12个版本 (6个重大更新)
0.7.4 | 2024年2月5日 |
---|---|
0.7.2 | 2022年11月20日 |
#182 在 编程语言 中
每月下载量 34次
在 3 个crate中使用了(通过 bpf-script)
86KB
1.5K SLoC
bpf-ins
用于编码和解码eBPF指令的crate。
用法
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);
}
}
许可证
lib.rs
:
用于编码和解码eBPF指令的crate。
用法
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);
}
}
许可证
依赖项
~270–730KB
~17K SLoC