#include <RTCP_Packet.h>
Inheritance diagram for RTCP_SR_Packet:
Public Member Functions | |
RTCP_SR_Packet (char *buffer, int *len) | |
Constructor for incoming SR packets. | |
RTCP_SR_Packet (ACE_UINT32 ssrcVal, ACE_UINT32 ntpMSByte, ACE_UINT32 ntpLSByte, ACE_UINT32 timestamp, ACE_UINT32 pktsSent, ACE_UINT32 octetsSent, RR_Block *rrBlocks) | |
Constructor for outgoing SR packets. | |
virtual | ~RTCP_SR_Packet (void) |
Destructor. | |
unsigned int | packet_size (void) |
Returns the size of the packet in bytes. | |
ACE_UINT32 | ssrc (void) |
Returns the synchronization source id for the sender of this packet. | |
ACE_UINT32 | ntp_ts_msw (void) |
Returns the most significant word of the NTP timestamp. | |
ACE_UINT32 | ntp_ts_lsw (void) |
Returns the least significant word of the NTP timestamp. | |
void | dump (void) |
Prints the contents of the packet. | |
Private Member Functions | |
void | build_packet (void) |
Used to create the byte representation of the RTCP packet. | |
Private Attributes | |
ACE_UINT32 | ssrc_ |
The synchronization source id of the sender generating this report. | |
ACE_UINT32 | ntp_ts_msw_ |
The most significant word of the NTP timestamp. | |
ACE_UINT32 | ntp_ts_lsw_ |
The least significant word of the NTP timestamp. | |
ACE_UINT32 | rtp_ts_ |
The RTP timestamp. | |
ACE_UINT32 | psent_ |
The total number of packets sent. | |
ACE_UINT32 | osent_ |
The total number of octets sent. | |
RR_Block * | rr_ |
A linked list of receiver report blocks. |
Definition at line 343 of file RTCP_Packet.h.
RTCP_SR_Packet::RTCP_SR_Packet | ( | char * | buffer, | |
int * | len | |||
) |
Constructor for incoming SR packets.
Definition at line 1027 of file RTCP_Packet.cpp.
References ACE_NEW, ACE_NTOHL, RTCP_Packet::chd_, RTCP_Common_Header::count_, RR_Block::dlsr_, RR_Block::fraction_, RR_Block::jitter_, RR_Block::last_seq_, RTCP_Common_Header::length_, RR_Block::lost_, RR_Block::lsr_, RR_Block::next_, ntp_ts_lsw_, ntp_ts_msw_, osent_, RTCP_Packet::packet_data_, psent_, rr_, rtp_ts_, RR_Block::ssrc_, and ssrc_.
01029 : RTCP_Packet (buffer) 01030 { 01031 unsigned int i = 0; 01032 RR_Block *local_block_ptr = 0; 01033 01034 this->rr_ = 0; 01035 01036 // The common part of the header is initialized in the parent. 01037 i=4; 01038 this->ssrc_ = ACE_NTOHL(*(ACE_UINT32*)&buffer[i]); 01039 i+=4; 01040 this->ntp_ts_msw_ = ACE_NTOHL(*(ACE_UINT32*)&buffer[i]); 01041 i+=4; 01042 this->ntp_ts_lsw_ = ACE_NTOHL(*(ACE_UINT32*)&buffer[i]); 01043 i+=4; 01044 this->rtp_ts_ = ACE_NTOHL(*(ACE_UINT32*)&buffer[i]); 01045 i+=4; 01046 this->psent_ = ACE_NTOHL(*(ACE_UINT32*)&buffer[i]); 01047 i+=4; 01048 this->osent_ = ACE_NTOHL(*(ACE_UINT32*)&buffer[i]); 01049 i+=4; 01050 for (unsigned int j=0; j<this->chd_.count_; j++) 01051 { 01052 if (j==0) 01053 { 01054 ACE_NEW (local_block_ptr, 01055 RR_Block); 01056 this->rr_ = local_block_ptr; 01057 } 01058 else 01059 { 01060 ACE_NEW (local_block_ptr->next_, 01061 RR_Block); 01062 local_block_ptr = local_block_ptr->next_; 01063 } 01064 01065 local_block_ptr->next_ = 0; 01066 local_block_ptr->ssrc_ = ACE_NTOHL(*(ACE_UINT32*)&buffer[i]); 01067 i+=4; 01068 ACE_UINT32 temp = ACE_NTOHL(*(ACE_UINT32*)&buffer[i]); 01069 local_block_ptr->fraction_ = (temp&0xff000000) >> 24; 01070 local_block_ptr->lost_ = temp & 0x00ffffff; 01071 i+=4; 01072 local_block_ptr->last_seq_ = ACE_NTOHL(*(ACE_UINT32*)&buffer[i]); 01073 i+=4; 01074 local_block_ptr->jitter_ = ACE_NTOHL(*(ACE_UINT32*)&buffer[i]); 01075 i+=4; 01076 local_block_ptr->lsr_ = ACE_NTOHL(*(ACE_UINT32*)&buffer[i]); 01077 i+=4; 01078 local_block_ptr->dlsr_ = ACE_NTOHL(*(ACE_UINT32*)&buffer[i]); 01079 i+=4; 01080 } 01081 01082 *len-=(this->chd_.length_+1)*4; 01083 01084 this->packet_data_ = 0; 01085 }
RTCP_SR_Packet::RTCP_SR_Packet | ( | ACE_UINT32 | ssrcVal, | |
ACE_UINT32 | ntpMSByte, | |||
ACE_UINT32 | ntpLSByte, | |||
ACE_UINT32 | timestamp, | |||
ACE_UINT32 | pktsSent, | |||
ACE_UINT32 | octetsSent, | |||
RR_Block * | rrBlocks | |||
) |
Constructor for outgoing SR packets.
Definition at line 983 of file RTCP_Packet.cpp.
References RTCP_Packet::chd_, RTCP_Common_Header::count_, RTCP_Common_Header::length_, RR_Block::next_, ntp_ts_lsw_, ntp_ts_msw_, osent_, RTCP_Packet::packet_data_, psent_, RTCP_Common_Header::pt_, rr_, RTCP_PT_SR, rtp_ts_, ssrc_, and RTCP_Common_Header::ver_.
00990 { 00991 RR_Block *block_ptr= 0; 00992 chd_.count_ = 0; 00993 chd_.ver_ = 2; 00994 chd_.pt_ = RTCP_PT_SR; 00995 00996 this->ssrc_ = ssrc; 00997 this->ntp_ts_msw_ = ntp_ts_msw; 00998 this->ntp_ts_lsw_ = ntp_ts_lsw; 00999 this->rtp_ts_ = timestamp; 01000 this->psent_ = packets_sent; 01001 this->osent_ = octets_sent; 01002 this->rr_ = blocks; 01003 01004 block_ptr = blocks; 01005 01006 while (block_ptr) 01007 { 01008 chd_.count_++; 01009 01010 // Can only have 31 receiver reports 01011 if (this->chd_.count_ == 31) 01012 { 01013 block_ptr->next_ = 0; 01014 break; 01015 } 01016 01017 block_ptr = block_ptr->next_; 01018 } 01019 01020 this->chd_.length_ = static_cast<ACE_UINT16> (6 + 6*(chd_.count_)); //+profile specific extensions ?? 01021 01022 this->packet_data_ = 0; 01023 }
RTCP_SR_Packet::~RTCP_SR_Packet | ( | void | ) | [virtual] |
Destructor.
Definition at line 1089 of file RTCP_Packet.cpp.
References RR_Block::next_, RTCP_Packet::packet_data_, and rr_.
01090 { 01091 RR_Block *prev; 01092 01093 if (this->rr_) 01094 { 01095 while (this->rr_) 01096 { 01097 prev = this->rr_; 01098 this->rr_ = this->rr_->next_; 01099 delete prev; 01100 } 01101 } 01102 01103 if (this->packet_data_) 01104 delete []this->packet_data_; 01105 }
void RTCP_SR_Packet::build_packet | ( | void | ) | [private, virtual] |
Used to create the byte representation of the RTCP packet.
Implements RTCP_Packet.
Definition at line 1119 of file RTCP_Packet.cpp.
References ACE_HTONL, ACE_HTONS, ACE_NEW, RTCP_Packet::chd_, RTCP_Common_Header::count_, RR_Block::dlsr_, RR_Block::fraction_, RR_Block::jitter_, RR_Block::last_seq_, RR_Block::lost_, RR_Block::lsr_, RR_Block::next_, RTCP_Packet::packet_data_, RTCP_Common_Header::pt_, rr_, RR_Block::ssrc_, and RTCP_Common_Header::ver_.
01120 { 01121 int index = 0; 01122 RR_Block *local_block_ptr; 01123 01124 if (this->packet_data_) 01125 delete []this->packet_data_; 01126 01127 ACE_NEW (this->packet_data_, 01128 char[this->packet_size()]); 01129 01130 this->packet_data_[index] = static_cast<char> ((this->chd_.ver_ << 6) | 01131 (this->chd_.pad_ << 5) | 01132 this->chd_.count_); 01133 index++; 01134 this->packet_data_[index] = this->chd_.pt_; 01135 index++; 01136 *((ACE_UINT16*)&this->packet_data_[index]) = ACE_HTONS(this->chd_.length_); 01137 index+=2; 01138 *((ACE_UINT32*)&this->packet_data_[index]) = ACE_HTONL(this->ssrc_); 01139 index+=4; 01140 *((ACE_UINT32*)&this->packet_data_[index]) = ACE_HTONL(this->ntp_ts_msw_); 01141 index+=4; 01142 *((ACE_UINT32*)&this->packet_data_[index]) = ACE_HTONL(this->ntp_ts_lsw_); 01143 index+=4; 01144 *((ACE_UINT32*)&this->packet_data_[index]) = ACE_HTONL(this->rtp_ts_); 01145 index+=4; 01146 *((ACE_UINT32*)&this->packet_data_[index]) = ACE_HTONL(this->psent_); 01147 index+=4; 01148 *((ACE_UINT32*)&this->packet_data_[index]) = ACE_HTONL(this->osent_); 01149 index+=4; 01150 01151 local_block_ptr = this->rr_; 01152 while (local_block_ptr) 01153 { 01154 *((ACE_UINT32*)&this->packet_data_[index]) = ACE_HTONL(local_block_ptr->ssrc_); 01155 index+=4; 01156 ACE_UINT32 temp = ACE_HTONL((local_block_ptr->fraction_&0xff) << 24) & 01157 local_block_ptr->lost_; 01158 *((ACE_UINT32*)&this->packet_data_[index]) = temp; 01159 index+=4; 01160 *((ACE_UINT32*)&this->packet_data_[index]) = ACE_HTONL(local_block_ptr->last_seq_); 01161 index+=4; 01162 *((ACE_UINT32*)&this->packet_data_[index]) = ACE_HTONL(local_block_ptr->jitter_); 01163 index+=4; 01164 *((ACE_UINT32*)&this->packet_data_[index]) = ACE_HTONL(local_block_ptr->lsr_); 01165 index+=4; 01166 *((ACE_UINT32*)&this->packet_data_[index]) = ACE_HTONL(local_block_ptr->dlsr_); 01167 index+=4; 01168 local_block_ptr = local_block_ptr->next_; 01169 } 01170 }
void RTCP_SR_Packet::dump | ( | void | ) |
Prints the contents of the packet.
Definition at line 1173 of file RTCP_Packet.cpp.
References ACE_DEBUG, RR_Block::dlsr_, RR_Block::fraction_, RR_Block::jitter_, RR_Block::last_seq_, LM_DEBUG, RR_Block::lost_, RR_Block::lsr_, RR_Block::next_, rr_, and RR_Block::ssrc_.
Referenced by TAO_AV_RTCP_Callback::receive_control_frame().
01174 { 01175 RR_Block *b = this->rr_; 01176 int count = 1; 01177 01178 ACE_DEBUG ((LM_DEBUG, 01179 "\nRTCP_SR_Packet:: from %u - %d rr blocks follow.\n", 01180 this->ssrc_, 01181 this->chd_.count_)); 01182 ACE_DEBUG ((LM_DEBUG, 01183 " NTP(sec) %u.%u; RTP ts %u\n", 01184 this->ntp_ts_msw_, 01185 this->ntp_ts_lsw_, 01186 this->rtp_ts_)); 01187 ACE_DEBUG ((LM_DEBUG, 01188 " packets sent %u; octets sent %u\n", 01189 this->psent_, 01190 this->osent_)); 01191 01192 while (b) 01193 { 01194 ACE_DEBUG ((LM_DEBUG, 01195 " Block %d: ssrc %u; frac %u; lost %u; last seq %u\n", 01196 count, 01197 b->ssrc_, 01198 b->fraction_, 01199 b->lost_, 01200 b->last_seq_)); 01201 ACE_DEBUG ((LM_DEBUG, 01202 " jitter %u; lsr %u; dlsr %u;\n", 01203 b->jitter_, 01204 b->lsr_, 01205 b->dlsr_)); 01206 01207 b = b->next_; 01208 ++count; 01209 } 01210 }
ACE_UINT32 RTCP_SR_Packet::ntp_ts_lsw | ( | void | ) | [inline] |
Returns the least significant word of the NTP timestamp.
Definition at line 371 of file RTCP_Packet.h.
References ntp_ts_lsw_.
Referenced by RTCP_Channel_In::updateStatistics().
00371 { return this->ntp_ts_lsw_; }
ACE_UINT32 RTCP_SR_Packet::ntp_ts_msw | ( | void | ) | [inline] |
Returns the most significant word of the NTP timestamp.
Definition at line 368 of file RTCP_Packet.h.
References ntp_ts_msw_.
Referenced by RTCP_Channel_In::updateStatistics().
00368 { return this->ntp_ts_msw_; }
unsigned int RTCP_SR_Packet::packet_size | ( | void | ) | [virtual] |
Returns the size of the packet in bytes.
Implements RTCP_Packet.
Definition at line 1109 of file RTCP_Packet.cpp.
References RTCP_Packet::chd_, and RTCP_Common_Header::count_.
01110 { 01111 ACE_UINT16 size = static_cast<ACE_UINT16> ((2+chd_.count_*6) * 4); // + profile specific extensions ? 01112 size += 20; // the first line is the same as RR; 20 more bytes for SR 01113 01114 return size; 01115 }
ACE_UINT32 RTCP_SR_Packet::ssrc | ( | void | ) | [inline] |
Returns the synchronization source id for the sender of this packet.
Definition at line 365 of file RTCP_Packet.h.
References ssrc_.
Referenced by TAO_AV_RTCP_Callback::receive_control_frame().
00365 { return this->ssrc_; }
ACE_UINT32 RTCP_SR_Packet::ntp_ts_lsw_ [private] |
The least significant word of the NTP timestamp.
Definition at line 387 of file RTCP_Packet.h.
Referenced by ntp_ts_lsw(), and RTCP_SR_Packet().
ACE_UINT32 RTCP_SR_Packet::ntp_ts_msw_ [private] |
The most significant word of the NTP timestamp.
Definition at line 384 of file RTCP_Packet.h.
Referenced by ntp_ts_msw(), and RTCP_SR_Packet().
ACE_UINT32 RTCP_SR_Packet::osent_ [private] |
The total number of octets sent.
Definition at line 396 of file RTCP_Packet.h.
Referenced by RTCP_SR_Packet().
ACE_UINT32 RTCP_SR_Packet::psent_ [private] |
The total number of packets sent.
Definition at line 393 of file RTCP_Packet.h.
Referenced by RTCP_SR_Packet().
RR_Block* RTCP_SR_Packet::rr_ [private] |
A linked list of receiver report blocks.
Definition at line 399 of file RTCP_Packet.h.
Referenced by build_packet(), dump(), RTCP_SR_Packet(), and ~RTCP_SR_Packet().
ACE_UINT32 RTCP_SR_Packet::rtp_ts_ [private] |
ACE_UINT32 RTCP_SR_Packet::ssrc_ [private] |
The synchronization source id of the sender generating this report.
Definition at line 381 of file RTCP_Packet.h.
Referenced by RTCP_SR_Packet(), and ssrc().