Expand description
A crate for encoding and decoding eBPF instructions.
§Usage
use bpf_ins::{Instruction, Register};
//
// return 0
//
let instructions = [
Instruction::mov32(Register::R0, 0), // mov r0, 0
Instruction::exit(), // exit
];
let mut encoded = vec![];
for instruction in &instructions {
let (x, y) = instruction.encode();
encoded.push(x);
if let Some(y) = y {
encoded.push(y);
}
}
§License
Re-exports§
pub use error::*;
pub use instruction::*;