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

    type ALUOp = bpf.ALUOp

      Instruction aliases.

      type ALUOpConstant

      type ALUOpConstant = bpf.ALUOpConstant

        Type aliases.

        type ALUOpX

        type ALUOpX = bpf.ALUOpX

          Type aliases.

          type Extension

          type Extension = bpf.Extension

            Type aliases.

            type Instruction

            type Instruction = bpf.Instruction

              Type aliases.

              type Jump

              type Jump = bpf.Jump

                Type aliases.

                type JumpIf

                type JumpIf = bpf.JumpIf

                  Type aliases.

                  type JumpIfX

                  type JumpIfX = bpf.JumpIfX

                    Type aliases.

                    type JumpTest

                    type JumpTest = bpf.JumpTest

                      Type aliases.

                      type LoadAbsolute

                      type LoadAbsolute = bpf.LoadAbsolute

                        Type aliases.

                        type LoadConstant

                        type LoadConstant = bpf.LoadConstant

                          Type aliases.

                          type LoadExtension

                          type LoadExtension = bpf.LoadExtension

                            Type aliases.

                            type LoadIndirect

                            type LoadIndirect = bpf.LoadIndirect

                              Type aliases.

                              type LoadMemShift

                              type LoadMemShift = bpf.LoadMemShift

                                Type aliases.

                                type LoadScratch

                                type LoadScratch = bpf.LoadScratch

                                  Type aliases.

                                  type NegateA

                                  type NegateA = bpf.NegateA

                                    Type aliases.

                                    type Program

                                    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

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

                                        type RawInstruction

                                        type RawInstruction = bpf.RawInstruction

                                          Type aliases.

                                          type Register

                                          type Register = bpf.Register

                                            Type aliases.

                                            type Registers

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

                                              Registers for a BPF virtual machine.

                                              type RetA

                                              type RetA = bpf.RetA

                                                Type aliases.

                                                type RetConstant

                                                type RetConstant = bpf.RetConstant

                                                  Type aliases.

                                                  type StoreScratch

                                                  type StoreScratch = bpf.StoreScratch

                                                    Type aliases.

                                                    type TAX

                                                    type TAX = bpf.TAX

                                                      Type aliases.

                                                      type TXA

                                                      type TXA = bpf.TXA

                                                        Type aliases.

                                                        type VM

                                                        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

                                                          func NewVM(program Program) *VM

                                                          func (*VM) Run

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

                                                          func (*VM) Verify

                                                          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