public V6PrefixBindingPool(V6PrefixPool pool) throws DhcpServerConfigException { try { this.pool = pool; allocPrefixLen = pool.getPrefixLength(); String[] cidr = pool.getRange().split("/"); if (cidr.length != 2) { throw new DhcpServerConfigException("Prefix pool must be specified in prefix/len notation"); } subnet = new Subnet(cidr[0], cidr[1]); if (allocPrefixLen < subnet.getPrefixLength()) { throw new DhcpServerConfigException( "Allocation prefix length must be greater or equal to pool prefix length"); } int numPrefixes = (int) Math.pow(2, allocPrefixLen - subnet.getPrefixLength()); freeList = new FreeList(BigInteger.ZERO, BigInteger.valueOf(numPrefixes).subtract(BigInteger.ONE)); dhcpConfigOptions = new DhcpV6ConfigOptions(pool.getPrefixConfigOptions()); } catch (NumberFormatException | UnknownHostException ex) { log.error("Invalid PrefixPool definition", ex); throw new DhcpServerConfigException("Invalid PrefixPool definition", ex); } }
@Override public PoliciesType getPolicies() { return pool == null ? null : pool.getPolicies(); }
@Override public FiltersType getFilters() { return pool == null ? null : pool.getFilters(); }