#bpf #jit #libpcap #cbpf #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

#341 in Unix APIs

Download history 581/week @ 2023-10-18 515/week @ 2023-10-25 189/week @ 2023-11-01 282/week @ 2023-11-08 316/week @ 2023-11-15 169/week @ 2023-11-22 186/week @ 2023-11-29 196/week @ 2023-12-06 272/week @ 2023-12-13 209/week @ 2023-12-20 109/week @ 2023-12-27 382/week @ 2024-01-03 275/week @ 2024-01-10 385/week @ 2024-01-17 496/week @ 2024-01-24 389/week @ 2024-01-31

1,595 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