# class SDPSession | A holder for a SDP session. More...
Contains pure virtuals
Full name | `TelEngine::SDPSession`
Definition | `#include <libs/ysdp/yatesdp.h>`
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Types

- enum { MediaMissing, MediaStarted, MediaMuted }

#### Public Methods

- SDPSession (SDPParser* parser)
- SDPSession (SDPParser* parser, NamedList& params)
- virtual ~SDPSession ()
- inline const String& getHost () const
- inline const String& getRtpAddr () const
- bool setMedia (ObjList* media)
- inline void putMedia (NamedList& msg, bool putPort = true)
- SDPMedia* getMedia (const String& name) const
- void setRfc2833 (const String& value)
- inline void setRfc2833 (const String* value)
- bool dispatchRtp (SDPMedia* media, const char* addr, bool start, bool pick, RefObject* context = 0)
- bool dispatchRtp (const char* addr, bool start, RefObject* context = 0)
- bool startRtp (RefObject* context = 0)
- bool updateSDP (const NamedList& params)
- bool updateRtpSDP (const NamedList& params)
- MimeSdpBody* createSDP (const char* addr, ObjList* mediaList = 0)
- MimeSdpBody* createSDP ()
- MimeSdpBody* createPasstroughSDP (NamedList& msg, bool update = true, bool allowEmptyAddr = false)
- inline MimeSdpBody* createRtpSDP (const char* addr, const NamedList& msg)
- inline MimeSdpBody* createRtpSDP (const char* addr, bool start)
- inline MimeSdpBody* createRtpSDP (bool start)
- void updateFormats (const NamedList& msg, bool changeMedia = false)
- bool addSdpParams (NamedList& msg, const MimeBody* body)
- bool addSdpParams (NamedList& msg, const String& rawSdp)
- bool addRtpParams (NamedList& msg, const String& natAddr = String::empty(), const MimeBody* body = 0, bool force = false, bool allowEmptyAddr = false)
- virtual void resetSdp (bool all = true)
- virtual Message* buildChanRtp (SDPMedia* media, const char* addr, bool start, RefObject* context)
- virtual Message* buildChanRtp (RefObject* context)
- bool localRtpChanged () const
- void setLocalRtpChanged (bool chg = false)

#### Public Static Methods

- static void putMedia (NamedList& msg, ObjList* media, bool putPort = true)
- static ObjList* updateRtpSDP (const NamedList& params, String& rtpAddr, ObjList* oldList = 0, bool allowEmptyAddr = false)

#### Protected Methods

- virtual void mediaChanged (const SDPMedia& media)
- virtual void dispatchingRtp (Message*& msg, SDPMedia* media)
- void setSdpDebug (DebugEnabler* enabler = 0, void* ptr = 0)
- void printRtpMedia (const char* reason)

#### Protected Members

- SDPParser* m_parser
- int m_mediaStatus
- bool m_rtpForward
- bool m_sdpForward
- String m_originAddr
- String m_externalAddr
- String m_rtpAddr
- String m_rtpLocalAddr
- String m_rtpNatAddr
- ObjList* m_rtpMedia
- int m_sdpSession
- int m_sdpVersion
- String m_host
- bool m_secure
- int m_rfc2833
- bool m_ipv6

## Detailed Description

This class holds RTP/SDP data for multiple media types NOTE: The SDPParser pointer held by this class is assumed to be non NULL

enum { MediaMissing, MediaStarted, MediaMuted } | ###

RTP media status enumeration

SDPSession (SDPParser* parser) | ### SDPSession

Constructor

Parameters:

parser | The SDP parser whose data this object will use

SDPSession (SDPParser* parser, NamedList& params) | ### SDPSession

Constructor

Parameters:

parser | The SDP parser whose data this object will use
params | SDP session parameters

~SDPSession () | ### ~SDPSession

[virtual]

Destructor. Reset the object

inline const String& getHost () | ### getHost

[const]

Get RTP local host

Returns: RTP local host

inline const String& getRtpAddr () | ### getRtpAddr

[const]

Get local RTP address

Returns: Local RTP address (external or local)

bool setMedia (ObjList* media) | ### setMedia

Set a new media list

Parameters:

media | New media list

Returns: True if media changed

void putMedia (NamedList& msg, ObjList* media, bool putPort = true) | ### putMedia

[static]

Put specified media parameters into a list of parameters

Parameters:

msg | Destination list
media | List of SDP media information
putPort | True to add the media port

inline void putMedia (NamedList& msg, bool putPort = true) | ### putMedia

Put session media parameters into a list of parameters

Parameters:

msg | Destination list
putPort | True to add the media port

SDPMedia* getMedia (const String& name) | ### getMedia

[const]

Retrieve a single media description

Parameters:

name | Name of the media to retrieve

Returns: Pointer to media descriptor, NULL if no such media set

void setRfc2833 (const String& value) | ### setRfc2833

Update the RFC 2833 availability and payload

Parameters:

value | String to get payload or availability

inline void setRfc2833 (const String* value) | ### setRfc2833

Update the RFC 2833 availability and payload

Parameters:

value | Pointer to string to get payload or availability

bool dispatchRtp (SDPMedia* media, const char* addr, bool start, bool pick, RefObject* context = 0) | ### dispatchRtp

Build and dispatch a chan.rtp message for a given media. Update media on success

Parameters:

media | The media to use
addr | Remote RTP address
start | True to request RTP start
pick | True to update local parameters (other then media) from returned message
context | Pointer to user provided context, optional

Returns: True if the message was succesfully handled

bool dispatchRtp (const char* addr, bool start, RefObject* context = 0) | ### dispatchRtp

Calls dispatchRtp() for each media in the list Update it on success. Remove it on failure

Parameters:

addr | Remote RTP address
start | True to request RTP start
context | Pointer to user provided context, optional

Returns: True if the message was succesfully handled for at least one media

bool startRtp (RefObject* context = 0) | ### startRtp

Try to start RTP (calls dispatchRtp()) for each media in the list

Parameters:

context | Pointer to user provided context, optional

Returns: True if at least one media was started

bool updateSDP (const NamedList& params) | ### updateSDP

Update from parameters. Build a default SDP from parser formats if no media is found in params

Parameters:

params | List of parameters to update from

Returns: True if media changed

bool updateRtpSDP (const NamedList& params) | ### updateRtpSDP

Update RTP/SDP data from parameters

Parameters:

params | List of parameters to update from

Returns: True if media or local address changed

MimeSdpBody* createSDP (const char* addr, ObjList* mediaList = 0) | ### createSDP

Creates a SDP body from transport address and list of media descriptors

Parameters:

addr | The address to set. Use own host if empty
mediaList | Optional media list. Use own list if the given one is 0

Returns: MimeSdpBody pointer or 0 if there is no media to set

MimeSdpBody* createSDP () | ### createSDP

Creates a SDP body for current media status

Returns: MimeSdpBody pointer or 0 if media is missing

MimeSdpBody* createPasstroughSDP (NamedList& msg, bool update = true, bool allowEmptyAddr = false) | ### createPasstroughSDP

Creates a SDP from RTP address data present in message. Use the raw SDP if present.

Parameters:

msg | The list of parameters
update | True to update RTP/SDP data if raw SDP is not found in the list
allowEmptyAddr | Allow empty address in parameters (default: false)

Returns: MimeSdpBody pointer or 0

inline MimeSdpBody* createRtpSDP (const char* addr, const NamedList& msg) | ### createRtpSDP

Creates a set of unstarted external RTP channels from remote addr and builds SDP from them

Parameters:

addr | Remote RTP address used when dispatching the chan.rtp message
msg | List of parameters used to update data

Returns: MimeSdpBody pointer or 0

inline MimeSdpBody* createRtpSDP (const char* addr, bool start) | ### createRtpSDP

Creates a set of RTP channels from address and media info and builds SDP from them

Parameters:

addr | Remote RTP address used when dispatching the chan.rtp message
start | True to create a started RTP

Returns: MimeSdpBody pointer or 0

inline MimeSdpBody* createRtpSDP (bool start) | ### createRtpSDP

Creates a set of started external RTP channels from remote addr and builds SDP from them

Parameters:

start | True to create a started RTP

Returns: MimeSdpBody pointer or 0

void updateFormats (const NamedList& msg, bool changeMedia = false) | ### updateFormats

Update media format lists from parameters

Parameters:

msg | Parameter list
changeMedia | True to update media list if required

bool addSdpParams (NamedList& msg, const MimeBody* body) | ### addSdpParams

Add raw SDP forwarding parameter from body if SDP forward is enabled

Parameters:

msg | Destination list
body | Mime body to process

Returns: True if the parameter was added

bool addSdpParams (NamedList& msg, const String& rawSdp) | ### addSdpParams

Add raw SDP forwarding parameter if SDP forward is enabled

Parameters:

msg | Destination list
rawSdp | The raw sdp content

Returns: True if the parameter was added

bool addRtpParams (NamedList& msg, const String& natAddr = String::empty(), const MimeBody* body = 0, bool force = false, bool allowEmptyAddr = false) | ### addRtpParams

Add RTP forwarding parameters to a message (media and address)

Parameters:

msg | Destination list
natAddr | Optional NAT address if detected
body | Pointer to the body to extract raw SDP from
force | True to override RTP forward flag
allowEmptyAddr | Allow empty address in parameters (default: false)

Returns: True if RTP data was added. Media is always added if present and remote address is not empty

void resetSdp (bool all = true) | ### resetSdp

[virtual]

Reset this object to default values

Parameters:

all | True to reset all parameters including configuration

Message* buildChanRtp (SDPMedia* media, const char* addr, bool start, RefObject* context) | ### buildChanRtp

[virtual]

Build a chan.rtp message and populate with media information

Parameters:

media | The media list
addr | Remote RTP address
start | True to request RTP start
context | Pointer to reference counted user provided context

Returns: The message with media information, NULL if media or addr are missing

Message* buildChanRtp (RefObject* context) | ### buildChanRtp

[pure virtual]

Build a chan.rtp message without media information

Parameters:

context | Pointer to reference counted user provided context

Returns: The message with user data set but no media information

bool localRtpChanged () | ### localRtpChanged

[const]

Check if local RTP data changed for at least one media

Returns: True if local RTP data changed for at least one media

void setLocalRtpChanged (bool chg = false) | ### setLocalRtpChanged

Set or reset the local RTP data changed flag for all media

Parameters:

chg | The new value for local RTP data changed flag of all media

ObjList* updateRtpSDP (const NamedList& params, String& rtpAddr, ObjList* oldList = 0, bool allowEmptyAddr = false) | ### updateRtpSDP

[static]

Update RTP/SDP data from parameters

Parameters:

params | Parameter list
rtpAddr | String to be filled with rtp address from the list
oldList | Optional existing media list (found media will be removed from it and added to the returned list
allowEmptyAddr | Allow empty address in parameters (default: false)

Returns: List of media or 0 if not found or rtpAddr is empty

void mediaChanged (const SDPMedia& media) | ### mediaChanged

[protected virtual]

Media changed notification. This method is called when setting new media and an old one changed

Parameters:

media | Old media that changed

void dispatchingRtp (Message*& msg, SDPMedia* media) | ### dispatchingRtp

[protected virtual]

Dispatch rtp notification. This method is called before dispatching the message. Clear the message to stop dispatch

Parameters:

msg | Message to dispatch
media | Media for which the message is going to be dispatched

void setSdpDebug (DebugEnabler* enabler = 0, void* ptr = 0) | ### setSdpDebug

[protected]

Set data used in debug

Parameters:

enabler | The DebugEnabler to use (0 to to use the parser)
ptr | Pointer to print, 0 to use the session pointer

void printRtpMedia (const char* reason) | ### printRtpMedia

[protected]

Print current media to output

Parameters:

reason | Reason to print

SDPParser* m_parser | ### m_parser

[protected]

int m_mediaStatus | ### m_mediaStatus

[protected]

bool m_rtpForward | ### m_rtpForward

[protected]

bool m_sdpForward | ### m_sdpForward

[protected]

String m_originAddr | ### m_originAddr

[protected]

String m_externalAddr | ### m_externalAddr

[protected]

String m_rtpAddr | ### m_rtpAddr

[protected]

String m_rtpLocalAddr | ### m_rtpLocalAddr

[protected]

String m_rtpNatAddr | ### m_rtpNatAddr

[protected]

ObjList* m_rtpMedia | ### m_rtpMedia

[protected]

int m_sdpSession | ### m_sdpSession

[protected]

int m_sdpVersion | ### m_sdpVersion

[protected]

String m_host | ### m_host

[protected]

bool m_secure | ### m_secure

[protected]

int m_rfc2833 | ### m_rfc2833

[protected]

bool m_ipv6 | ### m_ipv6

[protected]

Generated by: paulc on bussard on Mon Feb 10 13:15:47 2014, using kdoc 2.0a54.