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