libwebsockets
Lightweight C library for HTML5 websockets
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
32
36
40
44
45 /* Multi-SSRC support (RFC 3711 requires per-SSRC ROC/Seq) */
47 /* RFC 3711 3.3.2 replay list: window of 64 below replay_base */
48 uint64_t replay_base;
49 uint64_t replay_bitmap;
50 uint32_t ssrc; /* 0 = unused slot */
54 } src[4]; /* Support up to 4 streams (Video, Audio, RTX, etc) */
55
56 /* RFC 3711 3.3.2 replay list for the received SRTCP index */
57 uint64_t srtcp_rx_base;
59
61
64};
65
76 const uint8_t *master_key, const uint8_t *master_salt);
77
100lws_srtp_protect_rtp(struct lws_srtp_ctx *ctx, uint8_t *pkt, size_t *len, size_t max_len);
101
102#define lws_srtp_protect lws_srtp_protect_rtp
103
115lws_srtp_protect_rtcp(struct lws_srtp_ctx *ctx, uint8_t *pkt, size_t *len, size_t max_len);
116
128lws_srtp_unprotect_rtp(struct lws_srtp_ctx *ctx, uint8_t *pkt, size_t *len);
129
141lws_srtp_unprotect_rtcp(struct lws_srtp_ctx *ctx, uint8_t *pkt, size_t *len);
142
143#endif /* __LWS_SRTP_H__ */
unsigned short uint16_t
unsigned int uint32_t
#define LWS_EXTERN
unsigned char uint8_t
#define LWS_VISIBLE
uint8_t master_salt[14]
Definition lws-srtp.h:35
uint8_t srtcp_session_key[16]
Definition lws-srtp.h:41
uint8_t session_salt[14]
Definition lws-srtp.h:38
lws_srtp_profiles
Definition lws-srtp.h:28
@ LWS_SRTP_PROFILE_AES128_CM_HMAC_SHA1_32
Definition lws-srtp.h:30
@ LWS_SRTP_PROFILE_AES128_CM_HMAC_SHA1_80
Definition lws-srtp.h:29
int keys_derived
Definition lws-srtp.h:63
enum lws_srtp_profiles profile
Definition lws-srtp.h:62
uint8_t session_key[16]
Definition lws-srtp.h:37
LWS_VISIBLE LWS_EXTERN int lws_srtp_unprotect_rtcp(struct lws_srtp_ctx *ctx, uint8_t *pkt, size_t *len)
LWS_VISIBLE LWS_EXTERN int lws_srtp_protect_rtcp(struct lws_srtp_ctx *ctx, uint8_t *pkt, size_t *len, size_t max_len)
uint64_t srtcp_rx_bitmap
Definition lws-srtp.h:58
uint8_t master_key[16]
Definition lws-srtp.h:34
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)
struct lws_srtp_ctx::lws_srtp_src_ctx src[4]
uint8_t srtcp_session_auth[20]
Definition lws-srtp.h:43
uint64_t srtcp_rx_base
Definition lws-srtp.h:57
LWS_VISIBLE LWS_EXTERN int lws_srtp_unprotect_rtp(struct lws_srtp_ctx *ctx, uint8_t *pkt, size_t *len)
uint8_t srtcp_session_salt[14]
Definition lws-srtp.h:42
uint32_t srtcp_index
Definition lws-srtp.h:60
LWS_VISIBLE LWS_EXTERN int lws_srtp_protect_rtp(struct lws_srtp_ctx *ctx, uint8_t *pkt, size_t *len, size_t max_len)
uint8_t session_auth[20]
Definition lws-srtp.h:39