pub struct Table<I: IpExt, E, BT: FilterBindingsTypes> { /* private fields */ }Expand description
Implements a connection tracking subsystem.
The E parameter is for external data that is stored in the [Connection]
struct and can be extracted with the [Connection::external_data()]
function.
Implementations§
Source§impl<I: IpExt, E, BT: FilterBindingsTypes> Table<I, E, BT>
impl<I: IpExt, E, BT: FilterBindingsTypes> Table<I, E, BT>
Sourcepub fn contains_tuple(&self, tuple: &Tuple<I>) -> bool
pub fn contains_tuple(&self, tuple: &Tuple<I>) -> bool
Returns whether the table contains a connection for the specified tuple.
This is for NAT to determine whether a generated tuple will clash with one already in the map. While it might seem inefficient, to require locking in a loop, taking an uncontested lock is going to be significantly faster than the RNG used to allocate NAT parameters.
Sourcepub fn get_connection(&self, tuple: &Tuple<I>) -> Option<Connection<I, E, BT>>
pub fn get_connection(&self, tuple: &Tuple<I>) -> Option<Connection<I, E, BT>>
Returns a [Connection] for the flow indexed by tuple, if one exists.
Sourcepub fn num_entries(&self) -> usize
pub fn num_entries(&self) -> usize
Returns the number of entries in the table.
NOTE: This is usually twice the number of connections, but self-connected sockets will only have a single entry.
Sourcepub fn remove_connection(
&mut self,
tuple: &Tuple<I>,
) -> Option<Connection<I, E, BT>>
pub fn remove_connection( &mut self, tuple: &Tuple<I>, ) -> Option<Connection<I, E, BT>>
Removes the [Connection] for the flow indexed by tuple, if one exists,
and returns it to the caller.
Trait Implementations§
Source§impl<I: IpExt, E: Inspectable, BT: FilterBindingsTypes> Inspectable for Table<I, E, BT>
impl<I: IpExt, E: Inspectable, BT: FilterBindingsTypes> Inspectable for Table<I, E, BT>
Source§fn record<Inspector: Inspector>(&self, inspector: &mut Inspector)
fn record<Inspector: Inspector>(&self, inspector: &mut Inspector)
inspector.Auto Trait Implementations§
impl<I, E, BT> !Freeze for Table<I, E, BT>
impl<I, E, BT> RefUnwindSafe for Table<I, E, BT>
impl<I, E, BT> Send for Table<I, E, BT>
impl<I, E, BT> Sync for Table<I, E, BT>
impl<I, E, BT> Unpin for Table<I, E, BT>
impl<I, E, BT> UnwindSafe for Table<I, E, BT>
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
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
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