module Hans.Network.Types where
import Hans.Device.Types (Device,HasDeviceConfig(..))
import Hans.Lens
import Data.Serialize (Get,Put,getWord8,putWord8)
import Data.Word (Word8)
type NetworkProtocol = Word8
pattern PROT_ICMP4 = 0x1
pattern PROT_TCP = 0x6
pattern PROT_UDP = 0x11
getNetworkProtocol :: Get NetworkProtocol
getNetworkProtocol = getWord8
putNetworkProtocol :: NetworkProtocol -> Put
putNetworkProtocol = putWord8
data RouteInfo addr = RouteInfo { riSource :: !addr
, riNext :: !addr
, riDev :: !Device
} deriving (Eq,Functor)
instance HasDeviceConfig (RouteInfo addr) where
deviceConfig = to riDev . deviceConfig