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>
impl<FeatureConfig> FeatureRegistration<FeatureConfig>
Sourcepub 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
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_namefield must point to a valid nul-terminated C string that lives for the lifetime of the registration. - The
runs_beforeandruns_afterfields 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::registermust be called before calling other methods.
Sourcepub unsafe fn register(&'static self)
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.
Sourcepub unsafe fn unregister(&self)
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.
Sourcepub fn enable(
&self,
_vm: &BarrierHeldMainRef,
sw_if_index: SwIfIndex,
feature_config: FeatureConfig,
) -> Result<(), VnetError>
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).
Trait Implementations§
impl<T> Sync for FeatureRegistration<T>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more