Struct windivert::WinDivert

source ·
#[non_exhaustive]
pub struct WinDivert<L: WinDivertLayerTrait> { /* private fields */ }
Expand description

Main wrapper struct around windivert functionalities.

Implementations§

source§

impl WinDivert<NetworkLayer>

source

pub fn recv<'a>( &self, buffer: Option<&'a mut [u8]> ) -> Result<WinDivertPacket<'a, NetworkLayer>, WinDivertError>

Single packet blocking recv function.

source

pub fn recv_ex<'a>( &self, buffer: Option<&'a mut [u8]>, packet_count: usize ) -> Result<Vec<WinDivertPacket<'a, NetworkLayer>>, WinDivertError>

Batched blocking recv function.

source

pub fn send( &self, packet: &WinDivertPacket<'_, NetworkLayer> ) -> Result<u32, WinDivertError>

Single packet send function.

source

pub fn send_ex<'data, 'packets, P, I>( &self, packets: P ) -> Result<u32, WinDivertError>where P: IntoIterator<IntoIter = I>, I: ExactSizeIterator<Item = &'packets WinDivertPacket<'data, NetworkLayer>>, 'data: 'packets,

Batched packet send function.

source§

impl WinDivert<ForwardLayer>

source

pub fn recv<'a>( &self, buffer: Option<&'a mut [u8]> ) -> Result<WinDivertPacket<'a, ForwardLayer>, WinDivertError>

Single packet blocking recv function.

source

pub fn recv_ex<'a>( &self, buffer: Option<&'a mut [u8]>, packet_count: usize ) -> Result<Vec<WinDivertPacket<'a, NetworkLayer>>, WinDivertError>

Batched blocking recv function.

source

pub fn send( &self, packet: &WinDivertPacket<'_, ForwardLayer> ) -> Result<u32, WinDivertError>

Single packet send function.

source

pub fn send_ex<'data, 'packets, P, I>( &self, packets: P ) -> Result<u32, WinDivertError>where P: IntoIterator<IntoIter = I>, I: ExactSizeIterator<Item = &'packets WinDivertPacket<'data, ForwardLayer>>, 'data: 'packets,

Batched packet send function.

source§

impl WinDivert<FlowLayer>

source

pub fn recv<'a>( &self, buffer: Option<&'a mut [u8]> ) -> Result<WinDivertPacket<'a, FlowLayer>, WinDivertError>

Single packet blocking recv function.

source

pub fn recv_ex<'a>( &self, packet_count: usize ) -> Result<Vec<WinDivertPacket<'a, FlowLayer>>, WinDivertError>

Batched blocking recv function.

source§

impl WinDivert<SocketLayer>

source

pub fn recv<'a>( &self, buffer: Option<&'a mut [u8]> ) -> Result<WinDivertPacket<'a, SocketLayer>, WinDivertError>

Single packet blocking recv function.

source

pub fn recv_ex<'a>( &self, packet_count: usize ) -> Result<Vec<WinDivertPacket<'a, SocketLayer>>, WinDivertError>

Batched blocking recv function.

source§

impl WinDivert<ReflectLayer>

source

pub fn recv<'a>( &self, buffer: Option<&'a mut [u8]> ) -> Result<WinDivertPacket<'a, ReflectLayer>, WinDivertError>

Single packet blocking recv function.

source

pub fn recv_ex<'a>( &self, buffer: Option<&'a mut [u8]>, packet_count: usize ) -> Result<Vec<WinDivertPacket<'a, ReflectLayer>>, WinDivertError>

Batched blocking recv function.

source§

impl<L: WinDivertLayerTrait> WinDivert<L>

Recv implementations

source

pub fn get_param(&self, param: WinDivertParam) -> Result<u64, WinDivertError>

Methods that allows to query the driver for parameters.

source

pub fn set_param( &self, param: WinDivertParam, value: u64 ) -> Result<(), WinDivertError>

Method that allows setting driver parameters.

source

pub fn close(&mut self, action: CloseAction) -> WinResult<()>

Handle close function.

source

pub fn shutdown(&mut self, mode: WinDivertShutdownMode) -> WinResult<()>

Shutdown function.

source§

impl WinDivert<NetworkLayer>

source

pub fn network( filter: impl AsRef<str>, priority: i16, flags: WinDivertFlags ) -> Result<Self, WinDivertError>

WinDivert constructor for network layer.

source§

impl WinDivert<ForwardLayer>

source

pub fn forward( filter: impl AsRef<str>, priority: i16, flags: WinDivertFlags ) -> Result<Self, WinDivertError>

WinDivert constructor for forward layer.

source§

impl WinDivert<FlowLayer>

source

pub fn flow( filter: &str, priority: i16, flags: WinDivertFlags ) -> Result<Self, WinDivertError>

WinDivert constructor for flow layer.

source§

impl WinDivert<SocketLayer>

source

pub fn socket( filter: impl AsRef<str>, priority: i16, flags: WinDivertFlags ) -> Result<Self, WinDivertError>

WinDivert constructor for socket layer.

source§

impl WinDivert<ReflectLayer>

source

pub fn reflect( filter: impl AsRef<str>, priority: i16, flags: WinDivertFlags ) -> Result<Self, WinDivertError>

WinDivert constructor for reflect layer.

source§

impl WinDivert<()>

source

pub const MAX_BATCH: u8 = 255u8

Maximum number of packets that can be captured/sent in a single batched operation

source

pub fn uninstall() -> WinResult<()>

Method that tries to uninstall WinDivert driver.

Auto Trait Implementations§

§

impl<L> RefUnwindSafe for WinDivert<L>where L: RefUnwindSafe,

§

impl<L> Send for WinDivert<L>where L: Send,

§

impl<L> Sync for WinDivert<L>where L: Sync,

§

impl<L> Unpin for WinDivert<L>where L: Unpin,

§

impl<L> UnwindSafe for WinDivert<L>where L: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.