INET Framework for OMNeT++/OMNEST
RTPPacket Class Reference

#include <RTPPacket.h>

List of all members.

Public Member Functions

 RTPPacket (const char *name=NULL)
 RTPPacket (const RTPPacket &packet)
virtual ~RTPPacket ()
RTPPacketoperator= (const RTPPacket &packet)
virtual RTPPacketdup () const
virtual std::string info ()
virtual void dump ()
virtual int getMarker ()
virtual void setMarker (int marker)
virtual int getPayloadType ()
virtual void setPayloadType (int payloadType)
virtual uint16 getSequenceNumber ()
virtual void setSequenceNumber (uint16 sequenceNumber)
virtual uint32 getTimeStamp ()
virtual void setTimeStamp (uint32 timeStamp)
virtual uint32 getSSRC ()
virtual void setSSRC (uint32 ssrc)
virtual int getHeaderLength ()
virtual int getPayloadLength ()

Static Public Member Functions

static int getFixedHeaderLength ()

Protected Attributes

int _version
int _padding
int _extension
int _csrcCount
int _marker
int _payloadType
uint16 _sequenceNumber
uint32 _timeStamp
uint32 _ssrc

Detailed Description

This class represents an rtp data packet. Real data can either be encapsulated or simulated by adding length. Following rtp header fields exist but aren't used: padding, extension, csrcCount. The csrcList can't be used because csrcCount is always 0.


Constructor & Destructor Documentation

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

Default constructor.

Referenced by dup().

                                     : cPacket(name)
{
    _version = 2;
    _padding = 0;
    _extension = 0;
    _csrcCount = 0;
    _marker = 0;
    _payloadType = 0;
    _sequenceNumber = 0;
    _timeStamp = 0;
    _ssrc = 0;

    // a standard rtp packet without csrcs and data has a length of 12 bytes
    setByteLength(getFixedHeaderLength());
}
RTPPacket::RTPPacket ( const RTPPacket packet)

Copy constructor.

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

Destructor.

{
    // when csrcList is implemented this
    // should free the memory used for it
}

Member Function Documentation

void RTPPacket::dump ( ) [virtual]

Writes a longer description about this RTPPacket into the given stream.

Referenced by RTP::readRet().

{
    ev << "RTPPacket:" << endl;
    ev << "  payloadType = " << _payloadType << endl;
    ev << "  sequenceNumber = " << _sequenceNumber << endl;
    ev << "  timeStamp = " << _timeStamp << endl;
    ev << "  payloadLength = " << getPayloadLength() << endl;
}
RTPPacket * RTPPacket::dup ( ) const [virtual]

Duplicates the RTPPacket by calling the copy constructor.

{
    return new RTPPacket(*this);
}
int RTPPacket::getFixedHeaderLength ( ) [static]

Returns the length of the fixed header of an RTPPacket.

Referenced by getHeaderLength(), and RTPPacket().

{
    return 12;
}
int RTPPacket::getHeaderLength ( ) [virtual]

Returns the length of the header (fixed plus variable part) of this RTPPacket.

Referenced by getPayloadLength().

{
    // fixed header is 12 bytes long,
    // add 4 bytes for every csrc identifier
    return(getFixedHeaderLength() + 4 * _csrcCount);
}
int RTPPacket::getMarker ( ) [virtual]

Returns the value of the marker bit in this RTPPacket.

Referenced by RTPAVProfilePayload32Receiver::processPacket().

{
    return _marker;
}
int RTPPacket::getPayloadLength ( ) [virtual]

Returns the size of the payload stored in this RTPPacket.

Referenced by dump(), info(), RTPAVProfilePayload32Receiver::processPacket(), and RTPSenderInfo::processRTPPacket().

{
    return(getByteLength() - getHeaderLength());
}
int RTPPacket::getPayloadType ( ) [virtual]

Returns the payload type of this RTPPacket.

Referenced by RTPProfile::dataIn().

{
    return _payloadType;
}
uint16 RTPPacket::getSequenceNumber ( ) [virtual]

Returns the sequence number of this RTPPacket.

Referenced by RTPAVProfilePayload32Receiver::processPacket(), and RTPReceiverInfo::processRTPPacket().

{
    return _sequenceNumber;
}
uint32 RTPPacket::getSSRC ( ) [virtual]

Returns the ssrc identifier of this RTPPacket.

Referenced by RTPProfile::dataIn(), and RTCP::processIncomingRTPPacket().

{
    return _ssrc;
}
uint32 RTPPacket::getTimeStamp ( ) [virtual]
std::string RTPPacket::info ( ) [virtual]

Writes a one line info about this RTPPacket into the given string.

{
    std::stringstream out;
    out << "RTPPacket: payloadType=" << _payloadType << " payloadLength=" << getPayloadLength();
    return out.str();
}
RTPPacket & RTPPacket::operator= ( const RTPPacket packet)

Assignment operator.

Referenced by RTPPacket().

{
    cPacket::operator=(packet);
    _version = packet._version;
    _padding = packet._padding;
    _extension = packet._extension;
    _csrcCount = packet._csrcCount;
    _marker = packet._marker;
    _payloadType = packet._payloadType;
    _sequenceNumber = packet._sequenceNumber;
    _timeStamp = packet._timeStamp;
    _ssrc = packet._ssrc;
    return *this;
}
void RTPPacket::setMarker ( int  marker) [virtual]

Sets the value of the marker bit in this RTPPacket.

Referenced by RTPAVProfilePayload32Sender::sendPacket().

{
    _marker = marker;
}
void RTPPacket::setPayloadType ( int  payloadType) [virtual]

Sets the payload type of this RTPPacket.

Referenced by RTPAVProfilePayload32Sender::sendPacket().

{
    _payloadType = payloadType;
}
void RTPPacket::setSequenceNumber ( uint16  sequenceNumber) [virtual]

Sets the sequence number of this RTPPacket.

Referenced by RTPAVProfilePayload32Sender::sendPacket().

{
    _sequenceNumber = sequenceNumber;
}
void RTPPacket::setSSRC ( uint32  ssrc) [virtual]

Sets the ssrc identifier of this RTPPacket.

Referenced by RTPAVProfilePayload32Sender::sendPacket().

{
    _ssrc = ssrc;
}
void RTPPacket::setTimeStamp ( uint32  timeStamp) [virtual]

Sets the rtp time stamp of this RTPPacket.

Referenced by RTPAVProfilePayload32Sender::sendPacket().

{
    _timeStamp = timeStamp;
}

Member Data Documentation

int RTPPacket::_csrcCount [protected]

Stores the number (0..31) of contributing sources for this RTPPacket. It is always 0 because contributing sources are added by rtp mixers which aren't implemented.

Referenced by getHeaderLength(), operator=(), and RTPPacket().

int RTPPacket::_extension [protected]

Set to 1, if this RTPPacket contains an rtp header extension, 0 otherwise. This implementation doesn't support rtp header extensions, so it is always 0.

Referenced by operator=(), and RTPPacket().

int RTPPacket::_marker [protected]

The marker of this RTPPacket.

Referenced by getMarker(), operator=(), RTPPacket(), and setMarker().

int RTPPacket::_padding [protected]

Set to 1 if padding is used in this RTPPacket, 0 otherwise. This implementation doesn't use padding bytes, so it is always 0.

Referenced by operator=(), and RTPPacket().

int RTPPacket::_payloadType [protected]

The type of payload carried in this RTPPacket.

Referenced by dump(), getPayloadType(), info(), operator=(), RTPPacket(), and setPayloadType().

uint16 RTPPacket::_sequenceNumber [protected]

The sequence number of this RTPPacket.

Referenced by dump(), getSequenceNumber(), operator=(), RTPPacket(), and setSequenceNumber().

uint32 RTPPacket::_ssrc [protected]

The ssrc identifier of the creator of this RTPPacket.

Referenced by getSSRC(), operator=(), RTPPacket(), and setSSRC().

uint32 RTPPacket::_timeStamp [protected]

The rtp time stamp of this RTPPacket.

Referenced by dump(), getTimeStamp(), operator=(), RTPPacket(), and setTimeStamp().

int RTPPacket::_version [protected]

The rtp version of this RTPPacket.

Referenced by operator=(), and RTPPacket().


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