RTPParticipantInfo Class Reference

#include <RTPParticipantInfo.h>

Inheritance diagram for RTPParticipantInfo:

RTPReceiverInfo RTPSenderInfo

List of all members.


Detailed Description

This class is a super class for classes intended for storing information about rtp end systems. It has two subclasses: RTPReceiverInformation which is used for storing information about other system participating in an rtp session. RTPSenderInformation is used by an rtp endsystem for storing information about itself.
See also:
RTPReceiverInformation

RTPSenderInformation


Public Member Functions

 RTPParticipantInfo (uint32 ssrc=0)
 RTPParticipantInfo (const RTPParticipantInfo &participantInfo)
virtual ~RTPParticipantInfo ()
RTPParticipantInfooperator= (const RTPParticipantInfo &participantInfo)
virtual RTPParticipantInfodup () const
virtual void processRTPPacket (RTPPacket *packet, int id, simtime_t arrivalTime)
virtual void processSenderReport (SenderReport *report, simtime_t arrivalTime)
virtual void processReceptionReport (ReceptionReport *report, simtime_t arrivalTime)
virtual void processSDESChunk (SDESChunk *sdesChunk, simtime_t arrivalTime)
virtual SDESChunkgetSDESChunk ()
virtual void addSDESItem (SDESItem *sdesItem)
virtual ReceptionReportreceptionReport (simtime_t now)
virtual SenderReportsenderReport (simtime_t now)
virtual void nextInterval (simtime_t now)
virtual bool toBeDeleted (simtime_t now)
virtual bool isSender ()
virtual uint32 getSSRC ()
virtual void setSSRC (uint32 ssrc)
virtual IPAddress getAddress ()
virtual void setAddress (IPAddress address)
virtual int getRTPPort ()
virtual void setRTPPort (int rtpPort)
virtual int getRTCPPort ()
virtual void setRTCPPort (int rtpPort)
virtual void dump () const

Static Public Member Functions

static char * ssrcToName (uint32 ssrc)

Protected Member Functions

virtual void addSDESItem (SDESItem::SDES_ITEM_TYPE type, const char *content)

Protected Attributes

SDESChunk_sdesChunk
IPAddress _address
int _rtpPort
int _rtcpPort
int _silentIntervals

Constructor & Destructor Documentation

RTPParticipantInfo::RTPParticipantInfo ( uint32  ssrc = 0  ) 

Default constructor.

Referenced by dup().

00030                                                   : cObject() {
00031     _sdesChunk = new SDESChunk("SDESChunk", ssrc);
00032     // because there haven't been sent any rtp packets
00033     // by this endsystem at all, the number of silent
00034     // intervals would be undefined; to calculate with
00035     // it but not to regard this endsystem as a sender
00036     // it is set to 3; see isSender() for details
00037     _silentIntervals = 3;
00038     _address = IPAddress::UNSPECIFIED_ADDRESS;
00039     _rtpPort = PORT_UNDEF;
00040     _rtcpPort = PORT_UNDEF;
00041 };

RTPParticipantInfo::RTPParticipantInfo ( const RTPParticipantInfo participantInfo  ) 

Copy constructor.

00044                                                                                 : cObject() {
00045     operator=(participantInfo);
00046 };

RTPParticipantInfo::~RTPParticipantInfo (  )  [virtual]

Destructor.

00049                                         {
00050     delete _sdesChunk;
00051 };


Member Function Documentation

RTPParticipantInfo & RTPParticipantInfo::operator= ( const RTPParticipantInfo participantInfo  ) 

Assignment operator.

Referenced by RTPSenderInfo::operator=(), RTPReceiverInfo::operator=(), and RTPParticipantInfo().

00054                                                                                            {
00055     cObject::operator=(participantInfo);
00056     _sdesChunk = new SDESChunk(*(participantInfo._sdesChunk));
00057     _address = participantInfo._address;
00058     _rtpPort = participantInfo._rtpPort;
00059     _rtcpPort = participantInfo._rtcpPort;
00060     return *this;
00061 };

RTPParticipantInfo * RTPParticipantInfo::dup (  )  const [virtual]

Duplicates this RTPParticipantInfo by calling the copy constructor.

Reimplemented in RTPReceiverInfo, and RTPSenderInfo.

00064                                                   {
00065     return new RTPParticipantInfo(*this);
00066 };

void RTPParticipantInfo::processRTPPacket ( RTPPacket packet,
int  id,
simtime_t  arrivalTime 
) [virtual]

This method should be extended by a subclass for extracting information about the originating endsystem of an rtp packet. This method sets _silentInterval to 0 so that the sender of this rtp packet is regarded as an active sender.

Reimplemented in RTPReceiverInfo, and RTPSenderInfo.

Referenced by RTCP::processIncomingRTPPacket(), RTPSenderInfo::processRTPPacket(), and RTPReceiverInfo::processRTPPacket().

00069                                                                                           {
00070     _silentIntervals = 0;
00071     delete packet;
00072 };

void RTPParticipantInfo::processSenderReport ( SenderReport report,
simtime_t  arrivalTime 
) [virtual]

This method extracts information about an rtp endsystem as provided by the given SenderReport.

Reimplemented in RTPReceiverInfo.

Referenced by RTCP::processIncomingRTCPPacket().

00075                                                                                         {
00076     // useful code can be found in subclasses
00077     delete report;
00078 };

void RTPParticipantInfo::processReceptionReport ( ReceptionReport report,
simtime_t  arrivalTime 
) [virtual]

This method extracts information of the given ReceptionReport.

Reimplemented in RTPSenderInfo.

00081                                                                                               {
00082     // useful code can be found in subclasses
00083     delete report;
00084 };

void RTPParticipantInfo::processSDESChunk ( SDESChunk sdesChunk,
simtime_t  arrivalTime 
) [virtual]

This method extracts sdes information of the given sdes chunk.and stores it.

Reimplemented in RTPReceiverInfo.

Referenced by RTCP::processIncomingRTCPPacket(), and RTPReceiverInfo::processSDESChunk().

00087                                                                                      {
00088     for (int i = 0; i < sdesChunk->size(); i++) {
00089         if (sdesChunk->exist(i)) {
00090             SDESItem *sdesItem = (SDESItem *)(sdesChunk->remove(i));
00091             addSDESItem(sdesItem);
00092         }
00093     }
00094     delete sdesChunk;
00095 };

SDESChunk * RTPParticipantInfo::getSDESChunk (  )  [virtual]

Returns a copy of the sdes chunk used for storing source description items about this system.

Referenced by RTCP::createPacket().

00098                                             {
00099     return new SDESChunk(*_sdesChunk);
00100 };

void RTPParticipantInfo::addSDESItem ( SDESItem sdesItem  )  [virtual]

Adds this sdes item to the sdes chunk of this participant.

Referenced by RTCP::initializeRTCP(), and processSDESChunk().

00103                                                        {
00104     _sdesChunk->addSDESItem(sdesItem);
00105 };

ReceptionReport * RTPParticipantInfo::receptionReport ( simtime_t  now  )  [virtual]

This method is intended to be overwritten by subclasses. It should return a receiver report if there have been received rtp packets from that endsystem and NULL otherwise.

Reimplemented in RTPReceiverInfo.

00113                                                                   {
00114     return NULL;
00115 };

SenderReport * RTPParticipantInfo::senderReport ( simtime_t  now  )  [virtual]

This method is intended to be overwritten by subclasses which are used for storing information about itself. It should return a sender report if there have been sent rtp packets recently or NULL otherwise. The implementation for this class always returns NULL.

Reimplemented in RTPSenderInfo.

00118                                                             {
00119     return NULL;
00120 };

void RTPParticipantInfo::nextInterval ( simtime_t  now  )  [virtual]

This method should be called by the rtcp module which uses this class for storing information every time an rtcp packet is sent. Some behaviour of rtp and rtcp (and this class) depend on how many rtcp intervals have passed, for example an rtp end system is marked as inactive if there haven't been received packets from it for a certain number of rtpc intervals. Call getSenderReport() and createReceptionReport() before calling this method.

See also:
getSenderReport()

createReceptionReport()

Reimplemented in RTPReceiverInfo.

Referenced by RTCP::createPacket(), and RTPReceiverInfo::nextInterval().

00123                                                    {
00124     _silentIntervals++;
00125 };

bool RTPParticipantInfo::toBeDeleted ( simtime_t  now  )  [virtual]

Returns true if the end system does no longer participate in the rtp session. The implementation in this class always returns false.

Reimplemented in RTPReceiverInfo, and RTPSenderInfo.

Referenced by RTCP::createPacket().

00128                                                   {
00129     return false;
00130 };

bool RTPParticipantInfo::isSender (  )  [virtual]

Returns true if this endsystem has sent at least one rtp data packet during the last two rtcp intervals (including the current one).

Referenced by RTCP::createPacket(), RTPReceiverInfo::receptionReport(), RTCP::scheduleInterval(), and RTPSenderInfo::senderReport().

00108                                   {
00109     return (_silentIntervals <= 1);
00110 };

uint32 RTPParticipantInfo::getSSRC (  )  [virtual]

Returns the ssrc identifier of the rtp endsystem.

Referenced by RTCP::createPacket(), RTCP::handleSelfMessage(), RTCP::processIncomingRTCPPacket(), and RTPReceiverInfo::receptionReport().

00133                                    {
00134     return _sdesChunk->getSSRC();
00135 };

void RTPParticipantInfo::setSSRC ( uint32  ssrc  )  [virtual]

Sets the ssrc identifier.

Referenced by RTCP::chooseSSRC().

00138                                             {
00139     _sdesChunk->setSSRC(ssrc);
00140 };

IPAddress RTPParticipantInfo::getAddress (  )  [virtual]

Returns the ip address of the rtp endsystem.

Referenced by RTCP::processIncomingRTCPPacket(), and RTCP::processIncomingRTPPacket().

00148                                          {
00149     return _address;
00150 };

void RTPParticipantInfo::setAddress ( IPAddress  address  )  [virtual]

Sets the ip address of the rtp endsystem.

Referenced by RTCP::processIncomingRTCPPacket(), and RTCP::processIncomingRTPPacket().

00153                                                      {
00154     _address = address;
00155 };

int RTPParticipantInfo::getRTPPort (  )  [virtual]

Returns the port used by this endsystem for transmitting rtp packets.

Referenced by RTCP::processIncomingRTPPacket().

00158                                    {
00159     return _rtpPort;
00160 };

void RTPParticipantInfo::setRTPPort ( int  rtpPort  )  [virtual]

Sets the port used by the endsystem for transmitting rtp packets.

Referenced by RTCP::processIncomingRTPPacket().

00163                                                {
00164     _rtpPort = rtpPort;
00165 };

int RTPParticipantInfo::getRTCPPort (  )  [virtual]

Returns the port used by this endsystem for transmitting rtcp packets.

Referenced by RTCP::processIncomingRTCPPacket().

00168                                     {
00169     return _rtcpPort;
00170 };

void RTPParticipantInfo::setRTCPPort ( int  rtpPort  )  [virtual]

Sets the port used by the endsystem for transmitting rtcp packets.

Referenced by RTCP::processIncomingRTCPPacket().

00173                                                  {
00174     _rtcpPort = rtcpPort;
00175 };

char * RTPParticipantInfo::ssrcToName ( uint32  ssrc  )  [static]

This method returns the given 32 bit ssrc identifier as an 8 character hexadecimal number which is used as name of an RTPParticipantInfo object.

Referenced by RTCP::findParticipantInfo(), and RTPProfile::findSSRCGate().

00178                                                 {
00179     char name[9];
00180     sprintf(name, "%08x", ssrc);
00181     return opp_strdup(name);
00182 };

void RTPParticipantInfo::dump (  )  const [virtual]

00185                                     {
00186     std::cout <<" adress= "<< _address
00187               <<" rtpPort= "<< _rtpPort
00188               <<" rtcpPort= "<< _rtcpPort
00189               << endl;
00190 };

void RTPParticipantInfo::addSDESItem ( SDESItem::SDES_ITEM_TYPE  type,
const char *  content 
) [protected, virtual]

Creates a new SDESItem and adds it to the SDESChunk stored in this RTPParticipantInfo.

00143                                                                                      {
00144     _sdesChunk->addSDESItem(new SDESItem(type, content));
00145 };


Member Data Documentation

Used for storing sdes information about this rtp endsystem. The ssrc identifier is also stored here.

Referenced by addSDESItem(), getSDESChunk(), getSSRC(), operator=(), RTPParticipantInfo(), setSSRC(), and ~RTPParticipantInfo().

Used for storing the ip address of this endsystem.

Referenced by dump(), getAddress(), operator=(), RTPParticipantInfo(), and setAddress().

Used for storing the port for rtp by this endsystem.

Referenced by dump(), getRTPPort(), operator=(), RTPParticipantInfo(), and setRTPPort().

Used for storing the port for rtcp by this endsystem.

Referenced by dump(), getRTCPPort(), operator=(), RTPParticipantInfo(), and setRTCPPort().

Stores the number of rtcp intervals (including the current one) during which this rtp endsystem hasn't sent any rtp data packets. When an rtp data packet is received it is reset to 0.

Referenced by isSender(), nextInterval(), processRTPPacket(), and RTPParticipantInfo().


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

Generated on Fri Mar 20 18:51:21 2009 for INET Framework for OMNeT++/OMNEST by  doxygen 1.5.5