blob: bf8b38fc7f84cbb78e1c5419e71c9bba3243541f [file] [log] [blame]
Irfan Sheriffed5d7d12010-10-01 16:08:28 -07001/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
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
Hugo Benichifd31b9d2017-06-23 10:07:08 +090019import static android.system.OsConstants.IFA_F_DADFAILED;
20import static android.system.OsConstants.IFA_F_DEPRECATED;
21import static android.system.OsConstants.IFA_F_OPTIMISTIC;
22import static android.system.OsConstants.IFA_F_TENTATIVE;
23import static android.system.OsConstants.RT_SCOPE_HOST;
24import static android.system.OsConstants.RT_SCOPE_LINK;
25import static android.system.OsConstants.RT_SCOPE_SITE;
26import static android.system.OsConstants.RT_SCOPE_UNIVERSE;
27
paulhu819e0af2019-03-27 22:26:37 +080028import android.annotation.IntRange;
Jack Yu8eb6ca82019-03-01 12:04:50 -080029import android.annotation.NonNull;
paulhud9736de2019-03-08 16:35:20 +080030import android.annotation.Nullable;
Jack Yu4f956e02018-11-14 22:04:17 -080031import android.annotation.SystemApi;
Remi NGUYEN VAN31f1d0c2019-01-20 12:52:43 +090032import android.annotation.TestApi;
Artur Satayev26958002019-12-10 17:47:52 +000033import android.compat.annotation.UnsupportedAppUsage;
Mathew Inwood55418ea2018-12-20 15:30:45 +000034import android.os.Build;
Irfan Sheriffed5d7d12010-10-01 16:08:28 -070035import android.os.Parcel;
36import android.os.Parcelable;
Lorenzo Colitti8c6c2c32014-06-12 13:41:17 +090037import android.util.Pair;
Irfan Sheriffed5d7d12010-10-01 16:08:28 -070038
Robert Greenwaltb979f792011-02-11 17:01:02 -080039import java.net.Inet4Address;
Erik Klinebefe7782014-10-20 19:46:56 +090040import java.net.Inet6Address;
Irfan Sheriffed5d7d12010-10-01 16:08:28 -070041import java.net.InetAddress;
42import java.net.InterfaceAddress;
43import java.net.UnknownHostException;
44
45/**
Lorenzo Colittie1ad1842013-11-27 15:03:10 +090046 * Identifies an IP address on a network link.
Lorenzo Colitti64483942013-11-15 18:43:52 +090047 *
48 * A {@code LinkAddress} consists of:
49 * <ul>
50 * <li>An IP address and prefix length (e.g., {@code 2001:db8::1/64} or {@code 192.0.2.1/24}).
51 * The address must be unicast, as multicast addresses cannot be assigned to interfaces.
Lorenzo Colitti7dc78cf2014-06-09 22:58:46 +090052 * <li>Address flags: A bitmask of {@code OsConstants.IFA_F_*} values representing properties
53 * of the address (e.g., {@code android.system.OsConstants.IFA_F_OPTIMISTIC}).
54 * <li>Address scope: One of the {@code OsConstants.IFA_F_*} values; defines the scope in which
55 * the address is unique (e.g.,
56 * {@code android.system.OsConstants.RT_SCOPE_LINK} or
57 * {@code android.system.OsConstants.RT_SCOPE_UNIVERSE}).
58 * </ul>
Irfan Sheriffed5d7d12010-10-01 16:08:28 -070059 */
60public class LinkAddress implements Parcelable {
61 /**
62 * IPv4 or IPv6 address.
63 */
Mathew Inwood55418ea2018-12-20 15:30:45 +000064 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
Lorenzo Colitti6eb8a622013-08-08 19:24:09 +090065 private InetAddress address;
Irfan Sheriffed5d7d12010-10-01 16:08:28 -070066
67 /**
Lorenzo Colittie1ad1842013-11-27 15:03:10 +090068 * Prefix length.
Irfan Sheriffed5d7d12010-10-01 16:08:28 -070069 */
Mathew Inwood55418ea2018-12-20 15:30:45 +000070 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
Lorenzo Colitti6eb8a622013-08-08 19:24:09 +090071 private int prefixLength;
Irfan Sheriffed5d7d12010-10-01 16:08:28 -070072
Lorenzo Colitti64483942013-11-15 18:43:52 +090073 /**
74 * Address flags. A bitmask of IFA_F_* values.
75 */
76 private int flags;
77
78 /**
79 * Address scope. One of the RT_SCOPE_* constants.
80 */
81 private int scope;
82
83 /**
84 * Utility function to determines the scope of a unicast address. Per RFC 4291 section 2.5 and
85 * RFC 6724 section 3.2.
86 * @hide
87 */
Hugo Benichi1dfb6b62017-08-08 13:06:04 +090088 private static int scopeForUnicastAddress(InetAddress addr) {
Lorenzo Colitti64483942013-11-15 18:43:52 +090089 if (addr.isAnyLocalAddress()) {
90 return RT_SCOPE_HOST;
91 }
92
93 if (addr.isLoopbackAddress() || addr.isLinkLocalAddress()) {
94 return RT_SCOPE_LINK;
95 }
96
97 // isSiteLocalAddress() returns true for private IPv4 addresses, but RFC 6724 section 3.2
98 // says that they are assigned global scope.
99 if (!(addr instanceof Inet4Address) && addr.isSiteLocalAddress()) {
100 return RT_SCOPE_SITE;
101 }
102
103 return RT_SCOPE_UNIVERSE;
104 }
105
106 /**
Erik Klinebefe7782014-10-20 19:46:56 +0900107 * Utility function to check if |address| is a Unique Local IPv6 Unicast Address
108 * (a.k.a. "ULA"; RFC 4193).
109 *
110 * Per RFC 4193 section 8, fc00::/7 identifies these addresses.
111 */
paulhud9736de2019-03-08 16:35:20 +0800112 private boolean isIpv6ULA() {
113 if (isIpv6()) {
Erik Klinebefe7782014-10-20 19:46:56 +0900114 byte[] bytes = address.getAddress();
Erik Kline1eb8c692016-07-08 17:21:26 +0900115 return ((bytes[0] & (byte)0xfe) == (byte)0xfc);
Erik Klinebefe7782014-10-20 19:46:56 +0900116 }
117 return false;
118 }
119
120 /**
Hugo Benichi1dfb6b62017-08-08 13:06:04 +0900121 * @return true if the address is IPv6.
122 * @hide
123 */
Remi NGUYEN VAN31f1d0c2019-01-20 12:52:43 +0900124 @TestApi
125 @SystemApi
paulhud9736de2019-03-08 16:35:20 +0800126 public boolean isIpv6() {
Hugo Benichi1dfb6b62017-08-08 13:06:04 +0900127 return address instanceof Inet6Address;
128 }
129
130 /**
paulhud9736de2019-03-08 16:35:20 +0800131 * For backward compatibility.
132 * This was annotated with @UnsupportedAppUsage in P, so we can't remove the method completely
133 * just yet.
134 * @return true if the address is IPv6.
135 * @hide
136 */
137 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
138 public boolean isIPv6() {
139 return isIpv6();
140 }
141
142 /**
Hugo Benichi1dfb6b62017-08-08 13:06:04 +0900143 * @return true if the address is IPv4 or is a mapped IPv4 address.
144 * @hide
145 */
Remi NGUYEN VAN31f1d0c2019-01-20 12:52:43 +0900146 @TestApi
147 @SystemApi
paulhud9736de2019-03-08 16:35:20 +0800148 public boolean isIpv4() {
Hugo Benichi1dfb6b62017-08-08 13:06:04 +0900149 return address instanceof Inet4Address;
150 }
151
152 /**
Lorenzo Colitti64483942013-11-15 18:43:52 +0900153 * Utility function for the constructors.
154 */
155 private void init(InetAddress address, int prefixLength, int flags, int scope) {
156 if (address == null ||
157 address.isMulticastAddress() ||
158 prefixLength < 0 ||
Hugo Benichi1dfb6b62017-08-08 13:06:04 +0900159 (address instanceof Inet4Address && prefixLength > 32) ||
Robert Greenwaltb979f792011-02-11 17:01:02 -0800160 (prefixLength > 128)) {
161 throw new IllegalArgumentException("Bad LinkAddress params " + address +
Lorenzo Colitti6eb8a622013-08-08 19:24:09 +0900162 "/" + prefixLength);
Robert Greenwaltb979f792011-02-11 17:01:02 -0800163 }
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700164 this.address = address;
Irfan Sheriff96ca9172010-10-05 16:12:25 -0700165 this.prefixLength = prefixLength;
Lorenzo Colitti64483942013-11-15 18:43:52 +0900166 this.flags = flags;
167 this.scope = scope;
168 }
169
170 /**
171 * Constructs a new {@code LinkAddress} from an {@code InetAddress} and prefix length, with
172 * the specified flags and scope. Flags and scope are not checked for validity.
173 * @param address The IP address.
paulhu819e0af2019-03-27 22:26:37 +0800174 * @param prefixLength The prefix length. Must be &gt;= 0 and &lt;= (32 or 128) (IPv4 or IPv6).
Robert Greenwaltfd202e62014-05-18 09:39:18 -0700175 * @param flags A bitmask of {@code IFA_F_*} values representing properties of the address.
176 * @param scope An integer defining the scope in which the address is unique (e.g.,
177 * {@link OsConstants#RT_SCOPE_LINK} or {@link OsConstants#RT_SCOPE_SITE}).
178 * @hide
Lorenzo Colitti64483942013-11-15 18:43:52 +0900179 */
Remi NGUYEN VAN299a7cc2019-01-23 21:35:52 +0900180 @SystemApi
181 @TestApi
paulhu819e0af2019-03-27 22:26:37 +0800182 public LinkAddress(@NonNull InetAddress address, @IntRange(from = 0, to = 128) int prefixLength,
183 int flags, int scope) {
Lorenzo Colitti64483942013-11-15 18:43:52 +0900184 init(address, prefixLength, flags, scope);
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700185 }
186
Lorenzo Colittie1ad1842013-11-27 15:03:10 +0900187 /**
188 * Constructs a new {@code LinkAddress} from an {@code InetAddress} and a prefix length.
Lorenzo Colitti64483942013-11-15 18:43:52 +0900189 * The flags are set to zero and the scope is determined from the address.
Lorenzo Colittie1ad1842013-11-27 15:03:10 +0900190 * @param address The IP address.
paulhu819e0af2019-03-27 22:26:37 +0800191 * @param prefixLength The prefix length. Must be &gt;= 0 and &lt;= (32 or 128) (IPv4 or IPv6).
Robert Greenwaltfd202e62014-05-18 09:39:18 -0700192 * @hide
Lorenzo Colittie1ad1842013-11-27 15:03:10 +0900193 */
Jack Yu4f956e02018-11-14 22:04:17 -0800194 @SystemApi
Remi NGUYEN VAN5c5f1ba2019-01-29 12:08:43 +0900195 @TestApi
paulhu819e0af2019-03-27 22:26:37 +0800196 public LinkAddress(@NonNull InetAddress address,
197 @IntRange(from = 0, to = 128) int prefixLength) {
Lorenzo Colitti64483942013-11-15 18:43:52 +0900198 this(address, prefixLength, 0, 0);
199 this.scope = scopeForUnicastAddress(address);
Lorenzo Colitti6eb8a622013-08-08 19:24:09 +0900200 }
201
Lorenzo Colittie1ad1842013-11-27 15:03:10 +0900202 /**
203 * Constructs a new {@code LinkAddress} from an {@code InterfaceAddress}.
Lorenzo Colitti64483942013-11-15 18:43:52 +0900204 * The flags are set to zero and the scope is determined from the address.
Lorenzo Colittie1ad1842013-11-27 15:03:10 +0900205 * @param interfaceAddress The interface address.
Robert Greenwaltfd202e62014-05-18 09:39:18 -0700206 * @hide
Lorenzo Colittie1ad1842013-11-27 15:03:10 +0900207 */
paulhu819e0af2019-03-27 22:26:37 +0800208 public LinkAddress(@NonNull InterfaceAddress interfaceAddress) {
Lorenzo Colitti64483942013-11-15 18:43:52 +0900209 this(interfaceAddress.getAddress(),
Lorenzo Colitti6eb8a622013-08-08 19:24:09 +0900210 interfaceAddress.getNetworkPrefixLength());
211 }
212
213 /**
214 * Constructs a new {@code LinkAddress} from a string such as "192.0.2.5/24" or
Lorenzo Colitti64483942013-11-15 18:43:52 +0900215 * "2001:db8::1/64". The flags are set to zero and the scope is determined from the address.
Jack Yu8eb6ca82019-03-01 12:04:50 -0800216 * @param address The string to parse.
Robert Greenwaltfd202e62014-05-18 09:39:18 -0700217 * @hide
Lorenzo Colitti6eb8a622013-08-08 19:24:09 +0900218 */
Jack Yu4f956e02018-11-14 22:04:17 -0800219 @SystemApi
Remi NGUYEN VAN5c5f1ba2019-01-29 12:08:43 +0900220 @TestApi
Jack Yu8eb6ca82019-03-01 12:04:50 -0800221 public LinkAddress(@NonNull String address) {
Lorenzo Colitti64483942013-11-15 18:43:52 +0900222 this(address, 0, 0);
223 this.scope = scopeForUnicastAddress(this.address);
224 }
225
226 /**
227 * Constructs a new {@code LinkAddress} from a string such as "192.0.2.5/24" or
228 * "2001:db8::1/64", with the specified flags and scope.
Jack Yu8eb6ca82019-03-01 12:04:50 -0800229 * @param address The string to parse.
Lorenzo Colitti64483942013-11-15 18:43:52 +0900230 * @param flags The address flags.
231 * @param scope The address scope.
Robert Greenwaltfd202e62014-05-18 09:39:18 -0700232 * @hide
Lorenzo Colitti64483942013-11-15 18:43:52 +0900233 */
Remi NGUYEN VAN5c5f1ba2019-01-29 12:08:43 +0900234 @SystemApi
235 @TestApi
paulhud9736de2019-03-08 16:35:20 +0800236 public LinkAddress(@NonNull String address, int flags, int scope) {
Lorenzo Colitti8c6c2c32014-06-12 13:41:17 +0900237 // This may throw an IllegalArgumentException; catching it is the caller's responsibility.
Hugo Benichi1dfb6b62017-08-08 13:06:04 +0900238 // TODO: consider rejecting mapped IPv4 addresses such as "::ffff:192.0.2.5/24".
Lorenzo Colitti8c6c2c32014-06-12 13:41:17 +0900239 Pair<InetAddress, Integer> ipAndMask = NetworkUtils.parseIpAndMask(address);
240 init(ipAndMask.first, ipAndMask.second, flags, scope);
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700241 }
242
Lorenzo Colitti64483942013-11-15 18:43:52 +0900243 /**
244 * Returns a string representation of this address, such as "192.0.2.1/24" or "2001:db8::1/64".
245 * The string representation does not contain the flags and scope, just the address and prefix
246 * length.
247 */
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700248 @Override
249 public String toString() {
Lorenzo Colittie1ad1842013-11-27 15:03:10 +0900250 return address.getHostAddress() + "/" + prefixLength;
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700251 }
252
253 /**
Lorenzo Colitti64483942013-11-15 18:43:52 +0900254 * Compares this {@code LinkAddress} instance against {@code obj}. Two addresses are equal if
Lorenzo Colitti7dc78cf2014-06-09 22:58:46 +0900255 * their address, prefix length, flags and scope are equal. Thus, for example, two addresses
256 * that have the same address and prefix length are not equal if one of them is deprecated and
257 * the other is not.
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700258 *
259 * @param obj the object to be tested for equality.
260 * @return {@code true} if both objects are equal, {@code false} otherwise.
261 */
262 @Override
263 public boolean equals(Object obj) {
264 if (!(obj instanceof LinkAddress)) {
265 return false;
266 }
267 LinkAddress linkAddress = (LinkAddress) obj;
268 return this.address.equals(linkAddress.address) &&
Lorenzo Colitti64483942013-11-15 18:43:52 +0900269 this.prefixLength == linkAddress.prefixLength &&
270 this.flags == linkAddress.flags &&
271 this.scope == linkAddress.scope;
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700272 }
273
Lorenzo Colittie1ad1842013-11-27 15:03:10 +0900274 /**
275 * Returns a hashcode for this address.
John Wang4e900092011-04-04 12:35:42 -0700276 */
Lorenzo Colittie1ad1842013-11-27 15:03:10 +0900277 @Override
John Wang4e900092011-04-04 12:35:42 -0700278 public int hashCode() {
Lorenzo Colitti64483942013-11-15 18:43:52 +0900279 return address.hashCode() + 11 * prefixLength + 19 * flags + 43 * scope;
280 }
281
282 /**
Robert Greenwaltfd202e62014-05-18 09:39:18 -0700283 * Determines whether this {@code LinkAddress} and the provided {@code LinkAddress}
284 * represent the same address. Two {@code LinkAddresses} represent the same address
285 * if they have the same IP address and prefix length, even if their properties are
286 * different.
Lorenzo Colitti64483942013-11-15 18:43:52 +0900287 *
288 * @param other the {@code LinkAddress} to compare to.
289 * @return {@code true} if both objects have the same address and prefix length, {@code false}
290 * otherwise.
Lorenzo Colitti7dc78cf2014-06-09 22:58:46 +0900291 * @hide
Lorenzo Colitti64483942013-11-15 18:43:52 +0900292 */
Remi NGUYEN VAN31f1d0c2019-01-20 12:52:43 +0900293 @TestApi
294 @SystemApi
paulhud9736de2019-03-08 16:35:20 +0800295 public boolean isSameAddressAs(@Nullable LinkAddress other) {
296 if (other == null) {
297 return false;
298 }
Lorenzo Colitti64483942013-11-15 18:43:52 +0900299 return address.equals(other.address) && prefixLength == other.prefixLength;
John Wang4e900092011-04-04 12:35:42 -0700300 }
301
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700302 /**
Robert Greenwaltfd202e62014-05-18 09:39:18 -0700303 * Returns the {@link InetAddress} of this {@code LinkAddress}.
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700304 */
305 public InetAddress getAddress() {
306 return address;
307 }
308
309 /**
Robert Greenwaltfd202e62014-05-18 09:39:18 -0700310 * Returns the prefix length of this {@code LinkAddress}.
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700311 */
paulhu819e0af2019-03-27 22:26:37 +0800312 @IntRange(from = 0, to = 128)
Lorenzo Colitti7dc78cf2014-06-09 22:58:46 +0900313 public int getPrefixLength() {
Irfan Sheriff96ca9172010-10-05 16:12:25 -0700314 return prefixLength;
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700315 }
316
317 /**
Lorenzo Colitti7dc78cf2014-06-09 22:58:46 +0900318 * Returns the prefix length of this {@code LinkAddress}.
319 * TODO: Delete all callers and remove in favour of getPrefixLength().
320 * @hide
321 */
Mathew Inwoodfa3a7462018-08-08 14:52:47 +0100322 @UnsupportedAppUsage
paulhu819e0af2019-03-27 22:26:37 +0800323 @IntRange(from = 0, to = 128)
Lorenzo Colitti7dc78cf2014-06-09 22:58:46 +0900324 public int getNetworkPrefixLength() {
325 return getPrefixLength();
326 }
327
328 /**
Robert Greenwaltfd202e62014-05-18 09:39:18 -0700329 * Returns the flags of this {@code LinkAddress}.
Lorenzo Colitti64483942013-11-15 18:43:52 +0900330 */
331 public int getFlags() {
332 return flags;
333 }
334
335 /**
Robert Greenwaltfd202e62014-05-18 09:39:18 -0700336 * Returns the scope of this {@code LinkAddress}.
Lorenzo Colitti64483942013-11-15 18:43:52 +0900337 */
338 public int getScope() {
339 return scope;
340 }
341
342 /**
343 * Returns true if this {@code LinkAddress} is global scope and preferred.
Robert Greenwaltfd202e62014-05-18 09:39:18 -0700344 * @hide
Lorenzo Colitti64483942013-11-15 18:43:52 +0900345 */
Remi NGUYEN VAN31f1d0c2019-01-20 12:52:43 +0900346 @TestApi
347 @SystemApi
Lorenzo Colitti64483942013-11-15 18:43:52 +0900348 public boolean isGlobalPreferred() {
Erik Klinebefe7782014-10-20 19:46:56 +0900349 /**
350 * Note that addresses flagged as IFA_F_OPTIMISTIC are
351 * simultaneously flagged as IFA_F_TENTATIVE (when the tentative
352 * state has cleared either DAD has succeeded or failed, and both
353 * flags are cleared regardless).
354 */
paulhud9736de2019-03-08 16:35:20 +0800355 return (scope == RT_SCOPE_UNIVERSE
356 && !isIpv6ULA()
357 && (flags & (IFA_F_DADFAILED | IFA_F_DEPRECATED)) == 0L
358 && ((flags & IFA_F_TENTATIVE) == 0L || (flags & IFA_F_OPTIMISTIC) != 0L));
Lorenzo Colitti64483942013-11-15 18:43:52 +0900359 }
360
361 /**
Lorenzo Colittie1ad1842013-11-27 15:03:10 +0900362 * Implement the Parcelable interface.
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700363 */
364 public int describeContents() {
365 return 0;
366 }
367
368 /**
369 * Implement the Parcelable interface.
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700370 */
371 public void writeToParcel(Parcel dest, int flags) {
Lorenzo Colittie1ad1842013-11-27 15:03:10 +0900372 dest.writeByteArray(address.getAddress());
373 dest.writeInt(prefixLength);
Lorenzo Colitti64483942013-11-15 18:43:52 +0900374 dest.writeInt(this.flags);
375 dest.writeInt(scope);
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700376 }
377
378 /**
379 * Implement the Parcelable interface.
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700380 */
Jeff Sharkey9e8f83d2019-02-28 12:06:45 -0700381 public static final @android.annotation.NonNull Creator<LinkAddress> CREATOR =
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700382 new Creator<LinkAddress>() {
383 public LinkAddress createFromParcel(Parcel in) {
384 InetAddress address = null;
Lorenzo Colittie1ad1842013-11-27 15:03:10 +0900385 try {
386 address = InetAddress.getByAddress(in.createByteArray());
387 } catch (UnknownHostException e) {
388 // Nothing we can do here. When we call the constructor, we'll throw an
389 // IllegalArgumentException, because a LinkAddress can't have a null
390 // InetAddress.
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700391 }
Lorenzo Colittie1ad1842013-11-27 15:03:10 +0900392 int prefixLength = in.readInt();
Lorenzo Colitti64483942013-11-15 18:43:52 +0900393 int flags = in.readInt();
394 int scope = in.readInt();
395 return new LinkAddress(address, prefixLength, flags, scope);
Irfan Sheriffed5d7d12010-10-01 16:08:28 -0700396 }
397
398 public LinkAddress[] newArray(int size) {
399 return new LinkAddress[size];
400 }
401 };
402}