hans-2.4.0.0: IPv4 Network Stack

Safe HaskellNone
LanguageHaskell98

Hans.Utils.Checksum

Description

A module providing checksum computations to other parts of Hans. The checksum here is the standard Internet 16-bit checksum (the one's complement of the one's complement sum of the data).

Synopsis

Documentation

computeChecksum :: Word32 -> ByteString -> Word16 Source

Compute the final checksum, using the given initial value.

finalizeChecksum :: PartialChecksum -> Word16 Source

computePartialChecksum :: PartialChecksum -> ByteString -> PartialChecksum Source

Compute a partial checksum, yielding a value suitable to be passed to computeChecksum.

computePartialChecksumLazy :: PartialChecksum -> ByteString -> PartialChecksum Source

Compute the checksum of a lazy bytestring.

clearChecksum :: ByteString -> Int -> IO ByteString Source

Clear the two bytes at the checksum offset of a rendered packet.

pokeChecksum :: Word16 -> ByteString -> Int -> IO ByteString Source

Poke a checksum into a bytestring.

emptyPartialChecksum :: PartialChecksum Source