module Nettle.OpenFlow.FlowTable (
FlowTableID
, FlowMod (..)
, Cookie
, Priority
, TimeOut (..)
, FlowRemoved (..)
, FlowRemovalReason (..)
) where
import Nettle.OpenFlow.Switch
import Nettle.OpenFlow.Action
import Nettle.OpenFlow.Match
import Nettle.OpenFlow.Packet
import Data.Word
import Data.List as List
type FlowTableID = Word8
data FlowMod = AddFlow { match :: Match
, priority :: Priority
, actions :: ActionSequence
, cookie :: Cookie
, idleTimeOut :: TimeOut
, hardTimeOut :: TimeOut
, notifyWhenRemoved :: Bool
, applyToPacket :: Maybe BufferID
, overlapAllowed :: Bool
}
| AddEmergencyFlow { match :: Match
, priority :: Priority
, actions :: ActionSequence
, cookie :: Cookie
, overlapAllowed :: Bool
}
| ModifyFlows { match :: Match
, newActions :: ActionSequence
, ifMissingPriority :: Priority
, ifMissingCookie :: Cookie
, ifMissingIdleTimeOut :: TimeOut
, ifMissingHardTimeOut :: TimeOut
, ifMissingNotifyWhenRemoved :: Bool
, ifMissingOverlapAllowed :: Bool
}
| ModifyExactFlow { match :: Match
, priority :: Priority
, newActions :: ActionSequence
, ifMissingCookie :: Cookie
, ifMissingIdleTimeOut :: TimeOut
, ifMissingHardTimeOut :: TimeOut
, ifMissingNotifyWhenRemoved :: Bool
, ifMissingOverlapAllowed :: Bool
}
| DeleteFlows { match :: Match,
outPort :: Maybe PseudoPort
}
| DeleteExactFlow { match :: Match,
outPort :: Maybe PseudoPort,
priority :: Priority
}
deriving (Show, Eq)
type Cookie = Word64
type Priority = Word16
data TimeOut = Permanent
| ExpireAfter Word16
deriving (Show,Eq)
data FlowRemoved = FlowRemovedRecord { flowRemovedMatch :: Match,
flowRemovedCookie :: Word64,
flowRemovedPriority :: Priority,
flowRemovedReason :: FlowRemovalReason,
flowRemovedDuration :: Integer,
flowRemovedDurationNSecs :: Integer,
flowRemovedIdleTimeout :: Integer,
flowRemovedPacketCount :: Integer,
flowRemovedByteCount :: Integer }
deriving (Show,Eq)
data FlowRemovalReason = IdleTimerExpired
| HardTimerExpired
| DeletedByController
deriving (Show,Eq,Ord,Enum)