iproute-0.1: IP Routing Table

Data.IP.RouteTable

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.

Synopsis

Documentation

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 a, IP k) => Eq (IPRTable k a) 
(Show k, Show a, IP k) => Show (IPRTable k a) 

empty :: IP k => IPRTable k aSource

The empty function returns an empty IP routing table.

insert :: IP k => IPRange k -> a -> IPRTable k a -> IPRTable k aSource

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

lookup :: IP k => IPRange k -> IPRTable k a -> Maybe aSource

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

fromList :: IP k => [(IPRange 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 :: IP k => IPRTable k a -> [(IPRange k, a)]Source

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