pub trait Engine {
type Loader: Loader<Component = Self> + Default;
const EBPF_BYTES: &'static [u8];
const EBPF_PROGRAM_NAME: &'static str;
// Required methods
fn capacity(&self) -> Option<usize>;
fn add_rule(&mut self, rule_id: RuleId, rule: &Rule) -> Result<(), Error>;
fn remove_rule(&mut self, rule_id: RuleId, rule: &Rule) -> Result<(), Error>;
}Expand description
The Engine trait defines how rules are evaluated in the eBPF program. Each Engine requires a matching eBPF program.
Required Associated Constants§
Sourceconst EBPF_BYTES: &'static [u8]
const EBPF_BYTES: &'static [u8]
The raw bytes of the eBPF program
Sourceconst EBPF_PROGRAM_NAME: &'static str
const EBPF_PROGRAM_NAME: &'static str
The eBPF program name
Required Associated Types§
Required Methods§
Sourcefn capacity(&self) -> Option<usize>
fn capacity(&self) -> Option<usize>
If this engnine is limited in max capacity, return the capcacity
Sourcefn add_rule(&mut self, rule_id: RuleId, rule: &Rule) -> Result<(), Error>
fn add_rule(&mut self, rule_id: RuleId, rule: &Rule) -> Result<(), Error>
Add a rule to the engine
§Errors
Returns Error::EngineAtCapacity if the engine cannot accept additional rules.
Returns additional errors depending on the engine implementation.
Sourcefn remove_rule(&mut self, rule_id: RuleId, rule: &Rule) -> Result<(), Error>
fn remove_rule(&mut self, rule_id: RuleId, rule: &Rule) -> Result<(), Error>
Remove a rule from the engine
§Errors
Returns Error::MissingRule if the rule id is not present in the filter.
Returns additional errors depending on the engine implementation.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.