00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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
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