#jit #bpf #cbpf #libpcap #libbpfjit

sys bpfjit-sys

Rust bindings to NetBSD's cBPF JIT engine

6 stable releases

2.1.0 Nov 1, 2021
2.0.0 Oct 8, 2019
1.1.0 May 28, 2019
1.0.2 Apr 17, 2019
1.0.0 Apr 16, 2019

#652 in Unix APIs

Download history 503/week @ 2024-03-13 284/week @ 2024-03-20 81/week @ 2024-03-27 197/week @ 2024-04-03 636/week @ 2024-04-10 524/week @ 2024-04-17 407/week @ 2024-04-24 465/week @ 2024-05-01 260/week @ 2024-05-08 519/week @ 2024-05-15 406/week @ 2024-05-22 266/week @ 2024-05-29 224/week @ 2024-06-05 547/week @ 2024-06-12 226/week @ 2024-06-19 136/week @ 2024-06-26

1,239 downloads per month

BSD-2-Clause

1MB
31K SLoC

C 31K SLoC // 0.1% comments Rust 216 SLoC // 0.0% comments

bpfjit-sys

Rust bindings to NetBSD's cBPF JIT engine

Version: 2.0.0
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