iproute-1.7.15: 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
  }
- type IPv4Addr = Word32
- type IPv6Addr = (Word32, Word32, Word32, Word32)

# Documentation

newtype IPv4 #

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

Instances details

Data IPv4 # |

Instance details

Defined in Data.IP.Addr

Methods

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

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

toConstr :: IPv4 -> Constr #

dataTypeOf :: IPv4 -> DataType #

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

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

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

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

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

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

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

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

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

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

IsString IPv4 # |
Instance details Defined in Data.IP.Addr Methods fromString :: String -> IPv4 #
Bounded IPv4 # |
Instance details Defined in Data.IP.Addr Methods minBound :: IPv4 # maxBound :: IPv4 #
Enum IPv4 # |
Instance details Defined in Data.IP.Addr Methods succ :: IPv4 -> IPv4 # pred :: IPv4 -> IPv4 # toEnum :: Int -> IPv4 # fromEnum :: IPv4 -> Int # enumFrom :: IPv4 -> [IPv4] # enumFromThen :: IPv4 -> IPv4 -> [IPv4] # enumFromTo :: IPv4 -> IPv4 -> [IPv4] # enumFromThenTo :: IPv4 -> IPv4 -> IPv4 -> [IPv4] #
Generic IPv4 # |

Instance details

Defined in Data.IP.Addr

Associated Types

type Rep IPv4 |
Instance details Defined in Data.IP.Addr type Rep IPv4 = D1 ('MetaData "IPv4" "Data.IP.Addr" "iproute-1.7.15-7DWaiz0CUKEFkrEX4o4bKz" 'True) (C1 ('MetaCons "IP4" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 IPv4Addr)))

Methods

from :: IPv4 -> Rep IPv4 x #

to :: Rep IPv4 x -> IPv4 #

Read IPv4 # |
Instance details Defined in Data.IP.Addr Methods readsPrec :: Int -> ReadS IPv4 # readList :: ReadS [IPv4] # readPrec :: ReadPrec IPv4 # readListPrec :: ReadPrec [IPv4] #
Show IPv4 # |
Instance details Defined in Data.IP.Addr Methods showsPrec :: Int -> IPv4 -> ShowS # show :: IPv4 -> String # showList :: [IPv4] -> ShowS #
Eq IPv4 # |
Instance details Defined in Data.IP.Addr Methods (==) :: IPv4 -> IPv4 -> Bool # (/=) :: IPv4 -> IPv4 -> Bool #
Ord IPv4 # |
Instance details Defined in Data.IP.Addr Methods compare :: IPv4 -> IPv4 -> Ordering # (<) :: IPv4 -> IPv4 -> Bool # (<=) :: IPv4 -> IPv4 -> Bool # (>) :: IPv4 -> IPv4 -> Bool # (>=) :: IPv4 -> IPv4 -> Bool # max :: IPv4 -> IPv4 -> IPv4 # min :: IPv4 -> IPv4 -> IPv4 #
Addr IPv4 # |
Instance details Defined in Data.IP.Op Methods masked :: IPv4 -> IPv4 -> IPv4 # intToMask :: Int -> IPv4 #
Routable IPv4 # |
Instance details Defined in Data.IP.RouteTable.Internal Methods intToTBit :: Int -> IPv4 # isZero :: IPv4 -> IPv4 -> Bool #
IsString (AddrRange IPv4) # |
Instance details Defined in Data.IP.Range Methods fromString :: String -> AddrRange IPv4 #
Read (AddrRange IPv4) # |
Instance details Defined in Data.IP.Range Methods readsPrec :: Int -> ReadS (AddrRange IPv4) # readList :: ReadS [AddrRange IPv4] # readPrec :: ReadPrec (AddrRange IPv4) # readListPrec :: ReadPrec [AddrRange IPv4] #
type Rep IPv4 # |
Instance details Defined in Data.IP.Addr type Rep IPv4 = D1 ('MetaData "IPv4" "Data.IP.Addr" "iproute-1.7.15-7DWaiz0CUKEFkrEX4o4bKz" 'True) (C1 ('MetaCons "IP4" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 IPv4Addr)))

newtype IPv6 #

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

Instances details

Data IPv6 # |

Instance details

Defined in Data.IP.Addr

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 #

IsString IPv6 # |
Instance details Defined in Data.IP.Addr Methods fromString :: String -> IPv6 #
Bounded IPv6 # |
Instance details Defined in Data.IP.Addr Methods minBound :: IPv6 # maxBound :: IPv6 #
Enum IPv6 # |
Instance details Defined in Data.IP.Addr 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] #
Generic IPv6 # |

Instance details

Defined in Data.IP.Addr

Associated Types

type Rep IPv6 |
Instance details Defined in Data.IP.Addr type Rep IPv6 = D1 ('MetaData "IPv6" "Data.IP.Addr" "iproute-1.7.15-7DWaiz0CUKEFkrEX4o4bKz" 'True) (C1 ('MetaCons "IP6" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 IPv6Addr)))

Methods

from :: IPv6 -> Rep IPv6 x #

to :: Rep IPv6 x -> IPv6 #

Read IPv6 # |
Instance details Defined in Data.IP.Addr Methods readsPrec :: Int -> ReadS IPv6 # readList :: ReadS [IPv6] # readPrec :: ReadPrec IPv6 # readListPrec :: ReadPrec [IPv6] #
Show IPv6 # |
Instance details Defined in Data.IP.Addr Methods showsPrec :: Int -> IPv6 -> ShowS # show :: IPv6 -> String # showList :: [IPv6] -> ShowS #
Eq IPv6 # |
Instance details Defined in Data.IP.Addr Methods (==) :: IPv6 -> IPv6 -> Bool # (/=) :: IPv6 -> IPv6 -> Bool #
Ord IPv6 # |
Instance details Defined in Data.IP.Addr 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 #
Addr IPv6 # |
Instance details Defined in Data.IP.Op Methods masked :: IPv6 -> IPv6 -> IPv6 # intToMask :: Int -> IPv6 #
Routable IPv6 # |
Instance details Defined in Data.IP.RouteTable.Internal Methods intToTBit :: Int -> IPv6 # isZero :: IPv6 -> IPv6 -> Bool #
IsString (AddrRange IPv6) # |
Instance details Defined in Data.IP.Range Methods fromString :: String -> AddrRange IPv6 #
Read (AddrRange IPv6) # |
Instance details Defined in Data.IP.Range Methods readsPrec :: Int -> ReadS (AddrRange IPv6) # readList :: ReadS [AddrRange IPv6] # readPrec :: ReadPrec (AddrRange IPv6) # readListPrec :: ReadPrec [AddrRange IPv6] #
type Rep IPv6 # |
Instance details Defined in Data.IP.Addr type Rep IPv6 = D1 ('MetaData "IPv6" "Data.IP.Addr" "iproute-1.7.15-7DWaiz0CUKEFkrEX4o4bKz" 'True) (C1 ('MetaCons "IP6" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 IPv6Addr)))

data AddrRange a #

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

Instances details

Data a => Data (AddrRange a) # |

Instance details

Defined in Data.IP.Range

Methods

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

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

toConstr :: AddrRange a -> Constr #

dataTypeOf :: AddrRange a -> DataType #

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

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

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

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

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

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

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

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

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

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

IsString (AddrRange IPv4) # |
Instance details Defined in Data.IP.Range Methods fromString :: String -> AddrRange IPv4 #
IsString (AddrRange IPv6) # |
Instance details Defined in Data.IP.Range Methods fromString :: String -> AddrRange IPv6 #
Generic (AddrRange a) # |

Instance details

Defined in Data.IP.Range

Associated Types

type Rep (AddrRange a) |

Instance details

Defined in Data.IP.Range

type Rep (AddrRange a) = D1 ('MetaData "AddrRange" "Data.IP.Range" "iproute-1.7.15-7DWaiz0CUKEFkrEX4o4bKz" 'False) (C1 ('MetaCons "AddrRange" 'PrefixI 'True) (S1 ('MetaSel ('Just "addr") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: (S1 ('MetaSel ('Just "mask") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: S1 ('MetaSel ('Just "mlen") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int))))

Methods

from :: AddrRange a -> Rep (AddrRange a) x #

to :: Rep (AddrRange a) x -> AddrRange a #

Read (AddrRange IPv4) # |
Instance details Defined in Data.IP.Range Methods readsPrec :: Int -> ReadS (AddrRange IPv4) # readList :: ReadS [AddrRange IPv4] # readPrec :: ReadPrec (AddrRange IPv4) # readListPrec :: ReadPrec [AddrRange IPv4] #
Read (AddrRange IPv6) # |
Instance details Defined in Data.IP.Range Methods readsPrec :: Int -> ReadS (AddrRange IPv6) # readList :: ReadS [AddrRange IPv6] # readPrec :: ReadPrec (AddrRange IPv6) # readListPrec :: ReadPrec [AddrRange IPv6] #
Show a => Show (AddrRange a) # |
Instance details Defined in Data.IP.Range Methods showsPrec :: Int -> AddrRange a -> ShowS # show :: AddrRange a -> String # showList :: [AddrRange a] -> ShowS #
Eq a => Eq (AddrRange a) # |
Instance details Defined in Data.IP.Range Methods (==) :: AddrRange a -> AddrRange a -> Bool # (/=) :: AddrRange a -> AddrRange a -> Bool #
Ord a => Ord (AddrRange a) # |
Instance details Defined in Data.IP.Range Methods compare :: AddrRange a -> AddrRange a -> Ordering # (<) :: AddrRange a -> AddrRange a -> Bool # (<=) :: AddrRange a -> AddrRange a -> Bool # (>) :: AddrRange a -> AddrRange a -> Bool # (>=) :: AddrRange a -> AddrRange a -> Bool # max :: AddrRange a -> AddrRange a -> AddrRange a # min :: AddrRange a -> AddrRange a -> AddrRange a #
type Rep (AddrRange a) # |

Instance details

Defined in Data.IP.Range

type Rep (AddrRange a) = D1 ('MetaData "AddrRange" "Data.IP.Range" "iproute-1.7.15-7DWaiz0CUKEFkrEX4o4bKz" 'False) (C1 ('MetaCons "AddrRange" 'PrefixI 'True) (S1 ('MetaSel ('Just "addr") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: (S1 ('MetaSel ('Just "mask") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: S1 ('MetaSel ('Just "mlen") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int))))

type IPv4Addr = Word32 #

type IPv6Addr = (Word32, Word32, Word32, Word32) #