efw

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Rendered for windows/amd64

Overview

Package efw contains support code for eBPF for Windows.

Index

Constants

This section is empty.

Variables

View Source
var BPF = newProc("bpf")

The BPF syscall wrapper which is ABI compatible with Linux.

int bpf(int cmd, union bpf_attr* attr, unsigned int size)

Functions

func EbpfCanonicalizePinPath added in v0.19.0

func EbpfCanonicalizePinPath(input string) (string, error)

func EbpfCloseFd

func EbpfCloseFd(fd int) error

func EbpfDuplicateFd

func EbpfDuplicateFd(fd int) (int, error)

func EbpfGetBpfAttachType

func EbpfGetBpfAttachType(attachType windows.GUID) (uint32, error)

func EbpfGetBpfProgramType

func EbpfGetBpfProgramType(programType windows.GUID) (uint32, error)

func EbpfGetEbpfAttachType

func EbpfGetEbpfAttachType(attachType uint32) (windows.GUID, error)

func EbpfObjectLoadNativeFds

func EbpfObjectLoadNativeFds(fileName string, mapFds []FD, programFds []FD) (int, int, error)

func EbpfObjectUnpin

func EbpfObjectUnpin(path string) error

func EbpfProgramAttachFds

func EbpfProgramAttachFds(fd int, attachType windows.GUID, params unsafe.Pointer, params_size uintptr) (int, error)

Types

type BpfMapInfo

type BpfMapInfo struct {
	Name [_BPF_OBJ_NAME_LEN]byte ///< Null-terminated map name.
	// contains filtered or unexported fields
}

See https://github.com/microsoft/ebpf-for-windows/blob/95267a53b26c68a94145d1731e2a4c8b546034c3/include/ebpf_structs.h#L372-L386

type BpfProgInfo

type BpfProgInfo struct {
	Name [_BPF_OBJ_NAME_LEN]byte ///< Null-terminated map name.
	// contains filtered or unexported fields
}

See https://github.com/microsoft/ebpf-for-windows/blob/95267a53b26c68a94145d1731e2a4c8b546034c3/include/ebpf_structs.h#L396-L410

type Int

type Int int32

Int is the equivalent of int on MSVC (am64, arm64) and MinGW (gcc, clang).

type ObjectType

type ObjectType uint32

ObjectType is the equivalent of ebpf_object_type_t.

See https://github.com/microsoft/ebpf-for-windows/blob/44f5de09ec0f3f7ad176c00a290c1cb7106cdd5e/include/ebpf_core_structs.h#L41

const (
	EBPF_OBJECT_UNKNOWN ObjectType = iota
	EBPF_OBJECT_MAP
	EBPF_OBJECT_LINK
	EBPF_OBJECT_PROGRAM
)

func EbpfGetNextPinnedObjectPath

func EbpfGetNextPinnedObjectPath(startPath string, objectType ObjectType) (string, ObjectType, error)

func EbpfObjectGetInfoByFd

func EbpfObjectGetInfoByFd(fd int, info unsafe.Pointer, info_size *uint32) (ObjectType, error)

type Result

type Result int32

See https://github.com/microsoft/ebpf-for-windows/blob/main/include/ebpf_result.h

const (
	EBPF_SUCCESS Result = iota
	EBPF_VERIFICATION_FAILED
	EBPF_JIT_COMPILATION_FAILED
	EBPF_PROGRAM_LOAD_FAILED
	EBPF_INVALID_FD
	EBPF_INVALID_OBJECT
	EBPF_INVALID_ARGUMENT
	EBPF_OBJECT_NOT_FOUND
	EBPF_OBJECT_ALREADY_EXISTS
	EBPF_FILE_NOT_FOUND
	EBPF_ALREADY_PINNED
	EBPF_NOT_PINNED
	EBPF_NO_MEMORY
	EBPF_PROGRAM_TOO_LARGE
	EBPF_RPC_EXCEPTION
	EBPF_ALREADY_INITIALIZED
	EBPF_ELF_PARSING_FAILED
	EBPF_FAILED
	EBPF_OPERATION_NOT_SUPPORTED
	EBPF_KEY_NOT_FOUND
	EBPF_ACCESS_DENIED
	EBPF_BLOCKED_BY_POLICY
	EBPF_ARITHMETIC_OVERFLOW
	EBPF_EXTENSION_FAILED_TO_LOAD
	EBPF_INSUFFICIENT_BUFFER
	EBPF_NO_MORE_KEYS
	EBPF_KEY_ALREADY_EXISTS
	EBPF_NO_MORE_TAIL_CALLS
	EBPF_PENDING
	EBPF_OUT_OF_SPACE
	EBPF_CANCELED
	EBPF_INVALID_POINTER
	EBPF_TIMEOUT
	EBPF_STALE_ID
	EBPF_INVALID_STATE
)

func (Result) Error

func (r Result) Error() string

func (Result) String

func (i Result) String() string

type Size

type Size uint64

Size is the equivalent of size_t.

This is correct on amd64 and arm64 according to tests on godbolt.org.

Jump to

Keyboard shortcuts

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