Class RawPacket
When using a TransformConnector, a RTP/RTCP packet is represented using RawPacket. RawPacket stores the buffer holding the RTP/RTCP packet, as well as the inner offset and length of RTP/RTCP packet data.
After transformation, data is also stored in RawPacket objects, either the original RawPacket (in place transformation), or a newly created RawPacket.
Inherited Members
Namespace: SipLib.Dtls
Assembly: SipLib.dll
Syntax
public class RawPacket
Constructors
| Edit this page View SourceRawPacket()
Initializes a new empty RawPacket instance.
Declaration
public RawPacket()
RawPacket(byte[], int, int)
Initializes a new RawPacket instance with a specific byte array buffer.
Declaration
public RawPacket(byte[] data, int offset, int length)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | data | The byte array to be the buffer of the new instance |
| int | offset | The offset in buffer at which the actual data to be represented by the new instance starts |
| int | length | The number of bytes in buffer which constitute the actual data to be represented by the new instance |
Fields
| Edit this page View SourceEXT_HEADER_SIZE
The size of the extension header as defined by RFC 3550.
Declaration
public const int EXT_HEADER_SIZE = 4
Field Value
| Type | Description |
|---|---|
| int |
FIXED_HEADER_SIZE
The size of the fixed part of the RTP header as defined by RFC 3550.
Declaration
public const int FIXED_HEADER_SIZE = 12
Field Value
| Type | Description |
|---|---|
| int |
RTP_PACKET_MAX_SIZE
Maximum RTP packet size
Declaration
public const int RTP_PACKET_MAX_SIZE = 8192
Field Value
| Type | Description |
|---|---|
| int |
Methods
| Edit this page View SourceAppend(byte[], int)
Append a byte array to the end of the packet. This may change the data buffer of this packet.
Declaration
public void Append(byte[] data, int len)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | data | Data byte array to append |
| int | len | The number of bytes to append |
GetBuffer()
Gets the buffer containing the content of this packet
Declaration
public MemoryStream GetBuffer()
Returns
| Type | Description |
|---|---|
| MemoryStream |
GetCsrcCount()
Returns the number of CSRC identifiers currently included in this packet.
Declaration
public int GetCsrcCount()
Returns
| Type | Description |
|---|---|
| int |
GetData()
Gets the data in the RawPacket
Declaration
public byte[] GetData()
Returns
| Type | Description |
|---|---|
| byte[] | Returns a byte array containing the data. |
GetExtensionBit()
Returns true if the extension bit of this packet has been set and false otherwise.
Declaration
public bool GetExtensionBit()
Returns
| Type | Description |
|---|---|
| bool |
GetExtensionLength()
Returns the length of the extensions currently added to this packet.
Declaration
public int GetExtensionLength()
Returns
| Type | Description |
|---|---|
| int |
GetHeaderLength()
Gets RTP header length from a RTP packet
Declaration
public int GetHeaderLength()
Returns
| Type | Description |
|---|---|
| int |
GetLength()
Get the length of this packet's data
Declaration
public int GetLength()
Returns
| Type | Description |
|---|---|
| int |
GetPaddingSize()
Get RTP padding size from a RTP packet
Declaration
public int GetPaddingSize()
Returns
| Type | Description |
|---|---|
| int |
GetPayload()
Gets the RTP payload (bytes) of this RTP packet.
Declaration
public byte[]? GetPayload()
Returns
| Type | Description |
|---|---|
| byte[] |
GetPayloadLength()
Gets the RTP payload length from a RTP packet
Declaration
public int GetPayloadLength()
Returns
| Type | Description |
|---|---|
| int |
GetPayloadType()
Gets the RTP payload type from a RTP packet
Declaration
public byte GetPayloadType()
Returns
| Type | Description |
|---|---|
| byte |
GetRTCPSSRC()
Gets the RTCP SSRC from a RTCP packet
Declaration
public int GetRTCPSSRC()
Returns
| Type | Description |
|---|---|
| int |
GetSRTCPIndex(int)
Gets the SRTCP sequence number from a SRTCP packet
Declaration
public int GetSRTCPIndex(int authTagLen)
Parameters
| Type | Name | Description |
|---|---|---|
| int | authTagLen |
Returns
| Type | Description |
|---|---|
| int |
GetSSRC()
Get RTP SSRC from a RTP packet
Declaration
public int GetSSRC()
Returns
| Type | Description |
|---|---|
| int |
GetSequenceNumber()
Gets the RTP sequence number from a RTP packet
Declaration
public int GetSequenceNumber()
Returns
| Type | Description |
|---|---|
| int |
GetTimestamp()
Returns the timestamp for this RTP RawPacket.
Declaration
public long GetTimestamp()
Returns
| Type | Description |
|---|---|
| long |
Grow(int)
Grow the internal packet buffer.
This will change the data buffer of this packet but not the length of the valid data.Use this to grow the internal buffer to avoid buffer re-allocations when appending data.
Declaration
public void Grow(int delta)
Parameters
| Type | Name | Description |
|---|---|---|
| int | delta | Number of bytes to grow |
ReadInt(int)
Reads an integer from this packet at specified offset
Declaration
public int ReadInt(int off)
Parameters
| Type | Name | Description |
|---|---|---|
| int | off | Offset to the integer to be read |
Returns
| Type | Description |
|---|---|
| int |
ReadRegion(int, int)
Reads a byte region from a specified offset with a specified length
Declaration
public byte[]? ReadRegion(int off, int len)
Parameters
| Type | Name | Description |
|---|---|---|
| int | off | Offset to the region to be read |
| int | len | Length of the region to be read |
Returns
| Type | Description |
|---|---|
| byte[] |
ReadRegionToBuff(int, int, byte[])
Reads a byte region from a specified offset in the RTP packet and with a specified length into a given buffer
Declaration
public void ReadRegionToBuff(int off, int len, byte[] outBuff)
Parameters
| Type | Name | Description |
|---|---|---|
| int | off | Offset to the RTP packet of the region to be read |
| int | len | Length of the region to be read |
| byte[] | outBuff | Output buffer |
ReadUnsignedIntAsLong(int)
Reads an unsigned integer as a long at a specified offset
Declaration
public long ReadUnsignedIntAsLong(int off)
Parameters
| Type | Name | Description |
|---|---|---|
| int | off | Offset to the unsigned integer |
Returns
| Type | Description |
|---|---|
| long |
ReadUnsignedShortAsInt(int)
Reads an unsigned short at a specified offset as an int
Declaration
public int ReadUnsignedShortAsInt(int off)
Parameters
| Type | Name | Description |
|---|---|---|
| int | off | Offset to the unsigned short |
Returns
| Type | Description |
|---|---|
| int |
Wrap(byte[], int, int)
Wraps the data into raw packet for readable format
Declaration
public void Wrap(byte[] data, int offset, int length)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | data | Data to write into the raw packet |
| int | offset | Offset into the raw packet |
| int | length | Number of bytes to write |
shrink(int)
Shrinks the buffer of this packet by specified length
Declaration
public void shrink(int delta)
Parameters
| Type | Name | Description |
|---|---|---|
| int | delta | Length to shrink |