37 #ifndef RTCPSDESPACKET_H 39 #define RTCPSDESPACKET_H 41 #include "rtpconfig.h" 44 #include "rtpdefines.h" 45 #ifdef RTP_SUPPORT_NETINET_IN 46 #include <netinet/in.h> 47 #endif // RTP_SUPPORT_NETINET_IN 52 class RTCPCompoundPacket;
84 int GetChunkCount()
const;
90 bool GotoFirstChunk();
99 uint32_t GetChunkSSRC()
const;
106 bool GotoFirstItem();
118 size_t GetItemLength()
const;
121 uint8_t *GetItemData();
123 #ifdef RTP_SUPPORT_SDESPRIV 127 size_t GetPRIVPrefixLength()
const;
132 uint8_t *GetPRIVPrefixData();
137 size_t GetPRIVValueLength()
const;
142 uint8_t *GetPRIVValueData();
143 #endif // RTP_SUPPORT_SDESPRIV 149 uint8_t *currentchunk;
158 RTCPCommonHeader *hdr = (RTCPCommonHeader *)data;
159 return ((
int)hdr->count);
164 if (GetChunkCount() == 0)
169 currentchunk = data+
sizeof(RTCPCommonHeader);
171 itemoffset =
sizeof(uint32_t);
179 if (currentchunk == 0)
181 if (curchunknum == GetChunkCount())
184 size_t offset =
sizeof(uint32_t);
185 RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+
sizeof(uint32_t));
187 while (sdeshdr->sdesid != 0)
189 offset +=
sizeof(RTCPSDESHeader);
190 offset += (size_t)(sdeshdr->length);
191 sdeshdr = (RTCPSDESHeader *)(currentchunk+offset);
194 if ((offset&0x03) != 0)
195 offset += (4-(offset&0x03));
196 currentchunk += offset;
198 itemoffset =
sizeof(uint32_t);
206 if (currentchunk == 0)
208 uint32_t *ssrc = (uint32_t *)currentchunk;
216 if (currentchunk == 0)
218 itemoffset =
sizeof(uint32_t);
219 RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset);
220 if (sdeshdr->sdesid == 0)
229 if (currentchunk == 0)
232 RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset);
233 if (sdeshdr->sdesid == 0)
236 size_t offset = itemoffset;
237 offset +=
sizeof(RTCPSDESHeader);
238 offset += (size_t)(sdeshdr->length);
239 sdeshdr = (RTCPSDESHeader *)(currentchunk+offset);
240 if (sdeshdr->sdesid == 0)
250 if (currentchunk == 0)
252 RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset);
253 switch (sdeshdr->sdesid)
257 case RTCP_SDES_ID_CNAME:
259 case RTCP_SDES_ID_NAME:
261 case RTCP_SDES_ID_EMAIL:
263 case RTCP_SDES_ID_PHONE:
265 case RTCP_SDES_ID_LOCATION:
267 case RTCP_SDES_ID_TOOL:
269 case RTCP_SDES_ID_NOTE:
271 case RTCP_SDES_ID_PRIVATE:
283 if (currentchunk == 0)
285 RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset);
286 if (sdeshdr->sdesid == 0)
288 return (
size_t)(sdeshdr->length);
295 if (currentchunk == 0)
297 RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset);
298 if (sdeshdr->sdesid == 0)
300 return (currentchunk+itemoffset+
sizeof(RTCPSDESHeader));
303 #ifdef RTP_SUPPORT_SDESPRIV 308 if (currentchunk == 0)
310 RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset);
311 if (sdeshdr->sdesid != RTCP_SDES_ID_PRIVATE)
313 if (sdeshdr->length == 0)
315 uint8_t *preflen = currentchunk+itemoffset+
sizeof(RTCPSDESHeader);
316 size_t prefixlength = (size_t)(*preflen);
317 if (prefixlength > (
size_t)((sdeshdr->length)-1))
326 if (currentchunk == 0)
328 RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset);
329 if (sdeshdr->sdesid != RTCP_SDES_ID_PRIVATE)
331 if (sdeshdr->length == 0)
333 uint8_t *preflen = currentchunk+itemoffset+
sizeof(RTCPSDESHeader);
334 size_t prefixlength = (size_t)(*preflen);
335 if (prefixlength > (
size_t)((sdeshdr->length)-1))
337 if (prefixlength == 0)
339 return (currentchunk+itemoffset+
sizeof(RTCPSDESHeader)+1);
346 if (currentchunk == 0)
348 RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset);
349 if (sdeshdr->sdesid != RTCP_SDES_ID_PRIVATE)
351 if (sdeshdr->length == 0)
353 uint8_t *preflen = currentchunk+itemoffset+
sizeof(RTCPSDESHeader);
354 size_t prefixlength = (size_t)(*preflen);
355 if (prefixlength > (
size_t)((sdeshdr->length)-1))
357 return ((
size_t)(sdeshdr->length))-prefixlength-1;
364 if (currentchunk == 0)
366 RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset);
367 if (sdeshdr->sdesid != RTCP_SDES_ID_PRIVATE)
369 if (sdeshdr->length == 0)
371 uint8_t *preflen = currentchunk+itemoffset+
sizeof(RTCPSDESHeader);
372 size_t prefixlength = (size_t)(*preflen);
373 if (prefixlength > (
size_t)((sdeshdr->length)-1))
375 size_t valuelen = ((size_t)(sdeshdr->length))-prefixlength-1;
378 return (currentchunk+itemoffset+
sizeof(RTCPSDESHeader)+1+prefixlength);
381 #endif // RTP_SUPPORT_SDESPRIV 385 #endif // RTCPSDESPACKET_H int GetChunkCount() const
Returns the number of SDES chunks in the SDES packet.
Definition: rtcpsdespacket.h:154
ItemType GetItemType() const
Returns the SDES item type of the current item in the current chunk.
Definition: rtcpsdespacket.h:246
Used for a PHONE item.
Definition: rtcpsdespacket.h:65
bool GotoNextItem()
Advances the iteration to the next item in the current chunk.
Definition: rtcpsdespacket.h:225
Used for an EMAIL item.
Definition: rtcpsdespacket.h:64
Used when the iteration over the items has finished.
Definition: rtcpsdespacket.h:61
bool GotoFirstChunk()
Starts the iteration over the chunks.
Definition: rtcpsdespacket.h:162
uint32_t GetChunkSSRC() const
Returns the SSRC identifier of the current chunk.
Definition: rtcpsdespacket.h:202
ItemType
Identifies the type of an SDES item.
Definition: rtcpsdespacket.h:59
Used for a CNAME (canonical name) item.
Definition: rtcpsdespacket.h:62
Used for a PRIV item.
Definition: rtcpsdespacket.h:69
Used for a LOC (location) item.
Definition: rtcpsdespacket.h:66
size_t GetPRIVValueLength() const
If the current item is an SDES PRIV item, this function returns the length of the value string of the...
Definition: rtcpsdespacket.h:342
Definition: rtpfaketransmitter.h:64
Used for a NAME item.
Definition: rtcpsdespacket.h:63
bool GotoNextChunk()
Sets the current chunk to the next available chunk.
Definition: rtcpsdespacket.h:175
bool GotoFirstItem()
Starts the iteration over the SDES items in the current chunk.
Definition: rtcpsdespacket.h:212
size_t GetPRIVPrefixLength() const
If the current item is an SDES PRIV item, this function returns the length of the prefix string of th...
Definition: rtcpsdespacket.h:304
Base class for specific types of RTCP packets.
Definition: rtcppacket.h:50
uint8_t * GetPRIVPrefixData()
If the current item is an SDES PRIV item, this function returns actual data of the prefix string...
Definition: rtcpsdespacket.h:322
size_t GetItemLength() const
Returns the item length of the current item in the current chunk.
Definition: rtcpsdespacket.h:279
uint8_t * GetPRIVValueData()
If the current item is an SDES PRIV item, this function returns actual value data of the private item...
Definition: rtcpsdespacket.h:360
Describes an RTCP source description packet.
Definition: rtcpsdespacket.h:55
uint8_t * GetItemData()
Returns the item data of the current item in the current chunk.
Definition: rtcpsdespacket.h:291
Used for a NOTE item.
Definition: rtcpsdespacket.h:68
Used for a TOOL item.
Definition: rtcpsdespacket.h:67