Lines Matching defs:address

39  * Identifies an IP address on a network link.
43 * <li>An IP address and prefix length (e.g., {@code 2001:db8::1/64} or {@code 192.0.2.1/24}).
44 * The address must be unicast, as multicast addresses cannot be assigned to interfaces.
46 * of the address (e.g., {@code android.system.OsConstants.IFA_F_OPTIMISTIC}).
48 * the address is unique (e.g.,
55 * IPv4 or IPv6 address.
57 private InetAddress address;
75 * Utility function to determines the scope of a unicast address. Per RFC 4291 section 2.5 and
98 * Utility function to check if |address| is a Unique Local IPv6 Unicast Address
104 if (address != null && address instanceof Inet6Address) {
105 byte[] bytes = address.getAddress();
114 private void init(InetAddress address, int prefixLength, int flags, int scope) {
115 if (address == null ||
116 address.isMulticastAddress() ||
118 ((address instanceof Inet4Address) && prefixLength > 32) ||
120 throw new IllegalArgumentException("Bad LinkAddress params " + address +
123 this.address = address;
132 * @param address The IP address.
134 * @param flags A bitmask of {@code IFA_F_*} values representing properties of the address.
135 * @param scope An integer defining the scope in which the address is unique (e.g.,
139 public LinkAddress(InetAddress address, int prefixLength, int flags, int scope) {
140 init(address, prefixLength, flags, scope);
145 * The flags are set to zero and the scope is determined from the address.
146 * @param address The IP address.
150 public LinkAddress(InetAddress address, int prefixLength) {
151 this(address, prefixLength, 0, 0);
152 this.scope = scopeForUnicastAddress(address);
157 * The flags are set to zero and the scope is determined from the address.
158 * @param interfaceAddress The interface address.
168 * "2001:db8::1/64". The flags are set to zero and the scope is determined from the address.
172 public LinkAddress(String address) {
173 this(address, 0, 0);
174 this.scope = scopeForUnicastAddress(this.address);
181 * @param flags The address flags.
182 * @param scope The address scope.
185 public LinkAddress(String address, int flags, int scope) {
187 Pair<InetAddress, Integer> ipAndMask = NetworkUtils.parseIpAndMask(address);
192 * Returns a string representation of this address, such as "192.0.2.1/24" or "2001:db8::1/64".
193 * The string representation does not contain the flags and scope, just the address and prefix
198 return address.getHostAddress() + "/" + prefixLength;
203 * their address, prefix length, flags and scope are equal. Thus, for example, two addresses
204 * that have the same address and prefix length are not equal if one of them is deprecated and
216 return this.address.equals(linkAddress.address) &&
223 * Returns a hashcode for this address.
227 return address.hashCode() + 11 * prefixLength + 19 * flags + 43 * scope;
232 * represent the same address. Two {@code LinkAddresses} represent the same address
233 * if they have the same IP address and prefix length, even if their properties are
237 * @return {@code true} if both objects have the same address and prefix length, {@code false}
242 return address.equals(other.address) && prefixLength == other.prefixLength;
249 return address;
310 dest.writeByteArray(address.getAddress());
322 InetAddress address = null;
324 address = InetAddress.getByAddress(in.createByteArray());
333 return new LinkAddress(address, prefixLength, flags, scope);