Struct retina_datatypes::connection::ConnRecord
source · pub struct ConnRecord {
pub five_tuple: FiveTuple,
pub first_seen_ts: Instant,
pub second_seen_ts: Instant,
pub last_seen_ts: Instant,
pub max_inactivity: Duration,
pub history: Vec<u8>,
pub orig: Flow,
pub resp: Flow,
}
Expand description
Tracks a connection record throughout its lifetime.
§Note
Internal connection state is an associated type of a pub
trait, and therefore must also be
public. Documentation is hidden by default to avoid confusing users.
Fields§
§five_tuple: FiveTuple
The connection 5-tuple.
first_seen_ts: Instant
Timestamp of the first packet.
§Remarks
This represents the time Retina observed the first packet in the connection, and does not reflect timestamps read from a packet capture in offline analysis.
second_seen_ts: Instant
Timestamp of the second packet (approximate).
last_seen_ts: Instant
Timestamp of the last packet (approximate).
max_inactivity: Duration
Maximum duration of inactivity (the maximum time between observed segments).
history: Vec<u8>
This represents a summary of the connection history in the order the packets were observed, with letters encoded as a vector of bytes. This is a simplified version of state history in Zeek, and the meanings of each letter are similar: If the event comes from the originator, the letter is uppercase; if the event comes from the responder, the letter is lowercase.
- S: a pure SYN with only the SYN bit set (may have payload)
- H: a pure SYNACK with only the SYN and ACK bits set (may have payload)
- A: a pure ACK with only the ACK bit set and no payload
- D: segment contains non-zero payload length
- F: the segment has the FIN bit set (may have other flags and/or payload)
- R: segment has the RST bit set (may have other flags and/or payload)
Each letter is recorded a maximum of once in either direction.
orig: Flow
Originator flow.
resp: Flow
Responder flow.
Implementations§
source§impl ConnRecord
impl ConnRecord
sourcepub fn client(&self) -> SocketAddr
pub fn client(&self) -> SocketAddr
Returns the client (originator) socket address.
sourcepub fn server(&self) -> SocketAddr
pub fn server(&self) -> SocketAddr
Returns the server (responder) socket address.
sourcepub fn total_pkts(&self) -> u64
pub fn total_pkts(&self) -> u64
Returns the total number of packets observed in the connection.
sourcepub fn total_bytes(&self) -> u64
pub fn total_bytes(&self) -> u64
Returns the total number of payload bytes observed, excluding those from malformed packets.
sourcepub fn duration(&self) -> Duration
pub fn duration(&self) -> Duration
Returns te duration of the connection.
§Remarks
This does not represent the actual duration of the connection in offline analysis. It approximates the elapsed time between observation of the first and last observed packet in the connection.
sourcepub fn time_to_second_packet(&self) -> Duration
pub fn time_to_second_packet(&self) -> Duration
The duration (approximate) between the first and second packets.
Trait Implementations§
source§impl Debug for ConnRecord
impl Debug for ConnRecord
source§impl Display for ConnRecord
impl Display for ConnRecord
source§impl Serialize for ConnRecord
impl Serialize for ConnRecord
source§impl Tracked for ConnRecord
impl Tracked for ConnRecord
source§fn new(first_pkt: &L4Pdu) -> Self
fn new(first_pkt: &L4Pdu) -> Self
first_pkt
will also be delivered to update
.source§fn clear(&mut self)
fn clear(&mut self)
source§fn update(&mut self, pdu: &L4Pdu, reassembled: bool)
fn update(&mut self, pdu: &L4Pdu, reassembled: bool)
reassembled
to avoid double-counting.source§fn stream_protocols() -> Vec<&'static str>
fn stream_protocols() -> Vec<&'static str>
IMPLEMENTED_PROTOCOLS
in retina_core for list of supported protocols.Auto Trait Implementations§
impl Freeze for ConnRecord
impl RefUnwindSafe for ConnRecord
impl Send for ConnRecord
impl Sync for ConnRecord
impl Unpin for ConnRecord
impl UnwindSafe for ConnRecord
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