Nettle.FRPControl.SwitchInterface
Description
This module defines type classes for input types carrying switch messages and output types carrying switch commands. It defines a few basic instances of these classes. In addition it defines some signal functions that implement the most basic functionality to maintain switch-controller connections.
- type SwitchMessage = TCPMessage (TransactionID, SCMessage)
- data SockAddr
- switchJoinE :: Event SwitchMessage -> Event SockAddr
- switchLeaveE :: Event SwitchMessage -> Event (SockAddr, IOException)
- switchHelloE :: Event SwitchMessage -> Event (SockAddr, TransactionID)
- switchEchoRequestE :: Event SwitchMessage -> Event (SockAddr, TransactionID, [Word8])
- switchEchoReplyE :: Event SwitchMessage -> Event (SockAddr, TransactionID, [Word8])
- packetInE :: Event SwitchMessage -> Event (SockAddr, TransactionID, PacketInfo)
- switchFeaturesE :: Event SwitchMessage -> Event (SockAddr, TransactionID, SwitchFeatures)
- portUpdateE :: Event SwitchMessage -> Event (SockAddr, TransactionID, PortStatus)
- switchErrorE :: Event SwitchMessage -> Event (SockAddr, TransactionID, SwitchError)
- flowRemovalE :: Event SwitchMessage -> Event (SockAddr, TransactionID, FlowRemoved)
- statsReplyE :: Event SwitchMessage -> Event (SockAddr, TransactionID, StatsReply)
- portStatsReplyE :: Event SwitchMessage -> Event (SockAddr, TransactionID, MoreToFollowFlag, [(PortID, PortStats)])
- flowStatsReplyE :: Event SwitchMessage -> Event (SockAddr, TransactionID, MoreToFollowFlag, [FlowStats])
- barrierReplyE :: Event SwitchMessage -> Event (SockAddr, TransactionID)
- filterPacketIns :: (PacketInfo -> Bool) -> Event SwitchMessage -> Event SwitchMessage
- type SwitchOutput = [(SockAddr, (TransactionID, CSMessage))]
- switchCommand :: SockAddr -> TransactionID -> CSMessage -> SwitchOutput
- noOp :: Monoid o => o
- (<+>) :: Monoid o => o -> o -> o
- switchInterfaceDriver :: ServerPortNumber -> IO (IO SwitchMessage, SwitchOutput -> IO ())
- openFlowController :: SF (Event SwitchMessage) (Event SwitchOutput)
Switch input
type SwitchMessage = TCPMessage (TransactionID, SCMessage)Source
A switch message is a TCP message where normal messages
contain a TransactionID
and an SCMessage
switchJoinE :: Event SwitchMessage -> Event SockAddrSource
Projects out the SockAddr
associated with the switch from a ConnectionEstablished
TCPMessage
.
switchLeaveE :: Event SwitchMessage -> Event (SockAddr, IOException)Source
Outputs an event whenever the switch disconnects from the controller.
The event carries the SockAddr
used to communicate with the switch and
an IOException
value indicating the reason for the disconnection.
switchHelloE :: Event SwitchMessage -> Event (SockAddr, TransactionID)Source
Outputs an event whenever a switch sends a hello message.
switchEchoRequestE :: Event SwitchMessage -> Event (SockAddr, TransactionID, [Word8])Source
Outputs an event whenever a switch sends an echo request; carries
the SockAddr
of the switch, the TransactionID
of the echo request,
and the data included in the echo request.
switchEchoReplyE :: Event SwitchMessage -> Event (SockAddr, TransactionID, [Word8])Source
Outputs an event whenever a switch sends an echo reply; carries
the SockAddr
of the switch, the TransactionID
of the echo reply,
and the data included in the echo reply.
packetInE :: Event SwitchMessage -> Event (SockAddr, TransactionID, PacketInfo)Source
Outputs an event whenever a switch sends a packet in message.
The event carries the SockAddr
of the switch, the TransactionID
of the
message, and the PacketInfo
message itself.
switchFeaturesE :: Event SwitchMessage -> Event (SockAddr, TransactionID, SwitchFeatures)Source
Outputs an event whenever a switch sends a switch features message.
The event carries the SockAddr
of the switch, the TransactionID
of the
message, and the SwitchFeatures
message itself.
portUpdateE :: Event SwitchMessage -> Event (SockAddr, TransactionID, PortStatus)Source
Outputs an event whenever a switch sends a port update message.
The event carries the SockAddr
of the switch, the TransactionID
of the
message, and the PortStatus
message itself.
switchErrorE :: Event SwitchMessage -> Event (SockAddr, TransactionID, SwitchError)Source
Outputs an event whenever a switch sends an error message.
The event carries the SockAddr
of the switch, the TransactionID
of the
message, and the SwitchError
message itself.
flowRemovalE :: Event SwitchMessage -> Event (SockAddr, TransactionID, FlowRemoved)Source
Outputs an event whenever a switch sends an flow removed message.
The event carries the SockAddr
of the switch, the TransactionID
of the
message, and the FlowRemoved
message itself.
statsReplyE :: Event SwitchMessage -> Event (SockAddr, TransactionID, StatsReply)Source
Outputs an event whenever a switch sends statistics reply.
The event carries the SockAddr
of the switch, the TransactionID
of the
message, and the StatsReply
message itself.
portStatsReplyE :: Event SwitchMessage -> Event (SockAddr, TransactionID, MoreToFollowFlag, [(PortID, PortStats)])Source
Outputs an event whenever a switch sends port statistics reply.
The event carries the SockAddr
of the switch, the TransactionID
of the
message, a flag indicating whether more statistics for this reply will follow
in a separate message and the port statistics included in this message itself.
flowStatsReplyE :: Event SwitchMessage -> Event (SockAddr, TransactionID, MoreToFollowFlag, [FlowStats])Source
Outputs an event whenever a switch sends flow statistics reply.
The event carries the SockAddr
of the switch, the TransactionID
of the
message, a flag indicating whether more statistics for this reply will follow
in a separate message and the flow statistics included in this message itself.
barrierReplyE :: Event SwitchMessage -> Event (SockAddr, TransactionID)Source
Outputs an event whenever a switch sends a barrier reply.
The event carries the SockAddr
of the switch and the TransactionID
of the
message.
filterPacketIns :: (PacketInfo -> Bool) -> Event SwitchMessage -> Event SwitchMessageSource
Remove packet in messages not satisfying the given predicate.
Switch output
type SwitchOutput = [(SockAddr, (TransactionID, CSMessage))]Source
switchCommand :: SockAddr -> TransactionID -> CSMessage -> SwitchOutputSource
Another name for the unit element of a Monoid, specialized to the HasSwitchCommands class.
Driver
switchInterfaceDriver :: ServerPortNumber -> IO (IO SwitchMessage, SwitchOutput -> IO ())Source
Runs an OpenFlow server at the specified port number, and return the driver IO actions.
Basic OpenFlow controller
openFlowController :: SF (Event SwitchMessage) (Event SwitchOutput)Source
openFlowController
implements the basic aspects of the OpenFlow
protocol, such as the initial version negotiation and responding to
echo requests.