2 * Copyright (c) 2017-2019 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #include <vnet/vnet.h>
17 #include <vnet/session/application.h>
18 #include <vnet/session/application_interface.h>
19 #include <vnet/session/session.h>
20 #include <vppinfra/tw_timer_2t_1w_2048sl.h>
25 } http_process_event_t;
37 HTTP_STATE_ESTABLISHED,
39 } http_session_state_t;
42 CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
43 #define _(type, name) type name;
44 foreach_app_session_field
48 u32 vpp_session_index;
49 u64 vpp_session_handle;
55 http_session_t **sessions;
56 clib_rwlock_t sessions_lock;
57 u32 **session_to_http_session;
59 svm_msg_q_t **vpp_queue;
61 uword *handler_by_get_request;
63 u32 *free_http_cli_process_node_indices;
65 /* Sever's event queue */
66 svm_queue_t *vl_input_queue;
68 /* API client handle */
73 /* process node index for evnt scheduling */
76 tw_timer_wheel_2t_1w_2048sl_t tw;
77 clib_spinlock_t tw_lock;
80 u32 private_segment_size;
84 vlib_main_t *vlib_main;
87 http_server_main_t http_server_main;
90 http_server_sessions_reader_lock (void)
92 clib_rwlock_reader_lock (&http_server_main.sessions_lock);
96 http_server_sessions_reader_unlock (void)
98 clib_rwlock_reader_unlock (&http_server_main.sessions_lock);
102 http_server_sessions_writer_lock (void)
104 clib_rwlock_writer_lock (&http_server_main.sessions_lock);
108 http_server_sessions_writer_unlock (void)
110 clib_rwlock_writer_unlock (&http_server_main.sessions_lock);
113 static http_session_t *
114 http_server_session_alloc (u32 thread_index)
116 http_server_main_t *hsm = &http_server_main;
118 pool_get (hsm->sessions[thread_index], hs);
119 memset (hs, 0, sizeof (*hs));
120 hs->session_index = hs - hsm->sessions[thread_index];
121 hs->thread_index = thread_index;
122 hs->timer_handle = ~0;
126 static http_session_t *
127 http_server_session_get (u32 thread_index, u32 hs_index)
129 http_server_main_t *hsm = &http_server_main;
130 if (pool_is_free_index (hsm->sessions[thread_index], hs_index))
132 return pool_elt_at_index (hsm->sessions[thread_index], hs_index);
136 http_server_session_free (http_session_t * hs)
138 http_server_main_t *hsm = &http_server_main;
139 u32 thread = hs->thread_index;
141 memset (hs, 0xfa, sizeof (*hs));
142 pool_put (hsm->sessions[thread], hs);
146 http_server_session_lookup_add (u32 thread_index, u32 s_index, u32 hs_index)
148 http_server_main_t *hsm = &http_server_main;
149 vec_validate (hsm->session_to_http_session[thread_index], s_index);
150 hsm->session_to_http_session[thread_index][s_index] = hs_index;
154 http_server_session_lookup_del (u32 thread_index, u32 s_index)
156 http_server_main_t *hsm = &http_server_main;
157 hsm->session_to_http_session[thread_index][s_index] = ~0;
160 static http_session_t *
161 http_server_session_lookup (u32 thread_index, u32 s_index)
163 http_server_main_t *hsm = &http_server_main;
166 if (s_index < vec_len (hsm->session_to_http_session[thread_index]))
168 hs_index = hsm->session_to_http_session[thread_index][s_index];
169 return http_server_session_get (thread_index, hs_index);
176 http_server_session_timer_start (http_session_t * hs)
179 hs_handle = hs->thread_index << 24 | hs->session_index;
180 clib_spinlock_lock (&http_server_main.tw_lock);
181 hs->timer_handle = tw_timer_start_2t_1w_2048sl (&http_server_main.tw,
183 clib_spinlock_unlock (&http_server_main.tw_lock);
187 http_server_session_timer_stop (http_session_t * hs)
189 if (hs->timer_handle == ~0)
191 clib_spinlock_lock (&http_server_main.tw_lock);
192 tw_timer_stop_2t_1w_2048sl (&http_server_main.tw, hs->timer_handle);
193 clib_spinlock_unlock (&http_server_main.tw_lock);
197 http_server_session_disconnect (http_session_t * hs)
199 vnet_disconnect_args_t _a = { 0 }, *a = &_a;
200 a->handle = hs->vpp_session_handle;
201 a->app_index = http_server_main.app_index;
202 vnet_disconnect_session (a);
206 http_process_free (http_server_args * args)
208 vlib_node_runtime_t *rt;
209 vlib_main_t *vm = &vlib_global_main;
210 http_server_main_t *hsm = &http_server_main;
213 http_server_args **save_args;
215 node_index = args->node_index;
216 ASSERT (node_index != 0);
218 n = vlib_get_node (vm, node_index);
219 rt = vlib_node_get_runtime (vm, n->index);
220 save_args = vlib_node_get_runtime_data (vm, n->index);
222 /* Reset process session pointer */
223 clib_mem_free (*save_args);
226 /* Turn off the process node */
227 vlib_node_set_state (vm, rt->node_index, VLIB_NODE_STATE_DISABLED);
229 /* add node index to the freelist */
230 vec_add1 (hsm->free_http_cli_process_node_indices, node_index);
234 static const char *http_ok =
235 "HTTP/1.1 200 OK\r\n";
237 static const char *http_response =
238 "Content-Type: text/html\r\n"
239 "Expires: Mon, 11 Jan 1970 10:10:10 GMT\r\n"
240 "Connection: close \r\n"
241 "Pragma: no-cache\r\n"
242 "Content-Length: %d\r\n\r\n%v";
244 static const char *http_error_template =
246 "Content-Type: text/html\r\n"
247 "Expires: Mon, 11 Jan 1970 10:10:10 GMT\r\n"
248 "Connection: close\r\n"
249 "Pragma: no-cache\r\n"
250 "Content-Length: 0\r\n\r\n";
252 /* Header, including incantation to suppress favicon.ico requests */
253 static const char *html_header_template =
254 "<html><head><title>%v</title></head>"
255 "<link rel=\"icon\" href=\"data:,\">"
258 static const char *html_footer =
259 "</pre></body></html>\r\n";
261 static const char *html_header_static =
262 "<html><head><title>static reply</title></head>"
263 "<link rel=\"icon\" href=\"data:,\">"
264 "<body><pre>hello</pre></body></html>\r\n";
267 static u8 *static_http;
268 static u8 *static_ok;
271 http_cli_output (uword arg, u8 * buffer, uword buffer_bytes)
273 u8 **output_vecp = (u8 **) arg;
277 output_vec = *output_vecp;
279 offset = vec_len (output_vec);
280 vec_validate (output_vec, offset + buffer_bytes - 1);
281 clib_memcpy_fast (output_vec + offset, buffer, buffer_bytes);
283 *output_vecp = output_vec;
287 send_data (http_session_t * hs, u8 * data)
289 http_server_main_t *hsm = &http_server_main;
290 vnet_disconnect_args_t _a = { 0 }, *a = &_a;
291 vlib_main_t *vm = vlib_get_main ();
292 f64 last_sent_timer = vlib_time_now (vm);
293 u32 offset, bytes_to_send;
296 bytes_to_send = vec_len (data);
299 while (bytes_to_send > 0)
303 actual_transfer = svm_fifo_enqueue
304 (hs->tx_fifo, bytes_to_send, data + offset);
306 /* Made any progress? */
307 if (actual_transfer <= 0)
309 http_server_sessions_reader_unlock ();
310 vlib_process_suspend (vm, delay);
311 http_server_sessions_reader_lock ();
313 /* 10s deadman timer */
314 if (vlib_time_now (vm) > last_sent_timer + 10.0)
316 a->handle = hs->vpp_session_handle;
317 a->app_index = hsm->app_index;
318 vnet_disconnect_session (a);
321 /* Exponential backoff, within reason */
327 last_sent_timer = vlib_time_now (vm);
328 offset += actual_transfer;
329 bytes_to_send -= actual_transfer;
331 if (svm_fifo_set_event (hs->tx_fifo))
332 session_send_io_evt_to_thread (hs->tx_fifo,
333 SESSION_IO_EVT_TX_FLUSH);
340 send_error (http_session_t * hs, char *str)
344 data = format (0, http_error_template, str);
345 send_data (hs, data);
350 http_cli_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
353 u8 *request = 0, *reply = 0, *http = 0, *html = 0;
354 http_server_main_t *hsm = &http_server_main;
355 http_server_args **save_args;
356 http_server_args *args;
357 unformat_input_t input;
361 save_args = vlib_node_get_runtime_data (hsm->vlib_main, rt->node_index);
364 http_server_sessions_reader_lock ();
366 hs = http_server_session_get (args->thread_index, args->hs_index);
369 request = hs->rx_buf;
370 if (vec_len (request) < 7)
372 send_error (hs, "400 Bad Request");
376 for (i = 0; i < vec_len (request) - 4; i++)
378 if (request[i] == 'G' &&
379 request[i + 1] == 'E' &&
380 request[i + 2] == 'T' && request[i + 3] == ' ')
384 send_error (hs, "400 Bad Request");
389 vec_delete (request, i + 5, 0);
391 /* Replace slashes with spaces, stop at the end of the path */
395 if (request[i] == '/')
397 else if (request[i] == ' ')
399 /* vlib_cli_input is vector-based, no need for a NULL */
400 _vec_len (request) = i;
404 /* Should never happen */
405 if (i == vec_len (request))
409 /* Generate the html header */
410 html = format (0, html_header_template, request /* title */ );
412 /* Run the command */
413 unformat_init_vector (&input, vec_dup (request));
414 vlib_cli_input (vm, &input, http_cli_output, (uword) & reply);
415 unformat_free (&input);
418 /* Generate the html page */
419 html = format (html, "%v", reply);
420 html = format (html, html_footer);
421 /* And the http reply */
422 http = format (0, http_ok);
423 http = format (http, http_response, vec_len (html), html);
426 send_data (hs, http);
430 http_server_sessions_reader_unlock ();
435 http_process_free (args);
440 alloc_http_process (http_server_args * args)
444 http_server_main_t *hsm = &http_server_main;
445 vlib_main_t *vm = hsm->vlib_main;
446 uword l = vec_len (hsm->free_http_cli_process_node_indices);
447 http_server_args **save_args;
449 if (vec_len (hsm->free_http_cli_process_node_indices) > 0)
451 n = vlib_get_node (vm, hsm->free_http_cli_process_node_indices[l - 1]);
452 vlib_node_set_state (vm, n->index, VLIB_NODE_STATE_POLLING);
453 _vec_len (hsm->free_http_cli_process_node_indices) = l - 1;
457 static vlib_node_registration_t r = {
458 .function = http_cli_process,
459 .type = VLIB_NODE_TYPE_PROCESS,
460 .process_log2_n_stack_bytes = 16,
461 .runtime_data_bytes = sizeof (void *),
464 name = (char *) format (0, "http-cli-%d", l);
466 vlib_register_node (vm, &r);
469 n = vlib_get_node (vm, r.index);
472 /* Save the node index in the args. It won't be zero. */
473 args->node_index = n->index;
475 /* Save the args (pointer) in the node runtime */
476 save_args = vlib_node_get_runtime_data (vm, n->index);
477 *save_args = clib_mem_alloc (sizeof (*args));
478 clib_memcpy_fast (*save_args, args, sizeof (*args));
480 vlib_start_process (vm, n->runtime_index);
484 alloc_http_process_callback (void *cb_args)
486 alloc_http_process ((http_server_args *) cb_args);
490 session_rx_request (http_session_t * hs)
492 u32 max_dequeue, cursize;
495 cursize = vec_len (hs->rx_buf);
496 max_dequeue = svm_fifo_max_dequeue_cons (hs->rx_fifo);
497 if (PREDICT_FALSE (max_dequeue == 0))
500 vec_validate (hs->rx_buf, cursize + max_dequeue - 1);
501 n_read = app_recv_stream_raw (hs->rx_fifo, hs->rx_buf + cursize,
502 max_dequeue, 0, 0 /* peek */ );
503 ASSERT (n_read == max_dequeue);
504 if (svm_fifo_is_empty_cons (hs->rx_fifo))
505 svm_fifo_unset_event (hs->rx_fifo);
507 _vec_len (hs->rx_buf) = cursize + n_read;
512 http_server_rx_callback (session_t * s)
514 http_server_args args;
518 http_server_sessions_reader_lock ();
520 hs = http_server_session_lookup (s->thread_index, s->session_index);
521 if (!hs || hs->session_state != HTTP_STATE_ESTABLISHED)
524 rv = session_rx_request (hs);
528 /* send the command to a new/recycled vlib process */
529 args.hs_index = hs->session_index;
530 args.thread_index = hs->thread_index;
532 http_server_sessions_reader_unlock ();
534 /* Send RPC request to main thread */
535 if (vlib_get_thread_index () != 0)
536 vlib_rpc_call_main_thread (alloc_http_process_callback, (u8 *) & args,
539 alloc_http_process (&args);
544 http_server_rx_callback_static (session_t * s)
551 hs = http_server_session_lookup (s->thread_index, s->session_index);
552 if (!hs || hs->session_state == HTTP_STATE_CLOSED)
555 /* ok 200 was sent */
556 if (hs->session_state == HTTP_STATE_OK_SENT)
559 rv = session_rx_request (hs);
563 request = hs->rx_buf;
564 request_len = vec_len (request);
565 if (vec_len (request) < 7)
567 send_error (hs, "400 Bad Request");
571 for (i = 0; i < request_len - 4; i++)
573 if (request[i] == 'G' &&
574 request[i + 1] == 'E' &&
575 request[i + 2] == 'T' && request[i + 3] == ' ')
578 send_error (hs, "400 Bad Request");
583 /* check for the end sequence: /r/n/r/n */
584 if (request[request_len - 1] != 0xa || request[request_len - 3] != 0xa
585 || request[request_len - 2] != 0xd || request[request_len - 4] != 0xd)
588 /* send 200 OK first */
589 send_data (hs, static_ok);
590 hs->session_state = HTTP_STATE_OK_SENT;
594 send_data (hs, static_http);
597 http_server_session_disconnect (hs);
601 (void) svm_fifo_set_event (hs->rx_fifo);
602 session_send_io_evt_to_thread (hs->rx_fifo, SESSION_IO_EVT_BUILTIN_RX);
610 http_server_session_accept_callback (session_t * s)
612 http_server_main_t *hsm = &http_server_main;
615 hsm->vpp_queue[s->thread_index] =
616 session_main_get_vpp_event_queue (s->thread_index);
619 http_server_sessions_writer_lock ();
621 hs = http_server_session_alloc (s->thread_index);
622 http_server_session_lookup_add (s->thread_index, s->session_index,
624 hs->rx_fifo = s->rx_fifo;
625 hs->tx_fifo = s->tx_fifo;
626 hs->vpp_session_index = s->session_index;
627 hs->vpp_session_handle = session_handle (s);
628 hs->session_state = HTTP_STATE_ESTABLISHED;
629 http_server_session_timer_start (hs);
632 http_server_sessions_writer_unlock ();
634 s->session_state = SESSION_STATE_READY;
639 http_server_session_disconnect_callback (session_t * s)
641 http_server_main_t *hsm = &http_server_main;
642 vnet_disconnect_args_t _a = { 0 }, *a = &_a;
644 a->handle = session_handle (s);
645 a->app_index = hsm->app_index;
646 vnet_disconnect_session (a);
650 http_server_session_reset_callback (session_t * s)
652 http_server_main_t *hsm = &http_server_main;
653 vnet_disconnect_args_t _a = { 0 }, *a = &_a;
655 a->handle = session_handle (s);
656 a->app_index = hsm->app_index;
657 vnet_disconnect_session (a);
661 http_server_session_connected_callback (u32 app_index, u32 api_context,
662 session_t * s, session_error_t err)
664 clib_warning ("called...");
669 http_server_add_segment_callback (u32 client_index, u64 segment_handle)
671 clib_warning ("called...");
676 http_server_cleanup_callback (session_t * s, session_cleanup_ntf_t ntf)
678 http_server_main_t *hsm = &http_server_main;
681 if (ntf == SESSION_CLEANUP_TRANSPORT)
685 http_server_sessions_writer_lock ();
687 hs = http_server_session_lookup (s->thread_index, s->session_index);
691 http_server_session_lookup_del (hs->thread_index, hs->vpp_session_index);
692 vec_free (hs->rx_buf);
693 http_server_session_timer_stop (hs);
694 http_server_session_free (hs);
699 http_server_sessions_writer_unlock ();
702 static session_cb_vft_t http_server_session_cb_vft = {
703 .session_accept_callback = http_server_session_accept_callback,
704 .session_disconnect_callback = http_server_session_disconnect_callback,
705 .session_connected_callback = http_server_session_connected_callback,
706 .add_segment_callback = http_server_add_segment_callback,
707 .builtin_app_rx_callback = http_server_rx_callback,
708 .session_reset_callback = http_server_session_reset_callback,
709 .session_cleanup_callback = http_server_cleanup_callback,
713 http_server_attach ()
715 vnet_app_add_tls_cert_args_t _a_cert, *a_cert = &_a_cert;
716 vnet_app_add_tls_key_args_t _a_key, *a_key = &_a_key;
717 http_server_main_t *hsm = &http_server_main;
718 u64 options[APP_OPTIONS_N_OPTIONS];
719 vnet_app_attach_args_t _a, *a = &_a;
720 u32 segment_size = 128 << 20;
722 clib_memset (a, 0, sizeof (*a));
723 clib_memset (options, 0, sizeof (options));
725 if (hsm->private_segment_size)
726 segment_size = hsm->private_segment_size;
728 a->api_client_index = ~0;
729 a->name = format (0, "test_http_server");
730 a->session_cb_vft = &http_server_session_cb_vft;
731 a->options = options;
732 a->options[APP_OPTIONS_SEGMENT_SIZE] = segment_size;
733 a->options[APP_OPTIONS_RX_FIFO_SIZE] =
734 hsm->fifo_size ? hsm->fifo_size : 8 << 10;
735 a->options[APP_OPTIONS_TX_FIFO_SIZE] =
736 hsm->fifo_size ? hsm->fifo_size : 32 << 10;
737 a->options[APP_OPTIONS_FLAGS] = APP_OPTIONS_FLAGS_IS_BUILTIN;
738 a->options[APP_OPTIONS_PREALLOC_FIFO_PAIRS] = hsm->prealloc_fifos;
740 if (vnet_application_attach (a))
743 clib_warning ("failed to attach server");
747 hsm->app_index = a->app_index;
749 clib_memset (a_cert, 0, sizeof (*a_cert));
750 a_cert->app_index = a->app_index;
751 vec_validate (a_cert->cert, test_srv_crt_rsa_len);
752 clib_memcpy_fast (a_cert->cert, test_srv_crt_rsa, test_srv_crt_rsa_len);
753 vnet_app_add_tls_cert (a_cert);
755 clib_memset (a_key, 0, sizeof (*a_key));
756 a_key->app_index = a->app_index;
757 vec_validate (a_key->key, test_srv_key_rsa_len);
758 clib_memcpy_fast (a_key->key, test_srv_key_rsa, test_srv_key_rsa_len);
759 vnet_app_add_tls_key (a_key);
765 http_server_listen ()
767 http_server_main_t *hsm = &http_server_main;
768 vnet_listen_args_t _a, *a = &_a;
769 clib_memset (a, 0, sizeof (*a));
770 a->app_index = hsm->app_index;
771 a->uri = "tcp://0.0.0.0/80";
773 a->uri = (char *) hsm->uri;
774 return vnet_bind_uri (a);
778 http_server_session_close_cb (void *hs_handlep)
782 hs_handle = pointer_to_uword (hs_handlep);
783 hs = http_server_session_get (hs_handle >> 24, hs_handle & 0x00FFFFFF);
786 hs->timer_handle = ~0;
787 http_server_session_disconnect (hs);
791 http_expired_timers_dispatch (u32 * expired_timers)
796 for (i = 0; i < vec_len (expired_timers); i++)
798 /* Get session handle. The first bit is the timer id */
799 hs_handle = expired_timers[i] & 0x7FFFFFFF;
800 session_send_rpc_evt_to_thread (hs_handle >> 24,
801 http_server_session_close_cb,
802 uword_to_pointer (hs_handle, void *));
807 http_server_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
810 http_server_main_t *hsm = &http_server_main;
811 f64 now, timeout = 1.0;
812 uword *event_data = 0;
813 uword __clib_unused event_type;
817 vlib_process_wait_for_event_or_clock (vm, timeout);
818 now = vlib_time_now (vm);
819 event_type = vlib_process_get_events (vm, (uword **) & event_data);
822 clib_spinlock_lock (&http_server_main.tw_lock);
823 tw_timer_expire_timers_2t_1w_2048sl (&hsm->tw, now);
824 clib_spinlock_unlock (&http_server_main.tw_lock);
826 vec_reset_length (event_data);
832 VLIB_REGISTER_NODE (http_server_process_node) =
834 .function = http_server_process,
835 .type = VLIB_NODE_TYPE_PROCESS,
836 .name = "http-server-process",
837 .state = VLIB_NODE_STATE_DISABLED,
842 http_server_create (vlib_main_t * vm)
844 vlib_thread_main_t *vtm = vlib_get_thread_main ();
845 http_server_main_t *hsm = &http_server_main;
849 num_threads = 1 /* main thread */ + vtm->n_threads;
850 vec_validate (hsm->vpp_queue, num_threads - 1);
851 vec_validate (hsm->sessions, num_threads - 1);
852 vec_validate (hsm->session_to_http_session, num_threads - 1);
854 clib_rwlock_init (&hsm->sessions_lock);
855 clib_spinlock_init (&hsm->tw_lock);
857 if (http_server_attach ())
859 clib_warning ("failed to attach server");
862 if (http_server_listen ())
864 clib_warning ("failed to start listening");
868 /* Init timer wheel and process */
869 tw_timer_wheel_init_2t_1w_2048sl (&hsm->tw, http_expired_timers_dispatch,
870 1 /* timer interval */ , ~0);
871 vlib_node_set_state (vm, http_server_process_node.index,
872 VLIB_NODE_STATE_POLLING);
873 n = vlib_get_node (vm, http_server_process_node.index);
874 vlib_start_process (vm, n->runtime_index);
879 static clib_error_t *
880 http_server_create_command_fn (vlib_main_t * vm,
881 unformat_input_t * input,
882 vlib_cli_command_t * cmd)
884 http_server_main_t *hsm = &http_server_main;
885 unformat_input_t _line_input, *line_input = &_line_input;
890 hsm->prealloc_fifos = 0;
891 hsm->private_segment_size = 0;
895 /* Get a line of input. */
896 if (!unformat_user (input, unformat_line_input, line_input))
899 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
901 if (unformat (line_input, "static"))
904 if (unformat (line_input, "prealloc-fifos %d", &hsm->prealloc_fifos))
906 else if (unformat (line_input, "private-segment-size %U",
907 unformat_memory_size, &seg_size))
909 if (seg_size >= 0x100000000ULL)
911 vlib_cli_output (vm, "private segment size %llu, too large",
915 hsm->private_segment_size = seg_size;
917 else if (unformat (line_input, "fifo-size %d", &hsm->fifo_size))
918 hsm->fifo_size <<= 10;
919 else if (unformat (line_input, "uri %s", &hsm->uri))
922 return clib_error_return (0, "unknown input `%U'",
923 format_unformat_error, line_input);
925 unformat_free (line_input);
929 if (hsm->my_client_index != (u32) ~ 0)
930 return clib_error_return (0, "test http server is already running");
932 vnet_session_enable_disable (vm, 1 /* turn on TCP, etc. */ );
936 http_server_session_cb_vft.builtin_app_rx_callback =
937 http_server_rx_callback_static;
938 html = format (0, html_header_static);
939 static_http = format (0, http_response, vec_len (html), html);
940 static_ok = format (0, http_ok);
942 rv = http_server_create (vm);
948 return clib_error_return (0, "server_create returned %d", rv);
954 VLIB_CLI_COMMAND (http_server_create_command, static) =
956 .path = "test http server",
957 .short_help = "test http server",
958 .function = http_server_create_command_fn,
962 static clib_error_t *
963 http_server_main_init (vlib_main_t * vm)
965 http_server_main_t *hsm = &http_server_main;
967 hsm->my_client_index = ~0;
972 VLIB_INIT_FUNCTION (http_server_main_init);
975 * fd.io coding-style-patch-verification: ON
978 * eval: (c-set-style "gnu")