nettle-openflow-0.2.0: OpenFlow protocol messages, binary formats, and servers.




Sending packets

data PacketOut Source

A switch can be remotely commanded to send a packet. The packet can either be a packet buffered at the switch, in which case the bufferID is provided, or it can be specified explicitly by giving the packet data.




bufferIDData :: !(Either BufferID ByteString)

either a buffer ID or the data itself

packetInPort :: !(Maybe PortID)

the port at which the packet received, for the purposes of processing this command

packetActions :: !ActionSequence

actions to apply to the packet

bufferedPacketOut :: BufferID -> Maybe PortID -> ActionSequence -> PacketOutSource

Constructs a PacketOut value for a packet buffered at a switch.

unbufferedPacketOut :: ByteString -> Maybe PortID -> ActionSequence -> PacketOutSource

Constructs a PacketOut value for an unbuffered packet, including the packet data.

receivedPacketOut :: PacketInfo -> ActionSequence -> PacketOutSource

Constructs a PacketOut value that processes the packet referred to by the PacketInfo value according to the specified actions.

type BufferID = Word32Source

A switch may buffer a packet that it receives. When it does so, the packet is assigned a bufferID which can be used to refer to that packet.

Packets not handled by a switch

data PacketInfo Source

A switch receives packets on its ports. If the packet matches some flow rules, the highest priority rule is executed. If no flow rule matches, the packet is sent to the controller. When packet is sent to the controller, the switch sends a message containing the following information.




bufferID :: !(Maybe BufferID)

buffer ID if packet buffered

packetLength :: !NumBytes

full length of frame

receivedOnPort :: !PortID

port on which frame was received

reasonSent :: !PacketInReason

reason packet is being sent

packetData :: !ByteString

ethernet frame, includes full packet only if no buffer ID

enclosedFrame :: !(Either String EthernetFrame)

result of parsing packetData field.

data PacketInReason Source

A PacketInfo message includes the reason that the message was sent, namely either there was no match, or there was a match, and that match's actions included a Sent-To-Controller action.



type NumBytes = IntSource

The number of bytes in a packet.