summaryrefslogtreecommitdiff
path: root/include/asterisk/sdp_options.h
blob: a5c2d084e0a0cf2ca0cd5bc79d9908d2c2aeaf25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/*
 * Asterisk -- An open source telephony toolkit.
 *
 * Copyright (C) 2017, Digium, Inc.
 *
 * Mark Michelson <mmichelson@digium.com>
 *
 * See http://www.asterisk.org for more information about
 * the Asterisk project. Please do not directly contact
 * any of the maintainers of this project for assistance;
 * the project provides a web site, mailing lists and IRC
 * channels for your use.
 *
 * This program is free software, distributed under the terms of
 * the GNU General Public License Version 2. See the LICENSE file
 * at the top of the source tree.
 */

#ifndef _ASTERISK_SDP_OPTIONS_H
#define _ASTERISK_SDP_OPTIONS_H

struct ast_sdp_options;

/*!
 * \since 15.0.0
 * \brief Allocate a new SDP options structure.
 *
 * This will heap-allocate an SDP options structure and
 * initialize it to a set of default values.
 *
 * \retval NULL Allocation failure
 * \retval non-NULL Newly allocated SDP options
 */
struct ast_sdp_options *ast_sdp_options_alloc(void);

/*!
 * \since 15.0.0
 * \brief Free an SDP options structure.
 *
 * \note This only needs to be called if an error occurs between
 *       options allocation and a call to ast_sdp_state_alloc()
 *       Otherwise, the SDP state will take care of freeing the
 *       options for you.
 *
 * \param options The options to free
 */
void ast_sdp_options_free(struct ast_sdp_options *options);

/*!
 * \brief ICE options
 *
 * This is an enum because it is predicted that this eventually
 * support a TRICKLE-ICE option.
 */
enum ast_sdp_options_ice {
	/*! ICE is not enabled on this session */
	AST_SDP_ICE_DISABLED,
	/*! Standard ICE is enabled on this session */
	AST_SDP_ICE_ENABLED_STANDARD,
};

/*!
 * \since 15.0.0
 * \brief Set ICE options
 *
 * The default is AST_SDP_ICE_DISABLED
 */
int ast_sdp_options_set_ice(struct ast_sdp_options *options,
	enum ast_sdp_options_ice ice_setting);

/*!
 * \since 15.0.0
 * \brief Retrieve ICE options
 */
enum ast_sdp_options_ice ast_sdp_options_get_ice(const struct ast_sdp_options *options);

/*!
 * \since 15.0.0
 * \brief Enable or disable telephone events.
 *
 * A non-zero value indicates telephone events are enabled.
 * A zero value indicates telephone events are disabled.
 *
 * The default is 0
 */
int ast_sdp_options_set_telephone_event(struct ast_sdp_options *options,
	int telephone_event_enabled);

/*!
 * \since 15.0.0
 * \brief Retrieve telephone event setting.
 *
 * \retval 0 Telephone events are currently disabled.
 * \retval non-zero Telephone events are currently enabled.
 */
int ast_sdp_options_get_telephone_event(const struct ast_sdp_options *options);

/*!
 * \brief Representation of the SDP
 *
 * Users of the SDP API set the representation based on what they
 * natively handle. This indicates the type of SDP that the API expects
 * when being given an SDP, and it indicates the type of SDP that the API
 * returns when asked for one.
 */
enum ast_sdp_options_repr {
	/*! SDP is represented as a string */
	AST_SDP_REPR_STRING,
	/*! SDP is represented as a pjmedia_sdp_session */
	AST_SDP_REPR_PJMEDIA,
	/*! End of the list */
	AST_SDP_REPR_END,
};

/*!
 * \since 15.0.0
 * \brief Set the SDP representation
 *
 * The default is AST_SDP_REPR_STRING
 */
int ast_sdp_options_set_repr(struct ast_sdp_options *options,
	enum ast_sdp_options_repr repr);

/*!
 * \since 15.0.0
 * \brief Get the SDP representation
 */
enum ast_sdp_options_repr ast_sdp_options_get_repr(const struct ast_sdp_options *options);

/*!
 * \brief SDP encryption options
 */
enum ast_sdp_options_encryption {
	/*! No encryption */
	AST_SDP_ENCRYPTION_DISABLED,
	/*! SRTP SDES encryption */
	AST_SDP_ENCRYPTION_SRTP_SDES,
	/*! DTLS encryption */
	AST_SDP_ENCRYPTION_DTLS,
};

/*!
 * \since 15.0.0
 * \brief Set the SDP encryption
 *
 * The default is AST_SDP_ENCRYPTION_DISABLED
 */
int ast_sdp_options_set_encryption(struct ast_sdp_options *options,
	enum ast_sdp_options_encryption encryption);

/*!
 * \since 15.0.0
 * \brief Get the SDP encryption
 */
enum ast_sdp_options_encryption ast_sdp_options_get_encryption(const struct ast_sdp_options *options);

#endif /* _ASTERISK_SDP_OPTIONS_H */