Bayonne2 / Common C++ 2 Framework
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
OutgoingRTPPkt Class Reference
RTP data packets manipulation.

RTP packets being sent. More...

#include <rtppkt.h>

Inheritance diagram for OutgoingRTPPkt:
Inheritance graph
[legend]
Collaboration diagram for OutgoingRTPPkt:
Collaboration graph
[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. More...
 
  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. More...
 
  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. More...
 
 
 
void  setSeqNum (uint16 seq)
  Sets the sequence number in the header. More...
 
void  setTimestamp (uint32 pts)
 
void  setSSRC (uint32 ssrc) const
  Set synchronization source numeric identifier. More...
 
void  setSSRCNetwork (uint32 ssrc) const
  Set synchronization source numeric identifier. More...
 
void  setMarker (bool mark)
  Specify the value of the marker bit. More...
 
void  protect (uint32 ssrc, CryptoContext *pcc)
  Called packet is setup. More...
 
bool  operator== (const OutgoingRTPPkt &p) const
  Outgoing packets are equal if their sequence numbers match. More...
 
bool  operator!= (const OutgoingRTPPkt &p) const
  Outgoing packets are not equal if their sequence numbers differ. 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
 
 
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...
 
  Fetch a raw 2833 packet. More...
 
uint16  get2833Duration (void)
  Fetch 2833 duration field. More...
 
void  set2833Duration (uint16 timestamp)
  Set 2833 duration field. More...
 

Protected Member Functions

void  endPacket ()
  Free memory allocated for the packet. More...
 
RTPFixedHeadergetHeader () const
  Return low level structure for the header of the packet. More...
 
void  setExtension (bool e)
 
const RTPHeaderExtgetHeaderExt () const
  Get a pointer to RTPHeaderExt pointing after the RTP header (fixed part plus contributing sources). More...
 
uint32  getRawTimestamp () const
  Obtain the absolute timestamp carried in the packet header. More...
 
void  setbuffer (const void *src, size_t len, size_t pos)
 

Protected Attributes

uint16  cachedSeqNum
  Packet sequence number in host order. More...
 
uint32  cachedTimestamp
  Packet timestamp in host order (includes initial shift). More...
 
uint32  srtpDataOffset
  Offset into packet memory pointing to area for SRTP data. More...
 
int32  srtpLength
  Lebgth of additional SRTP data. More...
 
uint32  total
  total length, including header, payload and padding More...
 
uint32  payloadSize
  note: payload (not full packet) size. More...
 

Private Member Functions

  Copy constructor from objects of its same kind, declared private to avoid its use. More...
 
  Assignment operator from objects of its same kind, declared private to avoid its use. More...
 
void  setCSRCArray (const uint32 *const csrcs, uint16 numcsrc)
  Set the list of CSRC identifiers in an RTP packet, switching host to network order. More...
 

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

Definition at line 510 of file rtppkt.h.

Constructor & Destructor Documentation

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,
CryptoContextpcc = 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::OutgoingRTPPkt ( const uint32 *const  csrcs,
uint16  numcsrc,
const unsigned char *const  data,
size_t  datalen,
uint8  paddinglen = 0,
CryptoContextpcc = 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::OutgoingRTPPkt ( const unsigned char *const  data,
size_t  datalen,
uint8  paddinglen = 0,
CryptoContextpcc = 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 ( )
inline

Definition at line 587 of file rtppkt.h.

OutgoingRTPPkt::OutgoingRTPPkt ( const OutgoingRTPPkto )
private

Copy constructor from objects of its same kind, declared private to avoid its use.

Member Function Documentation

void RTPPacket::endPacket ( )
protectedinherited

Free memory allocated for the packet.

uint16 RTPPacket::get2833Duration ( void  )
inlineinherited

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
inlineinherited

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
inlineinherited

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
inlineinherited

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
inlineinherited

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
inlineinherited

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.

RTPFixedHeader* RTPPacket::getHeader ( ) const
inlineprotectedinherited

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.

const RTPHeaderExt* RTPPacket::getHeaderExt ( ) const
inlineprotectedinherited

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
inlineinherited

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
inlineinherited

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
inlineinherited
Returns
pointer to the payload section of the packet.

Definition at line 124 of file rtppkt.h.

uint32 RTPPacket::getPayloadSize ( ) const
inlineinherited
Returns
length of the payload section, in octets.

Definition at line 131 of file rtppkt.h.

PayloadType RTPPacket::getPayloadType ( ) const
inlineinherited
Returns
value of the PT header field.

Definition at line 138 of file rtppkt.h.

uint8 RTPPacket::getProtocolVersion ( ) const
inlineinherited
Returns
RTP protocol version of packet.

Definition at line 159 of file rtppkt.h.

struct RFC2833Payload* RTPPacket::getRaw2833Payload ( void  )
inlineinherited

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
inlineinherited

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
inlineinherited

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
inlineinherited

Definition at line 285 of file rtppkt.h.

uint32 RTPPacket::getRawTimestamp ( ) const
inlineprotectedinherited

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
inlineinherited
Returns
value of the sequence number header field, in host order.

Definition at line 145 of file rtppkt.h.

size_t RTPPacket::getSizeOfFixedHeader ( ) const
inlineinherited

Definition at line 289 of file rtppkt.h.

uint32 RTPPacket::getTimestamp ( ) const
inlineinherited
Returns
packet timestamp in host order.

Definition at line 152 of file rtppkt.h.

bool RTPPacket::isExtended ( ) const
inlineinherited

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
inlineinherited

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
inlineinherited

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.

bool OutgoingRTPPkt::operator!= ( const OutgoingRTPPktp ) const
inline

Outgoing packets are not equal if their sequence numbers differ.

Definition at line 670 of file rtppkt.h.

OutgoingRTPPkt& OutgoingRTPPkt::operator= ( const OutgoingRTPPkto )
private

Assignment operator from objects of its same kind, declared private to avoid its use.

bool OutgoingRTPPkt::operator== ( const OutgoingRTPPktp ) const
inline

Outgoing packets are equal if their sequence numbers match.

Definition at line 663 of file rtppkt.h.

void OutgoingRTPPkt::protect ( uint32  ssrc,
CryptoContextpcc 
)

Called packet is setup.

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

void RTPPacket::reComputePayLength ( bool  padding )
inherited

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

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

Definition at line 355 of file rtppkt.h.

void OutgoingRTPPkt::setCSRCArray ( const uint32 *const  csrcs,
uint16  numcsrc 
)
private

Set the list of CSRC identifiers in an RTP packet, switching host to network order.

void RTPPacket::setExtension ( bool  e )
inlineprotectedinherited

Definition at line 328 of file rtppkt.h.

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 to explicity specify and change that value.

Parameters
mark value for the market bit.

Definition at line 648 of file rtppkt.h.

void OutgoingRTPPkt::setPayloadType ( PayloadType  pt )
inline
Parameters
pt Packet payload type.

Definition at line 594 of file rtppkt.h.

void OutgoingRTPPkt::setSeqNum ( uint16  seq )
inline

Sets the sequence number in the header.

Parameters
seq Packet sequence number, in host order.

Definition at line 603 of file rtppkt.h.

void OutgoingRTPPkt::setSSRC ( uint32  ssrc ) const
inline

Set synchronization source numeric identifier.

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

Definition at line 626 of file rtppkt.h.

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.

Definition at line 637 of file rtppkt.h.

void OutgoingRTPPkt::setTimestamp ( uint32  pts )
inline
Parameters
pts Packet timestamp, in host order.

Definition at line 613 of file rtppkt.h.

Field Documentation

uint16 RTPPacket::cachedSeqNum
protectedinherited

Packet sequence number in host order.

Definition at line 359 of file rtppkt.h.

uint32 RTPPacket::cachedTimestamp
protectedinherited

Packet timestamp in host order (includes initial shift).

Definition at line 361 of file rtppkt.h.

uint32 RTPPacket::payloadSize
protectedinherited

note: payload (not full packet) size.

Definition at line 382 of file rtppkt.h.

uint32 RTPPacket::srtpDataOffset
protectedinherited

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
protectedinherited

Lebgth of additional SRTP data.

Covers the SRTP authentication and MKI data.

Definition at line 376 of file rtppkt.h.

uint32 RTPPacket::total
protectedinherited

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:

Generated on Dec 21, 2017 for commoncpp2-1.8.1, ccrtp-1.7.2, libzrtpcpp-2.3.4, ccscript3-1.1.7, ccaudio2-1.0.0 and bayonne2-2.3.2 (after installation in /usr/local/) by   doxygen 1.8.6

AltStyle によって変換されたページ (->オリジナル) /