jist.swans.route
Class RouteAodv.RouteTable

java.lang.Object
  extended by jist.swans.route.RouteAodv.RouteTable
Enclosing class:
RouteAodv

private static class RouteAodv.RouteTable
extends java.lang.Object

A routing table contains a hash map, consisting of NetAddress->RouteTableEntry mappings.


Field Summary
private  NetAddress localAddr
          Address of local node.
private  java.util.HashMap table
          The routing table.
 
Constructor Summary
RouteAodv.RouteTable(NetAddress netAddr)
          Constructs a RouteTable object.
 
Method Summary
 void add(NetAddress key, RouteAodv.RouteTableEntry value)
          Adds a new entry to the routing table.
 java.util.LinkedList destsViaHop(MacAddress hop)
          Returns all destinations through a given next hop.
 RouteAodv.RouteTableEntry lookup(NetAddress key)
          Look up routing information for a given destination address.
 void printTable()
          Print contents of routing table, for debugging purposes.
private  boolean remove(NetAddress key)
          Removes entry with given key from routing table.
 boolean removeList(java.util.LinkedList list)
          Remove all route table entries whose destination is specified in a given list.
 void removeNextHop(MacAddress nextHop)
          Remove all routing table entries with a given next hop address.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

table

private java.util.HashMap table
The routing table.


localAddr

private NetAddress localAddr
Address of local node.

Constructor Detail

RouteAodv.RouteTable

public RouteAodv.RouteTable(NetAddress netAddr)
Constructs a RouteTable object.

Parameters:
netAddr - local address of this node
Method Detail

add

public void add(NetAddress key,
                RouteAodv.RouteTableEntry value)
Adds a new entry to the routing table. Also adds next hop to outgoing table.

Parameters:
key - destination address
value - routing information for this destination

remove

private boolean remove(NetAddress key)
Removes entry with given key from routing table.

Parameters:
key - destination net address
Returns:
true, if entry existed and not null; false, otherwise

lookup

public RouteAodv.RouteTableEntry lookup(NetAddress key)
Look up routing information for a given destination address.

Parameters:
key - destination address
Returns:
routing information for this destination

removeList

public boolean removeList(java.util.LinkedList list)
Remove all route table entries whose destination is specified in a given list.

Parameters:
list - List of destinations (of type NetAddress)
Returns:
true, if at least one entry was removed from the table

removeNextHop

public void removeNextHop(MacAddress nextHop)
Remove all routing table entries with a given next hop address.

Parameters:
nextHop - the next hop address

destsViaHop

public java.util.LinkedList destsViaHop(MacAddress hop)
Returns all destinations through a given next hop.

Parameters:
hop - Next hop address
Returns:
list of destinations (of type NetAddress)

printTable

public void printTable()
Print contents of routing table, for debugging purposes.