Loading...
Searching...
No Matches
sdp.h File Reference

Simple SDP (RFC 2327) Interface. More...

`#include <sofia-sip/su_alloc.h>`
`#include <sofia-sip/su_types.h>`
Include dependency graph for sdp.h:

Go to the source code of this file.

## Data Structures

struct | sdp_session_s
| Session description. More...
struct | sdp_origin_s
| Session description identification. More...
struct | sdp_connection_s
| SDP connection - host or group address. More...
struct | sdp_bandwidth_s
| Session or media bandwidth. More...
struct | sdp_time_s
| Active time description. More...
struct | sdp_repeat_s
| Description of repetition. More...
struct | sdp_zone_s
| Timezone. More...
struct | sdp_key_s
| Session key. More...
struct | sdp_attribute_s
| Session or media attribute. More...
struct | sdp_media_s
| Media announcement. More...
struct | sdp_list_s
| Text list. More...
struct | sdp_rtpmap_s
| Mapping from RTP payload to codec. More...

## Typedefs

typedef struct sdp_session_s | sdp_session_t
| SDP session description.
typedef unsigned long | sdp_version_t
| SDP version "v=" line.
typedef struct sdp_origin_s | sdp_origin_t
| SDP origin "o=" line.
typedef struct sdp_connection_s | sdp_connection_t
| SDP connection "c=" line.
typedef struct sdp_bandwidth_s | sdp_bandwidth_t
| SDP bandwidth "b=" line.
typedef struct sdp_time_s | sdp_time_t
| SDP time "t=" line.
typedef struct sdp_repeat_s | sdp_repeat_t
| SDP repeat "r=" line.
typedef struct sdp_zone_s | sdp_zone_t
| SDP timezone "z=" line.
typedef struct sdp_key_s | sdp_key_t
| SDP encryption key "k=" line.
typedef struct sdp_attribute_s | sdp_attribute_t
| SDP attribute "a=" line.
typedef struct sdp_media_s | sdp_media_t
| SDP media "m=" line.
typedef struct sdp_list_s | sdp_list_t
| SDP list ("e=", "p=" lines).
typedef struct sdp_rtpmap_s | sdp_rtpmap_t
| SDP rtpmap attribute.
typedef char const | sdp_text_t
| Message text.
typedef struct sdp_parser_s | sdp_parser_t
| SDP parser handle.
typedef struct sdp_printer_s | sdp_printer_t
| SDP printer handle.

## Enumerations

enum | sdp_nettype_e { sdp_net_x , sdp_net_in }
| Network type. More...
enum | sdp_addrtype_e { sdp_addr_x , sdp_addr_ip4 , sdp_addr_ip6 }
| Address type. More...
enum | sdp_bandwidth_e { sdp_bw_x , sdp_bw_ct , sdp_bw_as }
| Bandwdith type. More...
enum | sdp_key_method_e { sdp_key_x , sdp_key_clear , sdp_key_base64 , sdp_key_uri , sdp_key_prompt }
| Mechanism to be used to obtain session key. More...
enum | sdp_media_e { sdp_media_x , sdp_media_any , sdp_media_audio , sdp_media_video , sdp_media_application , sdp_media_data , sdp_media_control , sdp_media_message , sdp_media_image , sdp_media_red }
| Media type. More...
enum | sdp_proto_e { sdp_proto_x , sdp_proto_tcp , sdp_proto_udp , sdp_proto_rtp , sdp_proto_srtp , sdp_proto_udptl , sdp_proto_tls , sdp_proto_any }
| Media transport protocol. More...
enum | sdp_mode_t
| Session mode. More...
enum | sdp_parse_flags_e { sdp_f_strict , sdp_f_anynet , sdp_f_realloc , sdp_f_all_rtpmaps , sdp_f_print_prefix , sdp_f_mode_0000 , sdp_f_insane , sdp_f_c_missing , sdp_f_config , sdp_f_mode_manual , sdp_f_mode_always }
| Flags given to sdp_parse()/sdp_print(). More...

## Functions

sdp_session_t * | sdp_session_dup (su_home_t *, sdp_session_t const *)
| Duplicate an SDP session description structure.
sdp_origin_t * | sdp_origin_dup (su_home_t *, sdp_origin_t const *)
| Duplicate an SDP origin structure.
sdp_connection_t * | sdp_connection_dup (su_home_t *, sdp_connection_t const *)
| Duplicate an SDP connection structure.
sdp_bandwidth_t * | sdp_bandwidth_dup (su_home_t *, sdp_bandwidth_t const *)
| Duplicate an SDP bandwidth structure.
sdp_time_t * | sdp_time_dup (su_home_t *, sdp_time_t const *)
| Duplicate an SDP time structure.
sdp_repeat_t * | sdp_repeat_dup (su_home_t *, sdp_repeat_t const *)
| Duplicate an SDP repeat structure.
sdp_zone_t * | sdp_zone_dup (su_home_t *, sdp_zone_t const *)
| Duplicate an SDP timezone structure.
sdp_key_t * | sdp_key_dup (su_home_t *, sdp_key_t const *)
| Duplicate an SDP key structure.
sdp_attribute_t * | sdp_attribute_dup (su_home_t *, sdp_attribute_t const *)
| Duplicate an SDP attribute structure.
sdp_media_t * | sdp_media_dup (su_home_t *, sdp_media_t const *, sdp_session_t *)
| Duplicate an SDP media description structure.
sdp_media_t * | sdp_media_dup_all (su_home_t *, sdp_media_t const *, sdp_session_t *)
| Duplicate a list of SDP media description structures.
sdp_list_t * | sdp_list_dup (su_home_t *, sdp_list_t const *)
| Duplicate a list structure.
sdp_rtpmap_t * | sdp_rtpmap_dup (su_home_t *, sdp_rtpmap_t const *)
| Duplicate an rtpmap structure.
int | sdp_session_cmp (sdp_session_t const *a, sdp_session_t const *b)
| Compare two session descriptions.
int | sdp_origin_cmp (sdp_origin_t const *a, sdp_origin_t const *b)
| Compare two origin fields.
int | sdp_connection_cmp (sdp_connection_t const *, sdp_connection_t const *b)
| Compare two connection fields.
int | sdp_bandwidth_cmp (sdp_bandwidth_t const *a, sdp_bandwidth_t const *b)
| Compare two bandwidth (b=) fields.
int | sdp_time_cmp (sdp_time_t const *a, sdp_time_t const *b)
| Compare two time fields.
int | sdp_repeat_cmp (sdp_repeat_t const *a, sdp_repeat_t const *b)
| Compare two repeat (r=) fields.
int | sdp_zone_cmp (sdp_zone_t const *a, sdp_zone_t const *b)
| Compare two zone (z=) fields.
int | sdp_key_cmp (sdp_key_t const *a, sdp_key_t const *b)
| Compare two key (k=) fields.
int | sdp_attribute_cmp (sdp_attribute_t const *, sdp_attribute_t const *)
| Compare two attribute (a=) fields.
int | sdp_media_cmp (sdp_media_t const *, sdp_media_t const *)
| Compare two media (m=) descriptions.
int | sdp_rtpmap_cmp (sdp_rtpmap_t const *a, sdp_rtpmap_t const *b)
| Compare two rtpmap structures.
int | sdp_list_cmp (sdp_list_t const *a, sdp_list_t const *b)
| Compare two text lists.
sdp_connection_t * | sdp_media_connections (sdp_media_t const *m)
| Get connections of a media description.
int | sdp_media_has_rtp (sdp_media_t const *m)
| Check if media uses RTP as its transport protocol.
void | sdp_media_type (sdp_media_t *m, char const *s)
| Set media type.
void | sdp_media_transport (sdp_media_t *m, char const *s)
| Set transport protocol.
sdp_attribute_t * | sdp_attribute_find (sdp_attribute_t const *a, char const *name)
| Find named attribute from given list.
sdp_attribute_t * | sdp_attribute_find2 (sdp_attribute_t const *a, sdp_attribute_t const *a2, char const *name)
| Find named attribute from given lists.
sdp_mode_t | sdp_attribute_mode (sdp_attribute_t const *a, sdp_mode_t defmode)
| Get session mode from attribute list.
sdp_attribute_t * | sdp_attribute_by_mode (su_home_t *, sdp_mode_t mode)
| Get session mode from attribute list.
sdp_attribute_t * | sdp_attribute_mapped_find (sdp_attribute_t const *a, char const *name, int pt, char **return_result)
| Find a mapped attribute.
void | sdp_attribute_append (sdp_attribute_t **list, sdp_attribute_t const *a)
| Append a attribute to a list of attributes.
int | sdp_attribute_replace (sdp_attribute_t **list, sdp_attribute_t *a, sdp_attribute_t **return_replaced)
| Replace a attribute within a list of attributes.
sdp_attribute_t * | sdp_attribute_remove (sdp_attribute_t **list, char const *name)
| Remove a named attribute from a list of attributes.
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)
| Count media lines in SDP.
unsigned | sdp_media_count_with (sdp_session_t const *sdp, sdp_media_t const *m0)
| Count matching media lines in SDP.
int | sdp_media_uses_rtp (sdp_media_t const *m)
| Return true if media uses RTP.
int | sdp_rtpmap_match (sdp_rtpmap_t const *, sdp_rtpmap_t const *)
| Check if payload type, rtp rate and parameters match in rtpmaps.
sdp_rtpmap_t * | sdp_rtpmap_find_matching (sdp_rtpmap_t const *list, sdp_rtpmap_t const *rm)
| Search for matching rtpmap from list.
sdp_parser_t * | sdp_parse (su_home_t *, char const msg[], issize_t msgsize, int flags)
| Parse an SDP message.
char const * | sdp_parsing_error (sdp_parser_t *p)
| Get a parsing error message.
sdp_session_t * | sdp_session (sdp_parser_t *p)
| Retrieve an SDP session structure.
void | sdp_parser_free (sdp_parser_t *p)
| Free an SDP parser.
int | sdp_sanity_check (sdp_parser_t *)
| Validates that all mandatory fields exist.
su_home_t * | sdp_parser_home (sdp_parser_t *)
| Obtain memory home used by parser.
sdp_printer_t * | sdp_print (su_home_t *, sdp_session_t const *, char msgbuf[], isize_t maxmsgsize, int flags)
| Print a SDP description.
char const * | sdp_printing_error (sdp_printer_t *p)
| Get encoding error.
char const * | sdp_message (sdp_printer_t *p)
| Get encoded SDP message.
isize_t | sdp_message_size (sdp_printer_t *p)
| Get size of encoded SDP message.
void | sdp_printer_free (sdp_printer_t *p)
| Free a SDP printer.

## Variables

sdp_rtpmap_t const *const | sdp_rtpmap_well_known [128]
| Table of rtpmap structures by payload type numbers.

## Detailed Description

Simple SDP (RFC 2327) Interface.

Author
  Pekka Pessi Pekka.nosp@m..Pes.nosp@m.si@no.nosp@m.kia..nosp@m.com
  Kai Vehmanen kai.v.nosp@m.ehma.nosp@m.nen@n.nosp@m.okia.nosp@m..com

Date
  Created: Fri Feb 18 08:54:48 2000 ppessi

## Typedef Documentation

## sdp_parser_t

typedef struct sdp_parser_s sdp_parser_t

SDP parser handle.

The SDP parser handle returned by sdp_parse() contains either a successfully parsed SDP session sdp_session_t or an error message. If sdp_session() returns non-NULL, parsing was successful.

See also
  sdp_session_t, sdp_parse(), sdp_session(), sdp_parsing_error(), sdp_sanity_check(), sdp_parser_home(), sdp_parser_free(), RFC 4566, RFC 2327.

## sdp_printer_t

typedef struct sdp_printer_s sdp_printer_t

SDP printer handle.

See also
  sdp_session_t, sdp_print(), sdp_printing_error(), sdp_message(), sdp_message_size(), sdp_printer_free()

## Enumeration Type Documentation

## sdp_addrtype_e

enum sdp_addrtype_e

Address type.

Enumerator
sdp_addr_x | Unknown address type.
sdp_addr_ip4 | IPv4 address.
sdp_addr_ip6 | IPv6 address.

## sdp_bandwidth_e

enum sdp_bandwidth_e

Bandwdith type.

Enumerator
sdp_bw_x | Unknown bandwidth type.
sdp_bw_ct | Conference total.
sdp_bw_as | Application-specific.

## sdp_key_method_e

enum sdp_key_method_e

Mechanism to be used to obtain session key.

Enumerator
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_media_e

enum sdp_media_e

Media type.

See also
  RFC2327 page 18.

Enumerator
sdp_media_x | 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, e.g., JPIP or T.38.

sdp_media_red

Redundancy.

Since
  New in 1.12.4.

## sdp_mode_t

enum sdp_mode_t

Session mode.

Note
  Identical to rtp_mode_t.

## sdp_nettype_e

enum sdp_nettype_e

Network type.

Enumerator
sdp_net_x | Unknown network type.
sdp_net_in | Internet.

## sdp_parse_flags_e

enum sdp_parse_flags_e

Flags given to sdp_parse()/sdp_print().

Enumerator
sdp_f_strict | Accept only conforming SDP.
sdp_f_anynet | Accept any network type.
sdp_f_realloc | Reallocate message.
sdp_f_all_rtpmaps | Include well-known rtpmaps in message, too.
sdp_f_print_prefix | Print buffer already contains a valid prefix.
sdp_f_mode_0000 | Connection line with INADDR_ANY is considered equal to sendonly.
sdp_f_insane | Don't run sanity check.
sdp_f_c_missing | Don't require c= for each media line.
sdp_f_config | Parse SDP config files.
sdp_f_mode_manual | Do not generate or parse SDP mode.
sdp_f_mode_always | Always generate media-level mode attributes.

## sdp_proto_e

enum sdp_proto_e

Media transport protocol.

Enumerator
sdp_proto_x | Unknown transport.
sdp_proto_tcp | TCP.
sdp_proto_udp | Plain UDP.
sdp_proto_rtp | RTP/AVP.
sdp_proto_srtp | RTP/SAVP.

sdp_proto_udptl

UDPTL.

Since
  New in 1.12.4.

sdp_proto_tls | TLS over TCP.

sdp_proto_any

- wildcard

## Function Documentation

## sdp_attribute_append()

void sdp_attribute_append | ( | sdp_attribute_t ** | list,
|  | sdp_attribute_t const * | a )

Append a attribute to a list of attributes.

Append a attribute to a list of attributes.

## sdp_attribute_by_mode()

sdp_attribute_t * sdp_attribute_by_mode | ( | su_home_t * | home,
|  | sdp_mode_t | mode )

Get session mode from attribute list.

Get session mode from attribute list.

## sdp_attribute_dup()

sdp_attribute_t * sdp_attribute_dup | ( | su_home_t * | h,
|  | sdp_attribute_t const * | a )

Duplicate an SDP attribute structure.

Duplicate an SDP attribute structure.

The function sdp_attribute_dup() duplicates (deeply copies) an SDP attribute list a allocating memory using memory home.

Parameters

  h | Memory home
  a | SDP attribute description to be duplicated

Note
  The duplicated structure is allocated using a single call to su_alloc() and it can be freed with su_free().

Returns
  If successful, a pointer to newly allocated sdp_attribute_t structure is returned, otherwise NULL is returned.

## sdp_attribute_find2()

sdp_attribute_t * sdp_attribute_find2 | ( | sdp_attribute_t const * | a,
|  | sdp_attribute_t const * | a2,
|  | char const * | name )

Find named attribute from given lists.

Find named attribute from given lists.

## sdp_attribute_mapped_find()

sdp_attribute_t * sdp_attribute_mapped_find | ( | sdp_attribute_t const * | a,
|  | char const * | name,
|  | int | pt,
|  | char ** | return_result )

Find a mapped attribute.

A mapped attribute has form 'a=<name>:<pt>

' where pt is a RTP payload type, integer in range 0..127. For example, "a=atmmap" [RFC 3108] is a mapped attribute. Note that common mapped attributes, "a=rtpmap" and "a=fmtp" are already parsed as list of sdp_rtpmap_t in sdp_media_t.

Parameters

  a | pointer to first attribute in the list
  name | name of the attribute
  pt | payload type number (must be 0..127)
  return_result | return value parameter for mapped attribute value

Returns
  Pointer to a matching attribute structure, or NULL.

If a matching attribute is found, return_result will point to part of the attribute after the payload type and whitespace.

## sdp_attribute_replace()

int sdp_attribute_replace | ( | sdp_attribute_t ** | list,
|  | sdp_attribute_t * | a,
|  | sdp_attribute_t ** | return_replaced )

Replace a attribute within a list of attributes.

Replace a attribute within a list of attributes.

Return values

  1 | if replaced existing attribute
  0 | if attribute was appended
  -1 | upon an error

## sdp_bandwidth_dup()

sdp_bandwidth_t * sdp_bandwidth_dup | ( | su_home_t * | h,
|  | sdp_bandwidth_t const * | b )

Duplicate an SDP bandwidth structure.

Duplicate an SDP bandwidth structure.

The function sdp_bandwidth_dup() duplicates (deeply copies) a list of SDP bandwidth descriptions b allocating memory using memory home.

Parameters

  h | Memory home
  b | SDP bandwidth description to be duplicated

Note
  The duplicated list is allocated using a single call to su_alloc() and it can be freed with su_free().

Returns
  If successful, a pointer to newly allocated sdp_bandwidth_t structure is returned, otherwise NULL is returned.

## sdp_connection_dup()

sdp_connection_t * sdp_connection_dup | ( | su_home_t * | h,
|  | sdp_connection_t const * | c )

Duplicate an SDP connection structure.

Duplicate an SDP connection structure.

The function sdp_connection_dup() duplicates (deeply copies) a list of SDP connection description c allocating memory using memory home.

Parameters

  h | Memory home
  c | SDP connection description to be duplicated

Note
  The duplicated list is allocated using a single call to su_alloc() and it can be freed with su_free().

Returns
  If successful, a pointer to newly allocated sdp_connection_t structure is returned, otherwise NULL is returned.

## sdp_key_dup()

sdp_key_t * sdp_key_dup | ( | su_home_t * | h,
|  | sdp_key_t const * | k )

Duplicate an SDP key structure.

Duplicate an SDP key structure.

The function sdp_key_dup() duplicates (deeply copies) an SDP key description k allocating memory using memory home.

Parameters

  h | Memory home
  k | SDP key description to be duplicated

Note
  The duplicated structure is allocated using a single call to su_alloc() and it can be freed with su_free().

Returns
  If successful, a pointer to newly allocated sdp_key_t structure is returned, otherwise NULL is returned.

## sdp_list_cmp()

int sdp_list_cmp | ( | sdp_list_t const * | a,
|  | sdp_list_t const * | b )

Compare two text lists.

Compare two text lists.

## sdp_list_dup()

sdp_list_t * sdp_list_dup | ( | su_home_t * | h,
|  | sdp_list_t const * | l )

Duplicate a list structure.

Duplicate a list structure.

The function sdp_list_dup() duplicates (deeply copies) an SDP text list l allocating memory using memory home.

Parameters

  h | Memory home
  l | SDP list description to be duplicated

Note
  The duplicated structure is allocated using a single call to su_alloc() and it can be freed with su_free().

Returns
  If successful, a pointer to newly allocated sdp_list_t structure is returned, otherwise NULL is returned.

## sdp_media_cmp()

int sdp_media_cmp | ( | sdp_media_t const * | a,
|  | sdp_media_t const * | b )

Compare two media (m=) descriptions.

Compare two media (m=) descriptions.

## sdp_media_count()

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 )

Count media lines in SDP.

Count media lines in SDP.

## sdp_media_dup()

sdp_media_t * sdp_media_dup | ( | su_home_t * | h,
|  | sdp_media_t const * | m,
|  | sdp_session_t * | sdp )

Duplicate an SDP media description structure.

Duplicate an SDP media description structure.

The function sdp_media_dup() duplicates (deeply copies) an SDP media description m allocating memory using memory home.

Parameters

  h | Memory home
  m | SDP media description to be duplicated
  sdp | SDP session description to which the newly allocated media description is linked

Note
  The duplicated structure is allocated using a single call to su_alloc() and it can be freed with su_free().

Returns
  If successful, a pointer to newly allocated sdp_media_t structure is returned, otherwise NULL is returned.

## sdp_media_dup_all()

sdp_media_t * sdp_media_dup_all | ( | su_home_t * | h,
|  | sdp_media_t const * | m,
|  | sdp_session_t * | sdp )

Duplicate a list of SDP media description structures.

Duplicate a list of SDP media description structures.

The function sdp_media_dup_all() duplicates (deeply copies) a list of SDP media descriptions m allocating memory using memory home.

Parameters

  h | Memory home
  m | list of SDP media descriptions to be duplicated
  sdp | SDP session description to which the newly allocated media descriptions are linked

Note
  The duplicated list is allocated using a single call to su_alloc() and it can be freed with su_free().

Returns
  If successful, a pointer to a newly allocated list of sdp_media_t structures is returned, otherwise NULL is returned.

## sdp_media_transport()

void sdp_media_transport | ( | sdp_media_t * | m,
|  | char const * | s )

Set transport protocol.

Set the m->m_proto to a well-known protocol type as well as canonize case of m_proto_name.

## sdp_message()

char const * sdp_message | ( | sdp_printer_t * | p | ) |

Get encoded SDP message.

Return a pointer to a C string containing the SDP message.

Parameters

  p | Pointer to an sdp_printer_t object.

Returns
  Return a pointer to a C string containing the encoded SDP message, or NULL upon an error.

## sdp_message_size()

isize_t sdp_message_size | ( | sdp_printer_t * | p | ) |

Get size of encoded SDP message.

Return the size of the encoded SDP message.

Parameters

  p | Pointer to an sdp_printer_t object.

Returns
  Number of bytes in SDP message excluding final NUL or 0 upon an error.

## sdp_origin_dup()

sdp_origin_t * sdp_origin_dup | ( | su_home_t * | h,
|  | sdp_origin_t const * | o )

Duplicate an SDP origin structure.

Duplicate an SDP origin structure.

The function sdp_origin_dup() duplicates (deeply copies) an SDP origin description o allocating memory using memory home.

Parameters

  h | Memory home
  o | SDP origin description to be duplicated

Note
  The duplicated structure is allocated using a single call to su_alloc() and it can be freed with su_free().

Returns
  If successful, a pointer to newly allocated sdp_origin_t structure is returned, otherwise NULL is returned.

## sdp_parse()

sdp_parser_t * sdp_parse | ( | su_home_t * | home,
|  | char const | msg[],
|  | issize_t | msgsize,
|  | int | flags )

Parse an SDP message.

The function sdp_parse() parses an SDP message msg of size msgsize. If msgsize is -1, the size of message is calculated using strlen().

Parsing is done according to the given flags.

The SDP message may not contain a NUL.

The parsing result is stored to an sdp_session_t structure.

Parameters

  home | memory home
  msg | pointer to message
  msgsize | size of the message (excluding final NUL, if any)
  flags | flags affecting the parsing.

The following flags are used by parser:

- sdp_f_strict Parser should accept only messages conforming strictly to the specification.
- sdp_f_anynet Parser accepts unknown network or address types.
- sdp_f_insane Do not run sanity check.
- sdp_f_c_missing Sanity check does not require c= for each m= line
- sdp_f_mode_0000 Parser regards "c=IN IP4 0.0.0.0" as "a=inactive" (likewise with c=IN IP6 ::)
- sdp_f_mode_manual Do not generate or parse SDP mode
- sdp_f_config Parse config files (any line can be missing)

Returns
  Always a valid parser handle.

Todo
  Parser accepts some non-conforming SDP even with sdp_f_strict.

See also
  sdp_session(), sdp_parsing_error(), sdp_sanity_check(), sdp_parser_home(), sdp_parser_free(), RFC 4566, RFC 2327.

## sdp_parser_free()

void sdp_parser_free | ( | sdp_parser_t * | p | ) |

Free an SDP parser.

The function sdp_parser_free() frees an SDP parser object along with the memory blocks associated with it.

Parameters

  p | pointer to the SDP parser to be freed

## sdp_parsing_error()

char const * sdp_parsing_error | ( | sdp_parser_t * | p | ) |

Get a parsing error message.

The function sdp_parsing_error() returns the error message associated with an SDP parser p.

Parameters

  p | SDP parser

Returns
  The function sdp_parsing_error() returns a C string describing parsing error, or NULL if no error occurred.

## sdp_print()

sdp_printer_t * sdp_print | ( | su_home_t * | home,
|  | sdp_session_t const * | session,
|  | char | msgbuf[],
|  | isize_t | msgsize,
|  | int | flags )

Print a SDP description.

Encode the contents of the SDP session structure sdp_session_t to the msgbuf. The msgbuf has size msgsize bytes. If msgbuf is `NULL`, the sdp_print() function allocates the required buffer from the home heap.

Parameters

  home | Memory home (may be NULL).
  session | SDP session description structure to be encoded.
  msgbuf | Buffer to which encoding is stored (may be NULL).
  msgsize | Size of msgbuf.
  flags | Flags specifying the encoding options.

The flags specify encoding options as follows:

- sdp_f_strict - Printer should only emit messages conforming strictly to the * specification.

- sdp_f_realloc - If this flag is specified, and msgbuf is too small for the resulting SDP message, `sdp_print()` may allocate a new buffer for it from the heap.

- sdp_f_print_prefix - The buffer provided by caller already contains valid data. The result will concatenated to the string in the buffer.

- sdp_f_mode_always - Always add mode attributes to media

- sdp_f_mode_manual - Do not generate mode attributes

Returns
  Always return a handle to an sdp_printer_t object.

See also
  sdp_printer_t, sdp_session_t, sdp_printing_error(), sdp_message(), sdp_message_size(), sdp_printer_free(), sdp_parse().

## sdp_printer_free()

void sdp_printer_free | ( | sdp_printer_t * | p | ) |

Free a SDP printer.

Free the printer object p and the message buffer possibly associated with it.

Parameters

  p | Pointer to an sdp_printer_t object.

## sdp_printing_error()

char const * sdp_printing_error | ( | sdp_printer_t * | p | ) |

Get encoding error.

Return a message describing the encoding error.

Parameters

  p | Pointer to an sdp_printer_t object.

Returns
  Return a pointer to C string describing printing errors, or NULL if no error was encountered.

## sdp_repeat_dup()

sdp_repeat_t * sdp_repeat_dup | ( | su_home_t * | h,
|  | sdp_repeat_t const * | r )

Duplicate an SDP repeat structure.

Duplicate an SDP repeat structure.

The function sdp_repeat_dup() duplicates (deeply copies) an SDP repeat description r allocating memory using memory home.

Parameters

  h | Memory home
  r | SDP repeat description to be duplicated

Note
  The duplicated structure is allocated using a single call to su_alloc() and it can be freed with su_free().

Returns
  If successful, a pointer to newly allocated sdp_repeat_t structure is returned, otherwise NULL is returned.

## sdp_rtpmap_dup()

sdp_rtpmap_t * sdp_rtpmap_dup | ( | su_home_t * | h,
|  | sdp_rtpmap_t const * | rm )

Duplicate an rtpmap structure.

Duplicate an rtpmap structure.

The function sdp_rtpmap_dup() duplicates (deeply copies) an SDP rtpmap list rm allocating memory using memory home.

Parameters

  h | Memory home
  rm | SDP rtpmap description to be duplicated

Note
  The duplicated structure is allocated using a single call to su_alloc() and it can be freed with su_free().

Returns
  If successful, a pointer to newly allocated sdp_rtpmap_t structure is returned, otherwise NULL is returned.

## sdp_rtpmap_find_matching()

sdp_rtpmap_t * sdp_rtpmap_find_matching | ( | sdp_rtpmap_t const * | list,
|  | sdp_rtpmap_t const * | rm )

Search for matching rtpmap from list.

Search for matching rtpmap from list.

Note
  The a=fmtp: for the codecs are not compared.

Returns
  Pointer to first sdp_rtpmap_t entry on the list matching with any sdp_rtpmap_t entry on rm.

## sdp_sanity_check()

int sdp_sanity_check | ( | sdp_parser_t * | p | ) |

Validates that all mandatory fields exist.

Checks that all necessary fields (v=, o=) exists in the parsed sdp. If strict, check that all mandatory fields (c=, o=, s=, t=) are present. This function also goes through all media, marks rejected media as such, and updates the mode accordingly.

Return values

  0 | if parsed SDP description is valid
  -1 | if some SDP line is missing
  -2 | if c= line is missing

## sdp_session()

sdp_session_t * sdp_session | ( | sdp_parser_t * | p | ) |

Retrieve an SDP session structure.

The function sdp_session() returns a pointer to the SDP session structure associated with the SDP parser p. The pointer and all the data in the structure are valid until sdp_parser_free() is called.

Parameters

  p | SDP parser

Returns
  The function sdp_session() returns a pointer to an parsed SDP message or NULL, if an error has occurred.

## sdp_session_dup()

sdp_session_t * sdp_session_dup | ( | su_home_t * | h,
|  | sdp_session_t const * | sdp )

Duplicate an SDP session description structure.

Duplicate an SDP session description structure.

The function sdp_session_dup() duplicates (deeply copies) an SDP session description sdp allocating memory using memory home.

Parameters

  h | Memory home
  sdp | SDP session description to be duplicated

Note
  The duplicated structure is allocated using a single call to su_alloc() and it can be freed with su_free().

Returns
  If successful, a pointer to newly allocated sdp_session_t structure is returned, otherwise NULL is returned.

## sdp_time_dup()

sdp_time_t * sdp_time_dup | ( | su_home_t * | h,
|  | sdp_time_t const * | t )

Duplicate an SDP time structure.

Duplicate an SDP time structure.

The function sdp_time_dup() duplicates (deeply copies) a list of SDP time descriptions t allocating memory using memory home.

Parameters

  h | Memory home
  t | SDP time description to be duplicated

Note
  The duplicated list is allocated using a single call to su_alloc() and it can be freed with su_free().

Returns
  If successful, a pointer to newly allocated sdp_time_t structure is returned, otherwise NULL is returned.

## sdp_zone_dup()

sdp_zone_t * sdp_zone_dup | ( | su_home_t * | h,
|  | sdp_zone_t const * | z )

Duplicate an SDP timezone structure.

Duplicate an SDP timezone structure.

The function sdp_zone_dup() duplicates (deeply copies) an SDP zone description z allocating memory using memory home.

Parameters

  h | Memory home
  z | SDP zone description to be duplicated

Note
  The duplicated structure is allocated using a single call to su_alloc() and it can be freed with su_free().

Returns
  If successful, a pointer to newly allocated sdp_zone_t structure is returned, otherwise NULL is returned.

## Variable Documentation

## sdp_rtpmap_well_known

sdp_rtpmap_t const* const sdp_rtpmap_well_known[128]

extern

Table of rtpmap structures by payload type numbers.

The table of reserved payload numbers is constructed from RFC 3551 and RFC 1890. Note the clock rate of G722.

Use sdp_rtpmap_dup() to copy these structures.

Sofia-SIP 1.12.11devel - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.