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 pool_put (hsm->sessions[hs->thread_index], hs);
141 memset (hs, 0xfa, sizeof (*hs));
145 http_server_session_lookup_add (u32 thread_index, u32 s_index, u32 hs_index)
147 http_server_main_t *hsm = &http_server_main;
148 vec_validate (hsm->session_to_http_session[thread_index], s_index);
149 hsm->session_to_http_session[thread_index][s_index] = hs_index;
153 http_server_session_lookup_del (u32 thread_index, u32 s_index)
155 http_server_main_t *hsm = &http_server_main;
156 hsm->session_to_http_session[thread_index][s_index] = ~0;
159 static http_session_t *
160 http_server_session_lookup (u32 thread_index, u32 s_index)
162 http_server_main_t *hsm = &http_server_main;
165 if (s_index < vec_len (hsm->session_to_http_session[thread_index]))
167 hs_index = hsm->session_to_http_session[thread_index][s_index];
168 return http_server_session_get (thread_index, hs_index);
175 http_server_session_timer_start (http_session_t * hs)
178 hs_handle = hs->thread_index << 24 | hs->session_index;
179 clib_spinlock_lock (&http_server_main.tw_lock);
180 hs->timer_handle = tw_timer_start_2t_1w_2048sl (&http_server_main.tw,
182 clib_spinlock_unlock (&http_server_main.tw_lock);
186 http_server_session_timer_stop (http_session_t * hs)
188 if (hs->timer_handle == ~0)
190 clib_spinlock_lock (&http_server_main.tw_lock);
191 tw_timer_stop_2t_1w_2048sl (&http_server_main.tw, hs->timer_handle);
192 clib_spinlock_unlock (&http_server_main.tw_lock);
196 http_server_session_disconnect (http_session_t * hs)
198 vnet_disconnect_args_t _a = { 0 }, *a = &_a;
199 a->handle = hs->vpp_session_handle;
200 a->app_index = http_server_main.app_index;
201 vnet_disconnect_session (a);
205 http_process_free (http_server_args * args)
207 vlib_node_runtime_t *rt;
208 vlib_main_t *vm = &vlib_global_main;
209 http_server_main_t *hsm = &http_server_main;
212 http_server_args **save_args;
214 node_index = args->node_index;
215 ASSERT (node_index != 0);
217 n = vlib_get_node (vm, node_index);
218 rt = vlib_node_get_runtime (vm, n->index);
219 save_args = vlib_node_get_runtime_data (vm, n->index);
221 /* Reset process session pointer */
222 clib_mem_free (*save_args);
225 /* Turn off the process node */
226 vlib_node_set_state (vm, rt->node_index, VLIB_NODE_STATE_DISABLED);
228 /* add node index to the freelist */
229 vec_add1 (hsm->free_http_cli_process_node_indices, node_index);
233 static const char *http_ok =
234 "HTTP/1.1 200 OK\r\n";
236 static const char *http_response =
237 "Content-Type: text/html\r\n"
238 "Expires: Mon, 11 Jan 1970 10:10:10 GMT\r\n"
239 "Connection: close \r\n"
240 "Pragma: no-cache\r\n"
241 "Content-Length: %d\r\n\r\n%s";
243 static const char *http_error_template =
245 "Content-Type: text/html\r\n"
246 "Expires: Mon, 11 Jan 1970 10:10:10 GMT\r\n"
247 "Connection: close\r\n"
248 "Pragma: no-cache\r\n"
249 "Content-Length: 0\r\n\r\n";
251 /* Header, including incantation to suppress favicon.ico requests */
252 static const char *html_header_template =
253 "<html><head><title>%v</title></head>"
254 "<link rel=\"icon\" href=\"data:,\">"
257 static const char *html_footer =
258 "</pre></body></html>\r\n";
260 static const char *html_header_static =
261 "<html><head><title>static reply</title></head>"
262 "<link rel=\"icon\" href=\"data:,\">"
263 "<body><pre>hello</pre></body></html>\r\n";
266 static u8 *static_http;
267 static u8 *static_ok;
270 http_cli_output (uword arg, u8 * buffer, uword buffer_bytes)
272 u8 **output_vecp = (u8 **) arg;
276 output_vec = *output_vecp;
278 offset = vec_len (output_vec);
279 vec_validate (output_vec, offset + buffer_bytes - 1);
280 clib_memcpy_fast (output_vec + offset, buffer, buffer_bytes);
282 *output_vecp = output_vec;
286 send_data (http_session_t * hs, u8 * data)
288 http_server_main_t *hsm = &http_server_main;
289 vnet_disconnect_args_t _a = { 0 }, *a = &_a;
290 vlib_main_t *vm = vlib_get_main ();
291 f64 last_sent_timer = vlib_time_now (vm);
292 u32 offset, bytes_to_send;
295 bytes_to_send = vec_len (data);
298 while (bytes_to_send > 0)
302 actual_transfer = svm_fifo_enqueue
303 (hs->tx_fifo, bytes_to_send, data + offset);
305 /* Made any progress? */
306 if (actual_transfer <= 0)
308 http_server_sessions_reader_unlock ();
309 vlib_process_suspend (vm, delay);
310 http_server_sessions_reader_lock ();
312 /* 10s deadman timer */
313 if (vlib_time_now (vm) > last_sent_timer + 10.0)
315 a->handle = hs->vpp_session_handle;
316 a->app_index = hsm->app_index;
317 vnet_disconnect_session (a);
320 /* Exponential backoff, within reason */
326 last_sent_timer = vlib_time_now (vm);
327 offset += actual_transfer;
328 bytes_to_send -= actual_transfer;
330 if (svm_fifo_set_event (hs->tx_fifo))
331 session_send_io_evt_to_thread (hs->tx_fifo,
332 SESSION_IO_EVT_TX_FLUSH);
339 send_error (http_session_t * hs, char *str)
343 data = format (0, http_error_template, str);
344 send_data (hs, data);
349 http_cli_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
352 u8 *request = 0, *reply = 0, *http = 0, *html = 0;
353 http_server_main_t *hsm = &http_server_main;
354 http_server_args **save_args;
355 http_server_args *args;
356 unformat_input_t input;
360 save_args = vlib_node_get_runtime_data (hsm->vlib_main, rt->node_index);
363 http_server_sessions_reader_lock ();
365 hs = http_server_session_get (args->thread_index, args->hs_index);
368 request = hs->rx_buf;
369 if (vec_len (request) < 7)
371 send_error (hs, "400 Bad Request");
375 for (i = 0; i < vec_len (request) - 4; i++)
377 if (request[i] == 'G' &&
378 request[i + 1] == 'E' &&
379 request[i + 2] == 'T' && request[i + 3] == ' ')
383 send_error (hs, "400 Bad Request");
388 vec_delete (request, i + 5, 0);
390 /* Replace slashes with spaces, stop at the end of the path */
394 if (request[i] == '/')
396 else if (request[i] == ' ')
398 /* vlib_cli_input is vector-based, no need for a NULL */
399 _vec_len (request) = i;
403 /* Should never happen */
404 if (i == vec_len (request))
408 /* Generate the html header */
409 html = format (0, html_header_template, request /* title */ );
411 /* Run the command */
412 unformat_init_vector (&input, vec_dup (request));
413 vlib_cli_input (vm, &input, http_cli_output, (uword) & reply);
414 unformat_free (&input);
417 /* Generate the html page */
418 html = format (html, "%v", reply);
419 html = format (html, html_footer);
420 /* And the http reply */
421 http = format (0, http_ok);
422 http = format (http, http_response, vec_len (html), html);
425 send_data (hs, http);
429 http_server_sessions_reader_unlock ();
434 http_process_free (args);
439 alloc_http_process (http_server_args * args)
443 http_server_main_t *hsm = &http_server_main;
444 vlib_main_t *vm = hsm->vlib_main;
445 uword l = vec_len (hsm->free_http_cli_process_node_indices);
446 http_server_args **save_args;
448 if (vec_len (hsm->free_http_cli_process_node_indices) > 0)
450 n = vlib_get_node (vm, hsm->free_http_cli_process_node_indices[l - 1]);
451 vlib_node_set_state (vm, n->index, VLIB_NODE_STATE_POLLING);
452 _vec_len (hsm->free_http_cli_process_node_indices) = l - 1;
456 static vlib_node_registration_t r = {
457 .function = http_cli_process,
458 .type = VLIB_NODE_TYPE_PROCESS,
459 .process_log2_n_stack_bytes = 16,
460 .runtime_data_bytes = sizeof (void *),
463 name = (char *) format (0, "http-cli-%d", l);
465 vlib_register_node (vm, &r);
468 n = vlib_get_node (vm, r.index);
471 /* Save the node index in the args. It won't be zero. */
472 args->node_index = n->index;
474 /* Save the args (pointer) in the node runtime */
475 save_args = vlib_node_get_runtime_data (vm, n->index);
476 *save_args = clib_mem_alloc (sizeof (*args));
477 clib_memcpy_fast (*save_args, args, sizeof (*args));
479 vlib_start_process (vm, n->runtime_index);
483 alloc_http_process_callback (void *cb_args)
485 alloc_http_process ((http_server_args *) cb_args);
489 session_rx_request (http_session_t * hs)
491 u32 max_dequeue, cursize;
494 cursize = vec_len (hs->rx_buf);
495 max_dequeue = svm_fifo_max_dequeue_cons (hs->rx_fifo);
496 if (PREDICT_FALSE (max_dequeue == 0))
499 vec_validate (hs->rx_buf, cursize + max_dequeue - 1);
500 n_read = app_recv_stream_raw (hs->rx_fifo, hs->rx_buf + cursize,
501 max_dequeue, 0, 0 /* peek */ );
502 ASSERT (n_read == max_dequeue);
503 if (svm_fifo_is_empty_cons (hs->rx_fifo))
504 svm_fifo_unset_event (hs->rx_fifo);
506 _vec_len (hs->rx_buf) = cursize + n_read;
511 http_server_rx_callback (session_t * s)
513 http_server_args args;
517 http_server_sessions_reader_lock ();
519 hs = http_server_session_lookup (s->thread_index, s->session_index);
520 if (!hs || hs->session_state != HTTP_STATE_ESTABLISHED)
523 rv = session_rx_request (hs);
527 /* send the command to a new/recycled vlib process */
528 args.hs_index = hs->session_index;
529 args.thread_index = hs->thread_index;
531 http_server_sessions_reader_unlock ();
533 /* Send RPC request to main thread */
534 if (vlib_get_thread_index () != 0)
535 vlib_rpc_call_main_thread (alloc_http_process_callback, (u8 *) & args,
538 alloc_http_process (&args);
543 http_server_rx_callback_static (session_t * s)
550 hs = http_server_session_lookup (s->thread_index, s->session_index);
551 if (!hs || hs->session_state == HTTP_STATE_CLOSED)
554 /* ok 200 was sent */
555 if (hs->session_state == HTTP_STATE_OK_SENT)
558 rv = session_rx_request (hs);
562 request = hs->rx_buf;
563 request_len = vec_len (request);
564 if (vec_len (request) < 7)
566 send_error (hs, "400 Bad Request");
570 for (i = 0; i < request_len - 4; i++)
572 if (request[i] == 'G' &&
573 request[i + 1] == 'E' &&
574 request[i + 2] == 'T' && request[i + 3] == ' ')
577 send_error (hs, "400 Bad Request");
582 /* check for the end sequence: /r/n/r/n */
583 if (request[request_len - 1] != 0xa || request[request_len - 3] != 0xa
584 || request[request_len - 2] != 0xd || request[request_len - 4] != 0xd)
587 /* send 200 OK first */
588 send_data (hs, static_ok);
589 hs->session_state = HTTP_STATE_OK_SENT;
593 send_data (hs, static_http);
596 http_server_session_disconnect (hs);
600 (void) svm_fifo_set_event (hs->rx_fifo);
601 session_send_io_evt_to_thread (hs->rx_fifo, SESSION_IO_EVT_BUILTIN_RX);
609 http_server_session_accept_callback (session_t * s)
611 http_server_main_t *hsm = &http_server_main;
614 hsm->vpp_queue[s->thread_index] =
615 session_main_get_vpp_event_queue (s->thread_index);
618 http_server_sessions_writer_lock ();
620 hs = http_server_session_alloc (s->thread_index);
621 http_server_session_lookup_add (s->thread_index, s->session_index,
623 hs->rx_fifo = s->rx_fifo;
624 hs->tx_fifo = s->tx_fifo;
625 hs->vpp_session_index = s->session_index;
626 hs->vpp_session_handle = session_handle (s);
627 hs->session_state = HTTP_STATE_ESTABLISHED;
628 http_server_session_timer_start (hs);
631 http_server_sessions_writer_unlock ();
633 s->session_state = SESSION_STATE_READY;
638 http_server_session_disconnect_callback (session_t * s)
640 http_server_main_t *hsm = &http_server_main;
641 vnet_disconnect_args_t _a = { 0 }, *a = &_a;
643 a->handle = session_handle (s);
644 a->app_index = hsm->app_index;
645 vnet_disconnect_session (a);
649 http_server_session_reset_callback (session_t * s)
651 http_server_main_t *hsm = &http_server_main;
652 vnet_disconnect_args_t _a = { 0 }, *a = &_a;
654 a->handle = session_handle (s);
655 a->app_index = hsm->app_index;
656 vnet_disconnect_session (a);
660 http_server_session_connected_callback (u32 app_index, u32 api_context,
661 session_t * s, session_error_t err)
663 clib_warning ("called...");
668 http_server_add_segment_callback (u32 client_index, u64 segment_handle)
670 clib_warning ("called...");
675 http_server_cleanup_callback (session_t * s, session_cleanup_ntf_t ntf)
677 http_server_main_t *hsm = &http_server_main;
680 if (ntf == SESSION_CLEANUP_TRANSPORT)
684 http_server_sessions_writer_lock ();
686 hs = http_server_session_lookup (s->thread_index, s->session_index);
690 http_server_session_lookup_del (hs->thread_index, hs->vpp_session_index);
691 vec_free (hs->rx_buf);
692 http_server_session_timer_stop (hs);
693 http_server_session_free (hs);
698 http_server_sessions_writer_unlock ();
701 static session_cb_vft_t http_server_session_cb_vft = {
702 .session_accept_callback = http_server_session_accept_callback,
703 .session_disconnect_callback = http_server_session_disconnect_callback,
704 .session_connected_callback = http_server_session_connected_callback,
705 .add_segment_callback = http_server_add_segment_callback,
706 .builtin_app_rx_callback = http_server_rx_callback,
707 .session_reset_callback = http_server_session_reset_callback,
708 .session_cleanup_callback = http_server_cleanup_callback,
712 http_server_attach ()
714 vnet_app_add_tls_cert_args_t _a_cert, *a_cert = &_a_cert;
715 vnet_app_add_tls_key_args_t _a_key, *a_key = &_a_key;
716 http_server_main_t *hsm = &http_server_main;
717 u64 options[APP_OPTIONS_N_OPTIONS];
718 vnet_app_attach_args_t _a, *a = &_a;
719 u32 segment_size = 128 << 20;
721 clib_memset (a, 0, sizeof (*a));
722 clib_memset (options, 0, sizeof (options));
724 if (hsm->private_segment_size)
725 segment_size = hsm->private_segment_size;
727 a->api_client_index = ~0;
728 a->name = format (0, "test_http_server");
729 a->session_cb_vft = &http_server_session_cb_vft;
730 a->options = options;
731 a->options[APP_OPTIONS_SEGMENT_SIZE] = segment_size;
732 a->options[APP_OPTIONS_RX_FIFO_SIZE] =
733 hsm->fifo_size ? hsm->fifo_size : 8 << 10;
734 a->options[APP_OPTIONS_TX_FIFO_SIZE] =
735 hsm->fifo_size ? hsm->fifo_size : 32 << 10;
736 a->options[APP_OPTIONS_FLAGS] = APP_OPTIONS_FLAGS_IS_BUILTIN;
737 a->options[APP_OPTIONS_PREALLOC_FIFO_PAIRS] = hsm->prealloc_fifos;
739 if (vnet_application_attach (a))
742 clib_warning ("failed to attach server");
746 hsm->app_index = a->app_index;
748 clib_memset (a_cert, 0, sizeof (*a_cert));
749 a_cert->app_index = a->app_index;
750 vec_validate (a_cert->cert, test_srv_crt_rsa_len);
751 clib_memcpy_fast (a_cert->cert, test_srv_crt_rsa, test_srv_crt_rsa_len);
752 vnet_app_add_tls_cert (a_cert);
754 clib_memset (a_key, 0, sizeof (*a_key));
755 a_key->app_index = a->app_index;
756 vec_validate (a_key->key, test_srv_key_rsa_len);
757 clib_memcpy_fast (a_key->key, test_srv_key_rsa, test_srv_key_rsa_len);
758 vnet_app_add_tls_key (a_key);
764 http_server_listen ()
766 http_server_main_t *hsm = &http_server_main;
767 vnet_listen_args_t _a, *a = &_a;
768 clib_memset (a, 0, sizeof (*a));
769 a->app_index = hsm->app_index;
770 a->uri = "tcp://0.0.0.0/80";
772 a->uri = (char *) hsm->uri;
773 return vnet_bind_uri (a);
777 http_server_session_close_cb (void *hs_handlep)
781 hs_handle = pointer_to_uword (hs_handlep);
782 hs = http_server_session_get (hs_handle >> 24, hs_handle & 0x00FFFFFF);
785 hs->timer_handle = ~0;
786 http_server_session_disconnect (hs);
790 http_expired_timers_dispatch (u32 * expired_timers)
795 for (i = 0; i < vec_len (expired_timers); i++)
797 /* Get session handle. The first bit is the timer id */
798 hs_handle = expired_timers[i] & 0x7FFFFFFF;
799 session_send_rpc_evt_to_thread (hs_handle >> 24,
800 http_server_session_close_cb,
801 uword_to_pointer (hs_handle, void *));
806 http_server_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
809 http_server_main_t *hsm = &http_server_main;
810 f64 now, timeout = 1.0;
811 uword *event_data = 0;
812 uword __clib_unused event_type;
816 vlib_process_wait_for_event_or_clock (vm, timeout);
817 now = vlib_time_now (vm);
818 event_type = vlib_process_get_events (vm, (uword **) & event_data);
821 clib_spinlock_lock (&http_server_main.tw_lock);
822 tw_timer_expire_timers_2t_1w_2048sl (&hsm->tw, now);
823 clib_spinlock_unlock (&http_server_main.tw_lock);
825 vec_reset_length (event_data);
831 VLIB_REGISTER_NODE (http_server_process_node) =
833 .function = http_server_process,
834 .type = VLIB_NODE_TYPE_PROCESS,
835 .name = "http-server-process",
836 .state = VLIB_NODE_STATE_DISABLED,
841 http_server_create (vlib_main_t * vm)
843 vlib_thread_main_t *vtm = vlib_get_thread_main ();
844 http_server_main_t *hsm = &http_server_main;
848 num_threads = 1 /* main thread */ + vtm->n_threads;
849 vec_validate (hsm->vpp_queue, num_threads - 1);
850 vec_validate (hsm->sessions, num_threads - 1);
851 vec_validate (hsm->session_to_http_session, num_threads - 1);
853 clib_rwlock_init (&hsm->sessions_lock);
854 clib_spinlock_init (&hsm->tw_lock);
856 if (http_server_attach ())
858 clib_warning ("failed to attach server");
861 if (http_server_listen ())
863 clib_warning ("failed to start listening");
867 /* Init timer wheel and process */
868 tw_timer_wheel_init_2t_1w_2048sl (&hsm->tw, http_expired_timers_dispatch,
869 1 /* timer interval */ , ~0);
870 vlib_node_set_state (vm, http_server_process_node.index,
871 VLIB_NODE_STATE_POLLING);
872 n = vlib_get_node (vm, http_server_process_node.index);
873 vlib_start_process (vm, n->runtime_index);
878 static clib_error_t *
879 http_server_create_command_fn (vlib_main_t * vm,
880 unformat_input_t * input,
881 vlib_cli_command_t * cmd)
883 http_server_main_t *hsm = &http_server_main;
884 unformat_input_t _line_input, *line_input = &_line_input;
889 hsm->prealloc_fifos = 0;
890 hsm->private_segment_size = 0;
894 /* Get a line of input. */
895 if (!unformat_user (input, unformat_line_input, line_input))
898 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
900 if (unformat (line_input, "static"))
903 if (unformat (line_input, "prealloc-fifos %d", &hsm->prealloc_fifos))
905 else if (unformat (line_input, "private-segment-size %U",
906 unformat_memory_size, &seg_size))
908 if (seg_size >= 0x100000000ULL)
910 vlib_cli_output (vm, "private segment size %llu, too large",
914 hsm->private_segment_size = seg_size;
916 else if (unformat (line_input, "fifo-size %d", &hsm->fifo_size))
917 hsm->fifo_size <<= 10;
918 else if (unformat (line_input, "uri %s", &hsm->uri))
921 return clib_error_return (0, "unknown input `%U'",
922 format_unformat_error, line_input);
924 unformat_free (line_input);
928 if (hsm->my_client_index != (u32) ~ 0)
929 return clib_error_return (0, "test http server is already running");
931 vnet_session_enable_disable (vm, 1 /* turn on TCP, etc. */ );
935 http_server_session_cb_vft.builtin_app_rx_callback =
936 http_server_rx_callback_static;
937 html = format (0, html_header_static);
938 static_http = format (0, http_response, vec_len (html), html);
939 static_ok = format (0, http_ok);
941 rv = http_server_create (vm);
947 return clib_error_return (0, "server_create returned %d", rv);
953 VLIB_CLI_COMMAND (http_server_create_command, static) =
955 .path = "test http server",
956 .short_help = "test http server",
957 .function = http_server_create_command_fn,
961 static clib_error_t *
962 http_server_main_init (vlib_main_t * vm)
964 http_server_main_t *hsm = &http_server_main;
966 hsm->my_client_index = ~0;
971 VLIB_INIT_FUNCTION (http_server_main_init);
974 * fd.io coding-style-patch-verification: ON
977 * eval: (c-set-style "gnu")