/** * 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"); }
/** * Construct a Client Subnet option. Note that the number of significant bits in * the address must not be greater than the supplied source netmask. * XXX something about Java's 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(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"); }
/** * Construct a Client Subnet option. Note that the number of significant bits in * the address must not be greater than the supplied source netmask. * XXX something about Java's 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"); }
InetAddress tmp = Address.truncate(address, sourceNetmask); if (!tmp.equals(address)) throw new WireParseException("invalid padding");
InetAddress tmp = Address.truncate(address, sourceNetmask); if (!tmp.equals(address)) throw new WireParseException("invalid padding");
InetAddress tmp = Address.truncate(address, sourceNetmask); if (!tmp.equals(address)) throw new WireParseException("invalid padding");