net.clackrouter.routing
Class RoutingTable

java.lang.Object
  extended by net.clackrouter.routing.RoutingTable

public class RoutingTable
extends java.lang.Object

Represents an simple routing table that can perform lookups based on a destination IP address. By default, entries are ordered for longest-prefix match.


Constructor Summary
RoutingTable(IPRouteLookup l)
           
 
Method Summary
 void addEntry(RoutingEntry entry)
          You probably want to use either addRemoteEntry() or addLocalEntry() instead of this function.
 void addLocalEntry(RoutingEntry new_entry)
           
 void addRemoteEntry(RoutingEntry new_entry)
          Must first lookup to make sure we have a route to the next-hop address already, if not, throw an error.
 void clear()
           
 void deleteEntry(RoutingEntry entry)
           
 RoutingEntry getEntry(int i)
           
 IPRouteLookup getLookupComponent()
           
 RoutingEntry getRouteForPrefix(java.net.InetAddress net, java.net.InetAddress mask)
           
 RoutingEntry longestPrefixMatch(java.net.InetAddress in)
           
 void moveEntryDown(RoutingEntry entry)
           
 void moveEntryUp(RoutingEntry entry)
           
 int numEntries()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RoutingTable

public RoutingTable(IPRouteLookup l)
Method Detail

getRouteForPrefix

public RoutingEntry getRouteForPrefix(java.net.InetAddress net,
                                      java.net.InetAddress mask)

getEntry

public RoutingEntry getEntry(int i)

numEntries

public int numEntries()

clear

public void clear()

addEntry

public void addEntry(RoutingEntry entry)
You probably want to use either addRemoteEntry() or addLocalEntry() instead of this function. Note: this function resorts the routing table to perform longest prefix match, invalidating any previous calls to moveEntryUp or moveEntryDown.


addLocalEntry

public void addLocalEntry(RoutingEntry new_entry)
                   throws java.lang.Exception
Throws:
java.lang.Exception

addRemoteEntry

public void addRemoteEntry(RoutingEntry new_entry)
                    throws java.lang.Exception
Must first lookup to make sure we have a route to the next-hop address already, if not, throw an error. Otherwise, add new routing entry, using the interface specified for the next hop.

Parameters:
net -
mask -
next_hop -
Throws:
java.lang.Exception

moveEntryUp

public void moveEntryUp(RoutingEntry entry)

moveEntryDown

public void moveEntryDown(RoutingEntry entry)

deleteEntry

public void deleteEntry(RoutingEntry entry)

longestPrefixMatch

public RoutingEntry longestPrefixMatch(java.net.InetAddress in)

getLookupComponent

public IPRouteLookup getLookupComponent()