nettle-openflow-0.1: High level configuration and control of computer networks.




This module provides Get values for parsing various IP packets and headers from ByteStrings into a byte-sequence-independent representation as Haskell datatypes.


These are incomplete. The headers may not contain all the information that the protocols specify. For example, the Haskell representation of an IP Header only includes source and destination addresses and IP protocol number, even though an IP packet has many more header fields. More seriously, an IP header may have an optional extra headers section after the destination address. We assume this is not present. If it is present, then the transport protocol header will not be directly after the destination address, but will be after these options. Therefore functions that assume this, such as the getExactMatch function below, will give incorrect results when applied to such IP packets.

The Haskell representations of the headers for the transport protocols are similarly incomplete. Again, the Get instances for the transport protocols may not parse through the end of the transport protocol header.


IP Packet

data IPPacket Source

An IP packet consists of a header and a body.


IPPacket IPHeader IPBody 

data IPHeader Source

An IP Header includes various information about the packet, including the type of payload it contains. Warning: this definition does not include every header field included in an IP packet.




ipSrcAddress :: IPAddress
ipDstAddress :: IPAddress
ipProtocol :: IPProtocol
headerLength :: Int
totalLength :: Int
dscp :: DifferentiatedServicesCodePoint

differentiated services code point - 6 bit number

data IPBody Source

The body of an IP packet can be either a TCP, UDP, ICMP or other packet. Packets other than TCP, UDP, ICMP are represented as unparsed ByteString values.


Framed Messages

class FramedMessage m a b | m -> a, m -> b whereSource

The FramedMessage class defines the class of data types which represents messages having source and destination addresses and a message body.


body :: m -> bSource

sourceAddress :: m -> aSource

destAddress :: m -> aSource