Safe Haskell | None |
---|---|
Language | Haskell2010 |
An IPv4 data type
This module provides the IPv4 data type and functions for working
with it. There are also encoding and decoding functions provided
in this module, but they should be imported from
Net.IPv4.Text
and Net.IPv4.ByteString.Char8
instead. They are
defined here so that the FromJSON
and ToJSON
instances can
use them.
At some point, a highly efficient IPv4-to-ByteString function needs
to be added to this module to take advantage of aeson
's new
toEncoding
method.
- newtype IPv4 = IPv4 {}
- data IPv4Range = IPv4Range {
- ipv4RangeBase :: !IPv4
- ipv4RangeLength :: !Int8
- fromOctets :: Word8 -> Word8 -> Word8 -> Word8 -> IPv4
- fromOctets' :: Word32 -> Word32 -> Word32 -> Word32 -> IPv4
- toOctets :: IPv4 -> (Word8, Word8, Word8, Word8)
- fromDotDecimalText :: Text -> Maybe IPv4
- fromDotDecimalText' :: Text -> Either String IPv4
- rangeFromDotDecimalText' :: Text -> Either String IPv4Range
- dotDecimalRangeParser :: Parser IPv4Range
- dotDecimalParser :: Parser IPv4
- toDotDecimalText :: IPv4 -> Text
- toDotDecimalBuilder :: IPv4 -> Builder
- rangeToDotDecimalText :: IPv4Range -> Text
- rangeToDotDecimalBuilder :: IPv4Range -> Builder
Types
IPv4Range | |
|
Conversion Functions
fromOctets' :: Word32 -> Word32 -> Word32 -> Word32 -> IPv4 Source
This is sort of a misnomer. It takes Word32 to make dotDecimalParser probably perform better.
Encoding and Decoding Functions
fromDotDecimalText :: Text -> Maybe IPv4 Source
dotDecimalParser :: Parser IPv4 Source
This does not do an endOfInput check because it is reused in the range parser implementation.
toDotDecimalText :: IPv4 -> Text Source
toDotDecimalBuilder :: IPv4 -> Builder Source