RTP Audio System  2.0.0
RTCPAbstractServer Class Reference

RTCP abstract server. More...

#include <rtcpabstractserver.h>

Inheritance diagram for RTCPAbstractServer:
TimedThread MultiTimerThread< Timers > Thread Synchronizable AudioServer

List of all members.

Classes

struct  Client

Public Types

enum  DeleteReason { DeleteReason_UserBye = 0, DeleteReason_Timeout = 1, DeleteReason_Shutdown = 2, DeleteReason_Error = 3 }

Public Member Functions

 RTCPAbstractServer ()
 ~RTCPAbstractServer ()
virtual void * newClient (Client *client, const char *cname)=0
virtual void deleteClient (Client *client, const DeleteReason reason)=0
virtual bool checkClient (Client *client)=0
virtual void appMessage (Client *client, const char *name, void *data, const cardinal dataLength)=0
virtual void sdesMessage (Client *client, const card8 type, char *data, const cardinal length)=0
virtual void receiverReport (Client *client, RTCPReceptionReportBlock *report, const cardinal layer)=0
virtual void outOfMemoryWarning ()
cardinal getMembers ()
card64 getDefaultTimeout () const
void setDefaultTimeout (const card64 timeout)
void * stop ()

Private Member Functions

void receivedSenderReport (const InternetFlow flow, const card32 source, RTCPReceptionReportBlock *report, const cardinal layer)
void receivedReceiverReport (const InternetFlow flow, const card32 source, RTCPReceptionReportBlock *report, const cardinal layer)
void receivedSourceDescription (const InternetFlow flow, const card32 source, const card8 type, char *data, const card8 length)
void receivedApp (const InternetFlow flow, const card32 source, const char *name, void *data, const card32 dataLength)
void receivedBye (const InternetFlow flow, const card32 source, const DeleteReason reason)
ClientfindClient (const card32 source, const InternetFlow flow)
void timerEvent ()

Private Attributes

card64 DefaultTimeout
std::multimap< const cardinal,
Client * > 
ClientSet

Friends

class RTCPReceiver

Detailed Description

RTCP abstract server.

This class is an abstract RTCP server.

Author:
Thomas Dreibholz
Version:
1.0

Member Enumeration Documentation

A set of reasons for deleteClient() call.

Enumerator:
DeleteReason_UserBye 
DeleteReason_Timeout 
DeleteReason_Shutdown 
DeleteReason_Error 

Constructor & Destructor Documentation


Member Function Documentation

virtual void RTCPAbstractServer::appMessage ( Client client,
const char *  name,
void *  data,
const cardinal  dataLength 
) [pure virtual]

Called when a client sends RTCP APP message. The call is synchronized by RTCPAbstractServer.

Parameters:
clientClient.
nameRTCP APP name.
dataRTCP APP data.
dataLengthRTCP APP data length.

Implemented in AudioServer.

virtual bool RTCPAbstractServer::checkClient ( Client client) [pure virtual]

This method is called about once per second to check, if the client is okay (e.g. no transmission error has occurred etc.) The call is synchronized by RTCPAbstractServer.

Returns:
true, if client is okay; false to delete client in case of an error.

Implemented in AudioServer.

virtual void RTCPAbstractServer::deleteClient ( Client client,
const DeleteReason  reason 
) [pure virtual]

Called when a client sends RTCP BYE or the timeout is reached. The call is synchronized by RTCPAbstractServer.

Parameters:
clientClient.
reasonReason for deleteClient() call.
hasTimeouttrue, if timeout is reached; false, if RTCP BYE received.
shutdowntrue, if server shutdown is in progress.

Implemented in AudioServer.

RTCPAbstractServer::Client * RTCPAbstractServer::findClient ( const card32  source,
const InternetFlow  flow 
) [private]

Get the default timeout in microseconds, after which a client is assumed to be dead and removed.

Returns:
Default timeout in microseconds.

Get number of members serverd by the server.

Returns:
Number of members.
virtual void* RTCPAbstractServer::newClient ( Client client,
const char *  cname 
) [pure virtual]

Called when a new client sends its SDES CNAME message. The class inheriting RTCPAbstractServer may use the client->UserData field to store additional data to serve the client. The result of the call will be saved into this field (client->UserData = newClient(client))! The call is synchronized by RTCPAbstractServer.

Parameters:
clientClient.
cnameCNAME string.
Returns:
A value, which RTCPAbstractServer will save to client->UserData.

Implemented in AudioServer.

This method is called, if an out of memory error occurs. It prints a simple error message. It should be overloaded by a more useful method within the concrete server. The call is synchronized by RTCPAbstractServer.

Reimplemented in AudioServer.

void RTCPAbstractServer::receivedApp ( const InternetFlow  flow,
const card32  source,
const char *  name,
void *  data,
const card32  dataLength 
) [private]
void RTCPAbstractServer::receivedBye ( const InternetFlow  flow,
const card32  source,
const DeleteReason  reason 
) [private]
void RTCPAbstractServer::receivedReceiverReport ( const InternetFlow  flow,
const card32  source,
RTCPReceptionReportBlock report,
const cardinal  layer 
) [private]
void RTCPAbstractServer::receivedSenderReport ( const InternetFlow  flow,
const card32  source,
RTCPReceptionReportBlock report,
const cardinal  layer 
) [private]
void RTCPAbstractServer::receivedSourceDescription ( const InternetFlow  flow,
const card32  source,
const card8  type,
char *  data,
const card8  length 
) [private]
virtual void RTCPAbstractServer::receiverReport ( Client client,
RTCPReceptionReportBlock report,
const cardinal  layer 
) [pure virtual]

Called when a client sends a receiver report; it is called for every receiver report block in the message. The call is synchronized by RTCPAbstractServer.

Parameters:
clientClient.
reportRTCPReceptionReportBlock.
layerLayer number.

Implemented in AudioServer.

virtual void RTCPAbstractServer::sdesMessage ( Client client,
const card8  type,
char *  data,
const cardinal  length 
) [pure virtual]

Called when a client sends RTCP SDES message; it is called for every SDES item in the message. The call is synchronized by RTCPAbstractServer.

Parameters:
clientClient.
typeRTCP SDES type.
dataRTCP SDES data.
lengthRTCP SDES length.

Implemented in AudioServer.

void RTCPAbstractServer::setDefaultTimeout ( const card64  timeout) [inline]

Set the default timeout in microseconds, after which a client is assumed to be dead and removed. The new value will be used for all new clients. Timeouts of old clients are not changed!

Parameters:
timeoutDefault timeout in microseconds.
void * RTCPAbstractServer::stop ( ) [virtual]

Reimplementation of Thread::stop() to remove all clients before stopping.

See also:
Thread::stop

Reimplemented from MultiTimerThread< Timers >.

void RTCPAbstractServer::timerEvent ( ) [private, virtual]

The virtual timerEvent() method, which contains the timed thread's implementation. It has to be implemented by classes, which inherit TimedThread. This method is called regularly with the given interval.

Implements TimedThread.


Friends And Related Function Documentation

friend class RTCPReceiver [friend]

RTCPReceiver is friend class to enable usage of receivedXXX() methods.


Member Data Documentation

std::multimap<const cardinal,Client*> RTCPAbstractServer::ClientSet [private]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines