7 #ifndef RESOURCE_HANDLER_H 8 #define RESOURCE_HANDLER_H 13 #include <boost/noncopyable.hpp> 14 #include <boost/multi_index_container.hpp> 15 #include <boost/multi_index/composite_key.hpp> 16 #include <boost/multi_index/hashed_index.hpp> 17 #include <boost/multi_index/member.hpp> 18 #include <boost/multi_index/mem_fun.hpp> 19 #include <boost/shared_ptr.hpp> 84 : type_(type), addr_(addr) {
94 std::vector<uint8_t> toBytes()
const {
100 typedef boost::shared_ptr<Resource> ResourcePtr;
103 typedef boost::multi_index_container<
109 boost::multi_index::indexed_by<
112 boost::multi_index::hashed_unique<
113 boost::multi_index::composite_key<
116 boost::multi_index::member<
120 boost::multi_index::const_mem_fun<
121 Resource, std::vector<uint8_t>, &Resource::toBytes
134 static ResourceContainer resources_;
137 static std::mutex mutex_;
173 ResourceContainer owned_;
221 #endif // RESOURCE_HANDLER_H
Resource race avoidance RAII handler for DHCPv4.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Resource race avoidance RAII handler.
Thrown by lock users when a resource lock cannot be obtained.
virtual ~ResourceHandler4()
Destructor.
std::vector< uint8_t > toBytes() const
Return address as set of bytes.
This is a base class for exceptions thrown from the DNS library module.
Defines the logger used by the top-level component of kea-lfc.
Type
Type of lease or pool.
bool isLocked4(const asiolink::IOAddress &addr)
Checks if a resource is owned by this handler.
void unLock4(const asiolink::IOAddress &addr)
Releases a resource.
The IOAddress class represents an IP addresses (version agnostic)
ResourceBusy(const char *file, size_t line, const char *what)
bool tryLock4(const asiolink::IOAddress &addr)
Tries to acquires a resource.