bpf: maze.io/x/bpf Index | Files | Directories

package bpf

import "maze.io/x/bpf"

Package bpf is an assembler for the Berkeley Packet Filter (bpf).

Index

Package Files

assembler.go bpf.go doc.go parse.go program.go vm.go vm_debug.go vm_registers.go

type ALUOp Uses

type ALUOp = bpf.ALUOp

Instruction aliases.

type ALUOpConstant Uses

type ALUOpConstant = bpf.ALUOpConstant

Type aliases.

type ALUOpX Uses

type ALUOpX = bpf.ALUOpX

Type aliases.

type Extension Uses

type Extension = bpf.Extension

Type aliases.

type Instruction Uses

type Instruction = bpf.Instruction

Type aliases.

type Jump Uses

type Jump = bpf.Jump

Type aliases.

type JumpIf Uses

type JumpIf = bpf.JumpIf

Type aliases.

type JumpIfX Uses

type JumpIfX = bpf.JumpIfX

Type aliases.

type JumpTest Uses

type JumpTest = bpf.JumpTest

Type aliases.

type LoadAbsolute Uses

type LoadAbsolute = bpf.LoadAbsolute

Type aliases.

type LoadConstant Uses

type LoadConstant = bpf.LoadConstant

Type aliases.

type LoadExtension Uses

type LoadExtension = bpf.LoadExtension

Type aliases.

type LoadIndirect Uses

type LoadIndirect = bpf.LoadIndirect

Type aliases.

type LoadMemShift Uses

type LoadMemShift = bpf.LoadMemShift

Type aliases.

type LoadScratch Uses

type LoadScratch = bpf.LoadScratch

Type aliases.

type NegateA Uses

type NegateA = bpf.NegateA

Type aliases.

type Program Uses

type Program []bpf.Instruction

Program is an assembled program.

func Assemble Uses

func Assemble(source string) (Program, error)

Assemble BPF instructions from source.

func (Program) Assemble Uses

func (p Program) Assemble() ([]bpf.RawInstruction, error)

func (Program) Verify Uses

func (p Program) Verify() error

Verify the program doing bounary checks and detecting division by zero errors.

type RawInstruction Uses

type RawInstruction = bpf.RawInstruction

Type aliases.

type Register Uses

type Register = bpf.Register

Type aliases.

type Registers Uses

type Registers struct {
    PC  uint32     // Program Counter
    A   uint32     // Accumulator
    X   uint32     //
    R   [16]uint32 // Scratch
}

Registers for a BPF virtual machine.

type RetA Uses

type RetA = bpf.RetA

Type aliases.

type RetConstant Uses

type RetConstant = bpf.RetConstant

Type aliases.

type StoreScratch Uses

type StoreScratch = bpf.StoreScratch

Type aliases.

type TAX Uses

type TAX = bpf.TAX

Type aliases.

type TXA Uses

type TXA = bpf.TXA

Type aliases.

type VM Uses

type VM struct {
    // Extensions are optional callback to load extensions. Note that the
    // "len" extension is always provided by the VM.
    Extensions map[bpf.Extension]func(*Registers) uint32
    // contains filtered or unexported fields
}

A VM is an emulated BPF virtual machine.

func NewVM Uses

func NewVM(program Program) *VM

func (*VM) Run Uses

func (vm *VM) Run(in []byte) (verdict uint32, err error)

func (*VM) Verify Uses

func (vm *VM) Verify() error

Verify runs sanity checks on the loaded program.

Directories

PathSynopsis
cmd/bpfasmPackage bpfasm implements a basic BPF assembler.
internal/parser

Package bpf imports 11 packages (graph) and is imported by 1 packages. Updated 2019-03-19. Refresh now. Tools for package owners.