Expand description
SCTP for the Sans-I/O WebRTC stack.
The Stream Control Transmission Protocol (RFC 4960) with the extensions WebRTC data
channels need: partial reliability (RFC 3758) and stream reset / reconfiguration
(RFC 6525). In WebRTC, SCTP runs over DTLS rather than over IP, and carries the data
channels described by rtc-datachannel.
This is a fully deterministic implementation of the protocol logic. It contains no networking code and reads no clock of its own: you feed it datagrams and time, and poll it for the datagrams and events it produces. That is what makes it testable without a network and reusable under any executor.
§Structure
Endpoint— the protocol state for one socket. It holds configuration and dispatches inbound datagrams to the right association.Association— the bulk of the logic for a single association: handshake, congestion control, retransmission, and its streams.Stream— one stream’s reads, writes and reliability settings.Chunks— a reassembled inbound message, delivered once every fragment has arrived.
§Example
Configuration is plain data, and the association is driven entirely by the caller — feed it datagrams and time, poll it for output:
use rtc_sctp::{EndpointConfig, TransportConfig};
use std::sync::Arc;
let transport = TransportConfig::default()
.with_max_message_size(65_536)
.with_max_num_outbound_streams(1024);
let endpoint_config = Arc::new(EndpointConfig::new());
assert_eq!(transport.max_message_size(), 65_536);Most applications do not depend on this crate directly — the rtc
crate drives it as one layer of the peer-connection pipeline and exposes data channels,
and webrtc wraps that in an async API.
Structs§
- Association
- Association represents an SCTP association
- Association
Event - Events sent from an Endpoint to an Association
- Association
Handle - Internal identifier for an
Associationcurrently associated with an endpoint - Association
Stats - Association statistics
- Chunk
- A chunk of data from the stream
- Chunk
Payload Data - ChunkPayloadData represents an SCTP Chunk of type DATA
- Chunks
- Chunks is a set of chunks that share the same SSN
- Client
Config - Configuration for outgoing associations
- Endpoint
- The main entry point to the library
- Endpoint
Config - Global configuration for the endpoint, affecting all associations
- Endpoint
Event - Events sent from an Association to an Endpoint
- Error
Cause Code - ErrorCauseCode is a cause code that appears in either a ERROR or ABORT chunk
- Server
Config - Parameters governing incoming associations
- Stream
- Stream represents an SCTP stream
- Stream
State - StreamState represents the state of an SCTP stream
- Timer
Config - Retransmission limits for the association’s timers.
- Transport
Config - Config collects the arguments to create_association construction into a single structure
Enums§
- Association
Error - Reasons why an association might be lost
- Connect
Error - Errors in the parameters being used to create a new association
- Datagram
Event - Event resulting from processing a single datagram
- Event
- Events of interest to the application
- Payload
- Payload in Incoming/outgoing Transmit
- Payload
Protocol Identifier - PayloadProtocolIdentifier is an enum for DataChannel payload types PayloadProtocolIdentifier enums https://www.iana.org/assignments/sctp-parameters/sctp-parameters.xhtml#sctp-parameters-25
- Reliability
Type - Reliability type for stream
- Side
- Whether an endpoint was the initiator of an association
- Stream
Event - Application events about streams
Type Aliases§
- Association
Id - Protocol-level identifier for an Association.
- Stream
Id - Identifier for a stream within a particular association