xarxa

Crates

git

Versions

default

Flavors

Skip to main content

NdiscOption

Struct NdiscOption 

Source
pub struct NdiscOption<'a> { /* private fields */ }
Expand description

A read/write wrapper around an NDISC Option.

Implementations§

Source§

impl<'a> NdiscOption<'a>

Core getter methods relevant to any type of NDISC option.

Source

pub const fn new_unchecked(buffer: &'a mut [u8]) -> NdiscOption<'a>

Create a raw octet buffer with an NDISC Option structure.

Source

pub fn new_checked(buffer: &'a mut [u8]) -> Result<NdiscOption<'a>>

Shorthand for a combination of new_unchecked and check_len.

Source

pub fn check_len(&self) -> Result<()>

Ensure that no accessor method will panic if called. Returns Err(Error) if the buffer is too short.

The result of this check is invalidated by calling set_data_len.

Source

pub fn option_type(&self) -> Type

Return the option type.

Source

pub fn data_len(&self) -> u8

Return the length of the data.

Source§

impl<'a> NdiscOption<'a>

Getter methods only relevant for Source/Target Link-layer Address options.

Return the Source/Target Link-layer Address.

Source§

impl<'a> NdiscOption<'a>

Getter methods only relevant for the MTU option.

Source

pub fn mtu(&self) -> u32

Return the MTU value.

Source§

impl<'a> NdiscOption<'a>

Getter methods only relevant for the Prefix Information option.

Source

pub fn prefix_len(&self) -> u8

Return the prefix length.

Source

pub fn prefix_flags(&self) -> PrefixInfoFlags

Return the prefix information flags.

Source

pub fn valid_lifetime(&self) -> Duration

Return the valid lifetime of the prefix.

Source

pub fn preferred_lifetime(&self) -> Duration

Return the preferred lifetime of the prefix.

Source

pub fn prefix(&self) -> Ipv6Address

Return the prefix.

Source§

impl<'a> NdiscOption<'a>

Source

pub fn data(&self) -> &[u8]

Return the option data.

Source§

impl<'a> NdiscOption<'a>

Core setter methods relevant to any type of NDISC option.

Source

pub fn set_option_type(&mut self, value: Type)

Set the option type.

Source

pub fn set_data_len(&mut self, value: u8)

Set the option data length.

Source§

impl<'a> NdiscOption<'a>

Setter methods only relevant for Source/Target Link-layer Address options.

Set the Source/Target Link-layer Address.

Source§

impl<'a> NdiscOption<'a>

Setter methods only relevant for the MTU option.

Source

pub fn set_mtu(&mut self, value: u32)

Set the MTU value.

Source§

impl<'a> NdiscOption<'a>

Setter methods only relevant for the Prefix Information option.

Source

pub fn set_prefix_len(&mut self, value: u8)

Set the prefix length.

Source

pub fn set_prefix_flags(&mut self, flags: PrefixInfoFlags)

Set the prefix information flags.

Source

pub fn set_valid_lifetime(&mut self, time: Duration)

Set the valid lifetime of the prefix.

Source

pub fn set_preferred_lifetime(&mut self, time: Duration)

Set the preferred lifetime of the prefix.

Source

pub fn clear_prefix_reserved(&mut self)

Clear the reserved bits.

Source

pub fn set_prefix(&mut self, addr: Ipv6Address)

Set the prefix.

Source§

impl<'a> NdiscOption<'a>

Setter methods only relevant for the Redirected Header option.

Source

pub fn clear_redirected_reserved(&mut self)

Clear the reserved bits.

Source§

impl<'a> NdiscOption<'a>

Source

pub fn data_mut(&mut self) -> &mut [u8]

Return a mutable pointer to the option data.

Trait Implementations§

Source§

impl<'a> Debug for NdiscOption<'a>

Source§

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

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

impl<'a> Eq for NdiscOption<'a>

Source§

impl<'a> PartialEq for NdiscOption<'a>

Source§

fn eq(&self, other: &NdiscOption<'a>) -> bool

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

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

Inequality operator !=. Read more
Source§

impl<'a> StructuralPartialEq for NdiscOption<'a>

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for NdiscOption<'a>

§

impl<'a> Freeze for NdiscOption<'a>

§

impl<'a> RefUnwindSafe for NdiscOption<'a>

§

impl<'a> Send for NdiscOption<'a>

§

impl<'a> Sync for NdiscOption<'a>

§

impl<'a> Unpin for NdiscOption<'a>

§

impl<'a> UnsafeUnpin for NdiscOption<'a>

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, 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, <T as TryFrom<U>>::Error>

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.