rtnetlink

package
v0.0.0-...-72cb0c4 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2013 License: BSD-3-Clause Imports: 5 Imported by: 0

README

Subdirectories represent sub 'classes' (Netlink MessageType) of RTNetlink;  So RTM_[DEL|GET|SET]ROUTE structures would all be in route/

Interface, Link and call will likely be rewritten to be more similar to the behaviour of 'route', but these placeholders should work for now.


Documentation

Index

Constants

View Source
const (
	GRP_LINK          = 1 << iota
	GRP_NOTIFY        = 1 << iota
	GRP_NEIGH         = 1 << iota
	GRP_TC            = 1 << iota
	GRP_IPV4_IFADDR   = 1 << iota
	GRP_IPV4_MROUTE   = 1 << iota
	GRP_IPV4_ROUTE    = 1 << iota
	GRP_IPV4_RULE     = 1 << iota
	GRP_IPV6_IFADDR   = 1 << iota
	GRP_IPV6_MROUTE   = 1 << iota
	GRP_IPV6_ROUTE    = 1 << iota
	GRP_IPV6_IFINFO   = 1 << iota
	GRP_DECnet_IFADDR = 1 << iota
	GRP_NOP2          = 1 << iota
	GRP_DECnet_ROUTE  = 1 << iota
	GRP_DECnet_RULE   = 1 << iota
	GRP_NOP4          = 1 << iota
	GRP_IPV6_PREFIX   = 1 << iota
	GRP_IPV6_RULE     = 1 << iota
	GRP_ND_USEROPT    = 1 << iota
	GRP_PHONET_IFADDR = 1 << iota
	GRP_PHONET_ROUTE  = 1 << iota
)
View Source
const (
	RTM_NEWLINK netlink.MessageType = iota + netlink.MIN_TYPE
	RTM_DELLINK
	RTM_GETLINK
	RTM_SETLINK
	RTM_NEWADDR
	RTM_DELADDR
	RTM_GETADDR
	RTM_RESERVED23
	RTM_NEWROUTE
	RTM_DELROUTE
	RTM_GETROUTE
	RTM_RESERVED27
	RTM_NEWNEIGH
	RTM_DELNEIGH
	RTM_GETNEIGH
	RTM_RESERVED31
	RTM_NEWRULE
	RTM_DELRULE
	RTM_GETRULE
	RTM_RESERVED35
	RTM_NEWQDISC
	RTM_DELQDISC
	RTM_GETQDISC
	RTM_RESERVED39
	RTM_NEWTCLASS
	RTM_DELTCLASS
	RTM_GETTCLASS
	RTM_RESERVED43
	RTM_NEWTFILTER
	RTM_DELTFILTER
	RTM_GETTFILTER
	RTM_RESERVED47
	RTM_NEWACTION
	RTM_DELACTION
	RTM_GETACTION
	RTM_RESERVED51
	RTM_NEWPREFIX
	RTM_RESERVED53
	RTM_RESERVED54
	RTM_RESERVED55
	RTM_RESERVED56
	RTM_RESERVED57
	RTM_GETMULTICAST
	RTM_RESERVED59
	RTM_RESERVED60
	RTM_RESERVED61
	RTM_GETANYCAST
	RTM_RESERVED63
	RTM_NEWNEIGHTBL
	RTM_RESERVED65
	RTM_GETNEIGHTBL
	RTM_SETNEIGHTBL
	RTM_NEWNDUSEROPT
	RTM_RESERVED69
	RTM_RESERVED70
	RTM_RESERVED71
	RTM_NEWADDRLABEL
	RTM_DELADDRLABEL
	RTM_GETADDRLABEL
	RTM_RESERVED75
	RTM_RESERVED76
	RTM_RESERVED77
	RTM_GETDCB
	RTM_SETDCB
	RTM_BASE = RTM_NEWLINK
	RTM_MAX  = RTM_SETDCB
)

netlink.MessageType's for RTNETLINK

Variables

View Source
var ScopeStrings = map[Scope]string{
	RT_SCOPE_UNIVERSE: "RT_SCOPE_UNIVERSE",
	RT_SCOPE_SITE:     "RT_SCOPE_SITE",
	RT_SCOPE_LINK:     "RT_SCOPE_LINK",
	RT_SCOPE_HOST:     "RT_SCOPE_HOST",
	RT_SCOPE_NOWHERE:  "RT_SCOPE_NOWHERE",
}

Functions

This section is empty.

Types

type Family

type Family uint8

Family is already defined in syscall, but we re-define them here for type-safety.

const (
	AF_UNSPEC Family = syscall.AF_UNSPEC
	AF_INET   Family = syscall.AF_INET
	AF_INET6  Family = syscall.AF_INET6
	AF_BRIDGE Family = syscall.AF_BRIDGE
)

func (Family) String

func (self Family) String() (out string)

Returns the String representation of the Family, or "" if the family name is unknown.

type Header interface {
	Len() int // The (unpadded) length of the Header.
	UnmarshalNetlink([]byte) error
	MarshalNetlink() ([]byte, error)
}

An RTNetlink Header describes the structures between the netlink header and the nlattributes.

type Message

type Message struct {
	Header     Header
	Attributes []netlink.Attribute
}

A Message contains a Header object and a series of attributes. It is extracted from the Body of a netlink.Message

func NewMessage

func NewMessage(h Header, attrs []netlink.Attribute) *Message

Create a new rtnetlink.Message based off of a header an list of attributes (which may be nil or empty).

func (Message) GetAttribute

func (self Message) GetAttribute(t netlink.AttributeType) (attr netlink.Attribute, err error)

Retrieve (the first) Attribute identified by Type, returning an error if not found.

func (self Message) MarshalNetlink() (out []byte, err error)

Handles the appropriate calls to marshal the Header and Attribute values, and return an appropriately aligned result.

func (*Message) SetAttribute

func (self *Message) SetAttribute(attr netlink.Attribute)

Replace or append the attribute with the AttributeType of attr

func (self *Message) UnmarshalNetlink(in []byte) (err error)

Unmarshals a generic message using the header as a guide. An error will be returned if the header cannot unmarshal properly, or any attribute in the series failed.

type Scope

type Scope byte

The scope of an address/route

const (
	RT_SCOPE_UNIVERSE Scope = 0
	RT_SCOPE_SITE     Scope = 200
	RT_SCOPE_LINK     Scope = 253
	RT_SCOPE_HOST     Scope = 254
	RT_SCOPE_NOWHERE  Scope = 255
)

func (Scope) String

func (self Scope) String() (out string)

Will return a string identifying the Scope, if a 'user' table, RT_SCOPE_%d will be used.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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