tftp-0.1: A library for building tftp servers

Safe HaskellNone



Common types used internally. Re-exports the ByteString type to use as well as some monad transformer stuff, exceptions, logging, Word and printf.



type ByteString = ByteStringSource

Alias for the Lazy ByteString that is used internally

pack :: [Word8] -> ByteString

O(n) Convert a '[Word8]' into a ByteString.

unpack :: ByteString -> [Word8]

O(n) Converts a ByteString to a '[Word8]'.

bdrop :: Int64 -> ByteString -> ByteStringSource

Candy for ByteString.pack to not interfere with Prelude(drop)

btake :: Int64 -> ByteString -> ByteStringSource

Candy for ByteString.take

blength :: ByteString -> Int64Source

Candy for ByteString.length

readFile :: FilePath -> IO ByteString

Read an entire file lazily into a ByteString. The Handle will be held open until EOF is encountered.

class (Eq address, Show address, Monad m, MonadIO m) => MessageIO m address | m -> address whereSource

Type class for monads that can send/receive messages


sendTo :: address -> ByteString -> m BoolSource

Send a message or return False when there was an error

receiveFrom :: Maybe Int -> m (Maybe (address, ByteString))Source

Receive a message, failing if no message was receive after a timeout (measured in seconds)

localAddress :: m addressSource

Return the address that receiveFrom receives on


MessageIO UDPIO Address

Abstraction over UDP IO for sending/receiving bytestrings

module Data.Word