Skip to main content

Module link

Module link 

Source
Available on crate feature link only.
Expand description

One SRT connection as a sans-IO link: datagrams and the caller’s now in, datagrams to send and delivered payloads out.

Link holds the whole per-connection conversation once the handshake has settled: the ARQ receiver and sender, the TSBPD scheduler, the §6 payload cipher and KM Refresh, LiveCC pacing, Keep-Alive and peer-idle timing, end-of-stream reporting, and DROPREQ/SHUTDOWN handling. It never reads a clock and never touches a socket: every call takes now and leaves what must go on the wire in Link::take_sent.

CallerLink is the caller role on top of it: the sans-IO CallerHandshake with its retransmit period and budget, and the transition into a Link at the resolution. It serves the tokio adapter (crate::io) and any embedded host that owns its own socket loop alike, so the protocol has one implementation, not one per host.

SRT: draft-sharabayko-srt-01 (handshake 4.3, TSBPD 4.5, too-late drop 4.6, ARQ 4.8, encryption 6).

Structs§

CallerLink
The caller role: the HSv5 caller handshake, then the established Link.
CallerParams
What a CallerLink is configured by: the handshake this side advertises, the connection’s own Socket ID and initial sequence number, its time bounds, and what the link may assume about the stream it delivers.
Delivered
What one call on a link delivered, in order.
Link
One established SRT connection, driven by datagrams and the caller’s clock.
LinkCadence
The protocol cadence a link keeps, every period chosen by the caller (libsrt’s values are a 250 ms handshake retransmit, a 1 s keep-alive; the rest are this crate’s own choices).
LinkCounts
What a link has counted about the DATA it received, one total per kind, for a host that keeps statistics.
LinkSetup
What settled a connection: its negotiated parameters and the peer’s own handshake values.
LinkTimers
Every time bound a link needs, all chosen by the caller.
Payload
One delivered application payload, held in the datagram it arrived in: the bytes from Payload::start on. A host that hands payloads on as shared buffers takes the datagram and the offset with Payload::into_parts and slices it, without a copy.

Enums§

DeliveredItem
One item a link hands its host, in the order the stream needs it.
LinkEnd
How a link ended, named once.

Constants§

KEY_LEN
Width of a derived value: a SHA-256 digest, and the seed the tokio adapter gives it.
MIN_WAKE
Floor on how soon Link::next_deadline may ask to be woken: never a deadline in the past, and a 1 ms minimum cannot spin (it matches the timer granularity every hosted adapter here has).

Functions§

shutdown_datagram
The SHUTDOWN datagram (§3.2.7) a leaving side sends its peer so the peer closes at once instead of waiting out its idle timeout. None when the packet cannot be serialized.