Asterisk - The Open Source Telephony Project GIT-master-f36a736
res_srtp.h
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 2010 FIXME
5 *
6 * See http://www.asterisk.org for more information about
7 * the Asterisk project. Please do not directly contact
8 * any of the maintainers of this project for assistance;
9 * the project provides a web site, mailing lists and IRC
10 * channels for your use.
11 *
12 * This program is free software, distributed under the terms of
13 * the GNU General Public License Version 2. See the LICENSE file
14 * at the top of the source tree.
15 */
16
17/*! \file
18 * \brief SRTP resource
19 */
20
21#ifndef _ASTERISK_RES_SRTP_H
22#define _ASTERISK_RES_SRTP_H
23
24#include "asterisk.h" /* for size_t */
25
26struct ast_srtp;
27struct ast_srtp_policy;
28struct ast_rtp_instance;
29
31 int (*no_ctx)(struct ast_rtp_instance *rtp, unsigned long ssrc, void *data);
32};
33
35 /*! Create a new SRTP session for an RTP instance with a default policy */
36 int (*create)(struct ast_srtp **srtp, struct ast_rtp_instance *rtp, struct ast_srtp_policy *policy);
37 /* Replace an existing SRTP session with a new session, along with a new default policy */
38 int (*replace)(struct ast_srtp **srtp, struct ast_rtp_instance *rtp, struct ast_srtp_policy *policy);
39 /*! Destroy an SRTP session, along with all associated policies */
40 void (*destroy)(struct ast_srtp *srtp);
41 /* Add a new stream to an existing SRTP session. Note that the policy cannot be for a wildcard SSRC */
42 int (*add_stream)(struct ast_srtp *srtp, struct ast_srtp_policy *policy);
43 /* Change the source on an existing SRTP session. */
44 int (*change_source)(struct ast_srtp *srtp, unsigned int from_ssrc, unsigned int to_ssrc);
45 /* Set a callback function */
46 void (*set_cb)(struct ast_srtp *srtp, const struct ast_srtp_cb *cb, void *data);
47 /* Unprotect SRTP data */
48 int (*unprotect)(struct ast_srtp *srtp, void *buf, int *size, int rtcp);
49 /* Protect RTP data */
50 int (*protect)(struct ast_srtp *srtp, void **buf, int *size, int rtcp);
51 /* Obtain a random cryptographic key */
52 int (*get_random)(unsigned char *key, size_t len);
53};
54
55/* Crypto suites */
57 /* https://www.iana.org/assignments/srtp-protection/srtp-protection.xhtml */
68};
69
71 struct ast_srtp_policy *(*alloc)(void);
72 void (*destroy)(struct ast_srtp_policy *policy);
73 int (*set_suite)(struct ast_srtp_policy *policy, enum ast_srtp_suite suite);
74 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);
75 void (*set_ssrc)(struct ast_srtp_policy *policy, unsigned long ssrc, int inbound);
76};
77
78#endif /* _ASTERISK_RES_SRTP_H */
Asterisk main include file. File version handling, generic pbx functions.
char buf[BUFSIZE]
Definition: eagi_proxy.c:66
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
ast_srtp_suite
Definition: res_srtp.h:56
@ AST_AES_CM_128_HMAC_SHA1_80
Definition: res_srtp.h:58
@ AST_AES_GCM_256
Definition: res_srtp.h:63
@ AST_AES_GCM_128
Definition: res_srtp.h:62
@ AST_AES_CM_128_HMAC_SHA1_32
Definition: res_srtp.h:59
@ AST_AES_CM_256_HMAC_SHA1_32
Definition: res_srtp.h:61
@ AST_AES_CM_192_HMAC_SHA1_80
Definition: res_srtp.h:66
@ AST_AES_CM_256_HMAC_SHA1_80
Definition: res_srtp.h:60
@ AST_AES_GCM_128_8
Definition: res_srtp.h:64
@ AST_AES_CM_192_HMAC_SHA1_32
Definition: res_srtp.h:67
@ AST_AES_GCM_256_8
Definition: res_srtp.h:65
int(* no_ctx)(struct ast_rtp_instance *rtp, unsigned long ssrc, void *data)
Definition: res_srtp.h:31
void(* destroy)(struct ast_srtp_policy *policy)
Definition: res_srtp.h:72
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)
Definition: res_srtp.h:74
void(* set_ssrc)(struct ast_srtp_policy *policy, unsigned long ssrc, int inbound)
Definition: res_srtp.h:75
int(* set_suite)(struct ast_srtp_policy *policy, enum ast_srtp_suite suite)
Definition: res_srtp.h:73
void(* destroy)(struct ast_srtp *srtp)
Definition: res_srtp.h:40
int(* unprotect)(struct ast_srtp *srtp, void *buf, int *size, int rtcp)
Definition: res_srtp.h:48
int(* change_source)(struct ast_srtp *srtp, unsigned int from_ssrc, unsigned int to_ssrc)
Definition: res_srtp.h:44
int(* protect)(struct ast_srtp *srtp, void **buf, int *size, int rtcp)
Definition: res_srtp.h:50
int(* get_random)(unsigned char *key, size_t len)
Definition: res_srtp.h:52
int(* replace)(struct ast_srtp **srtp, struct ast_rtp_instance *rtp, struct ast_srtp_policy *policy)
Definition: res_srtp.h:38
int(* add_stream)(struct ast_srtp *srtp, struct ast_srtp_policy *policy)
Definition: res_srtp.h:42
int(* create)(struct ast_srtp **srtp, struct ast_rtp_instance *rtp, struct ast_srtp_policy *policy)
Definition: res_srtp.h:36
void(* set_cb)(struct ast_srtp *srtp, const struct ast_srtp_cb *cb, void *data)
Definition: res_srtp.h:46