kernel

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: Apache-2.0 Imports: 4 Imported by: 79

Documentation

Overview

Package kernel - describe kernel mechanism

Index

Constants

View Source
const (

	// MECHANISM string
	MECHANISM = "KERNEL"

	// LinuxIfMaxLength - Linux has a limit of 15 characters for an interface name
	LinuxIfMaxLength = 15

	// PCIAddressKey - device PCI address property key
	PCIAddressKey = common.PCIAddressKey

	// DeviceTokenIDKey is a device token ID property key
	DeviceTokenIDKey = common.DeviceTokenIDKey

	// NetNSInodeKey - netns inode mechanism property key
	NetNSInodeKey = common.NetNSInodeKey

	// InterfaceNameKey - interface name mechanism property key
	InterfaceNameKey = common.InterfaceNameKey

	// NetNSURL - NetNS URL, it can be either:
	// * file:///proc/${pid}/ns/net - ${pid} process net NS
	// * inode://${dev}/${ino} - while transferring file between processes using grpcfd
	NetNSURL = common.InodeURL

	// NetNSURLScheme - expected scheme of NetNSURLs
	NetNSURLScheme = "file"

	// SupportsVLAN - flag set if the forwarder supports VLAN trunking
	SupportsVLAN = "supportsVlan"

	// VLAN - VLAN ID
	VLAN = "vlan"
)

Variables

This section is empty.

Functions

func New

func New(netnsURL string) *networkservice.Mechanism

New returns *networkservice.Mechanism of type kernel using the given netnsURL (file:///proc/${pid}/ns/net)

Types

type Mechanism

type Mechanism struct {
	*networkservice.Mechanism
}

Mechanism is a kernel mechanism helper

func ToMechanism

func ToMechanism(m *networkservice.Mechanism) *Mechanism

ToMechanism converts unified mechanism to helper If Mechanism m is *not* of type kernel.MECHANISM, it returns nil

func (*Mechanism) GetDeviceTokenID added in v1.1.0

func (m *Mechanism) GetDeviceTokenID() string

GetDeviceTokenID returns device token ID

func (*Mechanism) GetInterfaceName

func (m *Mechanism) GetInterfaceName() string

GetInterfaceName returns the Kernel Interface Name

func (*Mechanism) GetNetNSInode

func (m *Mechanism) GetNetNSInode() string

GetNetNSInode returns the NetNS inode

func (*Mechanism) GetNetNSURL

func (m *Mechanism) GetNetNSURL() string

GetNetNSURL returns the NetNS URL, it can be either: * file:///proc/${pid}/ns/net - ${pid} process net NS * inode://${dev}/${ino} - while transferring file between processes using grpcfd

func (*Mechanism) GetPCIAddress

func (m *Mechanism) GetPCIAddress() string

GetPCIAddress returns the PCI address of the device

func (*Mechanism) GetParameters

func (m *Mechanism) GetParameters() map[string]string

GetParameters returns the map of all parameters to the mechanism

func (*Mechanism) GetVLAN added in v1.1.0

func (m *Mechanism) GetVLAN() uint32

GetVLAN - return Vlan value - 0 if unset or invalid

func (*Mechanism) IsPCIDevice

func (m *Mechanism) IsPCIDevice() bool

IsPCIDevice returns if this mechanism is for a PCI device

func (*Mechanism) SetDeviceTokenID added in v1.1.0

func (m *Mechanism) SetDeviceTokenID(tokenID string)

SetDeviceTokenID sets device token ID

func (*Mechanism) SetInterfaceName

func (m *Mechanism) SetInterfaceName(interfaceName string)

SetInterfaceName sets the Kernel Interface Name

func (*Mechanism) SetNetNSInode

func (m *Mechanism) SetNetNSInode(netNSInode string)

SetNetNSInode sets the NetNS inode

func (*Mechanism) SetNetNSURL

func (m *Mechanism) SetNetNSURL(urlString string)

SetNetNSURL sets the NetNS URL - file:///proc/${pid}/ns/net

func (*Mechanism) SetPCIAddress

func (m *Mechanism) SetPCIAddress(pciAddress string)

SetPCIAddress sets the PCI address of the device

func (*Mechanism) SetSupportsVLAN added in v1.1.0

func (m *Mechanism) SetSupportsVLAN(supportsVlan bool)

SetSupportsVLAN set SupportsVLAN flag

func (*Mechanism) SetVLAN added in v1.1.0

func (m *Mechanism) SetVLAN(vlan uint32) *Mechanism

SetVLAN - set the VLAN value

func (*Mechanism) SupportsVLAN added in v1.1.0

func (m *Mechanism) SupportsVLAN() bool

SupportsVLAN returns SupportsVLAN flag

Jump to

Keyboard shortcuts

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