Expand description
Shared types for the sans-IO HSv5 handshake state machine —
draft-sharabayko-srt-01 §4.3 (Handshake Messages) / §4.3.1
(Caller-Listener Handshake).
This module holds the pieces crate::caller::CallerHandshake and
crate::listener::ListenerHandshake share: the negotiation input
(HandshakeConfig), the negotiation output (NegotiatedParams), the
event type both engines emit (HandshakeOutput), and the Handshake
Rejection Reason codes (§4.3, Table 7) as a typed RejectionReason.
This module also holds the crypto-feature-gated §6.1.5 Key Material
Exchange helpers (CryptoConfig, build_key_material_extension,
recover_sek, echo_key_material_as_response, verify_km_echo) shared
by crate::caller::CallerHandshake / crate::listener::ListenerHandshake
— see CryptoConfig’s doc and specs/rules/srt-crypto.md. Congestion
control beyond LiveCC packet pacing is an explicit follow-up — see the
crate root docs.
Structs§
- Crypto
Config crypto - Opt-in §6 payload-encryption config for one side of a Caller-Listener
handshake (
draft-sharabayko-srt-01§6.1.5, Key Material Exchange — curated atspecs/rules/srt-crypto.md).NoneonHandshakeConfig::crypto(the default) disables the encryption path entirely: no Key Material extension is sent, and a peer that sends one unexpectedly is rejected (RejectionReason::Unsecure). - Handshake
Config - Local configuration for one side of a Caller-Listener handshake — the
values this engine advertises (
draft-sharabayko-srt-01§3.2.1, §3.2.1.1, §3.2.1.3, §3.2.1.4). - Negotiated
Params - The outcome of a Caller-Listener handshake, once both TSBPD delays and
flags have been reconciled per
draft-sharabayko-srt-01§4.3.1.2 (“The value for latency is always agreed to be the greater of those reported by each party”).
Enums§
- Handshake
Output - An event produced by
crate::caller::CallerHandshake::feed/crate::caller::CallerHandshake::start/crate::listener::ListenerHandshake::feed/ either engine’stick. - Rejection
Reason - Handshake Rejection Reason (
draft-sharabayko-srt-01§4.3, Table 7). Sent in place of a normalHandshake Typevalue (1000 + code, decoded viaHandshakeType::Reserved) when a connection attempt is refused.
Constants§
- HANDSHAKE_
VERSION_ 4 - A base protocol version number of
4— the value the Caller’s INDUCTION handshake MUST always carry (draft-sharabayko-srt-01§4.3.1.1), kept for UDT compatibility. - HANDSHAKE_
VERSION_ 5 - A base protocol version number of
5— HSv5, used by every handshake message from the Listener’s INDUCTION response onward (§4.3.1.1/§4.3.1.2). - INDUCTION_
LEGACY_ SOCKET_ TYPE - The
Extension Fieldvalue the Caller sets on its very first INDUCTION handshake (§4.3.1.1: “Extension Field: 2”). This is not the §3.2.1 Table 3Extension Flagsbitmask (whoseKMREQbit happens to share the same numeric value) — it is a legacy UDT socket-type field (UDT_DGRAM) carried over because the INDUCTION handshake is version-4-shaped for UDT compatibility. - REJECTION_
CODE_ BASE - The base wire value of the Handshake Rejection Reason codes
(
draft-sharabayko-srt-01§4.3, Table 7): a rejected connection’sHandshake Typefield carries1000 + <code>. - SRT_
MAGIC_ CODE - The
Extension Fieldvalue the Listener echoes on its INDUCTION response so the Caller can recognise it as an SRT (not legacy UDT) party (draft-sharabayko-srt-01§4.3.1.1: “SRT magic code 0x4A17”).
Functions§
- derive_
cookie - A simple, deterministic, non-cryptographic mix for deriving a SYN Cookie
from caller-supplied inputs (
draft-sharabayko-srt-01§4.3.1.1: “a cookie that is crafted based on host, port and current time with 1 minute accuracy”). The draft specifies the semantic inputs, not a wire algorithm; this crate’s core never reads a clock, sotime_bucket(e.g. UNIX time / 60) must come from the caller/driver.