A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/polachok/bpfjit below:

polachok/bpfjit: BPF JIT from FreeBSD

BPF JIT

BPF to amd64 JIT compiler for rust extracted from FreeBSD 10 tree.

Example usage
extern crate bpfjit;
extern crate pcap;
use std::mem;

fn main() {
    let pcap = pcap::Capture::dead(pcap::Linktype(12 /* raw ip */)).unwrap();
    let bpf_prog = pcap.compile("tcp and dst port 80").unwrap();
    let insns = bpf_prog.get_instructions();
    let filter = bpfjit::BpfJitFilter::compile(unsafe {
        mem::transmute(insns)
    }).unwrap();
    let data = [1,2,3,4];
    if filter.matched(&data[..]) {
        // ...
    }
}

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4