ip-0.8.6: Library for IP and MAC addresses

Safe HaskellNone




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 -> Int -> MArray s -> ST s () 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.

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