37 #ifndef RTCPSDESINFO_H 39 #define RTCPSDESINFO_H 41 #include "rtpconfig.h" 43 #include "rtpdefines.h" 57 RTCPSDESInfo(
RTPMemoryManager *mgr = 0) : RTPMemoryObject(mgr) {
for (
int i = 0 ; i < RTCP_SDES_NUMITEMS_NONPRIVATE ; i++) nonprivateitems[i].SetMemoryManager(mgr); }
64 int SetCNAME(
const uint8_t *s,
size_t l) {
return SetNonPrivateItem(RTCP_SDES_ID_CNAME-1,s,l); }
67 int SetName(
const uint8_t *s,
size_t l) {
return SetNonPrivateItem(RTCP_SDES_ID_NAME-1,s,l); }
70 int SetEMail(
const uint8_t *s,
size_t l) {
return SetNonPrivateItem(RTCP_SDES_ID_EMAIL-1,s,l); }
73 int SetPhone(
const uint8_t *s,
size_t l) {
return SetNonPrivateItem(RTCP_SDES_ID_PHONE-1,s,l); }
76 int SetLocation(
const uint8_t *s,
size_t l) {
return SetNonPrivateItem(RTCP_SDES_ID_LOCATION-1,s,l); }
79 int SetTool(
const uint8_t *s,
size_t l) {
return SetNonPrivateItem(RTCP_SDES_ID_TOOL-1,s,l); }
82 int SetNote(
const uint8_t *s,
size_t l) {
return SetNonPrivateItem(RTCP_SDES_ID_NOTE-1,s,l); }
84 #ifdef RTP_SUPPORT_SDESPRIV 89 int SetPrivateValue(
const uint8_t *prefix,
size_t prefixlen,
const uint8_t *value,
size_t valuelen);
92 int DeletePrivatePrefix(
const uint8_t *s,
size_t len);
93 #endif // RTP_SUPPORT_SDESPRIV 96 uint8_t *
GetCNAME(
size_t *len)
const {
return GetNonPrivateItem(RTCP_SDES_ID_CNAME-1,len); }
99 uint8_t *
GetName(
size_t *len)
const {
return GetNonPrivateItem(RTCP_SDES_ID_NAME-1,len); }
102 uint8_t *
GetEMail(
size_t *len)
const {
return GetNonPrivateItem(RTCP_SDES_ID_EMAIL-1,len); }
105 uint8_t *
GetPhone(
size_t *len)
const {
return GetNonPrivateItem(RTCP_SDES_ID_PHONE-1,len); }
108 uint8_t *
GetLocation(
size_t *len)
const {
return GetNonPrivateItem(RTCP_SDES_ID_LOCATION-1,len); }
111 uint8_t *
GetTool(
size_t *len)
const {
return GetNonPrivateItem(RTCP_SDES_ID_TOOL-1,len); }
114 uint8_t *
GetNote(
size_t *len)
const {
return GetNonPrivateItem(RTCP_SDES_ID_NOTE-1,len); }
115 #ifdef RTP_SUPPORT_SDESPRIV 117 void GotoFirstPrivateValue();
126 bool GetNextPrivateValue(uint8_t **prefix,
size_t *prefixlen,uint8_t **value,
size_t *valuelen);
135 bool GetPrivateValue(
const uint8_t *prefix,
size_t prefixlen,uint8_t **value,
size_t *valuelen)
const;
136 #endif // RTP_SUPPORT_SDESPRIV 138 int SetNonPrivateItem(
int itemno,
const uint8_t *s,
size_t l) {
if (l > RTCP_SDES_MAXITEMLENGTH)
return ERR_RTP_SDES_LENGTHTOOBIG;
return nonprivateitems[itemno].SetInfo(s,l); }
139 uint8_t *GetNonPrivateItem(
int itemno,
size_t *len)
const {
return nonprivateitems[itemno].GetInfo(len); }
141 class SDESItem :
public RTPMemoryObject
151 RTPMemoryObject::SetMemoryManager(mgr);
156 RTPDeleteByteArray(str,GetMemoryManager());
158 uint8_t *GetInfo(
size_t *len)
const { *len = length;
return str; }
159 int SetInfo(
const uint8_t *s,
size_t len) {
return SetString(&str,&length,s,len); }
161 int SetString(uint8_t **dest,
size_t *destlen,
const uint8_t *s,
size_t len)
166 RTPDeleteByteArray((*dest),GetMemoryManager());
172 len = (len>RTCP_SDES_MAXITEMLENGTH)?RTCP_SDES_MAXITEMLENGTH:len;
175 return ERR_RTP_OUTOFMEM;
179 RTPDeleteByteArray((*dest),GetMemoryManager());
189 SDESItem nonprivateitems[RTCP_SDES_NUMITEMS_NONPRIVATE];
191 #ifdef RTP_SUPPORT_SDESPRIV 192 class SDESPrivateItem :
public SDESItem
203 RTPDeleteByteArray(prefix,GetMemoryManager());
205 uint8_t *GetPrefix(
size_t *len)
const { *len = prefixlen;
return prefix; }
206 int SetPrefix(
const uint8_t *s,
size_t len) {
return SetString(&prefix,&prefixlen,s,len); }
212 std::list<SDESPrivateItem *> privitems;
213 std::list<SDESPrivateItem *>::const_iterator curitem;
214 #endif // RTP_SUPPORT_SDESPRIV 219 #endif // RTCPSDESINFO_H int SetName(const uint8_t *s, size_t l)
Sets the SDES name item to s with length l.
Definition: rtcpsdesinfo.h:67
The class RTCPSDESInfo is a container for RTCP SDES information.
Definition: rtcpsdesinfo.h:53
RTCPSDESInfo(RTPMemoryManager *mgr=0)
Constructs an instance, optionally installing a memory manager.
Definition: rtcpsdesinfo.h:57
int SetEMail(const uint8_t *s, size_t l)
Sets the SDES e-mail item to s with length l.
Definition: rtcpsdesinfo.h:70
int SetTool(const uint8_t *s, size_t l)
Sets the SDES tool item to s with length l.
Definition: rtcpsdesinfo.h:79
#define RTPMEM_TYPE_BUFFER_SDESITEM
Buffer to store an SDES item.
Definition: rtpmemorymanager.h:75
uint8_t * GetCNAME(size_t *len) const
Returns the SDES CNAME item and stores its length in len.
Definition: rtcpsdesinfo.h:96
uint8_t * GetLocation(size_t *len) const
Returns the SDES location item and stores its length in len.
Definition: rtcpsdesinfo.h:108
int SetPhone(const uint8_t *s, size_t l)
Sets the SDES phone item to s with length l.
Definition: rtcpsdesinfo.h:73
int SetLocation(const uint8_t *s, size_t l)
Sets the SDES location item to s with length l.
Definition: rtcpsdesinfo.h:76
uint8_t * GetNote(size_t *len) const
Returns the SDES note item and stores its length in len.
Definition: rtcpsdesinfo.h:114
Definition: rtpfaketransmitter.h:64
A memory manager.
Definition: rtpmemorymanager.h:150
uint8_t * GetTool(size_t *len) const
Returns the SDES tool item and stores its length in len.
Definition: rtcpsdesinfo.h:111
uint8_t * GetEMail(size_t *len) const
Returns the SDES e-mail item and stores its length in len.
Definition: rtcpsdesinfo.h:102
int SetNote(const uint8_t *s, size_t l)
Sets the SDES note item to s with length l.
Definition: rtcpsdesinfo.h:82
uint8_t * GetPhone(size_t *len) const
Returns the SDES phone item and stores its length in len.
Definition: rtcpsdesinfo.h:105
uint8_t * GetName(size_t *len) const
Returns the SDES name item and stores its length in len.
Definition: rtcpsdesinfo.h:99
int SetCNAME(const uint8_t *s, size_t l)
Sets the SDES CNAME item to s with length l.
Definition: rtcpsdesinfo.h:64