dcsctp is a Rust implementation of the Stream Control Transmission Protocol
(SCTP, RFC 9260) designed for
WebRTC Data Channels (RFC 8831).
It is a user-space library intended to be embedded in larger systems (like
WebRTC implementations), not a standalone server or in an operating system
kernel.
- Core Design: The library is single-threaded and event-driven. It does not perform I/O directly. The consumer drives the loop by feeding packets/timer events and handling outgoing commands.
- Entry Point: The primary public interface is the
DcSctpSockettrait (src/api/mod.rs). The implementation isSocket(src/socket/mod.rs). - Internal:
src/socket/: State machine, connection establishment/teardown.src/rx/: Receiver logic (congestion control, reassembly).src/tx/: Transmitter logic (congestion control, retransmission).src/timer/: Timer abstractions (does not use system timers).
- C++ Bindings:
src/ffi.rsusescxxto expose the Rust API to C++. Changes tosrc/api/must often be reflected insrc/ffi.rs.
- Build:
cargo build - Test:
cargo test(Runs extensive unit and integration tests). - Lint:
cargo clippy --all-features --all-targets -- -D warnings - Format:
cargo +nightly fmt --all -- --check
- Changelog: All functional changes must be documented in
CHANGELOG.mdunder the Unreleased section (categories: Added, Changed, Deprecated, Removed, Fixed, Security).