Michael Jerris 5e81b98eba Sync to current darcs tree:
Mon Sep 17 14:50:04 EDT 2007  Pekka.Pessi@nokia.com
  * sofia-sip/sip_util.h: updated documentation

Mon Sep 17 14:50:18 EDT 2007  Pekka.Pessi@nokia.com
  * sofia-sip/tport_tag.h: updated documentation

Mon Sep 17 14:50:28 EDT 2007  Pekka.Pessi@nokia.com
  * soa_tag.c: updated documentation

Wed Sep 19 12:50:01 EDT 2007  Pekka.Pessi@nokia.com
  * msg: updated documentation

Wed Sep 19 13:29:50 EDT 2007  Pekka.Pessi@nokia.com
  * url: updated documentation

Wed Sep 19 13:32:14 EDT 2007  Pekka.Pessi@nokia.com
  * nth: updated documentation

Wed Sep 19 13:32:27 EDT 2007  Pekka.Pessi@nokia.com
  * nea: updated documentation

Wed Sep 19 13:33:36 EDT 2007  Pekka.Pessi@nokia.com
  * http: updated documentation

Wed Sep 19 13:36:58 EDT 2007  Pekka.Pessi@nokia.com
  * bnf: updated documentation

Wed Sep 19 13:38:58 EDT 2007  Pekka.Pessi@nokia.com
  * nua: updated nua_stack_init_handle() prototype

Wed Sep 19 18:45:56 EDT 2007  Pekka.Pessi@nokia.com
  * sip: added sip_name_addr_xtra(), sip_name_addr_dup()

Wed Sep 19 19:00:19 EDT 2007  Pekka.Pessi@nokia.com
  * sip_basic.c: cleaned old crud

Thu Sep 20 13:34:04 EDT 2007  Pekka.Pessi@nokia.com
  * iptsec: updated documentation

Thu Sep 20 13:36:22 EDT 2007  Pekka.Pessi@nokia.com
  * tport: updated documentation

Thu Sep 20 13:36:56 EDT 2007  Pekka.Pessi@nokia.com
  * su: updated documentation
  Removed internal files from doxygen-generated documentation.

Thu Sep 20 13:38:29 EDT 2007  Pekka.Pessi@nokia.com
  * soa: fixed documentation

Thu Sep 20 13:39:56 EDT 2007  Pekka.Pessi@nokia.com
  * sdp: updated documentation

Thu Sep 20 13:40:16 EDT 2007  Pekka.Pessi@nokia.com
  * ipt: updated documentation

Thu Sep 20 14:24:20 EDT 2007  Pekka.Pessi@nokia.com
  * nta: updated documentation

Thu Sep 20 14:41:04 EDT 2007  Pekka.Pessi@nokia.com
  * nua: updated documentation

  Updated tag documentation.

  Moved doxygen doc entries from sofia-sip/nua_tag.h to nua_tag.c.

  Removed internal datatypes and files from the generated documents.

Wed Sep 19 13:34:20 EDT 2007  Pekka.Pessi@nokia.com
  * docs: updated the generation of documentation. Updated links to header files.

Thu Sep 20 08:45:32 EDT 2007  Pekka.Pessi@nokia.com
  * sip/Makefile.am: added tags to <sofia-sip/sip_extra.h>

  Added check for extra tags in torture_sip.c.

Thu Sep 20 14:45:22 EDT 2007  Pekka.Pessi@nokia.com
  * stun: updated documentation

Wed Jul  4 18:55:20 EDT 2007  Pekka.Pessi@nokia.com
  * torture_heap.c: added tests for ##sort() and su_smoothsort()

Wed Jul  4 18:56:59 EDT 2007  Pekka.Pessi@nokia.com
  * Makefile.am: added smoothsort.c

Fri Jul 13 12:38:44 EDT 2007  Pekka.Pessi@nokia.com
  * sofia-sip/heap.h: heap_remove() now set()s index to 0 on removed item

Mon Jul 23 11:14:22 EDT 2007  Pekka.Pessi@nokia.com
  * sofia-sip/heap.h: fixed bug in heap##remove()

  If left kid was in heap but right was not, left kid was ignored.

Wed Jul  4 18:51:08 EDT 2007  Pekka.Pessi@nokia.com
  * smoothsort.c: added

Wed Jul  4 18:51:34 EDT 2007  Pekka.Pessi@nokia.com
  * heap.h: using su_smoothsort()

Fri Jul  6 10:20:27 EDT 2007  Pekka.Pessi@nokia.com
  * smoothsort.c: added

Wed Sep 19 17:40:30 EDT 2007  Pekka.Pessi@nokia.com
  * msg_parser.awk: generate two parser tables, default and extended

Wed Sep 19 18:39:45 EDT 2007  Pekka.Pessi@nokia.com
  * msg_parser.awk: just generate list of extra headers

  Allocate extended parser dynamically.

Wed Sep 19 18:59:59 EDT 2007  Pekka.Pessi@nokia.com
  * sip: added Remote-Party-ID, P-Asserted-Identity, P-Preferred-Identity

  Added functions sip_update_default_mclass() and sip_extend_mclass()
  for handling the extended parser. Note that Reply-To and Alert-Info are only
  available with the extended parser.

Wed Sep 19 19:05:44 EDT 2007  Pekka.Pessi@nokia.com
  * RELEASE: updated

Thu Sep 20 13:38:59 EDT 2007  Pekka.Pessi@nokia.com
  * sip: updated documentation

Thu Sep 20 14:17:28 EDT 2007  Pekka.Pessi@nokia.com
  * docs/conformance.docs: updated

Mon Oct  1 10:11:14 EDT 2007  Pekka.Pessi@nokia.com
  * tport_tag.c: re-enabled tptag_trusted

Thu Oct  4 09:21:07 EDT 2007  Pekka.Pessi@nokia.com
  * su_osx_runloop.c: moved virtual function table after struct definition

  Preparing for su_port_vtable_t refactoring.

Thu Oct  4 10:22:03 EDT 2007  Pekka.Pessi@nokia.com
  * su_source.c: refactored initialization/deinitialization

Fri Oct  5 04:58:18 EDT 2007  Pekka Pessi <Pekka.Pessi@nokia.com>
  * sip_extra.c: fixed prototypes with isize_t

Fri Oct  5 04:58:45 EDT 2007  Pekka Pessi <Pekka.Pessi@nokia.com>
  * test_nta_api.c: removed warnings about signedness

Fri Oct  5 04:59:02 EDT 2007  Pekka Pessi <Pekka.Pessi@nokia.com>
  * test_nua_params.c: removed warnings about constness

Fri Oct  5 07:20:26 EDT 2007  Pekka Pessi <first.lastname@nokia.com>
  * su_port.h, su_root.c: cleaned argument checking

  The su_root_*() and su_port_*() functions now check their arguments once
  and do not assert() with NULL arguments. The sur_task->sut_port should
  always be valid while su_root_t is alive.

Fri Oct  5 07:22:09 EDT 2007  Pekka Pessi <first.lastname@nokia.com>
  * su: added su_root_obtain(), su_root_release() and su_root_has_thread()

  When root is created with su_root_create() or cloned with su_clone_start(),
  the resulting root is obtained by the calling or created thread,
  respectively.

  The root can be released with su_root_release() and another thread can
  obtain it.

  The function su_root_has_thread() can be used to check if a thread has
  obtained or released the root.

  Implementation upgraded the su_port_own_thread() method as su_port_thread().

Fri Oct  5 07:28:10 EDT 2007  Pekka Pessi <first.lastname@nokia.com>
  * su_port.h: removed su_port_threadsafe() and su_port_yield() methods

  su_port_wait_events() replaces su_port_yield().

Fri Oct  5 13:26:04 EDT 2007  Pekka Pessi <Pekka.Pessi@nokia.com>
  * msg_parser.awk: not extending header structure unless needed.

  Removed gawk-ish /* comments */.

Fri Oct  5 14:32:25 EDT 2007  Pekka Pessi <Pekka.Pessi@nokia.com>
  * run_test_su: removed GNUisms

Fri Oct  5 14:32:47 EDT 2007  Pekka Pessi <Pekka.Pessi@nokia.com>
  * Makefile.am: removed implicit check target test_urlmap

Fri Oct  5 14:22:32 EDT 2007  Pekka Pessi <first.lastname@nokia.com>
  * torture_sresolv.c: use CLOCK_REALTIME if no CLOCK_PROCESS_CPUTIME_ID available

  Casting timespec tv_sec to unsigned long.

Fri Oct * nua_s added handling nua_prack()

  Thanks to Fabio Margarido for the patch.

Mon Oct  8 10:24:35 EDT 2007  Pekka.Pessi@nokia.com
  * test_nua: added test for sf.net bug #1803686

Mon Oct  8 08:15:23 EDT 2007  Pekka.Pessi@nokia.com
  * RELEASE: updated.

Mon Oct  8 09:30:36 EDT 2007  Pekka.Pessi@nokia.com
  * nua_stack: added handling nua_prack()

  Thanks to Fabio Margarido for the patch.

Mon Oct  8 10:24:35 EDT 2007  Pekka.Pessi@nokia.com
  * test_nua: added test for sf.net bug #1803686

Mon Oct  8 10:26:31 EDT 2007  Pekka.Pessi@nokia.com
  * nua: added test for nua_prack() (sf.net bug #1804248)

  Avoid sending nua_i_state after nua_prack() if no SDP O/A is happening, too.

Mon Oct  8 10:32:04 EDT 2007  Mikhail Zabaluev <mikhail.zabaluev@nokia.com>
  * su_source.c: don t leak the wait arrays

Mon Oct  8 10:37:11 EDT 2007  Pekka.Pessi@nokia.com
  * RELEASE: updated

Wed Oct 10 11:55:21 EDT 2007  Pekka.Pessi@nokia.com
  * sip_parser.c: silenced warning about extra const in sip_extend_mclass()

Wed Oct 10 11:57:08 EDT 2007  Pekka.Pessi@nokia.com
  * nta_tag.c: updated tag documentation

Wed Oct 10 13:16:40 EDT 2007  Pekka.Pessi@nokia.com
  * nua: fix logging crash if outbound used with application contact

  Silenced warnings.

Wed Oct 10 13:30:45 EDT 2007  Pekka.Pessi@nokia.com
  * msg_parser.awk: removed extra "const"

Wed Oct 10 13:31:45 EDT 2007  Pekka.Pessi@nokia.com
  * Makefile.am's: fixed distclean of documentation



git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5840 d0543943-73ff-0310-b7d9-9358b9ac24b2
2007-10-11 14:16:59 +00:00

563 lines
19 KiB
C

/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 2005 Nokia Corporation.
*
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef SDP_H
#define SDP_H
/**@file sofia-sip/sdp.h Simple SDP (RFC 2327) Interface.
*
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
* @author Kai Vehmanen <kai.vehmanen@nokia.com>
*
* @date Created: Fri Feb 18 08:54:48 2000 ppessi
*/
#ifndef SU_ALLOC_H
#include <sofia-sip/su_alloc.h>
#endif
#ifndef SU_TYPES_H
#include <sofia-sip/su_types.h>
#endif
SOFIA_BEGIN_DECLS
/** SDP session description */
typedef struct sdp_session_s sdp_session_t;
/** SDP version "v=" line */
typedef unsigned long sdp_version_t;
/** SDP origin "o=" line */
typedef struct sdp_origin_s sdp_origin_t;
/** SDP connection "c=" line */
typedef struct sdp_connection_s sdp_connection_t;
/** SDP bandwidth "b=" line */
typedef struct sdp_bandwidth_s sdp_bandwidth_t;
/** SDP time "t=" line */
typedef struct sdp_time_s sdp_time_t;
/** SDP repeat "r=" line */
typedef struct sdp_repeat_s sdp_repeat_t;
/** SDP timezone "z=" line */
typedef struct sdp_zone_s sdp_zone_t;
/** SDP encryption key "k=" line */
typedef struct sdp_key_s sdp_key_t;
/** SDP attribute "a=" line */
typedef struct sdp_attribute_s sdp_attribute_t;
/** SDP media "m=" line */
typedef struct sdp_media_s sdp_media_t;
/** SDP list ("e=", "p=" lines) */
typedef struct sdp_list_s sdp_list_t;
/** SDP rtpmap attribute */
typedef struct sdp_rtpmap_s sdp_rtpmap_t;
/** Message text */
typedef char const sdp_text_t;
#define SDP_MIME_TYPE "application/sdp"
enum {
SDP_CURRENT_VERSION = 0
};
/** Session description */
struct sdp_session_s
{
int sdp_size; /**< sizeof sdp_session_t */
sdp_session_t *sdp_next; /**< Next description in list */
sdp_version_t sdp_version[1]; /**< SDP version */
sdp_origin_t *sdp_origin; /**< Owner/creator and session ID */
sdp_text_t *sdp_subject; /**< Session name */
sdp_text_t *sdp_information; /**< Session information */
sdp_text_t *sdp_uri; /**< URi of description */
sdp_list_t *sdp_emails; /**< E-mail address(s) */
sdp_list_t *sdp_phones; /**< Phone number(s) */
sdp_connection_t *sdp_connection; /**< Group (or member) address */
sdp_bandwidth_t *sdp_bandwidths; /**< Session bandwidth */
sdp_time_t *sdp_time; /**< Session active time */
sdp_key_t *sdp_key; /**< Session key */
sdp_attribute_t *sdp_attributes; /**< Session attributes */
sdp_text_t *sdp_charset; /**< SDP charset (default is UTF8) */
sdp_media_t *sdp_media; /**< Media descriptors */
};
/** Session description identification */
struct sdp_origin_s
{
int o_size; /**< sizeof sdp_origin_t */
sdp_text_t *o_username; /**< Username of originator */
uint64_t o_id; /**< Session identification */
uint64_t o_version; /**< Version of session description */
sdp_connection_t *o_address; /**< Address of originator */
};
/** Network type */
typedef enum
{
sdp_net_x = 0, /**< Unknown network type */
sdp_net_in = 1 /**< Internet */
} sdp_nettype_e;
/** Address type */
typedef enum
{
sdp_addr_x = 0, /**< Unknown address type */
sdp_addr_ip4 = 1, /**< IPv4 address */
sdp_addr_ip6 = 2, /**< IPv6 address */
} sdp_addrtype_e;
/** SDP connection - host or group address */
struct sdp_connection_s
{
int c_size; /**< Size fo sdp_connection_t */
sdp_connection_t *c_next; /**< Next connection in list */
sdp_nettype_e c_nettype; /**< Network type */
sdp_addrtype_e c_addrtype; /**< Address type */
sdp_text_t *c_address; /**< Host or group address */
unsigned c_ttl : 8; /**< Time to live (scope) */
unsigned c_mcast : 1; /**< True if multicast */
unsigned : 0;
unsigned c_groups; /**< Number of groups (if multiple) */
};
/** Bandwdith type */
typedef enum
{
sdp_bw_x, /**< Unknown bandwidth type */
sdp_bw_ct, /**< Conference total */
sdp_bw_as, /**< Application-specific */
} sdp_bandwidth_e;
/** Session or media bandwidth. */
struct sdp_bandwidth_s
{
int b_size; /**< Size fo sdp_bandwidth_t */
sdp_bandwidth_t *b_next; /**< Next bw description in list */
sdp_bandwidth_e b_modifier; /**< Meaning of value
(total, or per application). */
sdp_text_t *b_modifier_name; /**< Modifier if not well-known */
unsigned long b_value; /**< Bandwidth in kilobits per second */
};
/** Active time description. */
struct sdp_time_s
{
int t_size; /**< sizeof sdp_time_t in bytes */
sdp_time_t *t_next; /**< Next time description in list */
unsigned long t_start; /**< Start time (seconds since 1900) */
unsigned long t_stop; /**< Stop time (seconds since 1900) */
sdp_repeat_t *t_repeat; /**< Repeat information */
sdp_zone_t *t_zone; /**< Time Zone infromation */
};
/** Description of repetition. */
struct sdp_repeat_s
{
int r_size; /**< Size of structure including
* r_offsets[r_number_of_offsets]
*/
int r_number_of_offsets; /**< Number of offsets in list */
unsigned long r_interval; /**< Time between activations */
unsigned long r_duration; /**< Duration of activation */
unsigned long r_offsets[1]; /**< List of offsets from start-time */
};
/** Timezone */
struct sdp_zone_s
{
/** Size of structure including z_adjustments[z_number_of_adjustments] */
int z_size;
int z_number_of_adjustments; /**< Number of adjustments in list */
struct {
unsigned long z_at; /**< Adjustment time */
long z_offset; /**< Adjustment offset */
} z_adjustments[1]; /**< List of timezone adjustments */
};
/** Mechanism to be used to obtain session key */
typedef enum {
sdp_key_x, /**< Unknown mechanism */
sdp_key_clear, /**< Key is included untransformed */
sdp_key_base64, /**< Key is encoded with base64 */
sdp_key_uri, /**< URI used to obtain a key */
sdp_key_prompt /**< No key is included,
prompt user for key */
} sdp_key_method_e;
/** Session key */
struct sdp_key_s
{
int k_size; /**< sizeof sdp_key_t */
sdp_key_method_e k_method; /**< Mechanism used to obtain key */
sdp_text_t *k_method_name; /**< Mechanism if not known */
sdp_text_t *k_material; /**< Encryption key */
};
/** Session or media attribute */
struct sdp_attribute_s {
int a_size; /**< sizeof sdp_attribute_t */
sdp_attribute_t *a_next; /**< Next attribute in list */
sdp_text_t *a_name; /**< Attribute name */
sdp_text_t *a_value; /**< Attribute value */
};
/** Media type @sa RFC2327 page 18. */
typedef enum
{
sdp_media_x = 0, /**< Unknown media */
sdp_media_any, /**< * wildcard */
sdp_media_audio, /**< Audio */
sdp_media_video, /**< Video */
sdp_media_application, /**< Conferencing */
sdp_media_data, /**< Bulk data transfer */
sdp_media_control, /**< Additional conference control */
sdp_media_message, /**< Messaging sessions*/
sdp_media_image, /**< Image browsing sessions for JPIP, and T.38 */
sdp_media_red /**< Redundancy. @NEW_1_12_4. */
} sdp_media_e;
/** Media transport protocol. */
typedef enum
{
sdp_proto_x = 0, /**< Unknown transport */
sdp_proto_tcp = 6, /**< TCP */
sdp_proto_udp = 17, /**< Plain UDP */
sdp_proto_rtp = 256, /**< RTP/AVP */
sdp_proto_srtp = 257, /**< RTP/SAVP */
sdp_proto_udptl = 258, /**< UDPTL. @NEW_1_12_4. */
sdp_proto_tls = 511, /**< TLS over TCP */
sdp_proto_any = 512 /**< * wildcard */
} sdp_proto_e;
/** Session mode. @note Identical to rtp_mode_t. */
typedef enum {
sdp_inactive = 0,
sdp_sendonly = 1,
sdp_recvonly = 2,
sdp_sendrecv = sdp_sendonly | sdp_recvonly
} sdp_mode_t;
/** Media announcement.
*
* This structure describes one media type, e.g., audio. The description
* contains the transport address (IP address and port) used for the group,
* the transport protocol used, the media formats or RTP payload types, and
* optionally media-specific bandwidth specification, encryption key and
* attributes.
*
* There is a pointer (m_user) for the application data, too.
*/
struct sdp_media_s
{
int m_size; /**< sizeof sdp_media_t */
sdp_media_t *m_next; /**< Next media announcement */
sdp_session_t *m_session; /**< Back-pointer to session level */
sdp_media_e m_type; /**< Media type */
sdp_text_t *m_type_name; /**< Media type name */
unsigned long m_port; /**< Transport port number */
unsigned long m_number_of_ports; /**< Number of ports (if multiple) */
sdp_proto_e m_proto; /**< Transport protocol */
sdp_text_t *m_proto_name; /**< Transport protocol name */
sdp_list_t *m_format; /**< List of media formats */
sdp_rtpmap_t *m_rtpmaps; /**< List of RTP maps */
sdp_text_t *m_information; /**< Media information */
sdp_connection_t *m_connections; /**< List of addresses used */
sdp_bandwidth_t *m_bandwidths; /**< Bandwidth specification */
sdp_key_t *m_key; /**< Media key */
sdp_attribute_t *m_attributes; /**< Media attributes */
void *m_user; /**< User data. */
/** Rejected media */
unsigned m_rejected : 1;
/** Inactive, recvonly, sendonly, sendrecv */
/* sdp_mode_t */ unsigned m_mode : 2;
unsigned : 0;
};
/** Text list */
struct sdp_list_s
{
int l_size; /**< sizeof sdp_list_t */
sdp_list_t *l_next; /**< Next text entry in list */
sdp_text_t *l_text; /**< Text as C string */
};
/** Mapping from RTP payload to codec.
*
* The sdp_rtpmap_t() structure defines a mapping from an RTP payload to a
* particular codec. In case of well-known payloads, the sdp_rtpmap_t()
* structure may be predefined, that is, generated by SDP parser without
* corresponding "a" line in the SDP. The sdp_rtpmap_t() structure may also
* contain the @c fmtp attribute, which is used to convey format-specific
* parameters.
*/
struct sdp_rtpmap_s {
int rm_size; /**< sizeof sdp_rtpmap_t */
sdp_rtpmap_t *rm_next; /**< Next RTP map entry */
sdp_text_t *rm_encoding; /**< Codec name */
unsigned long rm_rate; /**< Sampling rate */
sdp_text_t *rm_params; /**< Format-specific parameters */
sdp_text_t *rm_fmtp; /**< Contents of fmtp */
unsigned rm_predef : 1; /**< is this entry well-known? */
unsigned rm_pt : 7; /**< Payload type */
unsigned rm_any : 1; /**< Wildcard entry */
unsigned :0;
};
SOFIAPUBVAR sdp_rtpmap_t const * const sdp_rtpmap_well_known[128];
/** Duplicate an SDP session description structure. */
SOFIAPUBFUN sdp_session_t *sdp_session_dup(su_home_t *, sdp_session_t const *);
/** Duplicate an SDP origin structure. */
SOFIAPUBFUN
sdp_origin_t *sdp_origin_dup(su_home_t *, sdp_origin_t const *);
/** Duplicate an SDP connection structure. */
SOFIAPUBFUN
sdp_connection_t *sdp_connection_dup(su_home_t *home, sdp_connection_t const *);
/** Duplicate an SDP bandwidth structure. */
SOFIAPUBFUN
sdp_bandwidth_t *sdp_bandwidth_dup(su_home_t *home, sdp_bandwidth_t const *);
/** Duplicate an SDP time structure. */
SOFIAPUBFUN
sdp_time_t *sdp_time_dup(su_home_t *home, sdp_time_t const *);
/** Duplicate an SDP repeat structure. */
SOFIAPUBFUN
sdp_repeat_t *sdp_repeat_dup(su_home_t *home, sdp_repeat_t const *);
/** Duplicate an SDP timezone structure. */
SOFIAPUBFUN
sdp_zone_t *sdp_zone_dup(su_home_t *home, sdp_zone_t const *);
/** Duplicate an SDP key structure. */
SOFIAPUBFUN
sdp_key_t *sdp_key_dup(su_home_t *home, sdp_key_t const *);
/** Duplicate an SDP attribute structure. */
SOFIAPUBFUN
sdp_attribute_t *sdp_attribute_dup(su_home_t *home, sdp_attribute_t const *);
/** Duplicate an SDP media description structure. */
SOFIAPUBFUN
sdp_media_t *sdp_media_dup(su_home_t *, sdp_media_t const *,
sdp_session_t *);
/** Duplicate a list of SDP media description structures. */
SOFIAPUBFUN
sdp_media_t *sdp_media_dup_all(su_home_t *, sdp_media_t const *,
sdp_session_t *);
/** Duplicate a list structure. */
SOFIAPUBFUN
sdp_list_t *sdp_list_dup(su_home_t *home, sdp_list_t const *);
/** Duplicate an rtpmap structure. */
SOFIAPUBFUN
sdp_rtpmap_t *sdp_rtpmap_dup(su_home_t *home, sdp_rtpmap_t const *);
/** Compare two session descriptions. */
SOFIAPUBFUN int sdp_session_cmp(sdp_session_t const *a,
sdp_session_t const *b);
/** Compare two origin fields */
SOFIAPUBFUN int sdp_origin_cmp(sdp_origin_t const *a,
sdp_origin_t const *b);
/** Compare two connection fields */
SOFIAPUBFUN int sdp_connection_cmp(sdp_connection_t const *,
sdp_connection_t const *b);
/** Compare two bandwidth (b=) fields */
SOFIAPUBFUN int sdp_bandwidth_cmp(sdp_bandwidth_t const *a,
sdp_bandwidth_t const *b);
/** Compare two time fields */
SOFIAPUBFUN int sdp_time_cmp(sdp_time_t const *a, sdp_time_t const *b);
/* Compare two repeat (r=) fields */
SOFIAPUBFUN int sdp_repeat_cmp(sdp_repeat_t const *a, sdp_repeat_t const *b);
/* Compare two zone (z=) fields */
SOFIAPUBFUN int sdp_zone_cmp(sdp_zone_t const *a, sdp_zone_t const *b);
/** Compare two key (k=) fields. */
SOFIAPUBFUN int sdp_key_cmp(sdp_key_t const *a, sdp_key_t const *b);
/** Compare two attribute (a=) fields */
SOFIAPUBFUN int sdp_attribute_cmp(sdp_attribute_t const *,
sdp_attribute_t const *);
/** Compare two media (m=) descriptions */
SOFIAPUBFUN int sdp_media_cmp(sdp_media_t const *, sdp_media_t const *);
/** Compare two rtpmap structures. */
SOFIAPUBFUN int sdp_rtpmap_cmp(sdp_rtpmap_t const *a, sdp_rtpmap_t const *b);
/** Compare two text lists */
SOFIAPUBFUN int sdp_list_cmp(sdp_list_t const *a, sdp_list_t const *b);
/** Get connections of a media description */
SOFIAPUBFUN sdp_connection_t *sdp_media_connections(sdp_media_t const *m);
/** Check if media uses RTP as its transport protocol */
SOFIAPUBFUN int sdp_media_has_rtp(sdp_media_t const *m);
/** Set media type */
SOFIAPUBFUN void sdp_media_type(sdp_media_t *m, char const *s);
/** Set transport protocol */
SOFIAPUBFUN void sdp_media_transport(sdp_media_t *m, char const *s);
/** Find named attribute from given list. */
SOFIAPUBFUN sdp_attribute_t *sdp_attribute_find(sdp_attribute_t const *a,
char const *name);
/** Find named attribute from given lists. */
SOFIAPUBFUN sdp_attribute_t *sdp_attribute_find2(sdp_attribute_t const *a,
sdp_attribute_t const *a2,
char const *name);
/** Get session mode from attribute list. */
SOFIAPUBFUN sdp_mode_t sdp_attribute_mode(sdp_attribute_t const *a,
sdp_mode_t defmode);
/** Get session mode from attribute list. */
SOFIAPUBFUN sdp_attribute_t *sdp_attribute_by_mode(su_home_t *,
sdp_mode_t mode);
/** Find a mapped attribute. */
SOFIAPUBFUN
sdp_attribute_t *sdp_attribute_mapped_find(sdp_attribute_t const *a,
char const *name,
int pt, char **return_result);
/** Append a attribute to a list of attributes. */
SOFIAPUBFUN void sdp_attribute_append(sdp_attribute_t **list,
sdp_attribute_t const *a);
/** Replace a attribute within a list of attributes. */
SOFIAPUBFUN int sdp_attribute_replace(sdp_attribute_t **list,
sdp_attribute_t *a,
sdp_attribute_t **return_replaced);
/** Remove a named attribute from a list of attributes. */
SOFIAPUBFUN sdp_attribute_t *sdp_attribute_remove(sdp_attribute_t **list,
char const *name);
/* Return 1 if m= line struct matches with given type and name */
SOFIAPUBFUN unsigned sdp_media_match(sdp_media_t const *m,
sdp_media_e type,
sdp_text_t *type_name,
sdp_proto_e proto,
sdp_text_t *proto_name);
SOFIAPUBFUN unsigned sdp_media_match_with(sdp_media_t const *a,
sdp_media_t const *b);
/** Count media lines in SDP. */
SOFIAPUBFUN unsigned sdp_media_count(sdp_session_t const *sdp,
sdp_media_e type,
sdp_text_t *type_name,
sdp_proto_e proto,
sdp_text_t *proto_name);
SOFIAPUBFUN unsigned sdp_media_count_with(sdp_session_t const *sdp,
sdp_media_t const *m0);
/** Return true if media uses RTP */
SOFIAPUBFUN int sdp_media_uses_rtp(sdp_media_t const *m);
/** Check if payload type, rtp rate and parameters match in rtpmaps*/
SOFIAPUBFUN int sdp_rtpmap_match(sdp_rtpmap_t const *, sdp_rtpmap_t const *);
/** Search for matching rtpmap from list */
SOFIAPUBFUN sdp_rtpmap_t *sdp_rtpmap_find_matching(sdp_rtpmap_t const *list,
sdp_rtpmap_t const *rm);
/* ======================================================================== */
/** Flags given to sdp_parse()/sdp_print(). */
enum sdp_parse_flags_e {
/** Accept only conforming SDP */
sdp_f_strict = 1,
/** Accept any network type. */
sdp_f_anynet = 2,
/** Reallocate message. */
sdp_f_realloc = 4,
/** Include well-known rtpmaps in message, too */
sdp_f_all_rtpmaps = 8,
/** Print buffer already contains a valid prefix */
sdp_f_print_prefix = 16,
/** Connection line with INADDR_ANY is considered equal to sendonly */
sdp_f_mode_0000 = 32,
/** Don't run sanity check */
sdp_f_insane = 64,
/** Don't require c= for each media line */
sdp_f_c_missing = 128,
/** Parse SDP config files */
sdp_f_config = 256,
/** Do not generate or parse SDP mode */
sdp_f_mode_manual = 512,
/** Always generate media-level mode attributes */
sdp_f_mode_always = 1024
};
/** SDP parser handle. */
typedef struct sdp_parser_s sdp_parser_t;
typedef sdp_parser_t *sdp_parser;
SOFIAPUBFUN sdp_parser_t *sdp_parse(su_home_t *,
char const msg[], issize_t msgsize,
int flags);
SOFIAPUBFUN char const *sdp_parsing_error(sdp_parser_t *p);
SOFIAPUBFUN sdp_session_t *sdp_session(sdp_parser_t *p);
SOFIAPUBFUN void sdp_parser_free(sdp_parser_t *p);
SOFIAPUBFUN int sdp_sanity_check(sdp_parser_t *);
SOFIAPUBFUN su_home_t *sdp_parser_home(sdp_parser_t *);
/* ======================================================================== */
/** SDP printer handle */
typedef struct sdp_printer_s sdp_printer_t;
typedef sdp_printer_t *sdp_printer;
SOFIAPUBFUN sdp_printer_t *sdp_print(su_home_t *, sdp_session_t const *session,
char msgbuf[], isize_t maxmsgsize, int flags);
SOFIAPUBFUN char const *sdp_printing_error(sdp_printer_t *p);
SOFIAPUBFUN char const *sdp_message(sdp_printer_t *p);
SOFIAPUBFUN isize_t sdp_message_size(sdp_printer_t *p);
SOFIAPUBFUN void sdp_printer_free(sdp_printer_t *p);
#define sdp_mapped_attribute_find sdp_attribute_mapped_find
#define sdp_free_parser sdp_parser_free
#define sdp_free_printer sdp_printer_free
SOFIA_END_DECLS
#endif /* SDP_H */