pub struct ConnectionTracker { /* private fields */ }Expand description
Tracks TCP connections.
Implementations§
Source§impl ConnectionTracker
impl ConnectionTracker
pub fn new() -> Self
Sourcepub fn get_or_create(
&mut self,
src_ip: IpAddr,
src_port: u16,
dst_ip: IpAddr,
dst_port: u16,
flags: TcpFlags,
seq: u32,
frame_number: u64,
timestamp: i64,
) -> (&mut Connection, Direction)
pub fn get_or_create( &mut self, src_ip: IpAddr, src_port: u16, dst_ip: IpAddr, dst_port: u16, flags: TcpFlags, seq: u32, frame_number: u64, timestamp: i64, ) -> (&mut Connection, Direction)
Get or create a connection for the given packet. Returns (connection, direction).
Sourcepub fn update_state(
conn: &mut Connection,
flags: TcpFlags,
direction: Direction,
seq: u32,
)
pub fn update_state( conn: &mut Connection, flags: TcpFlags, direction: Direction, seq: u32, )
Update connection state based on TCP flags.
Sourcepub fn add_bytes(conn: &mut Connection, direction: Direction, bytes: usize)
pub fn add_bytes(conn: &mut Connection, direction: Direction, bytes: usize)
Add payload bytes to connection stats.
Sourcepub fn get(&self, key: &ConnectionKey) -> Option<&Connection>
pub fn get(&self, key: &ConnectionKey) -> Option<&Connection>
Get a connection by key.
Sourcepub fn connections(&self) -> impl Iterator<Item = &Connection>
pub fn connections(&self) -> impl Iterator<Item = &Connection>
Get all connections.
Sourcepub fn cleanup_timeout(
&mut self,
current_time: i64,
timeout_us: i64,
) -> Vec<Connection>
pub fn cleanup_timeout( &mut self, current_time: i64, timeout_us: i64, ) -> Vec<Connection>
Remove timed-out connections.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConnectionTracker
impl RefUnwindSafe for ConnectionTracker
impl Send for ConnectionTracker
impl Sync for ConnectionTracker
impl Unpin for ConnectionTracker
impl UnwindSafe for ConnectionTracker
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