Skip to main content

FeatureRegistration

Struct FeatureRegistration 

Source
pub struct FeatureRegistration<FeatureConfig> { /* private fields */ }
Expand description

Registration information for a VPP feature

This is typically created automatically using the crate::vnet_feature_init macro.

Implementations§

Source§

impl<FeatureConfig> FeatureRegistration<FeatureConfig>

Source

pub const unsafe fn new<N: Node<FeatureData = FeatureConfig>, const N_NEXT_NODES: usize>( feat: vnet_feature_registration_t, node: &'static NodeRegistration<N, N_NEXT_NODES>, ) -> Self

Creates a new FeatureRegistration from the given registration data

The node_name field will be filled in from the name of the node parameter.

§Safety
  • The arc_name field must point to a valid nul-terminated C string that lives for the lifetime of the registration.
  • The runs_before and runs_after fields must either be a valid null-terminated array of valid pointers to nul-terminated C string that live for the lifetime of the registration, or null.
  • Other pointers may be left null.
  • Self::register must be called before calling other methods.
Source

pub unsafe fn register(&'static self)

Registers the feature with VPP

§Safety
  • Must be called only once for this node registration.
  • Must be called from a constructor function that is invoked before VPP initialises.
Source

pub unsafe fn unregister(&self)

Unregisters the node with VPP

§Safety
  • Must be called from a destructor function.
  • Must be called only once for this node registration.
  • The node must have been previously registered with VPP using Self::register.
Source

pub fn enable( &self, _vm: &BarrierHeldMainRef, sw_if_index: SwIfIndex, feature_config: FeatureConfig, ) -> Result<(), VnetError>

Enables the feature on the given software interface index

If feature_config is provided, it can be obtained by feature node when processing packets.

If the feature arc doesn’t operate on a per-interface basis, sw_if_index can be set to SwIfIndex::new(0).

Source

pub fn disable( &self, _vm: &BarrierHeldMainRef, sw_if_index: SwIfIndex, ) -> Result<(), VnetError>

Disables the feature on the given software interface index

If the feature arc doesn’t operate on a per-interface basis, sw_if_index can be set to SwIfIndex::new(0).

Trait Implementations§

Auto Trait Implementations§

§

impl<FeatureConfig> !Freeze for FeatureRegistration<FeatureConfig>

§

impl<FeatureConfig> !RefUnwindSafe for FeatureRegistration<FeatureConfig>

§

impl<FeatureConfig> !Send for FeatureRegistration<FeatureConfig>

§

impl<FeatureConfig> Unpin for FeatureRegistration<FeatureConfig>
where FeatureConfig: Unpin,

§

impl<FeatureConfig> UnsafeUnpin for FeatureRegistration<FeatureConfig>

§

impl<FeatureConfig> UnwindSafe for FeatureRegistration<FeatureConfig>
where FeatureConfig: UnwindSafe,

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> 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, 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.