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 <vlibmemory/api.h>
18 #include <vnet/session/application.h>
19 #include <vnet/session/application_interface.h>
20 #include <hs_apps/proxy.h>
21 #include <vnet/tcp/tcp.h>
23 proxy_main_t proxy_main;
32 } proxy_connect_args_t;
35 proxy_cb_fn (void *data, u32 data_len)
37 proxy_connect_args_t *pa = (proxy_connect_args_t *) data;
38 vnet_connect_args_t a;
40 memset (&a, 0, sizeof (a));
41 a.api_context = pa->api_context;
42 a.app_index = pa->app_index;
44 vnet_connect_uri (&a);
48 proxy_call_main_thread (vnet_connect_args_t * a)
50 if (vlib_get_thread_index () == 0)
56 proxy_connect_args_t args;
57 args.api_context = a->api_context;
58 args.app_index = a->app_index;
59 clib_memcpy (args.uri, a->uri, vec_len (a->uri));
60 vl_api_rpc_call_main_thread (proxy_cb_fn, (u8 *) & args, sizeof (args));
64 static proxy_session_t *
65 proxy_get_active_open (proxy_main_t * pm, session_handle_t handle)
67 proxy_session_t *ps = 0;
70 p = hash_get (pm->proxy_session_by_active_open_handle, handle);
72 ps = pool_elt_at_index (pm->sessions, p[0]);
76 static proxy_session_t *
77 proxy_get_passive_open (proxy_main_t * pm, session_handle_t handle)
79 proxy_session_t *ps = 0;
82 p = hash_get (pm->proxy_session_by_server_handle, handle);
84 ps = pool_elt_at_index (pm->sessions, p[0]);
89 proxy_try_close_session (session_t * s, int is_active_open)
91 proxy_main_t *pm = &proxy_main;
92 proxy_session_t *ps = 0;
93 vnet_disconnect_args_t _a, *a = &_a;
94 session_handle_t handle;
96 handle = session_handle (s);
98 clib_spinlock_lock_if_init (&pm->sessions_lock);
102 ps = proxy_get_active_open (pm, handle);
105 a->handle = ps->vpp_active_open_handle;
106 a->app_index = pm->active_open_app_index;
107 vnet_disconnect_session (a);
108 ps->ao_disconnected = 1;
110 if (!ps->po_disconnected)
112 ASSERT (ps->vpp_server_handle != SESSION_INVALID_HANDLE);
113 a->handle = ps->vpp_server_handle;
114 a->app_index = pm->server_app_index;
115 vnet_disconnect_session (a);
116 ps->po_disconnected = 1;
121 ps = proxy_get_passive_open (pm, handle);
124 a->handle = ps->vpp_server_handle;
125 a->app_index = pm->server_app_index;
126 vnet_disconnect_session (a);
127 ps->po_disconnected = 1;
129 if (!ps->ao_disconnected && !ps->active_open_establishing)
131 /* Proxy session closed before active open */
132 if (ps->vpp_active_open_handle != SESSION_INVALID_HANDLE)
134 a->handle = ps->vpp_active_open_handle;
135 a->app_index = pm->active_open_app_index;
136 vnet_disconnect_session (a);
138 ps->ao_disconnected = 1;
141 clib_spinlock_unlock_if_init (&pm->sessions_lock);
145 proxy_session_free (proxy_session_t * ps)
147 proxy_main_t *pm = &proxy_main;
149 clib_memset (ps, 0xFE, sizeof (*ps));
150 pool_put (pm->sessions, ps);
154 proxy_try_delete_session (session_t * s, u8 is_active_open)
156 proxy_main_t *pm = &proxy_main;
157 proxy_session_t *ps = 0;
158 session_handle_t handle;
160 handle = session_handle (s);
162 clib_spinlock_lock_if_init (&pm->sessions_lock);
166 ps = proxy_get_active_open (pm, handle);
169 ps->vpp_active_open_handle = SESSION_INVALID_HANDLE;
170 hash_unset (pm->proxy_session_by_active_open_handle, handle);
172 if (ps->vpp_server_handle == SESSION_INVALID_HANDLE)
173 proxy_session_free (ps);
177 ps = proxy_get_passive_open (pm, handle);
180 ps->vpp_server_handle = SESSION_INVALID_HANDLE;
181 hash_unset (pm->proxy_session_by_server_handle, handle);
183 if (ps->vpp_active_open_handle == SESSION_INVALID_HANDLE)
185 if (!ps->active_open_establishing)
186 proxy_session_free (ps);
189 clib_spinlock_unlock_if_init (&pm->sessions_lock);
193 common_fifo_tuning_callback (session_t * s, svm_fifo_t * f,
194 session_ft_action_t act, u32 bytes)
196 proxy_main_t *pm = &proxy_main;
198 segment_manager_t *sm = segment_manager_get (f->segment_manager);
199 fifo_segment_t *fs = segment_manager_get_segment (sm, f->segment_index);
201 u8 seg_usage = fifo_segment_get_mem_usage (fs);
202 u32 fifo_in_use = svm_fifo_max_dequeue_prod (f);
203 u32 fifo_size = svm_fifo_size (f);
204 u8 fifo_usage = fifo_in_use * 100 / fifo_size;
207 ASSERT (act < SESSION_FT_ACTION_N_ACTIONS);
209 if (act == SESSION_FT_ACTION_ENQUEUED)
211 if (seg_usage < pm->low_watermark && fifo_usage > 50)
212 update_size = fifo_in_use;
213 else if (seg_usage < pm->high_watermark && fifo_usage > 80)
214 update_size = fifo_in_use;
216 update_size = clib_min (update_size, sm->max_fifo_size - fifo_size);
218 svm_fifo_set_size (f, fifo_size + update_size);
222 if (seg_usage > pm->high_watermark || fifo_usage < 20)
224 else if (seg_usage > pm->low_watermark && fifo_usage < 50)
225 update_size = (bytes / 2);
227 ASSERT (fifo_size >= 4096);
228 update_size = clib_min (update_size, fifo_size - 4096);
230 svm_fifo_set_size (f, fifo_size - update_size);
237 proxy_accept_callback (session_t * s)
239 proxy_main_t *pm = &proxy_main;
242 clib_spinlock_lock_if_init (&pm->sessions_lock);
244 pool_get_zero (pm->sessions, ps);
245 ps->vpp_server_handle = session_handle (s);
246 ps->vpp_active_open_handle = SESSION_INVALID_HANDLE;
248 hash_set (pm->proxy_session_by_server_handle, ps->vpp_server_handle,
251 clib_spinlock_unlock_if_init (&pm->sessions_lock);
253 s->session_state = SESSION_STATE_READY;
259 proxy_disconnect_callback (session_t * s)
261 proxy_try_close_session (s, 0 /* is_active_open */ );
265 proxy_reset_callback (session_t * s)
267 proxy_try_close_session (s, 0 /* is_active_open */ );
271 proxy_connected_callback (u32 app_index, u32 api_context,
272 session_t * s, session_error_t err)
274 clib_warning ("called...");
279 proxy_add_segment_callback (u32 client_index, u64 segment_handle)
281 clib_warning ("called...");
286 proxy_rx_callback (session_t * s)
288 proxy_main_t *pm = &proxy_main;
289 u32 thread_index = vlib_get_thread_index ();
290 svm_fifo_t *ao_tx_fifo;
293 ASSERT (s->thread_index == thread_index);
295 clib_spinlock_lock_if_init (&pm->sessions_lock);
297 ps = proxy_get_passive_open (pm, session_handle (s));
300 if (PREDICT_TRUE (ps->vpp_active_open_handle != SESSION_INVALID_HANDLE))
302 clib_spinlock_unlock_if_init (&pm->sessions_lock);
304 ao_tx_fifo = s->rx_fifo;
307 * Send event for active open tx fifo
309 if (svm_fifo_set_event (ao_tx_fifo))
311 u32 ao_thread_index = ao_tx_fifo->master_thread_index;
312 u32 ao_session_index = ao_tx_fifo->master_session_index;
313 if (session_send_io_evt_to_thread_custom (&ao_session_index,
316 clib_warning ("failed to enqueue tx evt");
319 if (svm_fifo_max_enqueue (ao_tx_fifo) <= TCP_MSS)
320 svm_fifo_add_want_deq_ntf (ao_tx_fifo, SVM_FIFO_WANT_DEQ_NOTIF);
324 vnet_connect_args_t _a, *a = &_a;
325 svm_fifo_t *tx_fifo, *rx_fifo;
326 u32 max_dequeue, proxy_index;
327 int actual_transfer __attribute__ ((unused));
329 rx_fifo = s->rx_fifo;
330 tx_fifo = s->tx_fifo;
332 ASSERT (rx_fifo->master_thread_index == thread_index);
333 ASSERT (tx_fifo->master_thread_index == thread_index);
335 max_dequeue = svm_fifo_max_dequeue_cons (s->rx_fifo);
337 if (PREDICT_FALSE (max_dequeue == 0))
340 max_dequeue = clib_min (pm->rcv_buffer_size, max_dequeue);
341 actual_transfer = svm_fifo_peek (rx_fifo, 0 /* relative_offset */ ,
342 max_dequeue, pm->rx_buf[thread_index]);
344 /* $$$ your message in this space: parse url, etc. */
346 clib_memset (a, 0, sizeof (*a));
348 ps->server_rx_fifo = rx_fifo;
349 ps->server_tx_fifo = tx_fifo;
350 ps->active_open_establishing = 1;
351 proxy_index = ps - pm->sessions;
353 clib_spinlock_unlock_if_init (&pm->sessions_lock);
355 a->uri = (char *) pm->client_uri;
356 a->api_context = proxy_index;
357 a->app_index = pm->active_open_app_index;
358 proxy_call_main_thread (a);
365 proxy_force_ack (void *handlep)
367 transport_connection_t *tc;
370 ao_s = session_get_from_handle (pointer_to_uword (handlep));
371 tc = session_get_transport (ao_s);
372 tcp_send_ack ((tcp_connection_t *) tc);
376 proxy_tx_callback (session_t * proxy_s)
378 proxy_main_t *pm = &proxy_main;
382 min_free = clib_min (svm_fifo_size (proxy_s->tx_fifo) >> 3, 128 << 10);
383 if (svm_fifo_max_enqueue (proxy_s->tx_fifo) < min_free)
385 svm_fifo_add_want_deq_ntf (proxy_s->tx_fifo, SVM_FIFO_WANT_DEQ_NOTIF);
389 clib_spinlock_lock_if_init (&pm->sessions_lock);
391 ps = proxy_get_passive_open (pm, session_handle (proxy_s));
394 if (ps->vpp_active_open_handle == SESSION_INVALID_HANDLE)
397 /* Force ack on active open side to update rcv wnd. Make sure it's done on
398 * the right thread */
399 void *arg = uword_to_pointer (ps->vpp_active_open_handle, void *);
400 session_send_rpc_evt_to_thread (ps->server_rx_fifo->master_thread_index,
401 proxy_force_ack, arg);
403 clib_spinlock_unlock_if_init (&pm->sessions_lock);
409 proxy_cleanup_callback (session_t * s, session_cleanup_ntf_t ntf)
411 if (ntf == SESSION_CLEANUP_TRANSPORT)
414 proxy_try_delete_session (s, 0 /* is_active_open */ );
417 static session_cb_vft_t proxy_session_cb_vft = {
418 .session_accept_callback = proxy_accept_callback,
419 .session_disconnect_callback = proxy_disconnect_callback,
420 .session_connected_callback = proxy_connected_callback,
421 .add_segment_callback = proxy_add_segment_callback,
422 .builtin_app_rx_callback = proxy_rx_callback,
423 .builtin_app_tx_callback = proxy_tx_callback,
424 .session_reset_callback = proxy_reset_callback,
425 .session_cleanup_callback = proxy_cleanup_callback,
426 .fifo_tuning_callback = common_fifo_tuning_callback
430 active_open_connected_callback (u32 app_index, u32 opaque,
431 session_t * s, session_error_t err)
433 proxy_main_t *pm = &proxy_main;
435 u8 thread_index = vlib_get_thread_index ();
439 clib_warning ("connection %d failed!", opaque);
445 * Setup proxy session handle.
447 clib_spinlock_lock_if_init (&pm->sessions_lock);
449 ps = pool_elt_at_index (pm->sessions, opaque);
450 ps->vpp_active_open_handle = session_handle (s);
451 ps->active_open_establishing = 0;
453 /* Passive open session was already closed! */
454 if (ps->po_disconnected)
456 /* Setup everything for the cleanup notification */
457 hash_set (pm->proxy_session_by_active_open_handle,
458 ps->vpp_active_open_handle, opaque);
459 ps->ao_disconnected = 1;
460 clib_spinlock_unlock_if_init (&pm->sessions_lock);
464 s->tx_fifo = ps->server_rx_fifo;
465 s->rx_fifo = ps->server_tx_fifo;
468 * Reset the active-open tx-fifo master indices so the active-open session
469 * will receive data, etc.
471 s->tx_fifo->master_session_index = s->session_index;
472 s->tx_fifo->master_thread_index = s->thread_index;
475 * Account for the active-open session's use of the fifos
476 * so they won't disappear until the last session which uses
479 s->tx_fifo->refcnt++;
480 s->rx_fifo->refcnt++;
482 svm_fifo_init_ooo_lookup (s->tx_fifo, 1 /* deq ooo */ );
483 svm_fifo_init_ooo_lookup (s->rx_fifo, 0 /* enq ooo */ );
485 hash_set (pm->proxy_session_by_active_open_handle,
486 ps->vpp_active_open_handle, opaque);
488 clib_spinlock_unlock_if_init (&pm->sessions_lock);
491 * Send event for active open tx fifo
493 ASSERT (s->thread_index == thread_index);
494 if (svm_fifo_set_event (s->tx_fifo))
495 session_send_io_evt_to_thread (s->tx_fifo, SESSION_IO_EVT_TX);
501 active_open_reset_callback (session_t * s)
503 proxy_try_close_session (s, 1 /* is_active_open */ );
507 active_open_create_callback (session_t * s)
513 active_open_disconnect_callback (session_t * s)
515 proxy_try_close_session (s, 1 /* is_active_open */ );
519 active_open_rx_callback (session_t * s)
521 svm_fifo_t *proxy_tx_fifo;
523 proxy_tx_fifo = s->rx_fifo;
526 * Send event for server tx fifo
528 if (svm_fifo_set_event (proxy_tx_fifo))
530 u8 thread_index = proxy_tx_fifo->master_thread_index;
531 u32 session_index = proxy_tx_fifo->master_session_index;
532 return session_send_io_evt_to_thread_custom (&session_index,
537 if (svm_fifo_max_enqueue (proxy_tx_fifo) <= TCP_MSS)
538 svm_fifo_add_want_deq_ntf (proxy_tx_fifo, SVM_FIFO_WANT_DEQ_NOTIF);
544 active_open_tx_callback (session_t * ao_s)
546 proxy_main_t *pm = &proxy_main;
547 transport_connection_t *tc;
548 session_handle_t handle;
554 min_free = clib_min (svm_fifo_size (ao_s->tx_fifo) >> 3, 128 << 10);
555 if (svm_fifo_max_enqueue (ao_s->tx_fifo) < min_free)
557 svm_fifo_add_want_deq_ntf (ao_s->tx_fifo, SVM_FIFO_WANT_DEQ_NOTIF);
561 clib_spinlock_lock_if_init (&pm->sessions_lock);
563 handle = session_handle (ao_s);
564 p = hash_get (pm->proxy_session_by_active_open_handle, handle);
568 if (pool_is_free_index (pm->sessions, p[0]))
571 ps = pool_elt_at_index (pm->sessions, p[0]);
572 if (ps->vpp_server_handle == ~0)
575 proxy_s = session_get_from_handle (ps->vpp_server_handle);
577 /* Force ack on proxy side to update rcv wnd */
578 tc = session_get_transport (proxy_s);
579 tcp_send_ack ((tcp_connection_t *) tc);
581 clib_spinlock_unlock_if_init (&pm->sessions_lock);
587 active_open_cleanup_callback (session_t * s, session_cleanup_ntf_t ntf)
589 if (ntf == SESSION_CLEANUP_TRANSPORT)
592 proxy_try_delete_session (s, 1 /* is_active_open */ );
596 static session_cb_vft_t active_open_clients = {
597 .session_reset_callback = active_open_reset_callback,
598 .session_connected_callback = active_open_connected_callback,
599 .session_accept_callback = active_open_create_callback,
600 .session_disconnect_callback = active_open_disconnect_callback,
601 .session_cleanup_callback = active_open_cleanup_callback,
602 .builtin_app_rx_callback = active_open_rx_callback,
603 .builtin_app_tx_callback = active_open_tx_callback,
604 .fifo_tuning_callback = common_fifo_tuning_callback
609 proxy_server_attach ()
611 proxy_main_t *pm = &proxy_main;
612 u64 options[APP_OPTIONS_N_OPTIONS];
613 vnet_app_attach_args_t _a, *a = &_a;
614 u32 segment_size = 512 << 20;
616 clib_memset (a, 0, sizeof (*a));
617 clib_memset (options, 0, sizeof (options));
619 if (pm->private_segment_size)
620 segment_size = pm->private_segment_size;
621 a->name = format (0, "proxy-server");
622 a->api_client_index = pm->server_client_index;
623 a->session_cb_vft = &proxy_session_cb_vft;
624 a->options = options;
625 a->options[APP_OPTIONS_SEGMENT_SIZE] = segment_size;
626 a->options[APP_OPTIONS_RX_FIFO_SIZE] = pm->fifo_size;
627 a->options[APP_OPTIONS_TX_FIFO_SIZE] = pm->fifo_size;
628 a->options[APP_OPTIONS_MAX_FIFO_SIZE] = pm->max_fifo_size;
629 a->options[APP_OPTIONS_HIGH_WATERMARK] = (u64) pm->high_watermark;
630 a->options[APP_OPTIONS_LOW_WATERMARK] = (u64) pm->low_watermark;
631 a->options[APP_OPTIONS_PRIVATE_SEGMENT_COUNT] = pm->private_segment_count;
632 a->options[APP_OPTIONS_PREALLOC_FIFO_PAIRS] =
633 pm->prealloc_fifos ? pm->prealloc_fifos : 0;
635 a->options[APP_OPTIONS_FLAGS] = APP_OPTIONS_FLAGS_IS_BUILTIN;
637 if (vnet_application_attach (a))
639 clib_warning ("failed to attach server");
642 pm->server_app_index = a->app_index;
649 active_open_attach (void)
651 proxy_main_t *pm = &proxy_main;
652 vnet_app_attach_args_t _a, *a = &_a;
653 u64 options[APP_OPTIONS_N_OPTIONS];
655 clib_memset (a, 0, sizeof (*a));
656 clib_memset (options, 0, sizeof (options));
658 a->api_client_index = pm->active_open_client_index;
659 a->session_cb_vft = &active_open_clients;
660 a->name = format (0, "proxy-active-open");
662 options[APP_OPTIONS_ACCEPT_COOKIE] = 0x12345678;
663 options[APP_OPTIONS_SEGMENT_SIZE] = 512 << 20;
664 options[APP_OPTIONS_RX_FIFO_SIZE] = pm->fifo_size;
665 options[APP_OPTIONS_TX_FIFO_SIZE] = pm->fifo_size;
666 options[APP_OPTIONS_MAX_FIFO_SIZE] = pm->max_fifo_size;
667 options[APP_OPTIONS_HIGH_WATERMARK] = (u64) pm->high_watermark;
668 options[APP_OPTIONS_LOW_WATERMARK] = (u64) pm->low_watermark;
669 options[APP_OPTIONS_PRIVATE_SEGMENT_COUNT] = pm->private_segment_count;
670 options[APP_OPTIONS_PREALLOC_FIFO_PAIRS] =
671 pm->prealloc_fifos ? pm->prealloc_fifos : 0;
673 options[APP_OPTIONS_FLAGS] = APP_OPTIONS_FLAGS_IS_BUILTIN
674 | APP_OPTIONS_FLAGS_IS_PROXY;
676 a->options = options;
678 if (vnet_application_attach (a))
681 pm->active_open_app_index = a->app_index;
689 proxy_server_listen ()
691 proxy_main_t *pm = &proxy_main;
692 vnet_listen_args_t _a, *a = &_a;
693 clib_memset (a, 0, sizeof (*a));
694 a->app_index = pm->server_app_index;
695 a->uri = (char *) pm->server_uri;
696 return vnet_bind_uri (a);
700 proxy_server_create (vlib_main_t * vm)
702 proxy_main_t *pm = &proxy_main;
703 vlib_thread_main_t *vtm = vlib_get_thread_main ();
707 num_threads = 1 /* main thread */ + vtm->n_threads;
708 vec_validate (proxy_main.server_event_queue, num_threads - 1);
709 vec_validate (proxy_main.active_open_event_queue, num_threads - 1);
710 vec_validate (pm->rx_buf, num_threads - 1);
712 for (i = 0; i < num_threads; i++)
713 vec_validate (pm->rx_buf[i], pm->rcv_buffer_size);
715 if (proxy_server_attach ())
717 clib_warning ("failed to attach server app");
720 if (proxy_server_listen ())
722 clib_warning ("failed to start listening");
725 if (active_open_attach ())
727 clib_warning ("failed to attach active open app");
731 for (i = 0; i < num_threads; i++)
733 pm->active_open_event_queue[i] = session_main_get_vpp_event_queue (i);
735 ASSERT (pm->active_open_event_queue[i]);
737 pm->server_event_queue[i] = session_main_get_vpp_event_queue (i);
743 static clib_error_t *
744 proxy_server_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
745 vlib_cli_command_t * cmd)
747 proxy_main_t *pm = &proxy_main;
748 char *default_server_uri = "tcp://0.0.0.0/23";
749 char *default_client_uri = "tcp://6.0.2.2/23";
753 pm->fifo_size = 64 << 10;
754 pm->max_fifo_size = 128 << 20;
755 pm->high_watermark = 80;
756 pm->low_watermark = 50;
757 pm->rcv_buffer_size = 1024;
758 pm->prealloc_fifos = 0;
759 pm->private_segment_count = 0;
760 pm->private_segment_size = 0;
763 if (vlib_num_workers ())
764 clib_spinlock_init (&pm->sessions_lock);
766 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
768 if (unformat (input, "fifo-size %U",
769 unformat_memory_size, &pm->fifo_size))
771 else if (unformat (input, "max-fifo-size %U",
772 unformat_memory_size, &pm->max_fifo_size))
774 else if (unformat (input, "high-watermark %d", &tmp32))
775 pm->high_watermark = (u8) tmp32;
776 else if (unformat (input, "low-watermark %d", &tmp32))
777 pm->low_watermark = (u8) tmp32;
778 else if (unformat (input, "rcv-buf-size %d", &pm->rcv_buffer_size))
780 else if (unformat (input, "prealloc-fifos %d", &pm->prealloc_fifos))
782 else if (unformat (input, "private-segment-count %d",
783 &pm->private_segment_count))
785 else if (unformat (input, "private-segment-size %U",
786 unformat_memory_size, &tmp64))
788 if (tmp64 >= 0x100000000ULL)
789 return clib_error_return
790 (0, "private segment size %lld (%llu) too large", tmp64, tmp64);
791 pm->private_segment_size = tmp64;
793 else if (unformat (input, "server-uri %s", &pm->server_uri))
794 vec_add1 (pm->server_uri, 0);
795 else if (unformat (input, "client-uri %s", &pm->client_uri))
796 vec_add1 (pm->client_uri, 0);
798 return clib_error_return (0, "unknown input `%U'",
799 format_unformat_error, input);
804 clib_warning ("No server-uri provided, Using default: %s",
806 pm->server_uri = format (0, "%s%c", default_server_uri, 0);
810 clib_warning ("No client-uri provided, Using default: %s",
812 pm->client_uri = format (0, "%s%c", default_client_uri, 0);
815 vnet_session_enable_disable (vm, 1 /* turn on session and transport */ );
817 rv = proxy_server_create (vm);
823 return clib_error_return (0, "server_create returned %d", rv);
830 VLIB_CLI_COMMAND (proxy_create_command, static) =
832 .path = "test proxy server",
833 .short_help = "test proxy server [server-uri <tcp://ip/port>]"
834 "[client-uri <tcp://ip/port>][fifo-size <nn>[k|m]]"
835 "[max-fifo-size <nn>[k|m]][high-watermark <nn>]"
836 "[low-watermark <nn>][rcv-buf-size <nn>][prealloc-fifos <nn>]"
837 "[private-segment-size <mem>][private-segment-count <nn>]",
838 .function = proxy_server_create_command_fn,
843 proxy_main_init (vlib_main_t * vm)
845 proxy_main_t *pm = &proxy_main;
846 pm->server_client_index = ~0;
847 pm->active_open_client_index = ~0;
848 pm->proxy_session_by_active_open_handle = hash_create (0, sizeof (uword));
849 pm->proxy_session_by_server_handle = hash_create (0, sizeof (uword));
854 VLIB_INIT_FUNCTION (proxy_main_init);
857 * fd.io coding-style-patch-verification: ON
860 * eval: (c-set-style "gnu")