iproute-1.1.0: IP Routing Table

Data.IP.RouteTable

Contents

Description

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/

Synopsis

Documentation

Routable class

class Addr a => Routable a whereSource

A class to contain IPv4 and IPv6.

Methods

intToTBit :: Int -> aSource

The intToTBit function takes Int and returns an Routable address whose only n-th bit is set.

isZero :: a -> a -> BoolSource

The isZero function takes an Routable address and an test bit Routable address and returns True is the bit is unset, otherwise returns False.

Type for IP routing table

data IPRTable k a Source

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.

Instances

(Eq k, Eq a) => Eq (IPRTable k a) 
(Show k, Show a) => Show (IPRTable k a) 

Functions to manipulate an IP routing table

empty :: Routable k => IPRTable k aSource

The empty function returns an empty IP routing table.

insert :: Routable k => AddrRange k -> a -> IPRTable k a -> IPRTable k aSource

The insert function inserts a value with a key of AddrRange to IPRTable and returns a new IPRTable.

delete :: Routable k => AddrRange k -> IPRTable k a -> IPRTable k aSource

The delete function deletes a value by a key of AddrRange from IPRTable and returns a new IPRTable.

lookup :: Routable k => AddrRange k -> IPRTable k a -> Maybe aSource

The lookup function looks up IPRTable with a key of AddrRange and returns its value if exists.

fromList :: Routable k => [(AddrRange k, a)] -> IPRTable k aSource

The fromList function creates a new IP routing table from a list of a pair of IPrange and value.

toList :: Routable k => IPRTable k a -> [(AddrRange k, a)]Source

The toList function creates a list of a pair of AddrRange and value from an IP routing table.