pub struct PacketCapture<State> { /* private fields */ }
Expand description
Basic PacketCapture type
Marker as PhantomData allow compile-time checking of struct use
Implementations§
Source§impl PacketCapture<Uninitialized>
Uninitialized PacketCaptures can be created only
impl PacketCapture<Uninitialized>
Uninitialized PacketCaptures can be created only
Sourcepub fn new_from_interface(
interface_name: &str,
) -> Result<PacketCapture<Initialized>, Box<dyn Error>>
pub fn new_from_interface( interface_name: &str, ) -> Result<PacketCapture<Initialized>, Box<dyn Error>>
Create a PacketCapture
Takes an interface name and returns an Initialized PacketCapture
Sourcepub fn new_with_default() -> Result<PacketCapture<Initialized>, Box<dyn Error>>
pub fn new_with_default() -> Result<PacketCapture<Initialized>, Box<dyn Error>>
Create a PacketCapture
Returns an Initialized PacketCapture with the default interface
Source§impl PacketCapture<Initialized>
Initialized PacketCaptures can start a capture or a live processing callback
impl PacketCapture<Initialized>
Initialized PacketCaptures can start a capture or a live processing callback
Sourcepub fn start_capture(&self) -> PacketCapture<Started>
pub fn start_capture(&self) -> PacketCapture<Started>
Start capturing
Stores packets that can be accessed later with the results
methods
Sourcepub fn start_live_process(
&self,
callback: impl FnMut(Vec<u8>) + Send + 'static,
) -> PacketCapture<Started>
pub fn start_live_process( &self, callback: impl FnMut(Vec<u8>) + Send + 'static, ) -> PacketCapture<Started>
Start live processing
Takes (and calls) a callback function on incoming streams of bytes
Source§impl PacketCapture<Started>
Started PacketCaptures can stop only
impl PacketCapture<Started>
Started PacketCaptures can stop only
Sourcepub fn stop_capture(&self) -> PacketCapture<Completed>
pub fn stop_capture(&self) -> PacketCapture<Completed>
Stop capturing
Not much more to it
Source§impl PacketCapture<Completed>
Completed PacketCaptures return results in various formats
impl PacketCapture<Completed>
Completed PacketCaptures return results in various formats
Sourcepub fn results_raw(&self) -> Arc<[Vec<u8>]>
pub fn results_raw(&self) -> Arc<[Vec<u8>]>
Results returned as raw vectors of bytes
Sourcepub fn results_as_ethernet(&self) -> EthernetFrameCollection<'_>
pub fn results_as_ethernet(&self) -> EthernetFrameCollection<'_>
Results returned as ethernet frames
Sourcepub fn results_as_ipv4(&self) -> Ipv4PacketCollection<'_>
pub fn results_as_ipv4(&self) -> Ipv4PacketCollection<'_>
Results returned as ipv4 packets
Sourcepub fn results_as_tcp(&self) -> TcpSegmentCollection<'_>
pub fn results_as_tcp(&self) -> TcpSegmentCollection<'_>
Results returned as tcp segments
Trait Implementations§
Auto Trait Implementations§
impl<State> Freeze for PacketCapture<State>
impl<State> RefUnwindSafe for PacketCapture<State>where
State: RefUnwindSafe,
impl<State> Send for PacketCapture<State>where
State: Send,
impl<State> Sync for PacketCapture<State>where
State: Sync,
impl<State> Unpin for PacketCapture<State>where
State: Unpin,
impl<State> UnwindSafe for PacketCapture<State>where
State: UnwindSafe,
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