Show / Hide Table of Contents

Class SctpChunk

Inheritance
System.Object
SctpChunk
SctpDataChunk
SctpErrorChunk
SctpInitChunk
SctpSackChunk
SctpShutdownChunk
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 SctpChunk

Constructors

| Improve this Doc View Source

SctpChunk()

This constructor is only intended to be used when parsing the specialised chunk types. Because they are being parsed from a buffer nothing is known about them and this constructor allows starting from a blank slate.

Declaration
protected SctpChunk()
| Improve this Doc View Source

SctpChunk(SctpChunkType, Byte)

Declaration
public SctpChunk(SctpChunkType chunkType, byte chunkFlags = 0)
Parameters
Type Name Description
SctpChunkType chunkType
System.Byte chunkFlags

Fields

| Improve this Doc View Source

ChunkFlags

The usage of these bits depends on the Chunk type as given by the Chunk Type field.Unless otherwise specified, they are set to 0 on transmit and are ignored on receipt.

Declaration
public byte ChunkFlags
Field Value
Type Description
System.Byte
| Improve this Doc View Source

ChunkType

This field identifies the type of information contained in the Chunk Value field.

Declaration
public byte ChunkType
Field Value
Type Description
System.Byte
| Improve this Doc View Source

ChunkValue

The Chunk Value field contains the actual information to be transferred in the chunk.The usage and format of this field is dependent on the Chunk Type.

Declaration
public byte[] ChunkValue
Field Value
Type Description
System.Byte[]
| Improve this Doc View Source

logger

Declaration
protected static ILogger logger
Field Value
Type Description
Microsoft.Extensions.Logging.ILogger
| Improve this Doc View Source

SCTP_CHUNK_HEADER_LENGTH

Declaration
public const int SCTP_CHUNK_HEADER_LENGTH = 4
Field Value
Type Description
System.Int32
| Improve this Doc View Source

UnrecognizedPeerParameters

Records any unrecognised parameters received from the remote peer and are classified as needing to be reported. These can be sent back to the remote peer if needed.

Declaration
public List<SctpTlvChunkParameter> UnrecognizedPeerParameters
Field Value
Type Description
System.Collections.Generic.List<SctpTlvChunkParameter>

Properties

| Improve this Doc View Source

KnownType

If recognised returns the known chunk type. If not recognised returns null.

Declaration
public SctpChunkType? KnownType { get; }
Property Value
Type Description
System.Nullable<SctpChunkType>

Methods

| Improve this Doc View Source

CopyUnrecognisedChunk(Byte[], Int32)

Copies an unrecognised chunk to a byte buffer and returns it. This method is used to assist in reporting unrecognised chunk types.

Declaration
public static byte[] CopyUnrecognisedChunk(byte[] buffer, int posn)
Parameters
Type Name Description
System.Byte[] buffer

The buffer containing the chunk.

System.Int32 posn

The position in the buffer that the unrecognised chunk starts.

Returns
Type Description
System.Byte[]

A new buffer containing a copy of the chunk.

| Improve this Doc View Source

GetChunkLength(Boolean)

Calculates the length for the chunk. Chunks are required to be padded out to 4 byte boundaries. This method gets overridden by specialised SCTP chunks that have their own fields that determine the length.

Declaration
public virtual ushort GetChunkLength(bool padded)
Parameters
Type Name Description
System.Boolean padded

If true the length field will be padded to a 4 byte boundary.

Returns
Type Description
System.UInt16

The length of the chunk.

| Improve this Doc View Source

GetChunkLengthFromHeader(Byte[], Int32, Boolean)

Extracts the padded length field from a serialised chunk buffer.

Declaration
public static uint GetChunkLengthFromHeader(byte[] buffer, int posn, bool padded)
Parameters
Type Name Description
System.Byte[] buffer

The buffer holding the serialised chunk.

System.Int32 posn

The start position of the serialised chunk.

System.Boolean padded

If true the length field will be padded to a 4 byte boundary.

Returns
Type Description
System.UInt32

The padded length of the serialised chunk.

| Improve this Doc View Source

GetParameters(Byte[], Int32, Int32)

Chunks can optionally contain Type-Length-Value (TLV) parameters. This method parses any variable length parameters from a chunk's value.

Declaration
public static IEnumerable<SctpTlvChunkParameter> GetParameters(byte[] buffer, int posn, int length)
Parameters
Type Name Description
System.Byte[] buffer

The buffer holding the serialised chunk.

System.Int32 posn

The position in the buffer to start parsing variable length parameters from.

System.Int32 length

The length of the TLV chunk parameters in the buffer.

Returns
Type Description
System.Collections.Generic.IEnumerable<SctpTlvChunkParameter>

A list of chunk parameters. Can be empty.

| Improve this Doc View Source

GetUnrecognisedChunkAction(UInt16)

If this chunk is unrecognised then this field dictates how the remainder of the SCTP packet should be handled.

Declaration
public static SctpUnrecognisedChunkActions GetUnrecognisedChunkAction(ushort chunkType)
Parameters
Type Name Description
System.UInt16 chunkType
Returns
Type Description
SctpUnrecognisedChunkActions
| Improve this Doc View Source

GotUnrecognisedParameter(SctpTlvChunkParameter)

Handler for processing an unrecognised chunk parameter.

Declaration
public bool GotUnrecognisedParameter(SctpTlvChunkParameter chunkParameter)
Parameters
Type Name Description
SctpTlvChunkParameter chunkParameter

The Type-Length-Value (TLV) formatted chunk that was not recognised.

Returns
Type Description
System.Boolean

True if further parameter parsing for this chunk should be stopped. False to continue.

| Improve this Doc View Source

Parse(Byte[], Int32)

Parses an SCTP chunk from a buffer.

Declaration
public static SctpChunk Parse(byte[] buffer, int posn)
Parameters
Type Name Description
System.Byte[] buffer

The buffer holding the serialised chunk.

System.Int32 posn

The position to start parsing at.

Returns
Type Description
SctpChunk

An SCTP chunk instance.

| Improve this Doc View Source

ParseBaseChunk(Byte[], Int32)

Parses a simple chunk and does not attempt to process any chunk value. This method is suitable when:

  • the chunk type consists only of the 4 byte header and has no fixed or variable parameters set.
Declaration
public static SctpChunk ParseBaseChunk(byte[] buffer, int posn)
Parameters
Type Name Description
System.Byte[] buffer

The buffer holding the serialised chunk.

System.Int32 posn

The position to start parsing at.

Returns
Type Description
SctpChunk

An SCTP chunk instance.

| Improve this Doc View Source

ParseFirstWord(Byte[], Int32)

The first 32 bits of all chunks represent the same 3 fields. This method parses those fields and sets them on the current instance.

Declaration
public ushort ParseFirstWord(byte[] buffer, int posn)
Parameters
Type Name Description
System.Byte[] buffer

The buffer holding the serialised chunk.

System.Int32 posn

The position in the buffer that indicates the start of the chunk.

Returns
Type Description
System.UInt16

The chunk length value.

| Improve this Doc View Source

WriteChunkHeader(Byte[], Int32)

Writes the chunk header to the buffer. All chunks use the same three header fields.

Declaration
protected void WriteChunkHeader(byte[] buffer, int posn)
Parameters
Type Name Description
System.Byte[] buffer

The buffer to write the chunk header to.

System.Int32 posn

The position in the buffer to write at.

| Improve this Doc View Source

WriteTo(Byte[], Int32)

Serialises the chunk to a pre-allocated buffer. This method gets overridden by specialised SCTP chunks that have their own parameters and need to be serialised differently.

Declaration
public virtual ushort WriteTo(byte[] buffer, int posn)
Parameters
Type Name Description
System.Byte[] buffer

The buffer to write the serialised chunk bytes to. It must have the required space already allocated.

System.Int32 posn

The position in the buffer to write to.

Returns
Type Description
System.UInt16

The number of bytes, including padding, written to the buffer.

Extension Methods

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