Skip to main content

load_pcap_and_process

Function load_pcap_and_process 

Source
pub fn load_pcap_and_process<M, C, E, H>(
    config: &Config,
    handler: &H,
) -> Result<(), Box<dyn Error>>
where C: Default, H: ProtocolHandler<M, C, E>,
Expand description

Load and process a PCAP file with the given configuration and handler.

This function reads packets from the specified PCAP file, decodes them using the provided handler, and writes the results to a JSON Lines output file or standard output.

§Arguments

  • config - Configuration containing paths and options for processing: destination ports on which the protocol handler will filter packets, input size limit, PCAP file path, and optional output path.
  • handler - Protocol handler that implements the ProtocolHandler trait

§Returns

  • Ok(()) if processing was successful
  • Err if an error occurred during file operations or processing