OutgoingRTPPkt Class Reference
RTP data packets manipulation.

RTP packets being sent. More...

`#include <rtppkt.h>`

Inheritance diagram for OutgoingRTPPkt:
[legend]
Collaboration diagram for OutgoingRTPPkt:
[legend]

## Public Member Functions

| 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.
| OutgoingRTPPkt (const uint32 *const csrcs, uint16 numcsrc, 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 and payload.
| OutgoingRTPPkt (const unsigned char *const data, size_t datalen, uint8 paddinglen=0, CryptoContext *pcc=NULL)
| Construct a new packet (fast variant, with no contributing sources and no header extension) to be sent.
| ~OutgoingRTPPkt ()
void | setPayloadType (PayloadType pt)
void | setSeqNum (uint16 seq)
void | setTimestamp (uint32 pts)
void | setSSRC (uint32 ssrc) const
| Set synchronization source numeric identifier.
void | setSSRCNetwork (uint32 ssrc) const
| Set synchronization source numeric identifier.
void | setMarker (bool mark)
| Specify the value of the marker bit.
void | protect (uint32 ssrc, CryptoContext *pcc)
| Called packet is setup.
bool | operator== (const OutgoingRTPPkt &p) const
| Outgoing packets are equal if their sequence numbers match.
bool | operator!= (const OutgoingRTPPkt &p) const
| Outgoing packets are not equal if their sequence numbers differ.
Public Member Functions inherited from 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.
| 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
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.
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
size_t | getSizeOfFixedHeader () const
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.

## Additional Inherited Members

Protected Member Functions inherited from RTPPacket
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)
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)
Protected Attributes inherited from RTPPacket
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.
uint32 | total
| total length, including header, payload and padding
uint32 | payloadSize
| note: payload (not full packet) size.

## Detailed Description

RTP packets being sent.

This class is intented to construct packet objects just before they are inserted into the sending queue, so that they are processed in a understandable and format independent manner inside the stack.

Author
  Federico Montesino Pouzols fedem.nosp@m.p@al.nosp@m.tern..nosp@m.org

## Constructor & Destructor Documentation

## OutgoingRTPPkt() [1/3]

OutgoingRTPPkt::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.

    A new copy in memory (holding all this components

along with the fixed header) is created. If the pointer to the SRTP CryptoContext is not NULL and holds a CryptoContext for the SSRC take the SSRC data into account when computing the required memory buffer.

Parameters

  csrcs | array of countributing source 32-bit identifiers, in host order.
  numcsrc | number of CSRC identifiers in the array.
  hdrext | whole header extension.
  hdrextlen | size of whole header extension, in octets.
  data | payload.
  datalen | payload length, in octets.
  paddinglen | pad packet to a multiple of paddinglen.
  pcc | Pointer to the SRTP CryptoContext, defaults to NULL if not specified.

Note
  For efficiency purposes, since this constructor is valid for all packets but is too complex for the common case, two simpler others are provided.

## OutgoingRTPPkt() [2/3]

OutgoingRTPPkt::OutgoingRTPPkt | ( | const uint32 *const | csrcs,
|  | uint16 | numcsrc,
|  | 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 and payload.

    A new copy in

memory (holding all this components along with the fixed header) is created. If the pointer to the SRTP CryptoContext is not NULL and holds a CryptoContext for the SSRC take the SSRC data into account when computing the required memory buffer.

Parameters

  csrcs | array of countributing source 32-bit identifiers, in host order.
  numcsrc | number of CSRC identifiers in the array.
  data | payload.
  datalen | payload length, in octets.
  paddinglen | pad packet to a multiple of paddinglen.
  pcc | Pointer to the SRTP CryptoContext, defaults to NULL if not specified.

## OutgoingRTPPkt() [3/3]

OutgoingRTPPkt::OutgoingRTPPkt | ( | const unsigned char *const | data,
|  | size_t | datalen,
|  | uint8 | paddinglen = `0`,
|  | CryptoContext * | pcc = `NULL`
| ) |  |

Construct a new packet (fast variant, with no contributing sources and no header extension) to be sent.

    A new copy in
    memory (holding the whole packet) is created. If the pointer
    to the SRTP CryptoContext is not NULL and holds a CryptoContext
    for the SSRC take the SSRC data into account when computing
    the required memory buffer.

Parameters

  data | payload.
  datalen | payload length, in octets.
  paddinglen | pad packet to a multiple of paddinglen.
  pcc | Pointer to the SRTP CryptoContext, defaults to NULL if not specified.

## ~OutgoingRTPPkt()

OutgoingRTPPkt::~OutgoingRTPPkt | ( |  | ) |

inline

## Member Function Documentation

## operator!=()

bool OutgoingRTPPkt::operator!= | ( | const OutgoingRTPPkt & | p | ) | const

inline

Outgoing packets are not equal if their sequence numbers differ.

## operator==()

bool OutgoingRTPPkt::operator== | ( | const OutgoingRTPPkt & | p | ) | const

inline

Outgoing packets are equal if their sequence numbers match.

## protect()

void OutgoingRTPPkt::protect | ( | uint32 | ssrc,
|  | CryptoContext * | pcc
| ) |  |

Called packet is setup.

This private method computes the SRTP data and stores it in the packet. Then encrypt the payload data (ex padding).

## setMarker()

void OutgoingRTPPkt::setMarker | ( | bool | mark | ) |

inline

Specify the value of the marker bit.

By default, the marker bit of outgoing packets is false/0. This method allows one to explicity specify and change that value.

Parameters

  mark | value for the market bit.

## setPayloadType()

void OutgoingRTPPkt::setPayloadType | ( | PayloadType | pt | ) |

inline

Parameters

  pt | Packet payload type.

## setSeqNum()

void OutgoingRTPPkt::setSeqNum | ( | uint16 | seq | ) |

inline

    Sets the sequence number in the header.

Parameters

  seq | Packet sequence number, in host order.

## setSSRC()

void OutgoingRTPPkt::setSSRC | ( | uint32 | ssrc | ) | const

inline

Set synchronization source numeric identifier.

Parameters

  ssrc | 32-bit Synchronization SouRCe numeric identifier, in host order.

## setSSRCNetwork()

void OutgoingRTPPkt::setSSRCNetwork | ( | uint32 | ssrc | ) | const

inline

Set synchronization source numeric identifier.

Special version to save endianness conversion.

Parameters

  ssrc | 32-bit Synchronization SouRCe numeric identifier, in network order.

## setTimestamp()

void OutgoingRTPPkt::setTimestamp | ( | uint32 | pts | ) |

inline

Parameters

  pts | Packet timestamp, in host order.

The documentation for this class was generated from the following file:

- rtppkt.h