|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.net.NetworkUtils
public class NetworkUtils
Native methods for managing network interfaces.
| Constructor Summary | |
|---|---|
NetworkUtils()
|
|
| Method Summary | |
|---|---|
static int |
addHostRoute(String interfaceName,
int hostaddr)
Add a route to the specified host via the named interface. |
static boolean |
configureInterface(String interfaceName,
DhcpInfo ipInfo)
When static IP configuration has been specified, configure the network interface according to the values supplied. |
static int |
disableInterface(String interfaceName)
Bring the named network interface down. |
static int |
getDefaultRoute(String interfaceName)
Return the gateway address for the default route for the named interface. |
static String |
getDhcpError()
Return the last DHCP-related error message that was recorded. |
static int |
lookupHost(String hostname)
Look up a host name and return the result as an int. |
static int |
removeDefaultRoute(String interfaceName)
Remove the default route for the named interface. |
static int |
removeHostRoutes(String interfaceName)
Remove host routes that uses the named interface. |
static int |
resetConnections(String interfaceName)
Reset any sockets that are connected via the named interface. |
static boolean |
runDhcp(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. |
static int |
setDefaultRoute(String interfaceName,
int gwayAddr)
Add a default route for the named interface. |
static boolean |
stopDhcp(String interfaceName)
Shut down the DHCP client daemon. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public NetworkUtils()
| Method Detail |
|---|
public static int disableInterface(String interfaceName)
public static int addHostRoute(String interfaceName,
int hostaddr)
public static int setDefaultRoute(String interfaceName,
int gwayAddr)
public static int getDefaultRoute(String interfaceName)
public static int removeHostRoutes(String interfaceName)
public static int removeDefaultRoute(String interfaceName)
public static int resetConnections(String interfaceName)
public static boolean runDhcp(String interfaceName,
DhcpInfo ipInfo)
interfaceName - the name of the interface to configureipInfo - if the request succeeds, this object is filled in with
the IP address information.
true for success, false for failurepublic static boolean stopDhcp(String interfaceName)
interfaceName - the name of the interface for which the daemon
should be stopped
true for success, false for failurepublic static String getDhcpError()
public static boolean configureInterface(String interfaceName,
DhcpInfo ipInfo)
interfaceName - the name of the interface to configureipInfo - the IP address, default gateway, and DNS server addresses
with which to configure the interface.
true for success, false for failurepublic static int lookupHost(String hostname)
hostname - the name of the host (or the IP address)
int in network byte order
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||