A base class for both IncomingRTPPkt and OutgoingRTPPkt.
More...
#include <rtppkt.h>
|
struct | RFC2833Payload |
| a structure defining RFC2833 Telephony events. More...
|
|
struct | RTPFixedHeader |
| RTP fixed header as it is send through the network. More...
|
|
struct | RTPHeaderExt |
| Fixed component of the variable-length header extension, appended to the fixed header, after the CSRC list, when X == 1. More...
|
|
|
| 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 stored. More...
|
|
| RTPPacket (size_t hdrlen, size_t plen, uint8 paddinglen, CryptoContext *pcc=NULL) |
| Construct a packet object without specifying its real content yet. More...
|
|
uint32 | getHeaderSize () const |
| Get the length of the header, including contributing sources identifiers and header extension, if present. More...
|
|
const uint8 *const | getPayload () const |
|
uint32 | getPayloadSize () const |
|
PayloadType | getPayloadType () const |
|
uint16 | getSeqNum () const |
|
uint32 | getTimestamp () const |
|
uint8 | getProtocolVersion () const |
|
bool | isPadded () const |
| Ask whether the packet contains padding bytes at the end. More...
|
|
uint8 | getPaddingSize () const |
| Get the number of octets padding the end of the payload section. More...
|
|
bool | isMarked () const |
| Ask whether the packet is marked (for isntance, is a new talk spurt in some audio profiles). More...
|
|
bool | isExtended () const |
| Ask whether the packet contains header extensions. More...
|
|
uint16 | getCSRCsCount () const |
| Get the number of contributing sources specified in the packet header. More...
|
|
const uint32 * | getCSRCs () const |
| Get the 32-bit identifiers of the contributing sources for the packet as an array, of length getCSRCsCount(). More...
|
|
uint16 | getHdrExtUndefined () const |
| Get the first 16 bits (in network order) of the header of the RTP header extension. More...
|
|
uint32 | getHdrExtSize () const |
| Get the length (in octets) of the data contained in the header extension. More...
|
|
const unsigned char * | getHdrExtContent () const |
| Get the content of the header extension. More...
|
|
const unsigned char *const | getRawPacket () const |
| Get the raw packet as it will be sent through the network. More...
|
|
uint32 | getRawPacketSize () const |
| Get the raw packet length, including header, extension, payload and padding. More...
|
|
uint32 | getRawPacketSizeSrtp () const |
|
size_t | getSizeOfFixedHeader () const |
|
void | reComputePayLength (bool padding) |
| Re-compute payload length. More...
|
|
struct RFC2833Payload * | getRaw2833Payload (void) |
| Fetch a raw 2833 packet. More...
|
|
uint16 | get2833Duration (void) |
| Fetch 2833 duration field. More...
|
|
void | set2833Duration (uint16 timestamp) |
| Set 2833 duration field. More...
|
|
A base class for both IncomingRTPPkt and OutgoingRTPPkt.
Provides common low level header structures and related methods. This class provides an interface that allows for partial and generic manipulation of RTP data packets. Values are returned in host order, except raw structures, which are returned as they are sent through the network.
- Author
- David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m
Definition at line 75 of file rtppkt.h.
RTPPacket::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 stored.
Commonly used to build RTPPacket objects from incoming data.
- Parameters
-
block | whole packet |
len | total length (header + payload + padding) of the packet |
duplicate | whether to memcopy the packet. At present, this feature is not used. |
- Note
- used in IncomingRTPPkt.
RTPPacket::RTPPacket |
( |
size_t |
hdrlen, |
|
|
size_t |
plen, |
|
|
uint8 |
paddinglen, |
|
|
CryptoContext * |
pcc = NULL |
|
) |
| |
Construct a packet object without specifying its real content yet.
Commonly used for outgoing packets. Header fields and payload must be filled in by another methods or by a derived constructor.
- Parameters
-
hdrlen | length of the header (including CSRC and extension). |
plen | payload length. |
paddinglen | pad packet to a multiple of paddinglen |
- Note
- used in OutgoingRTPPkt.
virtual RTPPacket::~RTPPacket |
( |
| ) |
|
|
inlineprotectedvirtual |
Destructor, free the buffer provided in the constructor.
Definition at line 309 of file rtppkt.h.
void RTPPacket::endPacket |
( |
| ) |
|
|
protected |
Free memory allocated for the packet.
uint16 RTPPacket::get2833Duration |
( |
void |
| ) |
|
|
inline |
Fetch 2833 duration field.
- Returns
- 2833 duration in native host machine byte order.
Definition at line 488 of file rtppkt.h.
const uint32* RTPPacket::getCSRCs |
( |
| ) |
const |
|
inline |
Get the 32-bit identifiers of the contributing sources for the packet as an array, of length getCSRCsCount().
- Returns
- An array of CSRC identifiers as they are in the packet (in network order).
Definition at line 215 of file rtppkt.h.
uint16 RTPPacket::getCSRCsCount |
( |
| ) |
const |
|
inline |
Get the number of contributing sources specified in the packet header.
Definition at line 204 of file rtppkt.h.
const unsigned char* RTPPacket::getHdrExtContent |
( |
| ) |
const |
|
inline |
Get the content of the header extension.
- Returns
- NULL if the packet has no header extension, otherwise a pointer to the packet header extension content.
Definition at line 258 of file rtppkt.h.
uint32 RTPPacket::getHdrExtSize |
( |
| ) |
const |
|
inline |
Get the length (in octets) of the data contained in the header extension.
Note that this length does not include the four octets at the beginning of the header extension.
- Returns
- 0 if the packet has no header extension, otherwise the length.
- Note
- 0 is a valid value for this field, so RTPPacket::isExtended() should be used.
Definition at line 246 of file rtppkt.h.
uint16 RTPPacket::getHdrExtUndefined |
( |
| ) |
const |
|
inline |
Get the first 16 bits (in network order) of the header of the RTP header extension.
Its meaning is undefined at this level.
- Returns
- 0 if the packet has no header extension, otherwise the first 16 bits of the header extension, in network order.
- Note
- 0 could be a valid value for the first 16 bits, in that case RTPPacket::isExtended() should be use.
Definition at line 231 of file rtppkt.h.
Return low level structure for the header of the packet.
- Returns
- RTPFixedHeader pointer to the header of the packet.
Definition at line 324 of file rtppkt.h.
Get a pointer to RTPHeaderExt pointing after the RTP header (fixed part plus contributing sources).
No check for for the X bit is done.
- Returns
- header extension if present, garbage if not.
Definition at line 339 of file rtppkt.h.
uint32 RTPPacket::getHeaderSize |
( |
| ) |
const |
|
inline |
Get the length of the header, including contributing sources identifiers and header extension, if present.
- Returns
- number of octets.
Definition at line 117 of file rtppkt.h.
uint8 RTPPacket::getPaddingSize |
( |
| ) |
const |
|
inline |
Get the number of octets padding the end of the payload section.
- Returns
- Padding length in octets.
Definition at line 177 of file rtppkt.h.
const uint8* const RTPPacket::getPayload |
( |
| ) |
const |
|
inline |
- Returns
- pointer to the payload section of the packet.
Definition at line 124 of file rtppkt.h.
uint32 RTPPacket::getPayloadSize |
( |
| ) |
const |
|
inline |
- Returns
- length of the payload section, in octets.
Definition at line 131 of file rtppkt.h.
- Returns
- value of the PT header field.
Definition at line 138 of file rtppkt.h.
uint8 RTPPacket::getProtocolVersion |
( |
| ) |
const |
|
inline |
- Returns
- RTP protocol version of packet.
Definition at line 159 of file rtppkt.h.
Fetch a raw 2833 packet.
- Returns
- low level 2833 data structure.
Definition at line 480 of file rtppkt.h.
const unsigned char* const RTPPacket::getRawPacket |
( |
| ) |
const |
|
inline |
Get the raw packet as it will be sent through the network.
- Returns
- memory zone where the raw packet structure is stored in.
Definition at line 271 of file rtppkt.h.
uint32 RTPPacket::getRawPacketSize |
( |
| ) |
const |
|
inline |
Get the raw packet length, including header, extension, payload and padding.
- Returns
- size of the raw packet structure.
Definition at line 281 of file rtppkt.h.
uint32 RTPPacket::getRawPacketSizeSrtp |
( |
| ) |
const |
|
inline |
uint32 RTPPacket::getRawTimestamp |
( |
| ) |
const |
|
inlineprotected |
Obtain the absolute timestamp carried in the packet header.
- Returns
- 32-bit timestamp in host order.
Definition at line 351 of file rtppkt.h.
uint16 RTPPacket::getSeqNum |
( |
| ) |
const |
|
inline |
- Returns
- value of the sequence number header field, in host order.
Definition at line 145 of file rtppkt.h.
size_t RTPPacket::getSizeOfFixedHeader |
( |
| ) |
const |
|
inline |
uint32 RTPPacket::getTimestamp |
( |
| ) |
const |
|
inline |
- Returns
- packet timestamp in host order.
Definition at line 152 of file rtppkt.h.
bool RTPPacket::isExtended |
( |
| ) |
const |
|
inline |
Ask whether the packet contains header extensions.
- Returns
- true if the header extension bit is 1.
Definition at line 196 of file rtppkt.h.
bool RTPPacket::isMarked |
( |
| ) |
const |
|
inline |
Ask whether the packet is marked (for isntance, is a new talk spurt in some audio profiles).
- Returns
- true is the header marker bit is 1.
Definition at line 187 of file rtppkt.h.
bool RTPPacket::isPadded |
( |
| ) |
const |
|
inline |
Ask whether the packet contains padding bytes at the end.
- Returns
- true if the header padding bit is 1.
Definition at line 167 of file rtppkt.h.
void RTPPacket::reComputePayLength |
( |
bool |
padding | ) |
|
Re-compute payload length.
This recomputation may be necessary in case of SRTP. We need to decrypt the packet before we can handle padding. See takeInDataPacket
in incqueue.cpp
- Parameters
-
padding | If true then set padding flag in RTP header and re-compute payloadSize. |
void RTPPacket::set2833Duration |
( |
uint16 |
timestamp | ) |
|
|
inline |
Set 2833 duration field.
- Parameters
-
timestamp | to use, native host machine byte order. |
Definition at line 496 of file rtppkt.h.
void RTPPacket::setbuffer |
( |
const void * |
src, |
|
|
size_t |
len, |
|
|
size_t |
pos |
|
) |
| |
|
inlineprotected |
void RTPPacket::setExtension |
( |
bool |
e | ) |
|
|
inlineprotected |
unsigned char* RTPPacket::buffer |
|
private |
packet in memory
Definition at line 386 of file rtppkt.h.
uint16 RTPPacket::cachedSeqNum |
|
protected |
Packet sequence number in host order.
Definition at line 359 of file rtppkt.h.
uint32 RTPPacket::cachedTimestamp |
|
protected |
Packet timestamp in host order (includes initial shift).
Definition at line 361 of file rtppkt.h.
bool RTPPacket::duplicated |
|
private |
whether the object was contructed with duplicated = true
Definition at line 390 of file rtppkt.h.
uint32 RTPPacket::hdrSize |
|
private |
size of the header, including contributing sources and extensions
Definition at line 388 of file rtppkt.h.
uint32 RTPPacket::payloadSize |
|
protected |
note: payload (not full packet) size.
Definition at line 382 of file rtppkt.h.
uint32 RTPPacket::srtpDataOffset |
|
protected |
Offset into packet memory pointing to area for SRTP data.
This offset points to the memory where the SRTP protect will store the authentication and MKI data.
Definition at line 369 of file rtppkt.h.
int32 RTPPacket::srtpLength |
|
protected |
Lebgth of additional SRTP data.
Covers the SRTP authentication and MKI data.
Definition at line 376 of file rtppkt.h.
total length, including header, payload and padding
Definition at line 379 of file rtppkt.h.
The documentation for this class was generated from the following file: