Skip to main content

Foreign

Struct Foreign 

Source
#[non_exhaustive]
pub struct Foreign { pub bbmd: SocketAddrV4, pub ttl: u16, pub renewal: Duration, pub response_timeout: Duration, pub retry: Retry, pub hold: u16, pub trust: ForwardedTrust, }
Expand description

A foreign device’s registration with its BBMD (Annex J.5.2).

It is #[non_exhaustive], so a new setting isn’t a breaking change: outside this crate, start from Foreign::new and set the fields to change.

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.
§bbmd: SocketAddrV4

The BBMD, at its B/IP address. Replies are matched against this address and port.

§ttl: u16

The time-to-live sent with each registration, in seconds; above 0.

§renewal: Duration

How often to register again: above zero and below the time-to-live. A shorter one than MIN_RENEWAL is raised to it. Registering more often than the time-to-live needs keeps a NAT mapping open (Annex J.7.5).

§response_timeout: Duration

How long an attempt waits for its result: above zero. One longer than the renewal interval is cut to it. It also sets the answer window the lease counts on (Lease).

§retry: Retry

When a failed attempt is tried again.

§hold: u16

How many broadcasts the caller can keep while the first attempt is outstanding. Node::admit_broadcast asks it to hold them until that attempt is answered or times out. With 0 they are sent at once.

§trust: ForwardedTrust

Which Forwarded-NPDUs are taken.

Implementations§

Source§

impl Foreign

Source

pub const fn new(bbmd: SocketAddrV4, ttl: u16) -> Self

Registration with bbmd for ttl seconds: renewed every half time-to-live (at least MIN_RENEWAL), a response timeout of that or DEFAULT_RESPONSE_TIMEOUT if shorter, Retry::Backoff, no broadcasts held, and Forwarded-NPDUs taken only from bbmd.

Source

pub const fn ttl_duration(&self) -> Duration

The time-to-live as a duration.

Source

pub const fn effective_renewal(&self) -> Duration

The renewal interval in use: renewal, at least MIN_RENEWAL.

Source

pub const fn effective_response_timeout(&self) -> Duration

The response timeout in use: response_timeout, at most the effective renewal.

Trait Implementations§

Source§

impl Clone for Foreign

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 Copy for Foreign

Source§

impl Debug for Foreign

Source§

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

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

impl Eq for Foreign

Source§

impl PartialEq for Foreign

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 Foreign

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