net.clackrouter.routing
Class RoutingTable
java.lang.Object
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.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RoutingTable
public RoutingTable(IPRouteLookup l)
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()