iproute-1.2.4: IP Routing Table

Data.IP

Contents

Description

Data structures to express IPv4, IPv6 and IP range.

Synopsis

Documentation

IP data

data IP Source

A unified IP data for IPv4 and IPv6. To create this, use the data constructors. Or use read 192.0.2.1 :: IP, for example. Also, 192.0.2.1 can be used as literal with OverloadedStrings.

Constructors

IPv4 

Fields

ipv4 :: IPv4
 
IPv6 

Fields

ipv6 :: IPv6
 

Instances

data IPv4 Source

The abstract data structure 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.

toIPv4 :: [Int] -> IPv4Source

The toIPv4 function takes a list of Int and returns IPv4. For example, toIPv4 [192,0,2,1].

fromIPv4 :: IPv4 -> [Int]Source

The fromIPv4 function convert IPv4 to a list of Int.

data IPv6 Source

The abstract data structure 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.

toIPv6 :: [Int] -> IPv6Source

The toIPv6 function takes a list of Int and returns IPv6. For example, toIPv6 [0x2001,0xDB8,0,0,0,0,0,1].

fromIPv6 :: IPv6 -> [Int]Source

The toIPv6 function convert IPv6 to a list of Int.

IP range data

data IPRange Source

A unified data for AddrRange IPv4 and AddrRange IPv6. To create this, use read "192.0.2.0/24" :: IPRange. Also, "192.0.2.0/24" can be used as literal with OverloadedStrings.

Constructors

IPv4Range 
IPv6Range 

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.

Address class

class Eq a => Addr a whereSource

Methods

masked :: a -> a -> aSource

The masked function takes an Addr and a contiguous mask and returned a masked Addr.

intToMask :: Int -> aSource

The intToMask function takes Int and returns a contiguous mask.

Instances

makeAddrRange :: Addr a => a -> Int -> AddrRange aSource

The makeAddrRange functions takes an Addr address and a mask length. It creates a bit mask from the mask length and masks the Addr address, then returns AddrRange made of them.

(>:>) :: Addr a => AddrRange a -> AddrRange a -> BoolSource

The >:> operator takes two AddrRange. It returns True if the first AddrRange contains the second AddrRange. Otherwise, it returns False.

isMatchedTo :: Addr a => a -> AddrRange a -> BoolSource

The toMatchedTo function take an Addr address and an AddrRange, and returns True if the range contains the address.