Skip to main content

CallerParams

Struct CallerParams 

Source
#[non_exhaustive]
pub struct CallerParams {
Show 13 fields pub handshake: HandshakeConfig, pub own_socket_id: u32, pub initial_seq_number: u32, pub timers: LinkTimers, pub arq: ArqBounds, pub key_refresh_seed: Zeroizing<Vec<u8>>, pub payload_admits: fn(&[u8]) -> bool, pub damage_policy: DamagePolicy, pub drift_us: i64, pub drift_window: NonZeroU32, pub max_bw: MaxBwConfig, pub km_refresh_thresholds: KmRefreshThresholds, pub refuse_cleartext: bool,
}
Available on crate feature link only.
Expand description

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.

The caller supplies the Socket ID and the ISN; a link never draws them itself, so a host that reads no randomness (or derives them from a seed it keeps) can still open a connection.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§handshake: HandshakeConfig

The handshake this side advertises (latency, stream id, encryption).

§own_socket_id: u32

This caller’s own SRT Socket ID (§3).

§initial_seq_number: u32

This caller’s initial sequence number: the first sequence number it sends (§3.1).

§timers: LinkTimers

The link’s time bounds.

§arq: ArqBounds

The ARQ receiver’s and sender’s bounds.

§key_refresh_seed: Zeroizing<Vec<u8>>

Secret entropy the link derives every refreshed stream key from; it draws none itself. A refresh that cannot be derived (an empty seed) is counted in LinkCounts::key_refresh_failed and reported as damage, never skipped silently.

§payload_admits: fn(&[u8]) -> bool

A synchronous check on each delivered payload: one it refuses is counted and reported, and never delivered. The host names the payload format it expects; the link imposes none, so a link built with CallerParams::new admits every payload.

§damage_policy: DamagePolicy

The caller’s decision about each damage report.

§drift_us: i64

Initial TSBPD drift. The scheduler estimates it from there; zero when none is known.

§drift_window: NonZeroU32

Fresh in-sequence packets per drift-sampling window (§4.7, rules 26-27). The draft names no count, so the caller supplies one.

§max_bw: MaxBwConfig

The LiveCC bandwidth policy that paces DATA packets (§5.1.1).

§km_refresh_thresholds: KmRefreshThresholds

KM Refresh thresholds (§6.1.6, key rotation packet counts).

§refuse_cleartext: bool

Whether a connection that negotiated encryption refuses a DATA packet sent in the clear, counting it undecryptable, rather than delivering it.

Implementations§

Source§

impl CallerParams

Source

pub fn new( handshake: HandshakeConfig, own_socket_id: u32, initial_seq_number: u32, timers: LinkTimers, arq: ArqBounds, key_refresh_seed: Vec<u8>, drift_window: NonZeroU32, ) -> Self

Parameters advertising handshake with this side’s Socket ID and ISN, the caller’s time bounds and key-refresh entropy, DamagePolicy::default (report everything), the default LiveCC policy and a link that admits every delivered payload.

Source

pub fn with_handshake_timeout(self, handshake_timeout: Duration) -> Self

Set how long the handshake may take.

Source

pub fn with_payload_admits(self, payload_admits: fn(&[u8]) -> bool) -> Self

Set which payloads the link delivers (see CallerParams::payload_admits).

Source

pub fn with_damage_policy(self, damage_policy: DamagePolicy) -> Self

Set the caller’s decision about each damage report.

Source

pub fn with_drift_us(self, drift_us: i64) -> Self

Set the initial TSBPD drift.

Source

pub fn with_max_bw(self, max_bw: MaxBwConfig) -> Self

Set the LiveCC bandwidth policy.

Source

pub fn with_read_idle(self, read_idle: Duration) -> Self

Set the peer-idle bound.

Source

pub fn with_passphrase(self, passphrase: Vec<u8>) -> Self

Set the §6 passphrase a peer’s Key Material is recovered with. The encryption field this side advertises still comes from handshake (its CryptoConfig salt and stream key are overwritten per attempt).

Source

pub fn with_cleartext_refused(self) -> Self

Refuse cleartext DATA on a connection that negotiated encryption (see CallerParams::refuse_cleartext).

Source

pub fn with_km_refresh_thresholds(self, thresholds: KmRefreshThresholds) -> Self

Set the KM Refresh thresholds.

Trait Implementations§

Source§

impl Clone for CallerParams

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CallerParams

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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