# `MaeBPF.Plug`
[🔗](https://github.com/cocoa-xu/MaeBPF/blob/v0.1.0/maebpf/lib/maebpf/plug.ex#L1)

Compile-time behaviour for composable, zero-runtime-overhead eBPF pipeline
plugs.

Inspired by `Plug`, every `MaeBPF.Plug` module declares pure compile-time IR
emission callbacks (`init/1`, optional `maps/1`, and `ir/1`). During
compilation (AOT via `use MaeBPF` or dynamically via
`MaeBPF.compile_pipeline/2`), all plugs in a hook block are fused into a
single flat eBPF instruction stream with shared packet bounds checks.

# `init`

```elixir
@callback init(opts :: keyword()) :: term()
```

# `ir`

```elixir
@callback ir(opts :: term()) :: [MaeBPF.IR.Op.t()]
```

# `maps`
*optional* 

```elixir
@callback maps(opts :: term()) :: [MaeBPF.IR.MapDef.t()]
```

# `expand`

Expands a `{plug_module, raw_opts}` pair (or plug-expandable struct such as
`~BPFC"""..."""`) into `{maps, ops}`, annotating every emitted
`%MaeBPF.IR.Op{}` with its originating `plug`, `file`, and `line`.

# `format_ports`

Formats a list of integer port numbers without charlist coercion (for example,
`[53]` renders as `"[53]"` instead of `"~c\"5\""`).

# `normalize_port_opts`

Normalizes port options (`:ports`, `:dport`, or `:sport`) for L4 port plugs.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
