FD.io VPP  v21.06-1-gbb7418cf9
Vector Packet Processing
srtp.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 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 <srtp/srtp.h>
18 #include <vnet/session/session.h>
19 
21 
22 static void srtp_disconnect (u32 ctx_handle, u32 thread_index);
24 
25 static inline u32
27 {
28  srtp_tc_t *ctx;
29  pool_get_zero (srtp_main.ctx_pool[thread_index], ctx);
30  ctx->c_thread_index = thread_index;
31  ctx->srtp_ctx_handle = ctx - srtp_main.ctx_pool[thread_index];
32  ctx->app_session_handle = SESSION_INVALID_HANDLE;
33  return ctx->srtp_ctx_handle;
34 }
35 
36 static inline srtp_tc_t *
38 {
39  return pool_elt_at_index (srtp_main.ctx_pool[thread_index], ctx_index);
40 }
41 
42 static void
44 {
46  srtp_policy_t *sp;
47  int i;
48 
49  for (i = 0; i < 2; i++)
50  {
51  sp = &ctx->srtp_policy[i];
52  sp_cfg = &cfg->policies[i];
53 
54  srtp_crypto_policy_set_rtp_default (&sp->rtp);
55  srtp_crypto_policy_set_rtcp_default (&sp->rtcp);
56  sp->ssrc.type = sp_cfg->ssrc_type;
57  sp->ssrc.value = sp_cfg->ssrc_value;
58  sp->key = clib_mem_alloc (sp_cfg->key_len);
59  clib_memcpy (sp->key, sp_cfg->key, sp_cfg->key_len);
60  sp->ekt = 0;
61  sp->next = i < 1 ? &ctx->srtp_policy[i + 1] : 0;
62  sp->window_size = sp_cfg->window_size;
63  sp->allow_repeat_tx = sp_cfg->allow_repeat_tx;
64  }
65 }
66 
67 static void
69 {
70  clib_mem_free (ctx->srtp_policy[0].key);
71  clib_mem_free (ctx->srtp_policy[1].key);
72 }
73 
74 void
76 {
77  if (!ctx->is_migrated)
79  pool_put (srtp_main.ctx_pool[ctx->c_thread_index], ctx);
80 }
81 
82 static inline u32
84 {
85  srtp_tc_t *ctx;
86 
87  pool_get (srtp_main.ctx_pool[thread_index], ctx);
88  clib_memcpy (ctx, ctx_ptr, sizeof (*ctx));
89 
90  ctx->c_thread_index = thread_index;
91  ctx->srtp_ctx_handle = ctx - srtp_main.ctx_pool[thread_index];
92  return 0;
93 }
94 
95 static inline void *
97 {
98  srtp_tc_t *sc;
99 
100  sc = clib_mem_alloc (sizeof (*sc));
101  clib_memcpy (sc, ctx, sizeof (*sc));
102 
103  return sc;
104 }
105 
106 u32
108 {
109  srtp_main_t *sm = &srtp_main;
110  srtp_tc_t *ctx;
111 
112  pool_get_zero (sm->listener_ctx_pool, ctx);
113  return ctx - sm->listener_ctx_pool;
114 }
115 
116 void
118 {
119  srtp_ctx_free_policy (ctx);
120  if (CLIB_DEBUG)
121  clib_memset (ctx, 0xfb, sizeof (*ctx));
122  pool_put (srtp_main.listener_ctx_pool, ctx);
123 }
124 
125 srtp_tc_t *
127 {
128  return pool_elt_at_index (srtp_main.listener_ctx_pool, ctx_index);
129 }
130 
131 u32
133 {
134  return (ctx - srtp_main.listener_ctx_pool);
135 }
136 
137 static int
139 {
140  session_t *app_session;
141  app_worker_t *app_wrk;
142  session_error_t err;
143 
144  if (srtp_create (&ctx->srtp_ctx, &ctx->srtp_policy[0]) != srtp_err_status_ok)
145  {
146  SRTP_DBG (0, "failed to init srtp ctx");
147  return -1;
148  }
149 
150  app_wrk = app_worker_get (ctx->parent_app_wrk_index);
151  app_session = session_get (ctx->c_s_index, ctx->c_thread_index);
152  app_session->app_wrk_index = ctx->parent_app_wrk_index;
153  app_session->connection_index = ctx->srtp_ctx_handle;
154  app_session->session_type =
155  session_type_from_proto_and_ip (TRANSPORT_PROTO_SRTP, ctx->udp_is_ip4);
156 
157  if ((err = app_worker_init_connected (app_wrk, app_session)))
158  goto failed;
159 
160  app_session->session_state = SESSION_STATE_READY;
161  if (app_worker_connect_notify (app_wrk, app_session, SESSION_E_NONE,
162  ctx->parent_app_api_context))
163  {
164  SRTP_DBG (0, "failed to notify app");
165  app_session->session_state = SESSION_STATE_CONNECTING;
166  srtp_disconnect (ctx->srtp_ctx_handle, vlib_get_thread_index ());
167  return -1;
168  }
169 
170  ctx->app_session_handle = session_handle (app_session);
171 
172  return 0;
173 
174 failed:
175  /* Free app session pre-allocated when transport was established */
176  session_free (session_get (ctx->c_s_index, ctx->c_thread_index));
177  ctx->no_app_session = 1;
178  srtp_disconnect (ctx->srtp_ctx_handle, vlib_get_thread_index ());
179  return app_worker_connect_notify (app_wrk, 0, err,
180  ctx->parent_app_api_context);
181 }
182 
183 static int
185 {
186  session_t *app_listener, *app_session;
187  app_worker_t *app_wrk;
188  srtp_tc_t *lctx;
189  int rv;
190 
191  if (srtp_create (&ctx->srtp_ctx, ctx->srtp_policy) != srtp_err_status_ok)
192  return -1;
193 
194  lctx = srtp_listener_ctx_get (ctx->listener_ctx_index);
195  app_listener = listen_session_get_from_handle (lctx->app_session_handle);
196 
197  app_session = session_get (ctx->c_s_index, ctx->c_thread_index);
198  app_session->app_wrk_index = ctx->parent_app_wrk_index;
199  app_session->connection_index = ctx->srtp_ctx_handle;
200  app_session->session_type = app_listener->session_type;
201  app_session->listener_handle = listen_session_get_handle (app_listener);
202  app_session->session_state = SESSION_STATE_ACCEPTING;
203 
204  if ((rv = app_worker_init_accepted (app_session)))
205  {
206  SRTP_DBG (1, "failed to allocate fifos");
207  session_free (app_session);
208  return rv;
209  }
210  ctx->app_session_handle = session_handle (app_session);
211  ctx->parent_app_wrk_index = app_session->app_wrk_index;
212  app_wrk = app_worker_get (app_session->app_wrk_index);
213  return app_worker_accept_notify (app_wrk, app_session);
214 }
215 
216 static int
218 {
219  if (srtp_dealloc (ctx->srtp_ctx))
220  SRTP_DBG (0, "%u failed to cleanup srtp state", ctx->c_c_index);
221  return 0;
222 }
223 
224 static inline int
227 {
228  u32 n_wrote = 0, to_deq, dgram_sz;
231  svm_msg_q_t *mq;
232  session_t *us;
233  u8 buf[2000];
234  int rv, len;
235 
237 
238  us = session_get_from_handle (ctx->srtp_session_handle);
239  to_deq = svm_fifo_max_dequeue_cons (app_session->tx_fifo);
241 
242  while (to_deq > 0)
243  {
244  /* Peeking only pre-header dgram because the session is connected */
245  rv = svm_fifo_peek (app_session->tx_fifo, 0, sizeof (hdr), (u8 *) &hdr);
246  ASSERT (rv == sizeof (hdr) && hdr.data_length < vec_len (buf));
247  ASSERT (to_deq >= hdr.data_length + SESSION_CONN_HDR_LEN);
248 
249  dgram_sz = hdr.data_length + SESSION_CONN_HDR_LEN;
250  if (svm_fifo_max_enqueue_prod (us->tx_fifo) < dgram_sz + 1000)
251  {
255  goto done;
256  }
257 
258  rv = svm_fifo_peek (app_session->tx_fifo, SESSION_CONN_HDR_LEN,
259  hdr.data_length, buf);
260  ASSERT (rv == hdr.data_length);
261  svm_fifo_dequeue_drop (app_session->tx_fifo, dgram_sz);
262 
263  len = rv;
264 
265  rv = srtp_protect (ctx->srtp_ctx, buf, &len);
266  if (rv != srtp_err_status_ok)
267  {
268  SRTP_DBG (0, "failed to protect %u", rv);
269  return 0;
270  }
271 
272  rv = app_send_dgram_raw (us->tx_fifo, &at, mq, (u8 *) buf, len,
273  SESSION_IO_EVT_TX, 1 /* do_evt */,
274  0 /* noblock */);
275  ASSERT (rv == len);
276 
277  n_wrote += rv;
278  to_deq -= dgram_sz;
279  }
280 
281 done:
282 
283  if (svm_fifo_needs_deq_ntf (app_session->tx_fifo, n_wrote))
284  session_dequeue_notify (app_session);
285 
286  if (n_wrote)
287  {
288  if (svm_fifo_set_event (us->tx_fifo))
290  }
291 
292  if (PREDICT_FALSE (ctx->app_closed &&
294  {
297  }
298 
299  return n_wrote > 0 ? clib_max (n_wrote / TRANSPORT_PACER_MIN_MSS, 1) : 0;
300 }
301 
302 int
304 {
305  if (svm_fifo_set_event (s->rx_fifo))
307  return 0;
308 }
309 
310 void
312 {
313  app_worker_t *app_wrk;
314  app_wrk = app_worker_get_if_valid (app_session->app_wrk_index);
315  if (PREDICT_TRUE (app_wrk != 0))
316  app_worker_lock_and_send_event (app_wrk, app_session, SESSION_IO_EVT_RX);
317 }
318 
319 static inline int
321 {
324  session_t *app_session;
325  u32 n_read = 0;
326  u8 buf[2000];
327  int rv, len;
328 
329  app_session = session_get_from_handle (ctx->app_session_handle);
330  svm_fifo_fill_chunk_list (app_session->rx_fifo);
331 
332  while (svm_fifo_max_dequeue_cons (us->rx_fifo) > 0)
333  {
334  if (svm_fifo_max_enqueue_prod (app_session->rx_fifo) < 2000)
335  {
337  goto done;
338  }
339 
340  rv = app_recv_dgram_raw (us->rx_fifo, (u8 *) buf, 2000, &at,
341  0 /* clear evt */, 0 /* peek */);
342  ASSERT (rv > 0);
343  len = rv;
344 
345  rv = srtp_unprotect (ctx->srtp_ctx, buf, &len);
346 
347  if (rv != srtp_err_status_ok)
348  {
349  SRTP_DBG (0, "failed to unprotect %d", rv);
350  return 0;
351  }
352  n_read += len;
353 
354  hdr.data_length = len;
355  hdr.data_offset = 0;
356 
357  svm_fifo_seg_t segs[2] = { { (u8 *) &hdr, sizeof (hdr) }, { buf, len } };
358 
359  rv = svm_fifo_enqueue_segments (app_session->rx_fifo, segs, 2,
360  0 /* allow partial */);
361  ASSERT (rv > 0);
362  }
363 
364 done:
365 
366  srtp_notify_app_enqueue (ctx, app_session);
367 
368  return n_read;
369 }
370 
371 int
372 srtp_add_segment_callback (u32 client_index, u64 segment_handle)
373 {
374  /* No-op for builtin */
375  return 0;
376 }
377 
378 int
379 srtp_del_segment_callback (u32 client_index, u64 segment_handle)
380 {
381  return 0;
382 }
383 
384 void
386 {
387  clib_warning ("udp %u disconnected?", us->session_index);
388 }
389 
390 void
392 {
393  clib_warning ("udp %u reset?", us->session_index);
394 }
395 
396 static int
397 srtp_session_connected_callback (u32 srtp_app_index, u32 ctx_handle,
398  session_t *us, session_error_t err)
399 {
400  session_t *app_session;
401  session_type_t st;
402  srtp_tc_t *ctx;
403 
404  ctx = srtp_ctx_get_w_thread (ctx_handle, 1 /* udp allocs on thread 1 */);
405 
406  ctx->srtp_session_handle = session_handle (us);
407  ctx->c_flags |= TRANSPORT_CONNECTION_F_NO_LOOKUP;
408  us->opaque = ctx_handle;
409 
410  /* Preallocate app session. Avoids allocating a session on srtp_session rx
411  * and potentially invalidating the session pool */
412  app_session = session_alloc (ctx->c_thread_index);
413  app_session->session_state = SESSION_STATE_CREATED;
414  ctx->c_s_index = app_session->session_index;
415 
416  st = session_type_from_proto_and_ip (TRANSPORT_PROTO_SRTP, ctx->udp_is_ip4);
417  app_session->session_type = st;
418  app_session->connection_index = ctx->srtp_ctx_handle;
419 
420  return srtp_ctx_init_client (ctx);
421 }
422 
423 int
425 {
426  session_t *srtp_listener, *app_session;
427  srtp_tc_t *lctx, *ctx;
428  u32 ctx_handle;
429 
430  srtp_listener = listen_session_get_from_handle (us->listener_handle);
431  lctx = srtp_listener_ctx_get (srtp_listener->opaque);
432 
433  ctx_handle = srtp_ctx_alloc_w_thread (us->thread_index);
434  ctx = srtp_ctx_get_w_thread (ctx_handle, us->thread_index);
435  clib_memcpy_fast (ctx, lctx, sizeof (*lctx));
436  ctx->c_thread_index = vlib_get_thread_index ();
437  ctx->srtp_ctx_handle = ctx_handle;
438  us->session_state = SESSION_STATE_READY;
439  us->opaque = ctx_handle;
440  ctx->srtp_session_handle = session_handle (us);
441  ctx->listener_ctx_index = srtp_listener->opaque;
442  ctx->c_flags |= TRANSPORT_CONNECTION_F_NO_LOOKUP;
443 
445  clib_memcpy (ctx->srtp_policy[0].key, lctx->srtp_policy[0].key,
448  clib_memcpy (ctx->srtp_policy[1].key, lctx->srtp_policy[1].key,
450 
451  app_session = session_alloc (ctx->c_thread_index);
452  app_session->session_state = SESSION_STATE_CREATED;
453  ctx->c_s_index = app_session->session_index;
454 
455  SRTP_DBG (1, "Accept on listener %u new connection [%u]%x",
456  srtp_listener->opaque, vlib_get_thread_index (), ctx_handle);
457 
458  return srtp_ctx_init_server (ctx);
459 }
460 
461 int
463 {
464  srtp_tc_t *ctx;
465 
466  ctx = srtp_ctx_get_w_thread (us->opaque, us->thread_index);
467  srtp_ctx_read (ctx, us);
468  return 0;
469 }
470 
471 int
473 {
474  srtp_tc_t *ctx;
475 
476  ctx = srtp_ctx_get_w_thread (us->opaque, us->thread_index);
478 
479  return 0;
480 }
481 
482 static void
484 {
485  srtp_tc_t *ctx;
486 
487  if (ntf == SESSION_CLEANUP_TRANSPORT)
488  {
489  /* Allow cleanup of tcp session */
490  if (s->session_state == SESSION_STATE_TRANSPORT_DELETED)
491  session_close (s);
492  return;
493  }
494 
496  if (!ctx->no_app_session)
498  srtp_ctx_deinit (ctx);
499  srtp_ctx_free (ctx);
500 }
501 
502 static void
504 {
505  u32 ctx_index = pointer_to_uword (arg);
506  srtp_tc_t *ctx;
507 
508  ctx = srtp_ctx_get_w_thread (ctx_index, vlib_get_thread_index ());
509  srtp_ctx_free (ctx);
510 }
511 
512 static void
513 srtp_migrate_ctx (void *arg)
514 {
515  u32 ctx_handle, thread_index, old_thread_index, old_ctx_index;
516  srtp_tc_t *ctx = (srtp_tc_t *) arg;
517  session_t *us, *new_app_session;
518  void *rargs;
519 
520  old_thread_index = ctx->c_thread_index;
521  old_ctx_index = ctx->c_c_index;
522  thread_index = session_thread_from_handle (ctx->srtp_session_handle);
523  ASSERT (thread_index == vlib_get_thread_index ());
524 
525  ctx_handle = srtp_ctx_attach (thread_index, ctx);
526  ctx = srtp_ctx_get_w_thread (ctx_handle, thread_index);
527  ctx->srtp_ctx_handle = ctx_handle;
528  SRTP_DBG (1, "migrated ctx handle %u", ctx_handle);
529 
530  us = session_get_from_handle (ctx->srtp_session_handle);
531  us->opaque = ctx_handle;
532  us->flags &= ~SESSION_F_IS_MIGRATING;
533  if (svm_fifo_max_dequeue (us->tx_fifo))
535 
536  /* Migrate app session as well */
537  session_dgram_connect_notify (&ctx->connection, old_thread_index,
538  &new_app_session);
539 
540  /* Call back original thread and ask for cleanup */
541  rargs = uword_to_pointer ((uword) old_ctx_index, void *);
543  rargs);
544 }
545 
546 static void
548 {
549  u32 new_thread = session_thread_from_handle (new_sh);
550  srtp_tc_t *ctx, *cloned_ctx;
551 
552  ctx = srtp_ctx_get_w_thread (us->opaque, us->thread_index);
553  ctx->srtp_session_handle = new_sh;
554  cloned_ctx = srtp_ctx_detach (ctx);
555  SRTP_DBG (1, "ctx %u attached to udp %x session migrating",
556  cloned_ctx->c_c_index, new_sh);
557 
559  (void *) cloned_ctx);
560 
561  /* Can't free ctx now because app might be sending as srtp is not
562  * connection oriented, so it won't wait for a handshake */
563  ctx->is_migrated = 1;
564 }
565 
566 static session_cb_vft_t srtp_app_cb_vft = {
568  .session_disconnect_callback = srtp_session_disconnect_callback,
569  .session_connected_callback = srtp_session_connected_callback,
570  .session_reset_callback = srtp_session_reset_callback,
571  .add_segment_callback = srtp_add_segment_callback,
572  .del_segment_callback = srtp_del_segment_callback,
573  .builtin_app_rx_callback = srtp_app_rx_callback,
574  .builtin_app_tx_callback = srtp_app_tx_callback,
575  .session_migrate_callback = srtp_session_migrate_callback,
576  .session_cleanup_callback = srtp_app_session_cleanup,
577 };
578 
579 static clib_error_t *
581 {
582  u32 add_segment_size = 256 << 20, first_seg_size = 32 << 20;
583  vnet_app_detach_args_t _da, *da = &_da;
584  vnet_app_attach_args_t _a, *a = &_a;
586  srtp_main_t *sm = &srtp_main;
587  u32 fifo_size = 128 << 12;
588 
589  if (!is_en)
590  {
591  da->app_index = sm->app_index;
592  da->api_client_index = APP_INVALID_INDEX;
594  return 0;
595  }
596 
597  srtp_init ();
599 
600  first_seg_size = sm->first_seg_size ? sm->first_seg_size : first_seg_size;
601  fifo_size = sm->fifo_size ? sm->fifo_size : fifo_size;
602 
603  clib_memset (a, 0, sizeof (*a));
604  clib_memset (options, 0, sizeof (options));
605 
606  a->session_cb_vft = &srtp_app_cb_vft;
607  a->api_client_index = APP_INVALID_INDEX;
608  a->options = options;
609  a->name = format (0, "srtp");
610  a->options[APP_OPTIONS_SEGMENT_SIZE] = first_seg_size;
611  a->options[APP_OPTIONS_ADD_SEGMENT_SIZE] = add_segment_size;
612  a->options[APP_OPTIONS_RX_FIFO_SIZE] = fifo_size;
613  a->options[APP_OPTIONS_TX_FIFO_SIZE] = fifo_size;
614  a->options[APP_OPTIONS_FLAGS] = APP_OPTIONS_FLAGS_IS_BUILTIN;
615  a->options[APP_OPTIONS_FLAGS] |= APP_OPTIONS_FLAGS_USE_GLOBAL_SCOPE;
616  a->options[APP_OPTIONS_FLAGS] |= APP_OPTIONS_FLAGS_IS_TRANSPORT_APP;
617 
618  if (vnet_application_attach (a))
619  return clib_error_return (0, "failed to attach srtp app");
620 
621  sm->app_index = a->app_index;
622  vec_free (a->name);
623 
624  return 0;
625 }
626 
627 int
629 {
630  vnet_connect_args_t _cargs = { {}, }, *cargs = &_cargs;
632  srtp_main_t *sm = &srtp_main;
633  app_worker_t *app_wrk;
634  application_t *app;
635  srtp_tc_t *ctx;
636  u32 ctx_index;
637  int rv;
638 
639  sep = (session_endpoint_cfg_t *) tep;
640  if (!sep->ext_cfg)
641  return SESSION_E_NOEXTCFG;
642 
643  app_wrk = app_worker_get (sep->app_wrk_index);
644  app = application_get (app_wrk->app_index);
645 
646  ctx_index = srtp_ctx_alloc_w_thread (1 /* because of udp */);
647  ctx = srtp_ctx_get_w_thread (ctx_index, 1);
648  ctx->parent_app_wrk_index = sep->app_wrk_index;
649  ctx->parent_app_api_context = sep->opaque;
650  ctx->udp_is_ip4 = sep->is_ip4;
651  ctx->srtp_ctx_handle = ctx_index;
652 
653  srtp_init_policy (ctx, (transport_endpt_cfg_srtp_t *) sep->ext_cfg->data);
654 
655  clib_memcpy_fast (&cargs->sep, sep, sizeof (session_endpoint_t));
656  cargs->sep.transport_proto = TRANSPORT_PROTO_UDP;
657  cargs->sep_ext.transport_flags = TRANSPORT_CFG_F_CONNECTED;
658  cargs->app_index = sm->app_index;
659  cargs->api_context = ctx_index;
660  cargs->sep_ext.ns_index = app->ns_index;
661  if ((rv = vnet_connect (cargs)))
662  return rv;
663 
664  SRTP_DBG (1, "New connect request %u", ctx_index);
665  return 0;
666 }
667 
668 static void
670 {
672  .handle = ctx->srtp_session_handle,
673  .app_index = srtp_main.app_index,
674  };
675 
676  if (vnet_disconnect_session (&a))
677  SRTP_DBG (0, "disconnect returned");
678 }
679 
680 static void
682 {
683  session_t *app_session;
684  srtp_tc_t *ctx;
685 
686  SRTP_DBG (1, "App disconnecting %x", ctx_handle);
687 
688  ctx = srtp_ctx_get_w_thread (ctx_handle, thread_index);
689 
690  app_session = session_get_from_handle (ctx->app_session_handle);
691  if (!svm_fifo_max_dequeue_cons (app_session->tx_fifo))
692  {
693  /* Confirm close */
696  }
697  else
698  {
699  /* Wait for all data to be written to udp */
700  ctx->app_closed = 1;
701  }
702 }
703 
704 static u32
705 srtp_start_listen (u32 app_listener_index, transport_endpoint_t *tep)
706 {
707  vnet_listen_args_t _bargs, *args = &_bargs;
708  session_handle_t udp_al_handle;
709  srtp_main_t *sm = &srtp_main;
711  session_t *srtp_listener;
712  session_t *app_listener;
713  app_worker_t *app_wrk;
714  application_t *app;
715  app_listener_t *al;
716  srtp_tc_t *lctx;
717  u32 lctx_index;
718 
719  sep = (session_endpoint_cfg_t *) tep;
720  if (!sep->ext_cfg)
721  return SESSION_E_NOEXTCFG;
722 
723  app_wrk = app_worker_get (sep->app_wrk_index);
724  app = application_get (app_wrk->app_index);
725 
726  clib_memset (args, 0, sizeof (*args));
727  args->app_index = sm->app_index;
728  args->sep_ext = *sep;
729  args->sep_ext.ns_index = app->ns_index;
730  args->sep_ext.transport_proto = TRANSPORT_PROTO_UDP;
731  args->sep_ext.transport_flags = TRANSPORT_CFG_F_CONNECTED;
732  if (vnet_listen (args))
733  return -1;
734 
735  lctx_index = srtp_listener_ctx_alloc ();
736  udp_al_handle = args->handle;
737  al = app_listener_get_w_handle (udp_al_handle);
738  srtp_listener = app_listener_get_session (al);
739  srtp_listener->opaque = lctx_index;
740 
741  app_listener = listen_session_get (app_listener_index);
742 
743  lctx = srtp_listener_ctx_get (lctx_index);
744  lctx->parent_app_wrk_index = sep->app_wrk_index;
745  lctx->srtp_session_handle = udp_al_handle;
746  lctx->app_session_handle = listen_session_get_handle (app_listener);
747  lctx->udp_is_ip4 = sep->is_ip4;
748 
749  srtp_init_policy (lctx, (transport_endpt_cfg_srtp_t *) sep->ext_cfg->data);
750 
751  SRTP_DBG (1, "Started listening %d", lctx_index);
752  return lctx_index;
753 }
754 
755 u32
756 srtp_stop_listen (u32 lctx_index)
757 {
760  srtp_tc_t *lctx;
761  session_t *ls;
762  int rv;
763 
764  lctx = srtp_listener_ctx_get (lctx_index);
765 
766  /* Cleanup listener from session lookup table */
767  ls = session_get_from_handle (lctx->srtp_session_handle);
768  lc = session_get_transport (ls);
769 
770  sep.fib_index = lc->fib_index;
771  sep.port = lc->lcl_port;
772  sep.is_ip4 = lc->is_ip4;
773  sep.transport_proto = TRANSPORT_PROTO_SRTP;
774  clib_memcpy (&sep.ip, &lc->lcl_ip, sizeof (lc->lcl_ip));
776 
778  .handle = lctx->srtp_session_handle,
779  .app_index = srtp_main.app_index,
780  .wrk_map_index = 0 /* default wrk */
781  };
782  if ((rv = vnet_unlisten (&a)))
783  SRTP_DBG (0, "unlisten returned %d", rv);
784 
785  srtp_listener_ctx_free (lctx);
786  return 0;
787 }
788 
791 {
792  srtp_tc_t *ctx;
793  ctx = srtp_ctx_get_w_thread (ctx_index, thread_index);
794  return &ctx->connection;
795 }
796 
798 srtp_listener_get (u32 listener_index)
799 {
800  srtp_tc_t *ctx;
801  ctx = srtp_listener_ctx_get (listener_index);
802  return &ctx->connection;
803 }
804 
805 int
807 {
808  session_t *app_session = (session_t *) session;
809  srtp_tc_t *ctx;
810 
811  if (PREDICT_FALSE (app_session->session_state >=
812  SESSION_STATE_TRANSPORT_CLOSED))
813  return 0;
814 
815  sp->flags = 0;
816  ctx = srtp_ctx_get_w_thread (app_session->connection_index,
817  app_session->thread_index);
818  if (PREDICT_FALSE (ctx->is_migrated))
819  return 0;
820 
821  return srtp_ctx_write (ctx, app_session, sp);
822 }
823 
824 u8 *
825 format_srtp_ctx (u8 *s, va_list *args)
826 {
827  srtp_tc_t *ctx = va_arg (*args, srtp_tc_t *);
828  u32 udp_si, udp_ti;
829 
830  session_parse_handle (ctx->srtp_session_handle, &udp_si, &udp_ti);
831  s = format (s, "[%d:%d][SRTP] app_wrk %u index %u udp %d:%d",
832  ctx->c_thread_index, ctx->c_s_index, ctx->parent_app_wrk_index,
833  ctx->srtp_ctx_handle, udp_ti, udp_si);
834 
835  return s;
836 }
837 
838 static u8 *
839 format_srtp_listener_ctx (u8 *s, va_list *args)
840 {
841  session_t *udp_listener;
842  app_listener_t *al;
843  srtp_tc_t *ctx;
844 
845  ctx = va_arg (*args, srtp_tc_t *);
846 
847  al = app_listener_get_w_handle (ctx->srtp_session_handle);
848  udp_listener = app_listener_get_session (al);
849  s = format (s, "[%d:%d][SRTP] app_wrk %u udp %d:%d", ctx->c_thread_index,
850  ctx->c_s_index, ctx->parent_app_wrk_index,
851  udp_listener->thread_index, udp_listener->session_index);
852 
853  return s;
854 }
855 
856 static u8 *
857 format_srtp_ctx_state (u8 *s, va_list *args)
858 {
859  srtp_tc_t *ctx;
860  session_t *us;
861 
862  ctx = va_arg (*args, srtp_tc_t *);
863  us = session_get (ctx->c_s_index, ctx->c_thread_index);
864  if (us->session_state == SESSION_STATE_LISTENING)
865  s = format (s, "%s", "LISTEN");
866  else
867  {
868  if (us->session_state >= SESSION_STATE_TRANSPORT_CLOSED)
869  s = format (s, "%s", "CLOSED");
870  else if (us->session_state == SESSION_STATE_APP_CLOSED)
871  s = format (s, "%s", "APP-CLOSED");
872  else if (us->session_state >= SESSION_STATE_TRANSPORT_CLOSING)
873  s = format (s, "%s", "CLOSING");
874  else
875  s = format (s, "%s", "ESTABLISHED");
876  }
877 
878  return s;
879 }
880 
881 u8 *
882 format_srtp_connection (u8 *s, va_list *args)
883 {
884  u32 ctx_index = va_arg (*args, u32);
885  u32 thread_index = va_arg (*args, u32);
886  u32 verbose = va_arg (*args, u32);
887  srtp_tc_t *ctx;
888 
889  ctx = srtp_ctx_get_w_thread (ctx_index, thread_index);
890  if (!ctx)
891  return s;
892 
893  s = format (s, "%-" SESSION_CLI_ID_LEN "U", format_srtp_ctx, ctx);
894  if (verbose)
895  {
896  s =
898  if (verbose > 1)
899  s = format (s, "\n");
900  }
901  return s;
902 }
903 
904 u8 *
905 format_srtp_listener (u8 *s, va_list *args)
906 {
907  u32 tc_index = va_arg (*args, u32);
908  u32 __clib_unused thread_index = va_arg (*args, u32);
909  u32 verbose = va_arg (*args, u32);
910  srtp_tc_t *ctx = srtp_listener_ctx_get (tc_index);
911 
912  s = format (s, "%-" SESSION_CLI_ID_LEN "U", format_srtp_listener_ctx, ctx);
913  if (verbose)
914  s = format (s, "%-" SESSION_CLI_STATE_LEN "U", format_srtp_ctx_state, ctx);
915  return s;
916 }
917 
918 u8 *
919 format_srtp_half_open (u8 *s, va_list *args)
920 {
921  return 0;
922 }
923 
924 static void
926  transport_endpoint_t *tep, u8 is_lcl)
927 {
928  srtp_tc_t *ctx = srtp_ctx_get_w_thread (ctx_handle, thread_index);
929  session_t *udp_session;
930 
931  udp_session = session_get_from_handle (ctx->srtp_session_handle);
932  session_get_endpoint (udp_session, tep, is_lcl);
933 }
934 
935 static void
937  transport_endpoint_t *tep, u8 is_lcl)
938 {
939  session_t *srtp_listener;
940  app_listener_t *al;
941  srtp_tc_t *ctx = srtp_listener_ctx_get (ctx_handle);
942 
943  al = app_listener_get_w_handle (ctx->srtp_session_handle);
944  srtp_listener = app_listener_get_session (al);
945  session_get_endpoint (srtp_listener, tep, is_lcl);
946 }
947 
949  .enable = srtp_enable,
950  .connect = srtp_connect,
951  .close = srtp_disconnect,
952  .start_listen = srtp_start_listen,
953  .stop_listen = srtp_stop_listen,
954  .get_connection = srtp_connection_get,
955  .get_listener = srtp_listener_get,
956  .custom_tx = srtp_custom_tx_callback,
957  .format_connection = format_srtp_connection,
958  .format_half_open = format_srtp_half_open,
959  .format_listener = format_srtp_listener,
960  .get_transport_endpoint = srtp_transport_endpoint_get,
961  .get_transport_listener_endpoint = srtp_transport_listener_endpoint_get,
962  .transport_options = {
963  .name = "srtp",
964  .short_name = "R",
965  .tx_type = TRANSPORT_TX_INTERNAL,
966  .service_type = TRANSPORT_SERVICE_APP,
967  },
968 };
969 
970 static clib_error_t *
972 {
973  transport_register_protocol (TRANSPORT_PROTO_SRTP, &srtp_proto,
974  FIB_PROTOCOL_IP4, ~0);
975  transport_register_protocol (TRANSPORT_PROTO_SRTP, &srtp_proto,
976  FIB_PROTOCOL_IP6, ~0);
977  return 0;
978 }
979 
981 
983  .version = VPP_BUILD_VER,
984  .description = "Secure Real-time Transport Protocol (SRTP)",
985  .default_disabled = 1,
986 };
987 
988 /*
989  * fd.io coding-style-patch-verification: ON
990  *
991  * Local Variables:
992  * eval: (c-set-style "gnu")
993  * End:
994  */
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
Definition: vec.h:524
#define SESSION_CLI_STATE_LEN
u32 srtp_listener_ctx_alloc(void)
Definition: srtp.c:107
transport_endpt_cfg_srtp_policy_t policies[2]
Definition: srtp.h:68
int app_worker_lock_and_send_event(app_worker_t *app, session_t *s, u8 evt_type)
Send event to application.
u32 connection_index
Index of the transport connection associated to the session.
srtp_t srtp_ctx
Definition: srtp.h:95
int app_worker_init_accepted(session_t *s)
session_type_t session_type
Type built from transport and network protocol types.
u8 is_migrated
Definition: srtp.h:94
static u32 svm_fifo_max_enqueue_prod(svm_fifo_t *f)
Maximum number of bytes that can be enqueued into fifo.
Definition: svm_fifo.h:607
a
Definition: bitmap.h:544
static int srtp_ctx_write(srtp_tc_t *ctx, session_t *app_session, transport_send_params_t *sp)
Definition: srtp.c:225
static session_cb_vft_t srtp_app_cb_vft
Definition: srtp.c:566
void srtp_ctx_free(srtp_tc_t *ctx)
Definition: srtp.c:75
svm_fifo_t * tx_fifo
int app_worker_connect_notify(app_worker_t *app_wrk, session_t *s, session_error_t err, u32 opaque)
u32 ns_index
Namespace the application belongs to.
Definition: application.h:129
u32 fifo_size
Definition: srtp.h:109
srtp_tc_t ** ctx_pool
Definition: srtp.h:101
struct _vnet_connect_args vnet_connect_args_t
#define pool_get_zero(P, E)
Allocate an object E from a pool P and zero it.
Definition: pool.h:258
Notify on dequeue.
Definition: svm_fifo.h:35
struct _vnet_unlisten_args_t vnet_unlisten_args_t
u32 thread_index
#define PREDICT_TRUE(x)
Definition: clib.h:125
u32 session_index
Index in thread pool where session was allocated.
unsigned long u64
Definition: types.h:89
static svm_msg_q_t * session_main_get_vpp_event_queue(u32 thread_index)
Definition: session.h:716
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
void session_transport_delete_notify(transport_connection_t *tc)
Notification from transport that connection is being deleted.
Definition: session.c:1084
transport_connection_t * session_get_transport(session_t *s)
Definition: session.c:1745
svm_fifo_t * rx_fifo
Pointers to rx/tx buffers.
static session_t * listen_session_get_from_handle(session_handle_t handle)
Definition: session.h:630
int session_lookup_del_session_endpoint2(session_endpoint_t *sep)
void session_send_rpc_evt_to_thread(u32 thread_index, void *fp, void *rpc_args)
Definition: session.c:116
int svm_fifo_peek(svm_fifo_t *f, u32 offset, u32 len, u8 *dst)
Peek data from fifo.
Definition: svm_fifo.c:1141
void srtp_session_reset_callback(session_t *us)
Definition: srtp.c:391
static int srtp_ctx_init_server(srtp_tc_t *ctx)
Definition: srtp.c:184
u8 key[SRTP_MAX_KEYLEN]
Definition: srtp.h:63
static session_t * session_get(u32 si, u32 thread_index)
Definition: session.h:336
int vnet_unlisten(vnet_unlisten_args_t *a)
Definition: application.c:1359
static void srtp_migrate_ctx_reply(void *arg)
Definition: srtp.c:503
u32 flags
Session flags.
VLIB_PLUGIN_REGISTER()
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
Definition: pool.h:255
static void srtp_ctx_free_policy(srtp_tc_t *ctx)
Definition: srtp.c:68
static void session_parse_handle(session_handle_t handle, u32 *index, u32 *thread_index)
static u8 * format_srtp_listener_ctx(u8 *s, va_list *args)
Definition: srtp.c:839
static void srtp_disconnect(u32 ctx_handle, u32 thread_index)
Definition: srtp.c:681
unsigned char u8
Definition: types.h:56
#define SESSION_ENDPOINT_NULL
Definition: session_types.h:67
struct _vnet_bind_args_t vnet_listen_args_t
u8 * format_srtp_connection(u8 *s, va_list *args)
Definition: srtp.c:882
static session_handle_t session_handle(session_t *s)
unsigned int u32
Definition: types.h:88
void session_get_endpoint(session_t *s, transport_endpoint_t *tep, u8 is_lcl)
Definition: session.c:1756
#define clib_memcpy(d, s, n)
Definition: string.h:197
u32 app_index
Definition: srtp.h:103
u8 session_type_t
void srtp_session_disconnect_callback(session_t *us)
Definition: srtp.c:385
srtp_tc_t * srtp_listener_ctx_get(u32 ctx_index)
Definition: srtp.c:126
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:172
struct _vnet_disconnect_args_t vnet_disconnect_args_t
int svm_fifo_enqueue_segments(svm_fifo_t *f, const svm_fifo_seg_t segs[], u32 n_segs, u8 allow_partial)
Enqueue array of svm_fifo_seg_t in order.
Definition: svm_fifo.c:972
u64 first_seg_size
Definition: srtp.h:108
static u32 svm_fifo_max_dequeue(svm_fifo_t *f)
Fifo max bytes to dequeue.
Definition: svm_fifo.h:516
int srtp_custom_tx_callback(void *session, transport_send_params_t *sp)
Definition: srtp.c:806
static u32 svm_fifo_max_dequeue_cons(svm_fifo_t *f)
Fifo max bytes to dequeue optimized for consumer.
Definition: svm_fifo.h:487
static clib_error_t * srtp_transport_init(vlib_main_t *vm)
Definition: srtp.c:971
description fragment has unexpected format
Definition: map.api:433
srtp_policy_t srtp_policy[2]
Definition: srtp.h:96
void srtp_listener_ctx_free(srtp_tc_t *ctx)
Definition: srtp.c:117
#define clib_error_return(e, args...)
Definition: error.h:99
static void srtp_migrate_ctx(void *arg)
Definition: srtp.c:513
int __clib_unused rv
Definition: application.c:491
int session_send_io_evt_to_thread(svm_fifo_t *f, session_evt_type_t evt_type)
Definition: session.c:84
int srtp_add_segment_callback(u32 client_index, u64 segment_handle)
Definition: srtp.c:372
static void srtp_transport_endpoint_get(u32 ctx_handle, u32 thread_index, transport_endpoint_t *tep, u8 is_lcl)
Definition: srtp.c:925
static int app_recv_dgram_raw(svm_fifo_t *f, u8 *buf, u32 len, app_session_transport_t *at, u8 clear_evt, u8 peek)
#define SESSION_INVALID_HANDLE
Definition: session_types.h:23
struct _transport_proto_vft transport_proto_vft_t
struct _vnet_app_attach_args_t vnet_app_attach_args_t
static int srtp_ctx_deinit(srtp_tc_t *ctx)
Definition: srtp.c:217
int session_dequeue_notify(session_t *s)
Definition: session.c:816
struct _session_endpoint_cfg session_endpoint_cfg_t
transport_connection_t connection
Definition: srtp.h:75
static clib_error_t * srtp_enable(vlib_main_t *vm, u8 is_en)
Definition: srtp.c:580
#define TRANSPORT_PACER_MIN_MSS
Definition: transport.h:22
static session_type_t session_type_from_proto_and_ip(transport_proto_t proto, u8 is_ip4)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:553
static u8 * format_srtp_ctx_state(u8 *s, va_list *args)
Definition: srtp.c:857
int app_worker_accept_notify(app_worker_t *app_wrk, session_t *s)
static session_t * session_get_from_handle(session_handle_t handle)
Definition: session.h:356
session_t * app_listener_get_session(app_listener_t *al)
Definition: application.c:306
static int srtp_ctx_read(srtp_tc_t *ctx, session_t *us)
Definition: srtp.c:320
long ctx[MAX_CONNS]
Definition: main.c:144
static void * srtp_ctx_detach(srtp_tc_t *ctx)
Definition: srtp.c:96
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:305
#define APP_INVALID_INDEX
Definition: application.h:226
#define SRTP_MAX_KEYLEN
libsrtp AES 256 key len with salt
Definition: srtp.h:54
#define PREDICT_FALSE(x)
Definition: clib.h:124
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
app_worker_t * app_worker_get_if_valid(u32 wrk_index)
void srtp_notify_app_enqueue(srtp_tc_t *ctx, session_t *app_session)
Definition: srtp.c:311
static srtp_tc_t * srtp_ctx_get_w_thread(u32 ctx_index, u32 thread_index)
Definition: srtp.c:37
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 u64 listen_session_get_handle(session_t *s)
Definition: session.h:622
static void srtp_transport_listener_endpoint_get(u32 ctx_handle, transport_endpoint_t *tep, u8 is_lcl)
Definition: srtp.c:936
u8 len
Definition: ip_types.api:103
int vnet_application_attach(vnet_app_attach_args_t *a)
Attach application to vpp.
Definition: application.c:1114
static u8 svm_fifo_set_event(svm_fifo_t *f)
Set fifo event flag.
Definition: svm_fifo.h:790
void transport_connection_reschedule(transport_connection_t *tc)
Definition: transport.c:790
app transport service
static u8 svm_fifo_needs_deq_ntf(svm_fifo_t *f, u32 n_last_deq)
Check if fifo needs dequeue notification.
Definition: svm_fifo.h:882
session_handle_t listener_handle
Parent listener session index if the result of an accept.
static_always_inline uword vlib_get_thread_index(void)
Definition: threads.h:208
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:261
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:395
#define SESSION_CLI_ID_LEN
#define SESSION_CONN_HDR_LEN
static const transport_proto_vft_t srtp_proto
Definition: srtp.c:948
static int srtp_ctx_init_client(srtp_tc_t *ctx)
Definition: srtp.c:138
void session_free(session_t *s)
Definition: session.c:227
#define clib_warning(format, args...)
Definition: error.h:59
int session_dgram_connect_notify(transport_connection_t *tc, u32 old_thread_index, session_t **new_session)
Move dgram session to the right thread.
Definition: session.c:1008
Don&#39;t register connection in lookup.
transport_connection_t * srtp_connection_get(u32 ctx_index, u32 thread_index)
Definition: srtp.c:790
struct _transport_connection transport_connection_t
int app_worker_init_connected(app_worker_t *app_wrk, session_t *s)
u64 buf
Definition: application.c:493
u8 * format_srtp_ctx(u8 *s, va_list *args)
Definition: srtp.c:825
transport_connection_t * srtp_listener_get(u32 listener_index)
Definition: srtp.c:798
application_t * application_get(u32 app_index)
Definition: application.c:710
static u32 session_thread_from_handle(session_handle_t handle)
void transport_register_protocol(transport_proto_t transport_proto, const transport_proto_vft_t *vft, fib_protocol_t fib_proto, u32 output_node)
Register transport virtual function table.
Definition: transport.c:246
transport_snd_flags_t flags
Definition: transport.h:62
static u32 srtp_start_listen(u32 app_listener_index, transport_endpoint_t *tep)
Definition: srtp.c:705
Definition: srtp.h:71
static void srtp_session_migrate_callback(session_t *us, session_handle_t new_sh)
Definition: srtp.c:547
apps acting as transports
#define uword_to_pointer(u, type)
Definition: types.h:136
u32 srtp_listener_ctx_index(srtp_tc_t *ctx)
Definition: srtp.c:132
app_listener_t * app_listener_get_w_handle(session_handle_t handle)
Get app listener for listener session handle.
Definition: application.c:88
#define ASSERT(truth)
srtp_tc_t * listener_ctx_pool
Definition: srtp.h:102
int vnet_listen(vnet_listen_args_t *a)
Definition: application.c:1266
static void clib_mem_free(void *p)
Definition: mem.h:311
int vnet_application_detach(vnet_app_detach_args_t *a)
Detach application from vpp.
Definition: application.c:1188
description security check failed
Definition: map.api:373
static void svm_fifo_add_want_deq_ntf(svm_fifo_t *f, u8 ntf_type)
Set specific want notification flag.
Definition: svm_fifo.h:817
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
Definition: string.h:92
int srtp_session_accept_callback(session_t *us)
Definition: srtp.c:424
struct _vnet_app_detach_args_t vnet_app_detach_args_t
static void * clib_mem_alloc(uword size)
Definition: mem.h:253
static uword pointer_to_uword(const void *p)
Definition: types.h:131
int vnet_connect(vnet_connect_args_t *a)
Definition: application.c:1320
#define clib_max(x, y)
Definition: clib.h:335
u8 thread_index
Index of the thread that allocated the session.
#define SRTP_DBG(_lvl, _fmt, _args...)
Definition: srtp.h:34
session_t * session_alloc(u32 thread_index)
Definition: session.c:201
u8 * format_srtp_half_open(u8 *s, va_list *args)
Definition: srtp.c:919
static void srtp_init_policy(srtp_tc_t *ctx, transport_endpt_cfg_srtp_t *cfg)
Definition: srtp.c:43
u32 srtp_stop_listen(u32 lctx_index)
Definition: srtp.c:756
int svm_fifo_fill_chunk_list(svm_fifo_t *f)
Ensure the whole fifo size is writeable.
Definition: svm_fifo.c:1228
int srtp_connect(transport_endpoint_cfg_t *tep)
Definition: srtp.c:628
app_worker_t * app_worker_get(u32 wrk_index)
u64 session_handle_t
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static int srtp_session_connected_callback(u32 srtp_app_index, u32 ctx_handle, session_t *us, session_error_t err)
Definition: srtp.c:397
volatile u8 session_state
State in session layer state machine.
void session_transport_closed_notify(transport_connection_t *tc)
Notification from transport that it is closed.
Definition: session.c:1150
u32 opaque
Opaque, for general use.
void session_close(session_t *s)
Initialize session closing procedure.
Definition: session.c:1496
u64 uword
Definition: types.h:112
u8 app_closed
Definition: srtp.h:92
static srtp_main_t srtp_main
Definition: srtp.c:20
int vnet_disconnect_session(vnet_disconnect_args_t *a)
Definition: application.c:1411
static void srtp_disconnect_transport(srtp_tc_t *ctx)
Definition: srtp.c:669
session_cleanup_ntf_t
static u32 srtp_ctx_alloc_w_thread(u32 thread_index)
Definition: srtp.c:26
u32 app_index
Index of owning app.
Definition: application.h:43
static struct option options[]
Definition: main.c:52
static u32 srtp_ctx_attach(u32 thread_index, void *ctx_ptr)
Definition: srtp.c:83
static u32 vlib_num_workers()
Definition: threads.h:354
enum session_error_ session_error_t
u32 app_wrk_index
Index of the app worker that owns the session.
int srtp_app_tx_callback(session_t *us)
Definition: srtp.c:472
u8 * format_srtp_listener(u8 *s, va_list *args)
Definition: srtp.c:905
int srtp_del_segment_callback(u32 client_index, u64 segment_handle)
Definition: srtp.c:379
int(* session_accept_callback)(session_t *new_session)
Notify server of newly accepted session.
struct _session_endpoint session_endpoint_t
int srtp_app_rx_callback(session_t *us)
Definition: srtp.c:462
u8 no_app_session
Definition: srtp.h:93
int svm_fifo_dequeue_drop(svm_fifo_t *f, u32 len)
Dequeue and drop bytes from fifo.
Definition: svm_fifo.c:1168
static void transport_connection_deschedule(transport_connection_t *tc)
Definition: transport.h:217
static session_t * listen_session_get(u32 ls_index)
Definition: session.h:653
static void srtp_app_session_cleanup(session_t *s, session_cleanup_ntf_t ntf)
Definition: srtp.c:483
int srtp_add_vpp_q_builtin_rx_evt(session_t *s)
Definition: srtp.c:303