Enum bpf_rs::ProgramType
source · [−]#[non_exhaustive]
#[repr(u32)]
pub enum ProgramType {
Show 32 variants
Unspec,
SocketFilter,
Kprobe,
SchedCls,
SchedAct,
Tracepoint,
Xdp,
PerfEvent,
CgroupSkb,
CgroupSock,
LwtIn,
LwtOut,
LwtXmit,
SockOps,
SkSkb,
CgroupDevice,
SkMsg,
RawTracepoint,
CgroupSockAddr,
LwtSeg6local,
LircMode2,
SkReuseport,
FlowDissector,
CgroupSysctl,
RawTracepointWritable,
CgroupSockopt,
Tracing,
StructOps,
Ext,
Lsm,
SkLookup,
Syscall,
}
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
Unspec
SocketFilter
Kprobe
SchedCls
SchedAct
Tracepoint
Xdp
PerfEvent
CgroupSkb
CgroupSock
LwtIn
LwtOut
LwtXmit
SockOps
SkSkb
CgroupDevice
SkMsg
RawTracepoint
CgroupSockAddr
LwtSeg6local
LircMode2
SkReuseport
FlowDissector
CgroupSysctl
RawTracepointWritable
CgroupSockopt
Tracing
StructOps
Ext
Lsm
SkLookup
Syscall
Implementations
sourceimpl 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
sourceimpl Clone for ProgramType
impl Clone for ProgramType
sourcefn clone(&self) -> ProgramType
fn clone(&self) -> ProgramType
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ProgramType
impl Debug for ProgramType
sourceimpl Display for ProgramType
impl Display for ProgramType
sourceimpl From<ProgramType> for u32
impl From<ProgramType> for u32
sourcefn from(enum_value: ProgramType) -> Self
fn from(enum_value: ProgramType) -> Self
Converts to this type from the input type.
sourceimpl Hash for ProgramType
impl Hash for ProgramType
sourceimpl PartialEq<ProgramType> for ProgramType
impl PartialEq<ProgramType> for ProgramType
sourceimpl TryFrom<u32> for ProgramType
impl TryFrom<u32> for ProgramType
type Error = TryFromPrimitiveError<ProgramType>
type Error = TryFromPrimitiveError<ProgramType>
The type returned in the event of a conversion error.
sourcefn try_from(number: u32) -> Result<Self, TryFromPrimitiveError<Self>>
fn try_from(number: u32) -> Result<Self, TryFromPrimitiveError<Self>>
Performs the conversion.
sourceimpl TryFromPrimitive for ProgramType
impl TryFromPrimitive for ProgramType
type Primitive = u32
const NAME: &'static str = "ProgramType"
fn try_from_primitive(
number: Self::Primitive
) -> Result<Self, TryFromPrimitiveError<Self>>
impl Copy for ProgramType
impl Eq for ProgramType
impl StructuralEq for ProgramType
impl StructuralPartialEq for ProgramType
Auto Trait Implementations
impl RefUnwindSafe for ProgramType
impl Send for ProgramType
impl Sync for ProgramType
impl Unpin for ProgramType
impl UnwindSafe for ProgramType
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more