cidrmap

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MapName    = "cilium_cidr_"
	MaxEntries = 16384
)
View Source
const (
	LPM_MAP_VALUE_SIZE = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CIDRMap

type CIDRMap struct {
	Fd        int
	AddrSize  int // max prefix length in bytes, 4 for IPv4, 16 for IPv6
	Prefixlen uint32

	// PrefixIsDynamic determines whether it's valid for entries to have
	// a prefix length that is not equal to the Prefixlen above
	PrefixIsDynamic bool
	// contains filtered or unexported fields
}

CIDRMap refers to an LPM trie map at 'path'.

func OpenMap

func OpenMap(path string, prefixlen int, prefixdyn bool) (*CIDRMap, bool, error)

OpenMap opens a new CIDRMap. 'bool' returns 'true' if the map was created, and 'false' if the map already existed. prefixdyn denotes whether element's prefixlen can vary and we thus need to use a LPM trie instead of hash table.

func OpenMapElems added in v1.5.0

func OpenMapElems(path string, prefixlen int, prefixdyn bool, maxelem uint32) (*CIDRMap, bool, error)

OpenMapElems is the same as OpenMap only with defined maxelem as argument.

func (*CIDRMap) CIDRDump added in v1.5.0

func (cm *CIDRMap) CIDRDump(to []string) []string

CIDRDump walks map 'cm' and dumps all CIDR entries

func (*CIDRMap) CIDRExists

func (cm *CIDRMap) CIDRExists(cidr net.IPNet) bool

CIDRExists returns true if 'cidr' exists in map 'cm'

func (*CIDRMap) CIDRNext added in v1.5.0

func (cm *CIDRMap) CIDRNext(cidr *net.IPNet) *net.IPNet

CIDRNext returns next CIDR entry in map 'cm'

func (*CIDRMap) Close

func (cm *CIDRMap) Close() error

Close closes the FD of the given CIDRMap

func (*CIDRMap) DeleteCIDR added in v1.5.0

func (cm *CIDRMap) DeleteCIDR(cidr net.IPNet) error

DeleteCIDR deletes an entry from 'cm' with key 'cidr'.

func (*CIDRMap) InsertCIDR added in v1.5.0

func (cm *CIDRMap) InsertCIDR(cidr net.IPNet) error

InsertCIDR inserts an entry to 'cm' with key 'cidr'. Value is currently not used.

func (*CIDRMap) String

func (cm *CIDRMap) String() string

String returns the path of the map.

Jump to

Keyboard shortcuts

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