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.
Summary
Functions
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.
Formats a list of integer port numbers without charlist coercion (for example,
[53] renders as "[53]" instead of "~c\"5\"").
Normalizes port options (:ports, :dport, or :sport) for L4 port plugs.
Callbacks
@callback ir(opts :: term()) :: [MaeBPF.IR.Op.t()]
@callback maps(opts :: term()) :: [MaeBPF.IR.MapDef.t()]
Functions
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.
Formats a list of integer port numbers without charlist coercion (for example,
[53] renders as "[53]" instead of "~c\"5\"").
Normalizes port options (:ports, :dport, or :sport) for L4 port plugs.