/**
         * Build a BindingPrefix for the given InetAddress and Link.
         *
         * @param inetAddr the inet addr
         * @param clientLink the client link
         * @param requestMsg the request msg
         *
         * @return the binding address
         */
        protected override BindingObject BuildBindingObject(IPAddress inetAddr,
                                                            DhcpLink clientLink, DhcpMessage requestMsg)
        {
            V6PrefixBindingPool bp =
                (V6PrefixBindingPool)FindBindingPool(clientLink.GetLink(), inetAddr, requestMsg);

            if (bp != null)
            {
                bp.SetUsed(inetAddr);   // TODO check if this is necessary
                IaPrefix iaPrefix = new IaPrefix();
                iaPrefix.SetIpAddress(inetAddr);
                iaPrefix.SetPrefixLength((short)bp.GetAllocPrefixLen());
                V6BindingPrefix bindingPrefix = new V6BindingPrefix(iaPrefix, bp);
                SetBindingObjectTimes(bindingPrefix,
                                      bp.GetPreferredLifetimeMs(), bp.GetPreferredLifetimeMs());
                // TODO store the configured options in the persisted binding?
                // bindingPrefix.setDhcpOptions(bp.getDhcpOptions());
                return(bindingPrefix);
            }
            else
            {
                log.Error("Failed to create BindingPrefix: No BindingPool found for IP=" +
                          inetAddr.ToString());
            }
            // MUST have a BindingPool, otherwise something's broke
            return(null);
        }
        /**
         * Builds a binding pool from an PrefixPool using the given link and filter.
         *
         * @param pool the AddressPool to wrap as an PrefixBindingPool
         * @param link the link
         * @param linkFilter the link filter
         *
         * @return the binding pool
         *
         * @throws DhcpServerConfigException if there is a problem parsing the configured range
         */
        protected V6PrefixBindingPool BuildV6BindingPool(v6PrefixPool pool, link link,
                                                         linkFilter linkFilter)
        {
            V6PrefixBindingPool bp = new V6PrefixBindingPool(pool);
            long pLifetime         =
                DhcpServerPolicies.EffectivePolicyAsLong(bp, link, Property.PREFERRED_LIFETIME);

            bp.SetPreferredLifetime(pLifetime);
            long vLifetime =
                DhcpServerPolicies.EffectivePolicyAsLong(bp, link, Property.VALID_LIFETIME);

            bp.SetValidLifetime(vLifetime);
            bp.SetLinkFilter(linkFilter);

            List <IPAddress> usedIps = iaMgr.FindExistingIPs(bp.GetStartAddress(), bp.GetEndAddress());

            if ((usedIps != null) && usedIps.Count > 0)
            {
                foreach (IPAddress ip in usedIps)
                {
                    //TODO: for the quickest startup?...
                    // set IP as used without checking if the binding has expired
                    // let the reaper thread deal with all binding cleanup activity
                    bp.SetUsed(ip);
                }
            }
            log.Info("Built prefix binding pool: " + bp.GetStartAddress().ToString() + "-" +
                     bp.GetEndAddress().ToString() + ", size=" + bp.GetSize());
            return(bp);
        }