37 #ifndef RTCPSDESPACKET_H
39 #define RTCPSDESPACKET_H
41 #include "rtpconfig.h"
44 #include "rtpdefines.h"
45 #if ! (defined(WIN32) || defined(_WIN32_WCE))
46 #include <netinet/in.h>
120 #ifdef RTP_SUPPORT_SDESPRIV
140 #endif // RTP_SUPPORT_SDESPRIV
146 uint8_t *currentchunk;
155 RTCPCommonHeader *hdr = (RTCPCommonHeader *)data;
156 return ((
int)hdr->count);
166 currentchunk = data+
sizeof(RTCPCommonHeader);
168 itemoffset =
sizeof(uint32_t);
176 if (currentchunk == 0)
181 size_t offset =
sizeof(uint32_t);
182 RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+
sizeof(uint32_t));
184 while (sdeshdr->sdesid != 0)
186 offset +=
sizeof(RTCPSDESHeader);
187 offset += (size_t)(sdeshdr->length);
188 sdeshdr = (RTCPSDESHeader *)(currentchunk+offset);
191 if ((offset&0x03) != 0)
192 offset += (4-(offset&0x03));
193 currentchunk += offset;
195 itemoffset =
sizeof(uint32_t);
203 if (currentchunk == 0)
205 uint32_t *ssrc = (uint32_t *)currentchunk;
213 if (currentchunk == 0)
215 itemoffset =
sizeof(uint32_t);
216 RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset);
217 if (sdeshdr->sdesid == 0)
226 if (currentchunk == 0)
229 RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset);
230 if (sdeshdr->sdesid == 0)
233 size_t offset = itemoffset;
234 offset +=
sizeof(RTCPSDESHeader);
235 offset += (size_t)(sdeshdr->length);
236 sdeshdr = (RTCPSDESHeader *)(currentchunk+offset);
237 if (sdeshdr->sdesid == 0)
247 if (currentchunk == 0)
249 RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset);
250 switch (sdeshdr->sdesid)
254 case RTCP_SDES_ID_CNAME:
256 case RTCP_SDES_ID_NAME:
258 case RTCP_SDES_ID_EMAIL:
260 case RTCP_SDES_ID_PHONE:
262 case RTCP_SDES_ID_LOCATION:
264 case RTCP_SDES_ID_TOOL:
266 case RTCP_SDES_ID_NOTE:
268 case RTCP_SDES_ID_PRIVATE:
280 if (currentchunk == 0)
282 RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset);
283 if (sdeshdr->sdesid == 0)
285 return (
size_t)(sdeshdr->length);
292 if (currentchunk == 0)
294 RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset);
295 if (sdeshdr->sdesid == 0)
297 return (currentchunk+itemoffset+
sizeof(RTCPSDESHeader));
300 #ifdef RTP_SUPPORT_SDESPRIV
305 if (currentchunk == 0)
307 RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset);
308 if (sdeshdr->sdesid != RTCP_SDES_ID_PRIVATE)
310 if (sdeshdr->length == 0)
312 uint8_t *preflen = currentchunk+itemoffset+
sizeof(RTCPSDESHeader);
313 size_t prefixlength = (size_t)(*preflen);
314 if (prefixlength > (
size_t)((sdeshdr->length)-1))
323 if (currentchunk == 0)
325 RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset);
326 if (sdeshdr->sdesid != RTCP_SDES_ID_PRIVATE)
328 if (sdeshdr->length == 0)
330 uint8_t *preflen = currentchunk+itemoffset+
sizeof(RTCPSDESHeader);
331 size_t prefixlength = (size_t)(*preflen);
332 if (prefixlength > (
size_t)((sdeshdr->length)-1))
334 if (prefixlength == 0)
336 return (currentchunk+itemoffset+
sizeof(RTCPSDESHeader)+1);
343 if (currentchunk == 0)
345 RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset);
346 if (sdeshdr->sdesid != RTCP_SDES_ID_PRIVATE)
348 if (sdeshdr->length == 0)
350 uint8_t *preflen = currentchunk+itemoffset+
sizeof(RTCPSDESHeader);
351 size_t prefixlength = (size_t)(*preflen);
352 if (prefixlength > (
size_t)((sdeshdr->length)-1))
354 return ((
size_t)(sdeshdr->length))-prefixlength-1;
361 if (currentchunk == 0)
363 RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset);
364 if (sdeshdr->sdesid != RTCP_SDES_ID_PRIVATE)
366 if (sdeshdr->length == 0)
368 uint8_t *preflen = currentchunk+itemoffset+
sizeof(RTCPSDESHeader);
369 size_t prefixlength = (size_t)(*preflen);
370 if (prefixlength > (
size_t)((sdeshdr->length)-1))
372 size_t valuelen = ((size_t)(sdeshdr->length))-prefixlength-1;
375 return (currentchunk+itemoffset+
sizeof(RTCPSDESHeader)+1+prefixlength);
378 #endif // RTP_SUPPORT_SDESPRIV
380 #endif // RTCPSDESPACKET_H
Used for a NAME item.
Definition: rtcpsdespacket.h:60
ItemType GetItemType() const
Returns the SDES item type of the current item in the current chunk.
Definition: rtcpsdespacket.h:243
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:301
Used for a NOTE item.
Definition: rtcpsdespacket.h:65
Used for a PHONE item.
Definition: rtcpsdespacket.h:62
bool GotoNextItem()
Advances the iteration to the next item in the current chunk.
Definition: rtcpsdespacket.h:222
Used for a PRIV item.
Definition: rtcpsdespacket.h:66
Base class for specific types of RTCP packets.
Definition: rtcppacket.h:47
uint8_t * GetPRIVPrefixData()
If the current item is an SDES PRIV item, this function returns actual data of the prefix string...
Definition: rtcpsdespacket.h:319
size_t GetItemLength() const
Returns the item length of the current item in the current chunk.
Definition: rtcpsdespacket.h:276
Represents an RTCP compound packet.
Definition: rtcpcompoundpacket.h:50
Describes an RTCP source description packet.
Definition: rtcpsdespacket.h:52
uint32_t GetChunkSSRC() const
Returns the SSRC identifier of the current chunk.
Definition: rtcpsdespacket.h:199
RTCPSDESPacket(uint8_t *data, size_t datalen)
Creates an instance based on the data in data with length datalen.
Used for a CNAME (canonical name) item.
Definition: rtcpsdespacket.h:59
Used when the iteration over the items has finished.
Definition: rtcpsdespacket.h:58
ItemType
Identifies the type of an SDES item.
Definition: rtcpsdespacket.h:56
uint8_t * GetItemData()
Returns the item data of the current item in the current chunk.
Definition: rtcpsdespacket.h:288
bool GotoFirstChunk()
Starts the iteration over the chunks.
Definition: rtcpsdespacket.h:159
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:339
int GetChunkCount() const
Returns the number of SDES chunks in the SDES packet.
Definition: rtcpsdespacket.h:151
bool GotoFirstItem()
Starts the iteration over the SDES items in the current chunk.
Definition: rtcpsdespacket.h:209
bool GotoNextChunk()
Sets the current chunk to the next available chunk.
Definition: rtcpsdespacket.h:172
Used for a TOOL item.
Definition: rtcpsdespacket.h:64
Used for a LOC (location) item.
Definition: rtcpsdespacket.h:63
Used for an EMAIL item.
Definition: rtcpsdespacket.h:61
Used when there is an item present, but the type is not recognized.
Definition: rtcpsdespacket.h:67
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:357