com.eurotech.framework.linux.net.route
Interface IRouteService

All Known Implementing Classes:
RouteServiceImpl

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 String SERVICE_NAME
          service name of this interface for the bundle activator
 
Method Summary
 void addStaticRoute(IPAddress destination, IPAddress gateway, IPAddress netmask, String iface, int metric)
          Adds a static route to the system's route table.
 String getDefaultInterface(IPAddress destination)
          Returns the default route's interface for the specified destination address, or null if no route exists.
 RouteConfig getDefaultRoute(String interfaceName)
          Returns the default route for a specified interface.
 RouteConfig[] getRoutes()
          Returns the routes contained in the system's route table.
 void removeStaticRoute(IPAddress destination, IPAddress gateway, IPAddress netmask, String iface)
          Removes a static route in the system's route table.
 

Field Detail

SERVICE_NAME

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

Method Detail

getDefaultRoute

RouteConfig getDefaultRoute(String interfaceName)
Returns the default route for a specified interface.

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

getDefaultInterface

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

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

addStaticRoute

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

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

removeStaticRoute

void removeStaticRoute(IPAddress destination,
                       IPAddress gateway,
                       IPAddress netmask,
                       String iface)
                       throws 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:
Exception - for invalid supplied parameters, or failure to remove.

getRoutes

RouteConfig[] 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.


Copyright © 2013. All Rights Reserved.