Skip to main content

CallerLink

Struct CallerLink 

Source
pub struct CallerLink { /* private fields */ }
Available on crate feature 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

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).

Source

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.

The established link, once the peer has resolved the handshake.

The established link, for sending and polling.

Source

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.

Source

pub fn on_datagram(&mut self, datagram: &[u8], now: Instant) -> Delivered

Process one datagram from the peer at now.

Source

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.

Source

pub fn next_deadline(&self, now: Instant) -> Option<Instant>

The next instant this link must act without an inbound datagram, whichever half is active.

Source

pub fn take_sent(&mut self) -> Vec<Vec<u8>>

Every datagram this attempt still owes the peer: the handshake’s, or the link’s.

Source

pub fn flush(&mut self, now: Instant, sent: &mut Vec<Vec<u8>>)

Append every datagram due at now to sent, as the host writes them: the handshake’s, then the link’s through Link::flush, which records the transmission.

Trait Implementations§

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more