Kea 2.7.4
allocation_state.h
Go to the documentation of this file.
1// Copyright (C) 2022-2023 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#ifndef ALLOCATION_STATE_H
8#define ALLOCATION_STATE_H
9
10#include <dhcpsrv/lease.h>
11#include <boost/scoped_ptr.hpp>
12#include <boost/shared_ptr.hpp>
13#include <boost/date_time/posix_time/posix_time.hpp>
14#include <mutex>
15
16namespace isc {
17namespace dhcp {
18
32public:
33
35 virtual ~AllocationState() = default;
36};
37
39typedef boost::shared_ptr<AllocationState> AllocationStatePtr;
40
49public:
50
55
61 boost::posix_time::ptime
63
64protected:
65
71
73 boost::scoped_ptr<std::mutex> mutex_;
74
77 boost::posix_time::ptime last_allocated_time_;
78};
79
80typedef boost::shared_ptr<SubnetAllocationState> SubnetAllocationStatePtr;
81
82} // end of namespace isc::dhcp
83} // end of namespace isc
84
85#endif // ALLOCATION_STATE_H
Base class for representing allocation state in pools and subnets.
virtual ~AllocationState()=default
Virtual destructor.
Common base class for subnet-specific allocation states.
boost::posix_time::ptime last_allocated_time_
Timestamp indicating when a lease has been last allocated from the subnet.
boost::posix_time::ptime getLastAllocatedTime() const
Returns last allocation time for the specified lease type.
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.
boost::shared_ptr< AllocationState > AllocationStatePtr
Type of the pointer to the AllocationState.
boost::shared_ptr< SubnetAllocationState > SubnetAllocationStatePtr
Defines the logger used by the top-level component of kea-lfc.