ip-0.9: Library for IP and MAC addresses

Safe HaskellNone
LanguageHaskell2010

Net.Internal

Synopsis

Documentation

c2w :: Char -> Word8 Source #

Taken from Data.ByteString.Internal. The same warnings apply here.

toTextPreAllocated :: Word32 -> Text Source #

I think that this function can be improved. Right now, it always allocates enough space for a fifteen-character text rendering of an IP address. I think that it should be possible to do more of the math upfront and allocate less space.

putMac :: ByteString -> Int -> Word64 -> MArray s -> ST s () Source #

word48AsOctets :: Word48 -> (Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> a) -> a Source #

i2w :: Integral a => a -> Word16 Source #

dotDecimalParser :: Parser Word32 Source #

This does not do an endOfInput check because it is reused in the range parser implementation.

fromOctets' :: Word32 -> Word32 -> Word32 -> Word32 -> Word32 Source #

This is sort of a misnomer. It takes Word32 to make dotDecimalParser probably perform better. This is mostly for internal use.

At some point, it would be worth revisiting the decision to use Word32 here. Using Word would probably give better performance on a 64-bit processor.

fromOctetsWord64 :: Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 Source #

All the words given as argument should be range restricted from 0 to 255. This is not checked.

countAddrs :: Word8 -> Word64 Source #

Given the size of the mask, return the total number of ips in the subnet. This only works for IPv4 addresses because an IPv6 subnet can have up to 2^128 addresses.

wordSuccessorsM :: MonadPlus m => (Word32 -> a) -> Word64 -> Word32 -> m a Source #

macFromText :: Maybe Char -> (Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> a) -> Text -> Maybe a Source #