110 total((uint32)len), duplicated(duplicate)
120 len -= block[len - 1];
124 buffer =
new unsigned char[len];
127 buffer =
const_cast<unsigned char*
>(block);
133 payloadSize((uint32)plen), buffer(NULL), hdrSize((uint32)hdrlen),
139 if ( 0 != paddinglen ) {
140 padding = paddinglen - (
total % paddinglen);
156 *(
reinterpret_cast<uint32*
>(
getHeader())) = 0;
158 if ( 0 != padding ) {
169 #ifdef CCXX_EXCEPTIONS
173 #ifdef CCXX_EXCEPTIONS
192 const unsigned char*
const hdrext, uint32 hdrextlen,
193 const unsigned char*
const data,
size_t datalen,
195 RTPPacket((getSizeOfFixedHeader() + sizeof(uint32) * numcsrc + hdrextlen),datalen,paddinglen, pcc)
200 pointer += numcsrc *
sizeof(uint32);
205 pointer += hdrextlen;
212 const unsigned char* data,
size_t datalen, uint8 paddinglen,
CryptoContext* pcc) :
213 RTPPacket((getSizeOfFixedHeader() + sizeof(uint32) *numcsrc),datalen, paddinglen, pcc)
218 pointer += numcsrc *
sizeof(uint32);
230 RTPPacket(getSizeOfFixedHeader(),datalen,paddinglen, pcc)
243 uint32* csrc =
const_cast<uint32*
>(
getCSRCs());
244 for (
int i = 0; i < numcsrc; i++ )
245 csrc[i] = htonl(csrc[i]);
334 uint32 guessedRoc = (uint32)(guessedIndex >> 16);
uint32 total
total length, including header, payload and padding
size_t getSizeOfFixedHeader() const
A base class for both IncomingRTPPkt and OutgoingRTPPkt.
void srtpAuthenticate(RTPPacket *rtp, uint32 roc, uint8 *tag)
Compute the authentication tag.
int32 getMkiLength() const
Get the length of the MKI in bytes.
The implementation for a SRTP cryptographic context.
void setRoc(uint32 r)
Set the Roll-Over-Counter.
const uint8 CCRTP_VERSION
RTP protocol version supported.
void reComputePayLength(bool padding)
Re-compute payload length.
PayloadType getPayloadType() const
uint32 getRawTimestamp() const
Obtain the absolute timestamp carried in the packet header.
const uint32 * getCSRCs() const
Get the 32-bit identifiers of the contributing sources for the packet as an array, of length getCSRCsCount().
uint32 getRoc() const
Get the Roll-Over-Counter.
Declaration of ccRTP internal stuff.
int32 unprotect(CryptoContext *pcc)
Unprotect a received packet.
unsigned char * buffer
packet in memory
OutgoingRTPPkt(const uint32 *const csrcs, uint16 numcsrc, const unsigned char *const hdrext, uint32 hdrextlen, const unsigned char *const data, size_t datalen, uint8 paddinglen=0, CryptoContext *pcc=NULL)
Construct a new packet to be sent, containing several contributing source identifiers, header extensions and payload.
static const uint16 RTP_INVALID_PT_VALUE
bool checkReplay(uint16 newSeqNumber)
Check for packet replay.
void srtpEncrypt(RTPPacket *rtp, uint64 index, uint32 ssrc)
Perform SRTP encryption.
uint32 srtpDataOffset
Offset into packet memory pointing to area for SRTP data.
IncomingRTPPkt(const unsigned char *block, size_t len)
Build an RTP packet object from a data buffer.
RTPFixedHeader * getHeader() const
Return low level structure for the header of the packet.
uint8 getProtocolVersion() const
uint32 cachedTimestamp
Packet timestamp in host order (includes initial shift).
static const uint16 RTP_INVALID_PT_MASK
const unsigned char *const getRawPacket() const
Get the raw packet as it will be sent through the network.
uint32 cachedSSRC
SSRC 32-bit identifier in host order.
void endPacket()
Free memory allocated for the packet.
void update(uint16 newSeqNumber)
Update the SRTP packet index.
int32 getTagLength() const
Get the length of the SRTP authentication tag in bytes.
bool headerValid
Header validity, checked at construction time.
ITU-T G.729. CS-ACELP audio.
void setbuffer(const void *src, size_t len, size_t pos)
uint64 guessIndex(uint16 newSeqNumber)
Compute (guess) the new SRTP index based on the sequence number of a received RTP packet...
void protect(uint32 ssrc, CryptoContext *pcc)
Called packet is setup.
void setCSRCArray(const uint32 *const csrcs, uint16 numcsrc)
Set the list of CSRC identifiers in an RTP packet, switching host to network order.
void setExtension(bool e)
RTPPacket(const unsigned char *const block, size_t len, bool duplicate=false)
Constructor, construct a packet object given the memory zone its content (header and payload) is stor...
uint32 hdrSize
size of the header, including contributing sources and extensions
int32 srtpLength
Lebgth of additional SRTP data.
StaticPayloadType
RTP static payload types (default bindings) defined in the AVP profile.
uint16 cachedSeqNum
Packet sequence number in host order.
uint32 payloadSize
note: payload (not full packet) size.
uint8 PayloadType
RTP payload type numeric identifier.