Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

RTPParticipantInfo Class Reference

#include <RTPParticipantInfo.h>

Inheritance diagram for RTPParticipantInfo:
RTPReceiverInfo RTPSenderInfo

List of all members.

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

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

Definition at line 43 of file RTPParticipantInfo.h.


Constructor & Destructor Documentation

RTPParticipantInfo::RTPParticipantInfo ( uint32  ssrc = 0  ) 

Default constructor.

Definition at line 30 of file RTPParticipantInfo.cc.

Referenced by dup().

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

RTPParticipantInfo::RTPParticipantInfo ( const RTPParticipantInfo participantInfo  ) 

Copy constructor.

Definition at line 45 of file RTPParticipantInfo.cc.

                                                                                : cObject()
{
    operator=(participantInfo);
}

RTPParticipantInfo::~RTPParticipantInfo (  )  [virtual]

Destructor.

Definition at line 51 of file RTPParticipantInfo.cc.

{
    delete _sdesChunk;
}


Member Function Documentation

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

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

Definition at line 113 of file RTPParticipantInfo.cc.

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

{
    _sdesChunk->addSDESItem(sdesItem);
}

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.

Definition at line 161 of file RTPParticipantInfo.cc.

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

void RTPParticipantInfo::dump (  )  const [virtual]

Definition at line 211 of file RTPParticipantInfo.cc.

{
    std::cout <<" adress= "<< _address
              <<" rtpPort= "<< _rtpPort
              <<" rtcpPort= "<< _rtcpPort
              << endl;
}

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

Duplicates this RTPParticipantInfo by calling the copy constructor.

Reimplemented in RTPReceiverInfo, and RTPSenderInfo.

Definition at line 68 of file RTPParticipantInfo.cc.

{
    return new RTPParticipantInfo(*this);
}

IPAddress RTPParticipantInfo::getAddress (  )  [virtual]

Returns the ip address of the rtp endsystem.

Definition at line 167 of file RTPParticipantInfo.cc.

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

{
    return _address;
}

int RTPParticipantInfo::getRTCPPort (  )  [virtual]

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

Definition at line 191 of file RTPParticipantInfo.cc.

Referenced by RTCP::processIncomingRTCPPacket().

{
    return _rtcpPort;
}

int RTPParticipantInfo::getRTPPort (  )  [virtual]

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

Definition at line 179 of file RTPParticipantInfo.cc.

Referenced by RTCP::processIncomingRTPPacket().

{
    return _rtpPort;
}

SDESChunk * RTPParticipantInfo::getSDESChunk (  )  [virtual]

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

Definition at line 107 of file RTPParticipantInfo.cc.

Referenced by RTCP::createPacket().

{
    return new SDESChunk(*_sdesChunk);
}

uint32 RTPParticipantInfo::getSSRC (  )  [virtual]

Returns the ssrc identifier of the rtp endsystem.

Definition at line 149 of file RTPParticipantInfo.cc.

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

{
    return _sdesChunk->getSSRC();
}

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).

Definition at line 119 of file RTPParticipantInfo.cc.

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

{
    return (_silentIntervals <= 1);
}

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.

Definition at line 137 of file RTPParticipantInfo.cc.

Referenced by RTCP::createPacket().

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

Assignment operator.

Definition at line 57 of file RTPParticipantInfo.cc.

Referenced by RTPParticipantInfo().

{
    cObject::operator=(participantInfo);
    _sdesChunk = new SDESChunk(*(participantInfo._sdesChunk));
    _address = participantInfo._address;
    _rtpPort = participantInfo._rtpPort;
    _rtcpPort = participantInfo._rtcpPort;
    return *this;
}

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

This method extracts information of the given ReceptionReport.

Reimplemented in RTPSenderInfo.

Definition at line 88 of file RTPParticipantInfo.cc.

{
    // useful code can be found in subclasses
    delete report;
}

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.

Definition at line 74 of file RTPParticipantInfo.cc.

Referenced by RTCP::processIncomingRTPPacket().

{
    _silentIntervals = 0;
    delete packet;
}

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.

Definition at line 95 of file RTPParticipantInfo.cc.

Referenced by RTCP::processIncomingRTCPPacket().

{
    for (int i = 0; i < sdesChunk->size(); i++) {
        if (sdesChunk->exist(i)) {
            SDESItem *sdesItem = (SDESItem *)(sdesChunk->remove(i));
            addSDESItem(sdesItem);
        }
    }
    delete sdesChunk;
}

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.

Definition at line 81 of file RTPParticipantInfo.cc.

Referenced by RTCP::processIncomingRTCPPacket().

{
    // useful code can be found in subclasses
    delete report;
}

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.

Definition at line 125 of file RTPParticipantInfo.cc.

{
    return NULL;
}

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.

Definition at line 131 of file RTPParticipantInfo.cc.

{
    return NULL;
}

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

Sets the ip address of the rtp endsystem.

Definition at line 173 of file RTPParticipantInfo.cc.

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

{
    _address = address;
}

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

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

Definition at line 197 of file RTPParticipantInfo.cc.

Referenced by RTCP::processIncomingRTCPPacket().

{
    _rtcpPort = rtcpPort;
}

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

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

Definition at line 185 of file RTPParticipantInfo.cc.

Referenced by RTCP::processIncomingRTPPacket().

{
    _rtpPort = rtpPort;
}

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

Sets the ssrc identifier.

Definition at line 155 of file RTPParticipantInfo.cc.

Referenced by RTCP::chooseSSRC().

{
    _sdesChunk->setSSRC(ssrc);
}

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.

Definition at line 203 of file RTPParticipantInfo.cc.

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

{
    char name[9];
    sprintf(name, "%08x", ssrc);
    return opp_strdup(name);
}

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.

Definition at line 143 of file RTPParticipantInfo.cc.

Referenced by RTCP::createPacket().

{
    return false;
}


Member Data Documentation

Used for storing the ip address of this endsystem.

Definition at line 217 of file RTPParticipantInfo.h.

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

Used for storing the port for rtcp by this endsystem.

Definition at line 227 of file RTPParticipantInfo.h.

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

Used for storing the port for rtp by this endsystem.

Definition at line 222 of file RTPParticipantInfo.h.

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

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

Definition at line 212 of file RTPParticipantInfo.h.

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

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.

Definition at line 234 of file RTPParticipantInfo.h.

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


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