#[non_exhaustive]#[repr(u32)]pub enum ProgramType {
Show 32 variants
Unspec = 0,
SocketFilter = 1,
Kprobe = 2,
SchedCls = 3,
SchedAct = 4,
Tracepoint = 5,
Xdp = 6,
PerfEvent = 7,
CgroupSkb = 8,
CgroupSock = 9,
LwtIn = 10,
LwtOut = 11,
LwtXmit = 12,
SockOps = 13,
SkSkb = 14,
CgroupDevice = 15,
SkMsg = 16,
RawTracepoint = 17,
CgroupSockAddr = 18,
LwtSeg6local = 19,
LircMode2 = 20,
SkReuseport = 21,
FlowDissector = 22,
CgroupSysctl = 23,
RawTracepointWritable = 24,
CgroupSockopt = 25,
Tracing = 26,
StructOps = 27,
Ext = 28,
Lsm = 29,
SkLookup = 30,
Syscall = 31,
}
Expand description
eBPF program type variants. Based off of kernel header’s
enum bpf_prog_type
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Unspec = 0
SocketFilter = 1
Kprobe = 2
SchedCls = 3
SchedAct = 4
Tracepoint = 5
Xdp = 6
PerfEvent = 7
CgroupSkb = 8
CgroupSock = 9
LwtIn = 10
LwtOut = 11
LwtXmit = 12
SockOps = 13
SkSkb = 14
CgroupDevice = 15
SkMsg = 16
RawTracepoint = 17
CgroupSockAddr = 18
LwtSeg6local = 19
LircMode2 = 20
SkReuseport = 21
FlowDissector = 22
CgroupSysctl = 23
RawTracepointWritable = 24
CgroupSockopt = 25
Tracing = 26
StructOps = 27
Ext = 28
Lsm = 29
SkLookup = 30
Syscall = 31
Implementations§
Source§impl ProgramType
impl ProgramType
Sourcepub fn probe(&self) -> Result<bool, Error>
pub fn probe(&self) -> Result<bool, Error>
Determines if the eBPF program type is supported on the current platform
Sourcepub fn probe_helper(&self, helper: BpfHelper) -> Result<bool, Error>
pub fn probe_helper(&self, helper: BpfHelper) -> Result<bool, Error>
Determines if the eBPF program helper function can be used my supported program types.
Note: Due to libbpf’s libbpf_probe_bpf_helper
, this may return Ok(true) for unsupported program
types. It is recommended to verify if the program type is supported before probing for helper
support.
Sourcepub fn iter() -> impl Iterator<Item = ProgramType>
pub fn iter() -> impl Iterator<Item = ProgramType>
Returns an ordered iterator over the ProgramType
variants. The order is determined by the kernel
header’s enum values.
Note: Skips ProgramType::Unspec
since it’s an invalid program type
Trait Implementations§
Source§impl Clone for ProgramType
impl Clone for ProgramType
Source§fn clone(&self) -> ProgramType
fn clone(&self) -> ProgramType
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 ProgramType
impl Debug for ProgramType
Source§impl Display for ProgramType
impl Display for ProgramType
Source§impl From<ProgramType> for u32
impl From<ProgramType> for u32
Source§fn from(enum_value: ProgramType) -> Self
fn from(enum_value: ProgramType) -> Self
Converts to this type from the input type.
Source§impl Hash for ProgramType
impl Hash for ProgramType
Source§impl PartialEq for ProgramType
impl PartialEq for ProgramType
Source§impl TryFrom<u32> for ProgramType
impl TryFrom<u32> for ProgramType
Source§type Error = TryFromPrimitiveError<ProgramType>
type Error = TryFromPrimitiveError<ProgramType>
The type returned in the event of a conversion error.
Source§impl TryFromPrimitive for ProgramType
impl TryFromPrimitive for ProgramType
impl Copy for ProgramType
impl Eq for ProgramType
impl StructuralPartialEq for ProgramType
Auto Trait Implementations§
impl Freeze for ProgramType
impl RefUnwindSafe for ProgramType
impl Send for ProgramType
impl Sync for ProgramType
impl Unpin for ProgramType
impl UnwindSafe for ProgramType
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