Show / Hide Table of Contents

Class SctpPacket

An SCTP packet is composed of a common header and chunks. A chunk contains either control information or user data.

Inheritance
System.Object
SctpPacket
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: SIPSorcery.Net
Assembly: SIPSorcery.dll
Syntax
public class SctpPacket

Constructors

| Improve this Doc View Source

SctpPacket(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 Source

CHECKSUM_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
| Improve this Doc View Source

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>
| Improve this Doc View Source

Header

The common header for the SCTP packet.

Declaration
public SctpHeader Header
Field Value
Type Description
SctpHeader
| Improve this Doc View Source

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[]>
| Improve this Doc View Source

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 Source

AddChunk(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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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
| Improve this Doc View Source

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.

Extension Methods

JSONWriter.ToJson(Object)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX