sapflow_srt/lib.rs
1//! SRT for sapflow: live receiver/listener and bounded paced caller/sender.
2//!
3//! Written from the SRT specification (draft-sharabayko-srt-01) and from
4//! watching real sessions on the wire (libsrt 1.5.4's `srt-live-transmit`
5//! and the encoders in `docs/interop.md`); where the two differ, the wire
6//! wins and `docs/reference.md` says so.
7//!
8//! Sans-IO, no async runtime: [`Listener`] takes datagrams with their
9//! source address and the time, and gives back datagrams to send,
10//! [`Event`]s (a caller asking to connect, payloads in order, a connection
11//! closing) and when it next needs the time. The server owns the socket.
12//!
13//! Layers:
14//!
15//! - [`seq`]: 31-bit sequence numbers and 32-bit timestamps, both wrapping.
16//! - [`packet`]: every packet type, parsed from and encoded to bytes.
17//! - [`loss`]: the receiver's loss list and when to ask again.
18//! - [`rtt`]: round-trip time from ACK/ACKACK pairs.
19//! - [`receiver`]: one connection: buffer, timestamp-based delivery with
20//! too-late drop, ACKs, NAKs, keepalives, idle timeout.
21//! - [`listener`]: handshakes (version 5, SYN cookies keyed per process),
22//! stream ids, limits, and the connections.
23//!
24//! [`Caller`] adds bounded, paced live sending. Live mode only: no file
25//! mode, rendezvous, groups or packet filters. Optional AES-128/256-CTR uses
26//! strict key negotiation and refresh. CTR does not authenticate media;
27//! control/stream IDs remain clear. See [`crypto`] for the supported profile.
28//!
29//! Every byte that arrives is hostile until the application accepts the
30//! caller: nothing here indexes without a bound or trusts a length, and
31//! it is fuzzed (`own_srt_packet`, `own_srt_listener`).
32
33#![warn(missing_docs)]
34#![cfg_attr(
35 not(test),
36 deny(
37 clippy::unwrap_used,
38 clippy::expect_used,
39 clippy::panic,
40 clippy::indexing_slicing,
41 clippy::unreachable,
42 clippy::todo
43 )
44)]
45
46pub mod caller;
47pub mod crypto;
48pub mod listener;
49pub mod loss;
50pub mod packet;
51pub mod receiver;
52pub mod rtt;
53pub mod sender;
54pub mod seq;
55
56pub use caller::{Caller, CallerCloseReason, CallerConfig, CallerEvent, CallerStats};
57pub use sender::{SendConfig, SendError, SendStats};
58
59pub use listener::{Config, ConnId, Event, Listener, ListenerStats, RejectCode};
60pub use receiver::{CloseReason, Stats};