FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
srtp.h
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 <
vnet/plugin/plugin.h
>
17
#include <vpp/app/version.h>
18
19
#include <
vnet/session/application_interface.h
>
20
#include <
vnet/session/application.h
>
21
22
#include <srtp2/srtp.h>
23
24
#ifndef SRC_PLUGINS_SRTP_SRTP_H_
25
#define SRC_PLUGINS_SRTP_SRTP_H_
26
27
#define SRTP_DEBUG 0
28
29
#if SRTP_DEBUG
30
#define SRTP_DBG(_lvl, _fmt, _args...) \
31
if (_lvl <= SRTP_DEBUG) \
32
clib_warning (_fmt, ##_args)
33
#else
34
#define SRTP_DBG(_lvl, _fmt, _args...)
35
#endif
36
37
typedef
struct
srtp_cxt_id_
38
{
39
union
40
{
41
session_handle_t
app_session_handle
;
42
u32
parent_app_api_ctx
;
43
};
44
session_handle_t
srtp_session_handle
;
45
u32
parent_app_wrk_index
;
46
u32
srtp_ctx
;
47
u32
listener_ctx_index
;
48
u8
udp_is_ip4
;
49
}
srtp_ctx_id_t
;
50
51
STATIC_ASSERT
(
sizeof
(
srtp_ctx_id_t
) <=
TRANSPORT_CONN_ID_LEN
,
52
"ctx id must be less than TRANSPORT_CONN_ID_LEN"
);
53
54
#define SRTP_MAX_KEYLEN 46
/**< libsrtp AES 256 key len with salt */
55
56
typedef
struct
transport_endpt_cfg_srtp_policy
57
{
58
u32
ssrc_type
;
59
u32
ssrc_value
;
60
u32
window_size
;
61
u8
allow_repeat_tx
;
62
u8
key_len
;
63
u8
key
[
SRTP_MAX_KEYLEN
];
64
}
transport_endpt_cfg_srtp_policy_t
;
65
66
typedef
struct
transport_endpt_cfg_srtp
67
{
68
transport_endpt_cfg_srtp_policy_t
policies
[2];
69
}
transport_endpt_cfg_srtp_t
;
70
71
typedef
struct
srtp_ctx_
72
{
73
union
74
{
75
transport_connection_t
connection
;
76
srtp_ctx_id_t
c_srtp_ctx_id
;
77
};
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
89
90
u8
is_passive_close
;
91
u8
resume
;
92
u8
app_closed
;
93
u8
no_app_session
;
94
u8
is_migrated
;
95
srtp_t
srtp_ctx
;
96
srtp_policy_t
srtp_policy
[2];
97
}
srtp_tc_t
;
98
99
typedef
struct
srtp_main_
100
{
101
srtp_tc_t
**
ctx_pool
;
102
srtp_tc_t
*
listener_ctx_pool
;
103
u32
app_index
;
104
clib_rwlock_t
half_open_rwlock
;
105
/*
106
* Config
107
*/
108
u64
first_seg_size
;
109
u32
fifo_size
;
110
}
srtp_main_t
;
111
112
#endif
/* SRC_PLUGINS_SRTP_SRTP_H_ */
113
114
/*
115
* fd.io coding-style-patch-verification: ON
116
*
117
* Local Variables:
118
* eval: (c-set-style "gnu")
119
* End:
120
*/
transport_endpt_cfg_srtp_t
struct transport_endpt_cfg_srtp transport_endpt_cfg_srtp_t
STATIC_ASSERT
STATIC_ASSERT(sizeof(srtp_ctx_id_t)<=TRANSPORT_CONN_ID_LEN, "ctx id must be less than TRANSPORT_CONN_ID_LEN")
transport_endpt_cfg_srtp::policies
transport_endpt_cfg_srtp_policy_t policies[2]
Definition:
srtp.h:68
transport_endpt_cfg_srtp_policy_t
struct transport_endpt_cfg_srtp_policy transport_endpt_cfg_srtp_policy_t
transport_endpt_cfg_srtp_policy::key
u8 key[SRTP_MAX_KEYLEN]
Definition:
srtp.h:63
transport_endpt_cfg_srtp_policy
Definition:
srtp.h:56
srtp_ctx_::no_app_session
u8 no_app_session
Definition:
srtp.h:93
srtp_ctx_::is_migrated
u8 is_migrated
Definition:
srtp.h:94
srtp_ctx_::c_srtp_ctx_id
srtp_ctx_id_t c_srtp_ctx_id
Definition:
srtp.h:76
session_handle_t
u64 session_handle_t
Definition:
session_types.h:111
srtp_ctx_::is_passive_close
u8 is_passive_close
Definition:
srtp.h:90
transport_endpt_cfg_srtp
Definition:
srtp.h:66
SRTP_MAX_KEYLEN
#define SRTP_MAX_KEYLEN
libsrtp AES 256 key len with salt
Definition:
srtp.h:54
srtp_ctx_::srtp_policy
srtp_policy_t srtp_policy[2]
Definition:
srtp.h:96
srtp_ctx_::connection
transport_connection_t connection
Definition:
srtp.h:75
srtp_main_::first_seg_size
u64 first_seg_size
Definition:
srtp.h:108
transport_connection_t
struct _transport_connection transport_connection_t
srtp_ctx_
Definition:
srtp.h:71
transport_endpt_cfg_srtp_policy::ssrc_value
u32 ssrc_value
Definition:
srtp.h:59
srtp_main_
Definition:
srtp.h:99
srtp_cxt_id_::parent_app_api_ctx
u32 parent_app_api_ctx
Definition:
srtp.h:42
srtp_main_::app_index
u32 app_index
Definition:
srtp.h:103
srtp_ctx_id_t
struct srtp_cxt_id_ srtp_ctx_id_t
srtp_main_::half_open_rwlock
clib_rwlock_t half_open_rwlock
Definition:
srtp.h:104
clib_rw_lock_
Definition:
lock.h:139
srtp_cxt_id_::udp_is_ip4
u8 udp_is_ip4
Definition:
srtp.h:48
srtp_main_t
struct srtp_main_ srtp_main_t
transport_endpt_cfg_srtp_policy::window_size
u32 window_size
Definition:
srtp.h:60
srtp_cxt_id_::srtp_session_handle
session_handle_t srtp_session_handle
Definition:
srtp.h:44
plugin.h
srtp_ctx_::resume
u8 resume
Definition:
srtp.h:91
srtp_main_::fifo_size
u32 fifo_size
Definition:
srtp.h:109
srtp_cxt_id_::parent_app_wrk_index
u32 parent_app_wrk_index
Definition:
srtp.h:45
u64
unsigned long u64
Definition:
types.h:89
srtp_main_::ctx_pool
srtp_tc_t ** ctx_pool
Definition:
srtp.h:101
srtp_cxt_id_::listener_ctx_index
u32 listener_ctx_index
Definition:
srtp.h:47
u32
unsigned int u32
Definition:
types.h:88
srtp_cxt_id_::srtp_ctx
u32 srtp_ctx
Definition:
srtp.h:46
transport_endpt_cfg_srtp_policy::ssrc_type
u32 ssrc_type
Definition:
srtp.h:58
transport_endpt_cfg_srtp_policy::key_len
u8 key_len
Definition:
srtp.h:62
srtp_ctx_::app_closed
u8 app_closed
Definition:
srtp.h:92
application_interface.h
u8
unsigned char u8
Definition:
types.h:56
srtp_cxt_id_
Definition:
srtp.h:37
srtp_ctx_::srtp_ctx
srtp_t srtp_ctx
Definition:
srtp.h:95
srtp_main_::listener_ctx_pool
srtp_tc_t * listener_ctx_pool
Definition:
srtp.h:102
TRANSPORT_CONN_ID_LEN
#define TRANSPORT_CONN_ID_LEN
Definition:
transport_types.h:74
srtp_tc_t
struct srtp_ctx_ srtp_tc_t
transport_endpt_cfg_srtp_policy::allow_repeat_tx
u8 allow_repeat_tx
Definition:
srtp.h:61
srtp_cxt_id_::app_session_handle
session_handle_t app_session_handle
Definition:
srtp.h:41
application.h
src
plugins
srtp
srtp.h
Generated on Sat Jan 8 2022 10:04:22 for FD.io VPP by
1.8.17