SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Public Member Functions | Private Member Functions | Private Attributes | List of all members
qrtplib::RTCPSRPacket Class Reference

#include <rtcpsrpacket.h>

+ Inheritance diagram for qrtplib::RTCPSRPacket:
+ Collaboration diagram for qrtplib::RTCPSRPacket:

Public Member Functions

 RTCPSRPacket (uint8_t *data, std::size_t datalength)
 
 ~RTCPSRPacket ()
 
uint32_t GetSenderSSRC () const
 
RTPNTPTime GetNTPTimestamp () const
 
uint32_t GetRTPTimestamp () const
 
uint32_t GetSenderPacketCount () const
 
uint32_t GetSenderOctetCount () const
 
int GetReceptionReportCount () const
 
uint32_t GetSSRC (int index) const
 
uint8_t GetFractionLost (int index) const
 
int32_t GetLostPacketCount (int index) const
 
uint32_t GetExtendedHighestSequenceNumber (int index) const
 
uint32_t GetJitter (int index) const
 
uint32_t GetLSR (int index) const
 
uint32_t GetDLSR (int index) const
 
- Public Member Functions inherited from qrtplib::RTCPPacket
virtual ~RTCPPacket ()
 
bool IsKnownFormat () const
 
PacketType GetPacketType () const
 
uint8_tGetPacketData ()
 
std::size_t GetPacketLength () const
 

Private Member Functions

RTCPReceiverReportGotoReport (int index) const
 

Private Attributes

RTPEndian m_endian
 

Additional Inherited Members

- Public Types inherited from qrtplib::RTCPPacket
enum  PacketType {
  SR, RR, SDES, BYE,
  APP, Unknown
}
 
- Protected Member Functions inherited from qrtplib::RTCPPacket
 RTCPPacket (PacketType t, uint8_t *d, std::size_t dlen)
 
- Protected Attributes inherited from qrtplib::RTCPPacket
uint8_tdata
 
std::size_t datalen
 
bool knownformat
 

Detailed Description

Describes an RTCP sender report packet.

Definition at line 55 of file rtcpsrpacket.h.

Constructor & Destructor Documentation

◆ RTCPSRPacket()

qrtplib::RTCPSRPacket::RTCPSRPacket ( uint8_t data,
std::size_t  datalength 
)

Creates an instance based on the data in data with length datalen. Creates an instance based on the data in data with length datalen. Since the data pointer is referenced inside the class (no copy of the data is made) one must make sure that the memory it points to is valid as long as the class instance exists.

Definition at line 38 of file rtcpsrpacket.cpp.

References qrtplib::RTCPCommonHeader::count, qrtplib::RTCPPacket::knownformat, and qrtplib::RTCPCommonHeader::padding.

38  :
39  RTCPPacket(SR, data, datalength)
40 {
41  knownformat = false;
42 
43  RTCPCommonHeader *hdr;
44  std::size_t len = datalength;
45  std::size_t expectedlength;
46 
47  hdr = (RTCPCommonHeader *) data;
48  if (hdr->padding)
49  {
50  uint8_t padcount = data[datalength - 1];
51  if ((padcount & 0x03) != 0) // not a multiple of four! (see rfc 3550 p 37)
52  return;
53  if (((std::size_t) padcount) >= len)
54  return;
55  len -= (std::size_t) padcount;
56  }
57 
58  expectedlength = sizeof(RTCPCommonHeader) + sizeof(uint32_t) + sizeof(RTCPSenderReport);
59  expectedlength += sizeof(RTCPReceiverReport) * ((int) hdr->count);
60 
61  if (expectedlength != len)
62  return;
63 
64  knownformat = true;
65 }
unsigned int uint32_t
Definition: rtptypes_win.h:46
unsigned char uint8_t
Definition: rtptypes_win.h:42
RTCPPacket(PacketType t, uint8_t *d, std::size_t dlen)
Definition: rtcppacket.h:65

◆ ~RTCPSRPacket()

qrtplib::RTCPSRPacket::~RTCPSRPacket ( )
inline

Definition at line 64 of file rtcpsrpacket.h.

65  {
66  }

Member Function Documentation

◆ GetDLSR()

uint32_t qrtplib::RTCPSRPacket::GetDLSR ( int  index) const
inline

Returns the DLSR field of the reception report block described by index which may have a value from 0 to GetReceptionReportCount()-1 (note that no check is performed to see if index is valid).

Definition at line 242 of file rtcpsrpacket.h.

References qrtplib::RTCPReceiverReport::dlsr.

Referenced by qrtplib::RTPSources::ProcessRTCPCompoundPacket().

243 {
244  if (!knownformat)
245  return 0;
246  RTCPReceiverReport *r = GotoReport(index);
247  return m_endian.qToHost(r->dlsr);
248 }
T qToHost(const T &x) const
Definition: rtpendian.h:27
RTCPReceiverReport * GotoReport(int index) const
Definition: rtcpsrpacket.h:184
+ Here is the caller graph for this function:

◆ GetExtendedHighestSequenceNumber()

uint32_t qrtplib::RTCPSRPacket::GetExtendedHighestSequenceNumber ( int  index) const
inline

Returns the extended highest sequence number of the reception report block described by index which may have a value from 0 to GetReceptionReportCount()-1 (note that no check is performed to see if index is valid).

Definition at line 218 of file rtcpsrpacket.h.

References qrtplib::RTCPReceiverReport::exthighseqnr.

Referenced by qrtplib::RTPSources::ProcessRTCPCompoundPacket().

219 {
220  if (!knownformat)
221  return 0;
222  RTCPReceiverReport *r = GotoReport(index);
223  return m_endian.qToHost(r->exthighseqnr);
224 }
T qToHost(const T &x) const
Definition: rtpendian.h:27
RTCPReceiverReport * GotoReport(int index) const
Definition: rtcpsrpacket.h:184
+ Here is the caller graph for this function:

◆ GetFractionLost()

uint8_t qrtplib::RTCPSRPacket::GetFractionLost ( int  index) const
inline

Returns the `fraction lost' field of the reception report described by index which may have a value from 0 to GetReceptionReportCount()-1 (note that no check is performed to see if index is valid).

Definition at line 198 of file rtcpsrpacket.h.

References qrtplib::RTCPReceiverReport::fractionlost.

Referenced by qrtplib::RTPSources::ProcessRTCPCompoundPacket().

199 {
200  if (!knownformat)
201  return 0;
202  RTCPReceiverReport *r = GotoReport(index);
203  return r->fractionlost;
204 }
RTCPReceiverReport * GotoReport(int index) const
Definition: rtcpsrpacket.h:184
+ Here is the caller graph for this function:

◆ GetJitter()

uint32_t qrtplib::RTCPSRPacket::GetJitter ( int  index) const
inline

Returns the jitter field of the reception report block described by index which may have a value from 0 to GetReceptionReportCount()-1 (note that no check is performed to see if index is valid).

Definition at line 226 of file rtcpsrpacket.h.

References qrtplib::RTCPReceiverReport::jitter.

Referenced by qrtplib::RTPSources::ProcessRTCPCompoundPacket().

227 {
228  if (!knownformat)
229  return 0;
230  RTCPReceiverReport *r = GotoReport(index);
231  return m_endian.qToHost(r->jitter);
232 }
T qToHost(const T &x) const
Definition: rtpendian.h:27
RTCPReceiverReport * GotoReport(int index) const
Definition: rtcpsrpacket.h:184
+ Here is the caller graph for this function:

◆ GetLostPacketCount()

int32_t qrtplib::RTCPSRPacket::GetLostPacketCount ( int  index) const
inline

Returns the number of lost packets in the reception report block described by index which may have a value from 0 to GetReceptionReportCount()-1 (note that no check is performed to see if index is valid).

Definition at line 206 of file rtcpsrpacket.h.

References qrtplib::RTCPReceiverReport::packetslost.

Referenced by qrtplib::RTPSources::ProcessRTCPCompoundPacket().

207 {
208  if (!knownformat)
209  return 0;
210  RTCPReceiverReport *r = GotoReport(index);
211  uint32_t count = ((uint32_t) r->packetslost[2]) | (((uint32_t) r->packetslost[1]) << 8) | (((uint32_t) r->packetslost[0]) << 16);
212  if ((count & 0x00800000) != 0) // test for negative number
213  count |= 0xFF000000;
214  int32_t *count2 = (int32_t *) (&count);
215  return (*count2);
216 }
unsigned int uint32_t
Definition: rtptypes_win.h:46
int int32_t
Definition: rtptypes_win.h:45
RTCPReceiverReport * GotoReport(int index) const
Definition: rtcpsrpacket.h:184
+ Here is the caller graph for this function:

◆ GetLSR()

uint32_t qrtplib::RTCPSRPacket::GetLSR ( int  index) const
inline

Returns the LSR field of the reception report block described by index which may have a value from 0 to GetReceptionReportCount()-1 (note that no check is performed to see if index is valid).

Definition at line 234 of file rtcpsrpacket.h.

References qrtplib::RTCPReceiverReport::lsr.

Referenced by qrtplib::RTPSources::ProcessRTCPCompoundPacket().

235 {
236  if (!knownformat)
237  return 0;
238  RTCPReceiverReport *r = GotoReport(index);
239  return m_endian.qToHost(r->lsr);
240 }
T qToHost(const T &x) const
Definition: rtpendian.h:27
RTCPReceiverReport * GotoReport(int index) const
Definition: rtcpsrpacket.h:184
+ Here is the caller graph for this function:

◆ GetNTPTimestamp()

RTPNTPTime qrtplib::RTCPSRPacket::GetNTPTimestamp ( ) const
inline

Returns the NTP timestamp contained in the sender report.

Definition at line 143 of file rtcpsrpacket.h.

References qrtplib::RTCPSenderReport::ntptime_lsw, and qrtplib::RTCPSenderReport::ntptime_msw.

Referenced by qrtplib::RTPSources::ProcessRTCPCompoundPacket().

144 {
145  if (!knownformat)
146  return RTPNTPTime(0, 0);
147 
148  RTCPSenderReport *sr = (RTCPSenderReport *) (data + sizeof(RTCPCommonHeader) + sizeof(uint32_t));
149  return RTPNTPTime(m_endian.qToHost(sr->ntptime_msw), m_endian.qToHost(sr->ntptime_lsw));
150 }
T qToHost(const T &x) const
Definition: rtpendian.h:27
unsigned int uint32_t
Definition: rtptypes_win.h:46
+ Here is the caller graph for this function:

◆ GetReceptionReportCount()

int qrtplib::RTCPSRPacket::GetReceptionReportCount ( ) const
inline

Returns the number of reception report blocks present in this packet.

Definition at line 176 of file rtcpsrpacket.h.

References qrtplib::RTCPCommonHeader::count.

Referenced by qrtplib::RTPSources::ProcessRTCPCompoundPacket().

177 {
178  if (!knownformat)
179  return 0;
180  RTCPCommonHeader *hdr = (RTCPCommonHeader *) data;
181  return ((int) hdr->count);
182 }
+ Here is the caller graph for this function:

◆ GetRTPTimestamp()

uint32_t qrtplib::RTCPSRPacket::GetRTPTimestamp ( ) const
inline

Returns the RTP timestamp contained in the sender report.

Definition at line 152 of file rtcpsrpacket.h.

References qrtplib::RTCPSenderReport::rtptimestamp.

Referenced by qrtplib::RTPSources::ProcessRTCPCompoundPacket().

153 {
154  if (!knownformat)
155  return 0;
156  RTCPSenderReport *sr = (RTCPSenderReport *) (data + sizeof(RTCPCommonHeader) + sizeof(uint32_t));
157  return m_endian.qToHost(sr->rtptimestamp);
158 }
T qToHost(const T &x) const
Definition: rtpendian.h:27
unsigned int uint32_t
Definition: rtptypes_win.h:46
+ Here is the caller graph for this function:

◆ GetSenderOctetCount()

uint32_t qrtplib::RTCPSRPacket::GetSenderOctetCount ( ) const
inline

Returns the sender's octet count contained in the sender report.

Definition at line 168 of file rtcpsrpacket.h.

References qrtplib::RTCPSenderReport::octetcount.

Referenced by qrtplib::RTPSources::ProcessRTCPCompoundPacket().

169 {
170  if (!knownformat)
171  return 0;
172  RTCPSenderReport *sr = (RTCPSenderReport *) (data + sizeof(RTCPCommonHeader) + sizeof(uint32_t));
173  return m_endian.qToHost(sr->octetcount);
174 }
T qToHost(const T &x) const
Definition: rtpendian.h:27
unsigned int uint32_t
Definition: rtptypes_win.h:46
+ Here is the caller graph for this function:

◆ GetSenderPacketCount()

uint32_t qrtplib::RTCPSRPacket::GetSenderPacketCount ( ) const
inline

Returns the sender's packet count contained in the sender report.

Definition at line 160 of file rtcpsrpacket.h.

References qrtplib::RTCPSenderReport::packetcount.

Referenced by qrtplib::RTPSources::ProcessRTCPCompoundPacket().

161 {
162  if (!knownformat)
163  return 0;
164  RTCPSenderReport *sr = (RTCPSenderReport *) (data + sizeof(RTCPCommonHeader) + sizeof(uint32_t));
165  return m_endian.qToHost(sr->packetcount);
166 }
T qToHost(const T &x) const
Definition: rtpendian.h:27
unsigned int uint32_t
Definition: rtptypes_win.h:46
+ Here is the caller graph for this function:

◆ GetSenderSSRC()

uint32_t qrtplib::RTCPSRPacket::GetSenderSSRC ( ) const
inline

Returns the SSRC of the participant who sent this packet.

Definition at line 134 of file rtcpsrpacket.h.

Referenced by qrtplib::RTPSources::ProcessRTCPCompoundPacket().

135 {
136  if (!knownformat)
137  return 0;
138 
139  uint32_t *ssrcptr = (uint32_t *) (data + sizeof(RTCPCommonHeader));
140  return m_endian.qToHost(*ssrcptr);
141 }
T qToHost(const T &x) const
Definition: rtpendian.h:27
unsigned int uint32_t
Definition: rtptypes_win.h:46
+ Here is the caller graph for this function:

◆ GetSSRC()

uint32_t qrtplib::RTCPSRPacket::GetSSRC ( int  index) const
inline

Returns the SSRC of the reception report block described by index which may have a value from 0 to GetReceptionReportCount()-1 (note that no check is performed to see if index is valid).

Definition at line 190 of file rtcpsrpacket.h.

References qrtplib::RTCPReceiverReport::ssrc.

Referenced by qrtplib::RTPSources::ProcessRTCPCompoundPacket().

191 {
192  if (!knownformat)
193  return 0;
194  RTCPReceiverReport *r = GotoReport(index);
195  return m_endian.qToHost(r->ssrc);
196 }
T qToHost(const T &x) const
Definition: rtpendian.h:27
RTCPReceiverReport * GotoReport(int index) const
Definition: rtcpsrpacket.h:184
+ Here is the caller graph for this function:

◆ GotoReport()

RTCPReceiverReport * qrtplib::RTCPSRPacket::GotoReport ( int  index) const
inlineprivate

Definition at line 184 of file rtcpsrpacket.h.

185 {
186  RTCPReceiverReport *r = (RTCPReceiverReport *) (data + sizeof(RTCPCommonHeader) + sizeof(uint32_t) + sizeof(RTCPSenderReport) + index * sizeof(RTCPReceiverReport));
187  return r;
188 }
unsigned int uint32_t
Definition: rtptypes_win.h:46

Member Data Documentation

◆ m_endian

RTPEndian qrtplib::RTCPSRPacket::m_endian
private

Definition at line 131 of file rtcpsrpacket.h.


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