Safe Haskell | None |
---|---|
Language | Haskell2010 |
- newtype IP4 = IP4 Word32
- getIP4 :: Get IP4
- putIP4 :: Putter IP4
- packIP4 :: Word8 -> Word8 -> Word8 -> Word8 -> IP4
- unpackIP4 :: IP4 -> (Word8, Word8, Word8, Word8)
- showIP4 :: IP4 -> ShowS
- readIP4 :: ReadS IP4
- pattern BroadcastIP4 :: IP4
- pattern CurrentNetworkIP4 :: IP4
- pattern WildcardIP4 :: IP4
- data IP4Mask = IP4Mask !IP4 !Int
- hostmask :: Int -> Word32
- netmask :: Int -> Word32
- maskRange :: IP4Mask -> (IP4, IP4)
- maskBits :: IP4Mask -> Int
- maskAddr :: IP4Mask -> IP4
- clearHostBits :: IP4Mask -> IP4
- setHostBits :: IP4Mask -> IP4
- broadcastAddress :: IP4Mask -> IP4
- readIP4Mask :: ReadS IP4Mask
- showIP4Mask :: IP4Mask -> ShowS
- ip4PseudoHeader :: IP4 -> IP4 -> NetworkProtocol -> Int -> PartialChecksum
- type IP4Ident = Word16
- data IP4Header = IP4Header {
- ip4TypeOfService :: !Word8
- ip4Ident :: !IP4Ident
- ip4Fragment_ :: !Word16
- ip4TimeToLive :: !Word8
- ip4Protocol :: !NetworkProtocol
- ip4Checksum :: !Word16
- ip4SourceAddr :: !IP4
- ip4DestAddr :: !IP4
- ip4Options :: ![IP4Option]
- emptyIP4Header :: IP4Header
- ip4DCSP :: Lens' IP4Header Word8
- ip4ECN :: Lens' IP4Header Word8
- ip4Fragment :: Lens' IP4Header Word16
- ip4DontFragment :: Lens' IP4Header Bool
- ip4MoreFragments :: Lens' IP4Header Bool
- ip4FragmentOffset :: Lens' IP4Header Word16
- noMoreFragments :: IP4Header -> IP4Header
- moreFragments :: IP4Header -> IP4Header
- addOffset :: Word16 -> IP4Header -> IP4Header
- setIdent :: IP4Ident -> IP4Header -> IP4Header
- ip4PacketSize :: IP4Header -> ByteString -> Int
- ip4HeaderSize :: IP4Header -> Int
- splitPacket :: Int -> IP4Header -> ByteString -> [(IP4Header, ByteString)]
- fragmentPacket :: Int64 -> IP4Header -> ByteString -> [(IP4Header, ByteString)]
- ip4VersionIHL :: Int -> Word8
- getIP4Packet :: Get (IP4Header, Int, Int)
- putIP4Header :: IP4Header -> Int -> Put
- renderIP4Options :: [IP4Option] -> (ByteString, Int)
- getIP4Options :: Int -> Get [IP4Option]
- data IP4Option = IP4Option {}
- ip4OptionSize :: IP4Option -> Int
- getIP4Option :: Get IP4Option
- ip4OptionType :: Bool -> Word8 -> Word8 -> Word8
- putIP4Option :: Putter IP4Option
- data ArpPacket = ArpPacket {}
- getArpPacket :: Get ArpPacket
- renderArpPacket :: ArpPacket -> ByteString
- putArpPacket :: Putter ArpPacket
- type ArpOper = Word16
- pattern ArpRequest :: forall a. (Num a, Eq a) => a
- pattern ArpReply :: forall a. (Num a, Eq a) => a
- getArpOper :: Get ArpOper
- putArpOper :: Putter ArpOper
Documentation
pattern BroadcastIP4 :: IP4 Source #
pattern CurrentNetworkIP4 :: IP4 Source #
pattern WildcardIP4 :: IP4 Source #
clearHostBits :: IP4Mask -> IP4 Source #
setHostBits :: IP4Mask -> IP4 Source #
broadcastAddress :: IP4Mask -> IP4 Source #
showIP4Mask :: IP4Mask -> ShowS Source #
ip4PseudoHeader :: IP4 -> IP4 -> NetworkProtocol -> Int -> PartialChecksum Source #
source address | +--------+--------+--------+--------+ | destination address | +--------+--------+--------+--------+ | zero |protocol| length | +--------+--------+--------+--------+
IP4Header | |
|
noMoreFragments :: IP4Header -> IP4Header Source #
moreFragments :: IP4Header -> IP4Header Source #
ip4PacketSize :: IP4Header -> ByteString -> Int Source #
Calculate the size of an IP4 packet
ip4HeaderSize :: IP4Header -> Int Source #
Calculate the size of an IP4 header
splitPacket :: Int -> IP4Header -> ByteString -> [(IP4Header, ByteString)] Source #
Fragment a single IP packet into one or more, given an MTU to fit into.
fragmentPacket :: Int64 -> IP4Header -> ByteString -> [(IP4Header, ByteString)] Source #
Given a fragment size and a packet, fragment the packet into multiple smaller ones.
ip4VersionIHL :: Int -> Word8 Source #
Compute the value of the version/header length byte.
getIP4Packet :: Get (IP4Header, Int, Int) Source #
Version| IHL |Type of Service| Total Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Identification |Flags| Fragment Offset | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Time to Live | Protocol | Header Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Source Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Destination Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
renderIP4Options :: [IP4Option] -> (ByteString, Int) Source #
IP4Option | |
|
ip4OptionSize :: IP4Option -> Int Source #
Arp packets, specialized to IP4 and Mac addresses.
getArpPacket :: Get ArpPacket Source #
Parse an Arp packet, given a way to parse hardware and protocol addresses.
putArpPacket :: Putter ArpPacket Source #
Render an Arp packet, given a way to render hardware and protocol addresses.
pattern ArpRequest :: forall a. (Num a, Eq a) => a Source #
getArpOper :: Get ArpOper Source #
Parse an Arp operation.
putArpOper :: Putter ArpOper Source #
Render an Arp operation.