Simple SDP (RFC 2327) Interface. More...
#include <sofia-sip/su_alloc.h>
#include <sofia-sip/su_types.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. |
Simple SDP (RFC 2327) Interface.
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.
struct sdp_printer_s sdp_printer_t |
SDP printer handle.
enum sdp_addrtype_e |
enum sdp_bandwidth_e |
enum sdp_key_method_e |
enum sdp_media_e |
Media type.
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.
|
enum sdp_mode_t |
Session mode.
enum sdp_nettype_e |
enum sdp_parse_flags_e |
Flags given to sdp_parse()/sdp_print().
enum sdp_proto_e |
Media transport protocol.
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.
|
sdp_proto_tls |
TLS over TCP. |
sdp_proto_any |
* wildcard |
void sdp_attribute_append | ( | sdp_attribute_t ** | list, | |
sdp_attribute_t const * | a | |||
) |
Append a attribute to a list of attributes.
sdp_attribute_t* sdp_attribute_by_mode | ( | su_home_t * | home, | |
sdp_mode_t | mode | |||
) |
Get session mode from attribute list.
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.
h | Memory home | |
a | SDP attribute description to be duplicated |
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_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.
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 |
If a matching attribute is found, return_result will point to part of the attribute after the payload type and whitespace.
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_remove | ( | sdp_attribute_t ** | list, | |
char const * | name | |||
) |
Remove a named attribute from 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.
Replace a attribute within a list of attributes.
1 | if replaced existing attribute | |
0 | if attribute was appended | |
-1 | upon an error |
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.
h | Memory home | |
b | SDP bandwidth description to be duplicated |
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.
h | Memory home | |
c | SDP connection description to be duplicated |
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.
h | Memory home | |
k | SDP key description to be duplicated |
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.
h | Memory home | |
l | SDP list description to be duplicated |
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.
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.
h | Memory home | |
m | SDP media description to be duplicated | |
sdp | SDP session description to which the newly allocated media description is linked |
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.
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 |
int sdp_media_has_rtp | ( | sdp_media_t const * | m | ) |
Check if media uses RTP as its transport protocol.
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.
char const* sdp_message | ( | sdp_printer_t * | p | ) |
Get encoded SDP message.
Return a pointer to a C string containing the SDP message.
p | Pointer to an sdp_printer_t object. |
isize_t sdp_message_size | ( | sdp_printer_t * | p | ) |
Get size of encoded SDP message.
Return the size of the encoded SDP message.
p | Pointer to an sdp_printer_t object. |
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.
h | Memory home | |
o | SDP origin description to be duplicated |
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. 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.
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:
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.
p | pointer to the SDP parser to be freed |
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.
p | SDP parser |
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.
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_print()
may allocate a new buffer for it from the heap.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.
p | Pointer to an sdp_printer_t object. |
char const* sdp_printing_error | ( | sdp_printer_t * | p | ) |
Get encoding error.
Return a message describing the encoding error.
p | Pointer to an sdp_printer_t object. |
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.
h | Memory home | |
r | SDP repeat description to be duplicated |
int sdp_rtpmap_cmp | ( | sdp_rtpmap_t const * | a, | |
sdp_rtpmap_t const * | b | |||
) |
Compare two rtpmap structures.
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.
h | Memory home | |
rm | SDP rtpmap description to be duplicated |
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.
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.
0 | if parsed SDP description is valid | |
-1 | if some SDP line is missing | |
-2 | if c= line is missing |
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.
p | SDP parser |
int sdp_session_cmp | ( | sdp_session_t const * | a, | |
sdp_session_t const * | b | |||
) |
Compare two session descriptions.
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.
h | Memory home | |
sdp | SDP session description to be duplicated |
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.
h | Memory home | |
t | SDP time description to be duplicated |
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.
h | Memory home | |
z | SDP zone description to be duplicated |
sdp_rtpmap_t const* const sdp_rtpmap_well_known[128] |
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.