Struct windivert_sys::WinDivertFlags
source · #[repr(transparent)]pub struct WinDivertFlags(_);
Expand description
Flag type required by WinDivertOpen()
. It follows a builder like style.
Different flags affect how the opened handle behaves. The following flags are supported:
sniff
: This flag opens the WinDivert handle inpacket sniffing
mode. In packet sniffing mode the original packet is not dropped-and-diverted (the default) but copied-and-diverted. This mode is useful for implementing packet sniffing tools similar to those applications that currently use Winpcap.drop
: This flag indicates that the user application does not intend to read matching packets withrecv()
(or any of it’s variants), instead the packets should be silently dropped. This is useful for implementing simple packet filters using the WinDivert filter language.recv_only
: This flags forces the handle into receive only mode which effectively disablessend()
(and any of it’s variants). This means that it is possible to block/capture packets or events but not inject them.send_only
: This flags forces the handle into send only mode which effectively disablesrecv()
(and any of it’s variants). This means that it is possible to inject packets or events, but not block/capture them.no_installs
: This flags causesWinDivertOpen
to fail with ERROR_SERVICE_DOES_NOT_EXIST (1060) if the WinDivert driver is not already installed. This flag is useful for querying the WinDivert driver state usingReflect
layer.fragments
: If set, the handle will capture inbound IP fragments, but not inbound reassembled IP packets. Otherwise, if not set (the default), the handle will capture inbound reassembled IP packets, but not inbound IP fragments. This flag only affects inbound packets at theNetwork
layer, else the flag is ignored. Note that any combination of (snif
|drop
) or (recv_only
|send_only
) are considered invalid.
Some layers have mandatory flags:
WinDivertLayer::Flow
: (sniff
|recv_only
)WinDivertLayer::Socket
:recv_only
WinDivertLayer::Reflect
: (sniff
|recv_only
)
Implementations§
source§impl WinDivertFlags
impl WinDivertFlags
WinDivertFlags builder methods.
sourcepub const fn unset_sniff(self) -> Self
pub const fn unset_sniff(self) -> Self
Unsets sniff
flag.
sourcepub fn set_sniff_value(&mut self, value: bool)
pub fn set_sniff_value(&mut self, value: bool)
Sets sniff
flag to value
.
sourcepub const fn unset_drop(self) -> Self
pub const fn unset_drop(self) -> Self
Unsets drop
flag.
sourcepub fn set_drop_value(&mut self, value: bool)
pub fn set_drop_value(&mut self, value: bool)
Sets drop
flag to value
.
sourcepub const fn set_recv_only(self) -> Self
pub const fn set_recv_only(self) -> Self
Sets recv_only
flag
sourcepub const fn unset_recv_only(self) -> Self
pub const fn unset_recv_only(self) -> Self
Unsets recv_only
flag
sourcepub fn set_recv_only_value(&mut self, value: bool)
pub fn set_recv_only_value(&mut self, value: bool)
Sets recv_only
flag to value
.
sourcepub const fn set_send_only(self) -> Self
pub const fn set_send_only(self) -> Self
Sets send_only
flag.
sourcepub const fn unset_send_only(self) -> Self
pub const fn unset_send_only(self) -> Self
Unsets send_only
flag.
sourcepub fn set_send_only_value(&mut self, value: bool)
pub fn set_send_only_value(&mut self, value: bool)
Sets send_only
flag to value
.
sourcepub const fn set_no_installs(self) -> Self
pub const fn set_no_installs(self) -> Self
Sets no_installs
flag.
sourcepub const fn unset_no_installs(self) -> Self
pub const fn unset_no_installs(self) -> Self
Unsets no_installs
flag.
sourcepub fn set_no_installs_value(&mut self, value: bool)
pub fn set_no_installs_value(&mut self, value: bool)
Sets no_installs
flag to value
.
sourcepub const fn set_fragments(self) -> Self
pub const fn set_fragments(self) -> Self
Sets fragments
flag.
sourcepub const fn unset_fragments(self) -> Self
pub const fn unset_fragments(self) -> Self
Unsets fragments
flag.
sourcepub fn set_fragments_value(&mut self, value: bool)
pub fn set_fragments_value(&mut self, value: bool)
Sets fragments
flag to value
.
Trait Implementations§
source§impl Clone for WinDivertFlags
impl Clone for WinDivertFlags
source§fn clone(&self) -> WinDivertFlags
fn clone(&self) -> WinDivertFlags
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for WinDivertFlags
impl Debug for WinDivertFlags
source§impl Default for WinDivertFlags
impl Default for WinDivertFlags
source§fn default() -> WinDivertFlags
fn default() -> WinDivertFlags
Returns the “default value” for a type. Read more
source§impl From<WinDivertFlags> for u64
impl From<WinDivertFlags> for u64
source§fn from(flags: WinDivertFlags) -> Self
fn from(flags: WinDivertFlags) -> Self
Converts to this type from the input type.
impl Copy for WinDivertFlags
Auto Trait Implementations§
impl RefUnwindSafe for WinDivertFlags
impl Send for WinDivertFlags
impl Sync for WinDivertFlags
impl Unpin for WinDivertFlags
impl UnwindSafe for WinDivertFlags
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