Wed Aug 7 17:15:45 2019

Asterisk developer's documentation


res_srtp.h

Go to the documentation of this file.
00001 /*
00002  * Asterisk -- An open source telephony toolkit.
00003  *
00004  * Copyright (C) 2010 FIXME
00005  *
00006  * See http://www.asterisk.org for more information about
00007  * the Asterisk project. Please do not directly contact
00008  * any of the maintainers of this project for assistance;
00009  * the project provides a web site, mailing lists and IRC
00010  * channels for your use.
00011  *
00012  * This program is free software, distributed under the terms of
00013  * the GNU General Public License Version 2. See the LICENSE file
00014  * at the top of the source tree.
00015  */
00016 
00017 /*! \file
00018  * \brief SRTP resource
00019  */
00020 
00021 #ifndef _ASTERISK_RES_SRTP_H
00022 #define _ASTERISK_RES_SRTP_H
00023 
00024 struct ast_srtp;
00025 struct ast_srtp_policy;
00026 struct ast_rtp_instance;
00027 
00028 struct ast_srtp_cb {
00029    int (*no_ctx)(struct ast_rtp_instance *rtp, unsigned long ssrc, void *data);
00030 };
00031 
00032 struct ast_srtp_res {
00033    /*! Create a new SRTP session for an RTP instance with a default policy */
00034    int (*create)(struct ast_srtp **srtp, struct ast_rtp_instance *rtp, struct ast_srtp_policy *policy);
00035    /* Replace an existing SRTP session with a new session, along with a new default policy */
00036    int (*replace)(struct ast_srtp **srtp, struct ast_rtp_instance *rtp, struct ast_srtp_policy *policy);
00037    /*! Destroy an SRTP session, along with all associated policies */
00038    void (*destroy)(struct ast_srtp *srtp);
00039    /* Add a new stream to an existing SRTP session.  Note that the policy cannot be for a wildcard SSRC */
00040    int (*add_stream)(struct ast_srtp *srtp, struct ast_srtp_policy *policy);
00041    /* Change the source on an existing SRTP session. */
00042    int (*change_source)(struct ast_srtp *srtp, unsigned int from_ssrc, unsigned int to_ssrc);
00043    /* Set a callback function */
00044    void (*set_cb)(struct ast_srtp *srtp, const struct ast_srtp_cb *cb, void *data);
00045    /* Unprotect SRTP data */
00046    int (*unprotect)(struct ast_srtp *srtp, void *buf, int *size, int rtcp);
00047    /* Protect RTP data */
00048    int (*protect)(struct ast_srtp *srtp, void **buf, int *size, int rtcp);
00049    /* Obtain a random cryptographic key */
00050    int (*get_random)(unsigned char *key, size_t len);
00051 };
00052 
00053 /* Crypto suites */
00054 enum ast_srtp_suite {
00055    AST_AES_CM_128_HMAC_SHA1_80 = 1,
00056    AST_AES_CM_128_HMAC_SHA1_32 = 2,
00057    AST_F8_128_HMAC_SHA1_80     = 3
00058 };
00059 
00060 struct ast_srtp_policy_res {
00061    struct ast_srtp_policy *(*alloc)(void);
00062    void (*destroy)(struct ast_srtp_policy *policy);
00063    int (*set_suite)(struct ast_srtp_policy *policy, enum ast_srtp_suite suite);
00064    int (*set_master_key)(struct ast_srtp_policy *policy, const unsigned char *key, size_t key_len, const unsigned char *salt, size_t salt_len);
00065    void (*set_ssrc)(struct ast_srtp_policy *policy, unsigned long ssrc, int inbound);
00066 };
00067 
00068 #endif /* _ASTERISK_RES_SRTP_H */

Generated on 7 Aug 2019 for Asterisk - The Open Source Telephony Project by  doxygen 1.6.1