foundation-0.0.23: Alternative prelude with batteries and no dependencies

License | BSD-style
Maintainer | Nicolas Di Prima <nicolas@primetype.co.uk>
Stability | experimental
Portability | portable
Safe Haskell | None
Language | Haskell2010

Foundation.Network.IPv6

Contents

- parsers

Description

IPv6 data type

Synopsis

- data IPv6
- any :: IPv6
- loopback :: IPv6
- fromString :: IsString a => String -> a
- toString :: IPv6 -> String
- fromTuple :: (Word16, Word16, Word16, Word16, Word16, Word16, Word16, Word16) -> IPv6
- toTuple :: IPv6 -> (Word16, Word16, Word16, Word16, Word16, Word16, Word16, Word16)
- ipv6Parser :: (ParserSource input, Element input ~ Char, Element (Chunk input) ~ Char) => Parser input IPv6
- ipv6ParserPreferred :: (ParserSource input, Element input ~ Char, Element (Chunk input) ~ Char) => Parser input IPv6
- ipv6ParserCompressed :: (ParserSource input, Element input ~ Char, Element (Chunk input) ~ Char) => Parser input IPv6
- ipv6ParserIpv4Embedded :: (ParserSource input, Element input ~ Char, Element (Chunk input) ~ Char) => Parser input IPv6

# Documentation

data IPv6 Source #

IPv6 data type

Instances

Eq IPv6 Source # |
Instance details Defined in Foundation.Network.IPv6 Methods (==) :: IPv6 -> IPv6 -> Bool Source # (/=) :: IPv6 -> IPv6 -> Bool Source #
Ord IPv6 Source # |
Instance details Defined in Foundation.Network.IPv6 Methods compare :: IPv6 -> IPv6 -> Ordering Source # (<) :: IPv6 -> IPv6 -> Bool Source # (<=) :: IPv6 -> IPv6 -> Bool Source # (>) :: IPv6 -> IPv6 -> Bool Source # (>=) :: IPv6 -> IPv6 -> Bool Source # max :: IPv6 -> IPv6 -> IPv6 Source # min :: IPv6 -> IPv6 -> IPv6 Source #
Show IPv6 Source # |
Instance details Defined in Foundation.Network.IPv6 Methods showsPrec :: Int -> IPv6 -> ShowS Source # show :: IPv6 -> String Source # showList :: [IPv6] -> ShowS Source #
IsString IPv6 Source # |
Instance details Defined in Foundation.Network.IPv6 Methods fromString :: String -> IPv6 Source #
NormalForm IPv6 Source # |
Instance details Defined in Foundation.Network.IPv6 Methods toNormalForm :: IPv6 -> () Source #
StorableFixed IPv6 Source # |
Instance details Defined in Foundation.Network.IPv6 Methods size :: proxy IPv6 -> CountOf Word8 Source # alignment :: proxy IPv6 -> CountOf Word8 Source #
Storable IPv6 Source # |
Instance details Defined in Foundation.Network.IPv6 Methods peek :: Ptr IPv6 -> IO IPv6 Source # poke :: Ptr IPv6 -> IPv6 -> IO () Source #
Hashable IPv6 Source # |
Instance details Defined in Foundation.Network.IPv6 Methods hashMix :: Hasher st => IPv6 -> st -> st Source #

any :: IPv6 Source #

equivalent to `::`

loopback :: IPv6 Source #

equivalent to `::1`

fromString :: IsString a => String -> a Source #

toString :: IPv6 -> String Source #

serialise to human readable IPv6

    >>> toString (fromString "0:0:0:0:0:0:0:1" :: IPv6)

fromTuple :: (Word16, Word16, Word16, Word16, Word16, Word16, Word16, Word16) -> IPv6 Source #

create an IPv6 from the given tuple

toTuple :: IPv6 -> (Word16, Word16, Word16, Word16, Word16, Word16, Word16, Word16) Source #

decompose an IPv6 into a tuple

# parsers

ipv6Parser :: (ParserSource input, Element input ~ Char, Element (Chunk input) ~ Char) => Parser input IPv6 Source #

IPv6 Parser as described in RFC4291

for more details: https://tools.ietf.org/html/rfc4291.html#section-2.2

which is exactly:

``` ipv6ParserPreferred | ipv6ParserIPv4Embedded | ipv6ParserCompressed ```

ipv6ParserPreferred :: (ParserSource input, Element input ~ Char, Element (Chunk input) ~ Char) => Parser input IPv6 Source #

IPv6 parser as described in RFC4291 section 2.2.1

The preferred form is x:x:x:x:x:x:x:x, where the `x`s are one to four hexadecimal digits of the eight 16-bit pieces of the address.

- `ABCD:EF01:2345:6789:ABCD:EF01:2345:6789`
- `2001:DB8:0:0:8:800:200C:417A`

ipv6ParserCompressed :: (ParserSource input, Element input ~ Char, Element (Chunk input) ~ Char) => Parser input IPv6 Source #

IPv6 parser as described in RFC4291 section 2.2.2

The use of "::" indicates one or more groups of 16 bits of zeros. The "::" can only appear once in an address. The "::" can also be used to compress leading or trailing zeros in an address.

- `2001:DB8::8:800:200C:417A`
- `FF01::101`
- `::1`
- `::`

ipv6ParserIpv4Embedded :: (ParserSource input, Element input ~ Char, Element (Chunk input) ~ Char) => Parser input IPv6 Source #

IPv6 address with embedded IPv4 address

when dealing with a mixed environment of IPv4 and IPv6 nodes is x:x:x:x:x:x:d.d.d.d, where the `x`s are the hexadecimal values of the six high-order 16-bit pieces of the address, and the `d`s are the decimal values of the four low-order 8-bit pieces of the address (standard IPv4 representation).

- `0:0:0:0:0:0:13.1.68.3`
- `0:0:0:0:0:FFFF:129.144.52.38`
- `::13.1.68.3`
- `::FFFF:129.144.52.38`