Liking cljdoc? Tell your friends :D

clj-ebpf.elf

ELF (Executable and Linkable Format) parser for BPF programs

ELF (Executable and Linkable Format) parser for BPF programs
raw docstring

create-maps-from-elfclj

(create-maps-from-elf path)

Create all BPF maps defined in ELF file

Parameters:

  • path: Path to ELF file

Returns map of {map-name -> BpfMap}

Example: (create-maps-from-elf "filter.o") ;; => {"my_map" #clj_ebpf.maps.BpfMap{...}}

Create all BPF maps defined in ELF file

Parameters:
- path: Path to ELF file

Returns map of {map-name -> BpfMap}

Example:
  (create-maps-from-elf "filter.o")
  ;; => {"my_map" #clj_ebpf.maps.BpfMap{...}}
sourceraw docstring

get-map-defclj

(get-map-def elf-file name)

Get BPF map definition by name

Parameters:

  • elf-file: Parsed ELF file
  • name: Map name

Returns BpfMapDef record or nil

Get BPF map definition by name

Parameters:
- elf-file: Parsed ELF file
- name: Map name

Returns BpfMapDef record or nil
sourceraw docstring

get-programclj

(get-program elf-file name-or-idx)

Get BPF program by name or index

Parameters:

  • elf-file: Parsed ELF file
  • name-or-idx: Program name (string) or index (integer)

Returns BpfProgram record or nil

Get BPF program by name or index

Parameters:
- elf-file: Parsed ELF file
- name-or-idx: Program name (string) or index (integer)

Returns BpfProgram record or nil
sourceraw docstring

inspect-elfclj

(inspect-elf path)

Inspect ELF file and return summary information

Parameters:

  • path: Path to ELF file

Returns map with:

  • :programs - List of program info
  • :maps - List of map info
  • :license - License string
  • :version - Kernel version

Example: (inspect-elf "filter.o") ;; => {:programs [{:name "xdp_filter" :type :xdp :size 128}] ;; :maps [{:name "my_map" :type 1 :key-size 4 ...}] ;; :license "GPL" ;; :version 0}

Inspect ELF file and return summary information

Parameters:
- path: Path to ELF file

Returns map with:
- :programs - List of program info
- :maps - List of map info
- :license - License string
- :version - Kernel version

Example:
  (inspect-elf "filter.o")
  ;; => {:programs [{:name "xdp_filter" :type :xdp :size 128}]
  ;;     :maps [{:name "my_map" :type 1 :key-size 4 ...}]
  ;;     :license "GPL"
  ;;     :version 0}
sourceraw docstring

list-mapsclj

(list-maps elf-file)

List all BPF map definitions in ELF file

Returns vector of maps with :name, :type, :key-size, :value-size, :max-entries

List all BPF map definitions in ELF file

Returns vector of maps with :name, :type, :key-size, :value-size, :max-entries
sourceraw docstring

list-programsclj

(list-programs elf-file)

List all BPF programs in ELF file

Returns vector of maps with :name, :section, :type, :size

List all BPF programs in ELF file

Returns vector of maps with :name, :section, :type, :size
sourceraw docstring

load-elf-program-and-mapsclj

(load-elf-program-and-maps path program-name)

Load BPF program and create all maps from ELF file

Parameters:

  • path: Path to ELF file
  • program-name: Name of program to load

Returns map with:

  • :program-fd - Program file descriptor
  • :maps - Map of {map-name -> BpfMap}

Example: (let [{:keys [program-fd maps]} (load-elf-program-and-maps "filter.o" "xdp_filter")] (println "Program FD:" program-fd) (println "Maps:" (keys maps)))

Load BPF program and create all maps from ELF file

Parameters:
- path: Path to ELF file
- program-name: Name of program to load

Returns map with:
- :program-fd - Program file descriptor
- :maps - Map of {map-name -> BpfMap}

Example:
  (let [{:keys [program-fd maps]} (load-elf-program-and-maps "filter.o" "xdp_filter")]
    (println "Program FD:" program-fd)
    (println "Maps:" (keys maps)))
sourceraw docstring

load-program-from-elfclj

(load-program-from-elf path program-name & options)

Load a BPF program from ELF file

Parameters:

  • path: Path to ELF file
  • program-name: Name of program to load (or index)
  • options: Additional options for program loading

Returns program file descriptor

Example: (load-program-from-elf "filter.o" "xdp_filter")

Load a BPF program from ELF file

Parameters:
- path: Path to ELF file
- program-name: Name of program to load (or index)
- options: Additional options for program loading

Returns program file descriptor

Example:
  (load-program-from-elf "filter.o" "xdp_filter")
sourceraw docstring

parse-elf-fileclj

(parse-elf-file path)

Parse ELF file and extract BPF programs and maps

Parameters:

  • path: Path to ELF file

Returns ElfFile record with:

  • header: ELF header
  • sections: Vector of section headers
  • programs: Vector of BPF programs
  • maps: Vector of BPF map definitions
  • license: License string
  • version: Kernel version
Parse ELF file and extract BPF programs and maps

Parameters:
- path: Path to ELF file

Returns ElfFile record with:
- header: ELF header
- sections: Vector of section headers
- programs: Vector of BPF programs
- maps: Vector of BPF map definitions
- license: License string
- version: Kernel version
sourceraw docstring

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