pub struct Filter { /* private fields */ }
Implementations§
Source§impl Filter
impl Filter
pub fn new() -> Self
Sourcepub fn add_host(self, host: IpAddr) -> Self
pub fn add_host(self, host: IpAddr) -> Self
Adds an ip host to the filter. It clears the src and dst hosts. Ips added here can match both src and dst hosts.
§Arguments
host
- The ip address to add to the filter.
Sourcepub fn add_src_host(self, src_host: IpAddr) -> Self
pub fn add_src_host(self, src_host: IpAddr) -> Self
Adds a src ip host to the filter. It clears the general hosts. Ips added here must be present as the src host of packets.
§Arguments
src_host
- The ip address to add to the filter.
Sourcepub fn add_dst_host(self, dst_host: IpAddr) -> Self
pub fn add_dst_host(self, dst_host: IpAddr) -> Self
Adds a dest ip host to the filter. It clears the general hosts. Ips added here must be present as the dest host of packets.
§Arguments
dst_host
- The ip address to add to the filter.
Sourcepub fn clear_host(self) -> Self
pub fn clear_host(self) -> Self
Deletes all the previously added IP hosts.
Sourcepub fn clear_src_host(self) -> Self
pub fn clear_src_host(self) -> Self
Deletes all the previously added source IP hosts.
Sourcepub fn clear_dst_host(self) -> Self
pub fn clear_dst_host(self) -> Self
Deletes all the previously added dest IP hosts.
Sourcepub fn set_tcp_only(self) -> Self
pub fn set_tcp_only(self) -> Self
Detect only tcp packets.
Sourcepub fn set_udp_only(self) -> Self
pub fn set_udp_only(self) -> Self
Detect only udp packets.
Sourcepub fn clear_protocol(self) -> Self
pub fn clear_protocol(self) -> Self
Detect both tcp and udp packets.
Sourcepub fn add_port(self, port: u16) -> Self
pub fn add_port(self, port: u16) -> Self
Add an accepted port to the filter. Matches both src and dst ports. It clears the src and dst ports.
§Arguments
port
- The valid port to add to the filter.
Sourcepub fn add_src_port(self, src_port: u16) -> Self
pub fn add_src_port(self, src_port: u16) -> Self
Add an accepted source port to the filter. It clears the general ports.
§Arguments
src_port
- The source port to accept.
Sourcepub fn add_dst_port(self, dst_port: u16) -> Self
pub fn add_dst_port(self, dst_port: u16) -> Self
Add an accepted dest port to the filter. It clears the generic ports.
§Arguments
dst_port
- The destination port to accept.