libwebsockets
Lightweight C library for HTML5 websockets
Toggle main menu visibility
class="ui-resizable-handle">
Loading...
Searching...
No Matches
lws-srtp.h
Go to the documentation of this file.
1
/*
2
* libwebsockets - small server side websockets and web server implementation
3
*
4
* Copyright (C) 2010 - 2026 Andy Green <andy@warmcat.com>
5
*
6
* Permission is hereby granted, free of charge, to any person obtaining a copy
7
* of this software and associated documentation files (the "Software"), to
8
* deal in the Software without restriction, including without limitation the
9
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10
* sell copies of the Software, and to permit persons to whom the Software is
11
* furnished to do so, subject to the following conditions:
12
*
13
* The above copyright notice and this permission notice shall be included in
14
* all copies or substantial portions of the Software.
15
*
16
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22
* IN THE SOFTWARE.
23
*/
24
25
#ifndef __LWS_SRTP_H__
26
#define __LWS_SRTP_H__
27
28
enum
lws_srtp_profiles
{
29
LWS_SRTP_PROFILE_AES128_CM_HMAC_SHA1_80
= 0x01,
30
LWS_SRTP_PROFILE_AES128_CM_HMAC_SHA1_32
= 0x02,
31
};
32
33
struct
lws_srtp_ctx
{
34
uint8_t
master_key
[16];
35
uint8_t
master_salt
[14];
36
37
uint8_t
session_key
[16];
38
uint8_t
session_salt
[14];
39
uint8_t
session_auth
[20];
40
41
uint8_t
srtcp_session_key
[16];
42
uint8_t
srtcp_session_salt
[14];
43
uint8_t
srtcp_session_auth
[20];
44
45
/* Multi-SSRC support (RFC 3711 requires per-SSRC ROC/Seq) */
46
struct
lws_srtp_src_ctx
{
47
uint32_t
ssrc
;
/* 0 = unused slot */
48
uint32_t
roc
;
49
uint16_t
last_seq
;
50
uint8_t
any_packet_received
;
51
}
src
[4];
/* Support up to 4 streams (Video, Audio, RTX, etc) */
52
53
uint32_t
srtcp_index
;
54
55
enum
lws_srtp_profiles
profile
;
56
int
keys_derived
;
57
};
58
67
LWS_VISIBLE
LWS_EXTERN
int
68
lws_srtp_init
(
struct
lws_srtp_ctx
*ctx,
enum
lws_srtp_profiles
profile,
69
const
uint8_t
*master_key,
const
uint8_t
*master_salt);
70
92
LWS_VISIBLE
LWS_EXTERN
int
93
lws_srtp_protect_rtp
(
struct
lws_srtp_ctx
*ctx,
uint8_t
*pkt,
size_t
*len,
size_t
max_len);
94
95
#define lws_srtp_protect lws_srtp_protect_rtp
96
107
LWS_VISIBLE
LWS_EXTERN
int
108
lws_srtp_protect_rtcp
(
struct
lws_srtp_ctx
*ctx,
uint8_t
*pkt,
size_t
*len,
size_t
max_len);
109
119
LWS_VISIBLE
LWS_EXTERN
int
120
lws_srtp_unprotect_rtp
(
struct
lws_srtp_ctx
*ctx,
uint8_t
*pkt,
size_t
*len);
121
131
LWS_VISIBLE
LWS_EXTERN
int
132
lws_srtp_unprotect_rtcp
(
struct
lws_srtp_ctx
*ctx,
uint8_t
*pkt,
size_t
*len);
133
134
#endif
/* __LWS_SRTP_H__ */
uint16_t
unsigned short uint16_t
Definition
libwebsockets.h:696
uint32_t
unsigned int uint32_t
Definition
libwebsockets.h:695
LWS_EXTERN
#define LWS_EXTERN
Definition
libwebsockets.h:296
uint8_t
unsigned char uint8_t
Definition
libwebsockets.h:697
LWS_VISIBLE
#define LWS_VISIBLE
Definition
libwebsockets.h:291
lws_srtp_ctx::master_salt
uint8_t master_salt[14]
Definition
lws-srtp.h:35
lws_srtp_ctx::srtcp_session_key
uint8_t srtcp_session_key[16]
Definition
lws-srtp.h:41
lws_srtp_ctx::session_salt
uint8_t session_salt[14]
Definition
lws-srtp.h:38
lws_srtp_profiles
lws_srtp_profiles
Definition
lws-srtp.h:28
LWS_SRTP_PROFILE_AES128_CM_HMAC_SHA1_32
@ LWS_SRTP_PROFILE_AES128_CM_HMAC_SHA1_32
Definition
lws-srtp.h:30
LWS_SRTP_PROFILE_AES128_CM_HMAC_SHA1_80
@ LWS_SRTP_PROFILE_AES128_CM_HMAC_SHA1_80
Definition
lws-srtp.h:29
lws_srtp_ctx::keys_derived
int keys_derived
Definition
lws-srtp.h:56
lws_srtp_ctx::profile
enum lws_srtp_profiles profile
Definition
lws-srtp.h:55
lws_srtp_ctx::session_key
uint8_t session_key[16]
Definition
lws-srtp.h:37
lws_srtp_unprotect_rtcp
LWS_VISIBLE LWS_EXTERN int lws_srtp_unprotect_rtcp(struct lws_srtp_ctx *ctx, uint8_t *pkt, size_t *len)
lws_srtp_ctx::lws_srtp_src_ctx::roc
uint32_t roc
Definition
lws-srtp.h:48
lws_srtp_protect_rtcp
LWS_VISIBLE LWS_EXTERN int lws_srtp_protect_rtcp(struct lws_srtp_ctx *ctx, uint8_t *pkt, size_t *len, size_t max_len)
lws_srtp_ctx::lws_srtp_src_ctx::last_seq
uint16_t last_seq
Definition
lws-srtp.h:49
lws_srtp_ctx::lws_srtp_src_ctx::ssrc
uint32_t ssrc
Definition
lws-srtp.h:47
lws_srtp_ctx::lws_srtp_src_ctx::any_packet_received
uint8_t any_packet_received
Definition
lws-srtp.h:50
lws_srtp_ctx::master_key
uint8_t master_key[16]
Definition
lws-srtp.h:34
lws_srtp_init
LWS_VISIBLE LWS_EXTERN int lws_srtp_init(struct lws_srtp_ctx *ctx, enum lws_srtp_profiles profile, const uint8_t *master_key, const uint8_t *master_salt)
lws_srtp_ctx::src
struct lws_srtp_ctx::lws_srtp_src_ctx src[4]
lws_srtp_ctx::srtcp_session_auth
uint8_t srtcp_session_auth[20]
Definition
lws-srtp.h:43
lws_srtp_unprotect_rtp
LWS_VISIBLE LWS_EXTERN int lws_srtp_unprotect_rtp(struct lws_srtp_ctx *ctx, uint8_t *pkt, size_t *len)
lws_srtp_ctx::srtcp_session_salt
uint8_t srtcp_session_salt[14]
Definition
lws-srtp.h:42
lws_srtp_ctx::srtcp_index
uint32_t srtcp_index
Definition
lws-srtp.h:53
lws_srtp_protect_rtp
LWS_VISIBLE LWS_EXTERN int lws_srtp_protect_rtp(struct lws_srtp_ctx *ctx, uint8_t *pkt, size_t *len, size_t max_len)
lws_srtp_ctx::session_auth
uint8_t session_auth[20]
Definition
lws-srtp.h:39
lws_srtp_ctx
Definition
lws-srtp.h:33
lws_srtp_ctx::lws_srtp_src_ctx
Definition
lws-srtp.h:46
include
libwebsockets
lws-srtp.h
Generated on
for libwebsockets by
1.18.0