#bpf #jit #libpcap #cbpf #libbpfjit

sys bpfjit-sys

Rust bindings to NetBSD’s cBPF JIT engine

5 stable releases

✓ Uses Rust 2018 edition

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

#5 in #bpf

Download history 267/week @ 2019-06-25 110/week @ 2019-07-02 244/week @ 2019-07-09 190/week @ 2019-07-16 155/week @ 2019-07-23 56/week @ 2019-07-30 155/week @ 2019-08-06 162/week @ 2019-08-13 115/week @ 2019-08-20 40/week @ 2019-08-27 66/week @ 2019-09-03 21/week @ 2019-09-10 65/week @ 2019-09-17 27/week @ 2019-09-24 39/week @ 2019-10-01

432 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