res_srtp.h
Go to the documentation of this file.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
00034 int (*create)(struct ast_srtp **srtp, struct ast_rtp_instance *rtp, struct ast_srtp_policy *policy);
00035
00036 int (*replace)(struct ast_srtp **srtp, struct ast_rtp_instance *rtp, struct ast_srtp_policy *policy);
00037
00038 void (*destroy)(struct ast_srtp *srtp);
00039
00040 int (*add_stream)(struct ast_srtp *srtp, struct ast_srtp_policy *policy);
00041
00042 int (*change_source)(struct ast_srtp *srtp, unsigned int from_ssrc, unsigned int to_ssrc);
00043
00044 void (*set_cb)(struct ast_srtp *srtp, const struct ast_srtp_cb *cb, void *data);
00045
00046 int (*unprotect)(struct ast_srtp *srtp, void *buf, int *size, int rtcp);
00047
00048 int (*protect)(struct ast_srtp *srtp, void **buf, int *size, int rtcp);
00049
00050 int (*get_random)(unsigned char *key, size_t len);
00051 };
00052
00053
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