packet_strata/tracker/
process.rs

1use crate::{metadata::PacketMetadata, packet::Packet, tracker::direction::PacketDirection};
2
3/// A trait for types that can process a packet and update their state.
4///
5/// This is primarily used by `Flow` to update statistics (counters, timestamps)
6/// and protocol-specific state machines (like TCP) upon receiving a new packet.
7pub trait Process {
8    /// Update the state based on the provided packet metadata and content.
9    fn process<Meta: PacketMetadata>(
10        &mut self,
11        meta: &Meta,
12        pkt: &Packet<'_>,
13        dir: PacketDirection,
14    );
15}
16
17impl Process for () {
18    fn process<Meta: PacketMetadata>(
19        &mut self,
20        _meta: &Meta,
21        _pkt: &Packet<'_>,
22        _dir: PacketDirection,
23    ) {
24    }
25}