Yate
Public Member Functions
SDPMedia Class Reference

SDP media description. More...

#include <yatesdp.h>

Inheritance diagram for SDPMedia:
NamedList String GenObject

List of all members.

Public Member Functions

 SDPMedia (const char *media, const char *transport, const char *formats, int rport=-1, int lport=-1)
virtual ~SDPMedia ()
bool isAudio () const
bool isModified () const
void setModified (bool modified=true)
const Stringsuffix () const
const Stringtransport () const
const Stringid () const
const Stringformat () const
const Stringformats () const
const StringremotePort () const
const StringlocalPort () const
const Stringmappings () const
void mappings (const char *newMap)
const Stringrfc2833 () const
void rfc2833 (int payload)
const StringremoteCrypto () const
const StringlocalCrypto () const
bool securable () const
bool sameAs (const SDPMedia *other, bool ignorePort=false) const
bool localChanged () const
void setLocalChanged (bool chg=false)
const char * fmtList () const
bool update (const char *formats, int rport=-1, int lport=-1, bool force=false)
void update (const NamedList &msg, bool pickFormat)
void parameter (const char *name, const char *value, bool append)
void parameter (NamedString *param, bool append)
void crypto (const char *desc, bool remote)
void putMedia (NamedList &msg, bool putPort=true)

Detailed Description

SDP media description.

This class holds a single SDP media description


Constructor & Destructor Documentation

SDPMedia ( const char *  media,
const char *  transport,
const char *  formats,
int  rport = -1,
int  lport = -1 
)

Constructor

Parameters:
mediaMedia type name
transportTransport name
formatsComma separated list of formats
rportOptional remote media port
lportOptional local media port
virtual ~SDPMedia ( ) [virtual]

Destructor


Member Function Documentation

void crypto ( const char *  desc,
bool  remote 
)

Set a new crypto description, set the modified flag if changed. Reset the media securable flag if the remote crypto is empty

Parameters:
descThe new crypto description
remoteTrue to set the remote crypto, false to set the local one
const char* fmtList ( ) const

Retrieve a formats list from this media

Returns:
Comma separated list of media formats (from formats list, current format or a default G711, 'alaw,mulaw', list
const String& format ( ) const [inline]

Retrieve the current media format

Returns:
The current media format
const String& formats ( ) const [inline]

Retrieve the formats set for this media

Returns:
Comma separated list of media formats

Referenced by SDPMedia::sameAs().

const String& id ( ) const [inline]

Retrieve the media id

Returns:
The media id
bool isAudio ( ) const [inline]

Check if this media type is audio

Returns:
True if this media describe an audio one
bool isModified ( ) const [inline]

Check if a media parameter changed

Returns:
True if a media changed
bool localChanged ( ) const [inline]

Check if local part of this media changed

Returns:
True if local part of this media changed
const String& localCrypto ( ) const [inline]

Retrieve local crypto description

Returns:
Local crypto description
const String& localPort ( ) const [inline]

Retrieve the local media port

Returns:
The local media port
const String& mappings ( ) const [inline]

Retrieve rtp payload mappings

Returns:
Rtp payload mappings
void mappings ( const char *  newMap) [inline]

Set rtp payload mappings for this media

Parameters:
newMapNew rtp payload mappings
void parameter ( const char *  name,
const char *  value,
bool  append 
)

Add or replace a parameter by name and value, set the modified flag

Parameters:
nameParameter name
valueParameter value
appendTrue to append, false to replace
void parameter ( NamedString param,
bool  append 
)

Add or replace a parameter, set the modified flag

Parameters:
paramThe parameter
appendTrue to append, false to replace
void putMedia ( NamedList msg,
bool  putPort = true 
)

Put this net media in a parameter list

Parameters:
msgDestination list
putPortTrue to add remote media port
const String& remoteCrypto ( ) const [inline]

Retrieve remote crypto description

Returns:
Remote crypto description
const String& remotePort ( ) const [inline]

Retrieve the remote media port

Returns:
The remote media port

Referenced by SDPMedia::sameAs().

const String& rfc2833 ( ) const [inline]

Retrieve RFC2833 status or payload of this media

Returns:
RFC2833 status or payload of this media
void rfc2833 ( int  payload) [inline]

Set RFC2833 status or payload of this media

Parameters:
payloadSDP numeric payload to set. Set it to a negative value to reset RFC2833

References String::boolText().

bool sameAs ( const SDPMedia other,
bool  ignorePort = false 
) const [inline]

Compare this media with another one

Parameters:
otherThe media to compare with
ignorePortIgnore differences caused only by port number
Returns:
True if both media have the same formats, transport and remote port

References SDPMedia::formats(), SDPMedia::remotePort(), and SDPMedia::transport().

bool securable ( ) const [inline]

Check if this media is securable

Returns:
True if this media is securable
void setLocalChanged ( bool  chg = false) [inline]

Set or reset local media changed flag

Parameters:
chgThe new value for local media changed flag
void setModified ( bool  modified = true) [inline]

Set or reset media parameter changed flag

Parameters:
modifiedThe new value of the media parameter changed flag
const String& suffix ( ) const [inline]

Retrieve the media suffix (built from type)

Returns:
Media suffix
const String& transport ( ) const [inline]

Retrieve the media transport name

Returns:
The media transport name

Referenced by SDPMedia::sameAs().

bool update ( const char *  formats,
int  rport = -1,
int  lport = -1,
bool  force = false 
)

Update this media from formats and ports

Parameters:
formatsNew media formats
rportOptional remote media port
lportOptional local media port
forceForce updating formats even if incompatible with old ones
Returns:
True if media changed
void update ( const NamedList msg,
bool  pickFormat 
)

Update from a chan.rtp message (rtp id and local port)

Parameters:
msgThe list of parameters
pickFormatTrue to update media format(s) from the list

The documentation for this class was generated from the following file: