Expand description
Packet I/O abstractions.
This module provides traits and implementations for reading packets from various sources (files, memory-mapped files, network streams, etc.)
§Design
The module uses generics with associated types for zero-vtable hot path:
PacketSourcetrait with associatedReadertypePacketReadertrait for sequential reading- Type erasure happens only at DataFusion boundaries
§Available Sources
FilePacketSource- Standard buffered file I/O (works with all file types)MmapPacketSource- Memory-mapped I/O for PCAP/PCAPNG files (requiresmmapfeature)- [
CloudPacketSource] - Cloud storage I/O for S3, GCS, Azure (requirescloudfeature)
§Compression Support
Both sources support transparent decompression of compressed files. Supported formats (via feature flags):
- Gzip (.gz) - always enabled
- Zstd (.zst) -
compress-zstdfeature - LZ4 (.lz4) -
compress-lz4feature - Bzip2 (.bz2) -
compress-bzip2feature - XZ (.xz) -
compress-xzfeature
Structs§
- File
Packet Reader - Sequential packet reader for PCAP files.
- File
Packet Source - Packet source backed by a PCAP/PCAPNG file.
- Generic
Pcap Reader - Generic PCAP/PCAPNG reader over any Read source.
- Mmap
Packet Reader - Memory-mapped packet reader.
- Mmap
Packet Source - Memory-mapped packet source.
- Mmap
Slice - A wrapper that allows sharing mmap data with Cursor. Implements AsRef<u8> so it can be used as Cursor’s inner type.
- Packet
Position - Position within a packet source (for seeking/checkpointing).
- Packet
Range - Range of packets for partitioning.
- Packet
Ref - Borrowed packet reference - zero-copy view into pcap_parser buffer.
- Packet
Source Metadata - Metadata about a packet source.
- RawPacket
- Raw packet data from a reader.
Enums§
- Compression
- Detected compression format.
- Decompress
Reader - Unified decompression reader that wraps various decompression formats.
- Pcap
Format - Format of the PCAP file.
Traits§
- Packet
Reader - Sequential reader of packets from a source.
- Packet
Source - Source of packet data. Creates readers and computes partitions.
Functions§
- decompress_
header - Decompress a header buffer in memory.
Type Aliases§
- AnyDecoder
- Type alias for mmap-based decompression.
- File
Decoder - Type alias for file-based decompression.