Mon Mar 19 11:30:30 2012

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    int (*create)(struct ast_srtp **srtp, struct ast_rtp_instance *rtp, struct ast_srtp_policy *policy);
00034    void (*destroy)(struct ast_srtp *srtp);
00035    int (*add_stream)(struct ast_srtp *srtp, struct ast_srtp_policy *policy);
00036    int (*change_source)(struct ast_srtp *srtp, unsigned int from_ssrc, unsigned int to_ssrc);
00037    void (*set_cb)(struct ast_srtp *srtp, const struct ast_srtp_cb *cb, void *data);
00038    int (*unprotect)(struct ast_srtp *srtp, void *buf, int *size, int rtcp);
00039    int (*protect)(struct ast_srtp *srtp, void **buf, int *size, int rtcp);
00040    int (*get_random)(unsigned char *key, size_t len);
00041 };
00042 
00043 /* Crypto suites */
00044 enum ast_srtp_suite {
00045    AST_AES_CM_128_HMAC_SHA1_80 = 1,
00046    AST_AES_CM_128_HMAC_SHA1_32 = 2,
00047    AST_F8_128_HMAC_SHA1_80     = 3
00048 };
00049 
00050 struct ast_srtp_policy_res {
00051    struct ast_srtp_policy *(*alloc)(void);
00052    void (*destroy)(struct ast_srtp_policy *policy);
00053    int (*set_suite)(struct ast_srtp_policy *policy, enum ast_srtp_suite suite);
00054    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);
00055    void (*set_ssrc)(struct ast_srtp_policy *policy, unsigned long ssrc, int inbound);
00056 };
00057 
00058 #endif /* _ASTERISK_RES_SRTP_H */

Generated on Mon Mar 19 11:30:30 2012 for Asterisk - The Open Source Telephony Project by  doxygen 1.4.7