Documentation ¶
Index ¶
- Variables
- func ReservedIP(n net.IPNet) (net.IP, error)
- type Controller
- func (r *Controller) AddConnection(ctx context.Context, c net.Conn)
- func (r *Controller) Announce(ip net.IP, mac net.HardwareAddr) error
- func (r *Controller) RemoveFlows() error
- func (r *Controller) RemoveFlowsByMAC(mac net.HardwareAddr) error
- func (r *Controller) SetEventListener(l EventListener)
- func (r *Controller) String() string
- type ControllerEventListener
- type Descriptions
- type Device
- func (r *Device) Close()
- func (r *Device) Descriptions() Descriptions
- func (r *Device) Factory() openflow.Factory
- func (r *Device) Features() Features
- func (r *Device) Flood(ingress *Port, packet []byte) error
- func (r *Device) FlowTableID() uint8
- func (r *Device) ID() string
- func (r *Device) IsClosed() bool
- func (r *Device) Port(num uint32) *Port
- func (r *Device) Ports() []*Port
- func (r *Device) RemoveFlow(match openflow.Match, port openflow.OutPort) error
- func (r *Device) RemoveFlowByMAC(mac net.HardwareAddr) error
- func (r *Device) RemoveFlows() error
- func (r *Device) SendARPAnnouncement(ip net.IP, mac net.HardwareAddr) error
- func (r *Device) SendARPDiscovery(sha net.HardwareAddr, spa, tpa net.IP) error
- func (r *Device) SendMessage(msg encoding.BinaryMarshaler) error
- func (r *Device) SetFlow(match openflow.Match, port openflow.OutPort) error
- func (r *Device) String() string
- func (r *Device) Writer() transceiver.Writer
- type EventListener
- type Features
- type Finder
- type LocationStatus
- type Node
- type Port
- type TopologyEventListener
Constants ¶
This section is empty.
Variables ¶
var (
ErrClosedDevice = errors.New("already closed device")
)
var NullMAC = net.HardwareAddr([]byte{0x06, 0xff, 0x01, 0x21, 0x09, 0x03})
NullMAC is a random local MAC address, which does not belong to any host, to disconnect a host from the network.
Functions ¶
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func NewController ¶
func NewController(db database) *Controller
func (*Controller) AddConnection ¶
func (r *Controller) AddConnection(ctx context.Context, c net.Conn)
func (*Controller) Announce ¶
func (r *Controller) Announce(ip net.IP, mac net.HardwareAddr) error
func (*Controller) RemoveFlows ¶
func (r *Controller) RemoveFlows() error
func (*Controller) RemoveFlowsByMAC ¶
func (r *Controller) RemoveFlowsByMAC(mac net.HardwareAddr) error
func (*Controller) SetEventListener ¶
func (r *Controller) SetEventListener(l EventListener)
func (*Controller) String ¶
func (r *Controller) String() string
type ControllerEventListener ¶
type Descriptions ¶
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
func (*Device) Descriptions ¶
func (r *Device) Descriptions() Descriptions
func (*Device) Flood ¶
Flood broadcasts the packet to all ports of this device, except the ingress port if ingress is not nil.
func (*Device) FlowTableID ¶
func (*Device) RemoveFlow ¶
TODO: Remove the flow caches that match the removed flows. This is not a critical issue, but same flows cannot be installed until the caches are expired.
func (*Device) RemoveFlowByMAC ¶
func (r *Device) RemoveFlowByMAC(mac net.HardwareAddr) error
TODO: Remove the flow caches that match the removed flows. This is not a critical issue, but same flows cannot be installed until the caches are expired.
func (*Device) RemoveFlows ¶
RemoveFlows removes all the normal flows except special ones for table miss and ARP packets.
func (*Device) SendARPAnnouncement ¶
func (*Device) SendARPDiscovery ¶
func (*Device) SendMessage ¶
func (r *Device) SendMessage(msg encoding.BinaryMarshaler) error
func (*Device) SetFlow ¶
SetFlow installs a normal flow entry for packet switching and routing into the switch device.
func (*Device) Writer ¶
func (r *Device) Writer() transceiver.Writer
type EventListener ¶
type EventListener interface { ControllerEventListener TopologyEventListener }
type Finder ¶
type Finder interface { Device(id string) *Device Devices() []*Device // IsEnabledBySTP returns whether p is disabled by spanning tree protocol IsEnabledBySTP(p *Port) bool // IsEdge returns whether p is an edge among two switches IsEdge(p *Port) bool Node(mac net.HardwareAddr) (*Node, LocationStatus, error) Path(srcDeviceID, dstDeviceID string) [][2]*Port }
type LocationStatus ¶
type LocationStatus int
const ( // Unregistered MAC address. LocationUnregistered LocationStatus = iota // Registered MAC address, but we don't know its physical location yet. LocationUndiscovered // Registered MAC address, and we know its physical location. LocationDiscovered )
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (*Node) MAC ¶
func (r *Node) MAC() net.HardwareAddr
type Port ¶
type Port struct {
// contains filtered or unexported fields
}
Port represents a switch port and also implements the graph.Point interface.