pub struct Flow<T, D> {Show 19 fields
pub start_ts: Timestamp,
pub last_ts: Timestamp,
pub src_mac: EthAddr,
pub dst_mac: EthAddr,
pub eth_proto: EtherProto,
pub tuple: T,
pub ip_info: IpInfo,
pub tcp_info: TcpInfo,
pub u_bytes: usize,
pub d_bytes: usize,
pub u_payload_bytes: usize,
pub d_payload_bytes: usize,
pub u_pkts: u32,
pub d_pkts: u32,
pub u_payload_pkts: u32,
pub d_payload_pkts: u32,
pub u_frags: u32,
pub d_frags: u32,
pub data: D,
}Fields§
§start_ts: TimestampTimestamp of the first packet in the flow.
last_ts: TimestampTimestamp of the last packet in the flow.
src_mac: EthAddrSource MAC address.
dst_mac: EthAddrDestination MAC address.
eth_proto: EtherProtoEthernet protocol.
tuple: TGeneric address tuple (e.g. TupleV4, TupleV6 or TupleL2)
ip_info: IpInfoIP layer statistics and info.
tcp_info: TcpInfoTCP layer statistics and info (optional).
u_bytes: usizeTotal uplink bytes.
d_bytes: usizeTotal downlink bytes.
u_payload_bytes: usizeTotal uplink payload bytes.
d_payload_bytes: usizeTotal downlink payload bytes.
u_pkts: u32Total uplink packets.
d_pkts: u32Total downlink packets.
u_payload_pkts: u32Uplink packets with payload.
d_payload_pkts: u32Downlink packets with payload.
u_frags: u32Uplink fragments count.
d_frags: u32Downlink fragments count.
data: DCustom data associated with the flow.
Implementations§
Source§impl<T, D> Flow<T, D>where
T: Default + Clone + Tuple + Sized,
for<'a> NetworkLayer<'a>: SourceDestLayer<T::Addr>,
T::Addr: Eq,
D: Default,
impl<T, D> Flow<T, D>where
T: Default + Clone + Tuple + Sized,
for<'a> NetworkLayer<'a>: SourceDestLayer<T::Addr>,
T::Addr: Eq,
D: Default,
Sourcepub fn new(
timestamp: Timestamp,
tuple: T,
pkt: &Packet<'_>,
dir: PacketDirection,
) -> Self
pub fn new( timestamp: Timestamp, tuple: T, pkt: &Packet<'_>, dir: PacketDirection, ) -> Self
Creates a new Flow instance.
§Arguments
timestamp- The timestamp of the first packet in the flow.tuple- The flow tuple that identifies this connection (canonical direction).pkt- The initial packet that triggered flow creation.dir- The direction of the initial packet (UpwardsorDownwards).
The source and destination MAC addresses and the tuple orientation are automatically adjusted based on the packet direction to ensure a consistent flow representation.
Sourcepub fn packet_dir(&self, pkt: &Packet<'_>) -> PacketDirection
pub fn packet_dir(&self, pkt: &Packet<'_>) -> PacketDirection
Determines the direction of a packet relative to the flow.
§Arguments
pkt- The packet to analyze for direction determination.
A packet is considered “upwards” if both its source address and source port match the flow’s source tuple. Otherwise, it’s considered “downwards”. This method is essential for tracking bidirectional communication within a single flow instance.