RTCP_Packet Class Reference

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>

Inheritance diagram for RTCP_Packet:

Inheritance graph
[legend]
Collaboration diagram for RTCP_Packet:

Collaboration graph
[legend]
List of all members.

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.

Detailed Description

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.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL RTCP_Packet::RTCP_Packet ( void   ) 

Constructor for outgoing RTCP packets.

Definition at line 7 of file RTCP_Packet.cpp.

References chd_, RTCP_Common_Header::count_, RTCP_Common_Header::length_, packet_data_, RTCP_Common_Header::pad_, and RTCP_Common_Header::ver_.

00008 {
00009   this->chd_.ver_ = 2;
00010   this->chd_.count_ = 0;
00011   this->chd_.pad_ = 0;
00012   this->chd_.length_ = 0;
00013   this->packet_data_ = 0;
00014 }

RTCP_Packet::RTCP_Packet ( char *  buffer  ) 

Constructor for incoming RTCP packets.

Definition at line 16 of file RTCP_Packet.cpp.

References ACE_DEBUG, ACE_NTOHS, chd_, RTCP_Common_Header::count_, RTCP_Common_Header::length_, LM_DEBUG, packet_data_, RTCP_Common_Header::pad_, RTCP_Common_Header::pt_, RTP_VERSION, and RTCP_Common_Header::ver_.

00017 {
00018   // Parse the common part of the control packet header.
00019   this->chd_.ver_ = (buffer[0] & 0xC0) >> 6;
00020 
00021   if (this->chd_.ver_ != RTP_VERSION)
00022     ACE_DEBUG ((LM_DEBUG,
00023                 "RTCP_Packet::RTCP_Packet version incorrect"));
00024 
00025   this->chd_.pad_ = (buffer[0] & 0x20) >> 5;
00026   this->chd_.count_ = buffer[0] & 0x1F;
00027   this->chd_.pt_ = buffer[1];
00028   this->chd_.length_ = ACE_NTOHS(*(ACE_UINT16*)&buffer[2]);
00029   this->packet_data_ = 0;
00030 }

RTCP_Packet::~RTCP_Packet (  )  [virtual]

Destructor.

Definition at line 32 of file RTCP_Packet.cpp.

00033 {
00034 }


Member Function Documentation

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.

Referenced by get_packet_data().

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.

References build_packet(), packet_data_, and packet_size().

Referenced by TAO_AV_RTCP_Callback::send_report().

00038 {
00039   length = static_cast<ACE_UINT16> (this->packet_size());
00040 
00041   // buiidPacket is defined for each child of RTCP_Packet
00042   // buildPacket creates a snapshot of the RTCP packet in the buffer pktData
00043   this->build_packet ();
00044 
00045   *buffer = this->packet_data_;
00046 }

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.

References RTCP_PT_RR, RTCP_PT_SR, and RTP_VERSION.

Referenced by TAO_AV_RTCP_Callback::receive_control_frame().

00050 {
00051   // make sure the RTP version is correct
00052   if (this->chd_.ver_ != RTP_VERSION)
00053     return 0;
00054 
00055   // these checks are only for the first RTCP packet in a compound packet
00056   if (is_first)
00057     {
00058       // the payload type must be RR or SR
00059       if ((this->chd_.pt_ != RTCP_PT_SR) && (this->chd_.pt_ != RTCP_PT_RR))
00060         return 0;
00061 
00062       // the padding bit must not be set
00063       if (this->chd_.pad_ != 0)
00064         return 0;
00065     }
00066 
00067   return 1;
00068 
00069 }

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.

Referenced by get_packet_data().


Member Data Documentation

RTCP_Common_Header RTCP_Packet::chd_ [protected]

Header data common to all RTCP packets.

Definition at line 70 of file RTCP_Packet.h.

Referenced by RTCP_SDES_Packet::add_chunk(), RTCP_SR_Packet::build_packet(), RTCP_SDES_Packet::build_packet(), RTCP_RR_Packet::build_packet(), RTCP_BYE_Packet::build_packet(), RTCP_SR_Packet::packet_size(), RTCP_SDES_Packet::packet_size(), RTCP_RR_Packet::packet_size(), RTCP_BYE_Packet::packet_size(), RTCP_BYE_Packet::RTCP_BYE_Packet(), RTCP_Packet(), RTCP_RR_Packet::RTCP_RR_Packet(), RTCP_SDES_Packet::RTCP_SDES_Packet(), and RTCP_SR_Packet::RTCP_SR_Packet().

char* RTCP_Packet::packet_data_ [protected]

Buffer to hold byte representation of the RTCP packet.

Definition at line 73 of file RTCP_Packet.h.

Referenced by RTCP_SR_Packet::build_packet(), RTCP_SDES_Packet::build_packet(), RTCP_RR_Packet::build_packet(), RTCP_BYE_Packet::build_packet(), get_packet_data(), RTCP_BYE_Packet::RTCP_BYE_Packet(), RTCP_Packet(), RTCP_RR_Packet::RTCP_RR_Packet(), RTCP_SDES_Packet::RTCP_SDES_Packet(), RTCP_SR_Packet::RTCP_SR_Packet(), RTCP_BYE_Packet::~RTCP_BYE_Packet(), RTCP_RR_Packet::~RTCP_RR_Packet(), RTCP_SDES_Packet::~RTCP_SDES_Packet(), and RTCP_SR_Packet::~RTCP_SR_Packet().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:47:58 2010 for TAO_AV by  doxygen 1.4.7