pub struct SnifferHandle { /* private fields */ }Expand description
A threaded packet sniffer that pushes captured packets into a channel.
The capture runs on a dedicated OS thread. Consumers read packets from the receiver end of a bounded crossbeam channel.
Implementations§
Source§impl SnifferHandle
impl SnifferHandle
Sourcepub fn start(config: SnifferConfig) -> Result<Self, SnifferError>
pub fn start(config: SnifferConfig) -> Result<Self, SnifferError>
Start a new sniffer with the given configuration.
Sourcepub fn recv(&self) -> Option<RawPacket>
pub fn recv(&self) -> Option<RawPacket>
Receive the next captured packet, blocking until one is available.
Returns None when the capture has ended (count/timeout reached or stopped).
Sourcepub fn is_stopped(&self) -> bool
pub fn is_stopped(&self) -> bool
Check if the sniffer has been signaled to stop.
Sourcepub fn join(self) -> CaptureStats
pub fn join(self) -> CaptureStats
Wait for the capture thread to finish and return stats.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SnifferHandle
impl !RefUnwindSafe for SnifferHandle
impl Send for SnifferHandle
impl Sync for SnifferHandle
impl Unpin for SnifferHandle
impl UnsafeUnpin for SnifferHandle
impl !UnwindSafe for SnifferHandle
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
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>
Converts
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>
Converts
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