This is an abstract class from which all RTCP packet types are derived. It contains code used to validate the RTCP packet. More...
#include <RTCP_Packet.h>
Public Member Functions | |
RTCP_Packet (void) | |
Constructor for outgoing RTCP packets. | |
RTCP_Packet (char *buffer) | |
Constructor for incoming RTCP packets. | |
virtual | ~RTCP_Packet () |
Destructor. | |
void | get_packet_data (char **buffer, ACE_UINT16 &length) |
Returns a pointer to a local buffer containing the packet. | |
virtual unsigned int | packet_size (void)=0 |
int | is_valid (char is_first) |
Protected Member Functions | |
virtual void | build_packet (void)=0 |
Protected Attributes | |
RTCP_Common_Header | chd_ |
Header data common to all RTCP packets. | |
char * | packet_data_ |
Buffer to hold byte representation of the RTCP packet. |
This is an abstract class from which all RTCP packet types are derived. It contains code used to validate the RTCP packet.
Definition at line 44 of file RTCP_Packet.h.
RTCP_Packet::RTCP_Packet | ( | void | ) |
RTCP_Packet::RTCP_Packet | ( | char * | buffer | ) |
Constructor for incoming RTCP packets.
Definition at line 16 of file RTCP_Packet.cpp.
{ // Parse the common part of the control packet header. this->chd_.ver_ = (buffer[0] & 0xC0) >> 6; if (this->chd_.ver_ != RTP_VERSION) ACE_DEBUG ((LM_DEBUG, "RTCP_Packet::RTCP_Packet version incorrect")); this->chd_.pad_ = (buffer[0] & 0x20) >> 5; this->chd_.count_ = buffer[0] & 0x1F; this->chd_.pt_ = buffer[1]; this->chd_.length_ = ACE_NTOHS(*(ACE_UINT16*)&buffer[2]); this->packet_data_ = 0; }
RTCP_Packet::~RTCP_Packet | ( | void | ) | [virtual] |
virtual void RTCP_Packet::build_packet | ( | void | ) | [protected, pure virtual] |
Used to create the byte representation of the RTCP packet. Defined in child class.
Implemented in RTCP_BYE_Packet, RTCP_RR_Packet, RTCP_SDES_Packet, and RTCP_SR_Packet.
void RTCP_Packet::get_packet_data | ( | char ** | buffer, | |
ACE_UINT16 & | length | |||
) |
Returns a pointer to a local buffer containing the packet.
Definition at line 37 of file RTCP_Packet.cpp.
{ length = static_cast<ACE_UINT16> (this->packet_size()); // buiidPacket is defined for each child of RTCP_Packet // buildPacket creates a snapshot of the RTCP packet in the buffer pktData this->build_packet (); *buffer = this->packet_data_; }
int RTCP_Packet::is_valid | ( | char | is_first | ) |
Checks the validity of an RTCP packet. RTCP packets can be sent together in a compound packet and is_first indicates the first packet in a compound packet
Definition at line 49 of file RTCP_Packet.cpp.
{ // make sure the RTP version is correct if (this->chd_.ver_ != RTP_VERSION) return 0; // these checks are only for the first RTCP packet in a compound packet if (is_first) { // the payload type must be RR or SR if ((this->chd_.pt_ != RTCP_PT_SR) && (this->chd_.pt_ != RTCP_PT_RR)) return 0; // the padding bit must not be set if (this->chd_.pad_ != 0) return 0; } return 1; }
virtual unsigned int RTCP_Packet::packet_size | ( | void | ) | [pure virtual] |
Returns the size of the packet. Defined in child class.
Implemented in RTCP_BYE_Packet, RTCP_RR_Packet, RTCP_SDES_Packet, and RTCP_SR_Packet.
RTCP_Common_Header RTCP_Packet::chd_ [protected] |
Header data common to all RTCP packets.
Definition at line 70 of file RTCP_Packet.h.
char* RTCP_Packet::packet_data_ [protected] |
Buffer to hold byte representation of the RTCP packet.
Definition at line 73 of file RTCP_Packet.h.