Irfan Sheriff | ed5d7d1 | 2010-10-01 16:08:28 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package android.net; |
| 18 | |
| 19 | import android.os.Parcel; |
| 20 | import android.os.Parcelable; |
| 21 | |
Robert Greenwalt | b979f79 | 2011-02-11 17:01:02 -0800 | [diff] [blame] | 22 | import java.net.Inet4Address; |
Irfan Sheriff | ed5d7d1 | 2010-10-01 16:08:28 -0700 | [diff] [blame] | 23 | import java.net.InetAddress; |
| 24 | import java.net.InterfaceAddress; |
| 25 | import java.net.UnknownHostException; |
| 26 | |
Elliott Hughes | 34385d3 | 2014-04-28 11:11:32 -0700 | [diff] [blame] | 27 | import static android.system.OsConstants.IFA_F_DADFAILED; |
| 28 | import static android.system.OsConstants.IFA_F_DEPRECATED; |
| 29 | import static android.system.OsConstants.IFA_F_TENTATIVE; |
| 30 | import static android.system.OsConstants.RT_SCOPE_HOST; |
| 31 | import static android.system.OsConstants.RT_SCOPE_LINK; |
| 32 | import static android.system.OsConstants.RT_SCOPE_SITE; |
| 33 | import static android.system.OsConstants.RT_SCOPE_UNIVERSE; |
Lorenzo Colitti | 6448394 | 2013-11-15 18:43:52 +0900 | [diff] [blame] | 34 | |
Irfan Sheriff | ed5d7d1 | 2010-10-01 16:08:28 -0700 | [diff] [blame] | 35 | /** |
Lorenzo Colitti | e1ad184 | 2013-11-27 15:03:10 +0900 | [diff] [blame] | 36 | * Identifies an IP address on a network link. |
Lorenzo Colitti | 6448394 | 2013-11-15 18:43:52 +0900 | [diff] [blame] | 37 | * |
| 38 | * A {@code LinkAddress} consists of: |
| 39 | * <ul> |
| 40 | * <li>An IP address and prefix length (e.g., {@code 2001:db8::1/64} or {@code 192.0.2.1/24}). |
| 41 | * The address must be unicast, as multicast addresses cannot be assigned to interfaces. |
Lorenzo Colitti | 7dc78cf | 2014-06-09 22:58:46 +0900 | [diff] [blame^] | 42 | * <li>Address flags: A bitmask of {@code OsConstants.IFA_F_*} values representing properties |
| 43 | * of the address (e.g., {@code android.system.OsConstants.IFA_F_OPTIMISTIC}). |
| 44 | * <li>Address scope: One of the {@code OsConstants.IFA_F_*} values; defines the scope in which |
| 45 | * the address is unique (e.g., |
| 46 | * {@code android.system.OsConstants.RT_SCOPE_LINK} or |
| 47 | * {@code android.system.OsConstants.RT_SCOPE_UNIVERSE}). |
| 48 | * </ul> |
Irfan Sheriff | ed5d7d1 | 2010-10-01 16:08:28 -0700 | [diff] [blame] | 49 | */ |
| 50 | public class LinkAddress implements Parcelable { |
| 51 | /** |
| 52 | * IPv4 or IPv6 address. |
| 53 | */ |
Lorenzo Colitti | 6eb8a62 | 2013-08-08 19:24:09 +0900 | [diff] [blame] | 54 | private InetAddress address; |
Irfan Sheriff | ed5d7d1 | 2010-10-01 16:08:28 -0700 | [diff] [blame] | 55 | |
| 56 | /** |
Lorenzo Colitti | e1ad184 | 2013-11-27 15:03:10 +0900 | [diff] [blame] | 57 | * Prefix length. |
Irfan Sheriff | ed5d7d1 | 2010-10-01 16:08:28 -0700 | [diff] [blame] | 58 | */ |
Lorenzo Colitti | 6eb8a62 | 2013-08-08 19:24:09 +0900 | [diff] [blame] | 59 | private int prefixLength; |
Irfan Sheriff | ed5d7d1 | 2010-10-01 16:08:28 -0700 | [diff] [blame] | 60 | |
Lorenzo Colitti | 6448394 | 2013-11-15 18:43:52 +0900 | [diff] [blame] | 61 | /** |
| 62 | * Address flags. A bitmask of IFA_F_* values. |
| 63 | */ |
| 64 | private int flags; |
| 65 | |
| 66 | /** |
| 67 | * Address scope. One of the RT_SCOPE_* constants. |
| 68 | */ |
| 69 | private int scope; |
| 70 | |
| 71 | /** |
| 72 | * Utility function to determines the scope of a unicast address. Per RFC 4291 section 2.5 and |
| 73 | * RFC 6724 section 3.2. |
| 74 | * @hide |
| 75 | */ |
| 76 | static int scopeForUnicastAddress(InetAddress addr) { |
| 77 | if (addr.isAnyLocalAddress()) { |
| 78 | return RT_SCOPE_HOST; |
| 79 | } |
| 80 | |
| 81 | if (addr.isLoopbackAddress() || addr.isLinkLocalAddress()) { |
| 82 | return RT_SCOPE_LINK; |
| 83 | } |
| 84 | |
| 85 | // isSiteLocalAddress() returns true for private IPv4 addresses, but RFC 6724 section 3.2 |
| 86 | // says that they are assigned global scope. |
| 87 | if (!(addr instanceof Inet4Address) && addr.isSiteLocalAddress()) { |
| 88 | return RT_SCOPE_SITE; |
| 89 | } |
| 90 | |
| 91 | return RT_SCOPE_UNIVERSE; |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * Utility function for the constructors. |
| 96 | */ |
| 97 | private void init(InetAddress address, int prefixLength, int flags, int scope) { |
| 98 | if (address == null || |
| 99 | address.isMulticastAddress() || |
| 100 | prefixLength < 0 || |
Robert Greenwalt | b979f79 | 2011-02-11 17:01:02 -0800 | [diff] [blame] | 101 | ((address instanceof Inet4Address) && prefixLength > 32) || |
| 102 | (prefixLength > 128)) { |
| 103 | throw new IllegalArgumentException("Bad LinkAddress params " + address + |
Lorenzo Colitti | 6eb8a62 | 2013-08-08 19:24:09 +0900 | [diff] [blame] | 104 | "/" + prefixLength); |
Robert Greenwalt | b979f79 | 2011-02-11 17:01:02 -0800 | [diff] [blame] | 105 | } |
Irfan Sheriff | ed5d7d1 | 2010-10-01 16:08:28 -0700 | [diff] [blame] | 106 | this.address = address; |
Irfan Sheriff | 96ca917 | 2010-10-05 16:12:25 -0700 | [diff] [blame] | 107 | this.prefixLength = prefixLength; |
Lorenzo Colitti | 6448394 | 2013-11-15 18:43:52 +0900 | [diff] [blame] | 108 | this.flags = flags; |
| 109 | this.scope = scope; |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * Constructs a new {@code LinkAddress} from an {@code InetAddress} and prefix length, with |
| 114 | * the specified flags and scope. Flags and scope are not checked for validity. |
| 115 | * @param address The IP address. |
| 116 | * @param prefixLength The prefix length. |
Robert Greenwalt | fd202e6 | 2014-05-18 09:39:18 -0700 | [diff] [blame] | 117 | * @param flags A bitmask of {@code IFA_F_*} values representing properties of the address. |
| 118 | * @param scope An integer defining the scope in which the address is unique (e.g., |
| 119 | * {@link OsConstants#RT_SCOPE_LINK} or {@link OsConstants#RT_SCOPE_SITE}). |
| 120 | * @hide |
Lorenzo Colitti | 6448394 | 2013-11-15 18:43:52 +0900 | [diff] [blame] | 121 | */ |
| 122 | public LinkAddress(InetAddress address, int prefixLength, int flags, int scope) { |
| 123 | init(address, prefixLength, flags, scope); |
Irfan Sheriff | ed5d7d1 | 2010-10-01 16:08:28 -0700 | [diff] [blame] | 124 | } |
| 125 | |
Lorenzo Colitti | e1ad184 | 2013-11-27 15:03:10 +0900 | [diff] [blame] | 126 | /** |
| 127 | * Constructs a new {@code LinkAddress} from an {@code InetAddress} and a prefix length. |
Lorenzo Colitti | 6448394 | 2013-11-15 18:43:52 +0900 | [diff] [blame] | 128 | * The flags are set to zero and the scope is determined from the address. |
Lorenzo Colitti | e1ad184 | 2013-11-27 15:03:10 +0900 | [diff] [blame] | 129 | * @param address The IP address. |
| 130 | * @param prefixLength The prefix length. |
Robert Greenwalt | fd202e6 | 2014-05-18 09:39:18 -0700 | [diff] [blame] | 131 | * @hide |
Lorenzo Colitti | e1ad184 | 2013-11-27 15:03:10 +0900 | [diff] [blame] | 132 | */ |
Lorenzo Colitti | 6eb8a62 | 2013-08-08 19:24:09 +0900 | [diff] [blame] | 133 | public LinkAddress(InetAddress address, int prefixLength) { |
Lorenzo Colitti | 6448394 | 2013-11-15 18:43:52 +0900 | [diff] [blame] | 134 | this(address, prefixLength, 0, 0); |
| 135 | this.scope = scopeForUnicastAddress(address); |
Lorenzo Colitti | 6eb8a62 | 2013-08-08 19:24:09 +0900 | [diff] [blame] | 136 | } |
| 137 | |
Lorenzo Colitti | e1ad184 | 2013-11-27 15:03:10 +0900 | [diff] [blame] | 138 | /** |
| 139 | * Constructs a new {@code LinkAddress} from an {@code InterfaceAddress}. |
Lorenzo Colitti | 6448394 | 2013-11-15 18:43:52 +0900 | [diff] [blame] | 140 | * The flags are set to zero and the scope is determined from the address. |
Lorenzo Colitti | e1ad184 | 2013-11-27 15:03:10 +0900 | [diff] [blame] | 141 | * @param interfaceAddress The interface address. |
Robert Greenwalt | fd202e6 | 2014-05-18 09:39:18 -0700 | [diff] [blame] | 142 | * @hide |
Lorenzo Colitti | e1ad184 | 2013-11-27 15:03:10 +0900 | [diff] [blame] | 143 | */ |
Irfan Sheriff | ed5d7d1 | 2010-10-01 16:08:28 -0700 | [diff] [blame] | 144 | public LinkAddress(InterfaceAddress interfaceAddress) { |
Lorenzo Colitti | 6448394 | 2013-11-15 18:43:52 +0900 | [diff] [blame] | 145 | this(interfaceAddress.getAddress(), |
Lorenzo Colitti | 6eb8a62 | 2013-08-08 19:24:09 +0900 | [diff] [blame] | 146 | interfaceAddress.getNetworkPrefixLength()); |
| 147 | } |
| 148 | |
| 149 | /** |
| 150 | * Constructs a new {@code LinkAddress} from a string such as "192.0.2.5/24" or |
Lorenzo Colitti | 6448394 | 2013-11-15 18:43:52 +0900 | [diff] [blame] | 151 | * "2001:db8::1/64". The flags are set to zero and the scope is determined from the address. |
Lorenzo Colitti | 6eb8a62 | 2013-08-08 19:24:09 +0900 | [diff] [blame] | 152 | * @param string The string to parse. |
Robert Greenwalt | fd202e6 | 2014-05-18 09:39:18 -0700 | [diff] [blame] | 153 | * @hide |
Lorenzo Colitti | 6eb8a62 | 2013-08-08 19:24:09 +0900 | [diff] [blame] | 154 | */ |
| 155 | public LinkAddress(String address) { |
Lorenzo Colitti | 6448394 | 2013-11-15 18:43:52 +0900 | [diff] [blame] | 156 | this(address, 0, 0); |
| 157 | this.scope = scopeForUnicastAddress(this.address); |
| 158 | } |
| 159 | |
| 160 | /** |
| 161 | * Constructs a new {@code LinkAddress} from a string such as "192.0.2.5/24" or |
| 162 | * "2001:db8::1/64", with the specified flags and scope. |
| 163 | * @param string The string to parse. |
| 164 | * @param flags The address flags. |
| 165 | * @param scope The address scope. |
Robert Greenwalt | fd202e6 | 2014-05-18 09:39:18 -0700 | [diff] [blame] | 166 | * @hide |
Lorenzo Colitti | 6448394 | 2013-11-15 18:43:52 +0900 | [diff] [blame] | 167 | */ |
| 168 | public LinkAddress(String address, int flags, int scope) { |
Lorenzo Colitti | 6eb8a62 | 2013-08-08 19:24:09 +0900 | [diff] [blame] | 169 | InetAddress inetAddress = null; |
| 170 | int prefixLength = -1; |
| 171 | try { |
| 172 | String [] pieces = address.split("/", 2); |
| 173 | prefixLength = Integer.parseInt(pieces[1]); |
| 174 | inetAddress = InetAddress.parseNumericAddress(pieces[0]); |
| 175 | } catch (NullPointerException e) { // Null string. |
| 176 | } catch (ArrayIndexOutOfBoundsException e) { // No prefix length. |
| 177 | } catch (NumberFormatException e) { // Non-numeric prefix. |
| 178 | } catch (IllegalArgumentException e) { // Invalid IP address. |
| 179 | } |
| 180 | |
| 181 | if (inetAddress == null || prefixLength == -1) { |
| 182 | throw new IllegalArgumentException("Bad LinkAddress params " + address); |
| 183 | } |
| 184 | |
Lorenzo Colitti | 6448394 | 2013-11-15 18:43:52 +0900 | [diff] [blame] | 185 | init(inetAddress, prefixLength, flags, scope); |
Irfan Sheriff | ed5d7d1 | 2010-10-01 16:08:28 -0700 | [diff] [blame] | 186 | } |
| 187 | |
Lorenzo Colitti | 6448394 | 2013-11-15 18:43:52 +0900 | [diff] [blame] | 188 | /** |
| 189 | * Returns a string representation of this address, such as "192.0.2.1/24" or "2001:db8::1/64". |
| 190 | * The string representation does not contain the flags and scope, just the address and prefix |
| 191 | * length. |
| 192 | */ |
Irfan Sheriff | ed5d7d1 | 2010-10-01 16:08:28 -0700 | [diff] [blame] | 193 | @Override |
| 194 | public String toString() { |
Lorenzo Colitti | e1ad184 | 2013-11-27 15:03:10 +0900 | [diff] [blame] | 195 | return address.getHostAddress() + "/" + prefixLength; |
Irfan Sheriff | ed5d7d1 | 2010-10-01 16:08:28 -0700 | [diff] [blame] | 196 | } |
| 197 | |
| 198 | /** |
Lorenzo Colitti | 6448394 | 2013-11-15 18:43:52 +0900 | [diff] [blame] | 199 | * Compares this {@code LinkAddress} instance against {@code obj}. Two addresses are equal if |
Lorenzo Colitti | 7dc78cf | 2014-06-09 22:58:46 +0900 | [diff] [blame^] | 200 | * their address, prefix length, flags and scope are equal. Thus, for example, two addresses |
| 201 | * that have the same address and prefix length are not equal if one of them is deprecated and |
| 202 | * the other is not. |
Irfan Sheriff | ed5d7d1 | 2010-10-01 16:08:28 -0700 | [diff] [blame] | 203 | * |
| 204 | * @param obj the object to be tested for equality. |
| 205 | * @return {@code true} if both objects are equal, {@code false} otherwise. |
| 206 | */ |
| 207 | @Override |
| 208 | public boolean equals(Object obj) { |
| 209 | if (!(obj instanceof LinkAddress)) { |
| 210 | return false; |
| 211 | } |
| 212 | LinkAddress linkAddress = (LinkAddress) obj; |
| 213 | return this.address.equals(linkAddress.address) && |
Lorenzo Colitti | 6448394 | 2013-11-15 18:43:52 +0900 | [diff] [blame] | 214 | this.prefixLength == linkAddress.prefixLength && |
| 215 | this.flags == linkAddress.flags && |
| 216 | this.scope == linkAddress.scope; |
Irfan Sheriff | ed5d7d1 | 2010-10-01 16:08:28 -0700 | [diff] [blame] | 217 | } |
| 218 | |
Lorenzo Colitti | e1ad184 | 2013-11-27 15:03:10 +0900 | [diff] [blame] | 219 | /** |
| 220 | * Returns a hashcode for this address. |
John Wang | 4e90009 | 2011-04-04 12:35:42 -0700 | [diff] [blame] | 221 | */ |
Lorenzo Colitti | e1ad184 | 2013-11-27 15:03:10 +0900 | [diff] [blame] | 222 | @Override |
John Wang | 4e90009 | 2011-04-04 12:35:42 -0700 | [diff] [blame] | 223 | public int hashCode() { |
Lorenzo Colitti | 6448394 | 2013-11-15 18:43:52 +0900 | [diff] [blame] | 224 | return address.hashCode() + 11 * prefixLength + 19 * flags + 43 * scope; |
| 225 | } |
| 226 | |
| 227 | /** |
Robert Greenwalt | fd202e6 | 2014-05-18 09:39:18 -0700 | [diff] [blame] | 228 | * Determines whether this {@code LinkAddress} and the provided {@code LinkAddress} |
| 229 | * represent the same address. Two {@code LinkAddresses} represent the same address |
| 230 | * if they have the same IP address and prefix length, even if their properties are |
| 231 | * different. |
Lorenzo Colitti | 6448394 | 2013-11-15 18:43:52 +0900 | [diff] [blame] | 232 | * |
| 233 | * @param other the {@code LinkAddress} to compare to. |
| 234 | * @return {@code true} if both objects have the same address and prefix length, {@code false} |
| 235 | * otherwise. |
Lorenzo Colitti | 7dc78cf | 2014-06-09 22:58:46 +0900 | [diff] [blame^] | 236 | * @hide |
Lorenzo Colitti | 6448394 | 2013-11-15 18:43:52 +0900 | [diff] [blame] | 237 | */ |
| 238 | public boolean isSameAddressAs(LinkAddress other) { |
| 239 | return address.equals(other.address) && prefixLength == other.prefixLength; |
John Wang | 4e90009 | 2011-04-04 12:35:42 -0700 | [diff] [blame] | 240 | } |
| 241 | |
Irfan Sheriff | ed5d7d1 | 2010-10-01 16:08:28 -0700 | [diff] [blame] | 242 | /** |
Robert Greenwalt | fd202e6 | 2014-05-18 09:39:18 -0700 | [diff] [blame] | 243 | * Returns the {@link InetAddress} of this {@code LinkAddress}. |
Irfan Sheriff | ed5d7d1 | 2010-10-01 16:08:28 -0700 | [diff] [blame] | 244 | */ |
| 245 | public InetAddress getAddress() { |
| 246 | return address; |
| 247 | } |
| 248 | |
| 249 | /** |
Robert Greenwalt | fd202e6 | 2014-05-18 09:39:18 -0700 | [diff] [blame] | 250 | * Returns the prefix length of this {@code LinkAddress}. |
Irfan Sheriff | ed5d7d1 | 2010-10-01 16:08:28 -0700 | [diff] [blame] | 251 | */ |
Lorenzo Colitti | 7dc78cf | 2014-06-09 22:58:46 +0900 | [diff] [blame^] | 252 | public int getPrefixLength() { |
Irfan Sheriff | 96ca917 | 2010-10-05 16:12:25 -0700 | [diff] [blame] | 253 | return prefixLength; |
Irfan Sheriff | ed5d7d1 | 2010-10-01 16:08:28 -0700 | [diff] [blame] | 254 | } |
| 255 | |
| 256 | /** |
Lorenzo Colitti | 7dc78cf | 2014-06-09 22:58:46 +0900 | [diff] [blame^] | 257 | * Returns the prefix length of this {@code LinkAddress}. |
| 258 | * TODO: Delete all callers and remove in favour of getPrefixLength(). |
| 259 | * @hide |
| 260 | */ |
| 261 | public int getNetworkPrefixLength() { |
| 262 | return getPrefixLength(); |
| 263 | } |
| 264 | |
| 265 | /** |
Robert Greenwalt | fd202e6 | 2014-05-18 09:39:18 -0700 | [diff] [blame] | 266 | * Returns the flags of this {@code LinkAddress}. |
Lorenzo Colitti | 6448394 | 2013-11-15 18:43:52 +0900 | [diff] [blame] | 267 | */ |
| 268 | public int getFlags() { |
| 269 | return flags; |
| 270 | } |
| 271 | |
| 272 | /** |
Robert Greenwalt | fd202e6 | 2014-05-18 09:39:18 -0700 | [diff] [blame] | 273 | * Returns the scope of this {@code LinkAddress}. |
Lorenzo Colitti | 6448394 | 2013-11-15 18:43:52 +0900 | [diff] [blame] | 274 | */ |
| 275 | public int getScope() { |
| 276 | return scope; |
| 277 | } |
| 278 | |
| 279 | /** |
| 280 | * Returns true if this {@code LinkAddress} is global scope and preferred. |
Robert Greenwalt | fd202e6 | 2014-05-18 09:39:18 -0700 | [diff] [blame] | 281 | * @hide |
Lorenzo Colitti | 6448394 | 2013-11-15 18:43:52 +0900 | [diff] [blame] | 282 | */ |
| 283 | public boolean isGlobalPreferred() { |
| 284 | return (scope == RT_SCOPE_UNIVERSE && |
| 285 | (flags & (IFA_F_DADFAILED | IFA_F_DEPRECATED | IFA_F_TENTATIVE)) == 0L); |
| 286 | } |
| 287 | |
| 288 | /** |
Lorenzo Colitti | e1ad184 | 2013-11-27 15:03:10 +0900 | [diff] [blame] | 289 | * Implement the Parcelable interface. |
Irfan Sheriff | ed5d7d1 | 2010-10-01 16:08:28 -0700 | [diff] [blame] | 290 | * @hide |
| 291 | */ |
| 292 | public int describeContents() { |
| 293 | return 0; |
| 294 | } |
| 295 | |
| 296 | /** |
| 297 | * Implement the Parcelable interface. |
| 298 | * @hide |
| 299 | */ |
| 300 | public void writeToParcel(Parcel dest, int flags) { |
Lorenzo Colitti | e1ad184 | 2013-11-27 15:03:10 +0900 | [diff] [blame] | 301 | dest.writeByteArray(address.getAddress()); |
| 302 | dest.writeInt(prefixLength); |
Lorenzo Colitti | 6448394 | 2013-11-15 18:43:52 +0900 | [diff] [blame] | 303 | dest.writeInt(this.flags); |
| 304 | dest.writeInt(scope); |
Irfan Sheriff | ed5d7d1 | 2010-10-01 16:08:28 -0700 | [diff] [blame] | 305 | } |
| 306 | |
| 307 | /** |
| 308 | * Implement the Parcelable interface. |
| 309 | * @hide |
| 310 | */ |
| 311 | public static final Creator<LinkAddress> CREATOR = |
| 312 | new Creator<LinkAddress>() { |
| 313 | public LinkAddress createFromParcel(Parcel in) { |
| 314 | InetAddress address = null; |
Lorenzo Colitti | e1ad184 | 2013-11-27 15:03:10 +0900 | [diff] [blame] | 315 | try { |
| 316 | address = InetAddress.getByAddress(in.createByteArray()); |
| 317 | } catch (UnknownHostException e) { |
| 318 | // Nothing we can do here. When we call the constructor, we'll throw an |
| 319 | // IllegalArgumentException, because a LinkAddress can't have a null |
| 320 | // InetAddress. |
Irfan Sheriff | ed5d7d1 | 2010-10-01 16:08:28 -0700 | [diff] [blame] | 321 | } |
Lorenzo Colitti | e1ad184 | 2013-11-27 15:03:10 +0900 | [diff] [blame] | 322 | int prefixLength = in.readInt(); |
Lorenzo Colitti | 6448394 | 2013-11-15 18:43:52 +0900 | [diff] [blame] | 323 | int flags = in.readInt(); |
| 324 | int scope = in.readInt(); |
| 325 | return new LinkAddress(address, prefixLength, flags, scope); |
Irfan Sheriff | ed5d7d1 | 2010-10-01 16:08:28 -0700 | [diff] [blame] | 326 | } |
| 327 | |
| 328 | public LinkAddress[] newArray(int size) { |
| 329 | return new LinkAddress[size]; |
| 330 | } |
| 331 | }; |
| 332 | } |