---
name: "IncomingRTPPkt"
section: "3"
platform: "linux"
package: "libccrtp-doc"
version: "2.0.9-4.1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/IncomingRTPPkt"
---

# IncomingRTPPkt(3)

RTP packets received from other participants.

## NAME

IncomingRTPPkt - RTP packets received from other participants.

## SYNOPSIS

`#include <rtppkt.h>`

Inherits **RTPPacket**.

### Public Member Functions

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

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 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 fedemp@altern.org

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

### IncomingRTPPkt::~IncomingRTPPkt ()` [inline]`

## Member Function Documentation

### uint32 IncomingRTPPkt::getSSRC () const` [inline]`

Get synchronization source numeric identifier.

**Returns**

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

### bool IncomingRTPPkt::isHeaderValid ()` [inline]`

Get validity of this packet.

**Returns**

whether the header check performed at construction time ended successfully.

### bool IncomingRTPPkt::operator!= (const IncomingRTPPkt & p) const` [inline]`

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

### bool IncomingRTPPkt::operator== (const IncomingRTPPkt & p) const` [inline]`

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

### int32 IncomingRTPPkt::unprotect (CryptoContext \* pcc)

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

## Author

Generated automatically by Doxygen for ccRTP from the source code.
