Merge "Switch from NetworkUtils to netd for iface config."

This commit is contained in:
Robert Greenwalt
2011-01-21 12:06:16 -08:00
committed by Android (Google) Code Review
2 changed files with 0 additions and 40 deletions

View File

@@ -103,26 +103,6 @@ public class NetworkUtils {
*/
public native static String getDhcpError();
/**
* When static IP configuration has been specified, configure the network
* interface according to the values supplied.
* @param interfaceName the name of the interface to configure
* @param ipInfo the IP address, default gateway, and DNS server addresses
* with which to configure the interface.
* @return {@code true} for success, {@code false} for failure
*/
public static boolean configureInterface(String interfaceName, DhcpInfo ipInfo) {
return configureNative(interfaceName,
ipInfo.ipAddress,
ipInfo.netmask,
ipInfo.gateway,
ipInfo.dns1,
ipInfo.dns2);
}
private native static boolean configureNative(
String interfaceName, int ipAddress, int netmask, int gateway, int dns1, int dns2);
/**
* Convert a IPv4 address from an integer to an InetAddress.
* @param hostAddress an int corresponding to the IPv4 address in network byte order

View File

@@ -30,7 +30,6 @@ int ifc_remove_host_routes(const char *ifname);
int ifc_get_default_route(const char *ifname);
int ifc_remove_default_route(const char *ifname);
int ifc_reset_connections(const char *ifname);
int ifc_configure(const char *ifname, in_addr_t ipaddr, in_addr_t netmask, in_addr_t gateway, in_addr_t dns1, in_addr_t dns2);
int dhcp_do_request(const char *ifname,
in_addr_t *ipaddr,
@@ -193,24 +192,6 @@ static jstring android_net_utils_getDhcpError(JNIEnv* env, jobject clazz)
return env->NewStringUTF(::dhcp_get_errmsg());
}
static jboolean android_net_utils_configureInterface(JNIEnv* env,
jobject clazz,
jstring ifname,
jint ipaddr,
jint mask,
jint gateway,
jint dns1,
jint dns2)
{
int result;
uint32_t lease;
const char *nameStr = env->GetStringUTFChars(ifname, NULL);
result = ::ifc_configure(nameStr, ipaddr, mask, gateway, dns1, dns2);
env->ReleaseStringUTFChars(ifname, nameStr);
return (jboolean)(result == 0);
}
// ----------------------------------------------------------------------------
/*
@@ -231,7 +212,6 @@ static JNINativeMethod gNetworkUtilMethods[] = {
{ "runDhcp", "(Ljava/lang/String;Landroid/net/DhcpInfo;)Z", (void *)android_net_utils_runDhcp },
{ "stopDhcp", "(Ljava/lang/String;)Z", (void *)android_net_utils_stopDhcp },
{ "releaseDhcpLease", "(Ljava/lang/String;)Z", (void *)android_net_utils_releaseDhcpLease },
{ "configureNative", "(Ljava/lang/String;IIIII)Z", (void *)android_net_utils_configureInterface },
{ "getDhcpError", "()Ljava/lang/String;", (void*) android_net_utils_getDhcpError },
};