16#include <boost/noncopyable.hpp>
17#include <boost/scoped_ptr.hpp>
88 static void addBackend(
const std::string& access);
94 static bool delBackend(
const std::string& db_type);
105 static bool delBackend(
const std::string& db_type,
106 const std::string& access,
107 bool if_unusable =
false);
153 const uint8_t* identifier_begin,
154 const size_t identifier_len,
161 const uint8_t* identifier_begin,
162 const size_t identifier_len)
const;
295 size_t& source_index,
296 uint64_t lower_host_id,
325 size_t& source_index,
326 uint64_t lower_host_id,
353 uint64_t lower_host_id,
380 uint64_t lower_host_id,
425 const uint8_t* identifier_begin,
426 const size_t identifier_len,
434 const uint8_t* identifier_begin,
435 const size_t identifier_len)
const;
453 const uint8_t* identifier_begin,
const size_t identifier_len,
460 const uint8_t* identifier_begin,
const size_t identifier_len)
const;
537 const uint8_t* identifier_begin,
538 const size_t identifier_len,
546 const uint8_t* identifier_begin,
547 const size_t identifier_len)
const;
565 const uint8_t* identifier_begin,
const size_t identifier_len,
572 const uint8_t* identifier_begin,
const size_t identifier_len)
const;
714 const uint8_t* identifier_begin,
const size_t identifier_len,
721 const uint8_t* identifier_begin,
const size_t identifier_len);
737 const uint8_t* identifier_begin,
const size_t identifier_len,
744 const uint8_t* identifier_begin,
const size_t identifier_len);
764 return (std::string(
"host_mgr"));
771 return (alternate_sources_);
832 return (ip_reservations_unique_);
866 const uint8_t* identifier_begin,
867 const size_t identifier_len)
const;
877 bool ip_reservations_unique_;
881 ip_reservations_unique_(true) { }
891 static boost::scoped_ptr<HostMgr>& getHostMgrPtr();
The IOAddress class represents an IP addresses (version agnostic)
Base interface for the classes implementing simple data source for host reservations.
ConstHostCollection getAll6(const SubnetID &subnet_id, const HostMgrOperationTarget target) const
Return all hosts in a DHCPv6 subnet.
ConstHostCollection getAll4(const SubnetID &subnet_id, const HostMgrOperationTarget target) const
Return all hosts in a DHCPv4 subnet.
static void delAllBackends()
Delete all alternate backends.
static void create()
Creates new instance of the HostMgr.
bool negative_caching_
The negative caching flag.
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.
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.
bool getNegativeCaching() const
Returns the negative caching flag.
virtual bool setIPReservationsUnique(const bool unique)
Controls whether IP reservations are unique or non-unique.
ConstHostPtr get6Any(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len, const HostMgrOperationTarget target) const
Returns any host connected to the IPv6 subnet.
void setDisableSingleQuery(bool disable_single_query)
Sets the disable single query flag.
virtual std::string getType() const
Return backend type.
ConstHostCollection getAllbyHostname4(const std::string &hostname, const SubnetID &subnet_id, const HostMgrOperationTarget target) const
Return all hosts with a hostname in a DHCPv4 subnet.
bool del4(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len, const HostMgrOperationTarget target)
Attempts to delete a host by (subnet4-id, identifier, identifier-type, operation-target)
virtual void cache(ConstHostPtr host) const
Cache an answer.
static bool delBackend(const std::string &db_type)
Delete an alternate host backend (aka host data source).
static void addBackend(const std::string &access)
Add an alternate host backend (aka host data source).
ConstHostCollection getAll(const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len, const HostMgrOperationTarget target) const
Return all hosts connected to any subnet for which reservations have been made using a specified iden...
ConstHostPtr get4Any(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len, const HostMgrOperationTarget target) const
Returns any host connected to the IPv4 subnet.
bool getDisableSingleQuery() const
Returns the disable single query flag.
bool del6(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len, const HostMgrOperationTarget target)
Attempts to delete a host by (subnet6-id, identifier, identifier-type, operation-target)
void add(const HostPtr &host, const HostMgrOperationTarget target)
Adds a new host to the alternate data source.
bool del(const SubnetID &subnet_id, const asiolink::IOAddress &addr, const HostMgrOperationTarget target)
Attempts to delete hosts by address.
void setNegativeCaching(bool negative_caching)
Sets the negative caching flag.
ConstHostCollection getAllbyHostname6(const std::string &hostname, const SubnetID &subnet_id, const HostMgrOperationTarget target) const
Return all hosts with a hostname in a DHCPv6 subnet.
bool disable_single_query_
The disable single query flag.
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.
HostDataSourcePtr getHostDataSource() const
Returns the first host data source.
static bool checkCacheBackend(bool logging=false)
Check for the cache host backend.
bool getIPReservationsUnique() const
Returns the boolean flag indicating if the IP reservations must be unique or can be non-unique.
static HostMgr & instance()
Returns a sole instance of the HostMgr.
void update(HostPtr const &host, const HostMgrOperationTarget target)
Implements BaseHostDataSource::update() for alternate sources.
ConstHostCollection getAllbyHostname(const std::string &hostname, const HostMgrOperationTarget target) const
Return all hosts with a hostname.
HostDataSourceList & getHostDataSourceList()
Returns the host data source list.
ConstHostPtr get4(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len, const HostMgrOperationTarget target) const
Returns a host connected to the IPv4 subnet.
ConstHostPtr get6(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len, const HostMgrOperationTarget target) const
Returns a host connected to the IPv6 subnet.
Wraps value holding size of the page with host reservations.
IdentifierType
Type of the host identifier.
boost::shared_ptr< BaseHostDataSource > HostDataSourcePtr
HostDataSource pointer.
boost::shared_ptr< Host > HostPtr
Pointer to the Host object.
std::vector< ConstHostPtr > ConstHostCollection
Collection of the const Host objects.
std::vector< HostDataSourcePtr > HostDataSourceList
HostDataSource list.
boost::shared_ptr< CacheHostDataSource > CacheHostDataSourcePtr
CacheHostDataSource pointer.
uint32_t SubnetID
Defines unique IPv4 or IPv6 subnet identifier.
boost::shared_ptr< const Host > ConstHostPtr
Const pointer to the Host object.
Defines the logger used by the top-level component of kea-lfc.