Struct PluginRegistry

Source
pub struct PluginRegistry { /* private fields */ }

Implementations§

Source§

impl PluginRegistry

Source

pub fn new() -> Self

Source

pub fn num_plugins(&self) -> usize

Return the count of different plugins

A plugin can be registered for several layers, but it will count as one.

Source

pub fn add_plugin(&mut self, plugin: SafePlugin) -> PluginID

Add a plugin to the registry, and return the identifier

Source

pub fn run_plugins<F, P>(&self, predicate: P, f: F)
where F: FnMut(&mut dyn Plugin), P: FnMut(&dyn Plugin) -> bool,

Run function F on all known plugins (registered or not) matching P

Source

pub fn register_layer( &mut self, layer: u8, layer_filter: u16, plugin_id: PluginID, ) -> Result<(), PluginBuilderError>

Register a layer for analysis, for the identified plugin

layer_filter is a filter on the value relative to the layer: for L3, use for ex. ETHERNET_IPV4, for L4, TRANSPORT_TCP, etc. Special value 0 for layer_filter means all possible values.

Source

pub fn get_plugins_for_layer( &self, layer: u8, layer_filter: u16, ) -> Option<&Vec<SafePlugin>>

Get plugins matching the given layer and layer_filter

Source

pub fn iter_registered_plugins( &self, ) -> impl Iterator<Item = (&PluginInfo, &SafePlugin)>

Return an iterator on registered plugins

The same plugin instance can be present multiple times, if registered with different PluginInfo (for ex. layer filters).

Source

pub fn iter_plugins(&self) -> impl Iterator<Item = &SafePlugin>

Return an iterator on all known plugins

Known plugins are plugins present in the registry (registered or not for layers)

Trait Implementations§

Source§

impl Default for PluginRegistry

Source§

fn default() -> PluginRegistry

Returns the “default value” for a type. 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> 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V