FD.io VPP  v19.04.4-rc0-5-ge88582fac
Vector Packet Processing
echo_server.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 <vnet/session/session.h>
21 
22 typedef struct
23 {
24  /*
25  * Server app parameters
26  */
28  svm_queue_t *vl_input_queue; /**< Sever's event queue */
29 
30  u32 app_index; /**< Server app index */
31  u32 my_client_index; /**< API client handle */
32  u32 node_index; /**< process node index for event scheduling */
33 
34  /*
35  * Config params
36  */
37  u8 no_echo; /**< Don't echo traffic */
38  u32 fifo_size; /**< Fifo size */
39  u32 rcv_buffer_size; /**< Rcv buffer size */
40  u32 prealloc_fifos; /**< Preallocate fifos */
41  u32 private_segment_count; /**< Number of private segments */
42  u32 private_segment_size; /**< Size of private segments */
43  char *server_uri; /**< Server URI */
44  u32 tls_engine; /**< TLS engine: mbedtls/openssl */
45  u8 is_dgram; /**< set if transport is dgram */
46  /*
47  * Test state
48  */
49  u8 **rx_buf; /**< Per-thread RX buffer */
52 
55 
57 
58 int
60 {
62 
63  esm->vpp_queue[s->thread_index] =
66  esm->byte_index = 0;
67  ASSERT (vec_len (esm->rx_retries) > s->thread_index);
69  esm->rx_retries[s->thread_index][s->session_index] = 0;
70  return 0;
71 }
72 
73 void
75 {
77  vnet_disconnect_args_t _a = { 0 }, *a = &_a;
78 
79  a->handle = session_handle (s);
80  a->app_index = esm->app_index;
82 }
83 
84 void
86 {
88  vnet_disconnect_args_t _a = { 0 }, *a = &_a;
89  clib_warning ("Reset session %U", format_session, s, 2);
90  a->handle = session_handle (s);
91  a->app_index = esm->app_index;
93 }
94 
95 int
97  session_t * s, u8 is_fail)
98 {
99  clib_warning ("called...");
100  return -1;
101 }
102 
103 int
104 echo_server_add_segment_callback (u32 client_index, u64 segment_handle)
105 {
106  /* New heaps may be added */
107  return 0;
108 }
109 
110 int
112 {
113  clib_warning ("called...");
114  return -1;
115 }
116 
117 void
118 test_bytes (echo_server_main_t * esm, int actual_transfer)
119 {
120  int i;
121  u32 my_thread_id = vlib_get_thread_index ();
122 
123  for (i = 0; i < actual_transfer; i++)
124  {
125  if (esm->rx_buf[my_thread_id][i] != ((esm->byte_index + i) & 0xff))
126  {
127  clib_warning ("at %lld expected %d got %d", esm->byte_index + i,
128  (esm->byte_index + i) & 0xff,
129  esm->rx_buf[my_thread_id][i]);
130  }
131  }
132  esm->byte_index += actual_transfer;
133 }
134 
135 /*
136  * If no-echo, just drop the data and be done with it.
137  */
138 int
140 {
141  svm_fifo_t *rx_fifo = s->rx_fifo;
142  svm_fifo_dequeue_drop (rx_fifo, svm_fifo_max_dequeue (rx_fifo));
143  return 0;
144 }
145 
146 int
148 {
149  u32 n_written, max_dequeue, max_enqueue, max_transfer;
150  int actual_transfer;
151  svm_fifo_t *tx_fifo, *rx_fifo;
153  u32 thread_index = vlib_get_thread_index ();
155 
156  ASSERT (s->thread_index == thread_index);
157 
158  rx_fifo = s->rx_fifo;
159  tx_fifo = s->tx_fifo;
160 
161  ASSERT (rx_fifo->master_thread_index == thread_index);
162  ASSERT (tx_fifo->master_thread_index == thread_index);
163 
164  max_enqueue = svm_fifo_max_enqueue (tx_fifo);
165  if (!esm->is_dgram)
166  {
167  max_dequeue = svm_fifo_max_dequeue (rx_fifo);
168  }
169  else
170  {
172  svm_fifo_peek (rx_fifo, 0, sizeof (ph), (u8 *) & ph);
173  max_dequeue = ph.data_length - ph.data_offset;
174  if (!esm->vpp_queue[s->thread_index])
175  {
176  svm_msg_q_t *mq;
178  esm->vpp_queue[s->thread_index] = mq;
179  }
180  max_enqueue -= sizeof (session_dgram_hdr_t);
181  }
182 
183  if (PREDICT_FALSE (max_dequeue == 0))
184  return 0;
185 
186  /* Number of bytes we're going to copy */
187  max_transfer = clib_min (max_dequeue, max_enqueue);
188 
189  /* No space in tx fifo */
190  if (PREDICT_FALSE (max_transfer == 0))
191  {
192  /* XXX timeout for session that are stuck */
193 
194  rx_event:
195  /* Program self-tap to retry */
196  if (svm_fifo_set_event (rx_fifo))
197  {
198  if (session_send_io_evt_to_thread (rx_fifo,
200  clib_warning ("failed to enqueue self-tap");
201 
203  if (esm->rx_retries[thread_index][s->session_index] == 500000)
204  {
205  clib_warning ("session stuck: %U", format_session, s, 2);
206  }
207  if (esm->rx_retries[thread_index][s->session_index] < 500001)
208  esm->rx_retries[thread_index][s->session_index]++;
209  }
210 
211  return 0;
212  }
213 
214  vec_validate (esm->rx_buf[thread_index], max_transfer);
215  if (!esm->is_dgram)
216  {
217  actual_transfer = app_recv_stream_raw (rx_fifo,
218  esm->rx_buf[thread_index],
219  max_transfer,
220  0 /* don't clear event */ ,
221  0 /* peek */ );
222  }
223  else
224  {
225  actual_transfer = app_recv_dgram_raw (rx_fifo,
226  esm->rx_buf[thread_index],
227  max_transfer, &at,
228  0 /* don't clear event */ ,
229  0 /* peek */ );
230  }
231  ASSERT (actual_transfer == max_transfer);
232  /* test_bytes (esm, actual_transfer); */
233 
234  /*
235  * Echo back
236  */
237 
238  if (!esm->is_dgram)
239  {
240  n_written = app_send_stream_raw (tx_fifo,
241  esm->vpp_queue[thread_index],
242  esm->rx_buf[thread_index],
243  actual_transfer, SESSION_IO_EVT_TX,
244  1 /* do_evt */ , 0);
245  }
246  else
247  {
248  n_written = app_send_dgram_raw (tx_fifo, &at,
249  esm->vpp_queue[s->thread_index],
250  esm->rx_buf[thread_index],
251  actual_transfer, SESSION_IO_EVT_TX,
252  1 /* do_evt */ , 0);
253  }
254 
255  if (n_written != max_transfer)
256  clib_warning ("short trout! written %u read %u", n_written, max_transfer);
257 
258  if (PREDICT_FALSE (svm_fifo_max_dequeue (rx_fifo)))
259  goto rx_event;
260 
261  return 0;
262 }
263 
265  .session_accept_callback = echo_server_session_accept_callback,
266  .session_disconnect_callback = echo_server_session_disconnect_callback,
267  .session_connected_callback = echo_server_session_connected_callback,
268  .add_segment_callback = echo_server_add_segment_callback,
269  .builtin_app_rx_callback = echo_server_rx_callback,
270  .session_reset_callback = echo_server_session_reset_callback
271 };
272 
273 /* Abuse VPP's input queue */
274 static int
276 {
278  api_main_t *am = &api_main;
279  vl_shmem_hdr_t *shmem_hdr;
280 
281  shmem_hdr = am->shmem_hdr;
282  esm->vl_input_queue = shmem_hdr->vl_input_queue;
283  esm->my_client_index = vl_api_memclnt_create_internal ("echo_server",
284  esm->vl_input_queue);
285  return 0;
286 }
287 
288 static int
289 echo_server_attach (u8 * appns_id, u64 appns_flags, u64 appns_secret)
290 {
291  vnet_app_add_tls_cert_args_t _a_cert, *a_cert = &_a_cert;
292  vnet_app_add_tls_key_args_t _a_key, *a_key = &_a_key;
294  vnet_app_attach_args_t _a, *a = &_a;
295  u64 options[APP_OPTIONS_N_OPTIONS];
296  u32 segment_size = 512 << 20;
297 
298  clib_memset (a, 0, sizeof (*a));
299  clib_memset (options, 0, sizeof (options));
300 
301  if (esm->no_echo)
302  echo_server_session_cb_vft.builtin_app_rx_callback =
304  else
305  echo_server_session_cb_vft.builtin_app_rx_callback =
307 
308  if (esm->private_segment_size)
309  segment_size = esm->private_segment_size;
310 
311  a->api_client_index = esm->my_client_index;
312  a->session_cb_vft = &echo_server_session_cb_vft;
313  a->options = options;
314  a->options[APP_OPTIONS_SEGMENT_SIZE] = segment_size;
315  a->options[APP_OPTIONS_ADD_SEGMENT_SIZE] = segment_size;
316  a->options[APP_OPTIONS_RX_FIFO_SIZE] = esm->fifo_size;
317  a->options[APP_OPTIONS_TX_FIFO_SIZE] = esm->fifo_size;
319  a->options[APP_OPTIONS_TLS_ENGINE] = esm->tls_engine;
320  a->options[APP_OPTIONS_PREALLOC_FIFO_PAIRS] =
321  esm->prealloc_fifos ? esm->prealloc_fifos : 1;
322 
323  a->options[APP_OPTIONS_FLAGS] = APP_OPTIONS_FLAGS_IS_BUILTIN;
324  if (appns_id)
325  {
326  a->namespace_id = appns_id;
327  a->options[APP_OPTIONS_FLAGS] |= appns_flags;
328  a->options[APP_OPTIONS_NAMESPACE_SECRET] = appns_secret;
329  }
330 
331  if (vnet_application_attach (a))
332  {
333  clib_warning ("failed to attach server");
334  return -1;
335  }
336  esm->app_index = a->app_index;
337 
338  clib_memset (a_cert, 0, sizeof (*a_cert));
339  a_cert->app_index = a->app_index;
340  vec_validate (a_cert->cert, test_srv_crt_rsa_len);
342  vnet_app_add_tls_cert (a_cert);
343 
344  clib_memset (a_key, 0, sizeof (*a_key));
345  a_key->app_index = a->app_index;
346  vec_validate (a_key->key, test_srv_key_rsa_len);
348  vnet_app_add_tls_key (a_key);
349  return 0;
350 }
351 
352 static int
354 {
356  vnet_app_detach_args_t _da, *da = &_da;
357  int rv;
358 
359  da->app_index = esm->app_index;
360  rv = vnet_application_detach (da);
361  esm->app_index = ~0;
362  return rv;
363 }
364 
365 static int
367 {
369  vnet_listen_args_t _a, *a = &_a;
370  clib_memset (a, 0, sizeof (*a));
371  a->app_index = esm->app_index;
372  a->uri = esm->server_uri;
373  return vnet_bind_uri (a);
374 }
375 
376 static int
377 echo_server_create (vlib_main_t * vm, u8 * appns_id, u64 appns_flags,
378  u64 appns_secret)
379 {
382  u32 num_threads;
383  int i;
384 
385  if (esm->my_client_index == (u32) ~ 0)
386  {
387  if (create_api_loopback (vm))
388  {
389  clib_warning ("failed to create api loopback");
390  return -1;
391  }
392  }
393 
394  num_threads = 1 /* main thread */ + vtm->n_threads;
395  vec_validate (echo_server_main.vpp_queue, num_threads - 1);
396  vec_validate (esm->rx_buf, num_threads - 1);
397  vec_validate (esm->rx_retries, num_threads - 1);
398  for (i = 0; i < vec_len (esm->rx_retries); i++)
399  vec_validate (esm->rx_retries[i],
402  for (i = 0; i < num_threads; i++)
403  vec_validate (esm->rx_buf[i], esm->rcv_buffer_size);
404 
405  if (echo_server_attach (appns_id, appns_flags, appns_secret))
406  {
407  clib_warning ("failed to attach server");
408  return -1;
409  }
410  if (echo_server_listen ())
411  {
412  clib_warning ("failed to start listening");
413  if (echo_server_detach ())
414  clib_warning ("failed to detach");
415  return -1;
416  }
417  return 0;
418 }
419 
420 static clib_error_t *
422  vlib_cli_command_t * cmd)
423 {
425  u8 server_uri_set = 0, *appns_id = 0;
426  u64 tmp, appns_flags = 0, appns_secret = 0;
427  char *default_uri = "tcp://0.0.0.0/1234";
428  int rv, is_stop = 0;
429 
430  esm->no_echo = 0;
431  esm->fifo_size = 64 << 10;
432  esm->rcv_buffer_size = 128 << 10;
433  esm->prealloc_fifos = 0;
434  esm->private_segment_count = 0;
435  esm->private_segment_size = 0;
437  esm->is_dgram = 0;
438  vec_free (esm->server_uri);
439 
441  {
442  if (unformat (input, "uri %s", &esm->server_uri))
443  server_uri_set = 1;
444  else if (unformat (input, "no-echo"))
445  esm->no_echo = 1;
446  else if (unformat (input, "fifo-size %d", &esm->fifo_size))
447  esm->fifo_size <<= 10;
448  else if (unformat (input, "rcv-buf-size %d", &esm->rcv_buffer_size))
449  ;
450  else if (unformat (input, "prealloc-fifos %d", &esm->prealloc_fifos))
451  ;
452  else if (unformat (input, "private-segment-count %d",
453  &esm->private_segment_count))
454  ;
455  else if (unformat (input, "private-segment-size %U",
456  unformat_memory_size, &tmp))
457  {
458  if (tmp >= 0x100000000ULL)
459  return clib_error_return
460  (0, "private segment size %lld (%llu) too large", tmp, tmp);
461  esm->private_segment_size = tmp;
462  }
463  else if (unformat (input, "appns %_%v%_", &appns_id))
464  ;
465  else if (unformat (input, "all-scope"))
466  appns_flags |= (APP_OPTIONS_FLAGS_USE_GLOBAL_SCOPE
467  | APP_OPTIONS_FLAGS_USE_LOCAL_SCOPE);
468  else if (unformat (input, "local-scope"))
469  appns_flags |= APP_OPTIONS_FLAGS_USE_LOCAL_SCOPE;
470  else if (unformat (input, "global-scope"))
471  appns_flags |= APP_OPTIONS_FLAGS_USE_GLOBAL_SCOPE;
472  else if (unformat (input, "secret %lu", &appns_secret))
473  ;
474  else if (unformat (input, "stop"))
475  is_stop = 1;
476  else if (unformat (input, "tls-engine %d", &esm->tls_engine))
477  ;
478  else
479  return clib_error_return (0, "failed: unknown input `%U'",
480  format_unformat_error, input);
481  }
482 
483  if (is_stop)
484  {
485  if (esm->app_index == (u32) ~ 0)
486  {
487  clib_warning ("server not running");
488  return clib_error_return (0, "failed: server not running");
489  }
490  rv = echo_server_detach ();
491  if (rv)
492  {
493  clib_warning ("failed: detach");
494  return clib_error_return (0, "failed: server detach %d", rv);
495  }
496  return 0;
497  }
498 
499  vnet_session_enable_disable (vm, 1 /* turn on TCP, etc. */ );
500 
501  if (!server_uri_set)
502  {
503  clib_warning ("No uri provided! Using default: %s", default_uri);
504  esm->server_uri = (char *) format (0, "%s%c", default_uri, 0);
505  }
506  if (esm->server_uri[0] == 'u' && esm->server_uri[3] != 'c')
507  esm->is_dgram = 1;
508 
509  rv = echo_server_create (vm, appns_id, appns_flags, appns_secret);
510  vec_free (appns_id);
511  if (rv)
512  {
513  vec_free (esm->server_uri);
514  return clib_error_return (0, "failed: server_create returned %d", rv);
515  }
516 
517  return 0;
518 }
519 
520 /* *INDENT-OFF* */
521 VLIB_CLI_COMMAND (echo_server_create_command, static) =
522 {
523  .path = "test echo server",
524  .short_help = "test echo server proto <proto> [no echo][fifo-size <mbytes>]"
525  "[rcv-buf-size <bytes>][prealloc-fifos <count>]"
526  "[private-segment-count <count>][private-segment-size <bytes[m|g]>]"
527  "[uri <tcp://ip/port>]",
528  .function = echo_server_create_command_fn,
529 };
530 /* *INDENT-ON* */
531 
532 clib_error_t *
534 {
536  esm->my_client_index = ~0;
537  return 0;
538 }
539 
541 
542 /*
543 * fd.io coding-style-patch-verification: ON
544 *
545 * Local Variables:
546 * eval: (c-set-style "gnu")
547 * End:
548 */
static int echo_server_listen()
Definition: echo_server.c:366
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
Definition: vec.h:439
static int app_recv_stream_raw(svm_fifo_t *f, u8 *buf, u32 len, u8 clear_evt, u8 peek)
int echo_server_session_accept_callback(session_t *s)
Definition: echo_server.c:59
#define clib_min(x, y)
Definition: clib.h:295
u32 vl_api_memclnt_create_internal(char *name, svm_queue_t *q)
Definition: memory_api.c:120
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
session_main_t session_main
Definition: session.c:26
u32 session_index
Index in thread pool where session was allocated.
u8 no_echo
Don&#39;t echo traffic.
Definition: echo_server.c:37
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
#define clib_memcpy_fast(a, b, c)
Definition: string.h:81
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
u32 fifo_size
Fifo size.
Definition: echo_server.c:38
void echo_server_session_disconnect_callback(session_t *s)
Definition: echo_server.c:74
svm_fifo_t * rx_fifo
Pointers to rx/tx buffers.
session_worker_t * wrk
Worker contexts.
Definition: session.h:122
u32 private_segment_size
Size of private segments.
Definition: echo_server.c:42
static int echo_server_detach(void)
Definition: echo_server.c:353
int i
static u32 svm_fifo_max_enqueue(svm_fifo_t *f)
Definition: svm_fifo.h:147
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:424
struct _vnet_application_add_tls_cert_args_t vnet_app_add_tls_cert_args_t
u32 tls_engine
TLS engine: mbedtls/openssl.
Definition: echo_server.c:44
clib_error_t * vnet_app_add_tls_cert(vnet_app_add_tls_cert_args_t *a)
Definition: application.c:1330
unsigned char u8
Definition: types.h:56
struct _vnet_bind_args_t vnet_listen_args_t
session_t * sessions
Worker session pool.
Definition: session.h:69
static session_handle_t session_handle(session_t *s)
u32 my_client_index
API client handle.
Definition: echo_server.c:31
struct _svm_fifo svm_fifo_t
svm_msg_q_t ** vpp_queue
Definition: echo_server.c:27
int echo_server_session_connected_callback(u32 app_index, u32 api_context, session_t *s, u8 is_fail)
Definition: echo_server.c:96
u32 prealloc_fifos
Preallocate fifos.
Definition: echo_server.c:40
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:163
struct _vnet_disconnect_args_t vnet_disconnect_args_t
svm_queue_t * vl_input_queue
Sever&#39;s event queue.
Definition: echo_server.c:28
static u32 svm_fifo_max_dequeue(svm_fifo_t *f)
Definition: svm_fifo.h:129
static const u32 test_srv_key_rsa_len
Definition: tls_test.h:77
#define clib_error_return(e, args...)
Definition: error.h:99
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 session_send_io_evt_to_thread(svm_fifo_t *f, session_evt_type_t evt_type)
Definition: session.c:86
static int echo_server_attach(u8 *appns_id, u64 appns_flags, u64 appns_secret)
Definition: echo_server.c:289
echo_server_main_t echo_server_main
Definition: echo_server.c:56
static int app_recv_dgram_raw(svm_fifo_t *f, u8 *buf, u32 len, app_session_transport_t *at, u8 clear_evt, u8 peek)
struct _vnet_app_attach_args_t vnet_app_attach_args_t
clib_error_t * vnet_app_add_tls_key(vnet_app_add_tls_key_args_t *a)
Definition: application.c:1342
struct _unformat_input_t unformat_input_t
#define PREDICT_FALSE(x)
Definition: clib.h:111
void echo_server_session_reset_callback(session_t *s)
Definition: echo_server.c:85
static const char test_srv_crt_rsa[]
Definition: tls_test.h:23
clib_error_t * vnet_session_enable_disable(vlib_main_t *vm, u8 is_en)
Definition: session.c:1426
static int app_send_dgram_raw(svm_fifo_t *f, app_session_transport_t *at, svm_msg_q_t *vpp_evt_q, u8 *data, u32 len, u8 evt_type, u8 do_evt, u8 noblock)
static clib_error_t * echo_server_create_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: echo_server.c:421
u32 app_index
Server app index.
Definition: echo_server.c:30
API main structure, used by both vpp and binary API clients.
Definition: api_common.h:202
int vnet_application_attach(vnet_app_attach_args_t *a)
Attach application to vpp.
Definition: application.c:839
void test_bytes(echo_server_main_t *esm, int actual_transfer)
Definition: echo_server.c:118
static u8 svm_fifo_set_event(svm_fifo_t *f)
Sets fifo event flag.
Definition: svm_fifo.h:172
#define UNFORMAT_END_OF_INPUT
Definition: format.h:144
static_always_inline uword vlib_get_thread_index(void)
Definition: threads.h:212
clib_error_t * echo_server_main_init(vlib_main_t *vm)
Definition: echo_server.c:533
vlib_main_t * vm
Definition: buffer.c:312
static int create_api_loopback(vlib_main_t *vm)
Definition: echo_server.c:275
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:341
#define clib_warning(format, args...)
Definition: error.h:59
struct _stream_session_cb_vft session_cb_vft_t
u32 node_index
process node index for event scheduling
Definition: echo_server.c:32
svm_queue_t * vl_input_queue
Definition: memory_shared.h:84
static const char test_srv_key_rsa[]
Definition: tls_test.h:49
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:155
#define ASSERT(truth)
int echo_server_builtin_server_rx_callback_no_echo(session_t *s)
Definition: echo_server.c:139
int echo_server_redirect_connect_callback(u32 client_index, void *mp)
Definition: echo_server.c:111
int vnet_application_detach(vnet_app_detach_args_t *a)
Detach application from vpp.
Definition: application.c:899
struct _vnet_application_add_tls_key_args_t vnet_app_add_tls_key_args_t
int echo_server_rx_callback(session_t *s)
Definition: echo_server.c:147
struct _vnet_app_detach_args_t vnet_app_detach_args_t
#define clib_max(x, y)
Definition: clib.h:288
u8 thread_index
Index of the thread that allocated the session.
int svm_fifo_dequeue_drop(svm_fifo_t *f, u32 max_bytes)
Definition: svm_fifo.c:734
int echo_server_add_segment_callback(u32 client_index, u64 segment_handle)
Definition: echo_server.c:104
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
volatile u8 session_state
State in session layer state machine.
u8 ** rx_buf
Per-thread RX buffer.
Definition: echo_server.c:49
int vnet_bind_uri(vnet_listen_args_t *a)
static int app_send_stream_raw(svm_fifo_t *f, svm_msg_q_t *vpp_evt_q, u8 *data, u32 len, u8 evt_type, u8 do_evt, u8 noblock)
char * server_uri
Server URI.
Definition: echo_server.c:43
int vnet_disconnect_session(vnet_disconnect_args_t *a)
Definition: application.c:1094
u32 private_segment_count
Number of private segments.
Definition: echo_server.c:41
struct _svm_queue svm_queue_t
unformat_function_t unformat_memory_size
Definition: format.h:295
u8 is_dgram
set if transport is dgram
Definition: echo_server.c:45
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
u32 rcv_buffer_size
Rcv buffer size.
Definition: echo_server.c:39
static int echo_server_create(vlib_main_t *vm, u8 *appns_id, u64 appns_flags, u64 appns_secret)
Definition: echo_server.c:377
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
struct session_dgram_header_ session_dgram_hdr_t
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:972
static session_cb_vft_t echo_server_session_cb_vft
Definition: echo_server.c:264
static const u32 test_srv_crt_rsa_len
Definition: tls_test.h:47
static uword unformat_check_input(unformat_input_t *i)
Definition: format.h:170
vlib_main_t * vlib_main
Definition: echo_server.c:53
static uword pool_elts(void *v)
Number of active elements in a pool.
Definition: pool.h:128