NetworkEvent

Enum NetworkEvent 

Source
pub enum NetworkEvent {
Show 18 variants NewLink(LinkMessage), DelLink(LinkMessage), NewAddress(AddressMessage), DelAddress(AddressMessage), NewRoute(RouteMessage), DelRoute(RouteMessage), NewNeighbor(NeighborMessage), DelNeighbor(NeighborMessage), NewFdb(FdbEntry), DelFdb(FdbEntry), NewQdisc(TcMessage), DelQdisc(TcMessage), NewClass(TcMessage), DelClass(TcMessage), NewFilter(TcMessage), DelFilter(TcMessage), NewAction(TcMessage), DelAction(TcMessage),
}
Expand description

Network events that can be received from the kernel.

These events are generated when network configuration changes occur. Use Connection<Route>::subscribe to select which event types to receive, then use Connection::events to get a stream of events.

Variants§

A new link was created or an existing link changed.

A link was deleted.

§

NewAddress(AddressMessage)

A new address was added.

§

DelAddress(AddressMessage)

An address was removed.

§

NewRoute(RouteMessage)

A new route was added.

§

DelRoute(RouteMessage)

A route was removed.

§

NewNeighbor(NeighborMessage)

A new neighbor entry was added.

§

DelNeighbor(NeighborMessage)

A neighbor entry was removed.

§

NewFdb(FdbEntry)

A new FDB entry was added or learned.

§

DelFdb(FdbEntry)

An FDB entry was removed.

§

NewQdisc(TcMessage)

A new qdisc was added or changed.

§

DelQdisc(TcMessage)

A qdisc was deleted.

§

NewClass(TcMessage)

A new class was added or changed.

§

DelClass(TcMessage)

A class was deleted.

§

NewFilter(TcMessage)

A new filter was added or changed.

§

DelFilter(TcMessage)

A filter was deleted.

§

NewAction(TcMessage)

A new action was added or changed.

§

DelAction(TcMessage)

An action was deleted.

Implementations§

Source§

impl NetworkEvent

Source

pub fn is_new(&self) -> bool

Returns true if this is a “new” event (add or change).

Source

pub fn is_del(&self) -> bool

Returns true if this is a “delete” event.

Source

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

Returns the interface index associated with this event, if any.

Source

pub fn action(&self) -> &'static str

Returns “new” or “del” based on the event type.

Useful for display/logging purposes.

Returns the inner LinkMessage if this is a link event.

Consumes self and returns the inner LinkMessage if this is a link event.

Source

pub fn as_address(&self) -> Option<&AddressMessage>

Returns the inner AddressMessage if this is an address event.

Source

pub fn into_address(self) -> Option<AddressMessage>

Consumes self and returns the inner AddressMessage if this is an address event.

Source

pub fn as_route(&self) -> Option<&RouteMessage>

Returns the inner RouteMessage if this is a route event.

Source

pub fn into_route(self) -> Option<RouteMessage>

Consumes self and returns the inner RouteMessage if this is a route event.

Source

pub fn as_neighbor(&self) -> Option<&NeighborMessage>

Returns the inner NeighborMessage if this is a neighbor event.

Source

pub fn into_neighbor(self) -> Option<NeighborMessage>

Consumes self and returns the inner NeighborMessage if this is a neighbor event.

Source

pub fn as_fdb(&self) -> Option<&FdbEntry>

Returns the inner FdbEntry if this is an FDB event.

Source

pub fn into_fdb(self) -> Option<FdbEntry>

Consumes self and returns the inner FdbEntry if this is an FDB event.

Source

pub fn as_tc(&self) -> Option<&TcMessage>

Returns the inner TcMessage if this is a TC event (qdisc, class, filter, or action).

Source

pub fn into_tc(self) -> Option<TcMessage>

Consumes self and returns the inner TcMessage if this is a TC event.

Trait Implementations§

Source§

impl Clone for NetworkEvent

Source§

fn clone(&self) -> NetworkEvent

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 NetworkEvent

Source§

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

Formats the value using the given formatter. Read more

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.