#bpf #jit #libpcap #cbpf #libbpfjit

sys bpfjit-sys

Rust bindings to NetBSD’s cBPF JIT engine

5 stable releases

✓ Uses Rust 2018 edition

2.0.0 Oct 8, 2019
1.1.0 May 28, 2019
1.0.2 Apr 17, 2019
1.0.0 Apr 16, 2019

#117 in Unix APIs

Download history 116/week @ 2019-12-07 59/week @ 2019-12-14 18/week @ 2019-12-21 41/week @ 2019-12-28 51/week @ 2020-01-04 122/week @ 2020-01-11 30/week @ 2020-01-18 18/week @ 2020-01-25 4/week @ 2020-02-01 44/week @ 2020-02-08 10/week @ 2020-02-15 69/week @ 2020-02-22 7/week @ 2020-02-29 19/week @ 2020-03-07 12/week @ 2020-03-14 41/week @ 2020-03-21

305 downloads per month

BSD-2-Clause

1MB
31K SLoC

C 31K SLoC // 0.1% comments Rust 237 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