Skip to main content

ConversationState

Struct ConversationState 

Source
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: CanonicalKey

Canonical bidirectional key identifying this conversation.

§status: ConversationStatus

Current conversation status.

§start_time: Duration

Timestamp of the first packet in the conversation.

§last_seen: Duration

Timestamp of the most recent packet in the conversation.

§forward: DirectionStats

Statistics for the forward direction (addr_aaddr_b).

§reverse: DirectionStats

Statistics for the reverse direction (addr_baddr_a).

§packet_indices: Vec<usize>

Indices of packets belonging to this conversation (into original packet list).

§protocol_state: ProtocolState

Protocol-specific state.

§max_flow_len: Option<u64>

Maximum packet length across both directions (if tracking enabled).

Implementations§

Source§

impl ConversationState

Source

pub fn new(key: CanonicalKey, timestamp: Duration) -> Self

Create a new conversation state from the first observed packet.

Source

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.

Source

pub fn total_packets(&self) -> u64

Total packets across both directions.

Source

pub fn total_bytes(&self) -> u64

Total bytes across both directions.

Source

pub fn duration(&self) -> Duration

Duration of the conversation.

Source

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.

Source

pub fn update_status(&mut self)

Update the conversation status based on protocol state.

Source

pub fn is_timed_out(&self, now: Duration, config: &FlowConfig) -> bool

Check whether this conversation has exceeded its idle timeout.

Trait Implementations§

Source§

impl Debug for ConversationState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V