7#ifndef BASE_HOST_DATA_SOURCE_H
8#define BASE_HOST_DATA_SOURCE_H
14#include <boost/shared_ptr.hpp>
65 if (
page_size_ > std::numeric_limits<uint32_t>::max()) {
67 << std::numeric_limits<uint32_t>::max());
123 const uint8_t* identifier_begin,
124 const size_t identifier_len)
const = 0;
206 size_t& source_index,
207 uint64_t lower_host_id,
229 size_t& source_index,
230 uint64_t lower_host_id,
251 uint64_t lower_host_id,
272 uint64_t lower_host_id,
299 const uint8_t* identifier_begin,
300 const size_t identifier_len)
const = 0;
362 const uint8_t* identifier_begin,
363 const size_t identifier_len)
const = 0;
470 const uint8_t* identifier_begin,
const size_t identifier_len) = 0;
485 const uint8_t* identifier_begin,
const size_t identifier_len) = 0;
496 if (host->getIPv4SubnetID() != SUBNET_ID_UNUSED) {
497 std::vector<uint8_t>
const& identifier(host->getIdentifier());
498 deleted =
del4(host->getIPv4SubnetID(), host->getIdentifierType(), identifier.data(),
500 }
else if (host->getIPv6SubnetID() != SUBNET_ID_UNUSED) {
501 std::vector<uint8_t>
const& identifier(host->getIdentifier());
502 deleted =
del6(host->getIPv6SubnetID(), host->getIdentifierType(), identifier.data(),
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
A generic exception that is thrown if a parameter given to a method would refer to or modify out-of-r...
The IOAddress class represents an IP addresses (version agnostic)
std::map< std::string, std::string > ParameterMap
Database configuration parameter map.
Exception thrown when invalid IP address has been specified for Host.
BadHostAddress(const char *file, size_t line, const char *what)
Base interface for the classes implementing simple data source for host reservations.
virtual std::string getType() const =0
Return backend type.
virtual bool isUnusable()
Flag which indicates if the host manager has at least one unusable connection.
virtual ConstHostCollection getAll6(const asiolink::IOAddress &address) const =0
Returns all hosts having a reservation for a specified address or delegated prefix (lease) in all sub...
virtual ConstHostCollection getAllbyHostname6(const std::string &hostname, const SubnetID &subnet_id) const =0
Return all hosts with a hostname in a DHCPv6 subnet.
virtual void add(const HostPtr &host)=0
Adds a new host to the collection.
virtual ConstHostCollection getAll6(const SubnetID &subnet_id) const =0
Return all hosts in a DHCPv6 subnet.
virtual void commit()
Commit Transactions.
virtual ConstHostCollection getAllbyHostname4(const std::string &hostname, const SubnetID &subnet_id) const =0
Return all hosts with a hostname in a DHCPv4 subnet.
virtual bool del(const SubnetID &subnet_id, const asiolink::IOAddress &addr)=0
Attempts to delete hosts by (subnet-id, address)
virtual ConstHostCollection getPage4(const SubnetID &subnet_id, size_t &source_index, uint64_t lower_host_id, const HostPageSize &page_size) const =0
Returns range of hosts in a DHCPv4 subnet.
virtual ConstHostPtr get4(const SubnetID &subnet_id, const asiolink::IOAddress &address) const =0
Returns a host connected to the IPv4 subnet and having a reservation for a specified IPv4 address.
virtual ConstHostPtr get4(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const =0
Returns a host connected to the IPv4 subnet.
virtual ConstHostCollection getAll4(const SubnetID &subnet_id, const asiolink::IOAddress &address) const =0
Returns all hosts connected to the IPv4 subnet and having a reservation for a specified address.
virtual bool del6(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len)=0
Attempts to delete a host by (subnet-id6, identifier, identifier-type)
virtual bool setIPReservationsUnique(const bool unique)=0
Controls whether IP reservations are unique or non-unique.
virtual ConstHostPtr get6(const SubnetID &subnet_id, const asiolink::IOAddress &address) const =0
Returns a host connected to the IPv6 subnet and having a reservation for a specified IPv6 address or ...
virtual isc::db::DatabaseConnection::ParameterMap getParameters() const
Return backend parameters.
IdType
Specifies the type of an identifier.
@ ID_HWADDR
Hardware address.
virtual ConstHostCollection getPage6(size_t &source_index, uint64_t lower_host_id, const HostPageSize &page_size) const =0
Returns range of hosts.
virtual ConstHostCollection getAll4(const asiolink::IOAddress &address) const =0
Returns a collection of hosts using the specified IPv4 address.
virtual ConstHostCollection getPage4(size_t &source_index, uint64_t lower_host_id, const HostPageSize &page_size) const =0
Returns range of hosts.
virtual bool del4(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len)=0
Attempts to delete a host by (subnet-id4, identifier, identifier-type)
virtual ConstHostCollection getPage6(const SubnetID &subnet_id, size_t &source_index, uint64_t lower_host_id, const HostPageSize &page_size) const =0
Returns range of hosts in a DHCPv6 subnet.
virtual ConstHostPtr get6(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const =0
Returns a host connected to the IPv6 subnet.
virtual ConstHostPtr get6(const asiolink::IOAddress &prefix, const uint8_t prefix_len) const =0
Returns a host using the specified IPv6 prefix.
virtual ConstHostCollection getAllbyHostname(const std::string &hostname) const =0
Return all hosts with a hostname.
virtual void update(HostPtr const &host)
Attempts to update an existing host entry.
virtual ConstHostCollection getAll6(const SubnetID &subnet_id, const asiolink::IOAddress &address) const =0
Returns all hosts connected to the IPv6 subnet and having a reservation for a specified address or de...
virtual ~BaseHostDataSource()
Default destructor implementation.
virtual ConstHostCollection getAll(const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const =0
Return all hosts connected to any subnet for which reservations have been made using a specified iden...
virtual void rollback()
Rollback Transactions.
virtual ConstHostCollection getAll4(const SubnetID &subnet_id) const =0
Return all hosts in a DHCPv4 subnet.
Exception thrown when the duplicate Host object is detected.
DuplicateHost(const char *file, size_t line, const char *what)
Exception thrown when a Host object is expected, but none are found.
HostNotFound(const char *file, size_t line, const char *what)
Wraps value holding size of the page with host reservations.
const size_t page_size_
Holds page size.
HostPageSize(const size_t page_size)
Constructor.
IdentifierType
Type of the host identifier.
Exception thrown when an address is already reserved by a Host object (DuplicateHost is same identity...
ReservedAddress(const char *file, size_t line, const char *what)
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
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.
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.