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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #include <vnet/plugin/plugin.h>
17 #include <vpp/app/version.h>
19 #include <vnet/session/application_interface.h>
20 #include <vnet/session/application.h>
22 #include <srtp2/srtp.h>
24 #ifndef SRC_PLUGINS_SRTP_SRTP_H_
25 #define SRC_PLUGINS_SRTP_SRTP_H_
30 #define SRTP_DBG(_lvl, _fmt, _args...) \
31 if (_lvl <= SRTP_DEBUG) \
32 clib_warning (_fmt, ##_args)
34 #define SRTP_DBG(_lvl, _fmt, _args...)
37 typedef struct srtp_cxt_id_
41 session_handle_t app_session_handle;
42 u32 parent_app_api_ctx;
44 session_handle_t srtp_session_handle;
45 u32 parent_app_wrk_index;
47 u32 listener_ctx_index;
51 STATIC_ASSERT (sizeof (srtp_ctx_id_t) <= TRANSPORT_CONN_ID_LEN,
52 "ctx id must be less than TRANSPORT_CONN_ID_LEN");
54 #define SRTP_MAX_KEYLEN 46 /**< libsrtp AES 256 key len with salt */
56 typedef struct transport_endpt_cfg_srtp_policy
63 u8 key[SRTP_MAX_KEYLEN];
64 } transport_endpt_cfg_srtp_policy_t;
66 typedef struct transport_endpt_cfg_srtp
68 transport_endpt_cfg_srtp_policy_t policies[2];
69 } transport_endpt_cfg_srtp_t;
71 typedef struct srtp_ctx_
75 transport_connection_t connection;
76 srtp_ctx_id_t c_srtp_ctx_id;
78 #define parent_app_wrk_index c_srtp_ctx_id.parent_app_wrk_index
79 #define app_session_handle c_srtp_ctx_id.app_session_handle
80 #define srtp_session_handle c_srtp_ctx_id.srtp_session_handle
81 #define listener_ctx_index c_srtp_ctx_id.listener_ctx_index
82 #define udp_is_ip4 c_srtp_ctx_id.udp_is_ip4
83 #define srtp_ctx_engine c_srtp_ctx_id.srtp_engine_id
84 #define srtp_ssl_ctx c_srtp_ctx_id.ssl_ctx
85 #define srtp_ctx_handle c_c_index
86 /* Temporary storage for session open opaque. Overwritten once
87 * underlying tcp connection is established */
88 #define parent_app_api_context c_srtp_ctx_id.parent_app_api_ctx
96 srtp_policy_t srtp_policy[2];
99 typedef struct srtp_main_
101 srtp_tc_t **ctx_pool;
102 srtp_tc_t *listener_ctx_pool;
104 clib_rwlock_t half_open_rwlock;
112 #endif /* SRC_PLUGINS_SRTP_SRTP_H_ */
115 * fd.io coding-style-patch-verification: ON
118 * eval: (c-set-style "gnu")