Documentation
¶
Overview ¶
Package api contains the reference implementation of the wasm API for Inspektor Gadget. It's designed to be used by gadgets and not by any other internal component of Inspektor Gadget.
This package requires TinyGo to ensure that stacks are not dynamically moved between unsafe.StringData and calls to wasm host functions. It doesn't work with the official Golang compiler.
Index ¶
- Constants
- func Debug(params ...any)
- func Debugf(fmt string, params ...any)
- func Error(params ...any)
- func Errorf(fmt string, params ...any)
- func GetParamValue(key string) (string, error)
- func GetSyscallName(id uint16) (string, error)
- func Info(params ...any)
- func Infof(fmt string, params ...any)
- func KallsymsSymbolExists(symbol string) bool
- func Log(level logLevel, args ...any)
- func Logf(level logLevel, format string, args ...any)
- func ReleaseHandle[T ~uint32](handle T) error
- func SetConfig(key string, val any) error
- func Trace(params ...any)
- func Tracef(fmt string, params ...any)
- func Warn(params ...any)
- func Warnf(fmt string, params ...any)
- type ArrayFunc
- type Data
- type DataArray
- type DataFunc
- type DataSource
- func (ds DataSource) AddField(name string, kind FieldKind) (Field, error)
- func (ds DataSource) EmitAndRelease(packet Packet) error
- func (ds DataSource) GetField(name string) (Field, error)
- func (ds DataSource) IsReferenced() bool
- func (ds DataSource) NewPacketArray() (PacketArray, error)
- func (ds DataSource) NewPacketSingle() (PacketSingle, error)
- func (ds DataSource) Release(packet Packet) error
- func (ds DataSource) Subscribe(cb DataFunc, priority uint32) error
- func (ds DataSource) SubscribeArray(cb ArrayFunc, priority uint32) error
- func (ds DataSource) SubscribePacket(cb PacketFunc, priority uint32) error
- func (ds DataSource) Unreference() error
- type DataSourceType
- type Field
- func (f Field) AddTag(tag string) error
- func (f Field) Bool(data Data) (bool, error)
- func (f Field) Bytes(data Data) ([]byte, error)
- func (f Field) Float32(data Data) (float32, error)
- func (f Field) Float64(data Data) (float64, error)
- func (f Field) Int16(data Data) (int16, error)
- func (f Field) Int32(data Data) (int32, error)
- func (f Field) Int64(data Data) (int64, error)
- func (f Field) Int8(data Data) (int8, error)
- func (f Field) SetBool(data Data, b bool) error
- func (f Field) SetBytes(data Data, buf []byte) error
- func (f Field) SetFloat32(data Data, value float32) error
- func (f Field) SetFloat64(data Data, value float64) error
- func (f Field) SetInt16(data Data, value int16) error
- func (f Field) SetInt32(data Data, value int32) error
- func (f Field) SetInt64(data Data, value int64) error
- func (f Field) SetInt8(data Data, value int8) error
- func (f Field) SetString(data Data, str string) error
- func (f Field) SetUint16(data Data, value uint16) error
- func (f Field) SetUint32(data Data, value uint32) error
- func (f Field) SetUint64(data Data, value uint64) error
- func (f Field) SetUint8(data Data, value uint8) error
- func (f Field) String(data Data) (string, error)
- func (f Field) Uint16(data Data) (uint16, error)
- func (f Field) Uint32(data Data) (uint32, error)
- func (f Field) Uint64(data Data) (uint64, error)
- func (f Field) Uint8(data Data) (uint8, error)
- type FieldKind
- type Map
- type MapSpec
- type MapType
- type MapUpdateFlags
- type Packet
- type PacketArray
- type PacketFunc
- type PacketSingle
- type PerfReader
- type SyscallDeclaration
- type SyscallParam
Constants ¶
View Source
const ( ErrorLevel logLevel = iota WarnLevel InfoLevel DebugLevel TraceLevel )
Variables ¶
This section is empty.
Functions ¶
func GetParamValue ¶ added in v0.33.0
func GetSyscallName ¶ added in v0.37.0
func KallsymsSymbolExists ¶ added in v0.37.0
func ReleaseHandle ¶ added in v0.37.0
Types ¶
type ArrayFunc ¶
type ArrayFunc func(DataSource, DataArray) error
type DataFunc ¶
type DataFunc func(DataSource, Data)
type DataSource ¶
type DataSource uint32
func GetDataSource ¶
func GetDataSource(name string) (DataSource, error)
func NewDataSource ¶
func NewDataSource(name string, typ DataSourceType) (DataSource, error)
func (DataSource) AddField ¶
func (ds DataSource) AddField(name string, kind FieldKind) (Field, error)
func (DataSource) EmitAndRelease ¶
func (ds DataSource) EmitAndRelease(packet Packet) error
func (DataSource) IsReferenced ¶ added in v0.35.0
func (ds DataSource) IsReferenced() bool
func (DataSource) NewPacketArray ¶
func (ds DataSource) NewPacketArray() (PacketArray, error)
func (DataSource) NewPacketSingle ¶
func (ds DataSource) NewPacketSingle() (PacketSingle, error)
func (DataSource) Release ¶
func (ds DataSource) Release(packet Packet) error
func (DataSource) SubscribeArray ¶
func (ds DataSource) SubscribeArray(cb ArrayFunc, priority uint32) error
func (DataSource) SubscribePacket ¶
func (ds DataSource) SubscribePacket(cb PacketFunc, priority uint32) error
func (DataSource) Unreference ¶ added in v0.35.0
func (ds DataSource) Unreference() error
type DataSourceType ¶
type DataSourceType uint32
const ( DataSourceTypeUndefined DataSourceType = 0 DataSourceTypeSingle DataSourceType = 1 DataSourceTypeArray DataSourceType = 2 )
type FieldKind ¶
type FieldKind uint32
const ( Kind_Invalid FieldKind = 0 Kind_Bool FieldKind = 1 Kind_Int8 FieldKind = 2 Kind_Int16 FieldKind = 3 Kind_Int32 FieldKind = 4 Kind_Int64 FieldKind = 5 Kind_Uint8 FieldKind = 6 Kind_Uint16 FieldKind = 7 Kind_Uint32 FieldKind = 8 Kind_Uint64 FieldKind = 9 Kind_Float32 FieldKind = 10 Kind_Float64 FieldKind = 11 Kind_String FieldKind = 12 Kind_CString FieldKind = 13 Kind_Bytes FieldKind = 14 )
Keep in sync with pkg/gadget-service/api/api.proto
type MapType ¶ added in v0.35.0
type MapType uint32
const ( UnspecifiedMap MapType = iota Hash Array ProgramArray PerfEventArray PerCPUHash PerCPUArray StackTrace CGroupArray LRUHash LRUCPUHash LPMTrie ArrayOfMaps HashOfMaps DevMap SockMap CPUMap XSKMap SockHash CGroupStorage ReusePortSockArray PerCPUCGroupStorage Queue Stack SkStorage DevMapHash StructOpsMap RingBuf InodeStorage TaskStorage BloomFilter UserRingbuf CgroupStorage Arena )
Taken from: https://github.com/cilium/ebpf/blob/6d6c5e3225732525434b0c192c97950488a4051b/types.go#L13-L105
type MapUpdateFlags ¶ added in v0.35.0
type MapUpdateFlags uint64
const ( UpdateAny MapUpdateFlags = iota UpdateNoExist MapUpdateFlags = 1 << (iota - 1) UpdateExist UpdateLock )
Taken from: https://github.com/cilium/ebpf/blob/061e86d8f5e9/map.go#L790-L801
type PacketArray ¶
type PacketArray uint32
type PacketFunc ¶
type PacketFunc func(DataSource, Packet) error
type PacketSingle ¶
type PacketSingle uint32
type PerfReader ¶ added in v0.37.0
type PerfReader uint32
func NewPerfReader ¶ added in v0.37.0
func NewPerfReader(m Map, size uint32, isOverwritable bool) (PerfReader, error)
func (PerfReader) Close ¶ added in v0.37.0
func (p PerfReader) Close() error
func (PerfReader) Pause ¶ added in v0.37.0
func (p PerfReader) Pause() error
func (PerfReader) Read ¶ added in v0.37.0
func (p PerfReader) Read() ([]byte, error)
func (PerfReader) Resume ¶ added in v0.37.0
func (p PerfReader) Resume() error
type SyscallDeclaration ¶ added in v0.37.0
type SyscallDeclaration struct { Name string Params []SyscallParam }
func GetSyscallDeclaration ¶ added in v0.37.0
func GetSyscallDeclaration(name string) (SyscallDeclaration, error)
type SyscallParam ¶ added in v0.37.0
Click to show internal directories.
Click to hide internal directories.