sdp_parse.c File Reference


Detailed Description

Simple SDP parser interface.

Author:
Pekka Pessi <Pekka.Pessi@nokia-email.address.hidden>

Kai Vehmanen <kai.vehmanen@nokia-email.address.hidden>

Date:
Created: Fri Feb 18 10:25:08 2000 ppessi

#include "config.h"
#include <sofia-sip/su_alloc.h>
#include "sofia-sip/sdp.h"
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include <limits.h>
#include <assert.h>

Include dependency graph for sdp_parse.c:


Functions

sdp_parser_tsdp_parse (su_home_t *home, char const msg[], issize_t msgsize, int flags)
 Parse an SDP message.
su_home_t * sdp_parser_home (sdp_parser_t *parser)
 Obtain memory home used by parser.
sdp_session_tsdp_session (sdp_parser_t *p)
 Retrieve an SDP session structure.
char const * sdp_parsing_error (sdp_parser_t *p)
 Get a parsing error message.
void sdp_parser_free (sdp_parser_t *p)
 Free an SDP parser.
int sdp_sanity_check (sdp_parser_t *p)
 Validates that all mandatory fields exist.
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.
int sdp_media_has_rtp (sdp_media_t const *m)
 Check if media uses RTP as its transport protocol.

Variables

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

Function Documentation

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.

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:

Returns:
Always a valid parser handle.
Todo:
Parser accepts some non-conforming SDP even with sdp_f_strict.

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

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.

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_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.


Variable Documentation

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.


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