StaticFilter

Struct StaticFilter 

Source
#[repr(C, packed(1))]
pub struct StaticFilter { pub adapter_handle: u64, pub direction_flags: DirectionFlags, pub filter_action: u32, pub valid_fields: FilterLayerFlags, pub last_reset: u32, pub packets_in: u64, pub bytes_in: u64, pub packets_out: u64, pub bytes_out: u64, pub data_link_filter: DataLinkLayerFilter, pub network_filter: NetworkLayerFilter, pub transport_filter: TransportLayerFilter, }
Expand description

This structure is used to define a single static filter rule for packet filtering. Each rule can specify filtering criteria at the data link, network, and transport layers. The structure also includes counters for incoming and outgoing packets and bytes that match the filter rule.

Fields§

§adapter_handle: u64

Adapter handle extended to 64 bit size for structure compatibility across x64 and x86 architectures

§direction_flags: DirectionFlags

PACKET_FLAG_ON_SEND or/and PACKET_FLAG_ON_RECEIVE to specify the direction of packets to match

§filter_action: u32

FILTER_PACKET_XXX to define the action to take when a packet matches the filter

§valid_fields: FilterLayerFlags

Specifies which of the fields below contain valid values and should be matched against the packet

§last_reset: u32

Time of the last counters reset (in seconds passed since 1 Jan 1980)

§packets_in: u64

Incoming packets passed through this filter

§bytes_in: u64

Incoming bytes passed through this filter

§packets_out: u64

Outgoing packets passed through this filter

§bytes_out: u64

Outgoing bytes passed through this filter

§data_link_filter: DataLinkLayerFilter

Filter criteria for the data link layer (e.g., Ethernet)

§network_filter: NetworkLayerFilter

Filter criteria for the network layer (e.g., IPv4, IPv6)

§transport_filter: TransportLayerFilter

Filter criteria for the transport layer (e.g., TCP, UDP, ICMP)

Implementations§

Source§

impl StaticFilter

Creates a new StaticFilter instance.

§Arguments

  • adapter_handle - Adapter handle extended to 64 bit size for structure compatibility across x64 and x86 architectures.
  • direction_flags - PACKET_FLAG_ON_SEND or/and PACKET_FLAG_ON_RECEIVE to specify the direction of packets to match.
  • filter_action - FILTER_PACKET_XXX to define the action to take when a packet matches the filter.
  • valid_fields - Specifies which of the fields below contain valid values and should be matched against the packet.
  • data_link_filter - Filter criteria for the data link layer (e.g., Ethernet).
  • network_filter - Filter criteria for the network layer (e.g., IPv4, IPv6).
  • transport_filter - Filter criteria for the transport layer (e.g., TCP, UDP, ICMP).

§Returns

  • A new StaticFilter instance.
Source

pub fn new( adapter_handle: u64, direction_flags: DirectionFlags, filter_action: u32, valid_fields: FilterLayerFlags, data_link_filter: DataLinkLayerFilter, network_filter: NetworkLayerFilter, transport_filter: TransportLayerFilter, ) -> Self

Trait Implementations§

Source§

impl Clone for StaticFilter

Source§

fn clone(&self) -> StaticFilter

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for StaticFilter

Source§

fn default() -> StaticFilter

Returns the “default value” for a type. Read more
Source§

impl Copy for StaticFilter

Auto Trait Implementations§

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.