pub struct CallerLink { /* private fields */ }link only.Expand description
The caller role: the HSv5 caller handshake, then the established Link.
The host calls CallerLink::connect once and sends what CallerLink::take_sent hands back;
every answer from the peer goes to CallerLink::on_datagram, and the host wakes at
CallerLink::next_deadline to call CallerLink::poll. A resolution turns the state into
a Link, whose own deadlines and datagrams follow from then on.
Implementations§
Source§impl CallerLink
impl CallerLink
Sourcepub fn new(params: &CallerParams, seed: Vec<u8>, attempt: u64) -> Self
pub fn new(params: &CallerParams, seed: Vec<u8>, attempt: u64) -> Self
A link that has not opened yet. seed is the secret entropy every attempt derives its
Socket ID, ISN and stream key from, and attempt names this opening (a reconnect is the
next attempt, and derives fresh values).
Sourcepub fn own_socket_id(&self) -> u32
pub fn own_socket_id(&self) -> u32
The caller’s own SRT Socket ID this side advertises: the caller’s if it named itself, else this attempt’s derivation from the seed.
Sourcepub fn link(&self) -> Option<&Link>
pub fn link(&self) -> Option<&Link>
The established link, once the peer has resolved the handshake.
Sourcepub fn connect(&mut self, now: Instant)
pub fn connect(&mut self, now: Instant)
Start the handshake at now, deriving this attempt’s Socket ID, ISN and stream key from
the seed. The induction datagram waits for CallerLink::take_sent; a caller that cannot
frame one has no datagram to send.
Sourcepub fn on_datagram(&mut self, datagram: &[u8], now: Instant) -> Delivered
pub fn on_datagram(&mut self, datagram: &[u8], now: Instant) -> Delivered
Process one datagram from the peer at now.
Sourcepub fn poll(&mut self, now: Instant) -> Delivered
pub fn poll(&mut self, now: Instant) -> Delivered
Advance the handshake at now: an unanswered request is re-sent once per period — a
late wake is one retransmit, not one per missed period (#3847) — and the caller’s budget
bounds the attempt.
Sourcepub fn next_deadline(&self, now: Instant) -> Option<Instant>
pub fn next_deadline(&self, now: Instant) -> Option<Instant>
The next instant this link must act without an inbound datagram, whichever half is active.