Liking cljdoc? Tell your friends :D

clj-ebpf.dsl.core

Core DSL module that re-exports all DSL functionality.

This namespace provides a unified API for BPF program construction:

(require '[clj-ebpf.dsl.core :as dsl])

;; Build a simple XDP program that drops all packets
(def drop-all
  (dsl/assemble
    [(dsl/mov :r0 1)    ; XDP_DROP = 1
     (dsl/exit-insn)]))

For more focused imports, use the submodules directly:

  • clj-ebpf.dsl.instructions - Low-level instruction encoding
  • clj-ebpf.dsl.alu - Arithmetic operations
  • clj-ebpf.dsl.mem - Memory operations
  • clj-ebpf.dsl.jump - Control flow
  • clj-ebpf.dsl.atomic - Atomic memory operations
Core DSL module that re-exports all DSL functionality.

This namespace provides a unified API for BPF program construction:

```clojure
(require '[clj-ebpf.dsl.core :as dsl])

;; Build a simple XDP program that drops all packets
(def drop-all
  (dsl/assemble
    [(dsl/mov :r0 1)    ; XDP_DROP = 1
     (dsl/exit-insn)]))
```

For more focused imports, use the submodules directly:
- clj-ebpf.dsl.instructions - Low-level instruction encoding
- clj-ebpf.dsl.alu - Arithmetic operations
- clj-ebpf.dsl.mem - Memory operations
- clj-ebpf.dsl.jump - Control flow
- clj-ebpf.dsl.atomic - Atomic memory operations
raw docstring

addclj

source

add-regclj

source

alu32-immclj

source

alu32-regclj

source

alu64-immclj

source

alu64-regclj

source

and-opclj

source

and-regclj

source

arshclj

source

arsh-regclj

source

assembleclj

(assemble insns)

Assemble a sequence of DSL instructions into bytes.

Arguments:

  • insns: Sequence of instruction maps (from DSL functions)

Returns a byte array ready for BPF loading.

Assemble a sequence of DSL instructions into bytes.

Arguments:
- insns: Sequence of instruction maps (from DSL functions)

Returns a byte array ready for BPF loading.
sourceraw docstring

atomic-addclj

source

atomic-andclj

source

atomic-available?clj

source

atomic-clear-bitclj

source

atomic-cmpxchgclj

source

atomic-decclj

source

atomic-fetch-addclj

source

atomic-fetch-andclj

source

atomic-fetch-orclj

source

atomic-fetch-xorclj

source

atomic-incclj

source

atomic-orclj

source

atomic-set-bitclj

source

atomic-supportclj

source

atomic-toggle-bitclj

source

atomic-xchgclj

source

atomic-xorclj

source

bswap16clj

source

bswap32clj

source

bswap64clj

source

callclj

source

divclj

source

div-regclj

source

end-to-beclj

source

end-to-leclj

source

exit-insnclj

source

flatten-insnsclj

(flatten-insns insns)

Flatten nested instruction sequences (e.g., from lddw).

Handles:

  • Vectors of instructions
  • Single instructions
  • Labels
Flatten nested instruction sequences (e.g., from lddw).

Handles:
- Vectors of instructions
- Single instructions
- Labels
sourceraw docstring

instruction->bytesclj

source

instructions->bytesclj

source

jaclj

source

jeqclj

source

jgeclj

source

jgtclj

source

jleclj

source

jltclj

source

jmp-immclj

source

jmp-regclj

source

jmp32-immclj

source

jmp32-regclj

source

jneclj

source

jsetclj

source

jsgeclj

source

jsgtclj

source

jsleclj

source

jsltclj

source

labelclj

source

label-refclj

source

label-ref?clj

source

label?clj

source

ld-map-fdclj

source

ld-map-valueclj

source

lddwclj

source

ldxclj

source

ldxbclj

source

ldxdwclj

source

ldxhclj

source

ldxwclj

source

lshclj

source

lsh-regclj

source

make-instructionclj

source

mod-opclj

source

mod-regclj

source

movclj

source

mov-regclj

source

mov32clj

source

mov32-regclj

source

mulclj

source

mul-regclj

source

neg-regclj

source

or-opclj

source

or-regclj

source

programcljmacro

(program prog-type & body)

Define a BPF program.

Example:

(program :xdp
  (mov :r0 (xdp-action :pass))
  (exit-insn))
Define a BPF program.

Example:
```clojure
(program :xdp
  (mov :r0 (xdp-action :pass))
  (exit-insn))
```
sourceraw docstring

reg->numclj

source

registersclj

source

resolve-labelsclj

(resolve-labels insns)

Resolve label references to actual offsets.

Arguments:

  • insns: Sequence of instructions (may include labels and label refs)

Returns a sequence of instructions with label references replaced by actual offsets.

Resolve label references to actual offsets.

Arguments:
- insns: Sequence of instructions (may include labels and label refs)

Returns a sequence of instructions with label references replaced
by actual offsets.
sourceraw docstring

rshclj

source

rsh-regclj

source

sk-actionclj

(sk-action action)

Get socket filter action.

  • :reject (0)
  • :accept (positive value, usually packet length)
Get socket filter action.

- :reject (0)
- :accept (positive value, usually packet length)
sourceraw docstring

stclj

source

stack-loadclj

source

stack-storeclj

source

stack-store-immclj

source

stbclj

source

stdwclj

source

sthclj

source

stwclj

source

stxclj

source

stxbclj

source

stxdwclj

source

stxhclj

source

stxwclj

source

subclj

source

sub-regclj

source

tail-callclj

source

tc-actionclj

(tc-action action)

Get TC action constant.

Actions:

  • :ok (0)
  • :reclassify (1)
  • :shot (2)
  • :pipe (3)
  • :stolen (4)
  • :queued (5)
  • :repeat (6)
  • :redirect (7)
Get TC action constant.

Actions:
- :ok (0)
- :reclassify (1)
- :shot (2)
- :pipe (3)
- :stolen (4)
- :queued (5)
- :repeat (6)
- :redirect (7)
sourceraw docstring

valid-instruction?clj

source

xdp-actionclj

(xdp-action action)

Get XDP action constant.

Actions:

  • :aborted (0)
  • :drop (1)
  • :pass (2)
  • :tx (3)
  • :redirect (4)
Get XDP action constant.

Actions:
- :aborted (0)
- :drop (1)
- :pass (2)
- :tx (3)
- :redirect (4)
sourceraw docstring

xor-opclj

source

xor-regclj

source

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close