Skip to main content

count_flows_in_file

Function count_flows_in_file 

Source
pub fn count_flows_in_file(
    path: &Path,
    filter: &Filter,
    bpf: Option<&BpfExpr>,
    unidirectional: bool,
) -> Result<HashMap<u64, u64>, PcapError>
Expand description

Count packets per flow ID in a single streaming pass over path.

Applies filter and bpf to each packet (caller must clear filter.flow_ids to avoid circular exclusion). Non-IP packets (no flow key) are not counted.

Returns a map from flow ID → packet count.

§Errors

Returns ToolkitPcapError on I/O or parse failure.