Asterisk - The Open Source Telephony Project
21.4.1
|
SRTP and SDP Security descriptions. More...
#include "asterisk.h"
#include "asterisk/linkedlists.h"
#include "asterisk/logger.h"
#include "asterisk/sdp_srtp.h"
Go to the source code of this file.
Functions | |
struct ast_sdp_crypto * | ast_sdp_crypto_alloc (void) |
Initialize an return an ast_sdp_crypto struct. More... | |
int | ast_sdp_crypto_build_offer (struct ast_sdp_crypto *p, int taglen) |
Generate an SRTP a=crypto offer. More... | |
void | ast_sdp_crypto_destroy (struct ast_sdp_crypto *crypto) |
Destroy a previously allocated ast_sdp_crypto struct. | |
int | ast_sdp_crypto_process (struct ast_rtp_instance *rtp, struct ast_sdp_srtp *srtp, const char *attr) |
Parse the a=crypto line from SDP and set appropriate values on the ast_sdp_crypto struct. More... | |
int | ast_sdp_crypto_register (struct ast_sdp_crypto_api *api) |
Register SDP SRTP crypto processing routines. More... | |
void | ast_sdp_crypto_unregister (struct ast_sdp_crypto_api *api) |
Unregister SDP SRTP crypto processing routines. More... | |
char * | ast_sdp_get_rtp_profile (unsigned int sdes_active, struct ast_rtp_instance *instance, unsigned int using_avpf, unsigned int force_avp) |
Get the RTP profile in use by a media session. More... | |
struct ast_sdp_srtp * | ast_sdp_srtp_alloc (void) |
allocate a ast_sdp_srtp structure More... | |
void | ast_sdp_srtp_destroy (struct ast_sdp_srtp *srtp) |
free a ast_sdp_srtp structure More... | |
const char * | ast_sdp_srtp_get_attrib (struct ast_sdp_srtp *srtp, int dtls_enabled, int default_taglen_32) |
Get the crypto attribute line for the srtp structure. More... | |
Variables | |
static struct ast_sdp_crypto_api * | sdp_crypto_api |
SRTP and SDP Security descriptions.
Specified in RFC 3711, 6188, 7714, and 4568
Definition in file sdp_srtp.c.
struct ast_sdp_crypto* ast_sdp_crypto_alloc | ( | void | ) |
Initialize an return an ast_sdp_crypto struct.
This function allocates a new ast_sdp_crypto struct and initializes its values
NULL | on failure |
Definition at line 71 of file sdp_srtp.c.
References ast_sdp_crypto_api::alloc.
int ast_sdp_crypto_build_offer | ( | struct ast_sdp_crypto * | p, |
int | taglen | ||
) |
Generate an SRTP a=crypto offer.
The offer is stored on the ast_sdp_crypto struct in a_crypto
p | A valid ast_sdp_crypto struct |
taglen | Length |
0 | success |
nonzero | failure |
Definition at line 87 of file sdp_srtp.c.
References ast_sdp_crypto_api::build_offer.
int ast_sdp_crypto_process | ( | struct ast_rtp_instance * | rtp, |
struct ast_sdp_srtp * | srtp, | ||
const char * | attr | ||
) |
Parse the a=crypto line from SDP and set appropriate values on the ast_sdp_crypto struct.
The attribute line should already have "a=crypto:" removed.
rtp | The rtp instance associated with the SDP being parsed |
srtp | SRTP structure |
attr | the a:crypto line from SDP |
0 | success |
nonzero | failure |
Definition at line 79 of file sdp_srtp.c.
References ast_sdp_crypto_api::parse_offer.
int ast_sdp_crypto_register | ( | struct ast_sdp_crypto_api * | api | ) |
Register SDP SRTP crypto processing routines.
api | Callbacks to register. |
0 | on success. |
-1 | on error. |
Definition at line 123 of file sdp_srtp.c.
void ast_sdp_crypto_unregister | ( | struct ast_sdp_crypto_api * | api | ) |
Unregister SDP SRTP crypto processing routines.
api | Callbacks to unregister. |
Definition at line 132 of file sdp_srtp.c.
char* ast_sdp_get_rtp_profile | ( | unsigned int | sdes_active, |
struct ast_rtp_instance * | instance, | ||
unsigned int | using_avpf, | ||
unsigned int | force_avp | ||
) |
Get the RTP profile in use by a media session.
sdes_active | Whether the media session is using SDES-SRTP |
instance | The RTP instance associated with this media session |
using_avpf | Whether the media session is using early feedback (AVPF) |
force_avp | Force SAVP or SAVPF profile when DTLS is in use |
Definition at line 103 of file sdp_srtp.c.
References ast_rtp_engine_dtls::active, and ast_rtp_instance_get_dtls().
Referenced by create_outgoing_sdp_stream().
struct ast_sdp_srtp* ast_sdp_srtp_alloc | ( | void | ) |
allocate a ast_sdp_srtp structure
NULL | on failure |
Definition at line 41 of file sdp_srtp.c.
References ast_calloc, and ast_debug.
void ast_sdp_srtp_destroy | ( | struct ast_sdp_srtp * | srtp | ) |
free a ast_sdp_srtp structure
srtp | a ast_sdp_srtp structure |
Definition at line 51 of file sdp_srtp.c.
References AST_LIST_NEXT, and ast_sdp_crypto_destroy().
const char* ast_sdp_srtp_get_attrib | ( | struct ast_sdp_srtp * | srtp, |
int | dtls_enabled, | ||
int | default_taglen_32 | ||
) |
Get the crypto attribute line for the srtp structure.
The attribute line does not contain the initial "a=crypto:" and does not terminate with "\r\n".
srtp | The ast_sdp_srtp structure for which to get an attribute line |
dtls_enabled | Whether this connection is encrypted with datagram TLS |
default_taglen_32 | Whether to default to a tag length of 32 instead of 80 |
NULL | if the srtp structure does not require an attribute line containing crypto information |
Definition at line 95 of file sdp_srtp.c.
References ast_sdp_crypto_api::get_attr.
|
static |
Registered SDP crypto API
Definition at line 39 of file sdp_srtp.c.