pub struct WinDivertFlags(/* private fields */);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 sniffingmode. 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 causesWinDivertOpento 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 usingReflectlayer.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 theNetworklayer, 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_onlyWinDivertLayer::Reflect: (sniff|recv_only)
Implementations§
Source§impl WinDivertFlags
WinDivertFlags builder methods.
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 duplicate 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 Freeze for WinDivertFlags
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