bpf

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2019 License: BSD-3-Clause Imports: 11 Imported by: 0

README

bpf

Berkeley Packet Filter (BPF) assembler.

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ALUOp added in v1.0.0

type ALUOp = bpf.ALUOp

Instruction aliases.

type ALUOpConstant added in v1.0.0

type ALUOpConstant = bpf.ALUOpConstant

Type aliases.

type ALUOpX added in v1.0.0

type ALUOpX = bpf.ALUOpX

Type aliases.

type Extension added in v1.0.0

type Extension = bpf.Extension

Type aliases.

type Instruction added in v1.0.0

type Instruction = bpf.Instruction

Type aliases.

type Jump added in v1.0.0

type Jump = bpf.Jump

Type aliases.

type JumpIf added in v1.0.0

type JumpIf = bpf.JumpIf

Type aliases.

type JumpIfX added in v1.0.0

type JumpIfX = bpf.JumpIfX

Type aliases.

type JumpTest added in v1.0.0

type JumpTest = bpf.JumpTest

Type aliases.

type LoadAbsolute added in v1.0.0

type LoadAbsolute = bpf.LoadAbsolute

Type aliases.

type LoadConstant added in v1.0.0

type LoadConstant = bpf.LoadConstant

Type aliases.

type LoadExtension added in v1.0.0

type LoadExtension = bpf.LoadExtension

Type aliases.

type LoadIndirect added in v1.0.0

type LoadIndirect = bpf.LoadIndirect

Type aliases.

type LoadMemShift added in v1.0.0

type LoadMemShift = bpf.LoadMemShift

Type aliases.

type LoadScratch added in v1.0.0

type LoadScratch = bpf.LoadScratch

Type aliases.

type NegateA added in v1.0.0

type NegateA = bpf.NegateA

Type aliases.

type Program added in v1.0.0

type Program []bpf.Instruction

Program is an assembled program.

func Assemble

func Assemble(source string) (Program, error)

Assemble BPF instructions from source.

func (Program) Assemble added in v1.0.0

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

type RawInstruction added in v1.0.0

type RawInstruction = bpf.RawInstruction

Type aliases.

type Register added in v1.0.0

type Register = bpf.Register

Type aliases.

type Registers added in v1.0.0

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

Registers for a BPF virtual machine.

type RetA added in v1.0.0

type RetA = bpf.RetA

Type aliases.

type RetConstant added in v1.0.0

type RetConstant = bpf.RetConstant

Type aliases.

type StoreScratch added in v1.0.0

type StoreScratch = bpf.StoreScratch

Type aliases.

type TAX added in v1.0.0

type TAX = bpf.TAX

Type aliases.

type TXA added in v1.0.0

type TXA = bpf.TXA

Type aliases.

type VM added in v1.0.0

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 added in v1.0.0

func NewVM(program Program) *VM

func (*VM) Run added in v1.0.0

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

func (*VM) Verify added in v1.0.0

func (vm *VM) Verify() error

Verify runs sanity checks on the loaded program.

Directories

Path Synopsis
cmd
bpfasm
Package bpfasm implements a basic BPF assembler.
Package bpfasm implements a basic BPF assembler.
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL