pub struct FlowRecord {
pub flow_id: String,
pub packet_sizes: Vec<usize>,
pub timestamps_us: Vec<u64>,
pub directions: Vec<bool>,
pub source_label: String,
}Expand description
A recorded traffic flow for correlation analysis.
Fields§
§flow_id: StringUnique flow identifier.
packet_sizes: Vec<usize>Packet sizes in order.
timestamps_us: Vec<u64>Timestamps in microseconds.
directions: Vec<bool>Direction markers (true = outgoing, false = incoming).
source_label: StringSource label (for testing purposes).
Implementations§
Source§impl FlowRecord
impl FlowRecord
pub fn new(flow_id: impl Into<String>) -> Self
Sourcepub fn add_packet(&mut self, size: usize, timestamp_us: u64, outgoing: bool)
pub fn add_packet(&mut self, size: usize, timestamp_us: u64, outgoing: bool)
Add a packet to this flow.
Sourcepub fn duration_us(&self) -> u64
pub fn duration_us(&self) -> u64
Duration of the flow in microseconds.
Sourcepub fn total_bytes(&self) -> usize
pub fn total_bytes(&self) -> usize
Total bytes transferred.
Sourcepub fn inter_packet_delays(&self) -> Vec<u64>
pub fn inter_packet_delays(&self) -> Vec<u64>
Inter-packet delays in microseconds.
Sourcepub fn avg_packet_size(&self) -> f64
pub fn avg_packet_size(&self) -> f64
Average packet size.
Sourcepub fn packet_count(&self) -> usize
pub fn packet_count(&self) -> usize
Packet count.
Trait Implementations§
Source§impl Clone for FlowRecord
impl Clone for FlowRecord
Source§fn clone(&self) -> FlowRecord
fn clone(&self) -> FlowRecord
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FlowRecord
impl Debug for FlowRecord
Source§impl<'de> Deserialize<'de> for FlowRecord
impl<'de> Deserialize<'de> for FlowRecord
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for FlowRecord
impl RefUnwindSafe for FlowRecord
impl Send for FlowRecord
impl Sync for FlowRecord
impl Unpin for FlowRecord
impl UnsafeUnpin for FlowRecord
impl UnwindSafe for FlowRecord
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more