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
-
addRoute(InetAddress, int, int)
- Adds a route without an associated gateway address.
-
addRoute(InetAddress, int, int, InetAddress)
- Adds a route with an associated gateway address.
-
delRoute(InetAddress)
- Removes a route from the routing table.
-
instance()
- Returns the one and only instance of RouteTable in existence.
-
main(String[])
- A main method for testing the routing table.
-
query(InetAddress)
- Returns a route object describing the route to the given destination.
-
registerListener(RouteChangeListener)
- Registers a new RouteChangeListener.
-
toString()
- Returns a string representation of the routing table.
-
unregisterListener(RouteChangeListener)
- Removes a RouteChangeListener.
instance
public static RouteTable instance()
- Returns the one and only instance of RouteTable in existence.
- Returns:
- The only instance
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
unregisterListener
public void unregisterListener(RouteChangeListener listener_)
- Removes a RouteChangeListener.
- Parameters:
- listener_ - The listener to be removed
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
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
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
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
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
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