ofp10

package
v0.0.0-...-c228989 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2018 License: GPL-3.0 Imports: 9 Imported by: 2

Documentation

Overview

OpenFlow Wire Protocol 0x01 Package ofp10 provides OpenFlow 1.0 structs along with Read and Write methods for each.

Struct documentation is taken from the OpenFlow Switch Specification Version 1.0.0. https://www.opennetworking.org/images/stories/downloads/sdn-resources/onf-specifications/openflow/openflow-spec-v1.0.0.pdf

Index

Constants

View Source
const (
	ActionType_Output = iota
	ActionType_SetVLAN_VID
	ActionType_SetVLAN_PCP
	ActionType_StripVLAN
	ActionType_SetDLSrc
	ActionType_SetDLDst
	ActionType_SetNWSrc
	ActionType_SetNWDst
	ActionType_SetNWTOS
	ActionType_SetTPSrc
	ActionType_SetTPDst
	ActionType_Enqueue
	ActionType_Vendor = 0xffff
)

ofp_action_type 1.0

View Source
const (
	C_FRAG_NORMAL = 0
	C_FRAG_DROP   = 1
	C_FRAG_REASM  = 2
	C_FRAG_MASK   = 3
)

ofp_config_flags 1.0

View Source
const (
	ET_HELLO_FAILED = iota
	ET_BAD_REQUEST
	ET_BAD_ACTION
	ET_FLOW_MOD_FAILED
	ET_PORT_MOD_FAILED
	ET_QUEUE_OP_FAILED
)

ofp_error_type 1.0

View Source
const (
	HFC_INCOMPATIBLE = iota
	HFC_EPERM
)

ofp_hello_failed_code 1.0

View Source
const (
	BRC_BAD_VERSION = iota
	BRC_BAD_TYPE
	BRC_BAD_STAT
	BRC_BAD_VENDOR

	BRC_BAD_SUBTYPE
	BRC_EPERM
	BRC_BAD_LEN
	BRC_BUFFER_EMPTY
	BRC_BUFFER_UNKNOWN
)

ofp_bad_request_code 1.0

View Source
const (
	BAC_BAD_TYPE = iota
	BAC_BAD_LEN
	BAC_BAD_VENDOR
	BAC_BAD_VENDOR_TYPE
	BAC_BAD_OUT_PORT
	BAC_BAD_ARGUMENT
	BAC_EPERM
	BAC_TOO_MANY
	BAC_BAD_QUEUE
)

ofp_bad_action_code 1.0

View Source
const (
	FMFC_ALL_TABLES_FULL = iota
	FMFC_OVERLAP
	FMFC_EPERM
	FMFC_BAD_EMERG_TIMEOUT
	FMFC_BAD_COMMAND
	FMFC_UNSUPPORTED
)

ofp_flow_mod_failed_code 1.0

View Source
const (
	PMFC_BAD_PORT = iota
	PMFC_BAD_HW_ADDR
)

ofp_port_mod_failed_code 1.0

View Source
const (
	QOFC_BAD_PORT = iota
	QOFC_BAD_QUEUE
	QOFC_EPERM
)

ofp_queue_op_failed_code 1.0

View Source
const (
	C_FLOW_STATS   = 1 << 0
	C_TABLE_STATS  = 1 << 1
	C_PORT_STATS   = 1 << 2
	C_STP          = 1 << 3
	C_RESERVED     = 1 << 4
	C_IP_REASM     = 1 << 5
	C_QUEUE_STATS  = 1 << 6
	C_ARP_MATCH_IP = 1 << 7
)

ofp_capabilities 1.0

View Source
const (
	FC_ADD = iota // OFPFC_ADD == 0
	FC_MODIFY
	FC_MODIFY_STRICT
	FC_DELETE
	FC_DELETE_STRICT
)

ofp_flow_mod_command 1.0

View Source
const (
	FF_SEND_FLOW_REM = 1 << 0
	FF_CHECK_OVERLAP = 1 << 1
	FF_EMERG         = 1 << 2
)

ofp_flow_mod_flags 1.0

View Source
const (
	RR_IDLE_TIMEOUT = iota
	RR_HARD_TIMEOUT
	RR_DELETE
)

ofp_flow_removed_reason 1.0

View Source
const (
	FW_IN_PORT  = 1 << 0
	FW_DL_VLAN  = 1 << 1
	FW_DL_SRC   = 1 << 2
	FW_DL_DST   = 1 << 3
	FW_DL_TYPE  = 1 << 4
	FW_NW_PROTO = 1 << 5
	FW_TP_SRC   = 1 << 6
	FW_TP_DST   = 1 << 7

	FW_NW_SRC_SHIFT = 8
	FW_NW_SRC_BITS  = 6
	FW_NW_SRC_MASK  = ((1 << FW_NW_SRC_BITS) - 1) << FW_NW_SRC_SHIFT
	FW_NW_SRC_ALL   = 32 << FW_NW_SRC_SHIFT

	FW_NW_DST_SHIFT = 14
	FW_NW_DST_BITS  = 6
	FW_NW_DST_MASK  = ((1 << FW_NW_DST_BITS) - 1) << FW_NW_DST_SHIFT
	FW_NW_DST_ALL   = 32 << FW_NW_DST_SHIFT

	FW_DL_VLAN_PCP = 1 << 20
	FW_NW_TOS      = 1 << 21

	FW_ALL = ((1 << 22) - 1)
)

ofp_flow_wildcards 1.0

View Source
const (
	/* Immutable messages. */
	Type_Hello = iota
	Type_Error
	Type_EchoRequest
	Type_EchoReply
	Type_Vendor

	/* Switch configuration messages. */
	Type_FeaturesRequest
	Type_FeaturesReply
	Type_GetConfigRequest
	Type_GetConfigReply
	Type_SetConfig

	/* Asynchronous messages. */
	Type_PacketIn
	Type_FlowRemoved
	Type_PortStatus

	/* Controller command messages. */
	Type_PacketOut
	Type_FlowMod
	Type_PortMod

	/* Statistics messages. */
	Type_StatsRequest
	Type_StatsReply

	/* Barrier messages. */
	Type_BarrierRequest
	Type_BarrierReply

	/* Queue Configuration messages. */
	Type_QueueGetConfigRequest
	Type_QueueGetConfigReply
)

ofp_type 1.0

View Source
const (
	R_NO_MATCH = iota
	R_ACTION
)

ofp_packet_in_reason 1.0

View Source
const (
	ETH_ALEN          = 6
	MAX_PORT_NAME_LEN = 16
)
View Source
const (
	PC_PORT_DOWN = 1 << 0

	PC_NO_STP  = 1 << 1
	PC_NO_RECV = 1 << 2

	PC_NO_STP_RECV  = 1 << 3
	PC_NO_FLOOD     = 1 << 4
	PC_NO_FWD       = 1 << 5
	PC_NO_PACKET_IN = 1 << 6
)

ofp_port_config 1.0

View Source
const (
	PS_LINK_DOWN = 1 << 0

	PS_STP_LISTEN  = 0 << 8 /* Not learning or relaying frames. */
	PS_STP_LEARN   = 1 << 8 /* Learning but not relaying frames. */
	PS_STP_FORWARD = 2 << 8 /* Learning and relaying frames. */
	PS_STP_BLOCK   = 3 << 8 /* Not part of spanning tree. */
	PS_STP_MASK    = 3 << 8 /* Bit mask for OFPPS_STP_* values. */
)

ofp_port_state 1.0

View Source
const (
	P_MAX = 0Xff00

	P_IN_PORT = 0xfff8
	P_TABLE   = 0xfff9

	P_NORMAL = 0xfffa
	P_FLOOD  = 0xfffb

	P_ALL        = 0xfffc
	P_CONTROLLER = 0xfffd
	P_LOCAL      = 0xfffe
	P_NONE       = 0xffff
)

ofp_port 1.0

View Source
const (
	PF_10MB_HD  = 1 << 0
	PF_10MB_FD  = 1 << 1
	PF_100MB_HD = 1 << 2
	PF_100MB_FD = 1 << 3
	PF_1GB_HD   = 1 << 4
	PF_1GB_FD   = 1 << 5
	PF_10GB_FD  = 1 << 6

	PF_COPPER     = 1 << 7
	PF_FIBER      = 1 << 8
	PF_AUTONEG    = 1 << 9
	PF_PAUSE      = 1 << 10
	PF_PAUSE_ASYM = 1 << 11
)

ofp_port_features 1.0

View Source
const (
	/* Description of this OpenFlow switch.
	* The request body is empty.
	* The reply body is struct ofp_desc_stats. */
	StatsType_Desc = iota
	/* Individual flow statistics.
	* The request body is struct ofp_flow_stats_request.
	* The reply body is an array of struct ofp_flow_stats. */
	StatsType_Flow
	/* Aggregate flow statistics.
	* The request body is struct ofp_aggregate_stats_request.
	* The reply body is struct ofp_aggregate_stats_reply. */
	StatsType_Aggregate
	/* Flow table statistics.
	* The request body is empty.
	* The reply body is an array of struct ofp_table_stats. */
	StatsType_Table
	/* Port statistics.
	* The request body is struct ofp_port_stats_request.
	* The reply body is an array of struct ofp_port_stats. */
	StatsType_Port
	/* Queue statistics for a port
	* The request body is struct _queue_stats_request.
	* The reply body is an array of struct ofp_queue_stats */
	StatsType_Queue
	/* Group counter statistics.
	* The request body is struct ofp_group_stats_request.
	* The reply is an array of struct ofp_group_stats. */
	StatsType_Vendor = 0xffff
)

_stats_types

View Source
const (
	DESC_STR_LEN   = 256
	SERIAL_NUM_LEN = 32
)
View Source
const (
	PR_ADD = iota
	PR_DELETE
	PR_MODIFY
)

ofp_port_reason 1.0

View Source
const (
	MAX_TABLE_NAME_LEN = 32
)
View Source
const (
	VERSION = 1
)

Variables

This section is empty.

Functions

func NewConfigRequest

func NewConfigRequest() *ofpxx.Header

func NewEchoReply

func NewEchoReply() *ofpxx.Header

Echo request/reply messages can be sent from either the switch or the controller, and must return an echo reply. They can be used to indicate the latency, bandwidth, and/or liveness of a controller-switch connection.

func NewEchoRequest

func NewEchoRequest() *ofpxx.Header

Echo request/reply messages can be sent from either the switch or the controller, and must return an echo reply. They can be used to indicate the latency, bandwidth, and/or liveness of a controller-switch connection.

func NewFeaturesRequest

func NewFeaturesRequest() *ofpxx.Header

FeaturesRequest constructor

func Parse

func Parse(b []byte) (message util.Message, err error)

Types

type Action

type Action interface {
	Header() *ActionHeader
	util.Message
}

func DecodeAction

func DecodeAction(data []byte) Action

TODO: Decode other Action types.

type ActionDLAddr

type ActionDLAddr struct {
	ActionHeader
	DLAddr net.HardwareAddr
	// contains filtered or unexported fields
}

The dl_addr field is the MAC address to set.

func NewActionDLDst

func NewActionDLDst(dlAddr net.HardwareAddr) *ActionDLAddr

Sets the destination MAC adddress to dlAddr

func NewActionDLSrc

func NewActionDLSrc(dlAddr net.HardwareAddr) *ActionDLAddr

Sets the source MAC adddress to dlAddr

func (*ActionDLAddr) Len

func (a *ActionDLAddr) Len() (n uint16)

func (*ActionDLAddr) MarshalBinary

func (a *ActionDLAddr) MarshalBinary() (data []byte, err error)

func (*ActionDLAddr) UnmarshalBinary

func (a *ActionDLAddr) UnmarshalBinary(data []byte) error

type ActionEnqueue

type ActionEnqueue struct {
	ActionHeader
	Port uint16

	QueueId uint32
	// contains filtered or unexported fields
}

The enqueue action maps a flow to an already-configured queue, regardless of the TOS and VLAN PCP bits. The packet should not change after an enqueue action. If the switch needs to set the TOS/PCP bits for internal handling, the original values should be restored before sending the packet out. A switch may support only queues that are tied to specific PCP/TOS bits. In that case, we cannot map an arbitrary flow to a specific queue, therefore the action ENQUEUE is not supported. The user can still use these queues and map flows to them by setting the relevant fields (TOS, VLAN PCP).

func NewActionEnqueue

func NewActionEnqueue(number uint16, queue uint32) *ActionEnqueue

func (*ActionEnqueue) Len

func (a *ActionEnqueue) Len() (n uint16)

func (*ActionEnqueue) MarshalBinary

func (a *ActionEnqueue) MarshalBinary() (data []byte, err error)

func (*ActionEnqueue) UnmarshalBinary

func (a *ActionEnqueue) UnmarshalBinary(data []byte) error

type ActionHeader

type ActionHeader struct {
	Type   uint16
	Length uint16
}

func (*ActionHeader) Header

func (a *ActionHeader) Header() *ActionHeader

func (*ActionHeader) Len

func (a *ActionHeader) Len() (n uint16)

func (*ActionHeader) MarshalBinary

func (a *ActionHeader) MarshalBinary() (data []byte, err error)

func (*ActionHeader) UnmarshalBinary

func (a *ActionHeader) UnmarshalBinary(data []byte) error

type ActionNWAddr

type ActionNWAddr struct {
	ActionHeader
	NWAddr net.IP
}

The nw_addr field is the IP address to set.

func NewActionNWDst

func NewActionNWDst(nwAddr net.IP) *ActionNWAddr

Sets the destination IP adddress to nwAddr

func NewActionNWSrc

func NewActionNWSrc(nwAddr net.IP) *ActionNWAddr

Sets the source IP adddress to nwAddr

func (*ActionNWAddr) Len

func (a *ActionNWAddr) Len() (n uint16)

func (*ActionNWAddr) MarshalBinary

func (a *ActionNWAddr) MarshalBinary() (data []byte, err error)

func (*ActionNWAddr) UnmarshalBinary

func (a *ActionNWAddr) UnmarshalBinary(data []byte) error

type ActionNWTOS

type ActionNWTOS struct {
	ActionHeader
	NWTOS uint8
	// contains filtered or unexported fields
}

The nw_tos field is the 6 upper bits of the ToS field to set, in the original bit positions (shifted to the left by 2).

func NewActionNWTOS

func NewActionNWTOS(tos uint8) *ActionNWTOS

Set ToS field in IP packets.

func (*ActionNWTOS) Len

func (a *ActionNWTOS) Len() (n uint16)

func (*ActionNWTOS) MarshalBinary

func (a *ActionNWTOS) MarshalBinary() (data []byte, err error)

func (*ActionNWTOS) UnmarshalBinary

func (a *ActionNWTOS) UnmarshalBinary(data []byte) error

type ActionOutput

type ActionOutput struct {
	ActionHeader
	Port   uint16
	MaxLen uint16
}

Action structure for OFPAT_OUTPUT, which sends packets out ’port’. When the ’port’ is the OFPP_CONTROLLER, ’max_len’ indicates the max number of bytes to send. A ’max_len’ of zero means no bytes of the packet should be sent.

func NewActionOutput

func NewActionOutput(number uint16) *ActionOutput

Returns a new Action Output message which sends packets out port number.

func (*ActionOutput) Len

func (a *ActionOutput) Len() (n uint16)

func (*ActionOutput) MarshalBinary

func (a *ActionOutput) MarshalBinary() (data []byte, err error)

func (*ActionOutput) UnmarshalBinary

func (a *ActionOutput) UnmarshalBinary(data []byte) error

type ActionStripVLAN

type ActionStripVLAN struct {
	ActionHeader
	// contains filtered or unexported fields
}

An action_strip_vlan takes no arguments and consists only of a generic ofp_action_header. This action strips the VLAN tag if one is present.

func NewActionStripVLAN

func NewActionStripVLAN() *ActionStripVLAN

Action to strip VLAN IDs from tagged packets.

func (*ActionStripVLAN) Len

func (a *ActionStripVLAN) Len() (n uint16)

func (*ActionStripVLAN) MarshalBinary

func (a *ActionStripVLAN) MarshalBinary() (data []byte, err error)

func (*ActionStripVLAN) UnmarshalBinary

func (a *ActionStripVLAN) UnmarshalBinary(data []byte) error

type ActionTPPort

type ActionTPPort struct {
	ActionHeader
	TPPort uint16
	// contains filtered or unexported fields
}

The tp_port field is the TCP/UDP/other port to set.

func NewActionTPDst

func NewActionTPDst(port uint16) *ActionTPPort

Returns an action that sets the transport layer destination port.

func NewActionTPSrc

func NewActionTPSrc(port uint16) *ActionTPPort

Returns an action that sets the transport layer source port.

func (*ActionTPPort) Len

func (a *ActionTPPort) Len() (n uint16)

func (*ActionTPPort) MarshalBinary

func (a *ActionTPPort) MarshalBinary() (data []byte, err error)

func (*ActionTPPort) UnmarshalBinary

func (a *ActionTPPort) UnmarshalBinary(data []byte) error

type ActionVLANPCP

type ActionVLANPCP struct {
	ActionHeader
	VLANPCP uint8
	// contains filtered or unexported fields
}

The vlan_pcp field is 8 bits long, but only the lower 3 bits have meaning.

func NewActionVLANPCP

func NewActionVLANPCP(pcp uint8) *ActionVLANPCP

Modifies PCP on VLAN tagged packets.

func (*ActionVLANPCP) Len

func (a *ActionVLANPCP) Len() (n uint16)

func (*ActionVLANPCP) MarshalBinary

func (a *ActionVLANPCP) MarshalBinary() (data []byte, err error)

func (*ActionVLANPCP) UnmarshalBinary

func (a *ActionVLANPCP) UnmarshalBinary(data []byte) error

type ActionVLANVID

type ActionVLANVID struct {
	ActionHeader
	VLANVID uint16
	// contains filtered or unexported fields
}

The vlan_vid field is 16 bits long, when an actual VLAN id is only 12 bits. The value 0xffff is used to indicate that no VLAN id was set.

func NewActionVLANVID

func NewActionVLANVID(vid uint16) *ActionVLANVID

Sets a VLAN ID on tagged packets. VLAN ID may be added to untagged packets on some switches.

func (*ActionVLANVID) Len

func (a *ActionVLANVID) Len() (n uint16)

func (*ActionVLANVID) MarshalBinary

func (a *ActionVLANVID) MarshalBinary() (data []byte, err error)

func (*ActionVLANVID) UnmarshalBinary

func (a *ActionVLANVID) UnmarshalBinary(data []byte) error

type ActionVendor

type ActionVendor struct {
	ActionHeader
	Vendor uint32
}

The Vendor field is the Vendor ID, which takes the same form as in struct ofp_vendor.

func NewActionVendor

func NewActionVendor(vendor uint32) *ActionVendor

func (*ActionVendor) Len

func (a *ActionVendor) Len() (n uint16)

func (*ActionVendor) MarshalBinary

func (a *ActionVendor) MarshalBinary() (data []byte, err error)

func (*ActionVendor) UnmarshalBinary

func (a *ActionVendor) UnmarshalBinary(data []byte) error

type AggregateStats

type AggregateStats struct {
	PacketCount uint64
	ByteCount   uint64
	FlowCount   uint32
	// contains filtered or unexported fields
}

ofp_aggregate_stats_reply 1.0

func NewAggregateStats

func NewAggregateStats() *AggregateStats

func (*AggregateStats) Len

func (s *AggregateStats) Len() (n uint16)

func (*AggregateStats) MarshalBinary

func (s *AggregateStats) MarshalBinary() (data []byte, err error)

func (*AggregateStats) UnmarshalBinary

func (s *AggregateStats) UnmarshalBinary(data []byte) error

type AggregateStatsRequest

type AggregateStatsRequest struct {
	Match
	TableId uint8

	OutPort uint16
	// contains filtered or unexported fields
}

ofp_aggregate_stats_request 1.0

func NewAggregateStatsRequest

func NewAggregateStatsRequest() *AggregateStatsRequest

func (*AggregateStatsRequest) Len

func (s *AggregateStatsRequest) Len() (n uint16)

func (*AggregateStatsRequest) MarshalBinary

func (s *AggregateStatsRequest) MarshalBinary() (data []byte, err error)

func (*AggregateStatsRequest) UnmarshalBinary

func (s *AggregateStatsRequest) UnmarshalBinary(data []byte) error

type BarrierReplyReactor

type BarrierReplyReactor interface {
	BarrierReply(dpid net.HardwareAddr, msg *ofpxx.Header)
}

type BarrierRequestReactor

type BarrierRequestReactor interface {
	BarrierRequest(req *ofpxx.Header)
}

type ConnectionDownReactor

type ConnectionDownReactor interface {
	ConnectionDown(dpid net.HardwareAddr, err error)
}

type ConnectionUpReactor

type ConnectionUpReactor interface {
	ConnectionUp(dpid net.HardwareAddr)
}

type DescStats

type DescStats struct {
	MfrDesc   []byte // Size DESC_STR_LEN
	HWDesc    []byte // Size DESC_STR_LEN
	SWDesc    []byte // Size DESC_STR_LEN
	SerialNum []byte // Size SERIAL_NUM_LEN
	DPDesc    []byte // Size DESC_STR_LEN
}

ofp_desc_stats 1.0

func NewDescStats

func NewDescStats() *DescStats

func (*DescStats) Len

func (s *DescStats) Len() (n uint16)

func (*DescStats) MarshalBinary

func (s *DescStats) MarshalBinary() (data []byte, err error)

func (*DescStats) UnmarshalBinary

func (s *DescStats) UnmarshalBinary(data []byte) error

type EchoReplyReactor

type EchoReplyReactor interface {
	EchoReply(dpid net.HardwareAddr)
}

type EchoRequestReactor

type EchoRequestReactor interface {
	EchoRequest(dpid net.HardwareAddr)
}

type ErrorMsg

type ErrorMsg struct {
	ofpxx.Header
	Code uint16
	Data util.Buffer
}

BEGIN: ofp10 - 5.4.4 ofp_error_msg 1.0

func NewErrorMsg

func NewErrorMsg() *ErrorMsg

func (*ErrorMsg) Len

func (e *ErrorMsg) Len() (n uint16)

func (*ErrorMsg) MarshalBinary

func (e *ErrorMsg) MarshalBinary() (data []byte, err error)

func (*ErrorMsg) UnmarshalBinary

func (e *ErrorMsg) UnmarshalBinary(data []byte) error

type ErrorReactor

type ErrorReactor interface {
	Error(dpid net.HardwareAddr, err *ErrorMsg)
}

type FeaturesReplyReactor

type FeaturesReplyReactor interface {
	FeaturesReply(dpid net.HardwareAddr, features *SwitchFeatures)
}

type FeaturesRequestReactor

type FeaturesRequestReactor interface {
	FeaturesRequest(features *ofpxx.Header)
}

type FlowMod

type FlowMod struct {
	ofpxx.Header
	Match  Match
	Cookie uint64

	Command     uint16
	IdleTimeout uint16
	HardTimeout uint16
	Priority    uint16
	BufferId    uint32
	OutPort     uint16
	Flags       uint16
	Actions     []Action
}

ofp_flow_mod

func NewFlowMod

func NewFlowMod() *FlowMod

func (*FlowMod) AddAction

func (f *FlowMod) AddAction(a Action)

func (*FlowMod) Len

func (f *FlowMod) Len() (n uint16)

func (*FlowMod) MarshalBinary

func (f *FlowMod) MarshalBinary() (data []byte, err error)

func (*FlowMod) UnmarshalBinary

func (f *FlowMod) UnmarshalBinary(data []byte) error

func (*FlowMod) UnmarshalJSON

func (f *FlowMod) UnmarshalJSON(b []byte) error

type FlowModReactor

type FlowModReactor interface {
	FlowMod(flowMod *FlowMod)
}

type FlowRemoved

type FlowRemoved struct {
	ofpxx.Header
	Match    Match
	Cookie   uint64
	Priority uint16
	Reason   uint8

	DurationSec  uint32
	DurationNSec uint32

	IdleTimeout uint16

	PacketCount uint64
	ByteCount   uint64
	// contains filtered or unexported fields
}

BEGIN: ofp10 - 5.4.2

func NewFlowRemoved

func NewFlowRemoved() *FlowRemoved

func (*FlowRemoved) Len

func (f *FlowRemoved) Len() (n uint16)

func (*FlowRemoved) MarshalBinary

func (f *FlowRemoved) MarshalBinary() (data []byte, err error)

func (*FlowRemoved) UnmarshalBinary

func (f *FlowRemoved) UnmarshalBinary(data []byte) error

type FlowRemovedReactor

type FlowRemovedReactor interface {
	FlowRemoved(dpid net.HardwareAddr, flow *FlowRemoved)
}

type FlowStats

type FlowStats struct {
	Length  uint16
	TableId uint8

	Match
	DurationSec  uint32
	DurationNSec uint32
	Priority     uint16
	IdleTimeout  uint16
	HardTimeout  uint16

	Cookie      uint64
	PacketCount uint64
	ByteCount   uint64
	Actions     []Action
	// contains filtered or unexported fields
}

ofp_flow_stats 1.0

func NewFlowStats

func NewFlowStats() *FlowStats

func (*FlowStats) Len

func (s *FlowStats) Len() (n uint16)

func (*FlowStats) MarshalBinary

func (s *FlowStats) MarshalBinary() (data []byte, err error)

func (*FlowStats) UnmarshalBinary

func (s *FlowStats) UnmarshalBinary(data []byte) error

type FlowStatsRequest

type FlowStatsRequest struct {
	Match
	TableId uint8

	OutPort uint16
	// contains filtered or unexported fields
}

ofp_flow_stats_request 1.0

func NewFlowStatsRequest

func NewFlowStatsRequest() *FlowStatsRequest

func (*FlowStatsRequest) Len

func (s *FlowStatsRequest) Len() (n uint16)

func (*FlowStatsRequest) MarshalBinary

func (s *FlowStatsRequest) MarshalBinary() (data []byte, err error)

func (*FlowStatsRequest) UnmarshalBinary

func (s *FlowStatsRequest) UnmarshalBinary(data []byte) error

type GetConfigReplyReactor

type GetConfigReplyReactor interface {
	GetConfigReply(dpid net.HardwareAddr, config *SwitchConfig)
}

type GetConfigRequestReactor

type GetConfigRequestReactor interface {
	GetConfigRequest(config *ofpxx.Header)
}

type HelloReactor

type HelloReactor interface {
	Hello(hello *ofpxx.Header)
}

type Match

type Match struct {
	Wildcards uint32           /* Wildcard fields. */
	InPort    uint16           /* Input switch port. */
	DLSrc     net.HardwareAddr `json:"-"`   //[ETH_ALEN]uint8 /* Ethernet source address. */
	DLDst     net.HardwareAddr `json:"-"  ` //[ETH_ALEN]uint8 /* Ethernet destination address. */
	DLVLAN    uint16           /* Input VLAN id. */
	DLVLANPcp uint8            /* Input VLAN priority. */

	DLType  uint16 /* Ethernet frame type. */
	NWTos   uint8  /* IP ToS (actually DSCP field, 6 bits). */
	NWProto uint8  /* IP protocol or lower 8 bits of ARP opcode. */

	NWSrc net.IP `json:"-"` /* IP source address. */
	NWDst net.IP `json:"-"` /* IP destination address. */
	TPSrc uint16 /* TCP/UDP source port. */
	TPDst uint16 /* TCP/UDP destination port. */
	// contains filtered or unexported fields
}

ofp_match 1.0

func NewMatch

func NewMatch() *Match

func (*Match) Len

func (m *Match) Len() (n uint16)

func (*Match) MarshalBinary

func (m *Match) MarshalBinary() (data []byte, err error)

func (*Match) UnmarshalBinary

func (m *Match) UnmarshalBinary(data []byte) error

func (*Match) UnmarshalJSON

func (m *Match) UnmarshalJSON(b []byte) error

type PacketIn

type PacketIn struct {
	ofpxx.Header
	BufferId uint32
	TotalLen uint16
	InPort   uint16
	Reason   uint8
	Data     eth.Ethernet
}

ofp_packet_in 1.0

func NewPacketIn

func NewPacketIn() *PacketIn

func (*PacketIn) Len

func (p *PacketIn) Len() (n uint16)

func (*PacketIn) MarshalBinary

func (p *PacketIn) MarshalBinary() (data []byte, err error)

func (*PacketIn) UnmarshalBinary

func (p *PacketIn) UnmarshalBinary(data []byte) error

type PacketInReactor

type PacketInReactor interface {
	PacketIn(dpid net.HardwareAddr, packet *PacketIn)
}

type PacketOut

type PacketOut struct {
	ofpxx.Header
	BufferId   uint32
	InPort     uint16
	ActionsLen uint16
	Actions    []Action
	Data       util.Message
}

When the controller wishes to send a packet out through the datapath, it uses the OFPT_PACKET_OUT message: The buffer_id is the same given in the ofp_packet_in message. If the buffer_id is -1, then the packet data is included in the data array. If OFPP_TABLE is specified as the output port of an action, the in_port in the packet_out message is used in the flow table lookup.

func NewPacketOut

func NewPacketOut() *PacketOut

func (*PacketOut) AddAction

func (p *PacketOut) AddAction(act Action)

func (*PacketOut) Len

func (p *PacketOut) Len() (n uint16)

func (*PacketOut) MarshalBinary

func (p *PacketOut) MarshalBinary() (data []byte, err error)

func (*PacketOut) UnmarshalBinary

func (p *PacketOut) UnmarshalBinary(data []byte) error

type PacketOutReactor

type PacketOutReactor interface {
	PacketOut(packet *PacketOut)
}

type PhyPort

type PhyPort struct {
	PortNo uint16
	HWAddr net.HardwareAddr
	Name   []byte // Size 16

	Config uint32
	State  uint32

	Curr       uint32
	Advertised uint32
	Supported  uint32
	Peer       uint32
}

ofp_phy_port 1.0

func NewPhyPort

func NewPhyPort() *PhyPort

func (*PhyPort) Len

func (p *PhyPort) Len() (n uint16)

func (*PhyPort) MarshalBinary

func (p *PhyPort) MarshalBinary() (data []byte, err error)

func (*PhyPort) MarshalJSON

func (p *PhyPort) MarshalJSON() ([]byte, error)

func (*PhyPort) UnmarshalBinary

func (p *PhyPort) UnmarshalBinary(data []byte) error

type PortMod

type PortMod struct {
	ofpxx.Header
	PortNo uint16
	HWAddr []uint8

	Config    uint32
	Mask      uint32
	Advertise uint32
	// contains filtered or unexported fields
}

ofp_port_mod 1.0

func NewPortMod

func NewPortMod(port int) *PortMod

func (*PortMod) Len

func (p *PortMod) Len() (n uint16)

func (*PortMod) MarshalBinary

func (p *PortMod) MarshalBinary() (data []byte, err error)

func (*PortMod) UnmarshalBinary

func (p *PortMod) UnmarshalBinary(data []byte) error

type PortModReactor

type PortModReactor interface {
	PortMod(portMod *PortMod)
}

type PortStats

type PortStats struct {
	PortNo uint16

	RxPackets  uint64
	TxPackets  uint64
	RxBytes    uint64
	TxBytes    uint64
	RxDropped  uint64
	TxDropped  uint64
	RxErrors   uint64
	TxErrors   uint64
	RxFrameErr uint64
	RxOverErr  uint64
	RxCRCErr   uint64
	Collisions uint64
	// contains filtered or unexported fields
}

ofp_port_stats 1.0

func NewPortStats

func NewPortStats() *PortStats

func (*PortStats) Len

func (s *PortStats) Len() (n uint16)

func (*PortStats) MarshalBinary

func (s *PortStats) MarshalBinary() (data []byte, err error)

func (*PortStats) UnmarshalBinary

func (s *PortStats) UnmarshalBinary(data []byte) error

type PortStatsRequest

type PortStatsRequest struct {
	PortNo uint16
	// contains filtered or unexported fields
}

ofp_port_stats_request 1.0

func NewPortStatsRequest

func NewPortStatsRequest() *PortStatsRequest

func (*PortStatsRequest) Len

func (s *PortStatsRequest) Len() (n uint16)

func (*PortStatsRequest) MarshalBinary

func (s *PortStatsRequest) MarshalBinary() (data []byte, err error)

func (*PortStatsRequest) UnmarshalBinary

func (s *PortStatsRequest) UnmarshalBinary(data []byte) error

type PortStatus

type PortStatus struct {
	ofpxx.Header
	Reason uint8

	Desc PhyPort
	// contains filtered or unexported fields
}

ofp_port_status

func NewPortStatus

func NewPortStatus() *PortStatus

func (*PortStatus) Len

func (p *PortStatus) Len() (n uint16)

func (*PortStatus) MarshalBinary

func (s *PortStatus) MarshalBinary() (data []byte, err error)

func (*PortStatus) UnmarshalBinary

func (s *PortStatus) UnmarshalBinary(data []byte) error

type PortStatusReactor

type PortStatusReactor interface {
	PortStatus(dpid net.HardwareAddr, status *PortStatus)
}

type QueueStats

type QueueStats struct {
	PortNo uint16

	QueueId   uint32
	TxBytes   uint64
	TxPackets uint64
	TxErrors  uint64
	// contains filtered or unexported fields
}

ofp_queue_stats 1.0

func (*QueueStats) Len

func (s *QueueStats) Len() (n uint16)

func (*QueueStats) MarshalBinary

func (s *QueueStats) MarshalBinary() (data []byte, err error)

func (*QueueStats) UnmarshalBinary

func (s *QueueStats) UnmarshalBinary(data []byte) error

type QueueStatsRequest

type QueueStatsRequest struct {
	PortNo uint16

	QueueId uint32
	// contains filtered or unexported fields
}

ofp_queue_stats_request 1.0

func NewQueueStatsRequest

func NewQueueStatsRequest() *QueueStatsRequest

func (*QueueStatsRequest) Len

func (s *QueueStatsRequest) Len() (n uint16)

func (*QueueStatsRequest) MarshalBinary

func (s *QueueStatsRequest) MarshalBinary() (data []byte, err error)

func (*QueueStatsRequest) UnmarshalBinary

func (s *QueueStatsRequest) UnmarshalBinary(data []byte) error

type SetConfigReactor

type SetConfigReactor interface {
	SetConfig(config *SwitchConfig)
}

type StatsReply

type StatsReply struct {
	ofpxx.Header
	Type  uint16
	Flags uint16
	Body  util.Message
}

_stats_reply 1.0

func (*StatsReply) Len

func (s *StatsReply) Len() (n uint16)

func (*StatsReply) MarshalBinary

func (s *StatsReply) MarshalBinary() (data []byte, err error)

func (*StatsReply) UnmarshalBinary

func (s *StatsReply) UnmarshalBinary(data []byte) error

type StatsReplyReactor

type StatsReplyReactor interface {
	StatsReply(dpid net.HardwareAddr, rep *StatsReply)
}

type StatsRequest

type StatsRequest struct {
	ofpxx.Header
	Type  uint16
	Flags uint16
	Body  util.Message
}

ofp_stats_request 1.0

func (*StatsRequest) Len

func (s *StatsRequest) Len() (n uint16)

func (*StatsRequest) MarshalBinary

func (s *StatsRequest) MarshalBinary() (data []byte, err error)

func (*StatsRequest) UnmarshalBinary

func (s *StatsRequest) UnmarshalBinary(data []byte) error

type StatsRequestReactor

type StatsRequestReactor interface {
	StatsRequest(req *StatsRequest)
}

type SwitchConfig

type SwitchConfig struct {
	ofpxx.Header
	Flags       uint16 // OFPC_* flags
	MissSendLen uint16
}

ofp_switch_config 1.0

func NewSetConfig

func NewSetConfig() *SwitchConfig

func (*SwitchConfig) Len

func (c *SwitchConfig) Len() (n uint16)

func (*SwitchConfig) MarshalBinary

func (c *SwitchConfig) MarshalBinary() (data []byte, err error)

func (*SwitchConfig) UnmarshalBinary

func (c *SwitchConfig) UnmarshalBinary(data []byte) error

type SwitchFeatures

type SwitchFeatures struct {
	ofpxx.Header
	DPID    net.HardwareAddr // Size 8
	Buffers uint32
	Tables  uint8

	Capabilities uint32
	Actions      uint32

	Ports []PhyPort
	// contains filtered or unexported fields
}

func NewFeaturesReply

func NewFeaturesReply() *SwitchFeatures

FeaturesReply constructor

func (*SwitchFeatures) Len

func (s *SwitchFeatures) Len() (n uint16)

func (*SwitchFeatures) MarshalBinary

func (s *SwitchFeatures) MarshalBinary() (data []byte, err error)

func (*SwitchFeatures) UnmarshalBinary

func (s *SwitchFeatures) UnmarshalBinary(data []byte) error

type TableStats

type TableStats struct {
	TableId uint8

	Name         []byte // Size MAX_TABLE_NAME_LEN
	Wildcards    uint32
	MaxEntries   uint32
	ActiveCount  uint32
	LookupCount  uint64
	MatchedCount uint64
	// contains filtered or unexported fields
}

ofp_table_stats 1.0

func NewTableStats

func NewTableStats() *TableStats

func (*TableStats) Len

func (s *TableStats) Len() (n uint16)

func (*TableStats) MarshalBinary

func (s *TableStats) MarshalBinary() (data []byte, err error)

func (*TableStats) UnmarshalBinary

func (s *TableStats) UnmarshalBinary(data []byte) error

type VendorHeader

type VendorHeader struct {
	Header ofpxx.Header /*Type OFPT_VENDOR*/
	Vendor uint32
}

ofp_vendor_header 1.0

func (*VendorHeader) Len

func (v *VendorHeader) Len() (n uint16)

func (*VendorHeader) MarshalBinary

func (v *VendorHeader) MarshalBinary() (data []byte, err error)

func (*VendorHeader) UnmarshalBinary

func (v *VendorHeader) UnmarshalBinary(data []byte) error

type VendorReactor

type VendorReactor interface {
	VendorHeader(dpid net.HardwareAddr, v *VendorHeader)
}

Jump to

Keyboard shortcuts

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