.TH "RTPPacket" 3 "Sat Oct 27 2018" "ccRTP" \" -*- nroff -*- .ad l .nh .SH NAME RTPPacket \- A base class for both \fBIncomingRTPPkt\fP and \fBOutgoingRTPPkt\fP\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherited by \fBIncomingRTPPkt\fP, and \fBOutgoingRTPPkt\fP\&. .SS "Classes" .in +1c .ti -1c .RI "struct \fBRFC2833Payload\fP" .br .RI "a structure defining RFC2833 Telephony events\&. " .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBRTPPacket\fP (const unsigned char *const block, size_t len, bool duplicate=false)" .br .RI "Constructor, construct a packet object given the memory zone its content (header and payload) is stored\&. " .ti -1c .RI "\fBRTPPacket\fP (size_t hdrlen, size_t plen, uint8 paddinglen, \fBCryptoContext\fP *pcc=NULL)" .br .RI "Construct a packet object without specifying its real content yet\&. " .ti -1c .RI "uint32 \fBgetHeaderSize\fP () const" .br .RI "Get the length of the header, including contributing sources identifiers and header extension, if present\&. " .ti -1c .RI "const uint8 *const \fBgetPayload\fP () const" .br .ti -1c .RI "uint32 \fBgetPayloadSize\fP () const" .br .ti -1c .RI "\fBPayloadType\fP \fBgetPayloadType\fP () const" .br .ti -1c .RI "uint16 \fBgetSeqNum\fP () const" .br .ti -1c .RI "uint32 \fBgetTimestamp\fP () const" .br .ti -1c .RI "uint8 \fBgetProtocolVersion\fP () const" .br .ti -1c .RI "bool \fBisPadded\fP () const" .br .RI "Ask whether the packet contains padding bytes at the end\&. " .ti -1c .RI "uint8 \fBgetPaddingSize\fP () const" .br .RI "Get the number of octets padding the end of the payload section\&. " .ti -1c .RI "bool \fBisMarked\fP () const" .br .RI "Ask whether the packet is marked (for isntance, is a new talk spurt in some audio profiles)\&. " .ti -1c .RI "bool \fBisExtended\fP () const" .br .RI "Ask whether the packet contains header extensions\&. " .ti -1c .RI "uint16 \fBgetCSRCsCount\fP () const" .br .RI "Get the number of contributing sources specified in the packet header\&. " .ti -1c .RI "const uint32 * \fBgetCSRCs\fP () const" .br .RI "Get the 32-bit identifiers of the contributing sources for the packet as an array, of length \fBgetCSRCsCount()\fP\&. " .ti -1c .RI "uint16 \fBgetHdrExtUndefined\fP () const" .br .RI "Get the first 16 bits (in network order) of the header of the RTP header extension\&. " .ti -1c .RI "uint32 \fBgetHdrExtSize\fP () const" .br .RI "Get the length (in octets) of the data contained in the header extension\&. " .ti -1c .RI "const unsigned char * \fBgetHdrExtContent\fP () const" .br .RI "Get the content of the header extension\&. " .ti -1c .RI "const unsigned char *const \fBgetRawPacket\fP () const" .br .RI "Get the raw packet as it will be sent through the network\&. " .ti -1c .RI "uint32 \fBgetRawPacketSize\fP () const" .br .RI "Get the raw packet length, including header, extension, payload and padding\&. " .ti -1c .RI "uint32 \fBgetRawPacketSizeSrtp\fP () const" .br .ti -1c .RI "size_t \fBgetSizeOfFixedHeader\fP () const" .br .ti -1c .RI "void \fBreComputePayLength\fP (bool padding)" .br .RI "Re-compute payload length\&. " .ti -1c .RI "struct \fBRFC2833Payload\fP * \fBgetRaw2833Payload\fP (void)" .br .RI "Fetch a raw 2833 packet\&. " .ti -1c .RI "uint16 \fBget2833Duration\fP (void)" .br .RI "Fetch 2833 duration field\&. " .ti -1c .RI "void \fBset2833Duration\fP (uint16 timestamp)" .br .RI "Set 2833 duration field\&. " .in -1c .SS "Protected Member Functions" .in +1c .ti -1c .RI "virtual \fB~RTPPacket\fP ()" .br .RI "Destructor, free the buffer provided in the constructor\&. " .ti -1c .RI "void \fBendPacket\fP ()" .br .RI "Free memory allocated for the packet\&. " .ti -1c .RI "RTPFixedHeader * \fBgetHeader\fP () const" .br .RI "Return low level structure for the header of the packet\&. " .ti -1c .RI "void \fBsetExtension\fP (bool e)" .br .ti -1c .RI "const RTPHeaderExt * \fBgetHeaderExt\fP () const" .br .RI "Get a pointer to RTPHeaderExt pointing after the RTP header (fixed part plus contributing sources)\&. " .ti -1c .RI "uint32 \fBgetRawTimestamp\fP () const" .br .RI "Obtain the absolute timestamp carried in the packet header\&. " .ti -1c .RI "void \fBsetbuffer\fP (const void *src, size_t len, size_t pos)" .br .in -1c .SS "Protected Attributes" .in +1c .ti -1c .RI "uint16 \fBcachedSeqNum\fP" .br .RI "Packet sequence number in host order\&. " .ti -1c .RI "uint32 \fBcachedTimestamp\fP" .br .RI "Packet timestamp in host order (includes initial shift)\&. " .ti -1c .RI "uint32 \fBsrtpDataOffset\fP" .br .RI "Offset into packet memory pointing to area for SRTP data\&. " .ti -1c .RI "int32 \fBsrtpLength\fP" .br .RI "Lebgth of additional SRTP data\&. " .ti -1c .RI "uint32 \fBtotal\fP" .br .RI "total length, including header, payload and padding " .ti -1c .RI "uint32 \fBpayloadSize\fP" .br .RI "note: payload (not full packet) size\&. " .in -1c .SH "Detailed Description" .PP A base class for both \fBIncomingRTPPkt\fP and \fBOutgoingRTPPkt\fP\&. 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\&. .PP \fBAuthor:\fP .RS 4 David Sugar dyfet@ostel.com .RE .PP .SH "Constructor & Destructor Documentation" .PP .SS "RTPPacket::RTPPacket (const unsigned char *const block, size_t len, bool duplicate = \fCfalse\fP)" .PP Constructor, construct a packet object given the memory zone its content (header and payload) is stored\&. Commonly used to build \fBRTPPacket\fP objects from incoming data\&. .PP \fBParameters:\fP .RS 4 \fIblock\fP whole packet .br \fIlen\fP total length (header + payload + padding) of the packet .br \fIduplicate\fP whether to memcopy the packet\&. At present, this feature is not used\&. .RE .PP \fBNote:\fP .RS 4 used in \fBIncomingRTPPkt\fP\&. .RE .PP .SS "RTPPacket::RTPPacket (size_t hdrlen, size_t plen, uint8 paddinglen, \fBCryptoContext\fP * pcc = \fCNULL\fP)" .PP 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\&. .PP \fBParameters:\fP .RS 4 \fIhdrlen\fP length of the header (including CSRC and extension)\&. .br \fIplen\fP payload length\&. .br \fIpaddinglen\fP pad packet to a multiple of paddinglen .RE .PP \fBNote:\fP .RS 4 used in \fBOutgoingRTPPkt\fP\&. .RE .PP .SS "virtual RTPPacket::~RTPPacket ()\fC [inline]\fP, \fC [protected]\fP, \fC [virtual]\fP" .PP Destructor, free the buffer provided in the constructor\&. .SH "Member Function Documentation" .PP .SS "void RTPPacket::endPacket ()\fC [protected]\fP" .PP Free memory allocated for the packet\&. .SS "uint16 RTPPacket::get2833Duration (void)\fC [inline]\fP" .PP Fetch 2833 duration field\&. .PP \fBReturns:\fP .RS 4 2833 duration in native host machine byte order\&. .RE .PP .SS "const uint32* RTPPacket::getCSRCs () const\fC [inline]\fP" .PP Get the 32-bit identifiers of the contributing sources for the packet as an array, of length \fBgetCSRCsCount()\fP\&. .PP \fBReturns:\fP .RS 4 An array of CSRC identifiers as they are in the packet (in network order)\&. .RE .PP .SS "uint16 RTPPacket::getCSRCsCount () const\fC [inline]\fP" .PP Get the number of contributing sources specified in the packet header\&. .SS "const unsigned char* RTPPacket::getHdrExtContent () const\fC [inline]\fP" .PP Get the content of the header extension\&. .PP \fBReturns:\fP .RS 4 NULL if the packet has no header extension, otherwise a pointer to the packet header extension content\&. .RE .PP .SS "uint32 RTPPacket::getHdrExtSize () const\fC [inline]\fP" .PP 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\&. .PP \fBReturns:\fP .RS 4 0 if the packet has no header extension, otherwise the length\&. .RE .PP \fBNote:\fP .RS 4 0 is a valid value for this field, so \fBRTPPacket::isExtended()\fP should be used\&. .RE .PP .SS "uint16 RTPPacket::getHdrExtUndefined () const\fC [inline]\fP" .PP Get the first 16 bits (in network order) of the header of the RTP header extension\&. Its meaning is undefined at this level\&. .PP \fBReturns:\fP .RS 4 0 if the packet has no header extension, otherwise the first 16 bits of the header extension, in network order\&. .RE .PP \fBNote:\fP .RS 4 0 could be a valid value for the first 16 bits, in that case \fBRTPPacket::isExtended()\fP should be use\&. .RE .PP .SS "RTPFixedHeader* RTPPacket::getHeader () const\fC [inline]\fP, \fC [protected]\fP" .PP Return low level structure for the header of the packet\&. .PP \fBReturns:\fP .RS 4 RTPFixedHeader pointer to the header of the packet\&. .RE .PP .SS "const RTPHeaderExt* RTPPacket::getHeaderExt () const\fC [inline]\fP, \fC [protected]\fP" .PP Get a pointer to RTPHeaderExt pointing after the RTP header (fixed part plus contributing sources)\&. No check for for the X bit is done\&. .PP \fBReturns:\fP .RS 4 header extension if present, garbage if not\&. .RE .PP .SS "uint32 RTPPacket::getHeaderSize () const\fC [inline]\fP" .PP Get the length of the header, including contributing sources identifiers and header extension, if present\&. .PP \fBReturns:\fP .RS 4 number of octets\&. .RE .PP .SS "uint8 RTPPacket::getPaddingSize () const\fC [inline]\fP" .PP Get the number of octets padding the end of the payload section\&. .PP \fBReturns:\fP .RS 4 Padding length in octets\&. .RE .PP .SS "const uint8* const RTPPacket::getPayload () const\fC [inline]\fP" .PP \fBReturns:\fP .RS 4 pointer to the payload section of the packet\&. .RE .PP .SS "uint32 RTPPacket::getPayloadSize () const\fC [inline]\fP" .PP \fBReturns:\fP .RS 4 length of the payload section, in octets\&. .RE .PP .SS "\fBPayloadType\fP RTPPacket::getPayloadType () const\fC [inline]\fP" .PP \fBReturns:\fP .RS 4 value of the PT header field\&. .RE .PP .SS "uint8 RTPPacket::getProtocolVersion () const\fC [inline]\fP" .PP \fBReturns:\fP .RS 4 RTP protocol version of packet\&. .RE .PP .SS "struct \fBRFC2833Payload\fP* RTPPacket::getRaw2833Payload (void)\fC [inline]\fP" .PP Fetch a raw 2833 packet\&. .PP \fBReturns:\fP .RS 4 low level 2833 data structure\&. .RE .PP .SS "const unsigned char* const RTPPacket::getRawPacket () const\fC [inline]\fP" .PP Get the raw packet as it will be sent through the network\&. .PP \fBReturns:\fP .RS 4 memory zone where the raw packet structure is stored in\&. .RE .PP .SS "uint32 RTPPacket::getRawPacketSize () const\fC [inline]\fP" .PP Get the raw packet length, including header, extension, payload and padding\&. .PP \fBReturns:\fP .RS 4 size of the raw packet structure\&. .RE .PP .SS "uint32 RTPPacket::getRawPacketSizeSrtp () const\fC [inline]\fP" .SS "uint32 RTPPacket::getRawTimestamp () const\fC [inline]\fP, \fC [protected]\fP" .PP Obtain the absolute timestamp carried in the packet header\&. .PP \fBReturns:\fP .RS 4 32-bit timestamp in host order\&. .RE .PP .SS "uint16 RTPPacket::getSeqNum () const\fC [inline]\fP" .PP \fBReturns:\fP .RS 4 value of the sequence number header field, in host order\&. .RE .PP .SS "size_t RTPPacket::getSizeOfFixedHeader () const\fC [inline]\fP" .SS "uint32 RTPPacket::getTimestamp () const\fC [inline]\fP" .PP \fBReturns:\fP .RS 4 packet timestamp in host order\&. .RE .PP .SS "bool RTPPacket::isExtended () const\fC [inline]\fP" .PP Ask whether the packet contains header extensions\&. .PP \fBReturns:\fP .RS 4 true if the header extension bit is 1\&. .RE .PP .SS "bool RTPPacket::isMarked () const\fC [inline]\fP" .PP Ask whether the packet is marked (for isntance, is a new talk spurt in some audio profiles)\&. .PP \fBReturns:\fP .RS 4 true is the header marker bit is 1\&. .RE .PP .SS "bool RTPPacket::isPadded () const\fC [inline]\fP" .PP Ask whether the packet contains padding bytes at the end\&. .PP \fBReturns:\fP .RS 4 true if the header padding bit is 1\&. .RE .PP .SS "void RTPPacket::reComputePayLength (bool padding)" .PP 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 \fCtakeInDataPacket\fP in \fCincqueue\&.cpp\fP .PP \fBParameters:\fP .RS 4 \fIpadding\fP If true then set padding flag in RTP header and re-compute payloadSize\&. .RE .PP .SS "void RTPPacket::set2833Duration (uint16 timestamp)\fC [inline]\fP" .PP Set 2833 duration field\&. .PP \fBParameters:\fP .RS 4 \fItimestamp\fP to use, native host machine byte order\&. .RE .PP .SS "void RTPPacket::setbuffer (const void * src, size_t len, size_t pos)\fC [inline]\fP, \fC [protected]\fP" .SS "void RTPPacket::setExtension (bool e)\fC [inline]\fP, \fC [protected]\fP" .SH "Member Data Documentation" .PP .SS "uint16 RTPPacket::cachedSeqNum\fC [protected]\fP" .PP Packet sequence number in host order\&. .SS "uint32 RTPPacket::cachedTimestamp\fC [protected]\fP" .PP Packet timestamp in host order (includes initial shift)\&. .SS "uint32 RTPPacket::payloadSize\fC [protected]\fP" .PP note: payload (not full packet) size\&. .SS "uint32 RTPPacket::srtpDataOffset\fC [protected]\fP" .PP 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\&. .SS "int32 RTPPacket::srtpLength\fC [protected]\fP" .PP Lebgth of additional SRTP data\&. Covers the SRTP authentication and MKI data\&. .SS "uint32 RTPPacket::total\fC [protected]\fP" .PP total length, including header, payload and padding .SH "Author" .PP Generated automatically by Doxygen for ccRTP from the source code\&.