hans-2.4.0.0: IPv4 Network Stack

Safe HaskellNone
LanguageHaskell98

Hans.Layer.IP4.Fragmentation

Synopsis

Documentation

type FragmentationTable addr = Map (Ident, addr, addr) Fragments Source

data Fragments Source

Constructors

Fragments 

Instances

fragmentEnd :: Fragment -> Int Source

The end of a fragment.

comesBefore :: Fragment -> Fragment -> Bool Source

Check the ordering of two fragments.

comesAfter :: Fragment -> Fragment -> Bool Source

Check the ordering of two fragments.

combineFragments :: Fragment -> Fragment -> Fragment Source

Merge two fragments.

Note: This doesn't do a validity check to make sure that they're actually adjacent.

expandGroup :: Fragments -> Fragment -> Int -> Fragments Source

Given a group of fragments, a new fragment, and a possible total size, create a new group of fragments that incorporates the new fragment.

addFragment :: Fragment -> [Fragment] -> [Fragment] Source

Add a fragment to a list of fragments, in a position that is relative to its offset and length.

processFragment :: Address addr => POSIXTime -> FragmentationTable addr -> Bool -> Int -> addr -> addr -> Ident -> ByteString -> (FragmentationTable addr, Maybe ByteString) Source

Process a packet fragment through the system, potentially returning a fully-processed packet if this fragment completes an existing packet or is itself a fully-complete packet.