Skip to main content

HandshakeConfig

Struct HandshakeConfig 

Source
#[non_exhaustive]
pub struct HandshakeConfig {
Show 13 fields pub latency: Duration, pub mtu: u32, pub max_flow_window_size: u32, pub initial_seq_number: u32, pub srt_version: u32, pub flags: HandshakeExtensionMessageFlags, pub encryption_field: EncryptionField, pub stream_id: Option<String>, pub group: Option<GroupMembershipExtension>, pub local_ip: [u32; 4], pub retransmit_after: Duration, pub max_retries: u32, pub crypto: Option<CryptoConfig>,
}
Expand description

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

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.
§latency: Duration

TSBPD delay this side requests, sent as both the Receiver and Sender TSBPD Delay of its Handshake Extension Message (§3.2.1.1, Figure 6), in whole milliseconds on the wire. The negotiated value is the greater of the two parties’ requests (§4.3.1.2).

§mtu: u32

Maximum Transmission Unit Size (§3.2.1).

§max_flow_window_size: u32

Maximum Flow Window Size (§3.2.1).

§initial_seq_number: u32

Initial Packet Sequence Number this side will use for its first data packet (§3.2.1). No data plane exists yet in this crate; callers of a later data-plane PR are expected to set this to a real ISN.

§srt_version: u32

The SRT Version this side reports in its Handshake Extension Message (major * 0x10000 + minor * 0x100 + patch, §3.2.1.1).

§flags: HandshakeExtensionMessageFlags

SRT Flags this side advertises (§3.2.1.1.1, Table 6).

§encryption_field: EncryptionField

Advertised cipher family and block size (§3.2.1, Table 2). Actual key-wrap/unwrap crypto is an explicit follow-up; this field is negotiated but not acted on in this release.

§stream_id: Option<String>

Stream ID to advertise (Caller only — §3.2.1.3); None sends no Stream ID extension.

§group: Option<GroupMembershipExtension>

Group Membership to advertise (§3.2.1.4); None sends no Group extension.

§local_ip: [u32; 4]

This side’s own IP address, reported in every outgoing handshake packet’s Peer IP Address field (§3.2.1: “IPv4 or IPv6 address of the packet’s sender” — despite the field’s name, each party reports its own address, not its peer’s).

§retransmit_after: Duration

Longest silence from the peer before the last-sent handshake packet is retransmitted: a crate::caller::CallerHandshake::tick / crate::listener::ListenerHandshake::tick call is the caller’s own time step, and the engine resends once that much of it has passed with no reply. No wall-clock lives in this crate.

§max_retries: u32

Maximum number of retransmissions before the handshake gives up (HandshakeOutput::TimedOut).

§crypto: Option<CryptoConfig>
Available on crate feature crypto only.

Opt-in §6 payload-encryption negotiation (crypto feature only). None (the default) means this side neither offers nor requires encryption. See CryptoConfig for the caller-supplied Salt/SEK contract.

Implementations§

Source§

impl HandshakeConfig

Source

pub fn with_latency(self, latency: Duration) -> Self

Sets latency.

Source

pub fn with_mtu(self, mtu: u32) -> Self

Sets mtu.

Source

pub fn with_max_flow_window_size(self, max_flow_window_size: u32) -> Self

Source

pub fn with_initial_seq_number(self, initial_seq_number: u32) -> Self

Source

pub fn with_srt_version(self, srt_version: u32) -> Self

Source

pub fn with_flags(self, flags: HandshakeExtensionMessageFlags) -> Self

Sets flags.

Source

pub fn with_encryption_field(self, encryption_field: EncryptionField) -> Self

Source

pub fn with_stream_id(self, stream_id: Option<String>) -> Self

Sets stream_id.

Source

pub fn with_group(self, group: Option<GroupMembershipExtension>) -> Self

Sets group.

Source

pub fn with_local_ip(self, local_ip: [u32; 4]) -> Self

Sets local_ip.

Source

pub fn with_retransmit_after(self, retransmit_after: Duration) -> Self

Source

pub fn with_max_retries(self, max_retries: u32) -> Self

Source

pub fn with_crypto(self, crypto: Option<CryptoConfig>) -> Self

Available on crate feature crypto only.

Sets crypto.

Source§

impl HandshakeConfig

Source

pub fn new( latency: Duration, mtu: u32, max_flow_window_size: u32, retransmit_after: Duration, max_retries: u32, ) -> Self

A configuration advertising latency, mtu and max_flow_window_size, retransmitting an unanswered handshake packet every retransmit_after and giving up after max_retries retransmissions. Every number is the caller’s: the crate supplies none. The rest starts as this crate’s feature set with no stream id, group or encryption.

Source§

impl HandshakeConfig

Source

pub fn for_profile(profile: Profile) -> Self

The Profile preset, built from this crate’s feature set with no stream id, group or encryption, replaceable through its with_* setters.

Trait Implementations§

Source§

impl Clone for HandshakeConfig

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 HandshakeConfig

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for HandshakeConfig

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for HandshakeConfig

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