예제 #1
0
 /**
  * Test if the given address is contained within this address pool.
  *
  * @param addr the address to test for containment in this address pool
  * @return true, if successful
  */
 public boolean contains(InetAddress addr) {
   if ((Util.compareInetAddrs(addr, range.getStartAddress()) >= 0)
       && (Util.compareInetAddrs(addr, range.getEndAddress()) <= 0)) {
     return true;
   }
   return false;
 }
예제 #2
0
 /**
  * Instantiates a new binding pool.
  *
  * @param pool the pool
  * @throws DhcpServerConfigException if the AddressPool definition is invalid
  */
 public V4AddressBindingPool(V4AddressPool pool) throws DhcpServerConfigException {
   this.pool = pool;
   try {
     this.range = new Range(pool.getRange());
   } catch (NumberFormatException ex) {
     log.error("Invalid AddressPool definition", ex);
     throw new DhcpServerConfigException("Invalid AddressPool definition", ex);
   } catch (UnknownHostException ex) {
     log.error("Invalid AddressPool definition", ex);
     throw new DhcpServerConfigException("Invalid AddressPool definition", ex);
   }
   freeList =
       new FreeList(
           new BigInteger(range.getStartAddress().getAddress()),
           new BigInteger(range.getEndAddress().getAddress()));
   reaper = new Timer(pool.getRange() + "_Reaper");
   v4ConfigOptions = new DhcpV4ConfigOptions(pool.getConfigOptions());
 }
예제 #3
0
 public String toString() {
   return range.getStartAddress().getHostAddress() + "-" + range.getEndAddress().getHostAddress();
 }
예제 #4
0
 /**
  * Gets the end address.
  *
  * @return the end address
  */
 public InetAddress getEndAddress() {
   return range.getEndAddress();
 }