Lines Matching refs:address

64  * conflict with each other. The system takes several actions to address
234 * Adds a network address to the VPN interface.
237 * address is already in use or cannot be assigned to the interface for any other reason.
239 * Adding an address implicitly allows traffic from that address family (i.e., IPv4 or IPv6) to
242 * @throws {@link IllegalArgumentException} if the address is invalid.
244 * @param address The IP address (IPv4 or IPv6) to assign to the VPN interface.
245 * @param prefixLength The prefix length of the address.
252 public boolean addAddress(InetAddress address, int prefixLength) {
253 check(address, prefixLength);
255 return getService().addVpnAddress(address.getHostAddress(), prefixLength);
262 * Removes a network address from the VPN interface.
265 * address is not assigned to the VPN interface, or if it is the only address assigned (thus
266 * cannot be removed), or if the address cannot be removed for any other reason.
268 * After removing an address, if there are no addresses, routes or DNS servers of a particular
269 * address family (i.e., IPv4 or IPv6) configured on the VPN, that <b>DOES NOT</b> block that
270 * family from being routed. In other words, once an address family has been allowed, it stays
273 * @throws {@link IllegalArgumentException} if the address is invalid.
275 * @param address The IP address (IPv4 or IPv6) to assign to the VPN interface.
276 * @param prefixLength The prefix length of the address.
282 public boolean removeAddress(InetAddress address, int prefixLength) {
283 check(address, prefixLength);
285 return getService().removeVpnAddress(address.getHostAddress(), prefixLength);
377 * Private method to validate address and prefixLength.
379 private static void check(InetAddress address, int prefixLength) {
380 if (address.isLoopbackAddress()) {
381 throw new IllegalArgumentException("Bad address");
383 if (address instanceof Inet4Address) {
387 } else if (address instanceof Inet6Address) {
448 * Add a network address to the VPN interface. Both IPv4 and IPv6
449 * addresses are supported. At least one address must be set before
452 * Adding an address implicitly allows traffic from that address family
455 * @throws IllegalArgumentException if the address is invalid.
457 public Builder addAddress(InetAddress address, int prefixLength) {
458 check(address, prefixLength);
460 if (address.isAnyLocalAddress()) {
461 throw new IllegalArgumentException("Bad address");
463 mAddresses.add(new LinkAddress(address, prefixLength));
464 mConfig.updateAllowedFamilies(address);
469 * Convenience method to add a network address to the VPN interface
470 * using a numeric address string. See {@link InetAddress} for the
471 * definitions of numeric address formats.
473 * Adding an address implicitly allows traffic from that address family
476 * @throws IllegalArgumentException if the address is invalid.
479 public Builder addAddress(String address, int prefixLength) {
480 return addAddress(InetAddress.parseNumericAddress(address), prefixLength);
487 * Adding a route implicitly allows traffic from that address family
492 public Builder addRoute(InetAddress address, int prefixLength) {
493 check(address, prefixLength);
496 byte[] bytes = address.getAddress();
500 throw new IllegalArgumentException("Bad address");
504 mRoutes.add(new RouteInfo(new IpPrefix(address, prefixLength), null));
505 mConfig.updateAllowedFamilies(address);
511 * using a numeric address string. See {@link InetAddress} for the
512 * definitions of numeric address formats.
514 * Adding a route implicitly allows traffic from that address family
520 public Builder addRoute(String address, int prefixLength) {
521 return addRoute(InetAddress.parseNumericAddress(address), prefixLength);
529 * Adding a server implicitly allows traffic from that address family
532 * @throws IllegalArgumentException if the address is invalid.
534 public Builder addDnsServer(InetAddress address) {
535 if (address.isLoopbackAddress() || address.isAnyLocalAddress()) {
536 throw new IllegalArgumentException("Bad address");
541 mConfig.dnsServers.add(address.getHostAddress());
547 * using a numeric address string. See {@link InetAddress} for the
548 * definitions of numeric address formats.
550 * Adding a server implicitly allows traffic from that address family
553 * @throws IllegalArgumentException if the address is invalid.
556 public Builder addDnsServer(String address) {
557 return addDnsServer(InetAddress.parseNumericAddress(address));
572 * Allows traffic from the specified address family.
574 * By default, if no address, route or DNS server of a specific family (IPv4 or IPv6) is
575 * added to this VPN, then all outgoing traffic of that family is blocked. If any address,
578 * This method allows an address family to be unblocked even without adding an address,
585 * @param family The address family ({@code AF_INET} or {@code AF_INET6}) to allow.