summaryrefslogtreecommitdiffstats
path: root/core/java/android/net/LinkProperties.java
diff options
context:
space:
mode:
authorsy.yun <sy.yun@lge.com>2013-09-02 05:24:09 +0900
committerRobert Greenwalt <rgreenwalt@google.com>2013-09-06 15:26:19 -0700
commit9d9b74a900696191048aa97cc3c854072640428b (patch)
tree1815a7074f214063f349a3841c159374c4c22d88 /core/java/android/net/LinkProperties.java
parenta680b17fb4906570f280d4f06c0d8840a37b709a (diff)
downloadframeworks_base-9d9b74a900696191048aa97cc3c854072640428b.zip
frameworks_base-9d9b74a900696191048aa97cc3c854072640428b.tar.gz
frameworks_base-9d9b74a900696191048aa97cc3c854072640428b.tar.bz2
Setting MTU size for specific network.
Able to config network specific MTU size. Normally, the default size of MTU is 1500. US - ATT 1410, TMUS 1440, SPRINT 1422 KR - SKT 1440, KT 1450, LGU+ 1428 JP - KDDI 1420, SoftBank 1340 CA - RGS 1430, FIDO 1430, MTS 1430, BELL 1358, SaskTel 1358 AU - TEL 1400 Bug: 10195070 Change-Id: Ie18650b37a3d44af944f2dae4aa97c04fb12cd5e
Diffstat (limited to 'core/java/android/net/LinkProperties.java')
-rw-r--r--core/java/android/net/LinkProperties.java35
1 files changed, 31 insertions, 4 deletions
diff --git a/core/java/android/net/LinkProperties.java b/core/java/android/net/LinkProperties.java
index 43d6b71..284e1a7 100644
--- a/core/java/android/net/LinkProperties.java
+++ b/core/java/android/net/LinkProperties.java
@@ -66,6 +66,7 @@ public class LinkProperties implements Parcelable {
private String mDomains;
private Collection<RouteInfo> mRoutes = new ArrayList<RouteInfo>();
private ProxyProperties mHttpProxy;
+ private int mMtu;
// Stores the properties of links that are "stacked" above this link.
// Indexed by interface name to allow modification and to prevent duplicates being added.
@@ -104,6 +105,7 @@ public class LinkProperties implements Parcelable {
for (LinkProperties l: source.mStackedLinks.values()) {
addStackedLink(l);
}
+ setMtu(source.getMtu());
}
}
@@ -223,6 +225,14 @@ public class LinkProperties implements Parcelable {
mDomains = domains;
}
+ public void setMtu(int mtu) {
+ mMtu = mtu;
+ }
+
+ public int getMtu() {
+ return mMtu;
+ }
+
private RouteInfo routeWithInterface(RouteInfo route) {
return new RouteInfo(
route.getDestination(),
@@ -322,6 +332,7 @@ public class LinkProperties implements Parcelable {
mRoutes.clear();
mHttpProxy = null;
mStackedLinks.clear();
+ mMtu = 0;
}
/**
@@ -346,6 +357,8 @@ public class LinkProperties implements Parcelable {
String domainName = "Domains: " + mDomains;
+ String mtu = "MTU: " + mMtu;
+
String routes = " Routes: [";
for (RouteInfo route : mRoutes) routes += route.toString() + ",";
routes += "] ";
@@ -359,7 +372,8 @@ public class LinkProperties implements Parcelable {
}
stacked += "] ";
}
- return "{" + ifaceName + linkAddresses + routes + dns + domainName + proxy + stacked + "}";
+ return "{" + ifaceName + linkAddresses + routes + dns + domainName + mtu
+ + proxy + stacked + "}";
}
/**
@@ -474,6 +488,16 @@ public class LinkProperties implements Parcelable {
return true;
}
+ /**
+ * Compares this {@code LinkProperties} MTU against the target
+ *
+ * @@param target LinkProperties to compare.
+ * @return {@code true} if both are identical, {@code false} otherwise.
+ */
+ public boolean isIdenticalMtu(LinkProperties target) {
+ return getMtu() == target.getMtu();
+ }
+
@Override
/**
* Compares this {@code LinkProperties} instance against the target
@@ -505,7 +529,8 @@ public class LinkProperties implements Parcelable {
isIdenticalDnses(target) &&
isIdenticalRoutes(target) &&
isIdenticalHttpProxy(target) &&
- isIdenticalStackedLinks(target);
+ isIdenticalStackedLinks(target) &&
+ isIdenticalMtu(target);
}
/**
@@ -607,7 +632,8 @@ public class LinkProperties implements Parcelable {
+ ((null == mDomains) ? 0 : mDomains.hashCode())
+ mRoutes.size() * 41
+ ((null == mHttpProxy) ? 0 : mHttpProxy.hashCode())
- + mStackedLinks.hashCode() * 47);
+ + mStackedLinks.hashCode() * 47)
+ + mMtu * 51;
}
/**
@@ -625,7 +651,7 @@ public class LinkProperties implements Parcelable {
dest.writeByteArray(d.getAddress());
}
dest.writeString(mDomains);
-
+ dest.writeInt(mMtu);
dest.writeInt(mRoutes.size());
for(RouteInfo route : mRoutes) {
dest.writeParcelable(route, flags);
@@ -664,6 +690,7 @@ public class LinkProperties implements Parcelable {
} catch (UnknownHostException e) { }
}
netProp.setDomains(in.readString());
+ netProp.setMtu(in.readInt());
addressCount = in.readInt();
for (int i=0; i<addressCount; i++) {
netProp.addRoute((RouteInfo)in.readParcelable(null));