FD.io VPP  v20.01-48-g3e0dafb74
Vector Packet Processing
proxy.c
Go to the documentation of this file.
1 /*
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:
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
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.
14 */
15 
16 #include <vnet/vnet.h>
17 #include <vlibmemory/api.h>
20 #include <hs_apps/proxy.h>
21 
23 
24 typedef struct
25 {
26  char uri[128];
30 
31 static void
32 proxy_cb_fn (void *data, u32 data_len)
33 {
36 
37  memset (&a, 0, sizeof (a));
38  a.api_context = pa->api_context;
39  a.app_index = pa->app_index;
40  a.uri = pa->uri;
41  vnet_connect_uri (&a);
42 }
43 
44 static void
46 {
47  if (vlib_get_thread_index () == 0)
48  {
49  vnet_connect_uri (a);
50  }
51  else
52  {
54  args.api_context = a->api_context;
55  args.app_index = a->app_index;
56  clib_memcpy (args.uri, a->uri, vec_len (a->uri));
57  vl_api_rpc_call_main_thread (proxy_cb_fn, (u8 *) & args, sizeof (args));
58  }
59 }
60 
61 static void
62 delete_proxy_session (session_t * s, int is_active_open)
63 {
64  proxy_main_t *pm = &proxy_main;
65  proxy_session_t *ps = 0;
66  vnet_disconnect_args_t _a, *a = &_a;
67  session_t *active_open_session = 0;
68  session_t *server_session = 0;
69  uword *p;
70  u64 handle;
71 
73 
74  handle = session_handle (s);
75 
76  if (is_active_open)
77  {
79  if (p == 0)
80  {
81  clib_warning ("proxy session for %s handle %lld (%llx) AWOL",
82  is_active_open ? "active open" : "server",
83  handle, handle);
84  }
85  else if (!pool_is_free_index (pm->sessions, p[0]))
86  {
87  active_open_session = s;
88  ps = pool_elt_at_index (pm->sessions, p[0]);
89  if (ps->vpp_server_handle != ~0)
90  server_session = session_get_from_handle (ps->vpp_server_handle);
91  }
92  }
93  else
94  {
95  p = hash_get (pm->proxy_session_by_server_handle, handle);
96  if (p == 0)
97  {
98  clib_warning ("proxy session for %s handle %lld (%llx) AWOL",
99  is_active_open ? "active open" : "server",
100  handle, handle);
101  }
102  else if (!pool_is_free_index (pm->sessions, p[0]))
103  {
104  server_session = s;
105  ps = pool_elt_at_index (pm->sessions, p[0]);
106  if (ps->vpp_active_open_handle != ~0)
107  active_open_session = session_get_from_handle
109  }
110  }
111 
112  if (ps)
113  {
114  if (CLIB_DEBUG > 0)
115  clib_memset (ps, 0xFE, sizeof (*ps));
116  pool_put (pm->sessions, ps);
117  }
118 
119  if (active_open_session)
120  {
121  a->handle = session_handle (active_open_session);
122  a->app_index = pm->active_open_app_index;
124  session_handle (active_open_session));
126  }
127 
128  if (server_session)
129  {
130  a->handle = session_handle (server_session);
131  a->app_index = pm->server_app_index;
133  session_handle (server_session));
135  }
136 
138 }
139 
140 static int
142 {
143  proxy_main_t *pm = &proxy_main;
144 
145  s->session_state = SESSION_STATE_READY;
146 
148 
149  return 0;
150 }
151 
152 static void
154 {
155  delete_proxy_session (s, 0 /* is_active_open */ );
156 }
157 
158 static void
160 {
161  clib_warning ("Reset session %U", format_session, s, 2);
162  delete_proxy_session (s, 0 /* is_active_open */ );
163 }
164 
165 static int
166 proxy_connected_callback (u32 app_index, u32 api_context,
167  session_t * s, u8 is_fail)
168 {
169  clib_warning ("called...");
170  return -1;
171 }
172 
173 static int
174 proxy_add_segment_callback (u32 client_index, u64 segment_handle)
175 {
176  clib_warning ("called...");
177  return -1;
178 }
179 
180 static int
182 {
183  u32 max_dequeue;
184  int actual_transfer __attribute__ ((unused));
185  svm_fifo_t *tx_fifo, *rx_fifo;
186  proxy_main_t *pm = &proxy_main;
187  u32 thread_index = vlib_get_thread_index ();
188  vnet_connect_args_t _a, *a = &_a;
189  proxy_session_t *ps;
190  int proxy_index;
191  uword *p;
192  svm_fifo_t *active_open_tx_fifo;
193 
194  ASSERT (s->thread_index == thread_index);
195 
198 
199  if (PREDICT_TRUE (p != 0))
200  {
202  active_open_tx_fifo = s->rx_fifo;
203 
204  /*
205  * Send event for active open tx fifo
206  */
207  if (svm_fifo_set_event (active_open_tx_fifo))
208  {
209  u32 ao_thread_index = active_open_tx_fifo->master_thread_index;
210  u32 ao_session_index = active_open_tx_fifo->master_session_index;
211  if (session_send_io_evt_to_thread_custom (&ao_session_index,
212  ao_thread_index,
214  clib_warning ("failed to enqueue tx evt");
215  }
216  }
217  else
218  {
219  rx_fifo = s->rx_fifo;
220  tx_fifo = s->tx_fifo;
221 
222  ASSERT (rx_fifo->master_thread_index == thread_index);
223  ASSERT (tx_fifo->master_thread_index == thread_index);
224 
225  max_dequeue = svm_fifo_max_dequeue_cons (s->rx_fifo);
226 
227  if (PREDICT_FALSE (max_dequeue == 0))
228  return 0;
229 
230  max_dequeue = clib_min (pm->rcv_buffer_size, max_dequeue);
231  actual_transfer = svm_fifo_peek (rx_fifo, 0 /* relative_offset */ ,
232  max_dequeue, pm->rx_buf[thread_index]);
233 
234  /* $$$ your message in this space: parse url, etc. */
235 
236  clib_memset (a, 0, sizeof (*a));
237 
238  pool_get (pm->sessions, ps);
239  clib_memset (ps, 0, sizeof (*ps));
240  ps->server_rx_fifo = rx_fifo;
241  ps->server_tx_fifo = tx_fifo;
243 
244  proxy_index = ps - pm->sessions;
245 
247  proxy_index);
248 
250 
251  a->uri = (char *) pm->client_uri;
252  a->api_context = proxy_index;
253  a->app_index = pm->active_open_app_index;
255  }
256 
257  return 0;
258 }
259 
260 static session_cb_vft_t proxy_session_cb_vft = {
262  .session_disconnect_callback = proxy_disconnect_callback,
263  .session_connected_callback = proxy_connected_callback,
264  .add_segment_callback = proxy_add_segment_callback,
265  .builtin_app_rx_callback = proxy_rx_callback,
266  .session_reset_callback = proxy_reset_callback
267 };
268 
269 static int
271  session_t * s, u8 is_fail)
272 {
273  proxy_main_t *pm = &proxy_main;
274  proxy_session_t *ps;
275  u8 thread_index = vlib_get_thread_index ();
276 
277  if (is_fail)
278  {
279  clib_warning ("connection %d failed!", opaque);
280  return 0;
281  }
282 
283  /*
284  * Setup proxy session handle.
285  */
287 
288  ps = pool_elt_at_index (pm->sessions, opaque);
290 
291  s->tx_fifo = ps->server_rx_fifo;
292  s->rx_fifo = ps->server_tx_fifo;
293 
294  /*
295  * Reset the active-open tx-fifo master indices so the active-open session
296  * will receive data, etc.
297  */
298  s->tx_fifo->master_session_index = s->session_index;
299  s->tx_fifo->master_thread_index = s->thread_index;
300 
301  /*
302  * Account for the active-open session's use of the fifos
303  * so they won't disappear until the last session which uses
304  * them disappears
305  */
306  s->tx_fifo->refcnt++;
307  s->rx_fifo->refcnt++;
308 
310  ps->vpp_active_open_handle, opaque);
311 
313 
314  /*
315  * Send event for active open tx fifo
316  */
317  ASSERT (s->thread_index == thread_index);
318  if (svm_fifo_set_event (s->tx_fifo))
320 
321  return 0;
322 }
323 
324 static void
326 {
327  delete_proxy_session (s, 1 /* is_active_open */ );
328 }
329 
330 static int
332 {
333  return 0;
334 }
335 
336 static void
338 {
339  delete_proxy_session (s, 1 /* is_active_open */ );
340 }
341 
342 static int
344 {
345  svm_fifo_t *proxy_tx_fifo;
346 
347  proxy_tx_fifo = s->rx_fifo;
348 
349  /*
350  * Send event for server tx fifo
351  */
352  if (svm_fifo_set_event (proxy_tx_fifo))
353  {
354  u8 thread_index = proxy_tx_fifo->master_thread_index;
355  u32 session_index = proxy_tx_fifo->master_session_index;
356  return session_send_io_evt_to_thread_custom (&session_index,
357  thread_index,
359  }
360 
361  return 0;
362 }
363 
364 /* *INDENT-OFF* */
365 static session_cb_vft_t active_open_clients = {
367  .session_connected_callback = active_open_connected_callback,
368  .session_accept_callback = active_open_create_callback,
369  .session_disconnect_callback = active_open_disconnect_callback,
370  .builtin_app_rx_callback = active_open_rx_callback
371 };
372 /* *INDENT-ON* */
373 
374 static int
376 {
377  proxy_main_t *pm = &proxy_main;
379  vnet_app_attach_args_t _a, *a = &_a;
380  u32 segment_size = 512 << 20;
381 
382  clib_memset (a, 0, sizeof (*a));
383  clib_memset (options, 0, sizeof (options));
384 
385  if (pm->private_segment_size)
386  segment_size = pm->private_segment_size;
387  a->name = format (0, "proxy-server");
388  a->api_client_index = pm->server_client_index;
389  a->session_cb_vft = &proxy_session_cb_vft;
390  a->options = options;
391  a->options[APP_OPTIONS_SEGMENT_SIZE] = segment_size;
392  a->options[APP_OPTIONS_RX_FIFO_SIZE] = pm->fifo_size;
393  a->options[APP_OPTIONS_TX_FIFO_SIZE] = pm->fifo_size;
395  a->options[APP_OPTIONS_PREALLOC_FIFO_PAIRS] =
396  pm->prealloc_fifos ? pm->prealloc_fifos : 0;
397 
398  a->options[APP_OPTIONS_FLAGS] = APP_OPTIONS_FLAGS_IS_BUILTIN;
399 
400  if (vnet_application_attach (a))
401  {
402  clib_warning ("failed to attach server");
403  return -1;
404  }
405  pm->server_app_index = a->app_index;
406 
407  vec_free (a->name);
408  return 0;
409 }
410 
411 static int
413 {
414  proxy_main_t *pm = &proxy_main;
415  vnet_app_attach_args_t _a, *a = &_a;
416  u64 options[16];
417 
418  clib_memset (a, 0, sizeof (*a));
419  clib_memset (options, 0, sizeof (options));
420 
421  a->api_client_index = pm->active_open_client_index;
422  a->session_cb_vft = &active_open_clients;
423  a->name = format (0, "proxy-active-open");
424 
425  options[APP_OPTIONS_ACCEPT_COOKIE] = 0x12345678;
426  options[APP_OPTIONS_SEGMENT_SIZE] = 512 << 20;
427  options[APP_OPTIONS_RX_FIFO_SIZE] = pm->fifo_size;
428  options[APP_OPTIONS_TX_FIFO_SIZE] = pm->fifo_size;
431  pm->prealloc_fifos ? pm->prealloc_fifos : 0;
432 
433  options[APP_OPTIONS_FLAGS] = APP_OPTIONS_FLAGS_IS_BUILTIN
434  | APP_OPTIONS_FLAGS_IS_PROXY;
435 
436  a->options = options;
437 
438  if (vnet_application_attach (a))
439  return -1;
440 
441  pm->active_open_app_index = a->app_index;
442 
443  vec_free (a->name);
444 
445  return 0;
446 }
447 
448 static int
450 {
451  proxy_main_t *pm = &proxy_main;
452  vnet_listen_args_t _a, *a = &_a;
453  clib_memset (a, 0, sizeof (*a));
454  a->app_index = pm->server_app_index;
455  a->uri = (char *) pm->server_uri;
456  return vnet_bind_uri (a);
457 }
458 
459 static int
461 {
462  proxy_main_t *pm = &proxy_main;
464  u32 num_threads;
465  int i;
466 
467  num_threads = 1 /* main thread */ + vtm->n_threads;
468  vec_validate (proxy_main.server_event_queue, num_threads - 1);
469  vec_validate (proxy_main.active_open_event_queue, num_threads - 1);
470  vec_validate (pm->rx_buf, num_threads - 1);
471 
472  for (i = 0; i < num_threads; i++)
473  vec_validate (pm->rx_buf[i], pm->rcv_buffer_size);
474 
475  if (proxy_server_attach ())
476  {
477  clib_warning ("failed to attach server app");
478  return -1;
479  }
480  if (proxy_server_listen ())
481  {
482  clib_warning ("failed to start listening");
483  return -1;
484  }
485  if (active_open_attach ())
486  {
487  clib_warning ("failed to attach active open app");
488  return -1;
489  }
490 
491  for (i = 0; i < num_threads; i++)
492  {
494 
496 
498  }
499 
500  return 0;
501 }
502 
503 static clib_error_t *
505  vlib_cli_command_t * cmd)
506 {
507  proxy_main_t *pm = &proxy_main;
508  char *default_server_uri = "tcp://0.0.0.0/23";
509  char *default_client_uri = "tcp://6.0.2.2/23";
510  int rv;
511  u64 tmp;
512 
513  pm->fifo_size = 64 << 10;
514  pm->rcv_buffer_size = 1024;
515  pm->prealloc_fifos = 0;
516  pm->private_segment_count = 0;
517  pm->private_segment_size = 0;
518  pm->server_uri = 0;
519  pm->client_uri = 0;
520 
522  {
523  if (unformat (input, "fifo-size %d", &pm->fifo_size))
524  pm->fifo_size <<= 10;
525  else if (unformat (input, "rcv-buf-size %d", &pm->rcv_buffer_size))
526  ;
527  else if (unformat (input, "prealloc-fifos %d", &pm->prealloc_fifos))
528  ;
529  else if (unformat (input, "private-segment-count %d",
530  &pm->private_segment_count))
531  ;
532  else if (unformat (input, "private-segment-size %U",
533  unformat_memory_size, &tmp))
534  {
535  if (tmp >= 0x100000000ULL)
536  return clib_error_return
537  (0, "private segment size %lld (%llu) too large", tmp, tmp);
538  pm->private_segment_size = tmp;
539  }
540  else if (unformat (input, "server-uri %s", &pm->server_uri))
541  vec_add1 (pm->server_uri, 0);
542  else if (unformat (input, "client-uri %s", &pm->client_uri))
543  vec_add1 (pm->client_uri, 0);
544  else
545  return clib_error_return (0, "unknown input `%U'",
546  format_unformat_error, input);
547  }
548 
549  if (!pm->server_uri)
550  {
551  clib_warning ("No server-uri provided, Using default: %s",
552  default_server_uri);
553  pm->server_uri = format (0, "%s%c", default_server_uri, 0);
554  }
555  if (!pm->client_uri)
556  {
557  clib_warning ("No client-uri provided, Using default: %s",
558  default_client_uri);
559  pm->client_uri = format (0, "%s%c", default_client_uri, 0);
560  }
561 
562  vnet_session_enable_disable (vm, 1 /* turn on session and transport */ );
563 
564  rv = proxy_server_create (vm);
565  switch (rv)
566  {
567  case 0:
568  break;
569  default:
570  return clib_error_return (0, "server_create returned %d", rv);
571  }
572 
573  return 0;
574 }
575 
576 /* *INDENT-OFF* */
577 VLIB_CLI_COMMAND (proxy_create_command, static) =
578 {
579  .path = "test proxy server",
580  .short_help = "test proxy server [server-uri <tcp://ip/port>]"
581  "[client-uri <tcp://ip/port>][fifo-size <nn>][rcv-buf-size <nn>]"
582  "[prealloc-fifos <nn>][private-segment-size <mem>]"
583  "[private-segment-count <nn>]",
584  .function = proxy_server_create_command_fn,
585 };
586 /* *INDENT-ON* */
587 
588 clib_error_t *
590 {
591  proxy_main_t *pm = &proxy_main;
592  pm->server_client_index = ~0;
593  pm->active_open_client_index = ~0;
596 
597  return 0;
598 }
599 
601 
602 /*
603 * fd.io coding-style-patch-verification: ON
604 *
605 * Local Variables:
606 * eval: (c-set-style "gnu")
607 * End:
608 */
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
Definition: vec.h:440
u64 vpp_active_open_handle
Definition: proxy.h:35
#define hash_set(h, key, value)
Definition: hash.h:255
#define clib_min(x, y)
Definition: clib.h:295
u32 private_segment_count
Number of private fifo segs.
Definition: proxy.h:61
#define hash_unset(h, key)
Definition: hash.h:261
u8 * format_session(u8 *s, va_list *args)
Format stream session as per the following format.
Definition: session_cli.c:101
a
Definition: bitmap.h:538
svm_fifo_t * tx_fifo
char uri[128]
Definition: proxy.c:26
struct _vnet_connect_args vnet_connect_args_t
#define PREDICT_TRUE(x)
Definition: clib.h:112
u32 session_index
Index in thread pool where session was allocated.
static int proxy_accept_callback(session_t *s)
Definition: proxy.c:141
unsigned long u64
Definition: types.h:89
static svm_msg_q_t * session_main_get_vpp_event_queue(u32 thread_index)
Definition: session.h:607
static void proxy_reset_callback(session_t *s)
Definition: proxy.c:159
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
svm_fifo_t * rx_fifo
Pointers to rx/tx buffers.
static int active_open_rx_callback(session_t *s)
Definition: proxy.c:343
static_always_inline void clib_spinlock_unlock_if_init(clib_spinlock_t *p)
Definition: lock.h:110
static clib_error_t * proxy_server_create_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: proxy.c:504
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:523
int svm_fifo_peek(svm_fifo_t *f, u32 offset, u32 len, u8 *dst)
Peek data from fifo.
Definition: svm_fifo.c:1007
int i
uword * proxy_session_by_server_handle
Definition: proxy.h:52
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:424
void(* session_reset_callback)(session_t *s)
Notify app that session was reset.
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
Definition: pool.h:237
unsigned char u8
Definition: types.h:56
struct _vnet_bind_args_t vnet_listen_args_t
static int active_open_create_callback(session_t *s)
Definition: proxy.c:331
svm_fifo_t * server_rx_fifo
Definition: proxy.h:31
static int active_open_connected_callback(u32 app_index, u32 opaque, session_t *s, u8 is_fail)
Definition: proxy.c:270
static session_handle_t session_handle(session_t *s)
struct _svm_fifo svm_fifo_t
#define clib_memcpy(d, s, n)
Definition: string.h:180
u8 prealloc_fifos
Request fifo preallocation.
Definition: proxy.h:79
u32 fifo_size
Definition: proxy.h:60
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:173
struct _vnet_disconnect_args_t vnet_disconnect_args_t
static u32 svm_fifo_max_dequeue_cons(svm_fifo_t *f)
Fifo max bytes to dequeue optimized for consumer.
Definition: svm_fifo.h:499
static session_cb_vft_t proxy_session_cb_vft
Definition: proxy.c:260
#define clib_error_return(e, args...)
Definition: error.h:99
void vl_api_rpc_call_main_thread(void *fp, u8 *data, u32 data_length)
Definition: vlib_api.c:607
unsigned int u32
Definition: types.h:88
int rcv_buffer_size
Definition: proxy.h:63
u32 server_app_index
server app index
Definition: proxy.h:48
int session_send_io_evt_to_thread(svm_fifo_t *f, session_evt_type_t evt_type)
Definition: session.c:80
struct _vnet_app_attach_args_t vnet_app_attach_args_t
clib_error_t * proxy_main_init(vlib_main_t *vm)
Definition: proxy.c:589
#define hash_get(h, key)
Definition: hash.h:249
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:519
proxy_session_t * sessions
Session pool, shared.
Definition: proxy.h:70
static session_t * session_get_from_handle(session_handle_t handle)
Definition: session.h:315
struct _unformat_input_t unformat_input_t
static void active_open_disconnect_callback(session_t *s)
Definition: proxy.c:337
static void proxy_cb_fn(void *data, u32 data_len)
Definition: proxy.c:32
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:287
#define PREDICT_FALSE(x)
Definition: clib.h:111
proxy_main_t proxy_main
Definition: proxy.c:22
static int proxy_server_create(vlib_main_t *vm)
Definition: proxy.c:460
vlib_main_t * vm
Definition: in2out_ed.c:1810
clib_error_t * vnet_session_enable_disable(vlib_main_t *vm, u8 is_en)
Definition: session.c:1606
u64 vpp_server_handle
Definition: proxy.h:34
int vnet_application_attach(vnet_app_attach_args_t *a)
Attach application to vpp.
Definition: application.c:815
static u8 svm_fifo_set_event(svm_fifo_t *f)
Set fifo event flag.
Definition: svm_fifo.h:749
svm_msg_q_t ** active_open_event_queue
Definition: proxy.h:43
#define UNFORMAT_END_OF_INPUT
Definition: format.h:145
u32 active_open_client_index
active open API client handle
Definition: proxy.h:49
static_always_inline uword vlib_get_thread_index(void)
Definition: threads.h:218
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:342
#define clib_warning(format, args...)
Definition: error.h:59
u32 server_client_index
server API client handle
Definition: proxy.h:47
static void proxy_call_main_thread(vnet_connect_args_t *a)
Definition: proxy.c:45
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
Definition: pool.h:284
u8 * server_uri
Definition: proxy.h:64
static void active_open_reset_callback(session_t *s)
Definition: proxy.c:325
svm_msg_q_t ** server_event_queue
per-thread vectors
Definition: proxy.h:42
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:152
u32 active_open_app_index
active open index after attach
Definition: proxy.h:50
#define hash_create(elts, value_bytes)
Definition: hash.h:696
#define ASSERT(truth)
static int proxy_server_attach()
Definition: proxy.c:375
static int proxy_connected_callback(u32 app_index, u32 api_context, session_t *s, u8 is_fail)
Definition: proxy.c:166
u8 data[128]
Definition: ipsec_types.api:87
uword * proxy_session_by_active_open_handle
Definition: proxy.h:53
static int proxy_rx_callback(session_t *s)
Definition: proxy.c:181
u8 ** rx_buf
intermediate rx buffers
Definition: proxy.h:44
static void delete_proxy_session(session_t *s, int is_active_open)
Definition: proxy.c:62
clib_spinlock_t sessions_lock
Definition: proxy.h:71
u8 thread_index
Index of the thread that allocated the session.
u32 private_segment_size
size of private fifo segs
Definition: proxy.h:62
static int active_open_attach(void)
Definition: proxy.c:412
svm_fifo_t * server_tx_fifo
Definition: proxy.h:32
static void proxy_disconnect_callback(session_t *s)
Definition: proxy.c:153
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
volatile u8 session_state
State in session layer state machine.
u64 uword
Definition: types.h:112
int vnet_bind_uri(vnet_listen_args_t *a)
int vnet_disconnect_session(vnet_disconnect_args_t *a)
Definition: application.c:1076
int session_send_io_evt_to_thread_custom(void *data, u32 thread_index, session_evt_type_t evt_type)
Definition: session.c:87
unformat_function_t unformat_memory_size
Definition: format.h:296
static int proxy_add_segment_callback(u32 client_index, u64 segment_handle)
Definition: proxy.c:174
static struct option options[]
Definition: main.c:52
static int proxy_server_listen()
Definition: proxy.c:449
u8 * format_unformat_error(u8 *s, va_list *va)
Definition: unformat.c:91
static vlib_thread_main_t * vlib_get_thread_main()
Definition: global_funcs.h:32
static session_cb_vft_t active_open_clients
Definition: proxy.c:365
int(* session_accept_callback)(session_t *new_session)
Notify server of newly accepted session.
int vnet_connect_uri(vnet_connect_args_t *a)
static_always_inline void clib_spinlock_lock_if_init(clib_spinlock_t *p)
Definition: lock.h:95
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:978
u8 * client_uri
Definition: proxy.h:65
static uword unformat_check_input(unformat_input_t *i)
Definition: format.h:171