INET Framework for OMNeT++/OMNEST
RTCPPacket Class Reference

#include <RTCPPacket.h>

Inheritance diagram for RTCPPacket:
RTCPByePacket RTCPReceiverReportPacket RTCPSDESPacket RTCPSenderReportPacket

List of all members.

Public Types

enum  RTCP_PACKET_TYPE {
  RTCP_PT_UNDEF = 0, RTCP_PT_SR = 200, RTCP_PT_RR = 201, RTCP_PT_SDES = 202,
  RTCP_PT_BYE = 203
}

Public Member Functions

 RTCPPacket (const char *name=NULL)
 RTCPPacket (const RTCPPacket &rtcpPacket)
virtual ~RTCPPacket ()
RTCPPacketoperator= (const RTCPPacket &rtcpPacket)
virtual RTCPPacketdup () const
virtual std::string info ()
virtual void dump (std::ostream &os) const
virtual int getVersion ()
virtual int getPadding ()
virtual int getCount ()
virtual RTCP_PACKET_TYPE getPacketType ()
virtual int getRtcpLength () const

Protected Attributes

int _version
int _padding
int _count
RTCP_PACKET_TYPE _packetType

Detailed Description

This is a base class for all types (except RTCPCompoundPacket) of rtcp packets. It isn't intended to be used directly.


Member Enumeration Documentation

The values for the packet type field in the rtcp header as defined in the rfc.

Enumerator:
RTCP_PT_UNDEF 

default value undefined

RTCP_PT_SR 

sender report

RTCP_PT_RR 

receiver report

RTCP_PT_SDES 

source description

RTCP_PT_BYE 

bye

                              {
            RTCP_PT_UNDEF =   0, 
            RTCP_PT_SR    = 200, 
            RTCP_PT_RR    = 201, 
            RTCP_PT_SDES  = 202, 
            RTCP_PT_BYE   = 203  
        };

Constructor & Destructor Documentation

RTCPPacket::RTCPPacket ( const char *  name = NULL)

Default constructor.

Referenced by dup().

                                       : cPacket(name) {
    // initialize variables
    _version = 2;
    _padding = 0;
    _count = 0;
    _packetType = RTCP_PT_UNDEF;
    // rtcpLength can be calculated with cPacket::getLength()

    // RTCP header length size is 4 bytes
    // not all rtcp packets (in particular RTCPSDESPacket) have
    // the ssrc identifier stored in the header
    setByteLength(4);
};
RTCPPacket::RTCPPacket ( const RTCPPacket rtcpPacket)

Copy constructor.

                                                   : cPacket() {
    setName(rtcpPacket.getName());
    operator=(rtcpPacket);
};
RTCPPacket::~RTCPPacket ( ) [virtual]

Destructor.

                        {
};

Member Function Documentation

void RTCPPacket::dump ( std::ostream &  os) const [virtual]

Writes a detailed report about this RTCPPacket into the given stream.

Reimplemented in RTCPReceiverReportPacket, RTCPSenderReportPacket, and RTCPSDESPacket.

                                          {
    os << "RTCPPacket:" << endl;
    os << "  version = " << _version << endl;
    os << "  padding = " << _padding << endl;
    os << "  count = " << _count << endl;
    os << "  packetType = " << _packetType << endl;
    os << "  rtcpLength = " << getRtcpLength() << endl;
};
RTCPPacket * RTCPPacket::dup ( ) const [virtual]

Duplicates the RTCPPacket by calling the copy constructor.

Reimplemented in RTCPReceiverReportPacket, RTCPSenderReportPacket, RTCPSDESPacket, and RTCPByePacket.

                                  {
    return new RTCPPacket(*this);
};
int RTCPPacket::getCount ( ) [virtual]

Returns the value of the count field in the rtcp header. Depending on the type of rtcp packet it stands for number of receiver reports or number of sdes chunks contained in this packet.

                         {
    return _count;
};
RTCPPacket::RTCP_PACKET_TYPE RTCPPacket::getPacketType ( ) [virtual]

Returns the packet type of this rtcp packet.

Referenced by RTCP::processIncomingRTCPPacket().

                                                     {
    return _packetType;
};
int RTCPPacket::getPadding ( ) [virtual]

1 if padding exists, 0 otherwise. In this implementation only 0 is used.

                           {
    return _padding;
};
int RTCPPacket::getRtcpLength ( ) const [virtual]

Returns the value of the field length in the rtcp header. The value isn't stored because it can be calculated with the getLength() method inherited from cPacket.

Referenced by dump().

                                    {
    // rtcpLength is the header field length
    // of an rtcp packet
    // in 32 bit words minus one
    return (int)(getByteLength() / 4) - 1;
};
int RTCPPacket::getVersion ( ) [virtual]

Returns the rtp version of the rtcp packet. It's always 2.

                           {
    return _version;
};
std::string RTCPPacket::info ( ) [virtual]

Writes a short info about this RTCPPacket into the given buffer.

Reimplemented in RTCPReceiverReportPacket, RTCPSenderReportPacket, and RTCPSDESPacket.

                           {
    std::stringstream out;
    out << "RTCPPacket.packetType=" << _packetType;
    return out.str();
};
RTCPPacket & RTCPPacket::operator= ( const RTCPPacket rtcpPacket)

Assignment operator.

Referenced by RTCPPacket().

                                                              {
    cPacket::operator=(rtcpPacket);
    setName(rtcpPacket.getName());
    _version = rtcpPacket._version;
    _padding = rtcpPacket._padding;
    _count = rtcpPacket._count;
    _packetType = rtcpPacket._packetType;
    return *this;
};

Member Data Documentation

int RTCPPacket::_count [protected]

Depending on the packet type, here is stored how many receiver reports or sdes chunks are contained in the packet. Values from 0 to 31 are allowed.

Referenced by RTCPReceiverReportPacket::addReceptionReport(), RTCPSDESPacket::addSDESChunk(), dump(), getCount(), RTCPReceiverReportPacket::info(), operator=(), RTCPByePacket::RTCPByePacket(), and RTCPPacket().

int RTCPPacket::_padding [protected]

Set to 1 if padding (bytes at the end of the packet to assure that the packet length in bytes is a multiple of a certain number; possibly needed for encryption) is used. In the simulation padding

Referenced by dump(), getPadding(), operator=(), and RTCPPacket().

int RTCPPacket::_version [protected]

The rtp version used. Always 2.

Referenced by dump(), getVersion(), operator=(), and RTCPPacket().


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