pub struct ListenerHandshake { /* private fields */ }Expand description
A driveable Listener-side SRT handshake (draft-sharabayko-srt-01
§4.3.1). syn_cookie is supplied by the caller/driver — this crate’s core
never reads a clock or a socket address; see
crate::handshake_sm::derive_cookie for a ready-made (non-standardized)
derivation helper.
Implementations§
Source§impl ListenerHandshake
impl ListenerHandshake
Sourcepub fn new(own_socket_id: u32, syn_cookie: u32, config: HandshakeConfig) -> Self
pub fn new(own_socket_id: u32, syn_cookie: u32, config: HandshakeConfig) -> Self
Creates a fresh Listener handshake in ListenerHandshakeState::Idle,
with the SYN Cookie it will hand out on INDUCTION and check on
CONCLUSION.
Sourcepub fn set_elapsed(&mut self, elapsed: Duration)
pub fn set_elapsed(&mut self, elapsed: Duration)
Sets the time elapsed since the connection started; every packet built
from here on carries it as its wire timestamp (§3.2.1). The machine reads
no clock, so the driver calls this before each start, feed and tick.
Sourcepub fn state(&self) -> ListenerHandshakeState
pub fn state(&self) -> ListenerHandshakeState
The current state.
Sourcepub fn negotiated(&self) -> Option<&NegotiatedParams>
pub fn negotiated(&self) -> Option<&NegotiatedParams>
The negotiated parameters, once ListenerHandshakeState::Connected.
Sourcepub fn feed(
&mut self,
packet: &ControlPacket<'_>,
) -> Result<Vec<HandshakeOutput>>
pub fn feed( &mut self, packet: &ControlPacket<'_>, ) -> Result<Vec<HandshakeOutput>>
Feeds an inbound control packet.
A repeated INDUCTION while awaiting the CONCLUSION re-sends the INDUCTION response; a repeated CONCLUSION from the connected peer (matching Socket ID and cookie) re-sends the CONCLUSION response.
§Errors
Error::UnexpectedControlPacket if packet is not a Handshake
packet; Error::HandshakeOutOfSequence if fed in a state that
expects nothing more (a driver bug, or a stranger’s packet after the
handshake finished — not a peer failure).
Sourcepub fn feed_bytes(&mut self, bytes: &[u8]) -> Result<Vec<HandshakeOutput>>
pub fn feed_bytes(&mut self, bytes: &[u8]) -> Result<Vec<HandshakeOutput>>
Convenience wrapper: parses bytes as a ControlPacket then
Self::feeds it.
Sourcepub fn tick(&mut self) -> Vec<HandshakeOutput>
pub fn tick(&mut self) -> Vec<HandshakeOutput>
Advances retransmit timing by one caller-defined tick, mirroring
crate::caller::CallerHandshake::tick.