blob: ec8d77e7578844b1bb5e7bffcde08eac3d435b9c [file] [log] [blame]
Robert Greenwalt47f69fe2010-06-15 15:43:39 -07001/*
Wink Saville6e809972010-09-21 09:15:35 -07002 * Copyright (C) 2010 The Android Open Source Project
Robert Greenwalt47f69fe2010-06-15 15:43:39 -07003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.net;
18
Robert Greenwalt37e65eb2010-08-30 10:56:47 -070019import android.net.ProxyProperties;
Robert Greenwalt47f69fe2010-06-15 15:43:39 -070020import android.os.Parcelable;
21import android.os.Parcel;
John Wang4e900092011-04-04 12:35:42 -070022import android.text.TextUtils;
Robert Greenwalt47f69fe2010-06-15 15:43:39 -070023
24import java.net.InetAddress;
Robert Greenwalt47f69fe2010-06-15 15:43:39 -070025import java.net.UnknownHostException;
26import java.util.ArrayList;
27import java.util.Collection;
Robert Greenwalt37e65eb2010-08-30 10:56:47 -070028import java.util.Collections;
Robert Greenwalt47f69fe2010-06-15 15:43:39 -070029
30/**
Robert Greenwalt37e65eb2010-08-30 10:56:47 -070031 * Describes the properties of a network link.
Robert Greenwalt992564e2011-02-09 13:56:06 -080032 *
33 * A link represents a connection to a network.
34 * It may have multiple addresses and multiple gateways,
35 * multiple dns servers but only one http proxy.
36 *
37 * Because it's a single network, the dns's
38 * are interchangeable and don't need associating with
39 * particular addresses. The gateways similarly don't
40 * need associating with particular addresses.
41 *
42 * A dual stack interface works fine in this model:
43 * each address has it's own prefix length to describe
44 * the local network. The dns servers all return
45 * both v4 addresses and v6 addresses regardless of the
46 * address family of the server itself (rfc4213) and we
47 * don't care which is used. The gateways will be
48 * selected based on the destination address and the
49 * source address has no relavence.
Robert Greenwalt47f69fe2010-06-15 15:43:39 -070050 * @hide
51 */
Robert Greenwalt37e65eb2010-08-30 10:56:47 -070052public class LinkProperties implements Parcelable {
Robert Greenwalt47f69fe2010-06-15 15:43:39 -070053
Robert Greenwalt4717c262012-10-31 14:32:53 -070054 private String mIfaceName;
Wink Savillee8222252011-07-13 13:44:13 -070055 private Collection<LinkAddress> mLinkAddresses = new ArrayList<LinkAddress>();
56 private Collection<InetAddress> mDnses = new ArrayList<InetAddress>();
Robert Greenwalt8058f622012-11-09 10:52:27 -080057 private String mDomains;
Wink Savillee8222252011-07-13 13:44:13 -070058 private Collection<RouteInfo> mRoutes = new ArrayList<RouteInfo>();
Robert Greenwalt47f69fe2010-06-15 15:43:39 -070059 private ProxyProperties mHttpProxy;
60
Robert Greenwalt0a46db52011-07-14 14:28:05 -070061 public static class CompareResult<T> {
Robert Greenwaltad55d352011-07-22 11:55:33 -070062 public Collection<T> removed = new ArrayList<T>();
63 public Collection<T> added = new ArrayList<T>();
Wink Savillee8222252011-07-13 13:44:13 -070064
65 @Override
66 public String toString() {
Robert Greenwalt0a46db52011-07-14 14:28:05 -070067 String retVal = "removed=[";
68 for (T addr : removed) retVal += addr.toString() + ",";
69 retVal += "] added=[";
70 for (T addr : added) retVal += addr.toString() + ",";
Wink Savillee8222252011-07-13 13:44:13 -070071 retVal += "]";
72 return retVal;
73 }
74 }
75
Robert Greenwalt37e65eb2010-08-30 10:56:47 -070076 public LinkProperties() {
Robert Greenwalt47f69fe2010-06-15 15:43:39 -070077 clear();
78 }
79
Robert Greenwalt37e65eb2010-08-30 10:56:47 -070080 // copy constructor instead of clone
81 public LinkProperties(LinkProperties source) {
Irfan Sheriffef6c1432010-08-30 20:37:17 -070082 if (source != null) {
Irfan Sheriffed5d7d12010-10-01 16:08:28 -070083 mIfaceName = source.getInterfaceName();
Robert Greenwalt0d8acea2011-07-28 17:21:25 -070084 for (LinkAddress l : source.getLinkAddresses()) mLinkAddresses.add(l);
85 for (InetAddress i : source.getDnses()) mDnses.add(i);
Robert Greenwalt8058f622012-11-09 10:52:27 -080086 mDomains = source.getDomains();
Robert Greenwalt0d8acea2011-07-28 17:21:25 -070087 for (RouteInfo r : source.getRoutes()) mRoutes.add(r);
Wink Savillebe2b0582011-05-18 15:59:04 -070088 mHttpProxy = (source.getHttpProxy() == null) ?
Robert Greenwalt8058f622012-11-09 10:52:27 -080089 null : new ProxyProperties(source.getHttpProxy());
Irfan Sheriffef6c1432010-08-30 20:37:17 -070090 }
Robert Greenwalt37e65eb2010-08-30 10:56:47 -070091 }
92
Irfan Sheriffed5d7d12010-10-01 16:08:28 -070093 public void setInterfaceName(String iface) {
94 mIfaceName = iface;
Lorenzo Colitti45b9a5b2013-03-08 11:30:39 -080095 ArrayList<RouteInfo> newRoutes = new ArrayList<RouteInfo>(mRoutes.size());
96 for (RouteInfo route : mRoutes) {
97 newRoutes.add(routeWithInterface(route));
98 }
99 mRoutes = newRoutes;
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700100 }
101
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700102 public String getInterfaceName() {
103 return mIfaceName;
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700104 }
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700105
Robert Greenwalt37e65eb2010-08-30 10:56:47 -0700106 public Collection<InetAddress> getAddresses() {
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700107 Collection<InetAddress> addresses = new ArrayList<InetAddress>();
108 for (LinkAddress linkAddress : mLinkAddresses) {
109 addresses.add(linkAddress.getAddress());
110 }
111 return Collections.unmodifiableCollection(addresses);
112 }
113
114 public void addLinkAddress(LinkAddress address) {
Robert Greenwalt04cac402011-03-02 17:03:37 -0800115 if (address != null) mLinkAddresses.add(address);
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700116 }
117
118 public Collection<LinkAddress> getLinkAddresses() {
119 return Collections.unmodifiableCollection(mLinkAddresses);
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700120 }
121
Robert Greenwalt37e65eb2010-08-30 10:56:47 -0700122 public void addDns(InetAddress dns) {
Robert Greenwalt04cac402011-03-02 17:03:37 -0800123 if (dns != null) mDnses.add(dns);
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700124 }
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700125
Robert Greenwalt37e65eb2010-08-30 10:56:47 -0700126 public Collection<InetAddress> getDnses() {
127 return Collections.unmodifiableCollection(mDnses);
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700128 }
129
Robert Greenwalt8058f622012-11-09 10:52:27 -0800130 public String getDomains() {
131 return mDomains;
132 }
133
134 public void setDomains(String domains) {
135 mDomains = domains;
136 }
137
Lorenzo Colitti45b9a5b2013-03-08 11:30:39 -0800138 private RouteInfo routeWithInterface(RouteInfo route) {
139 return new RouteInfo(
140 route.getDestination(),
141 route.getGateway(),
142 mIfaceName);
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700143 }
Lorenzo Colitti45b9a5b2013-03-08 11:30:39 -0800144
145 public void addRoute(RouteInfo route) {
146 if (route != null) {
147 String routeIface = route.getInterface();
148 if (routeIface != null && !routeIface.equals(mIfaceName)) {
149 throw new IllegalStateException(
150 "Route added with non-matching interface: " + routeIface +
151 " vs. mIfaceName");
152 }
153 mRoutes.add(routeWithInterface(route));
154 }
155 }
156
Robert Greenwaltaa70f102011-04-28 14:28:50 -0700157 public Collection<RouteInfo> getRoutes() {
158 return Collections.unmodifiableCollection(mRoutes);
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700159 }
160
Robert Greenwalt37e65eb2010-08-30 10:56:47 -0700161 public void setHttpProxy(ProxyProperties proxy) {
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700162 mHttpProxy = proxy;
163 }
Robert Greenwalt37e65eb2010-08-30 10:56:47 -0700164 public ProxyProperties getHttpProxy() {
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700165 return mHttpProxy;
166 }
167
Robert Greenwalt37e65eb2010-08-30 10:56:47 -0700168 public void clear() {
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700169 mIfaceName = null;
Wink Savillee8222252011-07-13 13:44:13 -0700170 mLinkAddresses.clear();
171 mDnses.clear();
Robert Greenwalt8058f622012-11-09 10:52:27 -0800172 mDomains = null;
Wink Savillee8222252011-07-13 13:44:13 -0700173 mRoutes.clear();
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700174 mHttpProxy = null;
175 }
176
177 /**
178 * Implement the Parcelable interface
179 * @hide
180 */
181 public int describeContents() {
182 return 0;
183 }
184
Wink Saville1f6408a2010-08-27 11:15:18 -0700185 @Override
Robert Greenwalt37e65eb2010-08-30 10:56:47 -0700186 public String toString() {
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700187 String ifaceName = (mIfaceName == null ? "" : "InterfaceName: " + mIfaceName + " ");
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700188
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700189 String linkAddresses = "LinkAddresses: [";
John Wang4e900092011-04-04 12:35:42 -0700190 for (LinkAddress addr : mLinkAddresses) linkAddresses += addr.toString() + ",";
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700191 linkAddresses += "] ";
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700192
193 String dns = "DnsAddresses: [";
Wink Saville1f6408a2010-08-27 11:15:18 -0700194 for (InetAddress addr : mDnses) dns += addr.getHostAddress() + ",";
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700195 dns += "] ";
196
Robert Greenwalt8058f622012-11-09 10:52:27 -0800197 String domainName = "Domains: " + mDomains;
198
199 String routes = " Routes: [";
Robert Greenwaltaa70f102011-04-28 14:28:50 -0700200 for (RouteInfo route : mRoutes) routes += route.toString() + ",";
201 routes += "] ";
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700202 String proxy = (mHttpProxy == null ? "" : "HttpProxy: " + mHttpProxy.toString() + " ");
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700203
Robert Greenwalt8058f622012-11-09 10:52:27 -0800204 return ifaceName + linkAddresses + routes + dns + domainName + proxy;
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700205 }
206
Wink Savillee8222252011-07-13 13:44:13 -0700207 /**
208 * Compares this {@code LinkProperties} interface name against the target
209 *
210 * @param target LinkProperties to compare.
211 * @return {@code true} if both are identical, {@code false} otherwise.
212 */
213 public boolean isIdenticalInterfaceName(LinkProperties target) {
214 return TextUtils.equals(getInterfaceName(), target.getInterfaceName());
215 }
216
217 /**
Robert Greenwalt4717c262012-10-31 14:32:53 -0700218 * Compares this {@code LinkProperties} interface addresses against the target
Wink Savillee8222252011-07-13 13:44:13 -0700219 *
220 * @param target LinkProperties to compare.
221 * @return {@code true} if both are identical, {@code false} otherwise.
222 */
223 public boolean isIdenticalAddresses(LinkProperties target) {
224 Collection<InetAddress> targetAddresses = target.getAddresses();
225 Collection<InetAddress> sourceAddresses = getAddresses();
226 return (sourceAddresses.size() == targetAddresses.size()) ?
227 sourceAddresses.containsAll(targetAddresses) : false;
228 }
229
230 /**
231 * Compares this {@code LinkProperties} DNS addresses against the target
232 *
233 * @param target LinkProperties to compare.
234 * @return {@code true} if both are identical, {@code false} otherwise.
235 */
236 public boolean isIdenticalDnses(LinkProperties target) {
237 Collection<InetAddress> targetDnses = target.getDnses();
Robert Greenwalt8058f622012-11-09 10:52:27 -0800238 String targetDomains = target.getDomains();
239 if (mDomains == null) {
240 if (targetDomains != null) return false;
241 } else {
242 if (mDomains.equals(targetDomains) == false) return false;
243 }
Wink Savillee8222252011-07-13 13:44:13 -0700244 return (mDnses.size() == targetDnses.size()) ?
245 mDnses.containsAll(targetDnses) : false;
246 }
247
248 /**
249 * Compares this {@code LinkProperties} Routes against the target
250 *
251 * @param target LinkProperties to compare.
252 * @return {@code true} if both are identical, {@code false} otherwise.
253 */
254 public boolean isIdenticalRoutes(LinkProperties target) {
255 Collection<RouteInfo> targetRoutes = target.getRoutes();
256 return (mRoutes.size() == targetRoutes.size()) ?
257 mRoutes.containsAll(targetRoutes) : false;
258 }
259
260 /**
261 * Compares this {@code LinkProperties} HttpProxy against the target
262 *
263 * @param target LinkProperties to compare.
264 * @return {@code true} if both are identical, {@code false} otherwise.
265 */
266 public boolean isIdenticalHttpProxy(LinkProperties target) {
267 return getHttpProxy() == null ? target.getHttpProxy() == null :
268 getHttpProxy().equals(target.getHttpProxy());
269 }
John Wang4e900092011-04-04 12:35:42 -0700270
271 @Override
272 /**
273 * Compares this {@code LinkProperties} instance against the target
274 * LinkProperties in {@code obj}. Two LinkPropertieses are equal if
275 * all their fields are equal in values.
276 *
277 * For collection fields, such as mDnses, containsAll() is used to check
278 * if two collections contains the same elements, independent of order.
279 * There are two thoughts regarding containsAll()
280 * 1. Duplicated elements. eg, (A, B, B) and (A, A, B) are equal.
281 * 2. Worst case performance is O(n^2).
282 *
283 * @param obj the object to be tested for equality.
284 * @return {@code true} if both objects are equal, {@code false} otherwise.
285 */
286 public boolean equals(Object obj) {
287 if (this == obj) return true;
288
289 if (!(obj instanceof LinkProperties)) return false;
290
John Wang4e900092011-04-04 12:35:42 -0700291 LinkProperties target = (LinkProperties) obj;
292
Wink Savillee8222252011-07-13 13:44:13 -0700293 return isIdenticalInterfaceName(target) &&
294 isIdenticalAddresses(target) &&
295 isIdenticalDnses(target) &&
296 isIdenticalRoutes(target) &&
297 isIdenticalHttpProxy(target);
298 }
John Wang4e900092011-04-04 12:35:42 -0700299
Wink Savillee8222252011-07-13 13:44:13 -0700300 /**
301 * Return two lists, a list of addresses that would be removed from
302 * mLinkAddresses and a list of addresses that would be added to
303 * mLinkAddress which would then result in target and mLinkAddresses
304 * being the same list.
305 *
Robert Greenwalt0a46db52011-07-14 14:28:05 -0700306 * @param target is a LinkProperties with the new list of addresses
Wink Savillee8222252011-07-13 13:44:13 -0700307 * @return the removed and added lists.
308 */
Robert Greenwalt0a46db52011-07-14 14:28:05 -0700309 public CompareResult<LinkAddress> compareAddresses(LinkProperties target) {
Wink Savillee8222252011-07-13 13:44:13 -0700310 /*
311 * Duplicate the LinkAddresses into removed, we will be removing
312 * address which are common between mLinkAddresses and target
313 * leaving the addresses that are different. And address which
314 * are in target but not in mLinkAddresses are placed in the
315 * addedAddresses.
316 */
Robert Greenwalt0a46db52011-07-14 14:28:05 -0700317 CompareResult<LinkAddress> result = new CompareResult<LinkAddress>();
Wink Savillee8222252011-07-13 13:44:13 -0700318 result.removed = new ArrayList<LinkAddress>(mLinkAddresses);
319 result.added.clear();
Robert Greenwalt0a46db52011-07-14 14:28:05 -0700320 if (target != null) {
321 for (LinkAddress newAddress : target.getLinkAddresses()) {
322 if (! result.removed.remove(newAddress)) {
323 result.added.add(newAddress);
324 }
Wink Savillee8222252011-07-13 13:44:13 -0700325 }
326 }
327 return result;
John Wang4e900092011-04-04 12:35:42 -0700328 }
329
Robert Greenwalt0a46db52011-07-14 14:28:05 -0700330 /**
331 * Return two lists, a list of dns addresses that would be removed from
332 * mDnses and a list of addresses that would be added to
333 * mDnses which would then result in target and mDnses
334 * being the same list.
335 *
336 * @param target is a LinkProperties with the new list of dns addresses
337 * @return the removed and added lists.
338 */
339 public CompareResult<InetAddress> compareDnses(LinkProperties target) {
340 /*
341 * Duplicate the InetAddresses into removed, we will be removing
342 * dns address which are common between mDnses and target
343 * leaving the addresses that are different. And dns address which
344 * are in target but not in mDnses are placed in the
345 * addedAddresses.
346 */
347 CompareResult<InetAddress> result = new CompareResult<InetAddress>();
348
349 result.removed = new ArrayList<InetAddress>(mDnses);
350 result.added.clear();
351 if (target != null) {
352 for (InetAddress newAddress : target.getDnses()) {
353 if (! result.removed.remove(newAddress)) {
354 result.added.add(newAddress);
355 }
356 }
357 }
358 return result;
359 }
360
361 /**
362 * Return two lists, a list of routes that would be removed from
363 * mRoutes and a list of routes that would be added to
364 * mRoutes which would then result in target and mRoutes
365 * being the same list.
366 *
367 * @param target is a LinkProperties with the new list of routes
368 * @return the removed and added lists.
369 */
370 public CompareResult<RouteInfo> compareRoutes(LinkProperties target) {
371 /*
372 * Duplicate the RouteInfos into removed, we will be removing
373 * routes which are common between mDnses and target
374 * leaving the routes that are different. And route address which
375 * are in target but not in mRoutes are placed in added.
376 */
377 CompareResult<RouteInfo> result = new CompareResult<RouteInfo>();
378
379 result.removed = new ArrayList<RouteInfo>(mRoutes);
380 result.added.clear();
381 if (target != null) {
382 for (RouteInfo r : target.getRoutes()) {
383 if (! result.removed.remove(r)) {
384 result.added.add(r);
385 }
386 }
387 }
388 return result;
389 }
390
391
John Wang4e900092011-04-04 12:35:42 -0700392 @Override
393 /**
394 * generate hashcode based on significant fields
395 * Equal objects must produce the same hash code, while unequal objects
396 * may have the same hash codes.
397 */
398 public int hashCode() {
399 return ((null == mIfaceName) ? 0 : mIfaceName.hashCode()
400 + mLinkAddresses.size() * 31
401 + mDnses.size() * 37
Robert Greenwalt8058f622012-11-09 10:52:27 -0800402 + ((null == mDomains) ? 0 : mDomains.hashCode())
Robert Greenwaltaa70f102011-04-28 14:28:50 -0700403 + mRoutes.size() * 41
John Wang4e900092011-04-04 12:35:42 -0700404 + ((null == mHttpProxy) ? 0 : mHttpProxy.hashCode()));
405 }
406
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700407 /**
408 * Implement the Parcelable interface.
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700409 */
Robert Greenwalt37e65eb2010-08-30 10:56:47 -0700410 public void writeToParcel(Parcel dest, int flags) {
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700411 dest.writeString(getInterfaceName());
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700412 dest.writeInt(mLinkAddresses.size());
413 for(LinkAddress linkAddress : mLinkAddresses) {
414 dest.writeParcelable(linkAddress, flags);
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700415 }
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700416
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700417 dest.writeInt(mDnses.size());
418 for(InetAddress d : mDnses) {
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700419 dest.writeByteArray(d.getAddress());
420 }
Robert Greenwalt8058f622012-11-09 10:52:27 -0800421 dest.writeString(mDomains);
Robert Greenwalt992564e2011-02-09 13:56:06 -0800422
Robert Greenwaltaa70f102011-04-28 14:28:50 -0700423 dest.writeInt(mRoutes.size());
424 for(RouteInfo route : mRoutes) {
425 dest.writeParcelable(route, flags);
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700426 }
Robert Greenwalt992564e2011-02-09 13:56:06 -0800427
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700428 if (mHttpProxy != null) {
429 dest.writeByte((byte)1);
430 dest.writeParcelable(mHttpProxy, flags);
431 } else {
432 dest.writeByte((byte)0);
433 }
434 }
435
436 /**
437 * Implement the Parcelable interface.
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700438 */
Robert Greenwalt37e65eb2010-08-30 10:56:47 -0700439 public static final Creator<LinkProperties> CREATOR =
440 new Creator<LinkProperties>() {
441 public LinkProperties createFromParcel(Parcel in) {
442 LinkProperties netProp = new LinkProperties();
Robert Greenwalt4717c262012-10-31 14:32:53 -0700443
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700444 String iface = in.readString();
445 if (iface != null) {
Robert Greenwalt4717c262012-10-31 14:32:53 -0700446 netProp.setInterfaceName(iface);
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700447 }
448 int addressCount = in.readInt();
449 for (int i=0; i<addressCount; i++) {
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700450 netProp.addLinkAddress((LinkAddress)in.readParcelable(null));
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700451 }
452 addressCount = in.readInt();
453 for (int i=0; i<addressCount; i++) {
454 try {
Irfan Sheriff1cf56ab2010-08-04 15:15:49 -0700455 netProp.addDns(InetAddress.getByAddress(in.createByteArray()));
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700456 } catch (UnknownHostException e) { }
457 }
Robert Greenwalt8058f622012-11-09 10:52:27 -0800458 netProp.setDomains(in.readString());
Robert Greenwalt992564e2011-02-09 13:56:06 -0800459 addressCount = in.readInt();
460 for (int i=0; i<addressCount; i++) {
Robert Greenwaltaa70f102011-04-28 14:28:50 -0700461 netProp.addRoute((RouteInfo)in.readParcelable(null));
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700462 }
463 if (in.readByte() == 1) {
464 netProp.setHttpProxy((ProxyProperties)in.readParcelable(null));
465 }
466 return netProp;
467 }
468
Robert Greenwalt37e65eb2010-08-30 10:56:47 -0700469 public LinkProperties[] newArray(int size) {
470 return new LinkProperties[size];
Robert Greenwalt47f69fe2010-06-15 15:43:39 -0700471 }
472 };
473}