pub struct PacketWithContext {
pub data: Vec<u8>,
pub hook_source: Option<u8>,
pub original_len: Option<u32>,
pub direct_event: Option<DirectEventData>,
pub timestamp_ns: Option<u64>,
}Expand description
Packet with optional hook source context from eBPF
When using the eBPF backend, packets include hook_source to indicate
where they were captured:
- 0 = XDP (ingress/download)
- 1 = TC ingress (not used - XDP handles ingress)
- 2 = TC egress (egress/upload)
For the pnet backend, hook_source is None and direction is determined
from IP addresses.
For eBPF TCP/UDP packets, direct_event contains pre-extracted data for
direct processing, bypassing packet reconstruction. When Some, the data
field may be empty or contain only ARP packet data.
Fields§
§data: Vec<u8>§hook_source: Option<u8>Hook source: Some(0)=XDP/ingress, Some(2)=TC egress/upload, None=unknown/pnet
original_len: Option<u32>Original packet length from wire (for eBPF, this comes from the kernel) When None, calculate from data.len() or parsed headers
direct_event: Option<DirectEventData>Direct event data for eBPF TCP/UDP packets (bypasses reconstruction) When Some, contains pre-extracted fields: src_ip, dst_ip, src_port, dst_port, protocol, tcp_flags. When None, parse from data field.
timestamp_ns: Option<u64>Kernel timestamp in nanoseconds (for RTT calculation)
Trait Implementations§
Source§impl Clone for PacketWithContext
impl Clone for PacketWithContext
Source§fn clone(&self) -> PacketWithContext
fn clone(&self) -> PacketWithContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more