pub struct ConversationState {
pub key: CanonicalKey,
pub status: ConversationStatus,
pub start_time: Duration,
pub last_seen: Duration,
pub forward: DirectionStats,
pub reverse: DirectionStats,
pub packet_indices: Vec<usize>,
pub protocol_state: ProtocolState,
pub max_flow_len: Option<u64>,
}Expand description
Complete state for a single bidirectional conversation.
Tracks the canonical key, timing, per-direction statistics, packet indices (into the original capture), and protocol-specific state (TCP state machine or UDP timeout tracking).
Fields§
§key: CanonicalKeyCanonical bidirectional key identifying this conversation.
status: ConversationStatusCurrent conversation status.
start_time: DurationTimestamp of the first packet in the conversation.
last_seen: DurationTimestamp of the most recent packet in the conversation.
forward: DirectionStatsStatistics for the forward direction (addr_a → addr_b).
reverse: DirectionStatsStatistics for the reverse direction (addr_b → addr_a).
packet_indices: Vec<usize>Indices of packets belonging to this conversation (into original packet list).
protocol_state: ProtocolStateProtocol-specific state.
max_flow_len: Option<u64>Maximum packet length across both directions (if tracking enabled).
Implementations§
Source§impl ConversationState
impl ConversationState
Sourcepub fn new(key: CanonicalKey, timestamp: Duration) -> Self
pub fn new(key: CanonicalKey, timestamp: Duration) -> Self
Create a new conversation state from the first observed packet.
Sourcepub fn new_zwave(zwave_key: ZWaveKey, timestamp: Duration) -> Self
pub fn new_zwave(zwave_key: ZWaveKey, timestamp: Duration) -> Self
Create a new Z-Wave conversation state.
Z-Wave conversations use a dummy canonical key since they are keyed by home ID and node pair rather than IP 5-tuple.
Sourcepub fn total_packets(&self) -> u64
pub fn total_packets(&self) -> u64
Total packets across both directions.
Sourcepub fn total_bytes(&self) -> u64
pub fn total_bytes(&self) -> u64
Total bytes across both directions.
Sourcepub fn record_packet(
&mut self,
direction: FlowDirection,
byte_count: u64,
timestamp: Duration,
packet_index: usize,
track_max_packet_len: bool,
track_max_flow_len: bool,
)
pub fn record_packet( &mut self, direction: FlowDirection, byte_count: u64, timestamp: Duration, packet_index: usize, track_max_packet_len: bool, track_max_flow_len: bool, )
Record a packet in this conversation.
Sourcepub fn update_status(&mut self)
pub fn update_status(&mut self)
Update the conversation status based on protocol state.
Sourcepub fn is_timed_out(&self, now: Duration, config: &FlowConfig) -> bool
pub fn is_timed_out(&self, now: Duration, config: &FlowConfig) -> bool
Check whether this conversation has exceeded its idle timeout.