FD.io VPP  v19.04.4-rc0-5-ge88582fac
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>
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 
72  handle = session_handle (s);
73 
75  if (is_active_open)
76  {
77  active_open_session = s;
78 
80  if (p == 0)
81  {
82  clib_warning ("proxy session for %s handle %lld (%llx) AWOL",
83  is_active_open ? "active open" : "server",
84  handle, handle);
85  }
86  else if (!pool_is_free_index (pm->sessions, p[0]))
87  {
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  else
92  server_session = 0;
93  }
94  }
95  else
96  {
97  server_session = s;
98 
99  p = hash_get (pm->proxy_session_by_server_handle, handle);
100  if (p == 0)
101  {
102  clib_warning ("proxy session for %s handle %lld (%llx) AWOL",
103  is_active_open ? "active open" : "server",
104  handle, handle);
105  }
106  else if (!pool_is_free_index (pm->sessions, p[0]))
107  {
108  ps = pool_elt_at_index (pm->sessions, p[0]);
109  if (ps->vpp_active_open_handle != ~0)
110  active_open_session = session_get_from_handle
112  else
113  active_open_session = 0;
114  }
115  }
116 
117  if (ps)
118  {
119  if (CLIB_DEBUG > 0)
120  clib_memset (ps, 0xFE, sizeof (*ps));
121  pool_put (pm->sessions, ps);
122  }
123 
125 
126  if (active_open_session)
127  {
128  a->handle = session_handle (active_open_session);
129  a->app_index = pm->active_open_app_index;
131  session_handle (active_open_session));
133  }
134 
135  if (server_session)
136  {
137  a->handle = session_handle (server_session);
138  a->app_index = pm->server_app_index;
140  session_handle (server_session));
142  }
143 }
144 
145 static int
147 {
148  proxy_main_t *pm = &proxy_main;
149 
151 
153 
154  return 0;
155 }
156 
157 static void
159 {
160  delete_proxy_session (s, 0 /* is_active_open */ );
161 }
162 
163 static void
165 {
166  clib_warning ("Reset session %U", format_session, s, 2);
167  delete_proxy_session (s, 0 /* is_active_open */ );
168 }
169 
170 static int
171 proxy_connected_callback (u32 app_index, u32 api_context,
172  session_t * s, u8 is_fail)
173 {
174  clib_warning ("called...");
175  return -1;
176 }
177 
178 static int
179 proxy_add_segment_callback (u32 client_index, u64 segment_handle)
180 {
181  clib_warning ("called...");
182  return -1;
183 }
184 
185 static int
187 {
188  u32 max_dequeue;
189  int actual_transfer __attribute__ ((unused));
190  svm_fifo_t *tx_fifo, *rx_fifo;
191  proxy_main_t *pm = &proxy_main;
192  u32 thread_index = vlib_get_thread_index ();
193  vnet_connect_args_t _a, *a = &_a;
194  proxy_session_t *ps;
195  int proxy_index;
196  uword *p;
197  svm_fifo_t *active_open_tx_fifo;
198 
199  ASSERT (s->thread_index == thread_index);
200 
203 
204  if (PREDICT_TRUE (p != 0))
205  {
207  active_open_tx_fifo = s->rx_fifo;
208 
209  /*
210  * Send event for active open tx fifo
211  */
212  if (svm_fifo_set_event (active_open_tx_fifo))
213  {
214  u32 ao_thread_index = active_open_tx_fifo->master_thread_index;
215  u32 ao_session_index = active_open_tx_fifo->master_session_index;
216  if (session_send_io_evt_to_thread_custom (&ao_session_index,
217  ao_thread_index,
219  clib_warning ("failed to enqueue tx evt");
220  }
221  }
222  else
223  {
224  rx_fifo = s->rx_fifo;
225  tx_fifo = s->tx_fifo;
226 
227  ASSERT (rx_fifo->master_thread_index == thread_index);
228  ASSERT (tx_fifo->master_thread_index == thread_index);
229 
230  max_dequeue = svm_fifo_max_dequeue (s->rx_fifo);
231 
232  if (PREDICT_FALSE (max_dequeue == 0))
233  return 0;
234 
235  actual_transfer = svm_fifo_peek (rx_fifo, 0 /* relative_offset */ ,
236  max_dequeue, pm->rx_buf[thread_index]);
237 
238  /* $$$ your message in this space: parse url, etc. */
239 
240  clib_memset (a, 0, sizeof (*a));
241 
243  pool_get (pm->sessions, ps);
244  clib_memset (ps, 0, sizeof (*ps));
245  ps->server_rx_fifo = rx_fifo;
246  ps->server_tx_fifo = tx_fifo;
248 
249  proxy_index = ps - pm->sessions;
250 
252  proxy_index);
253 
255 
256  a->uri = (char *) pm->client_uri;
257  a->api_context = proxy_index;
258  a->app_index = pm->active_open_app_index;
260  }
261 
262  return 0;
263 }
264 
266  .session_accept_callback = proxy_accept_callback,
267  .session_disconnect_callback = proxy_disconnect_callback,
268  .session_connected_callback = proxy_connected_callback,
269  .add_segment_callback = proxy_add_segment_callback,
270  .builtin_app_rx_callback = proxy_rx_callback,
271  .session_reset_callback = proxy_reset_callback
272 };
273 
274 static int
276  session_t * s, u8 is_fail)
277 {
278  proxy_main_t *pm = &proxy_main;
279  proxy_session_t *ps;
280  u8 thread_index = vlib_get_thread_index ();
281 
282  if (is_fail)
283  {
284  clib_warning ("connection %d failed!", opaque);
285  return 0;
286  }
287 
288  /*
289  * Setup proxy session handle.
290  */
292 
293  ps = pool_elt_at_index (pm->sessions, opaque);
295 
296  s->tx_fifo = ps->server_rx_fifo;
297  s->rx_fifo = ps->server_tx_fifo;
298 
299  /*
300  * Reset the active-open tx-fifo master indices so the active-open session
301  * will receive data, etc.
302  */
303  s->tx_fifo->master_session_index = s->session_index;
304  s->tx_fifo->master_thread_index = s->thread_index;
305 
306  /*
307  * Account for the active-open session's use of the fifos
308  * so they won't disappear until the last session which uses
309  * them disappears
310  */
311  s->tx_fifo->refcnt++;
312  s->rx_fifo->refcnt++;
313 
315  ps->vpp_active_open_handle, opaque);
316 
318 
319  /*
320  * Send event for active open tx fifo
321  */
322  ASSERT (s->thread_index == thread_index);
323  if (svm_fifo_set_event (s->tx_fifo))
325 
326  return 0;
327 }
328 
329 static void
331 {
332  delete_proxy_session (s, 1 /* is_active_open */ );
333 }
334 
335 static int
337 {
338  return 0;
339 }
340 
341 static void
343 {
344  delete_proxy_session (s, 1 /* is_active_open */ );
345 }
346 
347 static int
349 {
350  svm_fifo_t *proxy_tx_fifo;
351 
352  proxy_tx_fifo = s->rx_fifo;
353 
354  /*
355  * Send event for server tx fifo
356  */
357  if (svm_fifo_set_event (proxy_tx_fifo))
358  {
359  u8 thread_index = proxy_tx_fifo->master_thread_index;
360  u32 session_index = proxy_tx_fifo->master_session_index;
361  return session_send_io_evt_to_thread_custom (&session_index,
362  thread_index,
364  }
365 
366  return 0;
367 }
368 
369 /* *INDENT-OFF* */
371  .session_reset_callback = active_open_reset_callback,
372  .session_connected_callback = active_open_connected_callback,
373  .session_accept_callback = active_open_create_callback,
374  .session_disconnect_callback = active_open_disconnect_callback,
375  .builtin_app_rx_callback = active_open_rx_callback
376 };
377 /* *INDENT-ON* */
378 
379 
380 static void
382 {
383  proxy_main_t *pm = &proxy_main;
384  api_main_t *am = &api_main;
385  vl_shmem_hdr_t *shmem_hdr;
386 
387  shmem_hdr = am->shmem_hdr;
388  pm->vl_input_queue = shmem_hdr->vl_input_queue;
389  pm->server_client_index =
390  vl_api_memclnt_create_internal ("proxy_server", pm->vl_input_queue);
392  vl_api_memclnt_create_internal ("proxy_active_open", pm->vl_input_queue);
393 }
394 
395 static int
397 {
398  proxy_main_t *pm = &proxy_main;
399  u64 options[APP_OPTIONS_N_OPTIONS];
400  vnet_app_attach_args_t _a, *a = &_a;
401  u32 segment_size = 512 << 20;
402 
403  clib_memset (a, 0, sizeof (*a));
404  clib_memset (options, 0, sizeof (options));
405 
406  if (pm->private_segment_size)
407  segment_size = pm->private_segment_size;
408  a->api_client_index = pm->server_client_index;
409  a->session_cb_vft = &proxy_session_cb_vft;
410  a->options = options;
411  a->options[APP_OPTIONS_SEGMENT_SIZE] = segment_size;
412  a->options[APP_OPTIONS_RX_FIFO_SIZE] = pm->fifo_size;
413  a->options[APP_OPTIONS_TX_FIFO_SIZE] = pm->fifo_size;
415  a->options[APP_OPTIONS_PREALLOC_FIFO_PAIRS] =
416  pm->prealloc_fifos ? pm->prealloc_fifos : 0;
417 
418  a->options[APP_OPTIONS_FLAGS] = APP_OPTIONS_FLAGS_IS_BUILTIN;
419 
420  if (vnet_application_attach (a))
421  {
422  clib_warning ("failed to attach server");
423  return -1;
424  }
425  pm->server_app_index = a->app_index;
426 
427  return 0;
428 }
429 
430 static int
432 {
433  proxy_main_t *pm = &proxy_main;
434  vnet_app_attach_args_t _a, *a = &_a;
435  u64 options[16];
436 
437  clib_memset (a, 0, sizeof (*a));
438  clib_memset (options, 0, sizeof (options));
439 
440  a->api_client_index = pm->active_open_client_index;
441  a->session_cb_vft = &active_open_clients;
442 
443  options[APP_OPTIONS_ACCEPT_COOKIE] = 0x12345678;
444  options[APP_OPTIONS_SEGMENT_SIZE] = 512 << 20;
445  options[APP_OPTIONS_RX_FIFO_SIZE] = pm->fifo_size;
446  options[APP_OPTIONS_TX_FIFO_SIZE] = pm->fifo_size;
449  pm->prealloc_fifos ? pm->prealloc_fifos : 0;
450 
451  options[APP_OPTIONS_FLAGS] = APP_OPTIONS_FLAGS_IS_BUILTIN
452  | APP_OPTIONS_FLAGS_IS_PROXY;
453 
454  a->options = options;
455 
456  if (vnet_application_attach (a))
457  return -1;
458 
459  pm->active_open_app_index = a->app_index;
460 
461  return 0;
462 }
463 
464 static int
466 {
467  proxy_main_t *pm = &proxy_main;
468  vnet_listen_args_t _a, *a = &_a;
469  clib_memset (a, 0, sizeof (*a));
470  a->app_index = pm->server_app_index;
471  a->uri = (char *) pm->server_uri;
472  return vnet_bind_uri (a);
473 }
474 
475 static int
477 {
478  proxy_main_t *pm = &proxy_main;
480  u32 num_threads;
481  int i;
482 
483  if (pm->server_client_index == (u32) ~ 0)
485 
486  num_threads = 1 /* main thread */ + vtm->n_threads;
487  vec_validate (proxy_main.server_event_queue, num_threads - 1);
488  vec_validate (proxy_main.active_open_event_queue, num_threads - 1);
489  vec_validate (pm->rx_buf, num_threads - 1);
490 
491  for (i = 0; i < num_threads; i++)
492  vec_validate (pm->rx_buf[i], pm->rcv_buffer_size);
493 
494  if (proxy_server_attach ())
495  {
496  clib_warning ("failed to attach server app");
497  return -1;
498  }
499  if (proxy_server_listen ())
500  {
501  clib_warning ("failed to start listening");
502  return -1;
503  }
504  if (active_open_attach ())
505  {
506  clib_warning ("failed to attach active open app");
507  return -1;
508  }
509 
510  for (i = 0; i < num_threads; i++)
511  {
513 
515 
517  }
518 
519  return 0;
520 }
521 
522 static clib_error_t *
524  vlib_cli_command_t * cmd)
525 {
526  proxy_main_t *pm = &proxy_main;
527  char *default_server_uri = "tcp://0.0.0.0/23";
528  char *default_client_uri = "tcp://6.0.2.2/23";
529  int rv;
530  u64 tmp;
531 
532  pm->fifo_size = 64 << 10;
533  pm->rcv_buffer_size = 1024;
534  pm->prealloc_fifos = 0;
535  pm->private_segment_count = 0;
536  pm->private_segment_size = 0;
537  pm->server_uri = 0;
538 
540  {
541  if (unformat (input, "fifo-size %d", &pm->fifo_size))
542  pm->fifo_size <<= 10;
543  else if (unformat (input, "rcv-buf-size %d", &pm->rcv_buffer_size))
544  ;
545  else if (unformat (input, "prealloc-fifos %d", &pm->prealloc_fifos))
546  ;
547  else if (unformat (input, "private-segment-count %d",
548  &pm->private_segment_count))
549  ;
550  else if (unformat (input, "private-segment-size %U",
551  unformat_memory_size, &tmp))
552  {
553  if (tmp >= 0x100000000ULL)
554  return clib_error_return
555  (0, "private segment size %lld (%llu) too large", tmp, tmp);
556  pm->private_segment_size = tmp;
557  }
558  else if (unformat (input, "server-uri %s", &pm->server_uri))
559  ;
560  else if (unformat (input, "client-uri %s", &pm->client_uri))
561  pm->client_uri = format (0, "%s%c", pm->client_uri, 0);
562  else
563  return clib_error_return (0, "unknown input `%U'",
564  format_unformat_error, input);
565  }
566 
567  if (!pm->server_uri)
568  {
569  clib_warning ("No server-uri provided, Using default: %s",
570  default_server_uri);
571  pm->server_uri = format (0, "%s%c", default_server_uri, 0);
572  }
573  if (!pm->client_uri)
574  {
575  clib_warning ("No client-uri provided, Using default: %s",
576  default_client_uri);
577  pm->client_uri = format (0, "%s%c", default_client_uri, 0);
578  }
579 
580  vnet_session_enable_disable (vm, 1 /* turn on session and transport */ );
581 
582  rv = proxy_server_create (vm);
583  switch (rv)
584  {
585  case 0:
586  break;
587  default:
588  return clib_error_return (0, "server_create returned %d", rv);
589  }
590 
591  return 0;
592 }
593 
594 /* *INDENT-OFF* */
595 VLIB_CLI_COMMAND (proxy_create_command, static) =
596 {
597  .path = "test proxy server",
598  .short_help = "test proxy server [server-uri <tcp://ip/port>]"
599  "[client-uri <tcp://ip/port>][fifo-size <nn>][rcv-buf-size <nn>]"
600  "[prealloc-fifos <nn>][private-segment-size <mem>]"
601  "[private-segment-count <nn>]",
602  .function = proxy_server_create_command_fn,
603 };
604 /* *INDENT-ON* */
605 
606 clib_error_t *
608 {
609  proxy_main_t *pm = &proxy_main;
610  pm->server_client_index = ~0;
611  pm->active_open_client_index = ~0;
614 
615  return 0;
616 }
617 
619 
620 /*
621 * fd.io coding-style-patch-verification: ON
622 *
623 * Local Variables:
624 * eval: (c-set-style "gnu")
625 * End:
626 */
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
Definition: vec.h:439
u64 vpp_active_open_handle
Definition: proxy.h:36
#define hash_set(h, key, value)
Definition: hash.h:255
u32 private_segment_count
Number of private fifo segs.
Definition: proxy.h:62
u32 vl_api_memclnt_create_internal(char *name, svm_queue_t *q)
Definition: memory_api.c:120
#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:55
a
Definition: bitmap.h:538
svm_fifo_t * tx_fifo
char uri[128]
Definition: proxy.c:26
svm_queue_t * vl_input_queue
vpe input queue
Definition: proxy.h:41
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:146
unsigned long u64
Definition: types.h:89
static svm_msg_q_t * session_main_get_vpp_event_queue(u32 thread_index)
Definition: session.h:505
static void proxy_reset_callback(session_t *s)
Definition: proxy.c:164
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:348
static_always_inline void clib_spinlock_unlock_if_init(clib_spinlock_t *p)
Definition: lock.h:98
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:523
int i
static void create_api_loopbacks(vlib_main_t *vm)
Definition: proxy.c:381
uword * proxy_session_by_server_handle
Definition: proxy.h:53
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:424
u8 data[128]
Definition: ipsec.api:248
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
Definition: pool.h:236
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:336
svm_fifo_t * server_rx_fifo
Definition: proxy.h:32
static int active_open_connected_callback(u32 app_index, u32 opaque, session_t *s, u8 is_fail)
Definition: proxy.c:275
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:80
u32 fifo_size
Definition: proxy.h:61
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:163
struct _vnet_disconnect_args_t vnet_disconnect_args_t
static u32 svm_fifo_max_dequeue(svm_fifo_t *f)
Definition: svm_fifo.h:129
static session_cb_vft_t proxy_session_cb_vft
Definition: proxy.c:265
#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:623
struct vl_shmem_hdr_ * shmem_hdr
Binary API shared-memory segment header pointer.
Definition: api_common.h:265
unsigned int u32
Definition: types.h:88
int rcv_buffer_size
Definition: proxy.h:64
u32 server_app_index
server app index
Definition: proxy.h:49
int session_send_io_evt_to_thread(svm_fifo_t *f, session_evt_type_t evt_type)
Definition: session.c:86
struct _vnet_app_attach_args_t vnet_app_attach_args_t
clib_error_t * proxy_main_init(vlib_main_t *vm)
Definition: proxy.c:607
#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:514
proxy_session_t * sessions
Session pool, shared.
Definition: proxy.h:71
static session_t * session_get_from_handle(session_handle_t handle)
Definition: session.h:227
struct _unformat_input_t unformat_input_t
static void active_open_disconnect_callback(session_t *s)
Definition: proxy.c:342
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:286
#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:476
clib_error_t * vnet_session_enable_disable(vlib_main_t *vm, u8 is_en)
Definition: session.c:1426
API main structure, used by both vpp and binary API clients.
Definition: api_common.h:202
u64 vpp_server_handle
Definition: proxy.h:35
int vnet_application_attach(vnet_app_attach_args_t *a)
Attach application to vpp.
Definition: application.c:839
static u8 svm_fifo_set_event(svm_fifo_t *f)
Sets fifo event flag.
Definition: svm_fifo.h:172
svm_msg_q_t ** active_open_event_queue
Definition: proxy.h:44
#define UNFORMAT_END_OF_INPUT
Definition: format.h:144
u32 active_open_client_index
active open API client handle
Definition: proxy.h:50
static_always_inline uword vlib_get_thread_index(void)
Definition: threads.h:212
vlib_main_t * vm
Definition: buffer.c:312
#define clib_warning(format, args...)
Definition: error.h:59
struct _stream_session_cb_vft session_cb_vft_t
u32 server_client_index
server API client handle
Definition: proxy.h:48
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:283
u8 * server_uri
Definition: proxy.h:65
static void active_open_reset_callback(session_t *s)
Definition: proxy.c:330
svm_queue_t * vl_input_queue
Definition: memory_shared.h:84
svm_msg_q_t ** server_event_queue
per-thread vectors
Definition: proxy.h:43
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:155
u32 active_open_app_index
active open index after attach
Definition: proxy.h:51
#define hash_create(elts, value_bytes)
Definition: hash.h:696
#define ASSERT(truth)
static int proxy_server_attach()
Definition: proxy.c:396
static int proxy_connected_callback(u32 app_index, u32 api_context, session_t *s, u8 is_fail)
Definition: proxy.c:171
uword * proxy_session_by_active_open_handle
Definition: proxy.h:54
static int proxy_rx_callback(session_t *s)
Definition: proxy.c:186
u8 ** rx_buf
intermediate rx buffers
Definition: proxy.h:45
static void delete_proxy_session(session_t *s, int is_active_open)
Definition: proxy.c:62
clib_spinlock_t sessions_lock
Definition: proxy.h:72
u8 thread_index
Index of the thread that allocated the session.
u32 private_segment_size
size of private fifo segs
Definition: proxy.h:63
static int active_open_attach(void)
Definition: proxy.c:431
svm_fifo_t * server_tx_fifo
Definition: proxy.h:33
static void proxy_disconnect_callback(session_t *s)
Definition: proxy.c:158
#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:1094
int session_send_io_evt_to_thread_custom(void *data, u32 thread_index, session_evt_type_t evt_type)
Definition: session.c:93
unformat_function_t unformat_memory_size
Definition: format.h:295
static int proxy_add_segment_callback(u32 client_index, u64 segment_handle)
Definition: proxy.c:179
static int proxy_server_listen()
Definition: proxy.c:465
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:370
int vnet_connect_uri(vnet_connect_args_t *a)
int svm_fifo_peek(svm_fifo_t *f, u32 relative_offset, u32 max_bytes, u8 *copy_here)
Definition: svm_fifo.c:726
api_main_t api_main
Definition: api_shared.c:35
static_always_inline void clib_spinlock_lock_if_init(clib_spinlock_t *p)
Definition: lock.h:82
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:972
u8 * client_uri
Definition: proxy.h:66
static uword unformat_check_input(unformat_input_t *i)
Definition: format.h:170