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.
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
qrtplib::RTCPSDESInfo Class Reference

#include <rtcpsdesinfo.h>

+ Inheritance diagram for qrtplib::RTCPSDESInfo:
+ Collaboration diagram for qrtplib::RTCPSDESInfo:

Classes

class  SDESItem
 
class  SDESPrivateItem
 

Public Member Functions

 RTCPSDESInfo ()
 
virtual ~RTCPSDESInfo ()
 
void Clear ()
 
int SetCNAME (const uint8_t *s, std::size_t l)
 
int SetName (const uint8_t *s, std::size_t l)
 
int SetEMail (const uint8_t *s, std::size_t l)
 
int SetPhone (const uint8_t *s, std::size_t l)
 
int SetLocation (const uint8_t *s, std::size_t l)
 
int SetTool (const uint8_t *s, std::size_t l)
 
int SetNote (const uint8_t *s, std::size_t l)
 
int SetPrivateValue (const uint8_t *prefix, std::size_t prefixlen, const uint8_t *value, std::size_t valuelen)
 
int DeletePrivatePrefix (const uint8_t *s, std::size_t len)
 
uint8_tGetCNAME (std::size_t *len) const
 
uint8_tGetName (std::size_t *len) const
 
uint8_tGetEMail (std::size_t *len) const
 
uint8_tGetPhone (std::size_t *len) const
 
uint8_tGetLocation (std::size_t *len) const
 
uint8_tGetTool (std::size_t *len) const
 
uint8_tGetNote (std::size_t *len) const
 
void GotoFirstPrivateValue ()
 
bool GetNextPrivateValue (uint8_t **prefix, std::size_t *prefixlen, uint8_t **value, std::size_t *valuelen)
 
bool GetPrivateValue (const uint8_t *prefix, std::size_t prefixlen, uint8_t **value, std::size_t *valuelen) const
 

Private Member Functions

int SetNonPrivateItem (int itemno, const uint8_t *s, std::size_t l)
 
uint8_tGetNonPrivateItem (int itemno, std::size_t *len) const
 

Private Attributes

SDESItem nonprivateitems [RTCP_SDES_NUMITEMS_NONPRIVATE]
 
std::list< SDESPrivateItem * > privitems
 
std::list< SDESPrivateItem * >::const_iterator curitem
 

Detailed Description

The class RTCPSDESInfo is a container for RTCP SDES information.

Definition at line 54 of file rtcpsdesinfo.h.

Constructor & Destructor Documentation

◆ RTCPSDESInfo()

qrtplib::RTCPSDESInfo::RTCPSDESInfo ( )
inline

Constructs an instance, optionally installing a memory manager.

Definition at line 58 of file rtcpsdesinfo.h.

59  {
60  }

◆ ~RTCPSDESInfo()

virtual qrtplib::RTCPSDESInfo::~RTCPSDESInfo ( )
inlinevirtual

Definition at line 61 of file rtcpsdesinfo.h.

62  {
63  Clear();
64  }

Member Function Documentation

◆ Clear()

void qrtplib::RTCPSDESInfo::Clear ( )

Clears all SDES information.

Definition at line 38 of file rtcpsdesinfo.cpp.

References privitems.

Referenced by qrtplib::RTCPPacketBuilder::Destroy().

39 {
40 #ifdef RTP_SUPPORT_SDESPRIV
41  std::list<SDESPrivateItem *>::const_iterator it;
42 
43  for (it = privitems.begin(); it != privitems.end(); ++it)
44  delete *it;
45  privitems.clear();
46 #endif // RTP_SUPPORT_SDESPRIV
47 }
std::list< SDESPrivateItem * > privitems
Definition: rtcpsdesinfo.h:276
+ Here is the caller graph for this function:

◆ DeletePrivatePrefix()

int qrtplib::RTCPSDESInfo::DeletePrivatePrefix ( const uint8_t s,
std::size_t  len 
)

Deletes the entry for the prefix specified by s with length len.

Definition at line 99 of file rtcpsdesinfo.cpp.

References ERR_RTP_SDES_PREFIXNOTFOUND, and privitems.

100 {
101  std::list<SDESPrivateItem *>::iterator it;
102  bool found;
103 
104  found = false;
105  it = privitems.begin();
106  while (!found && it != privitems.end())
107  {
108  uint8_t *p;
109  std::size_t l;
110 
111  p = (*it)->GetPrefix(&l);
112  if (l == prefixlen)
113  {
114  if (l <= 0)
115  found = true;
116  else if (memcmp(prefix, p, l) == 0)
117  found = true;
118  else
119  ++it;
120  }
121  else
122  ++it;
123  }
124  if (!found)
126 
127  delete *it;
128  privitems.erase(it);
129  return 0;
130 }
unsigned char uint8_t
Definition: rtptypes_win.h:42
std::list< SDESPrivateItem * > privitems
Definition: rtcpsdesinfo.h:276
#define ERR_RTP_SDES_PREFIXNOTFOUND
Definition: rtperrors.h:109

◆ GetCNAME()

uint8_t* qrtplib::RTCPSDESInfo::GetCNAME ( std::size_t *  len) const
inline

Returns the SDES CNAME item and stores its length in len.

Definition at line 123 of file rtcpsdesinfo.h.

References RTCP_SDES_ID_CNAME.

Referenced by qrtplib::RTCPPacketBuilder::BuildBYEPacket(), qrtplib::RTCPPacketBuilder::BuildNextPacket(), and qrtplib::RTPInternalSourceData::ProcessSDESItem().

124  {
125  return GetNonPrivateItem(RTCP_SDES_ID_CNAME - 1, len);
126  }
uint8_t * GetNonPrivateItem(int itemno, std::size_t *len) const
Definition: rtcpsdesinfo.h:192
#define RTCP_SDES_ID_CNAME
Definition: rtpdefines.h:56
+ Here is the caller graph for this function:

◆ GetEMail()

uint8_t* qrtplib::RTCPSDESInfo::GetEMail ( std::size_t *  len) const
inline

Returns the SDES e-mail item and stores its length in len.

Definition at line 135 of file rtcpsdesinfo.h.

References RTCP_SDES_ID_EMAIL.

Referenced by qrtplib::RTCPPacketBuilder::FillInSDES(), and qrtplib::RTPInternalSourceData::ProcessSDESItem().

136  {
137  return GetNonPrivateItem(RTCP_SDES_ID_EMAIL - 1, len);
138  }
#define RTCP_SDES_ID_EMAIL
Definition: rtpdefines.h:58
uint8_t * GetNonPrivateItem(int itemno, std::size_t *len) const
Definition: rtcpsdesinfo.h:192
+ Here is the caller graph for this function:

◆ GetLocation()

uint8_t* qrtplib::RTCPSDESInfo::GetLocation ( std::size_t *  len) const
inline

Returns the SDES location item and stores its length in len.

Definition at line 147 of file rtcpsdesinfo.h.

References RTCP_SDES_ID_LOCATION.

Referenced by qrtplib::RTCPPacketBuilder::FillInSDES().

148  {
149  return GetNonPrivateItem(RTCP_SDES_ID_LOCATION - 1, len);
150  }
#define RTCP_SDES_ID_LOCATION
Definition: rtpdefines.h:60
uint8_t * GetNonPrivateItem(int itemno, std::size_t *len) const
Definition: rtcpsdesinfo.h:192
+ Here is the caller graph for this function:

◆ GetName()

uint8_t* qrtplib::RTCPSDESInfo::GetName ( std::size_t *  len) const
inline

Returns the SDES name item and stores its length in len.

Definition at line 129 of file rtcpsdesinfo.h.

References RTCP_SDES_ID_NAME.

Referenced by qrtplib::RTCPPacketBuilder::FillInSDES(), and qrtplib::RTPInternalSourceData::ProcessSDESItem().

130  {
131  return GetNonPrivateItem(RTCP_SDES_ID_NAME - 1, len);
132  }
uint8_t * GetNonPrivateItem(int itemno, std::size_t *len) const
Definition: rtcpsdesinfo.h:192
#define RTCP_SDES_ID_NAME
Definition: rtpdefines.h:57
+ Here is the caller graph for this function:

◆ GetNextPrivateValue()

bool qrtplib::RTCPSDESInfo::GetNextPrivateValue ( uint8_t **  prefix,
std::size_t *  prefixlen,
uint8_t **  value,
std::size_t *  valuelen 
)

Returns SDES priv item information. If available, returns true and stores the next SDES private item prefix in prefix and its length in prefixlen. The associated value and its length are then stored in value and valuelen. Otherwise, it returns false.

Definition at line 137 of file rtcpsdesinfo.cpp.

References curitem, and privitems.

138 {
139  if (curitem == privitems.end())
140  return false;
141  *prefix = (*curitem)->GetPrefix(prefixlen);
142  *value = (*curitem)->GetInfo(valuelen);
143  ++curitem;
144  return true;
145 }
std::list< SDESPrivateItem * >::const_iterator curitem
Definition: rtcpsdesinfo.h:277
std::list< SDESPrivateItem * > privitems
Definition: rtcpsdesinfo.h:276

◆ GetNonPrivateItem()

uint8_t* qrtplib::RTCPSDESInfo::GetNonPrivateItem ( int  itemno,
std::size_t *  len 
) const
inlineprivate

Definition at line 192 of file rtcpsdesinfo.h.

193  {
194  return nonprivateitems[itemno].GetInfo(len);
195  }
SDESItem nonprivateitems[RTCP_SDES_NUMITEMS_NONPRIVATE]
Definition: rtcpsdesinfo.h:246
uint8_t * GetInfo(std::size_t *len) const
Definition: rtcpsdesinfo.h:210

◆ GetNote()

uint8_t* qrtplib::RTCPSDESInfo::GetNote ( std::size_t *  len) const
inline

Returns the SDES note item and stores its length in len.

Definition at line 159 of file rtcpsdesinfo.h.

References RTCP_SDES_ID_NOTE.

Referenced by qrtplib::RTCPPacketBuilder::FillInSDES().

160  {
161  return GetNonPrivateItem(RTCP_SDES_ID_NOTE - 1, len);
162  }
uint8_t * GetNonPrivateItem(int itemno, std::size_t *len) const
Definition: rtcpsdesinfo.h:192
#define RTCP_SDES_ID_NOTE
Definition: rtpdefines.h:62
+ Here is the caller graph for this function:

◆ GetPhone()

uint8_t* qrtplib::RTCPSDESInfo::GetPhone ( std::size_t *  len) const
inline

Returns the SDES phone item and stores its length in len.

Definition at line 141 of file rtcpsdesinfo.h.

References RTCP_SDES_ID_PHONE.

Referenced by qrtplib::RTCPPacketBuilder::FillInSDES().

142  {
143  return GetNonPrivateItem(RTCP_SDES_ID_PHONE - 1, len);
144  }
uint8_t * GetNonPrivateItem(int itemno, std::size_t *len) const
Definition: rtcpsdesinfo.h:192
#define RTCP_SDES_ID_PHONE
Definition: rtpdefines.h:59
+ Here is the caller graph for this function:

◆ GetPrivateValue()

bool qrtplib::RTCPSDESInfo::GetPrivateValue ( const uint8_t prefix,
std::size_t  prefixlen,
uint8_t **  value,
std::size_t *  valuelen 
) const

Returns SDES priv item information. Looks for the entry which corresponds to the SDES private item prefix prefix with length prefixlen. If found, the function returns true and stores the associated value and its length in value and valuelen respectively.

Definition at line 147 of file rtcpsdesinfo.cpp.

References privitems.

148 {
149  std::list<SDESPrivateItem *>::const_iterator it;
150  bool found;
151 
152  found = false;
153  it = privitems.begin();
154  while (!found && it != privitems.end())
155  {
156  uint8_t *p;
157  std::size_t l;
158 
159  p = (*it)->GetPrefix(&l);
160  if (l == prefixlen)
161  {
162  if (l <= 0)
163  found = true;
164  else if (memcmp(prefix, p, l) == 0)
165  found = true;
166  else
167  ++it;
168  }
169  else
170  ++it;
171  }
172  if (found)
173  *value = (*it)->GetInfo(valuelen);
174  return found;
175 }
unsigned char uint8_t
Definition: rtptypes_win.h:42
std::list< SDESPrivateItem * > privitems
Definition: rtcpsdesinfo.h:276

◆ GetTool()

uint8_t* qrtplib::RTCPSDESInfo::GetTool ( std::size_t *  len) const
inline

Returns the SDES tool item and stores its length in len.

Definition at line 153 of file rtcpsdesinfo.h.

References RTCP_SDES_ID_TOOL.

Referenced by qrtplib::RTCPPacketBuilder::FillInSDES(), and qrtplib::RTPInternalSourceData::ProcessSDESItem().

154  {
155  return GetNonPrivateItem(RTCP_SDES_ID_TOOL - 1, len);
156  }
uint8_t * GetNonPrivateItem(int itemno, std::size_t *len) const
Definition: rtcpsdesinfo.h:192
#define RTCP_SDES_ID_TOOL
Definition: rtpdefines.h:61
+ Here is the caller graph for this function:

◆ GotoFirstPrivateValue()

void qrtplib::RTCPSDESInfo::GotoFirstPrivateValue ( )

Starts the iteration over the stored SDES private item prefixes and their associated values.

Definition at line 132 of file rtcpsdesinfo.cpp.

References curitem, and privitems.

133 {
134  curitem = privitems.begin();
135 }
std::list< SDESPrivateItem * >::const_iterator curitem
Definition: rtcpsdesinfo.h:277
std::list< SDESPrivateItem * > privitems
Definition: rtcpsdesinfo.h:276

◆ SetCNAME()

int qrtplib::RTCPSDESInfo::SetCNAME ( const uint8_t s,
std::size_t  l 
)
inline

Sets the SDES CNAME item to s with length l.

Definition at line 70 of file rtcpsdesinfo.h.

References RTCP_SDES_ID_CNAME.

Referenced by qrtplib::RTCPPacketBuilder::Init(), and qrtplib::RTPInternalSourceData::ProcessSDESItem().

71  {
72  return SetNonPrivateItem(RTCP_SDES_ID_CNAME - 1, s, l);
73  }
int SetNonPrivateItem(int itemno, const uint8_t *s, std::size_t l)
Definition: rtcpsdesinfo.h:186
#define RTCP_SDES_ID_CNAME
Definition: rtpdefines.h:56
+ Here is the caller graph for this function:

◆ SetEMail()

int qrtplib::RTCPSDESInfo::SetEMail ( const uint8_t s,
std::size_t  l 
)
inline

Sets the SDES e-mail item to s with length l.

Definition at line 82 of file rtcpsdesinfo.h.

References RTCP_SDES_ID_EMAIL.

Referenced by qrtplib::RTPInternalSourceData::ProcessSDESItem().

83  {
84  return SetNonPrivateItem(RTCP_SDES_ID_EMAIL - 1, s, l);
85  }
#define RTCP_SDES_ID_EMAIL
Definition: rtpdefines.h:58
int SetNonPrivateItem(int itemno, const uint8_t *s, std::size_t l)
Definition: rtcpsdesinfo.h:186
+ Here is the caller graph for this function:

◆ SetLocation()

int qrtplib::RTCPSDESInfo::SetLocation ( const uint8_t s,
std::size_t  l 
)
inline

Sets the SDES location item to s with length l.

Definition at line 94 of file rtcpsdesinfo.h.

References RTCP_SDES_ID_LOCATION.

Referenced by qrtplib::RTPInternalSourceData::ProcessSDESItem().

95  {
96  return SetNonPrivateItem(RTCP_SDES_ID_LOCATION - 1, s, l);
97  }
#define RTCP_SDES_ID_LOCATION
Definition: rtpdefines.h:60
int SetNonPrivateItem(int itemno, const uint8_t *s, std::size_t l)
Definition: rtcpsdesinfo.h:186
+ Here is the caller graph for this function:

◆ SetName()

int qrtplib::RTCPSDESInfo::SetName ( const uint8_t s,
std::size_t  l 
)
inline

Sets the SDES name item to s with length l.

Definition at line 76 of file rtcpsdesinfo.h.

References RTCP_SDES_ID_NAME.

Referenced by qrtplib::RTPInternalSourceData::ProcessSDESItem().

77  {
78  return SetNonPrivateItem(RTCP_SDES_ID_NAME - 1, s, l);
79  }
int SetNonPrivateItem(int itemno, const uint8_t *s, std::size_t l)
Definition: rtcpsdesinfo.h:186
#define RTCP_SDES_ID_NAME
Definition: rtpdefines.h:57
+ Here is the caller graph for this function:

◆ SetNonPrivateItem()

int qrtplib::RTCPSDESInfo::SetNonPrivateItem ( int  itemno,
const uint8_t s,
std::size_t  l 
)
inlineprivate

Definition at line 186 of file rtcpsdesinfo.h.

References ERR_RTP_SDES_LENGTHTOOBIG, and RTCP_SDES_MAXITEMLENGTH.

187  {
188  if (l > RTCP_SDES_MAXITEMLENGTH)
190  return nonprivateitems[itemno].SetInfo(s, l);
191  }
SDESItem nonprivateitems[RTCP_SDES_NUMITEMS_NONPRIVATE]
Definition: rtcpsdesinfo.h:246
#define RTCP_SDES_MAXITEMLENGTH
Definition: rtpdefines.h:65
int SetInfo(const uint8_t *s, std::size_t len)
Definition: rtcpsdesinfo.h:215
#define ERR_RTP_SDES_LENGTHTOOBIG
Definition: rtperrors.h:107

◆ SetNote()

int qrtplib::RTCPSDESInfo::SetNote ( const uint8_t s,
std::size_t  l 
)
inline

Sets the SDES note item to s with length l.

Definition at line 106 of file rtcpsdesinfo.h.

References RTCP_SDES_ID_NOTE.

Referenced by qrtplib::RTPInternalSourceData::ProcessSDESItem().

107  {
108  return SetNonPrivateItem(RTCP_SDES_ID_NOTE - 1, s, l);
109  }
#define RTCP_SDES_ID_NOTE
Definition: rtpdefines.h:62
int SetNonPrivateItem(int itemno, const uint8_t *s, std::size_t l)
Definition: rtcpsdesinfo.h:186
+ Here is the caller graph for this function:

◆ SetPhone()

int qrtplib::RTCPSDESInfo::SetPhone ( const uint8_t s,
std::size_t  l 
)
inline

Sets the SDES phone item to s with length l.

Definition at line 88 of file rtcpsdesinfo.h.

References RTCP_SDES_ID_PHONE.

Referenced by qrtplib::RTPInternalSourceData::ProcessSDESItem().

89  {
90  return SetNonPrivateItem(RTCP_SDES_ID_PHONE - 1, s, l);
91  }
int SetNonPrivateItem(int itemno, const uint8_t *s, std::size_t l)
Definition: rtcpsdesinfo.h:186
#define RTCP_SDES_ID_PHONE
Definition: rtpdefines.h:59
+ Here is the caller graph for this function:

◆ SetPrivateValue()

int qrtplib::RTCPSDESInfo::SetPrivateValue ( const uint8_t prefix,
std::size_t  prefixlen,
const uint8_t value,
std::size_t  valuelen 
)

Sets the entry for the prefix string specified by prefix with length prefixlen to contain the value string specified by value with length valuelen (if the maximum allowed number of prefixes was reached, the error code ERR_RTP_SDES_MAXPRIVITEMS is returned.

Definition at line 50 of file rtcpsdesinfo.cpp.

References ERR_RTP_SDES_MAXPRIVITEMS, privitems, RTP_MAXPRIVITEMS, qrtplib::RTCPSDESInfo::SDESItem::SetInfo(), and qrtplib::RTCPSDESInfo::SDESPrivateItem::SetPrefix().

Referenced by qrtplib::RTPInternalSourceData::ProcessPrivateSDESItem().

51 {
52  std::list<SDESPrivateItem *>::const_iterator it;
53  bool found;
54 
55  found = false;
56  it = privitems.begin();
57  while (!found && it != privitems.end())
58  {
59  uint8_t *p;
60  std::size_t l;
61 
62  p = (*it)->GetPrefix(&l);
63  if (l == prefixlen)
64  {
65  if (l <= 0)
66  found = true;
67  else if (memcmp(prefix, p, l) == 0)
68  found = true;
69  else
70  ++it;
71  }
72  else
73  ++it;
74  }
75 
76  SDESPrivateItem *item;
77 
78  if (found) // replace the value for this entry
79  item = *it;
80  else // no entry for this prefix found... add it
81  {
82  if (privitems.size() >= RTP_MAXPRIVITEMS) // too many items present, just ignore it
84 
85  int status;
86 
87  item = new SDESPrivateItem();
88 
89  if ((status = item->SetPrefix(prefix, prefixlen)) < 0)
90  {
91  delete item;
92  return status;
93  }
94  privitems.push_front(item);
95  }
96  return item->SetInfo(value, valuelen);
97 }
#define ERR_RTP_SDES_MAXPRIVITEMS
Definition: rtperrors.h:108
#define RTP_MAXPRIVITEMS
Definition: rtpdefines.h:42
unsigned char uint8_t
Definition: rtptypes_win.h:42
std::list< SDESPrivateItem * > privitems
Definition: rtcpsdesinfo.h:276
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetTool()

int qrtplib::RTCPSDESInfo::SetTool ( const uint8_t s,
std::size_t  l 
)
inline

Sets the SDES tool item to s with length l.

Definition at line 100 of file rtcpsdesinfo.h.

References RTCP_SDES_ID_TOOL.

Referenced by qrtplib::RTPInternalSourceData::ProcessSDESItem().

101  {
102  return SetNonPrivateItem(RTCP_SDES_ID_TOOL - 1, s, l);
103  }
int SetNonPrivateItem(int itemno, const uint8_t *s, std::size_t l)
Definition: rtcpsdesinfo.h:186
#define RTCP_SDES_ID_TOOL
Definition: rtpdefines.h:61
+ Here is the caller graph for this function:

Member Data Documentation

◆ curitem

std::list<SDESPrivateItem *>::const_iterator qrtplib::RTCPSDESInfo::curitem
private

Definition at line 277 of file rtcpsdesinfo.h.

Referenced by GetNextPrivateValue(), and GotoFirstPrivateValue().

◆ nonprivateitems

SDESItem qrtplib::RTCPSDESInfo::nonprivateitems[RTCP_SDES_NUMITEMS_NONPRIVATE]
private

Definition at line 246 of file rtcpsdesinfo.h.

◆ privitems

std::list<SDESPrivateItem *> qrtplib::RTCPSDESInfo::privitems
private

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