From 5a130b2e1730467cd209d3b3c929ff5f24a2aa02 Mon Sep 17 00:00:00 2001 From: Mark Michelson Date: Tue, 14 Feb 2017 09:54:43 -0600 Subject: Add SDP translator and PJMEDIA implementation. This creates the following: * Asterisk's internal representation of an SDP * An API for translating SDPs from one format to another * An implementation of a translator for PJMEDIA Change-Id: Ie2ecd3cbebe76756577be9b133e84d2ee356d46b --- include/asterisk/sdp_priv.h | 130 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 include/asterisk/sdp_priv.h (limited to 'include/asterisk/sdp_priv.h') diff --git a/include/asterisk/sdp_priv.h b/include/asterisk/sdp_priv.h new file mode 100644 index 000000000..000d11143 --- /dev/null +++ b/include/asterisk/sdp_priv.h @@ -0,0 +1,130 @@ +/* + * Asterisk -- An open source telephony toolkit. + * + * Copyright (C) 2017, Digium, Inc. + * + * Mark Michelson + * + * 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. + */ + +/* NOTE: It is unlikely that you need to include this file. You probably will only need + * this if you are an SDP translator, or if you are an inner part of the SDP API + */ + +#ifndef _SDP_PRIV_H +#define _SDP_PRIV_H + +#include "asterisk/vector.h" + +/*! + * \brief Structure representing an SDP attribute + */ +struct ast_sdp_a_line { + /*! Attribute name */ + char *name; + /*! Attribute value. For attributes that have no value, this will be an empty string */ + char *value; +}; + +/*! + * \brief Structure representing an SDP connection + */ +struct ast_sdp_c_line { + /* IP family string (e.g. IP4 or IP6) */ + char *family; + /* Connection address. Can be an IP address or FQDN */ + char *addr; +}; + +/*! + * \brief A collection of SDP attributes + */ +AST_VECTOR(ast_sdp_a_line_vector, struct ast_sdp_a_line); + +/*! + * \brief An SDP media stream + * + * This contains both the m line, as well as its + * constituent a lines. + */ +struct ast_sdp_m_line { + /*! Media type (e.g. "audio" or "video") */ + char *type; + /*! Port number in m line */ + uint16_t port; + /*! Number of ports specified in m line */ + uint16_t port_count; + /*! RTP profile string (e.g. "RTP/AVP") */ + char *profile; + /*! RTP payloads */ + AST_VECTOR(, char *) payloads; + /*! Connection information for this media stream */ + struct ast_sdp_c_line c_line; + /*! The attributes for this media stream */ + struct ast_sdp_a_line_vector a_lines; +}; + +/*! + * \brief SDP time information + */ +struct ast_sdp_t_line { + /*! Session start time */ + uint32_t start; + /*! Session end time */ + uint32_t end; +}; + +/*! + * \brief An SDP + */ +struct ast_sdp { + /*! SDP Origin line */ + struct { + /*! Origin user name */ + char *user; + /*! Origin id */ + uint32_t id; + /*! Origin version */ + uint32_t version; + /*! Origin IP address family (e.g. "IP4" or "IP6") */ + char *family; + /*! Origin address. Can be an IP address or FQDN */ + char *addr; + } o_line; + /*! SDP Session name */ + char *s_line; + /*! SDP top-level connection information */ + struct ast_sdp_c_line c_line; + /*! SDP timing information */ + struct ast_sdp_t_line t_line; + /*! SDP top-level attributes */ + struct ast_sdp_a_line_vector a_lines; + /*! SDP media streams */ + AST_VECTOR(, struct ast_sdp_m_line) m_lines; +}; + +/*! + * \brief Allocate a new SDP. + * + * \note This does not perform any initialization. + * + * \retval NULL FAIL + * \retval non-NULL New SDP + */ +struct ast_sdp *ast_sdp_alloc(void); + +/*! + * \brief Free an SDP and all its constituent parts + */ +void ast_sdp_free(struct ast_sdp *dead); + +#endif /* _SDP_PRIV_H */ -- cgit v1.2.3