pub struct NdiscOption<T: AsRef<[u8]>> { /* private fields */ }
Expand description
A read/write wrapper around an NDISC Option.
Implementations§
Source§impl<T: AsRef<[u8]>> NdiscOption<T>
impl<T: AsRef<[u8]>> NdiscOption<T>
Core getter methods relevant to any type of NDISC option.
Sourcepub const fn new_unchecked(buffer: T) -> NdiscOption<T>
pub const fn new_unchecked(buffer: T) -> NdiscOption<T>
Create a raw octet buffer with an NDISC Option structure.
Sourcepub fn new_checked(buffer: T) -> Result<NdiscOption<T>>
pub fn new_checked(buffer: T) -> Result<NdiscOption<T>>
Shorthand for a combination of new_unchecked and check_len.
Sourcepub fn check_len(&self) -> Result<()>
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.
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consume the NDISC option, returning the underlying buffer.
Sourcepub fn option_type(&self) -> Type
pub fn option_type(&self) -> Type
Return the option type.
Source§impl<T: AsRef<[u8]>> NdiscOption<T>
impl<T: AsRef<[u8]>> NdiscOption<T>
Getter methods only relevant for Source/Target Link-layer Address options.
Sourcepub fn link_layer_addr(&self) -> RawHardwareAddress
pub fn link_layer_addr(&self) -> RawHardwareAddress
Return the Source/Target Link-layer Address.
Source§impl<T: AsRef<[u8]>> NdiscOption<T>
impl<T: AsRef<[u8]>> NdiscOption<T>
Getter methods only relevant for the MTU option.
Source§impl<T: AsRef<[u8]>> NdiscOption<T>
impl<T: AsRef<[u8]>> NdiscOption<T>
Getter methods only relevant for the Prefix Information option.
Sourcepub fn prefix_len(&self) -> u8
pub fn prefix_len(&self) -> u8
Return the prefix length.
Sourcepub fn prefix_flags(&self) -> PrefixInfoFlags
pub fn prefix_flags(&self) -> PrefixInfoFlags
Return the prefix information flags.
Sourcepub fn valid_lifetime(&self) -> Duration
pub fn valid_lifetime(&self) -> Duration
Return the valid lifetime of the prefix.
Sourcepub fn preferred_lifetime(&self) -> Duration
pub fn preferred_lifetime(&self) -> Duration
Return the preferred lifetime of the prefix.
Sourcepub fn prefix(&self) -> Ipv6Address
pub fn prefix(&self) -> Ipv6Address
Return the prefix.
Source§impl<T: AsRef<[u8]> + AsMut<[u8]>> NdiscOption<T>
impl<T: AsRef<[u8]> + AsMut<[u8]>> NdiscOption<T>
Core setter methods relevant to any type of NDISC option.
Sourcepub fn set_option_type(&mut self, value: Type)
pub fn set_option_type(&mut self, value: Type)
Set the option type.
Sourcepub fn set_data_len(&mut self, value: u8)
pub fn set_data_len(&mut self, value: u8)
Set the option data length.
Source§impl<T: AsRef<[u8]> + AsMut<[u8]>> NdiscOption<T>
impl<T: AsRef<[u8]> + AsMut<[u8]>> NdiscOption<T>
Setter methods only relevant for Source/Target Link-layer Address options.
Sourcepub fn set_link_layer_addr(&mut self, addr: RawHardwareAddress)
pub fn set_link_layer_addr(&mut self, addr: RawHardwareAddress)
Set the Source/Target Link-layer Address.
Source§impl<T: AsRef<[u8]> + AsMut<[u8]>> NdiscOption<T>
impl<T: AsRef<[u8]> + AsMut<[u8]>> NdiscOption<T>
Setter methods only relevant for the MTU option.
Source§impl<T: AsRef<[u8]> + AsMut<[u8]>> NdiscOption<T>
impl<T: AsRef<[u8]> + AsMut<[u8]>> NdiscOption<T>
Setter methods only relevant for the Prefix Information option.
Sourcepub fn set_prefix_len(&mut self, value: u8)
pub fn set_prefix_len(&mut self, value: u8)
Set the prefix length.
Sourcepub fn set_prefix_flags(&mut self, flags: PrefixInfoFlags)
pub fn set_prefix_flags(&mut self, flags: PrefixInfoFlags)
Set the prefix information flags.
Sourcepub fn set_valid_lifetime(&mut self, time: Duration)
pub fn set_valid_lifetime(&mut self, time: Duration)
Set the valid lifetime of the prefix.
Sourcepub fn set_preferred_lifetime(&mut self, time: Duration)
pub fn set_preferred_lifetime(&mut self, time: Duration)
Set the preferred lifetime of the prefix.
Sourcepub fn clear_prefix_reserved(&mut self)
pub fn clear_prefix_reserved(&mut self)
Clear the reserved bits.
Sourcepub fn set_prefix(&mut self, addr: Ipv6Address)
pub fn set_prefix(&mut self, addr: Ipv6Address)
Set the prefix.
Source§impl<T: AsRef<[u8]> + AsMut<[u8]>> NdiscOption<T>
impl<T: AsRef<[u8]> + AsMut<[u8]>> NdiscOption<T>
Setter methods only relevant for the Redirected Header option.
Sourcepub fn clear_redirected_reserved(&mut self)
pub fn clear_redirected_reserved(&mut self)
Clear the reserved bits.