com.esf.net.route.service
Interface IRouteService


public interface IRouteService

The IRouteService is used to add, remove, and obtain information on entries in the system's route table CONFIGURATION Configuration will be accepted in the form of key/value pairs. The key/value pairs are strictly defined here: CONFIG_ENTRY -> KEY + "=" + VALUE KEY -> PARAM + "_" + INDEX INDEX -> "1" | "2" | ... | "N" PARAM -> "destination" | "netmask" | "iface" | "gateway" VALUE -> (value of the specified parameter) EXAMPLE: destination_1=192.168.2.0 gateway_1=192.168.1.56 netmask_1=255.255.255.0 iface_1=eth0 destination_2=10.11.0.0 gateway_2=10.11.10.1 netmask_2=255.255.0.0 iface_2=eth1


Field Summary
static java.lang.String SERVICE_NAME
          service name of this interface for the bundle activator
 
Method Summary
 void addStaticRoute(java.net.InetAddress destination, java.net.InetAddress gateway, java.net.InetAddress netmask, java.lang.String iface, int metric)
          Adds a static route to the system's route table.
 java.lang.String getDefaultInterface(java.net.InetAddress destination)
          Returns the default route's interface for the specified destination address, or null if no route exists.
 Route getDefaultRoute(java.lang.String iface)
          Returns the default route for a specified interface.
 Route[] getRoutes()
          Returns the routes contained in the system's route table.
 void removeStaticRoute(java.net.InetAddress destination, java.net.InetAddress gateway, java.net.InetAddress netmask, java.lang.String iface)
          Removes a static route in the system's route table.
 

Field Detail

SERVICE_NAME

static final java.lang.String SERVICE_NAME
service name of this interface for the bundle activator

Method Detail

getDefaultRoute

Route getDefaultRoute(java.lang.String iface)
Returns the default route for a specified interface.

Parameters:
iface - A String object specifying the interface name.
Returns:
A Route object representing the default route or null if none exists.

getDefaultInterface

java.lang.String getDefaultInterface(java.net.InetAddress destination)
Returns the default route's interface for the specified destination address, or null if no route exists.

Parameters:
destination - An InetAddress object representing the destination IP address.
Returns:
A String object specifying the interface name, null if no route exists.

addStaticRoute

void addStaticRoute(java.net.InetAddress destination,
                    java.net.InetAddress gateway,
                    java.net.InetAddress netmask,
                    java.lang.String iface,
                    int metric)
                    throws java.lang.Exception
Adds a static route to the system's route table.

Parameters:
destination - An InetAddress object representing the destination IP address.
gateway - An InetAddress object representing the gateway IP address.
netmask - An InetAddress object representing the netmask.
iface - A String object specifying the interface name.
metric - An int representing the metric (priority) of the route.
Throws:
java.lang.Exception - for invalid supplied parameters, or failure to add.

removeStaticRoute

void removeStaticRoute(java.net.InetAddress destination,
                       java.net.InetAddress gateway,
                       java.net.InetAddress netmask,
                       java.lang.String iface)
                       throws java.lang.Exception
Removes a static route in the system's route table.

Parameters:
destination - An InetAddress object representing the destination IP address.
gateway - An InetAddress object representing the gateway IP address.
netmask - An InetAddress object representing the netmask.
iface - A String object specifying the interface name.
Throws:
java.lang.Exception - for invalid supplied parameters, or failure to remove.

getRoutes

Route[] getRoutes()
Returns the routes contained in the system's route table.

Returns:
An array of Route objects representing the system's route table, null if no routes exist.