Skip to content
Mark Bednarczyk edited this page Nov 11, 2024 · 2 revisions

JNetRuntime BPF Compiler

Welcome to the JNetRuntime BPF Compiler module documentation. This module provides a flexible and extensible compilation framework for transforming network filter expressions into Berkeley Packet Filter (BPF) bytecode.

๐Ÿš€ Key Features

  • Multi-Dialect Support

    • TCPDump/PCAP filter syntax
    • Wireshark display filter expressions
    • Napatech NTPL filter language
  • Standard BPF Compatibility

    • Generates bytecode compatible with kernel BPF
    • Works with JNetRuntime BPF VM
    • Compatible with traditional BPF interpreters
  • High Performance

    • Optimized compilation process
    • Efficient bytecode generation
    • Multiple optimization levels

๐ŸŽฏ Purpose

The BPF Compiler module serves as a bridge between human-readable filter expressions and efficient machine-executable BPF bytecode. It enables:

  1. Network Traffic Filtering

    • Packet capture and analysis
    • Network monitoring
    • Protocol-specific filtering
  2. Cross-Platform Compatibility

    • Works on any Java-supported platform
    • Kernel BPF integration when available
    • Pure Java fallback with BPF VM
  3. Tool Integration

    • Compatible with existing network tools
    • Support for industry-standard syntaxes
    • Extensible for custom requirements

๐Ÿ”ง Quick Start

// Choose your preferred dialect
BpfCompiler compiler = BpfCompiler.forDialect(FilterDialect.PCAP);

// Compile a filter expression
byte[] bytecode = compiler.compile("tcp port 80");

// Use with JNetRuntime BPF VM
BPFProgram program = BPFProgram.load(bytecode);
boolean matches = program.execute(packet);

๐Ÿ“š Documentation

๐Ÿ”„ Integration

The compiler module works seamlessly with other JNetRuntime components:

[Filter Expression]
        โ†“
[BPF Compiler Module]
        โ†“
   [BPF Bytecode]
        โ†“
  โ”Œโ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”
[BPF VM]  [Kernel BPF]

๐Ÿ› ๏ธ Next Steps

๐Ÿ“ฎ Support


Check out our API Documentation for detailed information about using the compiler.

Have questions? Join our Community Discussion!