RTPPacket(3)

πŸ“¦
version 2.0.9 Β· 4 versions
, in debian trixie, ubuntu noble, ubuntu questing

πŸ’– NAME πŸ’–

okay so bestie, this is RTPPacket(3) from the Library Functions Manual. RTPPacket is a base class for both IncomingRTPPkt and OutgoingRTPPkt. periodt. πŸ’…


✨ SYNOPSIS ✨

#include <rtppkt.h>

Inherited by IncomingRTPPkt, and OutgoingRTPPkt.

πŸŽ€ Classes πŸŽ€

  • struct RFC2833Payload β€” a structure defining RFC2833 Telephony events.

πŸ‘‘ Public Member Functions πŸ‘‘

  • 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.
  • RTPPacket (size_t hdrlen, size_t plen, uint8 paddinglen, CryptoContext *pcc=NULL) β€” Construct a packet object without specifying its real content yet.
  • uint32 getHeaderSize () const β€” Get the length of the header, including contributing sources identifiers and header extension, if present.
  • const uint8 *const getPayload () const β€” just the signature, no extra lore in the manual.
  • uint32 getPayloadSize () const β€” just the signature.
  • PayloadType getPayloadType () const β€” just the signature.
  • uint16 getSeqNum () const β€” just the signature.
  • uint32 getTimestamp () const β€” just the signature.
  • uint8 getProtocolVersion () const β€” just the signature.
  • bool isPadded () const β€” Ask whether the packet contains padding bytes at the end.
  • uint8 getPaddingSize () const β€” Get the number of octets padding the end of the payload section.
  • bool isMarked () const β€” Ask whether the packet is marked (for isntance, is a new talk spurt in some audio profiles).
  • bool isExtended () const β€” Ask whether the packet contains header extensions.
  • uint16 getCSRCsCount () const β€” Get the number of contributing sources specified 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().
  • uint16 getHdrExtUndefined () const β€” Get the first 16 bits (in network order) of the header of the RTP header extension.
  • uint32 getHdrExtSize () const β€” Get the length (in octets) of the data contained in the header extension.
  • const unsigned char * getHdrExtContent () const β€” Get the content of the header extension.
  • const unsigned char *const getRawPacket () const β€” Get the raw packet as it will be sent through the network.
  • uint32 getRawPacketSize () const β€” Get the raw packet length, including header, extension, payload and padding.
  • uint32 getRawPacketSizeSrtp () const β€” just the signature.
  • size_t getSizeOfFixedHeader () const β€” just the signature.
  • void reComputePayLength (bool padding) β€” Re-compute payload length.
  • struct RFC2833Payload * getRaw2833Payload (void) β€” Fetch a raw 2833 packet.
  • uint16 get2833Duration (void) β€” Fetch 2833 duration field.
  • void set2833Duration (uint16 timestamp) β€” Set 2833 duration field.

πŸ”’ Protected Member Functions πŸ”’

  • virtual ~RTPPacket () β€” Destructor, free the buffer provided in the constructor.
  • void endPacket () β€” Free memory allocated for the packet.
  • RTPFixedHeader * getHeader () const β€” Return low level structure for the header of the packet.
  • void setExtension (bool e) β€” just the signature.
  • const RTPHeaderExt * getHeaderExt () const β€” Get a pointer to RTPHeaderExt pointing after the RTP header (fixed part plus contributing sources).
  • uint32 getRawTimestamp () const β€” Obtain the absolute timestamp carried in the packet header.
  • void setbuffer (const void *src, size_t len, size_t pos) β€” just the signature.

🧚 Protected Attributes 🧚

  • uint16 cachedSeqNum β€” Packet sequence number in host order.
  • uint32 cachedTimestamp β€” Packet timestamp in host order (includes initial shift).
  • uint32 srtpDataOffset β€” Offset into packet memory pointing to area for SRTP data.
  • int32 srtpLength β€” Lebgth of additional SRTP data. (yes bestie, β€œLebgth” is literally in the source, we keep it πŸ’€)
  • uint32 total β€” total length, including header, payload and padding
  • uint32 payloadSize β€” note: payload (not full packet) size.

🌈 Detailed Description 🌈

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@ostel.com


πŸŽ€ Constructor & Destructor Documentation πŸŽ€

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 () [inline], [protected], [virtual]

Destructor, free the buffer provided in the constructor.


πŸ’– Member Function Documentation πŸ’–

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.

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).

uint16 RTPPacket::getCSRCsCount () const [inline]

Get the number of contributing sources specified in the packet header.

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.

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.

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.

RTPFixedHeader * RTPPacket::getHeader () const [inline], [protected]

Return low level structure for the header of the packet.

Returns

RTPFixedHeader pointer to the header of the packet.

const RTPHeaderExt * RTPPacket::getHeaderExt () const [inline], [protected]

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.

uint32 RTPPacket::getHeaderSize () const [inline]

Get the length of the header, including contributing sources identifiers and header extension, if present.

Returns

number of octets.

uint8 RTPPacket::getPaddingSize () const [inline]

Get the number of octets padding the end of the payload section.

Returns

Padding length in octets.

const uint8 *const RTPPacket::getPayload () const [inline]

Returns

pointer to the payload section of the packet.

uint32 RTPPacket::getPayloadSize () const [inline]

Returns

length of the payload section, in octets.

PayloadType RTPPacket::getPayloadType () const [inline]

Returns

value of the PT header field.

uint8 RTPPacket::getProtocolVersion () const [inline]

Returns

RTP protocol version of packet.

struct RFC2833Payload * RTPPacket::getRaw2833Payload (void) [inline]

Fetch a raw 2833 packet.

Returns

low level 2833 data structure.

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.

uint32 RTPPacket::getRawPacketSize () const [inline]

Get the raw packet length, including header, extension, payload and padding.

Returns

size of the raw packet structure.

uint32 RTPPacket::getRawPacketSizeSrtp () const [inline]

just the signature, bestie.

uint32 RTPPacket::getRawTimestamp () const [inline], [protected]

Obtain the absolute timestamp carried in the packet header.

Returns

32-bit timestamp in host order.

uint16 RTPPacket::getSeqNum () const [inline]

Returns

value of the sequence number header field, in host order.

size_t RTPPacket::getSizeOfFixedHeader () const [inline]

just the signature.

uint32 RTPPacket::getTimestamp () const [inline]

Returns

packet timestamp in host order.

bool RTPPacket::isExtended () const [inline]

Ask whether the packet contains header extensions.

Returns

true if the header extension bit is 1.

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.

bool RTPPacket::isPadded () const [inline]

Ask whether the packet contains padding bytes at the end.

Returns

true if the header padding bit is 1.

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.

void RTPPacket::setbuffer (const void *src, size_t len, size_t pos) [inline], [protected]

just the signature.

void RTPPacket::setExtension (bool e) [inline], [protected]

just the signature.

πŸ’– Member Data Documentation πŸ’–

Okay bestie, now we're in the protected data members β€” the backstage pass holders of RTPPacket. Every single one is listed, no skips, no cap. ✨


uint16 RTPPacket::cachedSeqNum [protected]

Packet sequence number in host order. That's the whole vibe: sequence number, cached, host order. Slay. πŸ’…

uint32 RTPPacket::cachedTimestamp [protected]

Packet timestamp in host order (includes initial shift). Yes, the initial shift is included β€” don't forget that part, bestie. 🫢

uint32 RTPPacket::payloadSize [protected]

note: payload (not full packet) size. So it's the payload size, not the full packet size. Important distinction. Periodt. πŸ’–

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. Iconic memory-address behavior, fr fr. 🌸

int32 RTPPacket::srtpLength [protected]

Lebgth of additional SRTP data. Covers the SRTP authentication and MKI data. (Yes, it says "Lebgth" β€” we are preserving that exactly as the source wrote it. πŸ’€)

uint32 RTPPacket::total [protected]

total length, including header, payload and padding. All the things: header, payload, padding. The full package. πŸ‘‘


🌸 Author 🌸

Generated automatically by Doxygen for ccRTP from the source code. So yeah, Doxygen did that, for ccRTP, straight from the source. No notes. ✨


And for the footer, bestie: source/version is ccRTP, manual page is RTPPacket(3), and the date is not shown in the footer β€” so we're keeping it mysterious and timeless. Bye bestie! πŸ’…πŸŒˆπŸŽ€

πŸ“¦ where this page comes from