#include <RTCPPacket.h>
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 () |
RTCPPacket & | operator= (const RTCPPacket &rtcpPacket) |
virtual RTCPPacket * | dup () 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 |
The values for the packet type field in the rtcp header as defined in the rfc.
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 |
00052 { 00053 RTCP_PT_UNDEF = 0, 00054 RTCP_PT_SR = 200, 00055 RTCP_PT_RR = 201, 00056 RTCP_PT_SDES = 202, 00057 RTCP_PT_BYE = 203 00058 };
RTCPPacket::RTCPPacket | ( | const char * | name = NULL |
) |
Default constructor.
Referenced by dup().
00036 : cPacket(name) { 00037 // initialize variables 00038 _version = 2; 00039 _padding = 0; 00040 _count = 0; 00041 _packetType = RTCP_PT_UNDEF; 00042 // rtcpLength can be calculated with cPacket::getLength() 00043 00044 // RTCP header length size is 4 bytes 00045 // not all rtcp packets (in particular RTCPSDESPacket) have 00046 // the ssrc identifier stored in the header 00047 setByteLength(4); 00048 };
RTCPPacket::RTCPPacket | ( | const RTCPPacket & | rtcpPacket | ) |
Copy constructor.
00051 : cPacket() { 00052 setName(rtcpPacket.getName()); 00053 operator=(rtcpPacket); 00054 };
RTCPPacket & RTCPPacket::operator= | ( | const RTCPPacket & | rtcpPacket | ) |
Assignment operator.
Referenced by RTCPByePacket::operator=(), RTCPSDESPacket::operator=(), RTCPReceiverReportPacket::operator=(), and RTCPPacket().
00061 { 00062 cPacket::operator=(rtcpPacket); 00063 setName(rtcpPacket.getName()); 00064 _version = rtcpPacket._version; 00065 _padding = rtcpPacket._padding; 00066 _count = rtcpPacket._count; 00067 _packetType = rtcpPacket._packetType; 00068 return *this; 00069 };
RTCPPacket * RTCPPacket::dup | ( | ) | const [virtual] |
Duplicates the RTCPPacket by calling the copy constructor.
Reimplemented in RTCPReceiverReportPacket, RTCPSenderReportPacket, RTCPSDESPacket, and RTCPByePacket.
00072 { 00073 return new RTCPPacket(*this); 00074 };
std::string RTCPPacket::info | ( | ) | [virtual] |
Writes a short info about this RTCPPacket into the given buffer.
Reimplemented in RTCPReceiverReportPacket, RTCPSenderReportPacket, and RTCPSDESPacket.
00077 { 00078 std::stringstream out; 00079 out << "RTCPPacket.packetType=" << _packetType; 00080 return out.str(); 00081 };
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.
00084 { 00085 os << "RTCPPacket:" << endl; 00086 os << " version = " << _version << endl; 00087 os << " padding = " << _padding << endl; 00088 os << " count = " << _count << endl; 00089 os << " packetType = " << _packetType << endl; 00090 os << " rtcpLength = " << getRtcpLength() << endl; 00091 };
int RTCPPacket::getVersion | ( | ) | [virtual] |
int RTCPPacket::getPadding | ( | ) | [virtual] |
1 if padding exists, 0 otherwise. In this implementation only 0 is used.
00099 { 00100 return _padding; 00101 };
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.
00104 { 00105 return _count; 00106 };
RTCPPacket::RTCP_PACKET_TYPE RTCPPacket::getPacketType | ( | ) | [virtual] |
Returns the packet type of this rtcp packet.
Referenced by RTCP::processIncomingRTCPPacket().
00109 { 00110 return _packetType; 00111 };
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().
00114 { 00115 // rtcpLength is the header field length 00116 // of an rtcp packet 00117 // in 32 bit words minus one 00118 return (int)(getByteLength() / 4) - 1; 00119 };
int RTCPPacket::_version [protected] |
The rtp version used. Always 2.
Referenced by dump(), getVersion(), operator=(), 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::_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().
RTCP_PACKET_TYPE RTCPPacket::_packetType [protected] |
The packet type of the rtcp packet.
Referenced by dump(), getPacketType(), info(), operator=(), RTCPByePacket::RTCPByePacket(), RTCPPacket(), RTCPReceiverReportPacket::RTCPReceiverReportPacket(), RTCPSDESPacket::RTCPSDESPacket(), and RTCPSenderReportPacket::RTCPSenderReportPacket().