maps

package
v0.0.0-...-76a4e66 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at

http://aws.amazon.com/apache2.0/

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFirstMapEntryByID

func GetFirstMapEntryByID(nextKey uintptr, mapID int) error

func GetIDFromFD

func GetIDFromFD(mapFD int) (int, error)

func GetMapEntryByID

func GetMapEntryByID(key, value uintptr, mapID int) error

func GetNextMapEntryByID

func GetNextMapEntryByID(key, nextKey uintptr, mapID int) error

Types

type BpfMap

type BpfMap struct {
	MapFD       uint32
	MapID       uint32
	MapMetaData CreateEBPFMapInput
}

func (*BpfMap) BulkDeleteMapEntry

func (m *BpfMap) BulkDeleteMapEntry(keyvalue map[uintptr]uintptr) error

func (*BpfMap) BulkRefreshMapEntries

func (m *BpfMap) BulkRefreshMapEntries(newMapContents map[string]uintptr) error

func (*BpfMap) BulkUpdateMapEntry

func (m *BpfMap) BulkUpdateMapEntry(keyvalue map[uintptr]uintptr) error

func (*BpfMap) CreateBPFMap

func (m *BpfMap) CreateBPFMap(MapMetaData CreateEBPFMapInput) (BpfMap, error)

func (*BpfMap) CreateMapEntry

func (m *BpfMap) CreateMapEntry(key, value uintptr) error

func (*BpfMap) CreateUpdateMapEntry

func (m *BpfMap) CreateUpdateMapEntry(key, value uintptr, updateFlags uint64) error

func (*BpfMap) DeleteMapEntry

func (m *BpfMap) DeleteMapEntry(key uintptr) error

func (*BpfMap) GetAllMapKeys

func (m *BpfMap) GetAllMapKeys() ([]string, error)

func (*BpfMap) GetFirstMapEntry

func (m *BpfMap) GetFirstMapEntry(nextKey uintptr) error

To get the first entry pass key as `nil`

func (*BpfMap) GetMapEntry

func (m *BpfMap) GetMapEntry(key, value uintptr) error

func (*BpfMap) GetMapFromPinPath

func (m *BpfMap) GetMapFromPinPath(pinPath string) (BpfMapInfo, error)

func (*BpfMap) GetNextMapEntry

func (m *BpfMap) GetNextMapEntry(key, nextKey uintptr) error

func (*BpfMap) PinMap

func (m *BpfMap) PinMap(pinPath string, pinType uint32) error

func (*BpfMap) UnPinMap

func (m *BpfMap) UnPinMap(pinPath string) error

func (*BpfMap) UpdateMapEntry

func (m *BpfMap) UpdateMapEntry(key, value uintptr) error

type BpfMapAPIs

type BpfMapAPIs interface {
	// Wrapper for BPF_MAP_CREATE API
	CreateBPFMap(mapMetaData CreateEBPFMapInput) (BpfMap, error)
	// Pin map to the passed pinPath
	PinMap(pinPath string, pinType uint32) error
	// Delete pinPath
	UnPinMap(pinPath string) error
	// Add an entry to map, if the entry exists, we error out
	CreateMapEntry(key, value uintptr) error
	// Update an entry in map, if the entry exists, we update
	UpdateMapEntry(key, value uintptr) error
	// Wrapper to call create or update
	CreateUpdateMapEntry(key, value uintptr, updateFlags uint64) error
	// Delete a map entry
	DeleteMapEntry(key uintptr) error
	// Map iterator helper - Get the first map entry
	GetFirstMapEntry(nextKey uintptr) error
	//  Map iterator helper - Get next map entry
	GetNextMapEntry(key, nextKey uintptr) error
	// Get map value
	GetMapEntry(key, value uintptr) error
	// Update multiple map entries
	BulkUpdateMapEntry(keyvalue map[uintptr]uintptr) error
	// Delete multiple map entries
	BulkDeleteMapEntry(keyvalue map[uintptr]uintptr) error
	// Wrapper for delete and update map entries
	BulkRefreshMapEntries(newMapContents map[string]uintptr) error
	// Retrieve map info from pin path
	GetMapFromPinPath(pinPath string) (BpfMapInfo, error)
}

type BpfMapDef

type BpfMapDef struct {
	Type       uint32
	KeySize    uint32
	ValueSize  uint32
	MaxEntries uint32
	Flags      uint32
	InnerMapFd uint32
	Pinning    uint32
}

type BpfMapInfo

type BpfMapInfo struct {
	Type                  uint32
	Id                    uint32
	KeySize               uint32
	ValueSize             uint32
	MaxEntries            uint32
	MapFlags              uint32
	Name                  [constdef.BPFObjNameLen]byte
	IfIndex               uint32
	BtfVmLinuxValueTypeId uint32
	NetnsDev              uint64
	NetnsIno              uint64
	BTFID                 uint32
	BTFKeyTypeID          uint32
	BTFValueTypeId        uint32
	Pad                   uint32
	MapExtra              uint64
}

func BpfGetAllMapInfo

func BpfGetAllMapInfo() ([]BpfMapInfo, error)

func GetBPFmapInfo

func GetBPFmapInfo(mapFD int) (BpfMapInfo, error)

type BpfMapPinOptions

type BpfMapPinOptions struct {
	Type    uint32
	PinPath string
}

type BpfMapShowAttr

type BpfMapShowAttr struct {
	MapID     uint32
	NextID    uint32
	OpenFlags uint32
}

type BpfObjGet

type BpfObjGet struct {
	// contains filtered or unexported fields
}

* struct { anonymous struct used by BPF_OBJ_* commands * __aligned_u64 pathname; * __u32 bpf_fd; * __u32 file_flags; * };

func (*BpfObjGet) BpfGetObject

func (attr *BpfObjGet) BpfGetObject() (int, error)

type BpfObjGetInfo

type BpfObjGetInfo struct {
	// contains filtered or unexported fields
}
  • struct { anonymous struct used by BPF_OBJ_GET_INFO_BY_FD
  • __u32 bpf_fd;
  • __u32 info_len;
  • __aligned_u64 info;
  • } info;

*

func (*BpfObjGetInfo) BpfGetMapInfoForFD

func (objattr *BpfObjGetInfo) BpfGetMapInfoForFD() error

type CreateEBPFMapInput

type CreateEBPFMapInput struct {
	Type       uint32
	KeySize    uint32
	ValueSize  uint32
	MaxEntries uint32
	Flags      uint32
	InnerMapFd uint32
	PinOptions *BpfMapPinOptions
	NumaNode   uint32
	Name       string
}

Directories

Path Synopsis
Package mock_maps is a generated GoMock package.
Package mock_maps is a generated GoMock package.

Jump to

Keyboard shortcuts

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