Class SctpInitChunk
This class is used to represent both an INIT and INIT ACK chunk. The only structural difference between them is the INIT ACK requires the Cookie variable parameter to be set. The INIT chunk is used to initiate an SCTP association between two endpoints. The INIT ACK chunk is used to respond to an incoming INIT chunk from a remote peer.
Inherited Members
Namespace: SIPSorcery.Net
Assembly: SIPSorcery.dll
Syntax
public class SctpInitChunk : SctpChunk
Constructors
| Improve this Doc View SourceSctpInitChunk(SctpChunkType, UInt32, UInt32, UInt32, UInt16, UInt16)
Initialises the chunk as either INIT or INIT ACK.
Declaration
public SctpInitChunk(SctpChunkType initChunkType, uint initiateTag, uint initialTSN, uint arwnd, ushort numberOutboundStreams, ushort numberInboundStreams)
Parameters
Type | Name | Description |
---|---|---|
SctpChunkType | initChunkType | Either INIT or INIT ACK. |
System.UInt32 | initiateTag | |
System.UInt32 | initialTSN | |
System.UInt32 | arwnd | |
System.UInt16 | numberOutboundStreams | |
System.UInt16 | numberInboundStreams |
Fields
| Improve this Doc View SourceAddresses
Optional list of IP address parameters that can be included in INIT chunks.
Declaration
public List<IPAddress> Addresses
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<System.Net.IPAddress> |
ARwnd
Advertised Receiver Window Credit. This value represents the dedicated buffer space, in number of bytes, the sender of the INIT has reserved in association with this window.
Declaration
public uint ARwnd
Field Value
Type | Description |
---|---|
System.UInt32 |
CookiePreservative
The sender of the INIT shall use this parameter to suggest to the receiver of the INIT for a longer life-span of the State Cookie.
Declaration
public uint CookiePreservative
Field Value
Type | Description |
---|---|
System.UInt32 |
FIXED_PARAMETERS_LENGTH
Declaration
public const int FIXED_PARAMETERS_LENGTH = 16
Field Value
Type | Description |
---|---|
System.Int32 |
HostnameAddress
The sender of INIT uses this parameter to pass its Host Name (in place of its IP addresses) to its peer.The peer is responsible for resolving the name.Using this parameter might make it more likely for the association to work across a NAT box.
Declaration
public string HostnameAddress
Field Value
Type | Description |
---|---|
System.String |
InitialTSN
The initial Transmission Sequence Number (TSN) that the sender will use.
Declaration
public uint InitialTSN
Field Value
Type | Description |
---|---|
System.UInt32 |
InitiateTag
The receiver of the INIT (the responding end) records the value of the Initiate Tag parameter.This value MUST be placed into the Verification Tag field of every SCTP packet that the receiver of the INIT transmits within this association.
Declaration
public uint InitiateTag
Field Value
Type | Description |
---|---|
System.UInt32 |
NumberInboundStreams
Defines the maximum number of streams the sender of this INIT chunk allows the peer end to create in this association.
Declaration
public ushort NumberInboundStreams
Field Value
Type | Description |
---|---|
System.UInt16 |
NumberOutboundStreams
Defines the number of outbound streams the sender of this INIT chunk wishes to create in this association.
Declaration
public ushort NumberOutboundStreams
Field Value
Type | Description |
---|---|
System.UInt16 |
StateCookie
INIT ACK only. Mandatory. This parameter value MUST contain all the necessary state and parameter information required for the sender of this INIT ACK to create the association, along with a Message Authentication Code (MAC).
Declaration
public byte[] StateCookie
Field Value
Type | Description |
---|---|
System.Byte[] |
SupportedAddressTypes
The sender of INIT uses this parameter to list all the address types it can support. Options are IPv4 (5), IPv6 (6) and Hostname (11).
Declaration
public List<SctpInitChunkParameterType> SupportedAddressTypes
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<SctpInitChunkParameterType> |
UnrecognizedParameters
INIT ACK only. Optional. This parameter is returned to the originator of the INIT chunk if the INIT contains an unrecognized parameter that has a value that indicates it should be reported to the sender. This parameter value field will contain unrecognized parameters copied from the INIT chunk complete with Parameter Type, Length, and Value fields.
Declaration
public List<byte[]> UnrecognizedParameters
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<System.Byte[]> |
Methods
| Improve this Doc View SourceGetChunkLength(Boolean)
Calculates the length for INIT and INIT ACK chunks.
Declaration
public override 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. |
Overrides
| Improve this Doc View SourceParseChunk(Byte[], Int32)
Parses the INIT or INIT ACK chunk fields
Declaration
public static SctpInitChunk ParseChunk(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 |
---|---|
SctpInitChunk |
WriteTo(Byte[], Int32)
Serialises an INIT or INIT ACK chunk to a pre-allocated buffer.
Declaration
public override 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. |