iproute-1.7.0: IP Routing Table

Safe Haskell | None
Language | Haskell2010

Data.IP.Internal

Synopsis

- newtype IPv4 = IP4 IPv4Addr
- newtype IPv6 = IP6 IPv6Addr
- data AddrRange a = AddrRange {
  - addr :: !a
  - mask :: !a
  - mlen :: !Int
  }

# Documentation

newtype IPv4 Source

The abstract data type to express an IPv4 address. To create this, use `toIPv4`. Or use `read` `"192.0.2.1"` :: `IPv4`, for example. Also, `"192.0.2.1"` can be used as literal with OverloadedStrings.

    >>> read "192.0.2.1" :: IPv4
    192.0.2.1

Constructors

IP4 IPv4Addr |

Instances

Bounded IPv4 Source |
Enum IPv4 Source |
Eq IPv4 Source |
Data IPv4 Source |
Ord IPv4 Source |
Read IPv4 Source |
Show IPv4 Source |
IsString IPv4 Source |
Generic IPv4 Source |
Addr IPv4 Source |
Routable IPv4 Source |
Read (AddrRange IPv4) |
IsString (AddrRange IPv4) |
type Rep IPv4 Source |

newtype IPv6 Source

The abstract data type to express an IPv6 address. To create this, use `toIPv6`. Or use `read` `"2001:DB8::1"` :: `IPv6`, for example. Also, `"2001:DB8::1"` can be used as literal with OverloadedStrings.

    >>> read "2001:db8:00:00:00:00:00:01" :: IPv6
    2001:db8::1
    >>> read "2001:db8:11e:c00::101" :: IPv6
    2001:db8:11e:c00::101
    >>> read "2001:db8:11e:c00:aa:bb:192.0.2.1" :: IPv6
    2001:db8:11e:c00:aa:bb:c000:201
    >>> read "2001:db8::192.0.2.1" :: IPv6
    2001:db8::c000:201
    >>> read "0::ffff:192.0.2.1" :: IPv6
    ::ffff:192.0.2.1
    >>> read "0::0:c000:201" :: IPv6
    ::192.0.2.1
    >>> read "::0.0.0.1" :: IPv6
    ::1

Constructors

IP6 IPv6Addr |

Instances

Bounded IPv6 Source |
Enum IPv6 Source |
Eq IPv6 Source |
Data IPv6 Source |
Ord IPv6 Source |
Read IPv6 Source |
Show IPv6 Source |
IsString IPv6 Source |
Generic IPv6 Source |
Addr IPv6 Source |
Routable IPv6 Source |
Read (AddrRange IPv6) |
IsString (AddrRange IPv6) |
type Rep IPv6 Source |

data AddrRange a Source

The Addr range consists of an address, a contiguous mask, and mask length. The contiguous mask and the mask length are essentially same information but contained for pre calculation.

To create this, use `makeAddrRange` or `read` `"192.0.2.0/24"` :: `AddrRange` `IPv4`. Also, `"192.0.2.0/24"` can be used as literal with OverloadedStrings.

    >>> read "192.0.2.1/24" :: AddrRange IPv4
    192.0.2.0/24
    >>> read "2001:db8:00:00:00:00:00:01/48" :: AddrRange IPv6
    2001:db8::/48

Constructors

AddrRange |

Fields

addr :: !a

  The `addr` function returns an address from `AddrRange`.

mask :: !a

  The `mask` function returns a contiguous `IP` mask from `AddrRange`.

mlen :: !Int

  The `mlen` function returns a mask length from `AddrRange`.

Instances

Eq a => Eq (AddrRange a) Source |
Data a => Data (AddrRange a) Source |
Ord a => Ord (AddrRange a) Source |
Read (AddrRange IPv6) Source |
Read (AddrRange IPv4) Source |
Show a => Show (AddrRange a) Source |
IsString (AddrRange IPv6) Source |
IsString (AddrRange IPv4) Source |
Generic (AddrRange a) Source |
type Rep (AddrRange a) Source |