Kea 2.5.8
allocation_state.cc
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#include <config.h>
10#include <boost/date_time/posix_time/posix_time.hpp>
11
12using namespace isc::util;
13
14namespace isc {
15namespace dhcp {
16
18 : AllocationState(), mutex_(new std::mutex) {
19 last_allocated_time_ = boost::posix_time::neg_infin;
20}
21
22boost::posix_time::ptime
25 return (last_allocated_time_);
26}
27
28void
30 last_allocated_time_ = boost::posix_time::microsec_clock::universal_time();
31}
32
33}
34}
Base class for representing allocation state in pools and subnets.
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.
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.