pub enum BpfExpr {
And(Box<Self>, Box<Self>),
Or(Box<Self>, Box<Self>),
Not(Box<Self>),
IpProto(u8),
Ip,
Ip6,
Arp,
Host {
dir: Dir,
net: IpNet,
},
Net {
dir: Dir,
net: IpNet,
},
Port {
dir: Dir,
range: PortRange,
},
Len {
op: CmpOp,
val: u32,
},
}Expand description
A compiled BPF expression tree.
Construct with parse and evaluate per-packet with BpfExpr::eval.
Variants§
And(Box<Self>, Box<Self>)
Both sub-expressions must match.
Or(Box<Self>, Box<Self>)
Either sub-expression must match.
Not(Box<Self>)
Sub-expression must not match.
IpProto(u8)
IP protocol number (tcp=6, udp=17, icmp=1, icmp6=58, proto N).
Ip
IPv4 packet (ip keyword).
Ip6
IPv6 packet (ip6 keyword).
Arp
ARP frame (arp keyword). Best-effort: matches any non-IP packet
(i.e. packets for which etherparse produces no flow key).
Host
Exact host or prefix match on one or both endpoints.
Net
Network prefix (CIDR) match on one or both endpoints.
Port
Port or port-range match (TCP/UDP only; silently passes other protocols).
Len
Captured-length comparison (len > N, len <= N, …).
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BpfExpr
impl RefUnwindSafe for BpfExpr
impl Send for BpfExpr
impl Sync for BpfExpr
impl Unpin for BpfExpr
impl UnsafeUnpin for BpfExpr
impl UnwindSafe for BpfExpr
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more