Kea 2.7.5
|
Common base class for subnet-specific allocation states. More...
#include <allocation_state.h>
Public Member Functions | |
SubnetAllocationState () | |
Constructor. | |
boost::posix_time::ptime | getLastAllocatedTime () const |
Returns last allocation time for the specified lease type. | |
Public Member Functions inherited from isc::dhcp::AllocationState | |
virtual | ~AllocationState ()=default |
Virtual destructor. | |
Protected Member Functions | |
void | setCurrentAllocatedTimeInternal () |
Sets the last allocation time to current. | |
Protected Attributes | |
boost::posix_time::ptime | last_allocated_time_ |
Timestamp indicating when a lease has been last allocated from the subnet. | |
boost::scoped_ptr< std::mutex > | mutex_ |
Mutex used for thread-safe access to the state members. | |
Common base class for subnet-specific allocation states.
All subnet-specific allocation states should derive from this class. It provides a mutex for thread-safe access to the class members. It maintains last allocation times for various lease types. These times are used by the shared networks to find the "preferred" subnet (i.e., a subnet from which the latest lease was assigned).
Definition at line 48 of file allocation_state.h.
isc::dhcp::SubnetAllocationState::SubnetAllocationState | ( | ) |
Constructor.
Initializes the mutex.
Definition at line 17 of file allocation_state.cc.
References last_allocated_time_.
boost::posix_time::ptime isc::dhcp::SubnetAllocationState::getLastAllocatedTime | ( | ) | const |
Returns last allocation time for the specified lease type.
boost::posix_time::neg_infin
when no leases have been allocated from this subnet yet. Definition at line 23 of file allocation_state.cc.
References last_allocated_time_, and mutex_.
|
protected |
Sets the last allocation time to current.
This function should be called by derived classes. It should be called in the thread-safe context.
Definition at line 29 of file allocation_state.cc.
References last_allocated_time_.
Referenced by isc::dhcp::SubnetIterativeAllocationState::setLastAllocated().
|
protected |
Timestamp indicating when a lease has been last allocated from the subnet.
Definition at line 77 of file allocation_state.h.
Referenced by SubnetAllocationState(), getLastAllocatedTime(), and setCurrentAllocatedTimeInternal().
|
protected |
Mutex used for thread-safe access to the state members.
Definition at line 73 of file allocation_state.h.
Referenced by isc::dhcp::SubnetIterativeAllocationState::getLastAllocated(), getLastAllocatedTime(), and isc::dhcp::SubnetIterativeAllocationState::setLastAllocated().