Class SctpDataReceiver
Processes incoming data chunks and handles fragmentation and congestion control. This class does NOT handle in order delivery. Different streams on the same association can have different ordering requirements so it's left up to each stream handler to deal with full frames as they see fit.
Inheritance
Inherited Members
Namespace: SIPSorcery.Net
Assembly: SIPSorcery.dll
Syntax
public class SctpDataReceiver
Constructors
| Improve this Doc View SourceSctpDataReceiver(UInt32, UInt32, UInt32)
Creates a new SCTP data receiver instance.
Declaration
public SctpDataReceiver(uint receiveWindow, uint mtu, uint initialTSN)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt32 | receiveWindow | The size of the receive window. This is the window around the expected Transaction Sequence Number (TSN). If a data chunk is received with a TSN outside the window it is ignored. |
| System.UInt32 | mtu | The Maximum Transmission Unit for the network layer that the SCTP association is being used with. |
| System.UInt32 | initialTSN | The initial TSN for the association from the INIT handshake. |
Properties
| Improve this Doc View SourceCumulativeAckTSN
Gets the Transaction Sequence Number (TSN) that can be acknowledged to the remote peer. It represents the most recent in order TSN that has been received. If no in order TSN's have been received then null will be returned.
Declaration
public uint? CumulativeAckTSN { get; }
Property Value
| Type | Description |
|---|---|
| System.Nullable<System.UInt32> |
ForwardTSNCount
A count of the total entries in the receive dictionary. Note that if chunks have been received out of order this count could include chunks that have already been processed. They are kept in the dictionary as empty chunks to track which TSN's have been received.
Declaration
public int ForwardTSNCount { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Methods
| Improve this Doc View SourceGetDistance(UInt32, UInt32)
Gets the distance between two unsigned integers. The "distance" means how many points are there between the two unsigned integers and allows wrapping from the unsigned integer maximum to zero.
Declaration
public static uint GetDistance(uint start, uint end)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt32 | start | |
| System.UInt32 | end |
Returns
| Type | Description |
|---|---|
| System.UInt32 | The shortest distance between the two unsigned integers. |
GetSackChunk()
Gets a SACK chunk that represents the current state of the receiver.
Declaration
public SctpSackChunk GetSackChunk()
Returns
| Type | Description |
|---|---|
| SctpSackChunk | A SACK chunk that can be sent to the remote peer to update the ACK TSN and request a retransmit of any missing DATA chunks. |
IsNewer(UInt32, UInt32)
Determines if a received TSN is newer than the expected TSN taking into account if TSN wrap around has occurred.
Declaration
public static bool IsNewer(uint tsn, uint receivedTSN)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt32 | tsn | The TSN to compare against. |
| System.UInt32 | receivedTSN | The received TSN. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the received TSN is newer than the reference TSN or false if not. |
IsNewerOrEqual(UInt32, UInt32)
Declaration
public static bool IsNewerOrEqual(uint tsn, uint receivedTSN)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt32 | tsn | |
| System.UInt32 | receivedTSN |
Returns
| Type | Description |
|---|---|
| System.Boolean |
OnDataChunk(SctpDataChunk)
Handler for processing new data chunks.
Declaration
public List<SctpDataFrame> OnDataChunk(SctpDataChunk dataChunk)
Parameters
| Type | Name | Description |
|---|---|---|
| SctpDataChunk | dataChunk | The newly received data chunk. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<SctpDataFrame> | If the received chunk resulted in a full chunk becoming available one or more new frames will be returned otherwise an empty frame is returned. Multiple frames may be returned if this chunk is part of a stream and was received out or order. For unordered chunks the list will always have a single entry. |
SetInitialTSN(UInt32)
Used to set the initial TSN for the remote party when it's not known at creation time.
Declaration
public void SetInitialTSN(uint tsn)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt32 | tsn | The initial Transaction Sequence Number (TSN) for the remote party. |