All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class calypso.core.routing.RouteTable

java.lang.Object
   |
   +----calypso.core.routing.RouteTable

public class RouteTable
extends Object
A class that represents the Calypso node IP routing table. This class is a Singleton, so there can be only one routing table at a time. The Route objects are currently stored in a Vector.

Version:
$Revision: 1.7 $
Author:
Juhana Räsänen
See Also:
Route

Method Index

 o addRoute(InetAddress, int, int)
Adds a route without an associated gateway address.
 o addRoute(InetAddress, int, int, InetAddress)
Adds a route with an associated gateway address.
 o delRoute(InetAddress)
Removes a route from the routing table.
 o instance()
Returns the one and only instance of RouteTable in existence.
 o main(String[])
A main method for testing the routing table.
 o query(InetAddress)
Returns a route object describing the route to the given destination.
 o registerListener(RouteChangeListener)
Registers a new RouteChangeListener.
 o toString()
Returns a string representation of the routing table.
 o unregisterListener(RouteChangeListener)
Removes a RouteChangeListener.

Methods

 o instance
 public static RouteTable instance()
Returns the one and only instance of RouteTable in existence.

Returns:
The only instance
 o registerListener
 public void registerListener(RouteChangeListener listener_)
Registers a new RouteChangeListener. All changes in the routing tables are delivered to all listeners. A listener can be registered only once.

Parameters:
listener_ - The new listener
 o unregisterListener
 public void unregisterListener(RouteChangeListener listener_)
Removes a RouteChangeListener.

Parameters:
listener_ - The listener to be removed
 o addRoute
 public PPConnection addRoute(InetAddress ip_,
                              int maskLength_,
                              int outPort_)
Adds a route without an associated gateway address. Creates a new route object and stores it into the routing table.

Parameters:
ip_ - The Destination IP address
maskLength_ - The CIDR mask length
outPort_ - The outgoing port of the route
 o addRoute
 public PPConnection addRoute(InetAddress ip_,
                              int maskLength_,
                              int outPort_,
                              InetAddress gw_)
Adds a route with an associated gateway address. Creates a new route object and stores it into the routing table.

Parameters:
ip_ - The Destination IP address
maskLength_ - The CIDR mask length
outPort_ - The outgoing port of the route
gw_ - The IP address of the gateway host
 o delRoute
 public void delRoute(InetAddress ip_)
Removes a route from the routing table. The route must match exactly the IP/mask given, otherwise it won't be removed.

Parameters:
ip_ - The destination of the route to be removed
maskLength_ - The CIDR mask length of the route to be removed
 o query
 public Route query(InetAddress ip_)
Returns a route object describing the route to the given destination. The route table is searched for a longest match for the given address, eg. if there are routes 10.0.0.0/8 and 10.0.1.0/24 and route to 10.0.1.1 is queried, the latter will be returned.

Parameters:
ip_ - Destination IP address
Returns:
Route object describing the route to the destination
 o toString
 public String toString()
Returns a string representation of the routing table. All the routes in the table are concatentaed into string, separated with newlines.

Returns:
String representing the whole routing table.
Overrides:
toString in class Object
 o main
 public static void main(String argv[])
A main method for testing the routing table.

Parameters:
argv - The command line arguments.

All Packages  Class Hierarchy  This Package  Previous  Next  Index