#jit #cbpf #bpf #libpcap #libbpfjit

sys bpfjit-sys

Rust bindings to NetBSD's cBPF JIT engine

8 stable releases

2.1.2 Oct 7, 2024
2.1.1 Aug 9, 2024
2.1.0 Nov 1, 2021
2.0.0 Oct 8, 2019
1.0.2 Apr 17, 2019

#227 in Unix APIs

Download history 115/week @ 2024-08-24 165/week @ 2024-08-31 248/week @ 2024-09-07 223/week @ 2024-09-14 94/week @ 2024-09-21 76/week @ 2024-09-28 304/week @ 2024-10-05 251/week @ 2024-10-12 274/week @ 2024-10-19 202/week @ 2024-10-26 167/week @ 2024-11-02 154/week @ 2024-11-09 257/week @ 2024-11-16 141/week @ 2024-11-23 277/week @ 2024-11-30 303/week @ 2024-12-07

1,024 downloads per month

BSD-2-Clause

1MB
24K SLoC

C 24K SLoC // 0.1% comments Rust 219 SLoC // 0.0% comments

bpfjit-sys

Rust bindings to NetBSD's cBPF JIT engine

Author: Alex Forster <alex@alexforster.com>
License: BSD-2-Clause

Build Status

Usage

use bpfjit_sys::{BpfJit, Linktype};

static PACKET: &'static [u8] = &[
	// 0xDE, 0xAD, 0xBE, 0xEF, ...
];

fn main() {
	let filter = BpfJit::new("udp dst port 123", Linktype::Ethernet)?;
	
	if filter.matches(PACKET) {
		// ...
	}
}

Attributions

sljit

Copyright © Zoltan Herczeg <hzmester@freemail.hu>. All rights reserved.

Distributed under the 2-clause BSD license (BSD-2-Clause).

bpfjit

Copyright © Alexander Nasonov <alnsn@yandex.ru>. All rights reserved.

Distributed under the 2-clause BSD license (BSD-2-Clause).

Dependencies