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,
store_packet_indices: 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, store_packet_indices: 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.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConversationState
impl RefUnwindSafe for ConversationState
impl Send for ConversationState
impl Sync for ConversationState
impl Unpin for ConversationState
impl UnsafeUnpin for ConversationState
impl UnwindSafe for ConversationState
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more