Ring Daemon 16.0.0
Loading...
Searching...
No Matches
srtp.h
Go to the documentation of this file.
1/*
2 * SRTP encryption/decryption
3 * Copyright (c) 2012 Martin Storsjo
4 *
5 * This file is part of Libav.
6 *
7 * Libav is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * Libav is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with Libav; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef SRTP_H
23#define SRTP_H
24
25#include <stdint.h>
26
27struct AVAES;
28struct AVHMAC;
29
31{
32 struct AVAES* aes;
33 struct AVHMAC* hmac;
35 uint8_t master_key[16];
36 uint8_t master_salt[14];
37 uint8_t rtp_key[16], rtcp_key[16];
38 uint8_t rtp_salt[14], rtcp_salt[14];
39 uint8_t rtp_auth[20], rtcp_auth[20];
41 uint32_t roc;
42
43 uint32_t rtcp_index;
44};
45
46int ff_srtp_set_crypto(struct SRTPContext* s, const char* suite, const char* params);
47void ff_srtp_free(struct SRTPContext* s);
48int ff_srtp_decrypt(struct SRTPContext* s, uint8_t* buf, int* lenptr);
49int ff_srtp_encrypt(struct SRTPContext* s, const uint8_t* in, int len, uint8_t* out, int outlen);
50
51/* RTCP packet types */
52enum RTCPType { RTCP_FIR = 192, RTCP_IJ = 195, RTCP_SR = 200, RTCP_TOKEN = 210, RTCP_REMB = 206 };
53
54#define RTP_PT_IS_RTCP(x) \
55 (((x) >= RTCP_FIR && (x) <= RTCP_IJ) || ((x) >= RTCP_SR && (x) <= RTCP_TOKEN))
56
57#endif /* SRTP_H */
int ff_srtp_encrypt(struct SRTPContext *s, const uint8_t *in, int len, uint8_t *out, int outlen)
int ff_srtp_set_crypto(struct SRTPContext *s, const char *suite, const char *params)
RTCPType
Definition srtp.h:52
@ RTCP_SR
Definition srtp.h:52
@ RTCP_IJ
Definition srtp.h:52
@ RTCP_FIR
Definition srtp.h:52
@ RTCP_REMB
Definition srtp.h:52
@ RTCP_TOKEN
Definition srtp.h:52
int ff_srtp_decrypt(struct SRTPContext *s, uint8_t *buf, int *lenptr)
void ff_srtp_free(struct SRTPContext *s)
uint8_t rtcp_auth[20]
Definition srtp.h:39
uint8_t rtcp_key[16]
Definition srtp.h:37
uint32_t rtcp_index
Definition srtp.h:43
struct AVAES * aes
Definition srtp.h:32
uint8_t rtcp_salt[14]
Definition srtp.h:38
uint8_t master_key[16]
Definition srtp.h:35
int rtp_hmac_size
Definition srtp.h:34
uint32_t roc
Definition srtp.h:41
uint8_t rtp_auth[20]
Definition srtp.h:39
struct AVHMAC * hmac
Definition srtp.h:33
int rtcp_hmac_size
Definition srtp.h:34
uint8_t master_salt[14]
Definition srtp.h:36
uint8_t rtp_key[16]
Definition srtp.h:37
uint8_t rtp_salt[14]
Definition srtp.h:38
int seq_largest
Definition srtp.h:40
int seq_initialized
Definition srtp.h:40