Struct Analyzer

Source
pub struct Analyzer { /* private fields */ }
Expand description

Pcap/Pcap-ng analyzer

Read input pcap/pcap-ng data, parse it and call plugin callbacks for each ISO layer (L2 if available, L3 and L4). Flows are created for L4 sessions. Events are sent when plugins are created or destroyed.

The number of worker threads can be configured from the num_threads configuration variable. By default, it is 0 (auto-detect the number of cores and create the same number of threads).

All callbacks for a single ISO layer will be called concurrently before calling the next level callbacks.

Implementations§

Source§

impl Analyzer

Source

pub fn new(registry: Arc<PluginRegistry>, config: &Config) -> Analyzer

Source

pub fn registry(&self) -> &PluginRegistry

Get a reference to plugin registry

Source

pub fn with_deterministic_rng(self) -> Self

Use deterministic values for random numbers (for ex. flow IDs)

This option is intended for use in testing

Trait Implementations§

Source§

impl PcapAnalyzer for Analyzer

Source§

fn init(&mut self) -> Result<(), Error>

Initialize all plugins

Source§

fn handle_packet( &mut self, packet: &Packet<'_>, ctx: &ParseContext, ) -> Result<(), Error>

Dispatch function: given a packet, use link type to get the real data, and call the matching handling function (some pcap blocks encode ethernet, or IPv4 etc.)

Source§

fn teardown(&mut self)

Finalize analysis and notify plugins

Source§

fn handle_block( &mut self, _block: &PcapBlockOwned<'_>, _block_ctx: &ParseBlockContext, ) -> Result<(), Error>

Optional callback for every block of the pcap/pcapng file
Source§

fn before_refill(&mut self)

Source§

impl SafePcapAnalyzer for Analyzer

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