summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2012-04-18 21:55:14 -0700
committerJeff Sharkey <jsharkey@android.com>2012-04-18 21:55:14 -0700
commit77b87ba0bc1c5de025976416b49e698ed9362814 (patch)
tree0bd7c5a5a8c2ae5f9c7a078b151d144042d6aff8 /core
parent83cb5807b0eaa36b417ce5c978e4e460b1fcc9e2 (diff)
downloadframeworks_base-77b87ba0bc1c5de025976416b49e698ed9362814.zip
frameworks_base-77b87ba0bc1c5de025976416b49e698ed9362814.tar.gz
frameworks_base-77b87ba0bc1c5de025976416b49e698ed9362814.tar.bz2
Pipe DHCP vendor info towards framework.
Bug: 6344821 Change-Id: Ifb9a93c995f4d70f4ae2aa03b7e21f13013ef3b6
Diffstat (limited to 'core')
-rw-r--r--core/java/android/net/DhcpInfoInternal.java8
-rw-r--r--core/jni/android_net_NetUtils.cpp18
2 files changed, 18 insertions, 8 deletions
diff --git a/core/java/android/net/DhcpInfoInternal.java b/core/java/android/net/DhcpInfoInternal.java
index fa77bc5..7ab8047 100644
--- a/core/java/android/net/DhcpInfoInternal.java
+++ b/core/java/android/net/DhcpInfoInternal.java
@@ -19,9 +19,8 @@ package android.net;
import android.text.TextUtils;
import android.util.Log;
-import java.net.InetAddress;
import java.net.Inet4Address;
-import java.net.UnknownHostException;
+import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -42,6 +41,11 @@ public class DhcpInfoInternal {
public String serverAddress;
public int leaseDuration;
+ /**
+ * Vendor specific information (from RFC 2132).
+ */
+ public String vendorInfo;
+
private Collection<RouteInfo> mRoutes;
public DhcpInfoInternal() {
diff --git a/core/jni/android_net_NetUtils.cpp b/core/jni/android_net_NetUtils.cpp
index 724d9fb..1f2b1ae 100644
--- a/core/jni/android_net_NetUtils.cpp
+++ b/core/jni/android_net_NetUtils.cpp
@@ -31,20 +31,22 @@ int ifc_reset_connections(const char *ifname, int reset_mask);
int dhcp_do_request(const char *ifname,
const char *ipaddr,
const char *gateway,
- uint32_t *prefixLength,
+ uint32_t *prefixLength,
const char *dns1,
const char *dns2,
const char *server,
- uint32_t *lease);
+ uint32_t *lease,
+ const char *vendorInfo);
int dhcp_do_request_renew(const char *ifname,
const char *ipaddr,
const char *gateway,
- uint32_t *prefixLength,
+ uint32_t *prefixLength,
const char *dns1,
const char *dns2,
const char *server,
- uint32_t *lease);
+ uint32_t *lease,
+ const char *vendorInfo);
int dhcp_stop(const char *ifname);
int dhcp_release_lease(const char *ifname);
@@ -68,6 +70,7 @@ static struct fieldIds {
jfieldID dns2;
jfieldID serverAddress;
jfieldID leaseDuration;
+ jfieldID vendorInfo;
} dhcpInfoInternalFieldIds;
static jint android_net_utils_enableInterface(JNIEnv* env, jobject clazz, jstring ifname)
@@ -116,16 +119,17 @@ static jboolean android_net_utils_runDhcpCommon(JNIEnv* env, jobject clazz, jstr
char dns2[PROPERTY_VALUE_MAX];
char server[PROPERTY_VALUE_MAX];
uint32_t lease;
+ char vendorInfo[PROPERTY_VALUE_MAX];
const char *nameStr = env->GetStringUTFChars(ifname, NULL);
if (nameStr == NULL) return (jboolean)false;
if (renew) {
result = ::dhcp_do_request_renew(nameStr, ipaddr, gateway, &prefixLength,
- dns1, dns2, server, &lease);
+ dns1, dns2, server, &lease, vendorInfo);
} else {
result = ::dhcp_do_request(nameStr, ipaddr, gateway, &prefixLength,
- dns1, dns2, server, &lease);
+ dns1, dns2, server, &lease, vendorInfo);
}
env->ReleaseStringUTFChars(ifname, nameStr);
@@ -161,6 +165,7 @@ static jboolean android_net_utils_runDhcpCommon(JNIEnv* env, jobject clazz, jstr
env->SetObjectField(info, dhcpInfoInternalFieldIds.serverAddress,
env->NewStringUTF(server));
env->SetIntField(info, dhcpInfoInternalFieldIds.leaseDuration, lease);
+ env->SetObjectField(info, dhcpInfoInternalFieldIds.vendorInfo, env->NewStringUTF(vendorInfo));
}
return (jboolean)(result == 0);
}
@@ -230,6 +235,7 @@ int register_android_net_NetworkUtils(JNIEnv* env)
dhcpInfoInternalFieldIds.dns2 = env->GetFieldID(dhcpInfoInternalClass, "dns2", "Ljava/lang/String;");
dhcpInfoInternalFieldIds.serverAddress = env->GetFieldID(dhcpInfoInternalClass, "serverAddress", "Ljava/lang/String;");
dhcpInfoInternalFieldIds.leaseDuration = env->GetFieldID(dhcpInfoInternalClass, "leaseDuration", "I");
+ dhcpInfoInternalFieldIds.vendorInfo = env->GetFieldID(dhcpInfoInternalClass, "vendorInfo", "Ljava/lang/String;");
return AndroidRuntime::registerNativeMethods(env,
NETUTILS_PKG_NAME, gNetworkUtilMethods, NELEM(gNetworkUtilMethods));