Lines Matching refs:address

62  * conflict with each other. The system takes several actions to address
206 * Adds a network address to the VPN interface.
209 * address is already in use or cannot be assigned to the interface for any other reason.
211 * Adding an address implicitly allows traffic from that address family (i.e., IPv4 or IPv6) to
214 * @throws {@link IllegalArgumentException} if the address is invalid.
216 * @param address The IP address (IPv4 or IPv6) to assign to the VPN interface.
217 * @param prefixLength The prefix length of the address.
224 public boolean addAddress(InetAddress address, int prefixLength) {
225 check(address, prefixLength);
227 return getService().addVpnAddress(address.getHostAddress(), prefixLength);
234 * Removes a network address from the VPN interface.
237 * address is not assigned to the VPN interface, or if it is the only address assigned (thus
238 * cannot be removed), or if the address cannot be removed for any other reason.
240 * After removing an address, if there are no addresses, routes or DNS servers of a particular
241 * address family (i.e., IPv4 or IPv6) configured on the VPN, that <b>DOES NOT</b> block that
242 * family from being routed. In other words, once an address family has been allowed, it stays
245 * @throws {@link IllegalArgumentException} if the address is invalid.
247 * @param address The IP address (IPv4 or IPv6) to assign to the VPN interface.
248 * @param prefixLength The prefix length of the address.
254 public boolean removeAddress(InetAddress address, int prefixLength) {
255 check(address, prefixLength);
257 return getService().removeVpnAddress(address.getHostAddress(), prefixLength);
309 * Private method to validate address and prefixLength.
311 private static void check(InetAddress address, int prefixLength) {
312 if (address.isLoopbackAddress()) {
313 throw new IllegalArgumentException("Bad address");
315 if (address instanceof Inet4Address) {
319 } else if (address instanceof Inet6Address) {
380 * Add a network address to the VPN interface. Both IPv4 and IPv6
381 * addresses are supported. At least one address must be set before
384 * Adding an address implicitly allows traffic from that address family
387 * @throws IllegalArgumentException if the address is invalid.
389 public Builder addAddress(InetAddress address, int prefixLength) {
390 check(address, prefixLength);
392 if (address.isAnyLocalAddress()) {
393 throw new IllegalArgumentException("Bad address");
395 mAddresses.add(new LinkAddress(address, prefixLength));
396 mConfig.updateAllowedFamilies(address);
401 * Convenience method to add a network address to the VPN interface
402 * using a numeric address string. See {@link InetAddress} for the
403 * definitions of numeric address formats.
405 * Adding an address implicitly allows traffic from that address family
408 * @throws IllegalArgumentException if the address is invalid.
411 public Builder addAddress(String address, int prefixLength) {
412 return addAddress(InetAddress.parseNumericAddress(address), prefixLength);
419 * Adding a route implicitly allows traffic from that address family
424 public Builder addRoute(InetAddress address, int prefixLength) {
425 check(address, prefixLength);
428 byte[] bytes = address.getAddress();
432 throw new IllegalArgumentException("Bad address");
436 mRoutes.add(new RouteInfo(new LinkAddress(address, prefixLength), null));
437 mConfig.updateAllowedFamilies(address);
443 * using a numeric address string. See {@link InetAddress} for the
444 * definitions of numeric address formats.
446 * Adding a route implicitly allows traffic from that address family
452 public Builder addRoute(String address, int prefixLength) {
453 return addRoute(InetAddress.parseNumericAddress(address), prefixLength);
461 * Adding a server implicitly allows traffic from that address family
464 * @throws IllegalArgumentException if the address is invalid.
466 public Builder addDnsServer(InetAddress address) {
467 if (address.isLoopbackAddress() || address.isAnyLocalAddress()) {
468 throw new IllegalArgumentException("Bad address");
473 mConfig.dnsServers.add(address.getHostAddress());
479 * using a numeric address string. See {@link InetAddress} for the
480 * definitions of numeric address formats.
482 * Adding a server implicitly allows traffic from that address family
485 * @throws IllegalArgumentException if the address is invalid.
488 public Builder addDnsServer(String address) {
489 return addDnsServer(InetAddress.parseNumericAddress(address));
504 * Allows traffic from the specified address family.
506 * By default, if no address, route or DNS server of a specific family (IPv4 or IPv6) is
507 * added to this VPN, then all outgoing traffic of that family is blocked. If any address,
510 * This method allows an address family to be unblocked even without adding an address,
517 * @param family The address family ({@code AF_INET} or {@code AF_INET6}) to allow.