-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | IP Routing Table -- -- IP Routing Table is a tree of IP ranges to search one of them on the -- longest match base. It is a kind of TRIE with one way branching -- removed. Both IPv4 and IPv6 are supported. @package iproute @version 1.2.2 -- | IP routing table is a tree of IPRange to search one of them -- on the longest match base. It is a kind of TRIE with one way branching -- removed. Both IPv4 and IPv6 are supported. -- -- For more information, see: -- http://www.mew.org/~kazu/proj/iproute/ module Data.IP.RouteTable -- | A class to contain IPv4 and IPv6. class Addr a => Routable a intToTBit :: Routable a => Int -> a isZero :: Routable a => a -> a -> Bool -- | The Tree structure for IP routing table based on TRIE with one way -- branching removed. This is an abstracted data structure, so you cannot -- touch its inside. Please use insert or lookup, instead. data IPRTable k a -- | The empty function returns an empty IP routing table. empty :: Routable k => IPRTable k a -- | The insert function inserts a value with a key of -- AddrRange to IPRTable and returns a new IPRTable. insert :: Routable k => AddrRange k -> a -> IPRTable k a -> IPRTable k a -- | The delete function deletes a value by a key of -- AddrRange from IPRTable and returns a new -- IPRTable. delete :: Routable k => AddrRange k -> IPRTable k a -> IPRTable k a -- | The lookup function looks up IPRTable with a key of -- AddrRange. If a routing information in IPRTable matches -- the key, its value is returned. lookup :: Routable k => AddrRange k -> IPRTable k a -> Maybe a -- | The findMatch function looks up IPRTable with a key of -- AddrRange. If the key matches routing informations in -- IPRTable, they are returned. findMatch :: MonadPlus m => Routable k => AddrRange k -> IPRTable k a -> m (AddrRange k, a) -- | The fromList function creates a new IP routing table from a -- list of a pair of IPrange and value. fromList :: Routable k => [(AddrRange k, a)] -> IPRTable k a -- | The toList function creates a list of a pair of -- AddrRange and value from an IP routing table. toList :: Routable k => IPRTable k a -> [(AddrRange k, a)] -- | Data structures to express IPv4, IPv6 and IP range. module Data.IP -- | 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. data IP IPv4 :: IPv4 -> IP ipv4 :: IP -> IPv4 IPv6 :: IPv6 -> IP ipv6 :: IP -> IPv6 -- | 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. data IPv4 -- | The toIPv4 function takes a list of Int and returns -- IPv4. For example, toIPv4 [192,0,2,1]. toIPv4 :: [Int] -> IPv4 -- | 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. data IPv6 -- | The toIPv6 function takes a list of Int and returns -- IPv6. For example, toIPv6 -- [0x2001,0xDB8,0,0,0,0,0,1]. toIPv6 :: [Int] -> IPv6 -- | 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. data IPRange IPv4Range :: AddrRange IPv4 -> IPRange ipv4range :: IPRange -> AddrRange IPv4 IPv6Range :: AddrRange IPv6 -> IPRange ipv6range :: IPRange -> AddrRange IPv6 -- | 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. data AddrRange a class Eq a => Addr a masked :: Addr a => a -> a -> a intToMask :: Addr a => Int -> a -- | 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. makeAddrRange :: Addr a => a -> Int -> AddrRange a -- | The >:> operator takes two AddrRange. It returns -- True if the first AddrRange contains the second -- AddrRange. Otherwise, it returns False. (>:>) :: Addr a => AddrRange a -> AddrRange a -> Bool -- | The toMatchedTo function take an Addr address and an -- AddrRange, and returns True if the range contains the -- address. isMatchedTo :: Addr a => a -> AddrRange a -> Bool