Methods Summary |
---|
public static native int | addHostRoute(java.lang.String interfaceName, int hostaddr)Add a route to the specified host via the named interface.
|
public static boolean | configureInterface(java.lang.String interfaceName, DhcpInfo ipInfo)When static IP configuration has been specified, configure the network
interface according to the values supplied.
return configureNative(interfaceName,
ipInfo.ipAddress,
ipInfo.netmask,
ipInfo.gateway,
ipInfo.dns1,
ipInfo.dns2);
|
private static native boolean | configureNative(java.lang.String interfaceName, int ipAddress, int netmask, int gateway, int dns1, int dns2)
|
public static native int | disableInterface(java.lang.String interfaceName)Bring the named network interface down.
|
public static native int | getDefaultRoute(java.lang.String interfaceName)Return the gateway address for the default route for the named interface.
|
public static native java.lang.String | getDhcpError()Return the last DHCP-related error message that was recorded.
NOTE: This string is not localized, but currently it is only
used in logging.
|
public static int | lookupHost(java.lang.String hostname)Look up a host name and return the result as an int. Works if the argument
is an IP address in dot notation. Obviously, this can only be used for IPv4
addresses.
InetAddress inetAddress;
try {
inetAddress = InetAddress.getByName(hostname);
} catch (UnknownHostException e) {
return -1;
}
byte[] addrBytes;
int addr;
addrBytes = inetAddress.getAddress();
addr = ((addrBytes[3] & 0xff) << 24)
| ((addrBytes[2] & 0xff) << 16)
| ((addrBytes[1] & 0xff) << 8)
| (addrBytes[0] & 0xff);
return addr;
|
public static native boolean | releaseDhcpLease(java.lang.String interfaceName)Release the current DHCP lease.
|
public static native int | removeDefaultRoute(java.lang.String interfaceName)Remove the default route for the named interface.
|
public static native int | removeHostRoutes(java.lang.String interfaceName)Remove host routes that uses the named interface.
|
public static native int | resetConnections(java.lang.String interfaceName)Reset any sockets that are connected via the named interface.
|
public static native boolean | runDhcp(java.lang.String interfaceName, DhcpInfo ipInfo)Start the DHCP client daemon, in order to have it request addresses
for the named interface, and then configure the interface with those
addresses. This call blocks until it obtains a result (either success
or failure) from the daemon.
|
public static native int | setDefaultRoute(java.lang.String interfaceName, int gwayAddr)Add a default route for the named interface.
|
public static native boolean | stopDhcp(java.lang.String interfaceName)Shut down the DHCP client daemon.
|