Class SctpTlvChunkParameter
Represents the a variable length parameter field for use within a Chunk. All chunk parameters use the same underlying Type-Length-Value (TLV) format but then specialise how the fields are used.
Inheritance
Inherited Members
Namespace: SIPSorcery.Net
Assembly: SIPSorcery.dll
Syntax
public class SctpTlvChunkParameter
Remarks
From https://tools.ietf.org/html/rfc4960#section-3.2.1 (final section): Note that a parameter type MUST be unique across all chunks.For example, the parameter type '5' is used to represent an IPv4 address. The value '5' then is reserved across all chunks to represent an IPv4 address and MUST NOT be reused with a different meaning in any other chunk.
Constructors
| Improve this Doc View SourceSctpTlvChunkParameter()
Declaration
protected SctpTlvChunkParameter()
SctpTlvChunkParameter(UInt16, Byte[])
Creates a new chunk parameter instance.
Declaration
public SctpTlvChunkParameter(ushort parameterType, byte[] parameterValue)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | parameterType | |
System.Byte[] | parameterValue |
Fields
| Improve this Doc View SourceParameterValue
The information contained in the parameter.
Declaration
public byte[] ParameterValue
Field Value
Type | Description |
---|---|
System.Byte[] |
SCTP_PARAMETER_HEADER_LENGTH
Declaration
public const int SCTP_PARAMETER_HEADER_LENGTH = 4
Field Value
Type | Description |
---|---|
System.Int32 |
Properties
| Improve this Doc View SourceParameterType
The type of the chunk parameter.
Declaration
public ushort ParameterType { get; protected set; }
Property Value
Type | Description |
---|---|
System.UInt16 |
UnrecognisedAction
If this parameter is unrecognised by the parent chunk then this field dictates how it should handle it.
Declaration
public SctpUnrecognisedParameterActions UnrecognisedAction { get; }
Property Value
Type | Description |
---|---|
SctpUnrecognisedParameterActions |
Methods
| Improve this Doc View SourceGetBytes()
Serialises an SCTP chunk parameter to a byte array.
Declaration
public byte[] GetBytes()
Returns
Type | Description |
---|---|
System.Byte[] | The byte array containing the serialised chunk parameter. |
GetParameterLength(Boolean)
Calculates the length for the chunk parameter.
Declaration
public virtual ushort GetParameterLength(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. This method gets overridden by specialised SCTP parameters that each have their own fields that determine the length. |
ParseFirstWord(Byte[], Int32)
The first 32 bits of all chunk parameters represent the type and length. 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 parameter. |
System.Int32 | posn | The position in the buffer that indicates the start of the chunk parameter. |
Returns
Type | Description |
---|---|
System.UInt16 |
ParseTlvParameter(Byte[], Int32)
Parses an SCTP Type-Length-Value (TLV) chunk parameter from a buffer.
Declaration
public static SctpTlvChunkParameter ParseTlvParameter(byte[] buffer, int posn)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | The buffer holding the serialised TLV chunk parameter. |
System.Int32 | posn | The position to start parsing at. |
Returns
Type | Description |
---|---|
SctpTlvChunkParameter | An SCTP TLV chunk parameter instance. |
WriteParameterHeader(Byte[], Int32)
Writes the parameter header to the buffer. All chunk parameters use the same two header fields.
Declaration
protected void WriteParameterHeader(byte[] buffer, int posn)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | The buffer to write the chunk parameter header to. |
System.Int32 | posn | The position in the buffer to write at. |
WriteTo(Byte[], Int32)
Serialises the chunk parameter to a pre-allocated buffer. This method gets overridden by specialised SCTP chunk parameters that have their own data and need to be serialised differently.
Declaration
public virtual int WriteTo(byte[] buffer, int posn)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | The buffer to write the serialised chunk parameter 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.Int32 | The number of bytes, including padding, written to the buffer. |