Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <rtp.h>

Class RRtpSession

class RRtpSession;

Description

A handle to an RTP session.

This is the interface to the socket-level RTP service, and provides additional facilities such as header parsing, re-ordering out-of-order packets, demultiplexing multiple sources etc.

The class abstracts all RTP information going to/from a RTP socket, and its corresponding RTCP data.

Each RTP endpoint on a device needs its own RTP session.

Multiple hosts streaming to a port on this device correspond to different RRtpReceiveSource objects associated with the session.

The class behaviour assumes that an active scheduler has already been created and started; the class does not function correctly if not.

Members

Defined in RRtpSession:

Related Topics


Construction and destruction


RRtpSession()

inline RRtpSession();

Description

Default constructor

[Top]


Member functions


IsOpen()const

inline TBool IsOpen() const;

Description

Tests whether the RTP session represented by this handle is open.

Return value

TBool

ETrue, if the session is open, false otherwise.


OpenL(RSocketServ &,TSockAddr &,TSockAddr &,TInt,RConnection &,TInt,const TDesC8 &)

IMPORT_C void OpenL(RSocketServ &aServer, TSockAddr &aLocalAddr, TSockAddr &aRemoteAddr, TInt aMaxRXSize, RConnection &aConnection, TInt aPriority=EPriorityNormal, const TDesC8 &aCNAME=KNullDesC8);

Description

Opens the RTP session and initialises it.

No events will be generated until after control returns to the active scheduler. After successfully opening the session, the client has the opportunity to initialise the object by adding the event callbacks, that it requires.

Parameters

RSocketServ &aServer

An already opened socket server session

TSockAddr &aLocalAddr

The socket address to bind to at this end.

TSockAddr &aRemoteAddr

The remote socket address.

TInt aMaxRXSize

The maximum expected size of a received packet. Note that this includes the packet header (as it is profile dependent).

RConnection &aConnection

A started RConnection for the interface to open this session on.

TInt aPriority

The priority to be used for internal active objects.

const TDesC8 &aCNAME

The CNAME (Canonical End-Point Identifier).


OpenL(RSocketServ &,TSockAddr &,TSockAddr &,TInt,TInt,const TDesC8 &)

IMPORT_C void OpenL(RSocketServ &aServer, TSockAddr &aLocalAddr, TSockAddr &aRemoteAddr, TInt aMaxRXSize, TInt aPriority=EPriorityNormal, const TDesC8 &aCNAME=KNullDesC8);

Description

Opens the RTP session and initialises it.

No events will be generated until after control returns to the active scheduler. After successfully opening the session, the client has the opportunity to initialise the object by adding the event callbacks, that it requires.

Parameters

RSocketServ &aServer

An already opened socket server session

TSockAddr &aLocalAddr

The socket address to bind to at this end.

TSockAddr &aRemoteAddr

The remote socket address.

TInt aMaxRXSize

The maximum expected size of a received packet. Note that this includes the packet header (as it is profile dependent).

TInt aPriority

The priority to be used for internal active objects.

const TDesC8 &aCNAME

The CNAME (Canonical End-Point Identifier). RTCP is used only if CNAME is provided


OpenL(RSocket &,TInt,TInt)

IMPORT_C void OpenL(RSocket &aSocket, TInt aMaxRXSize, TInt aPriority=EPriorityNormal);

Description

Opens the session and initialises it without RTCP.

No events will be generated until after control returns to the active scheduler. After successfully opening the session, the client has the opportunity to initialise the object by adding the event callbacks, that it requires.

Parameters

RSocket &aSocket

An already connected socket.

TInt aMaxRXSize

The maximum expected size of a received packet. Note that this includes the packet header (as it is profile dependent).

TInt aPriority

The priority to be used for internal active objects.


Close()

IMPORT_C void Close();

Description

Closes the session.

All RRtpSendSource and RRtpReceiveSource objects associated with this session are closed.


SetMaxRXSize(TInt)

IMPORT_C void SetMaxRXSize(TInt aMaxRXSize);

Description

Sets the expected maximum size of a received packet.

This does not affect the packet that is being downloaded or is being waited for, so it is entirely possible that the first packet received after correctly setting the receive packet size will still overflow.

Parameters

TInt aMaxRXSize

The new expected maximum size.

Panic codes

RTP

3 if the session has not been opened and initialised. Note that this panic is raised in debug mode only.


MaxRXSize()

IMPORT_C TInt MaxRXSize();

Description

Gets the current expected maximum size of a received packet.

Return value

TInt

The current expected maximum receive size.

Panic codes

RTP

3 if the session has not been opened and initialised. Note that this panic is raised in debug mode only.


NewReceiveSourceL()

IMPORT_C RRtpReceiveSource NewReceiveSourceL();

Description

Creates a new receive stream, and returns the receive stream handle.

This function should only be called in response to an ERtpNewSource event.

Return value

RRtpReceiveSource

The receive stream handle.

Panic codes

RTP

3 if the session has not been opened and initialised. Note that this panic is raised in debug mode only.


NewReceiveSourceLC()

IMPORT_C RRtpReceiveSource NewReceiveSourceLC();

Description

Creates a new receive stream, puts a pointer to the receive stream object onto the cleanup stack, and returns the receive stream handle.

This function should only be called in response to an ERtpNewSource event.

Note that the function does not put a pointer to the RRtpReceiveSource object onto the cleanup stack as you might normally expect, but puts a pointer to the receive stream object for which the returned RRtpReceiveSource is the handle.

Note also that the API does not give you access to the receive stream object for which the returned RRtpReceiveSource is the handle.

Return value

RRtpReceiveSource

The receive stream handle.

Panic codes

RTP

3 if the session has not been opened and initialised. Note that this panic is raised in debug mode only.

See also:


RegisterEventCallbackL(TRtpEventType,void(*)(T *, const TRtpEvent &),T *,TRtpOneShotness,TInt)

inline void RegisterEventCallbackL(TRtpEventType aType, void(*aCallback)(T *, const TRtpEvent &), T *aPtr, TRtpOneShotness aOneShot, TInt aParameter);

Description

Registers a callback for the specified event.

Some compilers may not support templated member functions. A static version of this function is available that offers the same behaviour: RegisterEventCallbackL(RRtpSession,TRtpEventType,void (*aCallback)(T*, const TRtpEvent&),T*,TRtpOneShotness,TInt)

Parameters

TRtpEventType aType

The type of event.

void(*)(T *, const TRtpEvent &) aCallback

The callback function. The function is templated, and is prototyped to take a pointer to an object of the template type and a const reference to a TRtpEvent. The function returns void.

T *aPtr

A pointer that is passed to the callback function when that function is called.

TRtpOneShotness aOneShot

Indicates whether the callback function is only called once, or can be called more than once.

TInt aParameter

A parameter to be passed to the registration function. The meaning of this depends entirely on the event type. The parameter is optional - the other overload of this function is available for registrations that don't need to pass a parameter.


RegisterEventCallbackL(TRtpEventType,void(*)(T *, const TRtpEvent &),T *,TRtpOneShotness)

inline void RegisterEventCallbackL(TRtpEventType aType, void(*aCallback)(T *, const TRtpEvent &), T *aPtr, TRtpOneShotness aOneShot=ERtpNotOneShot);

Description

Registers a callback for the specified event.

Some compilers may not support templated member functions. A static version of this function is available that offers the same behaviour: RegisterEventCallbackL(RRtpSession,TRtpEventType,void (*aCallback)(T*, const TRtpEvent&),T*,TRtpOneShotness)

Parameters

TRtpEventType aType

The type of event.

void(*)(T *, const TRtpEvent &) aCallback

The callback function. The function is templated, and is prototyped to take a pointer to an object of the template type and a const reference to a TRtpEvent. The function returns void.

T *aPtr

A pointer that is passed to the callback function when that function is called.

TRtpOneShotness aOneShot

Indicates whether the callback function is only called once, or can be called more than once. If not specified, the default is to allow the callback function to be called more than once.


operator==(RRtpSession)const

inline TBool operator==(RRtpSession aThat) const;

Description

Tests whether this session handle represents the same session as the one represented by the specified handle.

Parameters

RRtpSession aThat

The handle of the session to be compared.

Return value

TBool

ETrue, if the represented sessions are the same, false otherwise.


operator!=(RRtpSession)const

inline TBool operator!=(RRtpSession aThat) const;

Description

Tests whether this session handle represents a different session to the one represented by the specified handle.

Parameters

RRtpSession aThat

The handle of the session to be compared.

Return value

TBool

ETrue, if the represented sessions are different, false otherwise.

[Top]


Member enumerations


Enum TRtpSendPacketType

TRtpSendPacketType

Description

A set of bit values passed as a parameter to RRtpSession::SendRTCPPacketL(TDesC8 &) to specify the SDES (Source Description) items that are to be sent with the packet. One or more of these may be set.

ERtcpPacketCNAME

Canonical End-Point Identifier SDES Item.

ERtcpPacketNAME

User Name SDES Item.

ERtcpPacketEMAIL

Electronic Mail Address SDES Item.

ERtcpPacketPHONE

Phone Number SDES Item.

ERtcpPacketLOC

Geographic User Location SDES Item.

ERtcpPacketTOOL

Application or Tool Name SDES Item

ERtcpPacketNOTE

Notice/Status SDES Item

ERtcpPacketPRIV

Private Extensions SDES Item