NeighborMessage

Struct NeighborMessage 

Source
pub struct NeighborMessage { /* private fields */ }
Expand description

Strongly-typed neighbor message with all attributes parsed.

Implementations§

Source§

impl NeighborMessage

Source

pub fn new() -> Self

Create a new empty neighbor message.

Source

pub fn family(&self) -> u8

Get the address family.

Source

pub fn ifindex(&self) -> u32

Get the interface index.

Source

pub fn state(&self) -> NeighborState

Get the neighbor state.

Source

pub fn flags(&self) -> u8

Get the neighbor flags.

Source

pub fn destination(&self) -> Option<&IpAddr>

Get the destination address.

Source

pub fn lladdr(&self) -> Option<&[u8]>

Get the link-layer address as bytes.

Source

pub fn probes(&self) -> Option<u32>

Get the number of probes.

Source

pub fn vlan(&self) -> Option<u16>

Get the VLAN ID.

Source

pub fn port(&self) -> Option<u16>

Get the port.

Source

pub fn vni(&self) -> Option<u32>

Get the VNI.

Source

pub fn master(&self) -> Option<u32>

Get the master device index.

Source

pub fn cache_info(&self) -> Option<&NeighborCacheInfo>

Get the cache info.

Source

pub fn mac_address(&self) -> Option<String>

Format the link-layer address as a MAC string.

Source

pub fn is_ipv4(&self) -> bool

Check if this is an IPv4 neighbor.

Source

pub fn is_ipv6(&self) -> bool

Check if this is an IPv6 neighbor.

Source

pub fn is_reachable(&self) -> bool

Check if the neighbor is reachable.

Source

pub fn is_permanent(&self) -> bool

Check if the neighbor is permanent.

Source

pub fn is_stale(&self) -> bool

Check if the neighbor is stale.

Source

pub fn is_incomplete(&self) -> bool

Check if the neighbor is incomplete.

Source

pub fn is_failed(&self) -> bool

Check if the neighbor failed.

Source

pub fn is_router(&self) -> bool

Check if this is a router (for IPv6).

Source

pub fn is_proxy(&self) -> bool

Check if this is a proxy entry.

Trait Implementations§

Source§

impl Clone for NeighborMessage

Source§

fn clone(&self) -> NeighborMessage

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NeighborMessage

Source§

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

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

impl Default for NeighborMessage

Source§

fn default() -> NeighborMessage

Returns the “default value” for a type. Read more
Source§

fn write_dump_header(buf: &mut Vec<u8>)

Write the header required for dump requests. This is appended to the netlink message after the nlmsghdr. Default implementation writes nothing (for messages that don’t need a header).
Source§

fn parse(input: &mut &[u8]) -> PResult<Self>

Parse from a mutable byte slice reference. The slice is advanced past the consumed bytes.
Source§

fn from_bytes(data: &[u8]) -> Result<Self>

Parse from a complete byte slice.
Source§

impl Printable for NeighborMessage

Source§

fn print_text<W: Write>(&self, w: &mut W, _opts: &OutputOptions) -> Result<()>

Print as plain text.
Source§

fn to_json(&self) -> Value

Convert to JSON value.
Source§

fn print<W: Write>( &self, w: &mut W, format: OutputFormat, opts: &OutputOptions, ) -> Result<()>

Print in the specified format.
Calculate the serialized size in bytes.
Source§

fn write_to(&self, buf: &mut Vec<u8>) -> Result<usize>

Write to a byte buffer. Returns the number of bytes written.
Source§

fn to_bytes(&self) -> Result<Vec<u8>>

Serialize to a new byte vector.

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> 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 = Infallible

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.