Class SctpPacket
An SCTP packet is composed of a common header and chunks. A chunk contains either control information or user data.
Inheritance
Inherited Members
Namespace: SIPSorcery.Net
Assembly: SIPSorcery.dll
Syntax
public class SctpPacket
Constructors
| Improve this Doc View SourceSctpPacket(UInt16, UInt16, UInt32)
Creates a new SCTP packet instance.
Declaration
public SctpPacket(ushort sourcePort, ushort destinationPort, uint verificationTag)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | sourcePort | The source port value to place in the packet header. |
System.UInt16 | destinationPort | The destination port value to place in the packet header. |
System.UInt32 | verificationTag | The verification tag value to place in the packet header. |
Fields
| Improve this Doc View SourceCHECKSUM_BUFFER_POSITION
The position in a serialised SCTP packet buffer that the checksum field starts.
Declaration
public const int CHECKSUM_BUFFER_POSITION = 8
Field Value
Type | Description |
---|---|
System.Int32 |
Chunks
The list of one or recognised chunks after parsing with SIPSorcery.Net.SctpPacket.ParseChunks(System.Byte[],System.Int32,System.Int32) or chunks that have been manually added for an outgoing SCTP packet.
Declaration
public List<SctpChunk> Chunks
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<SctpChunk> |
Header
The common header for the SCTP packet.
Declaration
public SctpHeader Header
Field Value
Type | Description |
---|---|
SctpHeader |
UnrecognisedChunks
A list of the blobs for chunks that weren't recognised when parsing a received packet.
Declaration
public List<byte[]> UnrecognisedChunks
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<System.Byte[]> |
VERIFICATIONTAG_BUFFER_POSITION
The position in a serialised SCTP packet buffer that the verification tag field starts.
Declaration
public const int VERIFICATIONTAG_BUFFER_POSITION = 4
Field Value
Type | Description |
---|---|
System.Int32 |
Methods
| Improve this Doc View SourceAddChunk(SctpChunk)
Adds a new chunk to send with an outgoing packet.
Declaration
public void AddChunk(SctpChunk chunk)
Parameters
Type | Name | Description |
---|---|---|
SctpChunk | chunk | The chunk to add. |
GetBytes()
Serialises an SCTP packet to a byte array.
Declaration
public byte[] GetBytes()
Returns
Type | Description |
---|---|
System.Byte[] | The byte array containing the serialised SCTP packet. |
GetVerificationTag(Byte[], Int32, Int32)
Gets the verification tag from a serialised SCTP packet. This allows a pre-flight check to be carried out before de-serialising the whole buffer.
Declaration
public static uint GetVerificationTag(byte[] buffer, int posn, int length)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | The buffer holding the serialised packet. |
System.Int32 | posn | The start position in the buffer. |
System.Int32 | length | The length of the packet in the buffer. |
Returns
Type | Description |
---|---|
System.UInt32 | The verification tag for the serialised SCTP packet. |
IsValid(Byte[], Int32, Int32, UInt32)
Performs verification checks on a serialised SCTP packet.
Declaration
public static bool IsValid(byte[] buffer, int posn, int length, uint requiredTag)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | The buffer holding the serialised packet. |
System.Int32 | posn | The start position in the buffer. |
System.Int32 | length | The length of the packet in the buffer. |
System.UInt32 | requiredTag | The required verification tag for the serialised packet. This should match the verification tag supplied by the remote party. |
Returns
Type | Description |
---|---|
System.Boolean | True if the packet is valid, false if not. |
Parse(Byte[], Int32, Int32)
Parses an SCTP packet from a serialised buffer.
Declaration
public static SctpPacket Parse(byte[] buffer, int offset, int length)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | The buffer holding the serialised packet. |
System.Int32 | offset | The position in the buffer of the packet. |
System.Int32 | length | The length of the serialised packet in the buffer. |
Returns
Type | Description |
---|---|
SctpPacket |
VerifyChecksum(Byte[], Int32, Int32)
Verifies whether the checksum for a serialised SCTP packet is valid.
Declaration
public static bool VerifyChecksum(byte[] buffer, int posn, int length)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | The buffer holding the serialised packet. |
System.Int32 | posn | The start position in the buffer. |
System.Int32 | length | The length of the packet in the buffer. |
Returns
Type | Description |
---|---|
System.Boolean | True if the checksum was valid, false if not. |