7#ifndef LEASE_QUERY_IMPL_H
8#define LEASE_QUERY_IMPL_H
18#include <boost/functional/hash.hpp>
19#include <unordered_set>
32#define CHECK_TERMINATED \
33 if (LeaseQueryImpl::terminated_) { \
34 isc_throw(isc::lease_query::QueryTerminated, "terminated"); \
44 : family_(family) { };
65 return (addresses_.size());
78 std::unordered_set<asiolink::IOAddress, asiolink::IOAddress::Hash> addresses_;
84 const auto& f = p->getFirstAddress();
85 const auto& l = p->getLastAddress();
88 std::size_t h1 = haddr(f);
89 std::size_t h2 = haddr(l);
92 return h1 ^ (h2 + 0x9e3779b97f4a7c15ULL + (h1 << 6) + (h1 >> 2));
100 return a->getFirstAddress() == b->getFirstAddress() &&
101 a->getLastAddress() == b->getLastAddress();
118 : family_(family) { };
142 return (pools_.size());
179 return (address_list_.size());
184 return (pool_set_.size());
200 bool& invalid)
const = 0;
207 return (address_list_.getFamily());
214 return (io_service_);
221 io_service_ = io_service;
This is a base class for exceptions thrown from the DNS library module.
Exception(const char *file, size_t line, const char *what)
Constructor for a given type for exceptions with file name and file line number.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
The IOAddress class represents an IP addresses (version agnostic)
Manages a unique list of IP addresses.
size_t size() const
Returns the number of addresses in the list.
bool contains(const isc::asiolink::IOAddress &address) const
Checks if an address is present in the list.
AddressList(uint16_t family)
Constructor.
uint16_t getFamily()
Returns the protocol family of the address list.
void insert(const isc::asiolink::IOAddress &address)
Inserts an address into the list.
uint16_t getFamily()
Returns the protocol family of the impl.
static bool terminated_
Terminated flag.
LeaseQueryImpl(uint16_t family, const isc::data::ConstElementPtr config)
Constructor.
static const isc::data::SimpleKeywords LEASE_QUERY_KEYWORDS
Keywords for Lease Query configuration.
size_t getNumRequesters() const
Returns the number of valid requester.
size_t getNumRequesterPools() const
Returns the number of valid requester pools.
isc::asiolink::IOServicePtr getIOService()
Get the hook I/O service.
bool isRequester(const isc::asiolink::IOAddress &address) const
Checks if the given address belongs to a valid requester.
void setIOService(isc::asiolink::IOServicePtr io_service)
Set the hook I/O service.
static size_t PageSize
Page size to commands.
virtual void processQuery(isc::dhcp::PktPtr base_query, bool &invalid) const =0
Processes a single client Lease Query.
virtual ~LeaseQueryImpl()
Destructor.
Manages a unique set of Pools of a given protocol family.
uint16_t getFamily() const
Returns the protocol family of the address set.
size_t size() const
Returns the number of pools in the set.
void insert(const isc::asiolink::IOAddress &prefix, uint8_t prefix_len)
Inserts an pool into the set.
PoolSet(uint16_t family)
Constructor.
bool contains(const isc::asiolink::IOAddress &address) const
Checks if an address is present in the set.
QueryTerminated(const char *file, size_t line, const char *what)
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
boost::shared_ptr< const Element > ConstElementPtr
std::map< std::string, isc::data::Element::types > SimpleKeywords
This specifies all accepted keywords with their types.
boost::shared_ptr< isc::dhcp::Pkt > PktPtr
A pointer to either Pkt4 or Pkt6 packet.
boost::shared_ptr< Pool > PoolPtr
a pointer to either IPv4 or IPv6 Pool
boost::shared_ptr< LeaseQueryImpl > LeaseQueryImplPtr
Defines a smart pointer to LeaseQueryImpl instance.
std::unordered_set< isc::dhcp::PoolPtr, PoolRangeHash, PoolRangeEqual > PoolRangeSet
Defines an alias for a set of pools hashed by range.
Defines the logger used by the top-level component of kea-lfc.
An IOAddress hash enabling the use in the unordered STL containers.
Equality comparator for two pools based on their address range.
bool operator()(const isc::dhcp::PoolPtr &a, const isc::dhcp::PoolPtr &b) const noexcept
Hash for a Pool based on it's address range.
std::size_t operator()(const isc::dhcp::PoolPtr &p) const noexcept