ccRTP 2.1.2
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes
IncomingRTPPkt Class Reference
RTP data packets manipulation.

RTP packets received from other participants. More...

#include <rtppkt.h>

Inheritance diagram for IncomingRTPPkt:
Inheritance graph
[legend]
Collaboration diagram for IncomingRTPPkt:
Collaboration graph
[legend]

Public Member Functions

  IncomingRTPPkt (const unsigned char *block, size_t len)
  Build an RTP packet object from a data buffer. More...
 
 
bool  isHeaderValid ()
  Get validity of this packet. More...
 
uint32  getSSRC () const
  Get synchronization source numeric identifier. More...
 
int32  unprotect (CryptoContext *pcc)
  Unprotect a received packet. More...
 
bool  operator== (const IncomingRTPPkt &p) const
  Two incoming packets are equal if they come from sources with the same SSRC and have the same sequence number. More...
 
bool  operator!= (const IncomingRTPPkt &p) const
  Two incoming packets are not equal if they come from different sources or have different sequence numbers. 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...
 

Private Attributes

bool  headerValid
  Header validity, checked at construction time. More...
 
uint32  cachedSSRC
  SSRC 32-bit identifier in host order. More...
 

Static Private Attributes

static const uint16  RTP_INVALID_PT_MASK = (0x7e)
 
static const uint16  RTP_INVALID_PT_VALUE = (0x48)
 

Detailed Description

RTP packets received from other participants.

This class is intented to construct a packet object just after every packet is received by the scheduled queue, so that they are processed in an 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 704 of file rtppkt.h.

Constructor & Destructor Documentation

IncomingRTPPkt::IncomingRTPPkt ( const unsigned char *  block,
size_t  len 
)

Build an RTP packet object from a data buffer.

This constructor first performs a generic RTP data packet header check, whose result can be checked via isHeaderValid().

Parameters
block pointer to the buffer the whole packet is stored in.
len length of the whole packet, expressed in octets.
Note
If check fails, the packet object is incomplete. checking isHeaderValid() is recommended before using a new RTPPacket object.

Definition at line 272 of file rtppkt.cpp.

IncomingRTPPkt::~IncomingRTPPkt ( )
inline

Definition at line 721 of file rtppkt.h.

IncomingRTPPkt::IncomingRTPPkt ( const IncomingRTPPktip )
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.

Definition at line 167 of file rtppkt.cpp.

uint16 RTPPacket::get2833Duration ( void  )
inlineinherited

Fetch 2833 duration field.

Returns
2833 duration in native host machine byte order.

Definition at line 485 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 212 of file rtppkt.h.

uint16 RTPPacket::getCSRCsCount ( ) const
inlineinherited

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

Definition at line 201 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 255 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 243 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 228 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 321 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 336 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 114 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 174 of file rtppkt.h.

const uint8* const RTPPacket::getPayload ( ) const
inlineinherited
Returns
pointer to the payload section of the packet.

Definition at line 121 of file rtppkt.h.

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

Definition at line 128 of file rtppkt.h.

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

Definition at line 135 of file rtppkt.h.

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

Definition at line 156 of file rtppkt.h.

struct RFC2833Payload* RTPPacket::getRaw2833Payload ( void  )
inlineinherited

Fetch a raw 2833 packet.

Returns
low level 2833 data structure.

Definition at line 477 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 268 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 278 of file rtppkt.h.

uint32 RTPPacket::getRawPacketSizeSrtp ( ) const
inlineinherited

Definition at line 282 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 348 of file rtppkt.h.

uint16 RTPPacket::getSeqNum ( ) const
inlineinherited
Returns
value of the sequence number header field, in host order.

Definition at line 142 of file rtppkt.h.

size_t RTPPacket::getSizeOfFixedHeader ( ) const
inlineinherited

Definition at line 286 of file rtppkt.h.

uint32 IncomingRTPPkt::getSSRC ( ) const
inline

Get synchronization source numeric identifier.

Returns
32-bits Synchronization SouRCe numeric identifier, in host order.

Definition at line 740 of file rtppkt.h.

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

Definition at line 149 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 193 of file rtppkt.h.

bool IncomingRTPPkt::isHeaderValid ( )
inline

Get validity of this packet.

Returns
whether the header check performed at construction time ended successfully.

Definition at line 730 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 184 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 164 of file rtppkt.h.

bool IncomingRTPPkt::operator!= ( const IncomingRTPPktp ) const
inline

Two incoming packets are not equal if they come from different sources or have different sequence numbers.

Definition at line 770 of file rtppkt.h.

IncomingRTPPkt& IncomingRTPPkt::operator= ( const IncomingRTPPktip )
private

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

bool IncomingRTPPkt::operator== ( const IncomingRTPPktp ) const
inline

Two incoming packets are equal if they come from sources with the same SSRC and have the same sequence number.

Definition at line 761 of file rtppkt.h.

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.

Definition at line 178 of file rtppkt.cpp.

void RTPPacket::set2833Duration ( uint16  timestamp )
inlineinherited

Set 2833 duration field.

Parameters
timestamp to use, native host machine byte order.

Definition at line 493 of file rtppkt.h.

void RTPPacket::setbuffer ( const void *  src,
size_t  len,
size_t  pos 
)
inlineprotectedinherited

Definition at line 352 of file rtppkt.h.

void RTPPacket::setExtension ( bool  e )
inlineprotectedinherited

Definition at line 325 of file rtppkt.h.

int32 IncomingRTPPkt::unprotect ( CryptoContextpcc )

Unprotect a received packet.

Perform SRTP processing on this packet.

Parameters
pcc Pointer to SRTP CryptoContext.
Returns
one if no errors, -1 if authentication failed, -2 if replay check failed

Definition at line 294 of file rtppkt.cpp.

Field Documentation

uint16 RTPPacket::cachedSeqNum
protectedinherited

Packet sequence number in host order.

Definition at line 356 of file rtppkt.h.

uint32 IncomingRTPPkt::cachedSSRC
private

SSRC 32-bit identifier in host order.

Definition at line 790 of file rtppkt.h.

uint32 RTPPacket::cachedTimestamp
protectedinherited

Packet timestamp in host order (includes initial shift).

Definition at line 358 of file rtppkt.h.

bool IncomingRTPPkt::headerValid
private

Header validity, checked at construction time.

Definition at line 788 of file rtppkt.h.

uint32 RTPPacket::payloadSize
protectedinherited

note: payload (not full packet) size.

Definition at line 379 of file rtppkt.h.

const uint16 IncomingRTPPkt::RTP_INVALID_PT_MASK = (0x7e)
staticprivate

Definition at line 794 of file rtppkt.h.

const uint16 IncomingRTPPkt::RTP_INVALID_PT_VALUE = (0x48)
staticprivate

Definition at line 795 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 366 of file rtppkt.h.

int32 RTPPacket::srtpLength
protectedinherited

Lebgth of additional SRTP data.

Covers the SRTP authentication and MKI data.

Definition at line 373 of file rtppkt.h.

uint32 RTPPacket::total
protectedinherited

total length, including header, payload and padding

Definition at line 376 of file rtppkt.h.


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

Generated on Dec 15, 2017 for ccrtp-2.1.2 (*.h and *.cpp) and libzrtpcpp-2.3.4 (*.h), by   doxygen 1.8.6

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