pub enum Program {
KProbe(KProbe),
KRetProbe(KProbe),
UProbe(UProbe),
URetProbe(UProbe),
SocketFilter(SocketFilter),
TracePoint(TracePoint),
XDP(XDP),
StreamParser(StreamParser),
StreamVerdict(StreamVerdict),
TaskIter(TaskIter),
SkLookup(SkLookup),
}
Expand description
A BPF program defined in a Module.
Variants§
KProbe(KProbe)
KRetProbe(KProbe)
UProbe(UProbe)
URetProbe(UProbe)
SocketFilter(SocketFilter)
TracePoint(TracePoint)
XDP(XDP)
StreamParser(StreamParser)
StreamVerdict(StreamVerdict)
TaskIter(TaskIter)
SkLookup(SkLookup)
Implementations§
Source§impl Program
impl Program
pub fn name(&self) -> &str
pub fn fd(&self) -> &Option<RawFd>
Sourcepub fn load(&mut self, kernel_version: u32, license: String) -> Result<()>
pub fn load(&mut self, kernel_version: u32, license: String) -> Result<()>
Load the BPF program.
BPF programs need to be loaded before they can be attached. Loading will fail if the BPF verifier rejects the code.
§Example
use redbpf::Module;
let mut module = Module::parse(&std::fs::read("file.elf").unwrap()).unwrap();
for program in module.programs.iter_mut() {
program
.load(module.version, module.license.clone()).unwrap()
}
Auto Trait Implementations§
impl Freeze for Program
impl RefUnwindSafe for Program
impl Send for Program
impl Sync for Program
impl Unpin for Program
impl UnwindSafe for Program
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