/** * Creates an APL element corresponding to an IPv4 or IPv6 prefix. * @param negative Indicates if this prefix is a negation. * @param address The IPv4 or IPv6 address. * @param prefixLength The length of this prefix, in bits. * @throws IllegalArgumentException The prefix length is invalid. */ public Element(boolean negative, InetAddress address, int prefixLength) { this(Address.familyOf(address), negative, address, prefixLength); }
/** * Creates an APL element corresponding to an IPv4 or IPv6 prefix. * @param negative Indicates if this prefix is a negation. * @param address The IPv4 or IPv6 address. * @param prefixLength The length of this prefix, in bits. * @throws IllegalArgumentException The prefix length is invalid. */ public Element(boolean negative, InetAddress address, int prefixLength) { this(Address.familyOf(address), negative, address, prefixLength); }
/** * Creates an APL element corresponding to an IPv4 or IPv6 prefix. * @param negative Indicates if this prefix is a negation. * @param address The IPv4 or IPv6 address. * @param prefixLength The length of this prefix, in bits. * @throws IllegalArgumentException The prefix length is invalid. */ public Element(boolean negative, InetAddress address, int prefixLength) { this(Address.familyOf(address), negative, address, prefixLength); }
/** * Creates an APL element corresponding to an IPv4 or IPv6 prefix. * @param negative Indicates if this prefix is a negation. * @param address The IPv4 or IPv6 address. * @param prefixLength The length of this prefix, in bits. * @throws IllegalArgumentException The prefix length is invalid. */ public Element(boolean negative, InetAddress address, int prefixLength) { this(Address.familyOf(address), negative, address, prefixLength); }
/** * Creates an AAAA Record from the given data * @param address The address suffix */ public AAAARecord(Name name, int dclass, long ttl, InetAddress address) { super(name, Type.AAAA, dclass, ttl); if (Address.familyOf(address) != Address.IPv6) throw new IllegalArgumentException("invalid IPv6 address"); this.address = address; }
/** * Creates an AAAA Record from the given data * @param address The address suffix */ public AAAARecord(Name name, int dclass, long ttl, InetAddress address) { super(name, Type.AAAA, dclass, ttl); if (Address.familyOf(address) != Address.IPv6) throw new IllegalArgumentException("invalid IPv6 address"); this.address = address; }
/** * Creates an AAAA Record from the given data * @param address The address suffix */ public AAAARecord(Name name, int dclass, long ttl, InetAddress address) { super(name, Type.AAAA, dclass, ttl); if (Address.familyOf(address) != Address.IPv6) throw new IllegalArgumentException("invalid IPv6 address"); this.address = address; }
/** * Creates an AAAA Record from the given data * @param address The address suffix */ public AAAARecord(Name name, int dclass, long ttl, InetAddress address) { super(name, Type.AAAA, dclass, ttl); if (Address.familyOf(address) != Address.IPv6) throw new IllegalArgumentException("invalid IPv6 address"); this.address = address.getAddress(); }
/** * Creates an A Record from the given data * @param address The address that the name refers to */ public ARecord(Name name, int dclass, long ttl, InetAddress address) { super(name, Type.A, dclass, ttl); if (Address.familyOf(address) != Address.IPv4) throw new IllegalArgumentException("invalid IPv4 address"); addr = fromArray(address.getAddress()); }
/** * Creates an A Record from the given data * @param address The address that the name refers to */ public ARecord(Name name, int dclass, long ttl, InetAddress address) { super(name, Type.A, dclass, ttl); if (Address.familyOf(address) != Address.IPv4) throw new IllegalArgumentException("invalid IPv4 address"); addr = fromArray(address.getAddress()); }
/** * Creates an A Record from the given data * @param address The address that the name refers to */ public ARecord(Name name, int dclass, long ttl, InetAddress address) { super(name, Type.A, dclass, ttl); if (Address.familyOf(address) != Address.IPv4) throw new IllegalArgumentException("invalid IPv4 address"); addr = fromArray(address.getAddress()); }
/** * Creates an A Record from the given data * @param address The address that the name refers to */ public ARecord(Name name, int dclass, long ttl, InetAddress address) { super(name, Type.A, dclass, ttl); if (Address.familyOf(address) != Address.IPv4) throw new IllegalArgumentException("invalid IPv4 address"); addr = fromArray(address.getAddress()); }
/** * Creates a WKS Record from the given data * @param address The IP address * @param protocol The IP protocol number * @param services An array of supported services, represented by port number. */ public WKSRecord(Name name, int dclass, long ttl, InetAddress address, int protocol, int [] services) { super(name, Type.WKS, dclass, ttl); if (Address.familyOf(address) != Address.IPv4) throw new IllegalArgumentException("invalid IPv4 address"); this.address = address.getAddress(); this.protocol = checkU8("protocol", protocol); for (int i = 0; i < services.length; i++) { checkU16("service", services[i]); } this.services = new int[services.length]; System.arraycopy(services, 0, this.services, 0, services.length); Arrays.sort(this.services); }
/** * Creates a WKS Record from the given data * @param address The IP address * @param protocol The IP protocol number * @param services An array of supported services, represented by port number. */ public WKSRecord(Name name, int dclass, long ttl, InetAddress address, int protocol, int [] services) { super(name, Type.WKS, dclass, ttl); if (Address.familyOf(address) != Address.IPv4) throw new IllegalArgumentException("invalid IPv4 address"); this.address = address.getAddress(); this.protocol = checkU8("protocol", protocol); for (int i = 0; i < services.length; i++) { checkU16("service", services[i]); } this.services = new int[services.length]; System.arraycopy(services, 0, this.services, 0, services.length); Arrays.sort(this.services); }
/** * Creates a WKS Record from the given data * @param address The IP address * @param protocol The IP protocol number * @param services An array of supported services, represented by port number. */ public WKSRecord(Name name, int dclass, long ttl, InetAddress address, int protocol, int [] services) { super(name, Type.WKS, dclass, ttl); if (Address.familyOf(address) != Address.IPv4) throw new IllegalArgumentException("invalid IPv4 address"); this.address = address.getAddress(); this.protocol = checkU8("protocol", protocol); for (int i = 0; i < services.length; i++) { checkU16("service", services[i]); } this.services = new int[services.length]; System.arraycopy(services, 0, this.services, 0, services.length); Arrays.sort(this.services); }
/** * Creates an A6 Record from the given data * @param prefixBits The number of bits in the address prefix * @param suffix The address suffix * @param prefix The name of the prefix */ public A6Record(Name name, int dclass, long ttl, int prefixBits, InetAddress suffix, Name prefix) { super(name, Type.A6, dclass, ttl); this.prefixBits = checkU8("prefixBits", prefixBits); if (suffix != null && Address.familyOf(suffix) != Address.IPv6) throw new IllegalArgumentException("invalid IPv6 address"); this.suffix = suffix; if (prefix != null) this.prefix = checkName("prefix", prefix); }
/** * Creates an A6 Record from the given data * @param prefixBits The number of bits in the address prefix * @param suffix The address suffix * @param prefix The name of the prefix */ public A6Record(Name name, int dclass, long ttl, int prefixBits, InetAddress suffix, Name prefix) { super(name, Type.A6, dclass, ttl); this.prefixBits = checkU8("prefixBits", prefixBits); if (suffix != null && Address.familyOf(suffix) != Address.IPv6) throw new IllegalArgumentException("invalid IPv6 address"); this.suffix = suffix; if (prefix != null) this.prefix = checkName("prefix", prefix); }
/** * Creates an A6 Record from the given data * @param prefixBits The number of bits in the address prefix * @param suffix The address suffix * @param prefix The name of the prefix */ public A6Record(Name name, int dclass, long ttl, int prefixBits, InetAddress suffix, Name prefix) { super(name, Type.A6, dclass, ttl); this.prefixBits = checkU8("prefixBits", prefixBits); if (suffix != null && Address.familyOf(suffix) != Address.IPv6) throw new IllegalArgumentException("invalid IPv6 address"); this.suffix = suffix; if (prefix != null) this.prefix = checkName("prefix", prefix); }
/** * Creates an A6 Record from the given data * @param prefixBits The number of bits in the address prefix * @param suffix The address suffix * @param prefix The name of the prefix */ public A6Record(Name name, int dclass, long ttl, int prefixBits, InetAddress suffix, Name prefix) { super(name, Type.A6, dclass, ttl); this.prefixBits = checkU8("prefixBits", prefixBits); if (suffix != null && Address.familyOf(suffix) != Address.IPv6) throw new IllegalArgumentException("invalid IPv6 address"); this.suffix = suffix; if (prefix != null) this.prefix = checkName("prefix", prefix); }
/** * Construct a Client Subnet option. Note that the number of significant bits * in the address must not be greater than the supplied source netmask. There * may also be issues related to Java's handling of mapped addresses * @param sourceNetmask The length of the netmask pertaining to the query. * In replies, it mirrors the same value as in the requests. * @param scopeNetmask The length of the netmask pertaining to the reply. * In requests, it MUST be set to 0. In responses, this may or may not match * the source netmask. * @param address The address of the client. */ public ClientSubnetOption(int sourceNetmask, int scopeNetmask, InetAddress address) { super(EDNSOption.Code.CLIENT_SUBNET); this.family = Address.familyOf(address); this.sourceNetmask = checkMaskLength("source netmask", this.family, sourceNetmask); this.scopeNetmask = checkMaskLength("scope netmask", this.family, scopeNetmask); this.address = Address.truncate(address, sourceNetmask); if (!address.equals(this.address)) throw new IllegalArgumentException("source netmask is not " + "valid for address"); }