11#include <boost/date_time/posix_time/posix_time.hpp>
12#include <boost/make_shared.hpp>
22 auto subnet_prefix = subnet->get();
23 return (boost::make_shared<SubnetIterativeAllocationState>(subnet_prefix.first, subnet_prefix.second));
27 const uint8_t prefix_length)
35 return (last_allocated_);
41 last_allocated_ = address;
48 return (boost::make_shared<PoolIterativeAllocationState>(pool->getFirstAddress()));
52 : last_allocated_(first), last_allocated_valid_(false) {
The IOAddress class represents an IP addresses (version agnostic)
static PoolIterativeAllocationStatePtr create(const PoolPtr &pool)
Factory function creating the state instance from pool.
PoolIterativeAllocationState(const asiolink::IOAddress &first)
Constructor.
Common base class for subnet-specific allocation states.
boost::scoped_ptr< std::mutex > mutex_
Mutex used for thread-safe access to the state members.
void setCurrentAllocatedTimeInternal()
Sets the last allocation time to current.
asiolink::IOAddress getLastAllocated() const
Returns last allocated address or prefix.
SubnetIterativeAllocationState(const asiolink::IOAddress &prefix, const uint8_t prefix_length)
Constructor.
void setLastAllocated(const asiolink::IOAddress &address)
Sets last allocated address or prefix.
static SubnetIterativeAllocationStatePtr create(const SubnetPtr &subnet)
Factory function creating the state instance from subnet.
IOAddress lastAddrInPrefix(const IOAddress &prefix, uint8_t len)
returns a last address in a given prefix
boost::shared_ptr< Subnet > SubnetPtr
A generic pointer to either Subnet4 or Subnet6 object.
boost::shared_ptr< Pool > PoolPtr
a pointer to either IPv4 or IPv6 Pool
boost::shared_ptr< PoolIterativeAllocationState > PoolIterativeAllocationStatePtr
Type of the pointer to the PoolIterativeAllocationState.
boost::shared_ptr< SubnetIterativeAllocationState > SubnetIterativeAllocationStatePtr
Type of the pointer to the SubnetIterativeAllocationState.
Defines the logger used by the top-level component of kea-lfc.
RAII lock object to protect the code in the same scope with a mutex.