Documentation ¶
Index ¶
- Constants
- Variables
- type Attribute
- type AttributeType
- type Attributes
- type CommandType
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) GetAttributeInt(a *Attribute, portOrVLAN uint32) (uint32, error)
- func (c *Conn) GetAttributeLink(a *Attribute, portOrVLAN uint32) (l *Link, err error)
- func (c *Conn) GetAttributePorts(a *Attribute, portOrVLAN uint32) (p Ports, err error)
- func (c *Conn) ListGlobalAttributes(dev *Device) (a Attributes, err error)
- func (c *Conn) ListPortAttributes(dev *Device) (a Attributes, err error)
- func (c *Conn) ListSwitches() ([]Device, error)
- func (c *Conn) ListVLANAttributes(dev *Device) (a Attributes, err error)
- type DataType
- type Device
- type DeviceBase
- type Group
- type Link
- type LinkAttr
- type LinkEEE
- type Port
- type PortAttribute
- type PortFlags
- type PortMap
- type PortMapAttribute
- type Ports
Constants ¶
View Source
const FamilyName = "switch"
Variables ¶
View Source
var ( // ErrInvalidAttributeType is returned when an unknown attribute type is encountered. ErrInvalidAttributeType = errors.New("invalid attribute type") // ErrIncompatibleNetlink is returned when an incompatible netlink response is detected. ErrIncompatibleNetlink = errors.New("incompatible netlink response") )
Functions ¶
This section is empty.
Types ¶
type Attribute ¶
type Attribute struct { Device *Device Group Group ID uint32 Type DataType Name string Description string }
func (*Attribute) UnmarshalAttributes ¶
func (a *Attribute) UnmarshalAttributes(ad *netlink.AttributeDecoder) error
func (*Attribute) UnmarshalBinary ¶
type AttributeType ¶
type AttributeType int
const ( AttrUnspec AttributeType = iota AttrType AttrID AttrDevName AttrAlias AttrName AttrVLANs AttrPorts AttrPortMap AttrCPUPort AttrOPID AttrOPType AttrOPName AttrOPPort AttrOPVLAN AttrOPValueInt AttrOPValueStr AttrOPValuePorts AttrOPValueLink AttrOPDescription AttrPort )
func (AttributeType) String ¶
func (i AttributeType) String() string
type Attributes ¶
func AttributesFromMessages ¶
type CommandType ¶
type CommandType int
const ( CmdUnspec CommandType = iota CmdGetSwitch CmdNewAttr CmdListGlobal CmdGetGlobal CmdSetGlobal CmdListPort CmdGetPort CmdSetPort CmdListVLAN CmdGetVLan CmdSetVLan )
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn represents a genetlink connection to the OpenWRT swconfig subsystem and implements their available actions.
func Dial ¶
Dial opens a new genetlink connection and returns a Conn structure instance that implements the switch API.
func (*Conn) GetAttributeInt ¶
func (*Conn) GetAttributeLink ¶
func (*Conn) GetAttributePorts ¶
func (*Conn) ListGlobalAttributes ¶
func (c *Conn) ListGlobalAttributes(dev *Device) (a Attributes, err error)
func (*Conn) ListPortAttributes ¶
func (c *Conn) ListPortAttributes(dev *Device) (a Attributes, err error)
func (*Conn) ListSwitches ¶
func (*Conn) ListVLANAttributes ¶
func (c *Conn) ListVLANAttributes(dev *Device) (a Attributes, err error)
type Device ¶
type Device struct { ID uint32 DeviceName string Alias string Name string VLANs uint32 Ports uint32 CPUPort uint32 PortMap []*PortMap }
func (*Device) UnmarshalAttributes ¶
func (d *Device) UnmarshalAttributes(ad *netlink.AttributeDecoder) error
func (*Device) UnmarshalBinary ¶
type DeviceBase ¶
type DeviceBase struct {
ID uint32
}
func (*DeviceBase) MarshalBinary ¶
func (d *DeviceBase) MarshalBinary() (data []byte, err error)
type Link ¶
type Link struct { Link bool Duplex bool ANeg bool TXFlow bool RXFlow bool Speed uint32 EEE LinkEEE }
func (*Link) UnmarshalAttributes ¶
func (l *Link) UnmarshalAttributes(ad *netlink.AttributeDecoder) error
type Port ¶
func (*Port) UnmarshalAttributes ¶
func (p *Port) UnmarshalAttributes(ad *netlink.AttributeDecoder) error
type PortAttribute ¶
type PortAttribute int
const ( PortAttrUnspec PortAttribute = iota PortAttrID PortAttrFlagTagged )
func (PortAttribute) String ¶
func (i PortAttribute) String() string
type PortMap ¶
func (*PortMap) UnmarshalAttributes ¶
func (m *PortMap) UnmarshalAttributes(ad *netlink.AttributeDecoder) error
type PortMapAttribute ¶
type PortMapAttribute int
const ( PortMapAttrPorts PortMapAttribute = iota PortMapAttrSegment PortMapAttrVirt )
func (PortMapAttribute) String ¶
func (i PortMapAttribute) String() string
type Ports ¶
type Ports []Port
func (*Ports) UnmarshalAttributes ¶
func (s *Ports) UnmarshalAttributes(ad *netlink.AttributeDecoder) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.