Struct netlink_packet_route::tc::TcActionGeneric

source ·
#[non_exhaustive]
pub struct TcActionGeneric { pub index: u32, pub capab: u32, pub action: TcActionType, pub refcnt: i32, pub bindcnt: i32, }
Expand description

Generic traffic control action parameters.

This structure is used to describe attributes common to all traffic control actions.

See #define tc_gen in linux/pkt_cls.h.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§index: u32

The index of the action is a unique identifier used to track actions installed in the kernel.

Each action type (e.g. mirror or nat) has its own independent index space. If you assign the index field to 0 when creating an action, the kernel will assign a unique index to the new action.

§capab: u32

NOTE: I cannot find any documentation on this field nor any place where it is used in iproute2 or the Linux kernel. The capab field is part of the #define tc_gen in the kernel, and that #define is used in many places, but I don’t see any place using the capab field in any way. I may be looking in the wrong place or missing something.

§action: TcActionType

Action type.

§refcnt: i32

Reference count of this action.

This refers to the number of times this action is referenced within the kernel. Actions are cleaned up (deleted) when refcnt reaches 0.

If you create an action on its own (i.e., not associated with a filter), the refcnt will be 1. If that action is then associated with a filter, the refcnt will be 2. If you then delete that filter, the refcnt will be 1 and the action will remain until you explicitly delete it (which is only possible when the refcnt is 1 and the bindcnt is 0).

If you were to create an action indirectly (e.g., as part of creating a filter) then the refcnt will still be 1 (along with the bindcnt). If you then create another filter that references the same action, the refcnt will be 2 (along with the bindcnt).

If you then deleted both of those actions, the refcnt would be 0 and the action would be removed from the kernel.

§bindcnt: i32

Bind count of this action.

The number of filters that reference (bind to) this action.

Trait Implementations§

source§

impl Clone for TcActionGeneric

source§

fn clone(&self) -> TcActionGeneric

Returns a copy 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 TcActionGeneric

source§

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

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

impl Default for TcActionGeneric

source§

fn default() -> TcActionGeneric

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

impl Emitable for TcActionGeneric

source§

fn buffer_len(&self) -> usize

Return the length of the serialized data.
source§

fn emit(&self, buffer: &mut [u8])

Serialize this types and write the serialized data into the given buffer. Read more
source§

impl<T: AsRef<[u8]>> Parseable<TcActionGenericBuffer<T>> for TcActionGeneric

source§

fn parse(buf: &TcActionGenericBuffer<T>) -> Result<Self, DecodeError>

Deserialize the current type.
source§

impl PartialEq for TcActionGeneric

source§

fn eq(&self, other: &TcActionGeneric) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for TcActionGeneric

source§

impl Eq for TcActionGeneric

source§

impl StructuralPartialEq for TcActionGeneric

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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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.