summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorRobert Greenwalt <rgreenwalt@google.com>2012-11-16 12:56:56 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-11-16 12:56:56 -0800
commit60bfacd8ef765f7f8ee43224a9d85960dea2b1c8 (patch)
treeddbf2c00c4892cfd2f54b429c2dd4fbe80e738e0 /core/java
parentf9f1ca9e969af7da2144c880cc093cc7a5f1c90d (diff)
parent8058f621891b41c6864b6004c1c47647436a0ac1 (diff)
downloadframeworks_base-60bfacd8ef765f7f8ee43224a9d85960dea2b1c8.zip
frameworks_base-60bfacd8ef765f7f8ee43224a9d85960dea2b1c8.tar.gz
frameworks_base-60bfacd8ef765f7f8ee43224a9d85960dea2b1c8.tar.bz2
Merge "Support for dns domain."
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/net/DhcpResults.java3
-rw-r--r--core/java/android/net/LinkProperties.java28
-rw-r--r--core/java/android/os/INetworkManagementService.aidl2
3 files changed, 29 insertions, 4 deletions
diff --git a/core/java/android/net/DhcpResults.java b/core/java/android/net/DhcpResults.java
index 23297df..2f300de 100644
--- a/core/java/android/net/DhcpResults.java
+++ b/core/java/android/net/DhcpResults.java
@@ -238,4 +238,7 @@ public class DhcpResults implements Parcelable {
vendorInfo = info;
}
+ public void setDomains(String domains) {
+ linkProperties.setDomains(domains);
+ }
}
diff --git a/core/java/android/net/LinkProperties.java b/core/java/android/net/LinkProperties.java
index 60bf640..b9362da 100644
--- a/core/java/android/net/LinkProperties.java
+++ b/core/java/android/net/LinkProperties.java
@@ -54,6 +54,7 @@ public class LinkProperties implements Parcelable {
private String mIfaceName;
private Collection<LinkAddress> mLinkAddresses = new ArrayList<LinkAddress>();
private Collection<InetAddress> mDnses = new ArrayList<InetAddress>();
+ private String mDomains;
private Collection<RouteInfo> mRoutes = new ArrayList<RouteInfo>();
private ProxyProperties mHttpProxy;
@@ -82,9 +83,10 @@ public class LinkProperties implements Parcelable {
mIfaceName = source.getInterfaceName();
for (LinkAddress l : source.getLinkAddresses()) mLinkAddresses.add(l);
for (InetAddress i : source.getDnses()) mDnses.add(i);
+ mDomains = source.getDomains();
for (RouteInfo r : source.getRoutes()) mRoutes.add(r);
mHttpProxy = (source.getHttpProxy() == null) ?
- null : new ProxyProperties(source.getHttpProxy());
+ null : new ProxyProperties(source.getHttpProxy());
}
}
@@ -120,6 +122,14 @@ public class LinkProperties implements Parcelable {
return Collections.unmodifiableCollection(mDnses);
}
+ public String getDomains() {
+ return mDomains;
+ }
+
+ public void setDomains(String domains) {
+ mDomains = domains;
+ }
+
public void addRoute(RouteInfo route) {
if (route != null) mRoutes.add(route);
}
@@ -138,6 +148,7 @@ public class LinkProperties implements Parcelable {
mIfaceName = null;
mLinkAddresses.clear();
mDnses.clear();
+ mDomains = null;
mRoutes.clear();
mHttpProxy = null;
}
@@ -162,12 +173,14 @@ public class LinkProperties implements Parcelable {
for (InetAddress addr : mDnses) dns += addr.getHostAddress() + ",";
dns += "] ";
- String routes = "Routes: [";
+ String domainName = "Domains: " + mDomains;
+
+ String routes = " Routes: [";
for (RouteInfo route : mRoutes) routes += route.toString() + ",";
routes += "] ";
String proxy = (mHttpProxy == null ? "" : "HttpProxy: " + mHttpProxy.toString() + " ");
- return ifaceName + linkAddresses + routes + dns + proxy;
+ return ifaceName + linkAddresses + routes + dns + domainName + proxy;
}
/**
@@ -201,6 +214,12 @@ public class LinkProperties implements Parcelable {
*/
public boolean isIdenticalDnses(LinkProperties target) {
Collection<InetAddress> targetDnses = target.getDnses();
+ String targetDomains = target.getDomains();
+ if (mDomains == null) {
+ if (targetDomains != null) return false;
+ } else {
+ if (mDomains.equals(targetDomains) == false) return false;
+ }
return (mDnses.size() == targetDnses.size()) ?
mDnses.containsAll(targetDnses) : false;
}
@@ -359,6 +378,7 @@ public class LinkProperties implements Parcelable {
return ((null == mIfaceName) ? 0 : mIfaceName.hashCode()
+ mLinkAddresses.size() * 31
+ mDnses.size() * 37
+ + ((null == mDomains) ? 0 : mDomains.hashCode())
+ mRoutes.size() * 41
+ ((null == mHttpProxy) ? 0 : mHttpProxy.hashCode()));
}
@@ -377,6 +397,7 @@ public class LinkProperties implements Parcelable {
for(InetAddress d : mDnses) {
dest.writeByteArray(d.getAddress());
}
+ dest.writeString(mDomains);
dest.writeInt(mRoutes.size());
for(RouteInfo route : mRoutes) {
@@ -413,6 +434,7 @@ public class LinkProperties implements Parcelable {
netProp.addDns(InetAddress.getByAddress(in.createByteArray()));
} catch (UnknownHostException e) { }
}
+ netProp.setDomains(in.readString());
addressCount = in.readInt();
for (int i=0; i<addressCount; i++) {
netProp.addRoute((RouteInfo)in.readParcelable(null));
diff --git a/core/java/android/os/INetworkManagementService.aidl b/core/java/android/os/INetworkManagementService.aidl
index 2179fa1..80abd0f 100644
--- a/core/java/android/os/INetworkManagementService.aidl
+++ b/core/java/android/os/INetworkManagementService.aidl
@@ -351,7 +351,7 @@ interface INetworkManagementService
/**
* Bind name servers to an interface in the DNS resolver.
*/
- void setDnsServersForInterface(String iface, in String[] servers);
+ void setDnsServersForInterface(String iface, in String[] servers, String domains);
/**
* Flush the DNS cache associated with the default interface.