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 Attributes | List of all members
qrtplib::RTCPAPPPacket Class Reference

#include <rtcpapppacket.h>

+ Inheritance diagram for qrtplib::RTCPAPPPacket:
+ Collaboration diagram for qrtplib::RTCPAPPPacket:

Public Member Functions

 RTCPAPPPacket (uint8_t *data, std::size_t datalen)
 
 ~RTCPAPPPacket ()
 
uint8_t GetSubType () const
 
uint32_t GetSSRC () const
 
uint8_tGetName ()
 
uint8_tGetAPPData ()
 
std::size_t GetAPPDataLength () const
 
- Public Member Functions inherited from qrtplib::RTCPPacket
virtual ~RTCPPacket ()
 
bool IsKnownFormat () const
 
PacketType GetPacketType () const
 
uint8_tGetPacketData ()
 
std::size_t GetPacketLength () const
 

Private Attributes

RTPEndian m_endian
 
std::size_t appdatalen
 

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 APP packet.

Definition at line 54 of file rtcpapppacket.h.

Constructor & Destructor Documentation

◆ RTCPAPPPacket()

qrtplib::RTCPAPPPacket::RTCPAPPPacket ( uint8_t data,
std::size_t  datalen 
)

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 rtcpapppacket.cpp.

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

38  :
39  RTCPPacket(APP, data, datalength)
40 {
41  knownformat = false;
42 
43  RTCPCommonHeader *hdr;
44  std::size_t len = datalength;
45 
46  hdr = (RTCPCommonHeader *) data;
47  if (hdr->padding)
48  {
49  uint8_t padcount = data[datalength - 1];
50  if ((padcount & 0x03) != 0) // not a multiple of four! (see rfc 3550 p 37)
51  return;
52  if (((std::size_t) padcount) >= len)
53  return;
54  len -= (std::size_t) padcount;
55  }
56 
57  if (len < (sizeof(RTCPCommonHeader) + sizeof(uint32_t) * 2))
58  return;
59  len -= (sizeof(RTCPCommonHeader) + sizeof(uint32_t) * 2);
60  appdatalen = len;
61  knownformat = true;
62 }
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

◆ ~RTCPAPPPacket()

qrtplib::RTCPAPPPacket::~RTCPAPPPacket ( )
inline

Definition at line 63 of file rtcpapppacket.h.

64  {
65  }

Member Function Documentation

◆ GetAPPData()

uint8_t * qrtplib::RTCPAPPPacket::GetAPPData ( )
inline

Returns a pointer to the actual data.

Definition at line 113 of file rtcpapppacket.h.

114 {
115  if (!knownformat)
116  return 0;
117  if (appdatalen == 0)
118  return 0;
119  return (data + sizeof(RTCPCommonHeader) + sizeof(uint32_t) * 2);
120 }
unsigned int uint32_t
Definition: rtptypes_win.h:46

◆ GetAPPDataLength()

std::size_t qrtplib::RTCPAPPPacket::GetAPPDataLength ( ) const
inline

Returns the length of the actual data.

Definition at line 122 of file rtcpapppacket.h.

123 {
124  if (!knownformat)
125  return 0;
126  return appdatalen;
127 }

◆ GetName()

uint8_t * qrtplib::RTCPAPPPacket::GetName ( )
inline

Returns the name contained in the APP packet. Returns the name contained in the APP packet. This alway consists of four bytes and is not NULL-terminated.

Definition at line 105 of file rtcpapppacket.h.

106 {
107  if (!knownformat)
108  return 0;
109 
110  return (data + sizeof(RTCPCommonHeader) + sizeof(uint32_t));
111 }
unsigned int uint32_t
Definition: rtptypes_win.h:46

◆ GetSSRC()

uint32_t qrtplib::RTCPAPPPacket::GetSSRC ( ) const
inline

Returns the SSRC of the source which sent this packet.

Definition at line 96 of file rtcpapppacket.h.

97 {
98  if (!knownformat)
99  return 0;
100 
101  uint32_t *ssrc = (uint32_t *) (data + sizeof(RTCPCommonHeader));
102  return m_endian.qToHost(*ssrc);
103 }
T qToHost(const T &x) const
Definition: rtpendian.h:27
unsigned int uint32_t
Definition: rtptypes_win.h:46

◆ GetSubType()

uint8_t qrtplib::RTCPAPPPacket::GetSubType ( ) const
inline

Returns the subtype contained in the APP packet.

Definition at line 88 of file rtcpapppacket.h.

References qrtplib::RTCPCommonHeader::count.

89 {
90  if (!knownformat)
91  return 0;
92  RTCPCommonHeader *hdr = (RTCPCommonHeader *) data;
93  return hdr->count;
94 }

Member Data Documentation

◆ appdatalen

std::size_t qrtplib::RTCPAPPPacket::appdatalen
private

Definition at line 85 of file rtcpapppacket.h.

Referenced by RTCPAPPPacket().

◆ m_endian

RTPEndian qrtplib::RTCPAPPPacket::m_endian
private

Definition at line 84 of file rtcpapppacket.h.


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