Class SctpAssociation
An SCTP association represents an established connection between two SCTP endpoints. This class also represents the Transmission Control Block (TCB) referred to in RFC4960.
Inherited Members
Namespace: SIPSorcery.Net
Assembly: SIPSorcery.dll
Syntax
public class SctpAssociation
Constructors
| Improve this Doc View SourceSctpAssociation(SctpTransport, SctpTransportCookie, Int32)
Create a new SCTP association instance from the cookie that was previously sent to the remote party in an INIT ACK chunk.
Declaration
public SctpAssociation(SctpTransport sctpTransport, SctpTransportCookie cookie, int localTransportPort)
Parameters
Type | Name | Description |
---|---|---|
SctpTransport | sctpTransport | |
SctpTransportCookie | cookie | |
System.Int32 | localTransportPort |
SctpAssociation(SctpTransport, IPEndPoint, UInt16, UInt16, UInt16, Int32, UInt16, UInt16)
Create a new SCTP association instance where the INIT will be generated from this end of the connection.
Declaration
public SctpAssociation(SctpTransport sctpTransport, IPEndPoint destination, ushort sctpSourcePort, ushort sctpDestinationPort, ushort defaultMTU, int localTransportPort, ushort numberOutboundStreams = 65535, ushort numberInboundStreams = 65535)
Parameters
Type | Name | Description |
---|---|---|
SctpTransport | sctpTransport | The transport layer doing the actual sending and receiving of packets, e.g. UDP, DTLS, raw sockets etc. |
System.Net.IPEndPoint | destination | Optional. The remote destination end point for this association. Some transports, such as DTLS, are already established and do not use this parameter. |
System.UInt16 | sctpSourcePort | The source port for the SCTP packet header. |
System.UInt16 | sctpDestinationPort | The destination port for the SCTP packet header. |
System.UInt16 | defaultMTU | The default Maximum Transmission Unit (MTU) for the underlying transport. This determines the maximum size of an SCTP packet that will be used with the transport. |
System.Int32 | localTransportPort | Optional. The local transport (e.g. UDP or DTLS) port being used for the underlying SCTP transport. This be set on the SCTP association's ID to aid in diagnostics. |
System.UInt16 | numberOutboundStreams | |
System.UInt16 | numberInboundStreams |
Fields
| Improve this Doc View SourceDEFAULT_ADVERTISED_RECEIVE_WINDOW
Declaration
public const uint DEFAULT_ADVERTISED_RECEIVE_WINDOW = 262144U
Field Value
Type | Description |
---|---|
System.UInt32 |
DEFAULT_NUMBER_INBOUND_STREAMS
Declaration
public const int DEFAULT_NUMBER_INBOUND_STREAMS = 65535
Field Value
Type | Description |
---|---|
System.Int32 |
DEFAULT_NUMBER_OUTBOUND_STREAMS
Declaration
public const int DEFAULT_NUMBER_OUTBOUND_STREAMS = 65535
Field Value
Type | Description |
---|---|
System.Int32 |
ID
A unique ID for this association. The ID is not part of the SCTP protocol. It is provided as a convenience measure in case a transport of application needs to keep track of multiple associations.
Declaration
public readonly string ID
Field Value
Type | Description |
---|---|
System.String |
Properties
| Improve this Doc View SourceARwnd
Advertised Receiver Window Credit. This value represents the dedicated buffer space, in number of bytes, that will be used for the receive buffer for this association.
Declaration
public uint ARwnd { get; }
Property Value
Type | Description |
---|---|
System.UInt32 |
Destination
The remote destination end point for this association. The underlying transport will supply this field if it is needed (the UDP encapsulation transport needs it, the DTSL transport does not).
Declaration
public IPEndPoint Destination { get; }
Property Value
Type | Description |
---|---|
System.Net.IPEndPoint |
SendBufferedAmount
The total size (in bytes) of outgoing user data queued in the SctpDataSender.
Declaration
public ulong SendBufferedAmount { get; }
Property Value
Type | Description |
---|---|
System.UInt64 |
State
Indicates the current connection state of the association.
Declaration
public SctpAssociationState State { get; }
Property Value
Type | Description |
---|---|
SctpAssociationState |
TSN
Transaction Sequence Number (TSN). A monotonically increasing number that must be included in every DATA chunk.
Declaration
public uint TSN { get; }
Property Value
Type | Description |
---|---|
System.UInt32 |
VerificationTag
Declaration
public uint VerificationTag { get; }
Property Value
Type | Description |
---|---|
System.UInt32 |
Methods
| Improve this Doc View SourceAbort(ISctpErrorCause)
Sends an SCTP control packet with an abort chunk to terminate the association.
Declaration
public void Abort(ISctpErrorCause errorCause)
Parameters
Type | Name | Description |
---|---|---|
ISctpErrorCause | errorCause | The cause of the abort. |
GetControlPacket(SctpChunk)
Gets an SCTP packet for a control (non-data) chunk.
Declaration
public SctpPacket GetControlPacket(SctpChunk chunk)
Parameters
Type | Name | Description |
---|---|---|
SctpChunk | chunk | The control chunk to get a packet for. |
Returns
Type | Description |
---|---|
SctpPacket | A single control chunk SCTP packet. |
GotCookie(SctpTransportCookie)
Initialises the association state based on the echoed cookie (the cookie that we sent to the remote party and was then echoed back to us). An association can only be initialised from a cookie prior to it being used and prior to it ever having entered the established state.
Declaration
public void GotCookie(SctpTransportCookie cookie)
Parameters
Type | Name | Description |
---|---|---|
SctpTransportCookie | cookie | The echoed cookie that was returned from the remote party. |
Init()
Attempts to initialise the association by sending an INIT chunk to the remote peer.
Declaration
public void Init()
SendData(UInt16, UInt32, Byte[])
Sends a DATA chunk to the remote peer.
Declaration
public void SendData(ushort streamID, uint ppid, byte[] data)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | streamID | The stream ID to sent the data on. |
System.UInt32 | ppid | The payload protocol ID for the data. |
System.Byte[] | data | The byte data to send. |
SendData(UInt16, UInt32, String)
Sends a DATA chunk to the remote peer.
Declaration
public void SendData(ushort streamID, uint ppid, string message)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | streamID | The stream ID to sent the data on. |
System.UInt32 | ppid | The payload protocol ID for the data. |
System.String | message | The string data to send. |
Shutdown()
Initiates the shutdown of the association by sending a shutdown control chunk to the remote party.
Declaration
public void Shutdown()
UpdateDestinationPort(UInt16)
Attempts to update the association's SCTP destination port.
Declaration
public void UpdateDestinationPort(ushort port)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | port | The updated destination port. |
UpdateSourcePort(UInt16)
Attempts to update the association's SCTP source port.
Declaration
public void UpdateSourcePort(ushort port)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | port | The updated source port. |
Events
| Improve this Doc View SourceOnAborted
Event to notify the application that an error occurred that caused the association to be aborted locally.
Declaration
public event Action<string> OnAborted
Event Type
Type | Description |
---|---|
System.Action<System.String> |
OnAbortReceived
Event to notify the application that the remote party aborted this association.
Declaration
public event Action<string> OnAbortReceived
Event Type
Type | Description |
---|---|
System.Action<System.String> |
OnAssociationStateChanged
Event to notify application that the association state has changed.
Declaration
public event Action<SctpAssociationState> OnAssociationStateChanged
Event Type
Type | Description |
---|---|
System.Action<SctpAssociationState> |
OnData
Event to notify application that user data is available.
Declaration
public event Action<SctpDataFrame> OnData
Event Type
Type | Description |
---|---|
System.Action<SctpDataFrame> |