blob: 09901af2e6c585cb7407db2523e248caeb5584a8 (
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
|
/*
* 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_TRANSLATOR_H
#define _ASTERISK_SDP_TRANSLATOR_H
#include "asterisk/sdp_options.h"
struct sdp;
/*!
* \brief SDP translator operations
*/
struct ast_sdp_translator_ops {
/*! The SDP representation on which this translator operates */
enum ast_sdp_options_impl repr;
/*! Allocate new translator private data for a translator */
void *(*translator_new)(void);
/*! Free translator private data */
void (*translator_free)(void *translator_priv);
/*! Convert the channel-native SDP into an internal Asterisk SDP */
struct ast_sdp *(*to_sdp)(void *repr_sdp, void *translator_priv);
/*! Convert an internal Asterisk SDP into a channel-native SDP */
void *(*from_sdp)(const struct ast_sdp *sdp, void *translator_priv);
};
/*!
* \brief An SDP translator
*
* An SDP translator is responsible for converting between Asterisk's internal
* representation of an SDP and the representation that is native to the channel
* driver. Translators are allocated per-use.
*/
struct ast_sdp_translator {
/*! The operations this translator uses */
struct ast_sdp_translator_ops *ops;
/*! Private data this translator uses */
void *translator_priv;
};
/*!
* \brief Register an SDP translator
* \param ops The SDP operations defined by this translator
* \retval 0 Success
* \retval -1 FAIL
*/
int ast_sdp_register_translator(struct ast_sdp_translator_ops *ops);
/*!
* \brief Unregister an SDP translator
*/
void ast_sdp_unregister_translator(struct ast_sdp_translator_ops *ops);
/*!
* \brief Allocate a new SDP translator
* \param Representation corresponding to the translator_ops to use
* \retval NULL FAIL
* \retval non-NULL New SDP translator
*/
struct ast_sdp_translator *ast_sdp_translator_new(enum ast_sdp_options_impl repr);
/*!
* \brief Free an SDP translator
*/
void ast_sdp_translator_free(struct ast_sdp_translator *translator);
/*!
* \brief Translate a native SDP to internal Asterisk SDP
*
* \param translator The translator to use when translating
* \param native_sdp The SDP from the channel driver
* \retval NULL FAIL
* \retval Non-NULL The translated SDP
*/
struct ast_sdp *ast_sdp_translator_to_sdp(struct ast_sdp_translator *translator, void *native_sdp);
/*!
* \brief Translate an internal Asterisk SDP to a native SDP
*
* \param translator The translator to use when translating
* \param ast_sdp The Asterisk SDP to translate
* \retval NULL FAIL
* \retval non-NULL The translated SDP
*/
void *ast_sdp_translator_from_sdp(struct ast_sdp_translator *translator,
const struct ast_sdp *ast_sdp);
#endif /* _ASTERISK_SDP_TRANSLATOR_H */
|