FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
vpp_echo_bapi.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 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 <stdio.h>
17 #include <signal.h>
18 
20 
21 #define REPLY_MSG_ID_BASE msg_id_base
23 
24 /*
25  *
26  * Binary API Messages
27  *
28  */
29 
30 void
32 {
34  bmp = vl_msg_api_alloc (sizeof (*bmp));
35  clib_memset (bmp, 0, sizeof (*bmp));
36 
37  bmp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_APP_ATTACH);
38  bmp->client_index = em->my_client_index;
39  bmp->context = ntohl (0xfeedface);
40  bmp->options[APP_OPTIONS_FLAGS] = APP_OPTIONS_FLAGS_ACCEPT_REDIRECT;
41  bmp->options[APP_OPTIONS_FLAGS] |= APP_OPTIONS_FLAGS_ADD_SEGMENT;
45  bmp->options[APP_OPTIONS_ADD_SEGMENT_SIZE] = 128 << 20;
46  bmp->options[APP_OPTIONS_SEGMENT_SIZE] = 256 << 20;
48  if (em->appns_id)
49  {
53  }
54  vl_msg_api_send_shmem (em->vl_input_queue, (u8 *) & bmp);
55 }
56 
57 void
59 {
61  bmp = vl_msg_api_alloc (sizeof (*bmp));
62  clib_memset (bmp, 0, sizeof (*bmp));
63 
64  bmp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_APPLICATION_DETACH);
65  bmp->client_index = em->my_client_index;
66  bmp->context = ntohl (0xfeedface);
67 
68  vl_msg_api_send_shmem (em->vl_input_queue, (u8 *) & bmp);
69 }
70 
71 void
73 {
74  u32 cert_len = test_srv_crt_rsa_len;
77 
78  bmp = vl_msg_api_alloc (sizeof (*bmp) + cert_len + key_len);
79  clib_memset (bmp, 0, sizeof (*bmp) + cert_len + key_len);
80 
81  bmp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_APP_ADD_CERT_KEY_PAIR);
82  bmp->client_index = em->my_client_index;
83  bmp->context = ntohl (0xfeedface);
84  bmp->cert_len = clib_host_to_net_u16 (cert_len);
85  bmp->certkey_len = clib_host_to_net_u16 (key_len + cert_len);
86  clib_memcpy_fast (bmp->certkey, test_srv_crt_rsa, cert_len);
88 
89  vl_msg_api_send_shmem (em->vl_input_queue, (u8 *) & bmp);
90 }
91 
92 void
94 {
96  bmp = vl_msg_api_alloc (sizeof (*bmp));
97  clib_memset (bmp, 0, sizeof (*bmp));
98 
99  bmp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_APP_DEL_CERT_KEY_PAIR);
100  bmp->client_index = em->my_client_index;
101  bmp->context = ntohl (0xfeedface);
102  bmp->index = clib_host_to_net_u32 (em->ckpair_index);
103  vl_msg_api_send_shmem (em->vl_input_queue, (u8 *) & bmp);
104 }
105 
106 static u8
108 {
109  return proto == TRANSPORT_PROTO_TLS || proto == TRANSPORT_PROTO_DTLS ||
110  proto == TRANSPORT_PROTO_QUIC;
111 }
112 
113 static void
115 {
118 
119  c = echo_segment_alloc_chunk (ECHO_MQ_SEG_HANDLE, 0, sizeof (cfg), offset);
120  if (!c)
121  return;
122 
123  memset (&cfg, 0, sizeof (cfg));
125  cfg.len = sizeof (cfg);
126  cfg.crypto.ckpair_index = em->ckpair_index;
128  clib_memcpy_fast (c->data, &cfg, cfg.len);
129 }
130 
131 void
132 echo_send_listen (echo_main_t * em, ip46_address_t * ip)
133 {
134  app_session_evt_t _app_evt, *app_evt = &_app_evt;
136  svm_msg_q_t *mq = em->ctrl_mq;
137 
139  mp = (session_listen_msg_t *) app_evt->evt->data;
140  memset (mp, 0, sizeof (*mp));
141  mp->client_index = em->my_client_index;
142  mp->context = ntohl (0xfeedface);
143  mp->wrk_index = 0;
144  mp->is_ip4 = em->uri_elts.is_ip4;
145  clib_memcpy_fast (&mp->ip, ip, sizeof (mp->ip));
146  mp->port = em->uri_elts.port;
147  mp->proto = em->uri_elts.transport_proto;
150  app_send_ctrl_evt_to_vpp (mq, app_evt);
151 }
152 
153 void
155 {
156  app_session_evt_t _app_evt, *app_evt = &_app_evt;
158  svm_msg_q_t *mq = em->ctrl_mq;
159 
161  mp = (session_unlisten_msg_t *) app_evt->evt->data;
162  memset (mp, 0, sizeof (*mp));
163  mp->client_index = em->my_client_index;
164  mp->wrk_index = 0;
165  mp->handle = s->vpp_session_handle;
166  mp->context = 0;
167  app_send_ctrl_evt_to_vpp (mq, app_evt);
168 }
169 
170 void
171 echo_send_connect (echo_main_t * em, void *args)
172 {
173  app_session_evt_t _app_evt, *app_evt = &_app_evt;
176  svm_msg_q_t *mq = em->ctrl_mq;
177 
179  while (em->max_sim_connects <= 0)
180  ;
181 
183  mp = (session_connect_msg_t *) app_evt->evt->data;
184  memset (mp, 0, sizeof (*mp));
185  mp->client_index = em->my_client_index;
186  mp->context = ntohl (a->context);
187  mp->wrk_index = 0;
188  mp->is_ip4 = em->uri_elts.is_ip4;
189  clib_memcpy_fast (&mp->ip, &a->ip, sizeof (mp->ip));
190  clib_memcpy_fast (&mp->lcl_ip, &a->lcl_ip, sizeof (mp->ip));
191  mp->port = em->uri_elts.port;
192  mp->proto = em->uri_elts.transport_proto;
193  mp->parent_handle = a->parent_session_handle;
196  mp->flags = em->connect_flag;
197  app_send_ctrl_evt_to_vpp (mq, app_evt);
198 }
199 
200 void
202 {
203  echo_session_t *s;
204  app_session_evt_t _app_evt, *app_evt = &_app_evt;
206  svm_msg_q_t *mq = em->ctrl_mq;
208 
210  mp = (session_disconnect_msg_t *) app_evt->evt->data;
211  memset (mp, 0, sizeof (*mp));
212  mp->client_index = em->my_client_index;
213  mp->handle = a->session_handle;
214  app_send_ctrl_evt_to_vpp (mq, app_evt);
215 
216  if (!(s = echo_get_session_from_handle (em, mp->handle)))
217  return;
219 }
220 
221 /*
222  *
223  * Helpers
224  *
225  */
226 
227 int
229  int fd)
230 {
231  fifo_segment_create_args_t _a, *a = &_a;
232  echo_main_t *em = &echo_main;
234  int rv;
235 
236  clib_memset (a, 0, sizeof (*a));
237  a->segment_name = (char *) name;
238  a->segment_type = type;
239 
240  if (type == SSVM_SEGMENT_MEMFD)
241  a->memfd_fd = fd;
242 
243  sm = &em->segment_main;
244 
245  if ((rv = fifo_segment_attach (sm, a)))
246  return rv;
247 
249  hash_set (em->shared_segment_handles, segment_handle,
250  a->new_segment_indices[0]);
252 
253  vec_free (a->new_segment_indices);
254  return 0;
255 }
256 
257 u32
258 echo_segment_lookup (u64 segment_handle)
259 {
260  echo_main_t *em = &echo_main;
261  uword *segment_idxp;
262 
263  ECHO_LOG (3, "Check if segment mapped 0x%lx...", segment_handle);
264 
266  segment_idxp = hash_get (em->shared_segment_handles, segment_handle);
268  if (!segment_idxp)
269  return ~0;
270 
271  ECHO_LOG (2, "Segment not mapped (0x%lx)", segment_handle);
272  return ((u32) *segment_idxp);
273 }
274 
275 void
276 echo_segment_detach (u64 segment_handle)
277 {
278  echo_main_t *em = &echo_main;
280 
281  u32 segment_index = echo_segment_lookup (segment_handle);
282  if (segment_index == (u32) ~0)
283  return;
284 
285  sm = &em->segment_main;
286 
288  fifo_segment_delete (sm, fifo_segment_get_segment (sm, segment_index));
289  hash_unset (em->shared_segment_handles, segment_handle);
291 }
292 
293 int
294 echo_attach_session (uword segment_handle, uword rxf_offset, uword txf_offset,
295  uword mq_offset, echo_session_t *s)
296 {
297  echo_main_t *em = &echo_main;
298  u32 fs_index, eqs_index;
299  fifo_segment_t *fs;
300 
301  fs_index = echo_segment_lookup (segment_handle);
302  if (fs_index == (u32) ~0)
303  {
304  ECHO_LOG (0, "ERROR: segment for session %u is not mounted!",
305  s->session_index);
306  return -1;
307  }
308 
309  if (mq_offset != (uword) ~0)
310  {
312  ASSERT (eqs_index != (u32) ~0);
313  }
314 
316 
317  fs = fifo_segment_get_segment (&em->segment_main, fs_index);
318  s->rx_fifo = fifo_segment_alloc_fifo_w_offset (fs, rxf_offset);
319  s->tx_fifo = fifo_segment_alloc_fifo_w_offset (fs, txf_offset);
320  s->rx_fifo->segment_index = fs_index;
321  s->tx_fifo->segment_index = fs_index;
322  s->rx_fifo->shr->client_session_index = s->session_index;
323  s->tx_fifo->shr->client_session_index = s->session_index;
324 
325  if (mq_offset != (uword) ~0)
326  {
327  fs = fifo_segment_get_segment (&em->segment_main, eqs_index);
328  s->vpp_evt_q = fifo_segment_msg_q_attach (fs, mq_offset,
329  s->rx_fifo->shr->slice_index);
330  }
331 
333 
334  return 0;
335 }
336 
337 int
338 echo_segment_attach_mq (uword segment_handle, uword mq_offset, u32 mq_index,
339  svm_msg_q_t **mq)
340 {
341  echo_main_t *em = &echo_main;
342  fifo_segment_t *fs;
343  u32 fs_index;
344 
345  fs_index = echo_segment_lookup (segment_handle);
346  if (fs_index == (u32) ~0)
347  {
348  ECHO_LOG (0, "ERROR: mq segment %lx for is not attached!",
349  segment_handle);
350  return -1;
351  }
352 
354 
355  fs = fifo_segment_get_segment (&em->segment_main, fs_index);
356  *mq = fifo_segment_msg_q_attach (fs, mq_offset, mq_index);
357 
359 
360  return 0;
361 }
362 
364 echo_segment_alloc_chunk (uword segment_handle, u32 slice_index, u32 size,
365  uword *offset)
366 {
367  echo_main_t *em = &echo_main;
369  fifo_segment_t *fs;
370  u32 fs_index;
371 
372  fs_index = echo_segment_lookup (segment_handle);
373  if (fs_index == (u32) ~0)
374  {
375  ECHO_LOG (0, "ERROR: mq segment %lx for is not attached!",
376  segment_handle);
377  return 0;
378  }
379 
381 
382  fs = fifo_segment_get_segment (&em->segment_main, fs_index);
383  c = fifo_segment_alloc_chunk_w_slice (fs, slice_index, size);
385 
387 
388  return c;
389 }
390 
391 /*
392  *
393  * Binary API callbacks
394  *
395  */
396 
397 static void
400 {
401  echo_main_t *em = &echo_main;
402  if (mp->retval)
403  {
404  ECHO_FAIL (ECHO_FAIL_VL_API_CERT_KEY_ADD_REPLY,
405  "Adding cert and key returned %d",
406  clib_net_to_host_u32 (mp->retval));
407  return;
408  }
409  /* No concurrency here, only bapi thread writes */
410  if (em->state != STATE_ATTACHED_NO_CERT)
411  {
412  ECHO_FAIL (ECHO_FAIL_VL_API_CERT_KEY_ADD_REPLY, "Wrong state");
413  return;
414  }
415  em->ckpair_index = clib_net_to_host_u32 (mp->index);
416  em->state = STATE_ATTACHED;
417 }
418 
419 static void
421  (vl_api_app_del_cert_key_pair_reply_t * mp)
422 {
423  echo_main_t *em = &echo_main;
424  if (mp->retval)
425  {
426  ECHO_FAIL (ECHO_FAIL_VL_API_CERT_KEY_DEL_REPLY,
427  "Delete cert and key returned %d",
428  clib_net_to_host_u32 (mp->retval));
429  return;
430  }
432 }
433 
434 static void
436 {
437  echo_main_t *em = &echo_main;
438  int *fds = 0, i, rv;
439  u32 n_fds = 0;
440  u64 segment_handle;
441  char *segment_name = 0;
442 
443  segment_handle = clib_net_to_host_u64 (mp->segment_handle);
444  ECHO_LOG (2, "Attached returned app %u", htons (mp->app_index));
445 
446  if (mp->retval)
447  {
448  ECHO_FAIL (ECHO_FAIL_VL_API_APP_ATTACH, "attach failed: %U",
449  format_api_error, clib_net_to_host_u32 (mp->retval));
450  return;
451  }
452 
453  if (!mp->app_mq)
454  {
455  ECHO_FAIL (ECHO_FAIL_VL_API_NULL_APP_MQ, "NULL app_mq");
456  return;
457  }
458 
459  if (mp->n_fds)
460  {
461  vec_validate (fds, mp->n_fds);
462  if (vl_socket_client_recv_fd_msg (fds, mp->n_fds, 5))
463  {
464  ECHO_FAIL (ECHO_FAIL_VL_API_RECV_FD_MSG,
465  "vl_socket_client_recv_fd_msg failed");
466  goto failed;
467  }
468 
469  if (mp->fd_flags & SESSION_FD_F_VPP_MQ_SEGMENT)
471  fds[n_fds++]))
472  {
473  ECHO_FAIL (ECHO_FAIL_VL_API_SVM_FIFO_SEG_ATTACH,
474  "svm_fifo_segment_attach failed on SSVM_SEGMENT_MEMFD");
475  goto failed;
476  }
478  mp->vpp_ctrl_mq_thread, &em->ctrl_mq);
479 
480  if (mp->fd_flags & SESSION_FD_F_MEMFD_SEGMENT)
481  {
482  segment_name = vl_api_from_api_to_new_c_string (&mp->segment_name);
483  rv = echo_segment_attach (segment_handle, segment_name,
484  SSVM_SEGMENT_MEMFD, fds[n_fds++]);
485  if (rv != 0)
486  {
487  ECHO_FAIL (ECHO_FAIL_VL_API_SVM_FIFO_SEG_ATTACH,
488  "svm_fifo_segment_attach ('%s') "
489  "failed on SSVM_SEGMENT_MEMFD", segment_name);
490  vec_free (segment_name);
491  goto failed;
492  }
493  vec_free (segment_name);
494  }
495  echo_segment_attach_mq (segment_handle, mp->app_mq, 0, &em->app_mq);
496 
497  if (mp->fd_flags & SESSION_FD_F_MQ_EVENTFD)
498  svm_msg_q_set_eventfd (em->app_mq, fds[n_fds++]);
499 
500  vec_free (fds);
501  }
502  else
503  {
504  segment_name = vl_api_from_api_to_new_c_string (&mp->segment_name);
505  rv = echo_segment_attach (segment_handle, segment_name, SSVM_SEGMENT_SHM,
506  -1);
507  if (rv != 0)
508  {
509  ECHO_FAIL (ECHO_FAIL_VL_API_SVM_FIFO_SEG_ATTACH,
510  "svm_fifo_segment_attach ('%s') "
511  "failed on SSVM_SEGMENT_SHM", segment_name);
512  vec_free (segment_name);
513  goto failed;
514  }
515  vec_free (segment_name);
516  }
517  ECHO_LOG (2, "Mapped segment 0x%lx", segment_handle);
518 
520  return;
521 failed:
522  for (i = clib_max (n_fds - 1, 0); i < vec_len (fds); i++)
523  close (fds[i]);
524  vec_free (fds);
525 }
526 
527 static void
528 vl_api_application_detach_reply_t_handler (vl_api_application_detach_reply_t *
529  mp)
530 {
531  if (mp->retval)
532  {
533  ECHO_FAIL (ECHO_FAIL_VL_API_DETACH_REPLY,
534  "app detach returned with err: %d", mp->retval);
535  return;
536  }
538 }
539 
540 #define foreach_quic_echo_msg \
541 _(APP_ATTACH_REPLY, app_attach_reply) \
542 _(APPLICATION_DETACH_REPLY, application_detach_reply) \
543 _(APP_ADD_CERT_KEY_PAIR_REPLY, app_add_cert_key_pair_reply) \
544 _(APP_DEL_CERT_KEY_PAIR_REPLY, app_del_cert_key_pair_reply)
545 
546 #define vl_print(handle, ...) fformat (handle, __VA_ARGS__)
547 #define vl_endianfun
548 #include <vnet/session/session.api.h>
549 #undef vl_endianfun
550 
551 #define vl_printfun
552 #include <vnet/session/session.api.h>
553 #undef vl_printfun
554 
555 #define vl_api_version(n, v) static u32 api_version = v;
556 #include <vnet/session/session.api.h>
557 #undef vl_api_version
558 
559 void
561 {
562  u8 *name = format (0, "session_%08x%c", api_version, 0);
563 
565 
566  vec_free (name);
567 
568  if (REPLY_MSG_ID_BASE == (u16) ~0)
569  return;
570 
571 #define _(N, n) \
572  vl_msg_api_set_handlers (REPLY_MSG_ID_BASE + VL_API_##N, #n, \
573  vl_api_##n##_t_handler, vl_noop_handler, \
574  vl_api_##n##_t_endian, vl_api_##n##_t_print, \
575  sizeof (vl_api_##n##_t), 1);
577 #undef _
578 }
579 
580 /*
581  * fd.io coding-style-patch-verification: ON
582  *
583  * Local Variables:
584  * eval: (c-set-style "gnu")
585  * End:
586  */
session_connect_msg_::context
u32 context
Definition: application_interface.h:399
echo_main_t::ckpair_index
u32 ckpair_index
Definition: vpp_echo_common.h:321
STATE_CLEANED_CERT_KEY
@ STATE_CLEANED_CERT_KEY
Definition: vpp_echo_common.h:204
vl_api_app_attach_t::namespace_id
string namespace_id[]
Definition: session.api:41
hash_set
#define hash_set(h, key, value)
Definition: hash.h:255
fifo_segment_chunk_offset
uword fifo_segment_chunk_offset(fifo_segment_t *fs, svm_fifo_chunk_t *c)
Definition: fifo_segment.c:1073
ntohs
#define ntohs(x)
Definition: af_xdp.bpf.c:29
session_unlisten_msg_
Definition: application_interface.h:359
echo_segment_attach
int echo_segment_attach(u64 segment_handle, char *name, ssvm_segment_type_t type, int fd)
Definition: vpp_echo_bapi.c:228
failed
description security check failed
Definition: map.api:373
vl_api_app_add_cert_key_pair_t
Add certificate and key.
Definition: session.api:90
vl_api_application_detach_t
Application detach from session layer.
Definition: session.api:77
fifo_segment_delete
void fifo_segment_delete(fifo_segment_main_t *sm, fifo_segment_t *s)
Definition: fifo_segment.c:421
APP_OPTIONS_RX_FIFO_SIZE
@ APP_OPTIONS_RX_FIFO_SIZE
Definition: application_interface.h:210
session_unlisten_msg_::wrk_index
u32 wrk_index
Definition: application_interface.h:363
echo_attach_session
int echo_attach_session(uword segment_handle, uword rxf_offset, uword txf_offset, uword mq_offset, echo_session_t *s)
Definition: vpp_echo_bapi.c:294
vl_api_application_detach_t::context
u32 context
Definition: session.api:79
vl_socket_client_recv_fd_msg
clib_error_t * vl_socket_client_recv_fd_msg(int fds[], int n_fds, u32 wait)
Definition: socket_client.c:593
vl_api_app_attach_reply_t::segment_handle
u64 segment_handle
Definition: session.api:69
ECHO_FAIL
#define ECHO_FAIL(fail, _fmt, _args...)
Definition: vpp_echo_common.h:114
clib_max
#define clib_max(x, y)
Definition: clib.h:335
vl_api_app_add_cert_key_pair_t::client_index
u32 client_index
Definition: session.api:91
vl_api_app_attach_t::context
u32 context
Definition: session.api:39
fifo_segment_get_segment
fifo_segment_t * fifo_segment_get_segment(fifo_segment_main_t *sm, u32 segment_index)
Definition: fifo_segment.c:436
echo_api_hookup
void echo_api_hookup(echo_main_t *em)
Definition: vpp_echo_bapi.c:560
vl_api_app_attach_reply_t::retval
i32 retval
Definition: session.api:61
name
string name[64]
Definition: fib.api:25
echo_session_t
Definition: vpp_echo_common.h:145
fifo_segment_msg_q_attach
svm_msg_q_t * fifo_segment_msg_q_attach(fifo_segment_t *fs, uword offset, u32 mq_index)
Attach message queue at fifo segment offset.
Definition: fifo_segment.c:1106
fifo_segment_alloc_fifo_w_offset
svm_fifo_t * fifo_segment_alloc_fifo_w_offset(fifo_segment_t *fs, uword offset)
Definition: fifo_segment.c:892
vl_api_app_add_cert_key_pair_t::certkey_len
u16 certkey_len
Definition: session.api:94
echo_msg_add_crypto_ext_config
static void echo_msg_add_crypto_ext_config(echo_main_t *em, uword *offset)
Definition: vpp_echo_bapi.c:114
vl_api_app_del_cert_key_pair_t::index
u32 index
Definition: session.api:117
fifo_segment_t
Definition: fifo_segment.h:68
SESSION_CTRL_EVT_CONNECT
@ SESSION_CTRL_EVT_CONNECT
Definition: session_types.h:350
session_listen_msg_::proto
u8 proto
Definition: application_interface.h:324
session_listen_msg_
Definition: application_interface.h:317
vl_api_app_add_cert_key_pair_t::context
u32 context
Definition: session.api:92
vl_api_app_add_cert_key_pair_t::certkey
u8 certkey[certkey_len]
Definition: session.api:95
echo_main_t::state
volatile connection_state_t state
Definition: vpp_echo_common.h:294
svm_fifo_chunk_
Definition: fifo_types.h:38
transport_endpt_ext_cfg_::type
u16 type
Definition: transport_types.h:282
echo_segment_alloc_chunk
svm_fifo_chunk_t * echo_segment_alloc_chunk(uword segment_handle, u32 slice_index, u32 size, uword *offset)
Definition: vpp_echo_bapi.c:364
u16
unsigned short u16
Definition: types.h:57
vl_api_app_del_cert_key_pair_reply_t_handler
static void vl_api_app_del_cert_key_pair_reply_t_handler(vl_api_app_del_cert_key_pair_reply_t *mp)
Definition: vpp_echo_bapi.c:421
session_unlisten_msg_::client_index
u32 client_index
Definition: application_interface.h:361
vl_api_app_add_cert_key_pair_reply_t::retval
i32 retval
Definition: session.api:105
APP_OPTIONS_SEGMENT_SIZE
@ APP_OPTIONS_SEGMENT_SIZE
Definition: application_interface.h:207
echo_main_t::transport_proto
u32 transport_proto
Definition: vpp_echo_common.h:363
vpp_echo_common.h
clib_memcpy_fast
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
Definition: string.h:92
APP_OPTIONS_NAMESPACE_SECRET
@ APP_OPTIONS_NAMESPACE_SECRET
Definition: application_interface.h:215
session_connect_msg_::is_ip4
u8 is_ip4
Definition: application_interface.h:405
vl_api_app_attach_reply_t::app_mq
u64 app_mq
Definition: session.api:62
echo_connect_args_
Definition: vpp_echo_common.h:373
app_send_ctrl_evt_to_vpp
static void app_send_ctrl_evt_to_vpp(svm_msg_q_t *mq, app_session_evt_t *app_evt)
Definition: application_interface.h:588
SSVM_SEGMENT_MEMFD
@ SSVM_SEGMENT_MEMFD
Definition: ssvm.h:50
vl_api_app_del_cert_key_pair_t::context
u32 context
Definition: session.api:116
ssvm_segment_type_t
enum ssvm_segment_type_ ssvm_segment_type_t
REPLY_MSG_ID_BASE
#define REPLY_MSG_ID_BASE
Definition: vpp_echo_bapi.c:21
hash_unset
#define hash_unset(h, key)
Definition: hash.h:261
echo_main_t::segment_main
fifo_segment_main_t segment_main
Definition: vpp_echo_common.h:291
echo_session_t::vpp_session_handle
foreach_app_session_field u64 vpp_session_handle
Definition: vpp_echo_common.h:151
session_listen_msg_::context
u32 context
Definition: application_interface.h:320
session_disconnect_msg_
Definition: application_interface.h:451
vl_api_application_detach_t::client_index
u32 client_index
Definition: session.api:78
STATE_ATTACHED_NO_CERT
@ STATE_ATTACHED_NO_CERT
Definition: vpp_echo_common.h:198
echo_send_detach
void echo_send_detach(echo_main_t *em)
Definition: vpp_echo_bapi.c:58
echo_main_t::my_client_index
u32 my_client_index
Definition: vpp_echo_common.h:270
ECHO_MQ_SEG_HANDLE
#define ECHO_MQ_SEG_HANDLE
Definition: vpp_echo_common.h:27
echo_main_t::proto_cb_vft
echo_proto_cb_vft_t * proto_cb_vft
Definition: vpp_echo_common.h:289
SESSION_CTRL_EVT_UNLISTEN
@ SESSION_CTRL_EVT_UNLISTEN
Definition: session_types.h:354
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
echo_send_disconnect_session
void echo_send_disconnect_session(echo_main_t *em, void *args)
Definition: vpp_echo_bapi.c:201
session_disconnect_msg_::handle
session_handle_t handle
Definition: application_interface.h:455
transport_endpt_ext_cfg_
Definition: transport_types.h:280
vl_api_app_attach_t
Application attach to session layer.
Definition: session.api:37
app_session_event_::evt
session_event_t * evt
Definition: application_interface.h:572
STATE_DETACHED
@ STATE_DETACHED
Definition: vpp_echo_common.h:205
vl_api_app_attach_reply_t::app_index
u32 app_index
Definition: session.api:65
echo_main_t::is_ip4
u8 is_ip4
Definition: vpp_echo_common.h:366
test_srv_key_rsa
static const char test_srv_key_rsa[]
Definition: tls_test.h:49
session_connect_msg_::ext_config
uword ext_config
Definition: application_interface.h:412
session_connect_msg_::client_index
u32 client_index
Definition: application_interface.h:398
echo_main_t::fifo_size
u32 fifo_size
Definition: vpp_echo_common.h:310
hash_get
#define hash_get(h, key)
Definition: hash.h:249
echo_main_t::prealloc_fifo_pairs
u32 prealloc_fifo_pairs
Definition: vpp_echo_common.h:311
clib_spinlock_lock
static_always_inline void clib_spinlock_lock(clib_spinlock_t *p)
Definition: lock.h:82
format_api_error
static u8 * format_api_error(u8 *s, va_list *args)
Definition: api_main.c:12
c
svmdb_client_t * c
Definition: vpp_get_metrics.c:48
echo_main_t::appns_id
u8 * appns_id
Definition: vpp_echo_common.h:326
vl_api_app_attach_reply_t::vpp_ctrl_mq_thread
u8 vpp_ctrl_mq_thread
Definition: session.api:64
session_connect_msg_::lcl_ip
ip46_address_t lcl_ip
Definition: application_interface.h:407
fifo_segment_attach
int fifo_segment_attach(fifo_segment_main_t *sm, fifo_segment_create_args_t *a)
Attach as slave to a fifo segment.
Definition: fifo_segment.c:382
foreach_quic_echo_msg
#define foreach_quic_echo_msg
Definition: vpp_echo_bapi.c:540
SESSION_CTRL_EVT_LISTEN
@ SESSION_CTRL_EVT_LISTEN
Definition: session_types.h:352
uword
u64 uword
Definition: types.h:112
transport_endpt_ext_cfg_::len
u16 len
Definition: transport_types.h:283
vl_api_application_detach_reply_t_handler
static void vl_api_application_detach_reply_t_handler(vl_api_application_detach_reply_t *mp)
Definition: vpp_echo_bapi.c:528
vl_api_app_add_cert_key_pair_t::cert_len
u16 cert_len
Definition: session.api:93
echo_segment_attach_mq
int echo_segment_attach_mq(uword segment_handle, uword mq_offset, u32 mq_index, svm_msg_q_t **mq)
Definition: vpp_echo_bapi.c:338
echo_transport_needs_crypto
static u8 echo_transport_needs_crypto(transport_proto_t proto)
Definition: vpp_echo_bapi.c:107
session_connect_msg_::flags
u8 flags
Definition: application_interface.h:411
echo_segment_lookup
u32 echo_segment_lookup(u64 segment_handle)
Definition: vpp_echo_bapi.c:258
transport_endpt_crypto_cfg_::ckpair_index
u32 ckpair_index
Definition: transport_types.h:275
msg_id_base
static u16 msg_id_base
Definition: vpp_echo_bapi.c:22
vec_validate
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
Definition: vec.h:523
session_listen_msg_::client_index
u32 client_index
Definition: application_interface.h:319
app_alloc_ctrl_evt_to_vpp
static void app_alloc_ctrl_evt_to_vpp(svm_msg_q_t *mq, app_session_evt_t *app_evt, u8 evt_type)
Definition: application_interface.h:576
transport_endpt_crypto_cfg_::crypto_engine
u8 crypto_engine
Definition: transport_types.h:276
echo_send_connect
void echo_send_connect(echo_main_t *em, void *args)
Definition: vpp_echo_bapi.c:171
echo_main_t::segment_handles_lock
clib_spinlock_t segment_handles_lock
Definition: vpp_echo_common.h:288
svm_msg_q_
Definition: message_queue.h:72
vl_api_app_del_cert_key_pair_t
Delete certificate and key.
Definition: session.api:114
clib_atomic_sub_fetch
#define clib_atomic_sub_fetch(a, b)
Definition: atomics.h:31
APP_OPTIONS_PREALLOC_FIFO_PAIRS
@ APP_OPTIONS_PREALLOC_FIFO_PAIRS
Definition: application_interface.h:212
session_unlisten_msg_::context
u32 context
Definition: application_interface.h:362
fifo_segment_alloc_chunk_w_slice
svm_fifo_chunk_t * fifo_segment_alloc_chunk_w_slice(fifo_segment_t *fs, u32 slice_index, u32 chunk_size)
Definition: fifo_segment.c:1055
session_listen_msg_::ext_config
uword ext_config
Definition: application_interface.h:328
echo_main_t::shared_segment_handles
uword * shared_segment_handles
Definition: vpp_echo_common.h:287
vl_api_app_attach_reply_t::vpp_ctrl_mq
u64 vpp_ctrl_mq
Definition: session.api:63
vl_client_get_first_plugin_msg_id
u16 vl_client_get_first_plugin_msg_id(const char *plugin_name)
Definition: memory_client.c:552
session_listen_msg_::ip
ip46_address_t ip
Definition: application_interface.h:326
session_connect_msg_::port
u16 port
Definition: application_interface.h:402
echo_main_t::max_sim_connects
volatile int max_sim_connects
Definition: vpp_echo_common.h:342
vec_free
#define vec_free(V)
Free vector's memory (no header).
Definition: vec.h:395
svm_msg_q_set_eventfd
void svm_msg_q_set_eventfd(svm_msg_q_t *mq, int fd)
Set event fd for queue.
Definition: message_queue.c:485
echo_main_t::appns_flags
u64 appns_flags
Definition: vpp_echo_common.h:327
size
u32 size
Definition: vhost_user.h:125
session_connect_msg_::wrk_index
u32 wrk_index
Definition: application_interface.h:400
SSVM_SEGMENT_SHM
@ SSVM_SEGMENT_SHM
Definition: ssvm.h:49
clib_bihash_value
template key/value backing page structure
Definition: bihash_doc.h:44
APP_OPTIONS_TX_FIFO_SIZE
@ APP_OPTIONS_TX_FIFO_SIZE
Definition: application_interface.h:211
echo_segment_detach
void echo_segment_detach(u64 segment_handle)
Definition: vpp_echo_bapi.c:276
session_connect_msg_::parent_handle
u64 parent_handle
Definition: application_interface.h:408
vl_api_app_attach_reply_t_handler
static void vl_api_app_attach_reply_t_handler(vl_api_app_attach_reply_t *mp)
Definition: vpp_echo_bapi.c:435
vl_api_vec_to_api_string
int vl_api_vec_to_api_string(const u8 *vec, vl_api_string_t *str)
Definition: api_shared.c:1175
test_srv_crt_rsa
static const char test_srv_crt_rsa[]
Definition: tls_test.h:23
APP_OPTIONS_ADD_SEGMENT_SIZE
@ APP_OPTIONS_ADD_SEGMENT_SIZE
Definition: application_interface.h:208
u64
unsigned long u64
Definition: types.h:89
format
description fragment has unexpected format
Definition: map.api:433
ASSERT
#define ASSERT(truth)
Definition: error_bootstrap.h:69
vl_api_app_add_cert_key_pair_reply_t_handler
static void vl_api_app_add_cert_key_pair_reply_t_handler(vl_api_app_add_cert_key_pair_reply_t *mp)
Definition: vpp_echo_bapi.c:399
session_connect_msg_
Definition: application_interface.h:396
u32
unsigned int u32
Definition: types.h:88
echo_send_unbind
void echo_send_unbind(echo_main_t *em, echo_session_t *s)
Definition: vpp_echo_bapi.c:154
transport_proto_t
enum _transport_proto transport_proto_t
echo_main_t::connect_flag
u8 connect_flag
Definition: vpp_echo_common.h:323
vl_api_app_attach_t::client_index
u32 client_index
Definition: session.api:38
APP_OPTIONS_EVT_QUEUE_SIZE
@ APP_OPTIONS_EVT_QUEUE_SIZE
Definition: application_interface.h:206
echo_main_t::appns_secret
u64 appns_secret
Definition: vpp_echo_common.h:328
vl_api_app_attach_reply_t::segment_name
string segment_name[]
Definition: session.api:70
test_srv_crt_rsa_len
static const u32 test_srv_crt_rsa_len
Definition: tls_test.h:47
echo_main_t::vl_input_queue
svm_queue_t * vl_input_queue
Definition: vpp_echo_common.h:269
vl_api_app_attach_t::options
u64 options[18]
Definition: session.api:40
vl_api_app_add_cert_key_pair_reply_t::index
u32 index
Definition: session.api:106
fifo_segment_main_t
Definition: fifo_segment.h:81
session_listen_msg_::wrk_index
u32 wrk_index
Definition: application_interface.h:321
clib_spinlock_unlock
static_always_inline void clib_spinlock_unlock(clib_spinlock_t *p)
Definition: lock.h:121
echo_main_t
Definition: vpp_echo_common.h:267
APP_OPTIONS_FLAGS
@ APP_OPTIONS_FLAGS
Definition: application_interface.h:205
vl_api_app_add_cert_key_pair_reply_t
Add certificate and key.
Definition: session.api:103
echo_main_t::evt_q_size
u32 evt_q_size
Definition: vpp_echo_common.h:320
clib_memset
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
echo_main
echo_main_t echo_main
Definition: vpp_echo.c:24
vl_api_app_attach_reply_t::n_fds
u8 n_fds
Definition: session.api:66
u8
unsigned char u8
Definition: types.h:56
echo_disconnect_args_
Definition: vpp_echo_common.h:381
a
a
Definition: bitmap.h:525
vl_api_app_del_cert_key_pair_t::client_index
u32 client_index
Definition: session.api:115
ip
vl_api_address_t ip
Definition: l2.api:558
vl_msg_api_send_shmem
void vl_msg_api_send_shmem(svm_queue_t *q, u8 *elem)
Definition: memory_shared.c:753
vl_api_app_attach_reply_t::fd_flags
u8 fd_flags
Definition: session.api:67
SESSION_CTRL_EVT_DISCONNECT
@ SESSION_CTRL_EVT_DISCONNECT
Definition: session_types.h:349
i
int i
Definition: flowhash_template.h:376
session_connect_msg_::ip
ip46_address_t ip
Definition: application_interface.h:406
vl_api_app_attach_reply_t
Application attach reply.
Definition: session.api:59
echo_main_t::port
u32 port
Definition: vpp_echo_common.h:365
ECHO_LOG
#define ECHO_LOG(lvl, _fmt, _args...)
Definition: vpp_echo_common.h:129
rv
int __clib_unused rv
Definition: application.c:491
key_len
u16 key_len
Definition: ikev2_types.api:95
echo_main_t::uri_elts
struct echo_main_t::@691 uri_elts
echo_proto_cb_vft_::sent_disconnect_cb
void(* sent_disconnect_cb)(echo_session_t *s)
Definition: vpp_echo_common.h:231
STATE_ATTACHED
@ STATE_ATTACHED
Definition: vpp_echo_common.h:199
echo_main_t::app_mq
svm_msg_q_t * app_mq
Definition: vpp_echo_common.h:276
session_listen_msg_::is_ip4
u8 is_ip4
Definition: application_interface.h:325
echo_send_attach
void echo_send_attach(echo_main_t *em)
Definition: vpp_echo_bapi.c:31
session_connect_msg_::proto
u8 proto
Definition: application_interface.h:404
fifo_segment_create_args_t
Definition: fifo_segment.h:88
proto
vl_api_ip_proto_t proto
Definition: acl_types.api:51
echo_send_listen
void echo_send_listen(echo_main_t *em, ip46_address_t *ip)
Definition: vpp_echo_bapi.c:132
vl_api_from_api_to_new_c_string
char * vl_api_from_api_to_new_c_string(vl_api_string_t *astr)
Definition: api_shared.c:1218
transport_endpt_ext_cfg_::crypto
transport_endpt_crypto_cfg_t crypto
Definition: transport_types.h:286
session_listen_msg_::port
u16 port
Definition: application_interface.h:323
echo_send_add_cert_key
void echo_send_add_cert_key(echo_main_t *em)
Definition: vpp_echo_bapi.c:72
TRANSPORT_ENDPT_EXT_CFG_CRYPTO
@ TRANSPORT_ENDPT_EXT_CFG_CRYPTO
Definition: transport_types.h:270
type
vl_api_fib_path_type_t type
Definition: fib_types.api:123
session_unlisten_msg_::handle
session_handle_t handle
Definition: application_interface.h:364
echo_send_del_cert_key
void echo_send_del_cert_key(echo_main_t *em)
Definition: vpp_echo_bapi.c:93
app_session_event_
Definition: application_interface.h:569
echo_main_t::ctrl_mq
svm_msg_q_t * ctrl_mq
Definition: vpp_echo_common.h:277
echo_main_t::crypto_engine
u8 crypto_engine
Definition: vpp_echo_common.h:322
session_disconnect_msg_::client_index
u32 client_index
Definition: application_interface.h:453
echo_get_session_from_handle
echo_session_t * echo_get_session_from_handle(echo_main_t *em, u64 handle)
Definition: vpp_echo_common.c:573
test_srv_key_rsa_len
static const u32 test_srv_key_rsa_len
Definition: tls_test.h:77
vl_msg_api_alloc
void * vl_msg_api_alloc(int nbytes)
Definition: memory_shared.c:199