16 #include <boost/noncopyable.hpp>
17 #include <boost/scoped_ptr.hpp>
75 static void addBackend(
const std::string& access);
81 static bool delBackend(
const std::string& db_type);
92 static bool delBackend(
const std::string& db_type,
93 const std::string& access,
94 bool if_unusable =
false);
139 const uint8_t* identifier_begin,
140 const size_t identifier_len)
const;
239 size_t& source_index,
240 uint64_t lower_host_id,
269 size_t& source_index,
270 uint64_t lower_host_id,
297 uint64_t lower_host_id,
324 uint64_t lower_host_id,
361 const uint8_t* identifier_begin,
362 const size_t identifier_len)
const;
379 const uint8_t* identifier_begin,
const size_t identifier_len)
const;
440 const uint8_t* identifier_begin,
441 const size_t identifier_len)
const;
458 const uint8_t* identifier_begin,
const size_t identifier_len)
const;
542 const uint8_t* identifier_begin,
const size_t identifier_len);
556 const uint8_t* identifier_begin,
const size_t identifier_len);
564 return (std::string(
"host_mgr"));
571 return (alternate_sources_);
632 return (ip_reservations_unique_);
639 io_service_ = io_service;
644 return (io_service_);
678 const uint8_t* identifier_begin,
679 const size_t identifier_len)
const;
689 bool ip_reservations_unique_;
692 HostMgr() : negative_caching_(false), disable_single_query_(false),
693 ip_reservations_unique_(true) { }
703 static boost::scoped_ptr<HostMgr>& getHostMgrPtr();
static HostMgr & instance()
Returns a sole instance of the HostMgr.
virtual ConstHostCollection getAllbyHostname(const std::string &hostname) const
Return all hosts with a hostname.
virtual ConstHostPtr get6Any(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const
Returns any host connected to the IPv6 subnet.
Wraps value holding size of the page with host reservations.
virtual ConstHostCollection getAllbyHostname6(const std::string &hostname, const SubnetID &subnet_id) const
Return all hosts with a hostname in a DHCPv6 subnet.
virtual ConstHostCollection getAll4(const SubnetID &subnet_id) const
Return all hosts in a DHCPv4 subnet.
static void setIOService(const isc::asiolink::IOServicePtr &io_service)
Sets IO service to be used by the Host Manager.
boost::shared_ptr< Host > HostPtr
Pointer to the Host object.
virtual ConstHostCollection getPage6(const SubnetID &subnet_id, size_t &source_index, uint64_t lower_host_id, const HostPageSize &page_size) const
Returns range of hosts in a DHCPv6 subnet.
void setNegativeCaching(bool negative_caching)
Sets the negative caching flag.
static isc::asiolink::IOServicePtr & getIOService()
Returns pointer to the IO service.
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
boost::shared_ptr< BaseHostDataSource > HostDataSourcePtr
HostDataSource pointer.
virtual void cache(ConstHostPtr host) const
Cache an answer.
virtual bool setIPReservationsUnique(const bool unique)
Controls whether IP reservations are unique or non-unique.
virtual ConstHostCollection getAll6(const SubnetID &subnet_id) const
Return all hosts in a DHCPv6 subnet.
virtual ConstHostCollection getAll(const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const
Return all hosts connected to any subnet for which reservations have been made using a specified iden...
virtual bool del6(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len)
Attempts to delete a host by (subnet6-id, identifier, identifier-type)
virtual ConstHostPtr get4Any(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const
Returns any host connected to the IPv4 subnet.
boost::shared_ptr< CacheHostDataSource > CacheHostDataSourcePtr
CacheHostDataSource pointer.
static bool delBackend(const std::string &db_type)
Delete an alternate host backend (aka host data source).
std::vector< ConstHostPtr > ConstHostCollection
Collection of the const Host objects.
static void create()
Creates new instance of the HostMgr.
virtual ConstHostPtr get6(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const
Returns a host connected to the IPv6 subnet.
virtual ConstHostCollection getAllbyHostname4(const std::string &hostname, const SubnetID &subnet_id) const
Return all hosts with a hostname in a DHCPv4 subnet.
boost::shared_ptr< const Host > ConstHostPtr
Const pointer to the Host object.
bool getDisableSingleQuery() const
Returns the disable single query flag.
HostDataSourcePtr getHostDataSource() const
Returns the first host data source.
Defines the logger used by the top-level component of kea-dhcp-ddns.
virtual std::string getType() const
Return backend type.
bool getNegativeCaching() const
Returns the negative caching flag.
void setDisableSingleQuery(bool disable_single_query)
Sets the disable single query flag.
bool getIPReservationsUnique() const
Returns the boolean flag indicating if the IP reservations must be unique or can be non-unique...
Base interface for the classes implementing simple data source for host reservations.
std::vector< HostDataSourcePtr > HostDataSourceList
HostDataSource list.
virtual bool del4(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len)
Attempts to delete a host by (subnet4-id, identifier, identifier-type)
static void delAllBackends()
Delete all alternate backends.
static void addBackend(const std::string &access)
Add an alternate host backend (aka host data source).
bool negative_caching_
The negative caching flag.
static bool checkCacheBackend(bool logging=false)
Check for the cache host backend.
virtual ConstHostPtr get4(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const
Returns a host connected to the IPv4 subnet.
virtual void cacheNegative(const SubnetID &ipv4_subnet_id, const SubnetID &ipv6_subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const
Cache a negative answer.
IdentifierType
Type of the host identifier.
The IOAddress class represents an IP addresses (version agnostic)
HostDataSourceList & getHostDataSourceList()
Returns the host data source list.
virtual ConstHostCollection getPage4(const SubnetID &subnet_id, size_t &source_index, uint64_t lower_host_id, const HostPageSize &page_size) const
Returns range of hosts in a DHCPv4 subnet.
virtual void add(const HostPtr &host)
Adds a new host to the alternate data source.
bool disable_single_query_
The disable single query flag.
uint32_t SubnetID
Unique identifier for a subnet (both v4 and v6)
virtual bool del(const SubnetID &subnet_id, const asiolink::IOAddress &addr)
Attempts to delete hosts by address.