Skip to main content

PacketMetadata

Type Alias PacketMetadata 

Source
pub type PacketMetadata = PacketMetadata;
Expand description

PacketMetadata from wire

Aliased Type§

pub struct PacketMetadata {
    pub timestamp: Option<SystemTime>,
}

Fields§

§timestamp: Option<SystemTime>

The kernel capture timestamp for this packet, if the backend supports it.

On BPF platforms (macOS/BSD/Windows), this is always populated from the bh_tstamp field in the BPF header, which is set by the kernel when the packet is captured. On Linux, this is populated when Config::enable_timestamps is true. On other backends, this is None.

Comparing this timestamp against SystemTime::now() after next_with_metadata() returns gives the delay between kernel capture time and application processing time, which includes any time the packet spent in the receive buffer.