Kea 2.7.6
isc::dhcp::SubnetAllocationState Class Reference

Common base class for subnet-specific allocation states. More...

#include <allocation_state.h>

+ Inheritance diagram for isc::dhcp::SubnetAllocationState:

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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ SubnetAllocationState()

isc::dhcp::SubnetAllocationState::SubnetAllocationState ( )

Constructor.

Initializes the mutex.

Definition at line 17 of file allocation_state.cc.

References last_allocated_time_.

Member Function Documentation

◆ getLastAllocatedTime()

boost::posix_time::ptime isc::dhcp::SubnetAllocationState::getLastAllocatedTime ( ) const

Returns last allocation time for the specified lease type.

Returns
Last allocation time for the lease type or 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_.

◆ setCurrentAllocatedTimeInternal()

void isc::dhcp::SubnetAllocationState::setCurrentAllocatedTimeInternal ( )
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().

Member Data Documentation

◆ last_allocated_time_

boost::posix_time::ptime isc::dhcp::SubnetAllocationState::last_allocated_time_
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().

◆ mutex_

boost::scoped_ptr<std::mutex> isc::dhcp::SubnetAllocationState::mutex_
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().


The documentation for this class was generated from the following files: