# maebpf v0.1.0 - API Reference

## Modules

- [MaeBPF](MaeBPF.md): Managed Atomic eBPF (`maeBPF`): zero-clang pure-Elixir eBPF compilation,
compile-time fused `MaeBPF.Plug` pipelines, state-preserving atomic
`BPF_LINK_UPDATE` hot-swapping, and zero-polling `enif_select` ring buffer
streaming for Elixir/BEAM.
- [MaeBPF.Compiler](MaeBPF.Compiler.md): Behaviour for eBPF compiler backends invoked by `use MaeBPF, compiler: Module`.
- [MaeBPF.Compiler.Pure](MaeBPF.Compiler.Pure.md): Zero-clang pure-Elixir eBPF ISA v3 + ELF64 + `.BTF` + `.BTF.ext` compiler.
- [MaeBPF.DSL](MaeBPF.DSL.md): Unified compile-time DSL backing `use MaeBPF`.
- [MaeBPF.Diagnostics](MaeBPF.Diagnostics.md): Source-mapped Linux eBPF verifier error diagnostics.
- [MaeBPF.Disasm](MaeBPF.Disasm.md): Pure-Elixir eBPF ISA v3 disassembler for raw instruction binaries, compiled
ELF64 (`EM_BPF`) objects, and `use MaeBPF` modules.
- [MaeBPF.Globals](MaeBPF.Globals.md): BTF-driven pre-load patching and post-load read/write access for eBPF
`.rodata`, `.data`, and `.bss` global variables.
- [MaeBPF.IR](MaeBPF.IR.md): Typed intermediate representation (IR) and static safety checker for `MaeBPF`.
- [MaeBPF.IR.MapDef](MaeBPF.IR.MapDef.md): Typed BPF map definition inside `%MaeBPF.IR.Module{}`.

- [MaeBPF.IR.Module](MaeBPF.IR.Module.md): Root IR container representing a multi-program, multi-map eBPF ELF object.

- [MaeBPF.IR.Op](MaeBPF.IR.Op.md): Typed IR operation emitted by a `MaeBPF.Plug` or DSL statement.

- [MaeBPF.IR.Program](MaeBPF.IR.Program.md): Typed eBPF program entry inside `%MaeBPF.IR.Module{}`.

- [MaeBPF.Link](MaeBPF.Link.md): Attachment, atomic program hot-swap, iterator reads, introspection, and
teardown of kernel `bpf_link` resources.
- [MaeBPF.Map](MaeBPF.Map.md): Operations on eBPF maps belonging to a loaded object or opened from bpffs
via `open_pinned/1`, including native per-CPU map lookups and updates.

- [MaeBPF.Migration](MaeBPF.Migration.md): Transactional live hot-swap map migration planner and executor.
- [MaeBPF.Migration.Plan](MaeBPF.Migration.Plan.md): Validated migration plan produced by `MaeBPF.Migration.plan/3`.

- [MaeBPF.Packet](MaeBPF.Packet.md): Ethernet, IPv4, UDP, and TCP packet builders plus IPv4, CIDR, LPM key, and
16-byte packed RingBuf event codecs.
- [MaeBPF.Plug](MaeBPF.Plug.md): Compile-time behaviour for composable, zero-runtime-overhead eBPF pipeline
plugs.
- [MaeBPF.Plugs.Blocklist](MaeBPF.Plugs.Blocklist.md): Looks up the packet's IPv4 source (or destination) address against a
module-level exact IPv4 map (`:hash` / `:lru_hash`, 4-byte key) or CIDR
longest-prefix-match map (`:lpm_trie`, 8-byte
`<<32::32-little, ipv4::32-big>>` key).
- [MaeBPF.Plugs.CountPackets](MaeBPF.Plugs.CountPackets.md): Increments a `:percpu_array` (lock-free) or `:array` (atomic) counter map at
slot `0` (configurable via `:slot`), and optionally accumulates packet byte
length (`data_end - data`) at slot `1` (configurable via `:byte_slot`).
- [MaeBPF.Plugs.CountTracepoint](MaeBPF.Plugs.CountTracepoint.md): Increments a `:percpu_array` (lock-free) or `:array` (atomic) counter map on
every kernel tracepoint invocation inside a `trace` hook block.
- [MaeBPF.Plugs.DropInvalid](MaeBPF.Plugs.DropInvalid.md): Drops frames shorter than 14 bytes (Ethernet header) or malformed IPv4
packets (`ethertype == 0x0800` with fewer than 34 bytes or `ihl < 5`).

- [MaeBPF.Plugs.DropTCP](MaeBPF.Plugs.DropTCP.md): Drops IPv4 TCP packets matching one or more destination or source ports.
- [MaeBPF.Plugs.DropUDP](MaeBPF.Plugs.DropUDP.md): Drops IPv4 UDP packets matching one or more destination or source ports.
- [MaeBPF.Plugs.PassTCP](MaeBPF.Plugs.PassTCP.md): Passes IPv4 TCP packets matching one or more destination or source ports.
- [MaeBPF.Plugs.PassUDP](MaeBPF.Plugs.PassUDP.md): Passes IPv4 UDP packets matching one or more destination or source ports.
- [MaeBPF.Plugs.SampleRingBuf](MaeBPF.Plugs.SampleRingBuf.md): Emits a compact 16-byte packed event into a declared RingBuf `stream`
- [MaeBPF.Plugs.TLSSNI](MaeBPF.Plugs.TLSSNI.md): Pure-Elixir, zero-`clang` TLS ClientHello SNI domain filter for `tcx` and
`cgroup_skb` hooks.
- [MaeBPF.Probe](MaeBPF.Probe.md): Host kernel capability probing, privilege inspection, and human-readable
feature diagnostics for Linux eBPF environments.
- [MaeBPF.RingBuf](MaeBPF.RingBuf.md): Zero-polling `BPF_MAP_TYPE_RINGBUF` consumer backed by `ring_buffer__epoll_fd`
and BEAM `enif_select`.
- [MaeBPF.Schema](MaeBPF.Schema.md): Single-source-of-truth schema compilation, packed binary codecs, endianness
conversion, and map geometry compatibility checks for eBPF maps, events, and
global variables.
- [MaeBPF.Schema.MapSpec](MaeBPF.Schema.MapSpec.md): Compiled BPF map specification capturing kernel geometry, key/value
schemas, and a deterministic SHA-256 layout fingerprint.

- [MaeBPF.Server](MaeBPF.Server.md): OTP GenServer owning a live eBPF object, single or multi-hook `bpf_link`
attachments, optional `enif_select` ring buffer streaming, live zero-downtime
debug tracing, transactional map migration, and optional kernel runtime stats.
- [MaeBPF.Sim](MaeBPF.Sim.md): Pure-Elixir macOS and Linux simulator for `MaeBPF.IR` pipelines.
- [MaeBPF.Supervisor](MaeBPF.Supervisor.md): Standard OTP `Supervisor` managing one or more `MaeBPF` policy workers.
- [MaeBPF.Target](MaeBPF.Target.md): Ergonomic target validation and resolution for `MaeBPF` kernel attachments.
- [MaeBPF.Telemetry](MaeBPF.Telemetry.md): Live kernel BPF introspection and `BPF_STATS_RUN_TIME` telemetry controls.

- [MaeBPF.Test](MaeBPF.Test.md): Dual-mode testing harness comparing pure-Elixir IR simulation (`MaeBPF.Sim`)
against live Linux kernel `BPF_PROG_TEST_RUN` (`MaeBPF.TestRun`).
- [MaeBPF.TestRun](MaeBPF.TestRun.md): Direct Linux `BPF_PROG_TEST_RUN` execution for loaded eBPF programs.

