| Asterisk - The Open Source Telephony Project GIT-master-27fb039
    | 
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. | |
| int | ast_sdp_crypto_build_offer (struct ast_sdp_crypto *p, int taglen) | 
| Generate an SRTP a=crypto offer. | |
| 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. | |
| int | ast_sdp_crypto_register (struct ast_sdp_crypto_api *api) | 
| Register SDP SRTP crypto processing routines. | |
| void | ast_sdp_crypto_unregister (struct ast_sdp_crypto_api *api) | 
| Unregister SDP SRTP crypto processing routines. | |
| 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. | |
| struct ast_sdp_srtp * | ast_sdp_srtp_alloc (void) | 
| allocate a ast_sdp_srtp structure | |
| void | ast_sdp_srtp_destroy (struct ast_sdp_srtp *srtp) | 
| free a ast_sdp_srtp structure | |
| 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. | |
| 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, NULL, and sdp_crypto_api.
Referenced by setup_srtp().
| 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, and sdp_crypto_api.
| void ast_sdp_crypto_destroy | ( | struct ast_sdp_crypto * | crypto | ) | 
Destroy a previously allocated ast_sdp_crypto struct.
Definition at line 64 of file sdp_srtp.c.
References ast_sdp_srtp::crypto, ast_sdp_crypto_api::dtor, and sdp_crypto_api.
Referenced by ast_sdp_srtp_destroy().
| 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, and sdp_crypto_api.
Referenced by setup_sdes_srtp().
| 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.
References sdp_crypto_api.
Referenced by res_srtp_init().
| 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.
References NULL, and sdp_crypto_api.
Referenced by res_srtp_shutdown().
| 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, ast_debug, ast_rtp_engine_srtp_is_registered(), and NULL.
Referenced by add_crypto_to_stream(), res_sdp_srtp_get_attr(), and setup_srtp().
| 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_free, AST_LIST_NEXT, ast_sdp_crypto_destroy(), ast_sdp_srtp::crypto, ast_sdp_srtp::next, NULL, and ast_sdp_srtp::sdp_srtp_list.
Referenced by session_media_dtor().
| 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, NULL, and sdp_crypto_api.
Referenced by add_crypto_to_stream().
| 
 | static | 
Registered SDP crypto API
Definition at line 39 of file sdp_srtp.c.
Referenced by ast_sdp_crypto_alloc(), ast_sdp_crypto_build_offer(), ast_sdp_crypto_destroy(), ast_sdp_crypto_process(), ast_sdp_crypto_register(), ast_sdp_crypto_unregister(), and ast_sdp_srtp_get_attrib().