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();
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.
Wraps value holding size of the page with host reservations.
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.
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 getAll6(const SubnetID &subnet_id) const
Return all hosts in a DHCPv6 subnet.
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.
bool getDisableSingleQuery() const
Returns the disable single query flag.
virtual ConstHostCollection getAllbyHostname4(const std::string &hostname, const SubnetID &subnet_id) const
Return all hosts with a hostname in a DHCPv4 subnet.
void setNegativeCaching(bool negative_caching)
Sets the negative caching flag.
static isc::asiolink::IOServicePtr & getIOService()
Returns pointer to the IO service.
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 void cache(ConstHostPtr host) const
Cache an answer.
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
boost::shared_ptr< BaseHostDataSource > HostDataSourcePtr
HostDataSource pointer.
virtual bool setIPReservationsUnique(const bool unique)
Controls whether IP reservations are unique or non-unique.
bool getNegativeCaching() const
Returns the negative caching flag.
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.
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)
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 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.
boost::shared_ptr< const Host > ConstHostPtr
Const pointer to the Host object.
virtual ConstHostCollection getAllbyHostname6(const std::string &hostname, const SubnetID &subnet_id) const
Return all hosts with a hostname in a DHCPv6 subnet.
Defines the logger used by the top-level component of kea-lfc.
HostDataSourcePtr getHostDataSource() const
Returns the first host data source.
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 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.
void setDisableSingleQuery(bool disable_single_query)
Sets the disable single query flag.
virtual ConstHostCollection getAllbyHostname(const std::string &hostname) const
Return all hosts with a hostname.
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)
virtual ConstHostCollection getAll4(const SubnetID &subnet_id) const
Return all hosts in a DHCPv4 subnet.
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 std::string getType() const
Return backend type.
IdentifierType
Type of the host identifier.
The IOAddress class represents an IP addresses (version agnostic)
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.
HostDataSourceList & getHostDataSourceList()
Returns the host data source list.
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
Defines unique IPv4 or IPv6 subnet identifier.
virtual bool del(const SubnetID &subnet_id, const asiolink::IOAddress &addr)
Attempts to delete hosts by address.