ip-1.7.8: Library for IP and MAC addresses

Safe Haskell | None
Language | Haskell2010

Net.IPv6

Contents

- Convert
- Special IP Addresses
- Textual Conversion
  - Text
- UTF-8 Bytes
  - Printing
- IPv6 Ranges
  - Range functions
  - Textual Conversion
    - Text
  - UTF-8 Bytes
- Types

Description

This module provides the IPv6 data type and functions for working with it.

Synopsis

- ipv6 :: Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> IPv6
- fromOctets :: Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> IPv6
- fromWord16s :: Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> IPv6
- fromWord32s :: Word32 -> Word32 -> Word32 -> Word32 -> IPv6
- fromTupleWord16s :: (Word16, Word16, Word16, Word16, Word16, Word16, Word16, Word16) -> IPv6
- fromTupleWord32s :: (Word32, Word32, Word32, Word32) -> IPv6
- toWord16s :: IPv6 -> (Word16, Word16, Word16, Word16, Word16, Word16, Word16, Word16)
- toWord32s :: IPv6 -> (Word32, Word32, Word32, Word32)
- any :: IPv6
- loopback :: IPv6
- localhost :: IPv6
- encode :: IPv6 -> Text
- encodeShort :: IPv6 -> ShortText
- decode :: Text -> Maybe IPv6
- decodeShort :: ShortText -> Maybe IPv6
- parser :: Parser IPv6
- parserUtf8Bytes :: e -> Parser e s IPv6
- decodeUtf8Bytes :: Bytes -> Maybe IPv6
- boundedBuilderUtf8 :: IPv6 -> Builder 39
- print :: IPv6 -> IO ()
- range :: IPv6 -> Word8 -> IPv6Range
- fromBounds :: IPv6 -> IPv6 -> IPv6Range
- normalize :: IPv6Range -> IPv6Range
- contains :: IPv6Range -> IPv6 -> Bool
- isSubsetOf :: IPv6Range -> IPv6Range -> Bool
- member :: IPv6 -> IPv6Range -> Bool
- lowerInclusive :: IPv6Range -> IPv6
- upperInclusive :: IPv6Range -> IPv6
- encodeRange :: IPv6Range -> Text
- decodeRange :: Text -> Maybe IPv6Range
- parserRange :: Parser IPv6Range
- printRange :: IPv6Range -> IO ()
- parserRangeUtf8Bytes :: e -> Parser e s IPv6Range
- parserRangeUtf8BytesLenient :: e -> Parser e s IPv6Range
- newtype IPv6 = IPv6 {
  - getIPv6 :: Word128
  }
- data IPv6Range = IPv6Range {
  - ipv6RangeBase :: !IPv6
  - ipv6RangeLength :: !Word8
  }

# Convert

ipv6 :: Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> IPv6 #

Create an `IPv6` address from the eight 16-bit fragments that make it up. This closely resembles the standard IPv6 notation, so is used for the `Show` instance. Note that this lacks the formatting feature for suppress zeroes in an `IPv6` address, but it should be readable enough for hacking in GHCi.

    >>> let addr = ipv6 0x3124 0x0 0x0 0xDEAD 0xCAFE 0xFF 0xFE00 0x1
    >>> addr
    ipv6 0x3124 0x0000 0x0000 0xdead 0xcafe 0x00ff 0xfe00 0x0001
    >>> T.putStrLn (encode addr)
    3124::dead:cafe:ff:fe00:1

fromOctets :: Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> IPv6 #

This could be useful for the rare occasion in which one could construct an `IPv6` from octets.

Note that while `Net.IPv4.`fromOctets` = Net.IPv4.`ipv4``, `Net.IPv6.fromOctets /= Net.IPv6.ipv6`. While this should be obvious from their types, it is worth mentioning since the similarity in naming might be confusing.

fromWord16s :: Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> IPv6 #

An alias for the `ipv6` smart constructor.

fromWord32s :: Word32 -> Word32 -> Word32 -> Word32 -> IPv6 #

Build an `IPv6` from four 32-bit words. The leftmost argument is the high word and the rightword is the low word.

fromTupleWord16s :: (Word16, Word16, Word16, Word16, Word16, Word16, Word16, Word16) -> IPv6 #

Uncurried variant of `fromWord16s`.

fromTupleWord32s :: (Word32, Word32, Word32, Word32) -> IPv6 #

Uncurried variant of `fromWord32s`.

toWord16s :: IPv6 -> (Word16, Word16, Word16, Word16, Word16, Word16, Word16, Word16) #

Convert an `IPv6` to eight 16-bit words.

toWord32s :: IPv6 -> (Word32, Word32, Word32, Word32) #

Convert an `IPv6` to four 32-bit words.

# Special IP Addresses

any :: IPv6 #

The IP address representing any host.

    >>> IPv6.any
    ipv6 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000

loopback :: IPv6 #

The local loopback IP address.

    >>> IPv6.loopback
    ipv6 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0001

localhost :: IPv6 #

A useful alias for `loopback`.

    >>> IPv6.localhost
    ipv6 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0001

# Textual Conversion

## Text

encode :: IPv6 -> Text #

Encodes the `IPv6` address using zero-compression on the leftmost longest string of zeroes in the address. Per RFC 5952 Section 5, this uses mixed notation when encoding an IPv4-mapped IPv6 address:

    >>> T.putStrLn $ IPv6.encode $ IPv6.fromWord16s 0xDEAD 0xBEEF 0x0 0x0 0x0 0x0 0x0 0x1234
    dead:beef::1234
    >>> T.putStrLn $ IPv6.encode $ IPv6.fromWord16s 0x0 0x0 0x0 0x0 0x0 0xFFFF 0x6437 0xA5B4
    ::ffff:100.55.165.180
    >>> T.putStrLn $ IPv6.encode $ IPv6.fromWord16s 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
    ::

Per Section 4.2.2 of the same RFC, this does not use `::` to shorten a single 16-bit 0 field. Only runs of multiple 0 fields are considered.

encodeShort :: IPv6 -> ShortText #

Encodes the `IPv6` address as `ShortText` using zero-compression on the leftmost longest string of zeroes in the address. Per RFC 5952 Section 5, this uses mixed notation when encoding an IPv4-mapped IPv6 address.

    >>> IPv6.encodeShort $ IPv6.fromWord16s 0xDEAD 0xBEEF 0x0 0x0 0x0 0x0ABC 0x0 0x1234
    "dead:beef::abc:0:1234"

decode :: Text -> Maybe IPv6 #

Decode an `IPv6` address. This accepts both standard IPv6 notation (with zero compression) and mixed notation for IPv4-mapped IPv6 addresses. For a decoding function that additionally accepts dot-decimal-encoded IPv4 addresses, see `Net.IP.decode`.

decodeShort :: ShortText -> Maybe IPv6 #

Decode `ShortText` as an `IPv6` address.

    >>> decodeShort "ffff::2:b"
    Just (ipv6 0xffff 0x0000 0x0000 0x0000 0x0000 0x0000 0x0002 0x000b)

parser :: Parser IPv6 #

Parse an `IPv6` using `Parser`.

    >>> Atto.parseOnly IPv6.parser (Text.pack "dead:beef:3240:a426:ba68:1cd0:4263:109b")
    Right (ipv6 0xdead 0xbeef 0x3240 0xa426 0xba68 0x1cd0 0x4263 0x109b)

# UTF-8 Bytes

parserUtf8Bytes :: e -> Parser e s IPv6 #

Parse UTF-8-encoded `Bytes` as an `IPv6` address. This accepts both uppercase and lowercase characters in the hexadecimal components.

    >>> let str = "dead:beef:3240:a426:ba68:1cd0:4263:109b -> alive"
    >>> Parser.parseBytes (parserUtf8Bytes ()) (Ascii.fromString str)
    Success (Slice {offset = 39, length = 9, value = ipv6 0xdead 0xbeef 0x3240 0xa426 0xba68 0x1cd0 0x4263 0x109b})

This does not currently support parsing embedded IPv4 address (e.g. `ff00:8000:abc::224.1.2.3`).

decodeUtf8Bytes :: Bytes -> Maybe IPv6 #

Decode UTF-8-encoded `Bytes` into an `IPv6` address.

    >>> decodeUtf8Bytes (Ascii.fromString "::cab:1")
    Just (ipv6 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0cab 0x0001)

boundedBuilderUtf8 :: IPv6 -> Builder 39 #

Encodes the `IPv6` address using zero-compression on the leftmost longest string of zeroes in the address.

    >>> BB.run Nat.constant $ IPv6.boundedBuilderUtf8 $ IPv6.fromWord16s 0xDEAD 0xBEEF 0x0 0x0 0x0 0x0 0x0 0x1234
    [0x64, 0x65, 0x61, 0x64, 0x3a, 0x62, 0x65, 0x65, 0x66, 0x3a, 0x3a, 0x31, 0x32, 0x33, 0x34]

## Printing

print :: IPv6 -> IO () #

Print an `IPv6` using the textual encoding.

# IPv6 Ranges

## Range functions

range :: IPv6 -> Word8 -> IPv6Range #

Smart constructor for `IPv6Range`. Ensures the mask is appropriately sized and sets masked bits in the `IPv6` to zero.

    >>> let addr = IPv6.ipv6 0xDEAD 0xBEEF 0x3240 0xA426 0xBA68 0x1CD0 0x4263 0x109B
    >>> IPv6.printRange $ IPv6.range addr 25
    dead:be80::/25

fromBounds :: IPv6 -> IPv6 -> IPv6Range #

Given an inclusive lower and upper ip address, create the smallest `IPv6Range` that contains the two. This is helpful in situations where input is given as a range, like `` .

This makes the range broader if it cannot be represented in CIDR notation.

    >>> addrLower = IPv6.ipv6 0xDEAD 0xBE80 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
    >>> addrUpper = IPv6.ipv6 0xDEAD 0xBEFF 0xFFFF 0xFFFF 0xFFFF 0xFFFF 0xFFFF 0xFFFF
    >>> IPv6.printRange $ IPv6.fromBounds addrLower addrUpper
    dead:be80::/25

normalize :: IPv6Range -> IPv6Range #

Normalize an `IPv6Range`. The first result of this is that the `IPv6` inside the `IPv6Range` is changed so that the insignificant bits are zeroed out. For example:

    >>> addr1 = IPv6.ipv6 0x0192 0x0168 0x0001 0x0019 0x0000 0x0000 0x0000 0x0000
    >>> addr2 = IPv6.ipv6 0x0192 0x0168 0x0001 0x0163 0x0000 0x0000 0x0000 0x0000
    >>> IPv6.printRange $ IPv6.normalize $ IPv6.IPv6Range addr1 24
    192:100::/24
    >>> IPv6.printRange $ IPv6.normalize $ IPv6.IPv6Range addr2 28
    192:160::/28

The second effect of this is that the mask length is lowered to be 128 or smaller. Working with `IPv6Range`s that have not been normalized does not cause any issues for this library, although other applications may reject such ranges (especially those with a mask length above 128).

Note that 'normalize is idempotent, that is:

    IPv6.normalize r == (IPv6.normalize . IPv6.normalize) r

contains :: IPv6Range -> IPv6 -> Bool #

Checks to see if an `IPv6` address belongs in the `IPv6Range`.

    >>> let ip = IPv6.ipv6 0x2001 0x0db8 0x0db8 0x1094 0x2051 0x0000 0x0000 0x0001
    >>> let iprange mask = IPv6.IPv6Range (IPv6.ipv6 0x2001 0x0db8 0x0000 0x0000 0x0000 0x0000 0x0000 0x0001) mask
    >>> IPv6.contains (iprange 8) ip
    True
    >>> IPv6.contains (iprange 48) ip
    False

Typically, element-testing functions are written to take the element as the first argument and the set as the second argument. This is intentionally written the other way for better performance when iterating over a collection. For example, you might test elements in a list for membership like this:

    >>> let r = IPv6.IPv6Range (IPv6.ipv6 0x2001 0x0db8 0x0000 0x0000 0x0000 0x0000 0x0000 0x0001) 64
    >>> fmap (IPv6.contains r) (take 5 $ iterate succ $ IPv6.ipv6 0x2001 0x0db8 0x0000 0x0000 0xffff 0xffff 0xffff 0xfffe)
    [True,True,False,False,False]

The implementation of `contains` ensures that (with GHC), the bitmask creation and range normalization only occur once in the above example. They are reused as the list is iterated.

isSubsetOf :: IPv6Range -> IPv6Range -> Bool #

Checks if the first range is a subset of the second range.

member :: IPv6 -> IPv6Range -> Bool #

This is provided to mirror the interface provided by `Data.Set`. It behaves just like `contains` but with flipped arguments.

    IPv6.member ip r == IPv6.contains r ip

lowerInclusive :: IPv6Range -> IPv6 #

The inclusive lower bound of an `IPv6Range`. This is conventionally understood to be the broadcast address of a subnet. For example:

    >>> T.putStrLn $ IPv6.encode $ IPv6.lowerInclusive $ IPv6.IPv6Range (IPv6.ipv6 0x2001 0x0db8 0x0000 0x0000 0x0000 0x0000 0x0000 0x0001) 25
    2001:d80::

Note that the lower bound of a normalized `IPv6Range` is simply the ip address of the range:

    IPv6.lowerInclusive r == IPv6.ipv6RangeBase (IPv6.normalize r)

upperInclusive :: IPv6Range -> IPv6 #

The inclusive upper bound of an `IPv6Range`.

    >>> let addr = IPv6.ipv6 0xDEAD 0xBEEF 0x3240 0xA426 0xBA68 0x1CD0 0x4263 0x109B
    >>> T.putStrLn $ IPv6.encode $ IPv6.upperInclusive $ IPv6.IPv6Range addr 25
    dead:beff:ffff:ffff:ffff:ffff:ffff:ffff

## Textual Conversion

### Text

encodeRange :: IPv6Range -> Text #

Encode an `IPv6Range` as `Text`.

    >>> addr = IPv6.ipv6 0xDEAD 0xBEEF 0x3240 0xA426 0xBA68 0x1CD0 0x4263 0x109B
    >>> T.putStrLn $ IPv6.encodeRange $ IPv6.IPv6Range addr 28
    dead:beef:3240:a426:ba68:1cd0:4263:109b/28

decodeRange :: Text -> Maybe IPv6Range #

Decode an `IPv6Range` from `Text`.

    >>> addr = IPv6.ipv6 0xDEAD 0xBEEF 0x3240 0xA426 0xBA68 0x1CD0 0x4263 0x109B
    >>> fmap IPv6.encodeRange $ IPv6.decodeRange (Text.pack "dead:beef:3240:a426:ba68:1cd0:4263:109b/28")
    Just "dead:bee0::/28"

parserRange :: Parser IPv6Range #

Parse an `IPv6Range` using a `Parser`.

printRange :: IPv6Range -> IO () #

Print an `IPv6Range` using the textual encoding.

## UTF-8 Bytes

parserRangeUtf8Bytes :: e -> Parser e s IPv6Range #

Parse UTF-8-encoded `Bytes` into an `IPv4Range`. This requires the mask to be present.

    >>> maybe (putStrLn "nope") IPv6.printRange $ Parser.parseBytesMaybe (IPv6.parserRangeUtf8Bytes ()) (Ascii.fromString "1b02:f001:5:200b::/80")
    1b02:f001:5:200b::/80
    >>> maybe (putStrLn "nope") IPv6.printRange $ Parser.parseBytesMaybe (IPv6.parserRangeUtf8Bytes ()) (Ascii.fromString "abcd::")
    nope

See `parserRangeUtf8BytesLenient` for a variant that treats a missing mask as a `/32` mask.

parserRangeUtf8BytesLenient :: e -> Parser e s IPv6Range #

Variant of `parserRangeUtf8Bytes` that allows the mask to be omitted. An omitted mask is treated as a `/128` mask.

    >>> maybe (putStrLn "nope") IPv6.printRange $ Parser.parseBytesMaybe (IPv6.parserRangeUtf8BytesLenient ()) (Ascii.fromString "1b02:f001:5:200b::/80")
    1b02:f001:5:200b::/80
    >>> maybe (putStrLn "nope") IPv6.printRange $ Parser.parseBytesMaybe (IPv6.parserRangeUtf8BytesLenient ()) (Ascii.fromString "abcd::")
    abcd::/128

# Types

newtype IPv6 #

A 128-bit Internet Protocol version 6 address.

Constructors

IPv6 |

Fields

- getIPv6 :: Word128

#### Instances

Instances details

FromJSON IPv6 # |
Instance details Defined in Net.IPv6 Methods parseJSON :: Value -> Parser IPv6 # parseJSONList :: Value -> Parser [IPv6] # omittedField :: Maybe IPv6 #
ToJSON IPv6 # |
Instance details Defined in Net.IPv6 Methods toJSON :: IPv6 -> Value # toEncoding :: IPv6 -> Encoding # toJSONList :: [IPv6] -> Value # toEncodingList :: [IPv6] -> Encoding # omitField :: IPv6 -> Bool #
NFData IPv6 # |
Instance details Defined in Net.IPv6 Methods rnf :: IPv6 -> () #
Bits IPv6 # |

Instance details

Defined in Net.IPv6

Methods

(.&.) :: IPv6 -> IPv6 -> IPv6 #

(.|.) :: IPv6 -> IPv6 -> IPv6 #

xor :: IPv6 -> IPv6 -> IPv6 #

complement :: IPv6 -> IPv6 #

shift :: IPv6 -> Int -> IPv6 #

rotate :: IPv6 -> Int -> IPv6 #

zeroBits :: IPv6 #

bit :: Int -> IPv6 #

setBit :: IPv6 -> Int -> IPv6 #

clearBit :: IPv6 -> Int -> IPv6 #

complementBit :: IPv6 -> Int -> IPv6 #

testBit :: IPv6 -> Int -> Bool #

bitSizeMaybe :: IPv6 -> Maybe Int #

bitSize :: IPv6 -> Int #

isSigned :: IPv6 -> Bool #

shiftL :: IPv6 -> Int -> IPv6 #

unsafeShiftL :: IPv6 -> Int -> IPv6 #

shiftR :: IPv6 -> Int -> IPv6 #

unsafeShiftR :: IPv6 -> Int -> IPv6 #

rotateL :: IPv6 -> Int -> IPv6 #

rotateR :: IPv6 -> Int -> IPv6 #

popCount :: IPv6 -> Int #

FiniteBits IPv6 # |
Instance details Defined in Net.IPv6 Methods finiteBitSize :: IPv6 -> Int # countLeadingZeros :: IPv6 -> Int # countTrailingZeros :: IPv6 -> Int #
Data IPv6 # |

Instance details

Defined in Net.IPv6

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> IPv6 -> c IPv6 #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c IPv6 #

toConstr :: IPv6 -> Constr #

dataTypeOf :: IPv6 -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c IPv6) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IPv6) #

gmapT :: (forall b. Data b => b -> b) -> IPv6 -> IPv6 #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IPv6 -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IPv6 -> r #

gmapQ :: (forall d. Data d => d -> u) -> IPv6 -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> IPv6 -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> IPv6 -> m IPv6 #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> IPv6 -> m IPv6 #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> IPv6 -> m IPv6 #

Bounded IPv6 # |
Instance details Defined in Net.IPv6 Methods minBound :: IPv6 # maxBound :: IPv6 #
Enum IPv6 # |
Instance details Defined in Net.IPv6 Methods succ :: IPv6 -> IPv6 # pred :: IPv6 -> IPv6 # toEnum :: Int -> IPv6 # fromEnum :: IPv6 -> Int # enumFrom :: IPv6 -> [IPv6] # enumFromThen :: IPv6 -> IPv6 -> [IPv6] # enumFromTo :: IPv6 -> IPv6 -> [IPv6] # enumFromThenTo :: IPv6 -> IPv6 -> IPv6 -> [IPv6] #
Storable IPv6 # |
Instance details Defined in Net.IPv6 Methods sizeOf :: IPv6 -> Int # alignment :: IPv6 -> Int # peekElemOff :: Ptr IPv6 -> Int -> IO IPv6 # pokeElemOff :: Ptr IPv6 -> Int -> IPv6 -> IO () # peekByteOff :: Ptr b -> Int -> IO IPv6 # pokeByteOff :: Ptr b -> Int -> IPv6 -> IO () # peek :: Ptr IPv6 -> IO IPv6 # poke :: Ptr IPv6 -> IPv6 -> IO () #
Generic IPv6 # |

Instance details

Defined in Net.IPv6

Associated Types

type Rep IPv6 |
Instance details Defined in Net.IPv6 type Rep IPv6 = D1 ('MetaData "IPv6" "Net.IPv6" "ip-1.7.8-AipOdb0Sv1p9R8aZCz7tFh" 'True) (C1 ('MetaCons "IPv6" 'PrefixI 'True) (S1 ('MetaSel ('Just "getIPv6") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word128)))

Methods

from :: IPv6 -> Rep IPv6 x #

to :: Rep IPv6 x -> IPv6 #

Ix IPv6 # |
Instance details Defined in Net.IPv6 Methods range :: (IPv6, IPv6) -> [IPv6] # index :: (IPv6, IPv6) -> IPv6 -> Int # unsafeIndex :: (IPv6, IPv6) -> IPv6 -> Int # inRange :: (IPv6, IPv6) -> IPv6 -> Bool # rangeSize :: (IPv6, IPv6) -> Int # unsafeRangeSize :: (IPv6, IPv6) -> Int #
Read IPv6 # |
Instance details Defined in Net.IPv6 Methods readsPrec :: Int -> ReadS IPv6 # readList :: ReadS [IPv6] # readPrec :: ReadPrec IPv6 # readListPrec :: ReadPrec [IPv6] #
Show IPv6 # |
Instance details Defined in Net.IPv6 Methods showsPrec :: Int -> IPv6 -> ShowS # show :: IPv6 -> String # showList :: [IPv6] -> ShowS #
Eq IPv6 # |
Instance details Defined in Net.IPv6 Methods (==) :: IPv6 -> IPv6 -> Bool # (/=) :: IPv6 -> IPv6 -> Bool #
Ord IPv6 # |
Instance details Defined in Net.IPv6 Methods compare :: IPv6 -> IPv6 -> Ordering # (<) :: IPv6 -> IPv6 -> Bool # (<=) :: IPv6 -> IPv6 -> Bool # (>) :: IPv6 -> IPv6 -> Bool # (>=) :: IPv6 -> IPv6 -> Bool # max :: IPv6 -> IPv6 -> IPv6 # min :: IPv6 -> IPv6 -> IPv6 #
Hashable IPv6 # |
Instance details Defined in Net.IPv6 Methods hashWithSalt :: Int -> IPv6 -> Int # hash :: IPv6 -> Int #
Prim IPv6 # |

Instance details

Defined in Net.IPv6

Methods

sizeOfType# :: Proxy IPv6 -> Int# #

sizeOf# :: IPv6 -> Int# #

alignmentOfType# :: Proxy IPv6 -> Int# #

alignment# :: IPv6 -> Int# #

indexByteArray# :: ByteArray# -> Int# -> IPv6 #

readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, IPv6 #) #

writeByteArray# :: MutableByteArray# s -> Int# -> IPv6 -> State# s -> State# s #

setByteArray# :: MutableByteArray# s -> Int# -> Int# -> IPv6 -> State# s -> State# s #

indexOffAddr# :: Addr# -> Int# -> IPv6 #

readOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, IPv6 #) #

writeOffAddr# :: Addr# -> Int# -> IPv6 -> State# s -> State# s #

setOffAddr# :: Addr# -> Int# -> Int# -> IPv6 -> State# s -> State# s #

type Rep IPv6 # |
Instance details Defined in Net.IPv6 type Rep IPv6 = D1 ('MetaData "IPv6" "Net.IPv6" "ip-1.7.8-AipOdb0Sv1p9R8aZCz7tFh" 'True) (C1 ('MetaCons "IPv6" 'PrefixI 'True) (S1 ('MetaSel ('Just "getIPv6") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word128)))

data IPv6Range #

An `IPv6Range`. It is made up of the first `IPv6` in the range and its length.

Constructors

IPv6Range |

Fields

- ipv6RangeBase :: !IPv6
- ipv6RangeLength :: !Word8

#### Instances

Instances details

FromJSON IPv6Range # |
Instance details Defined in Net.IPv6 Methods parseJSON :: Value -> Parser IPv6Range # parseJSONList :: Value -> Parser [IPv6Range] # omittedField :: Maybe IPv6Range #
ToJSON IPv6Range # |
Instance details Defined in Net.IPv6 Methods toJSON :: IPv6Range -> Value # toEncoding :: IPv6Range -> Encoding # toJSONList :: [IPv6Range] -> Value # toEncodingList :: [IPv6Range] -> Encoding # omitField :: IPv6Range -> Bool #
NFData IPv6Range # |
Instance details Defined in Net.IPv6 Methods rnf :: IPv6Range -> () #
Data IPv6Range # |

Instance details

Defined in Net.IPv6

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> IPv6Range -> c IPv6Range #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c IPv6Range #

toConstr :: IPv6Range -> Constr #

dataTypeOf :: IPv6Range -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c IPv6Range) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IPv6Range) #

gmapT :: (forall b. Data b => b -> b) -> IPv6Range -> IPv6Range #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IPv6Range -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IPv6Range -> r #

gmapQ :: (forall d. Data d => d -> u) -> IPv6Range -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> IPv6Range -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> IPv6Range -> m IPv6Range #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> IPv6Range -> m IPv6Range #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> IPv6Range -> m IPv6Range #

Generic IPv6Range # |

Instance details

Defined in Net.IPv6

Associated Types

type Rep IPv6Range |
Instance details Defined in Net.IPv6 type Rep IPv6Range = D1 ('MetaData "IPv6Range" "Net.IPv6" "ip-1.7.8-AipOdb0Sv1p9R8aZCz7tFh" 'False) (C1 ('MetaCons "IPv6Range" 'PrefixI 'True) (S1 ('MetaSel ('Just "ipv6RangeBase") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 IPv6) :*: S1 ('MetaSel ('Just "ipv6RangeLength") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word8)))

Methods

from :: IPv6Range -> Rep IPv6Range x #

to :: Rep IPv6Range x -> IPv6Range #

Read IPv6Range # |
Instance details Defined in Net.IPv6 Methods readsPrec :: Int -> ReadS IPv6Range # readList :: ReadS [IPv6Range] # readPrec :: ReadPrec IPv6Range # readListPrec :: ReadPrec [IPv6Range] #
Show IPv6Range # |
Instance details Defined in Net.IPv6 Methods showsPrec :: Int -> IPv6Range -> ShowS # show :: IPv6Range -> String # showList :: [IPv6Range] -> ShowS #
Eq IPv6Range # |
Instance details Defined in Net.IPv6 Methods (==) :: IPv6Range -> IPv6Range -> Bool # (/=) :: IPv6Range -> IPv6Range -> Bool #
Ord IPv6Range # |
Instance details Defined in Net.IPv6 Methods compare :: IPv6Range -> IPv6Range -> Ordering # (<) :: IPv6Range -> IPv6Range -> Bool # (<=) :: IPv6Range -> IPv6Range -> Bool # (>) :: IPv6Range -> IPv6Range -> Bool # (>=) :: IPv6Range -> IPv6Range -> Bool # max :: IPv6Range -> IPv6Range -> IPv6Range # min :: IPv6Range -> IPv6Range -> IPv6Range #
type Rep IPv6Range # |
Instance details Defined in Net.IPv6 type Rep IPv6Range = D1 ('MetaData "IPv6Range" "Net.IPv6" "ip-1.7.8-AipOdb0Sv1p9R8aZCz7tFh" 'False) (C1 ('MetaCons "IPv6Range" 'PrefixI 'True) (S1 ('MetaSel ('Just "ipv6RangeBase") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 IPv6) :*: S1 ('MetaSel ('Just "ipv6RangeLength") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word8)))