FD.io VPP  v21.06-3-gbb25fbf28
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 /*
22  *
23  * Binary API Messages
24  *
25  */
26 
27 void
29 {
31  bmp = vl_msg_api_alloc (sizeof (*bmp));
32  clib_memset (bmp, 0, sizeof (*bmp));
33 
34  bmp->_vl_msg_id = ntohs (VL_API_APP_ATTACH);
35  bmp->client_index = em->my_client_index;
36  bmp->context = ntohl (0xfeedface);
37  bmp->options[APP_OPTIONS_FLAGS] = APP_OPTIONS_FLAGS_ACCEPT_REDIRECT;
38  bmp->options[APP_OPTIONS_FLAGS] |= APP_OPTIONS_FLAGS_ADD_SEGMENT;
42  bmp->options[APP_OPTIONS_ADD_SEGMENT_SIZE] = 128 << 20;
43  bmp->options[APP_OPTIONS_SEGMENT_SIZE] = 256 << 20;
45  if (em->appns_id)
46  {
50  }
51  vl_msg_api_send_shmem (em->vl_input_queue, (u8 *) & bmp);
52 }
53 
54 void
56 {
58  bmp = vl_msg_api_alloc (sizeof (*bmp));
59  clib_memset (bmp, 0, sizeof (*bmp));
60 
61  bmp->_vl_msg_id = ntohs (VL_API_APPLICATION_DETACH);
62  bmp->client_index = em->my_client_index;
63  bmp->context = ntohl (0xfeedface);
64 
65  vl_msg_api_send_shmem (em->vl_input_queue, (u8 *) & bmp);
66 }
67 
68 void
70 {
71  u32 cert_len = test_srv_crt_rsa_len;
74 
75  bmp = vl_msg_api_alloc (sizeof (*bmp) + cert_len + key_len);
76  clib_memset (bmp, 0, sizeof (*bmp) + cert_len + key_len);
77 
78  bmp->_vl_msg_id = ntohs (VL_API_APP_ADD_CERT_KEY_PAIR);
79  bmp->client_index = em->my_client_index;
80  bmp->context = ntohl (0xfeedface);
81  bmp->cert_len = clib_host_to_net_u16 (cert_len);
82  bmp->certkey_len = clib_host_to_net_u16 (key_len + cert_len);
83  clib_memcpy_fast (bmp->certkey, test_srv_crt_rsa, cert_len);
85 
86  vl_msg_api_send_shmem (em->vl_input_queue, (u8 *) & bmp);
87 }
88 
89 void
91 {
93  bmp = vl_msg_api_alloc (sizeof (*bmp));
94  clib_memset (bmp, 0, sizeof (*bmp));
95 
96  bmp->_vl_msg_id = ntohs (VL_API_APP_DEL_CERT_KEY_PAIR);
97  bmp->client_index = em->my_client_index;
98  bmp->context = ntohl (0xfeedface);
99  bmp->index = clib_host_to_net_u32 (em->ckpair_index);
100  vl_msg_api_send_shmem (em->vl_input_queue, (u8 *) & bmp);
101 }
102 
103 static u8
105 {
106  return proto == TRANSPORT_PROTO_TLS || proto == TRANSPORT_PROTO_DTLS ||
107  proto == TRANSPORT_PROTO_QUIC;
108 }
109 
110 static void
112 {
115 
116  c = echo_segment_alloc_chunk (ECHO_MQ_SEG_HANDLE, 0, sizeof (cfg), offset);
117  if (!c)
118  return;
119 
120  memset (&cfg, 0, sizeof (cfg));
122  cfg.len = sizeof (cfg);
123  cfg.crypto.ckpair_index = em->ckpair_index;
125  clib_memcpy_fast (c->data, &cfg, cfg.len);
126 }
127 
128 void
129 echo_send_listen (echo_main_t * em, ip46_address_t * ip)
130 {
131  app_session_evt_t _app_evt, *app_evt = &_app_evt;
133  svm_msg_q_t *mq = em->ctrl_mq;
134 
136  mp = (session_listen_msg_t *) app_evt->evt->data;
137  memset (mp, 0, sizeof (*mp));
138  mp->client_index = em->my_client_index;
139  mp->context = ntohl (0xfeedface);
140  mp->wrk_index = 0;
141  mp->is_ip4 = em->uri_elts.is_ip4;
142  clib_memcpy_fast (&mp->ip, ip, sizeof (mp->ip));
143  mp->port = em->uri_elts.port;
144  mp->proto = em->uri_elts.transport_proto;
147  app_send_ctrl_evt_to_vpp (mq, app_evt);
148 }
149 
150 void
152 {
153  app_session_evt_t _app_evt, *app_evt = &_app_evt;
155  svm_msg_q_t *mq = em->ctrl_mq;
156 
158  mp = (session_unlisten_msg_t *) app_evt->evt->data;
159  memset (mp, 0, sizeof (*mp));
160  mp->client_index = em->my_client_index;
161  mp->wrk_index = 0;
162  mp->handle = s->vpp_session_handle;
163  mp->context = 0;
164  app_send_ctrl_evt_to_vpp (mq, app_evt);
165 }
166 
167 void
168 echo_send_connect (echo_main_t * em, void *args)
169 {
170  app_session_evt_t _app_evt, *app_evt = &_app_evt;
173  svm_msg_q_t *mq = em->ctrl_mq;
174 
176  while (em->max_sim_connects <= 0)
177  ;
178 
180  mp = (session_connect_msg_t *) app_evt->evt->data;
181  memset (mp, 0, sizeof (*mp));
182  mp->client_index = em->my_client_index;
183  mp->context = ntohl (a->context);
184  mp->wrk_index = 0;
185  mp->is_ip4 = em->uri_elts.is_ip4;
186  clib_memcpy_fast (&mp->ip, &a->ip, sizeof (mp->ip));
187  clib_memcpy_fast (&mp->lcl_ip, &a->lcl_ip, sizeof (mp->ip));
188  mp->port = em->uri_elts.port;
189  mp->proto = em->uri_elts.transport_proto;
190  mp->parent_handle = a->parent_session_handle;
193  mp->flags = em->connect_flag;
194  app_send_ctrl_evt_to_vpp (mq, app_evt);
195 }
196 
197 void
199 {
200  echo_session_t *s;
201  app_session_evt_t _app_evt, *app_evt = &_app_evt;
203  svm_msg_q_t *mq = em->ctrl_mq;
205 
207  mp = (session_disconnect_msg_t *) app_evt->evt->data;
208  memset (mp, 0, sizeof (*mp));
209  mp->client_index = em->my_client_index;
210  mp->handle = a->session_handle;
211  app_send_ctrl_evt_to_vpp (mq, app_evt);
212 
213  if (!(s = echo_get_session_from_handle (em, mp->handle)))
214  return;
216 }
217 
218 /*
219  *
220  * Helpers
221  *
222  */
223 
224 int
226  int fd)
227 {
228  fifo_segment_create_args_t _a, *a = &_a;
229  echo_main_t *em = &echo_main;
231  int rv;
232 
233  clib_memset (a, 0, sizeof (*a));
234  a->segment_name = (char *) name;
235  a->segment_type = type;
236 
237  if (type == SSVM_SEGMENT_MEMFD)
238  a->memfd_fd = fd;
239 
240  sm = &em->segment_main;
241 
242  if ((rv = fifo_segment_attach (sm, a)))
243  return rv;
244 
246  hash_set (em->shared_segment_handles, segment_handle,
247  a->new_segment_indices[0]);
249 
250  vec_free (a->new_segment_indices);
251  return 0;
252 }
253 
254 u32
255 echo_segment_lookup (u64 segment_handle)
256 {
257  echo_main_t *em = &echo_main;
258  uword *segment_idxp;
259 
260  ECHO_LOG (3, "Check if segment mapped 0x%lx...", segment_handle);
261 
263  segment_idxp = hash_get (em->shared_segment_handles, segment_handle);
265  if (!segment_idxp)
266  return ~0;
267 
268  ECHO_LOG (2, "Segment not mapped (0x%lx)", segment_handle);
269  return ((u32) *segment_idxp);
270 }
271 
272 void
273 echo_segment_detach (u64 segment_handle)
274 {
275  echo_main_t *em = &echo_main;
277 
278  u32 segment_index = echo_segment_lookup (segment_handle);
279  if (segment_index == (u32) ~0)
280  return;
281 
282  sm = &em->segment_main;
283 
285  fifo_segment_delete (sm, fifo_segment_get_segment (sm, segment_index));
286  hash_unset (em->shared_segment_handles, segment_handle);
288 }
289 
290 int
291 echo_attach_session (uword segment_handle, uword rxf_offset, uword txf_offset,
292  uword mq_offset, echo_session_t *s)
293 {
294  echo_main_t *em = &echo_main;
295  u32 fs_index, eqs_index;
296  fifo_segment_t *fs;
297 
298  fs_index = echo_segment_lookup (segment_handle);
299  if (fs_index == (u32) ~0)
300  {
301  ECHO_LOG (0, "ERROR: segment for session %u is not mounted!",
302  s->session_index);
303  return -1;
304  }
305 
306  if (mq_offset != (uword) ~0)
307  {
309  ASSERT (eqs_index != (u32) ~0);
310  }
311 
313 
314  fs = fifo_segment_get_segment (&em->segment_main, fs_index);
315  s->rx_fifo = fifo_segment_alloc_fifo_w_offset (fs, rxf_offset);
316  s->tx_fifo = fifo_segment_alloc_fifo_w_offset (fs, txf_offset);
317  s->rx_fifo->segment_index = fs_index;
318  s->tx_fifo->segment_index = fs_index;
319  s->rx_fifo->shr->client_session_index = s->session_index;
320  s->tx_fifo->shr->client_session_index = s->session_index;
321 
322  if (mq_offset != (uword) ~0)
323  {
324  fs = fifo_segment_get_segment (&em->segment_main, eqs_index);
325  s->vpp_evt_q = fifo_segment_msg_q_attach (fs, mq_offset,
326  s->rx_fifo->shr->slice_index);
327  }
328 
330 
331  return 0;
332 }
333 
334 int
335 echo_segment_attach_mq (uword segment_handle, uword mq_offset, u32 mq_index,
336  svm_msg_q_t **mq)
337 {
338  echo_main_t *em = &echo_main;
339  fifo_segment_t *fs;
340  u32 fs_index;
341 
342  fs_index = echo_segment_lookup (segment_handle);
343  if (fs_index == (u32) ~0)
344  {
345  ECHO_LOG (0, "ERROR: mq segment %lx for is not attached!",
346  segment_handle);
347  return -1;
348  }
349 
351 
352  fs = fifo_segment_get_segment (&em->segment_main, fs_index);
353  *mq = fifo_segment_msg_q_attach (fs, mq_offset, mq_index);
354 
356 
357  return 0;
358 }
359 
361 echo_segment_alloc_chunk (uword segment_handle, u32 slice_index, u32 size,
362  uword *offset)
363 {
364  echo_main_t *em = &echo_main;
366  fifo_segment_t *fs;
367  u32 fs_index;
368 
369  fs_index = echo_segment_lookup (segment_handle);
370  if (fs_index == (u32) ~0)
371  {
372  ECHO_LOG (0, "ERROR: mq segment %lx for is not attached!",
373  segment_handle);
374  return 0;
375  }
376 
378 
379  fs = fifo_segment_get_segment (&em->segment_main, fs_index);
380  c = fifo_segment_alloc_chunk_w_slice (fs, slice_index, size);
382 
384 
385  return c;
386 }
387 
388 /*
389  *
390  * Binary API callbacks
391  *
392  */
393 
394 static void
397 {
398  echo_main_t *em = &echo_main;
399  if (mp->retval)
400  {
401  ECHO_FAIL (ECHO_FAIL_VL_API_CERT_KEY_ADD_REPLY,
402  "Adding cert and key returned %d",
403  clib_net_to_host_u32 (mp->retval));
404  return;
405  }
406  /* No concurrency here, only bapi thread writes */
407  if (em->state != STATE_ATTACHED_NO_CERT)
408  {
409  ECHO_FAIL (ECHO_FAIL_VL_API_CERT_KEY_ADD_REPLY, "Wrong state");
410  return;
411  }
412  em->ckpair_index = clib_net_to_host_u32 (mp->index);
413  em->state = STATE_ATTACHED;
414 }
415 
416 static void
418  (vl_api_app_del_cert_key_pair_reply_t * mp)
419 {
420  echo_main_t *em = &echo_main;
421  if (mp->retval)
422  {
423  ECHO_FAIL (ECHO_FAIL_VL_API_CERT_KEY_DEL_REPLY,
424  "Delete cert and key returned %d",
425  clib_net_to_host_u32 (mp->retval));
426  return;
427  }
429 }
430 
431 static void
433 {
434  echo_main_t *em = &echo_main;
435  int *fds = 0, i, rv;
436  u32 n_fds = 0;
437  u64 segment_handle;
438  char *segment_name = 0;
439 
440  segment_handle = clib_net_to_host_u64 (mp->segment_handle);
441  ECHO_LOG (2, "Attached returned app %u", htons (mp->app_index));
442 
443  if (mp->retval)
444  {
445  ECHO_FAIL (ECHO_FAIL_VL_API_APP_ATTACH, "attach failed: %U",
446  format_api_error, clib_net_to_host_u32 (mp->retval));
447  return;
448  }
449 
450  if (!mp->app_mq)
451  {
452  ECHO_FAIL (ECHO_FAIL_VL_API_NULL_APP_MQ, "NULL app_mq");
453  return;
454  }
455 
456  if (mp->n_fds)
457  {
458  vec_validate (fds, mp->n_fds);
459  if (vl_socket_client_recv_fd_msg (fds, mp->n_fds, 5))
460  {
461  ECHO_FAIL (ECHO_FAIL_VL_API_RECV_FD_MSG,
462  "vl_socket_client_recv_fd_msg failed");
463  goto failed;
464  }
465 
466  if (mp->fd_flags & SESSION_FD_F_VPP_MQ_SEGMENT)
468  fds[n_fds++]))
469  {
470  ECHO_FAIL (ECHO_FAIL_VL_API_SVM_FIFO_SEG_ATTACH,
471  "svm_fifo_segment_attach failed on SSVM_SEGMENT_MEMFD");
472  goto failed;
473  }
475  mp->vpp_ctrl_mq_thread, &em->ctrl_mq);
476 
477  if (mp->fd_flags & SESSION_FD_F_MEMFD_SEGMENT)
478  {
479  segment_name = vl_api_from_api_to_new_c_string (&mp->segment_name);
480  rv = echo_segment_attach (segment_handle, segment_name,
481  SSVM_SEGMENT_MEMFD, fds[n_fds++]);
482  if (rv != 0)
483  {
484  ECHO_FAIL (ECHO_FAIL_VL_API_SVM_FIFO_SEG_ATTACH,
485  "svm_fifo_segment_attach ('%s') "
486  "failed on SSVM_SEGMENT_MEMFD", segment_name);
487  vec_free (segment_name);
488  goto failed;
489  }
490  vec_free (segment_name);
491  }
492  echo_segment_attach_mq (segment_handle, mp->app_mq, 0, &em->app_mq);
493 
494  if (mp->fd_flags & SESSION_FD_F_MQ_EVENTFD)
495  svm_msg_q_set_eventfd (em->app_mq, fds[n_fds++]);
496 
497  vec_free (fds);
498  }
499  else
500  {
501  segment_name = vl_api_from_api_to_new_c_string (&mp->segment_name);
502  rv = echo_segment_attach (segment_handle, segment_name, SSVM_SEGMENT_SHM,
503  -1);
504  if (rv != 0)
505  {
506  ECHO_FAIL (ECHO_FAIL_VL_API_SVM_FIFO_SEG_ATTACH,
507  "svm_fifo_segment_attach ('%s') "
508  "failed on SSVM_SEGMENT_SHM", segment_name);
509  vec_free (segment_name);
510  goto failed;
511  }
512  vec_free (segment_name);
513  }
514  ECHO_LOG (2, "Mapped segment 0x%lx", segment_handle);
515 
517  return;
518 failed:
519  for (i = clib_max (n_fds - 1, 0); i < vec_len (fds); i++)
520  close (fds[i]);
521  vec_free (fds);
522 }
523 
524 static void
525 vl_api_application_detach_reply_t_handler (vl_api_application_detach_reply_t *
526  mp)
527 {
528  if (mp->retval)
529  {
530  ECHO_FAIL (ECHO_FAIL_VL_API_DETACH_REPLY,
531  "app detach returned with err: %d", mp->retval);
532  return;
533  }
535 }
536 
537 #define foreach_quic_echo_msg \
538 _(APP_ATTACH_REPLY, app_attach_reply) \
539 _(APPLICATION_DETACH_REPLY, application_detach_reply) \
540 _(APP_ADD_CERT_KEY_PAIR_REPLY, app_add_cert_key_pair_reply) \
541 _(APP_DEL_CERT_KEY_PAIR_REPLY, app_del_cert_key_pair_reply)
542 
543 void
545 {
546 #define _(N,n) \
547  vl_msg_api_set_handlers(VL_API_##N, #n, \
548  vl_api_##n##_t_handler, \
549  vl_noop_handler, \
550  vl_api_##n##_t_endian, \
551  vl_api_##n##_t_print, \
552  sizeof(vl_api_##n##_t), 1);
554 #undef _
555 }
556 
557 /*
558  * fd.io coding-style-patch-verification: ON
559  *
560  * Local Variables:
561  * eval: (c-set-style "gnu")
562  * End:
563  */
session_connect_msg_::context
u32 context
Definition: application_interface.h:397
echo_main_t::ckpair_index
u32 ckpair_index
Definition: vpp_echo_common.h:335
STATE_CLEANED_CERT_KEY
@ STATE_CLEANED_CERT_KEY
Definition: vpp_echo_common.h:218
vl_api_app_attach_t::namespace_id
string namespace_id[]
Definition: session.api:41
fifo_segment_chunk_offset
uword fifo_segment_chunk_offset(fifo_segment_t *fs, svm_fifo_chunk_t *c)
Definition: fifo_segment.c:1072
ntohs
#define ntohs(x)
Definition: af_xdp.bpf.c:29
session_unlisten_msg_
Definition: application_interface.h:357
echo_segment_attach
int echo_segment_attach(u64 segment_handle, char *name, ssvm_segment_type_t type, int fd)
Definition: vpp_echo_bapi.c:225
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:420
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:361
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:291
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:128
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:435
echo_api_hookup
void echo_api_hookup(echo_main_t *em)
Definition: vpp_echo_bapi.c:544
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:159
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:1105
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:891
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:111
vl_api_app_del_cert_key_pair_t::index
u32 index
Definition: session.api:117
fifo_segment_t
Definition: fifo_segment.h:67
SESSION_CTRL_EVT_CONNECT
@ SESSION_CTRL_EVT_CONNECT
Definition: session_types.h:350
session_listen_msg_::proto
u8 proto
Definition: application_interface.h:323
session_listen_msg_
Definition: application_interface.h:316
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:308
svm_fifo_chunk_
Definition: fifo_types.h:38
transport_endpt_ext_cfg_::type
u16 type
Definition: transport_types.h:278
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:361
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:418
session_unlisten_msg_::client_index
u32 client_index
Definition: application_interface.h:359
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:377
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:403
vl_api_app_attach_reply_t::app_mq
u64 app_mq
Definition: session.api:62
echo_connect_args_
Definition: vpp_echo_common.h:387
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
echo_main_t::segment_main
fifo_segment_main_t segment_main
Definition: vpp_echo_common.h:305
echo_session_t::vpp_session_handle
foreach_app_session_field u64 vpp_session_handle
Definition: vpp_echo_common.h:165
session_listen_msg_::context
u32 context
Definition: application_interface.h:319
session_disconnect_msg_
Definition: application_interface.h:451
hash_set
#define hash_set(h, key, value)
Definition: hash.h:255
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:212
echo_send_detach
void echo_send_detach(echo_main_t *em)
Definition: vpp_echo_bapi.c:55
echo_main_t::my_client_index
u32 my_client_index
Definition: vpp_echo_common.h:284
ECHO_MQ_SEG_HANDLE
#define ECHO_MQ_SEG_HANDLE
Definition: vpp_echo_common.h:41
echo_main_t::proto_cb_vft
echo_proto_cb_vft_t * proto_cb_vft
Definition: vpp_echo_common.h:303
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:198
session_disconnect_msg_::handle
session_handle_t handle
Definition: application_interface.h:455
transport_endpt_ext_cfg_
Definition: transport_types.h:276
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:219
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:380
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:410
session_connect_msg_::client_index
u32 client_index
Definition: application_interface.h:396
echo_main_t::fifo_size
u32 fifo_size
Definition: vpp_echo_common.h:324
echo_main_t::prealloc_fifo_pairs
u32 prealloc_fifo_pairs
Definition: vpp_echo_common.h:325
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:340
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:405
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:381
foreach_quic_echo_msg
#define foreach_quic_echo_msg
Definition: vpp_echo_bapi.c:537
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:279
hash_get
#define hash_get(h, key)
Definition: hash.h:249
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:525
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:335
echo_transport_needs_crypto
static u8 echo_transport_needs_crypto(transport_proto_t proto)
Definition: vpp_echo_bapi.c:104
session_connect_msg_::flags
u8 flags
Definition: application_interface.h:409
i
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:261
echo_segment_lookup
u32 echo_segment_lookup(u64 segment_handle)
Definition: vpp_echo_bapi.c:255
transport_endpt_crypto_cfg_::ckpair_index
u32 ckpair_index
Definition: transport_types.h:271
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:318
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:272
echo_send_connect
void echo_send_connect(echo_main_t *em, void *args)
Definition: vpp_echo_bapi.c:168
echo_main_t::segment_handles_lock
clib_spinlock_t segment_handles_lock
Definition: vpp_echo_common.h:302
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:360
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:1054
session_listen_msg_::ext_config
uword ext_config
Definition: application_interface.h:327
echo_main_t::shared_segment_handles
uword * shared_segment_handles
Definition: vpp_echo_common.h:301
vl_api_app_attach_reply_t::vpp_ctrl_mq
u64 vpp_ctrl_mq
Definition: session.api:63
session_listen_msg_::ip
ip46_address_t ip
Definition: application_interface.h:325
session_connect_msg_::port
u16 port
Definition: application_interface.h:400
echo_main_t::max_sim_connects
volatile int max_sim_connects
Definition: vpp_echo_common.h:356
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:341
size
u32 size
Definition: vhost_user.h:125
session_connect_msg_::wrk_index
u32 wrk_index
Definition: application_interface.h:398
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:273
session_connect_msg_::parent_handle
u64 parent_handle
Definition: application_interface.h:406
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:432
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
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:396
session_connect_msg_
Definition: application_interface.h:394
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:151
transport_proto_t
enum _transport_proto transport_proto_t
echo_main_t::connect_flag
u8 connect_flag
Definition: vpp_echo_common.h:337
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:342
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:283
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:77
session_listen_msg_::wrk_index
u32 wrk_index
Definition: application_interface.h:320
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:281
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:334
echo_main_t::uri_elts
struct echo_main_t::@681 uri_elts
hash_unset
#define hash_unset(h, key)
Definition: hash.h:261
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:395
a
a
Definition: bitmap.h:544
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
session_connect_msg_::ip
ip46_address_t ip
Definition: application_interface.h:404
vl_api_app_attach_reply_t
Application attach reply.
Definition: session.api:59
echo_main_t::port
u32 port
Definition: vpp_echo_common.h:379
ECHO_LOG
#define ECHO_LOG(lvl, _fmt, _args...)
Definition: vpp_echo_common.h:143
rv
int __clib_unused rv
Definition: application.c:491
key_len
u16 key_len
Definition: ikev2_types.api:95
echo_proto_cb_vft_::sent_disconnect_cb
void(* sent_disconnect_cb)(echo_session_t *s)
Definition: vpp_echo_common.h:245
STATE_ATTACHED
@ STATE_ATTACHED
Definition: vpp_echo_common.h:213
echo_main_t::app_mq
svm_msg_q_t * app_mq
Definition: vpp_echo_common.h:290
session_listen_msg_::is_ip4
u8 is_ip4
Definition: application_interface.h:324
echo_send_attach
void echo_send_attach(echo_main_t *em)
Definition: vpp_echo_bapi.c:28
session_connect_msg_::proto
u8 proto
Definition: application_interface.h:402
fifo_segment_create_args_t
Definition: fifo_segment.h:84
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:129
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:282
session_listen_msg_::port
u16 port
Definition: application_interface.h:322
echo_send_add_cert_key
void echo_send_add_cert_key(echo_main_t *em)
Definition: vpp_echo_bapi.c:69
TRANSPORT_ENDPT_EXT_CFG_CRYPTO
@ TRANSPORT_ENDPT_EXT_CFG_CRYPTO
Definition: transport_types.h:266
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:362
echo_send_del_cert_key
void echo_send_del_cert_key(echo_main_t *em)
Definition: vpp_echo_bapi.c:90
app_session_event_
Definition: application_interface.h:569
echo_main_t::ctrl_mq
svm_msg_q_t * ctrl_mq
Definition: vpp_echo_common.h:291
echo_main_t::crypto_engine
u8 crypto_engine
Definition: vpp_echo_common.h:336
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