mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-03 23:45:27 +00:00
[#1163] Checkpoint: updated API
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
// Copyright (C) 2014-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@@ -221,6 +221,48 @@ public:
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const = 0;
|
||||
|
||||
/// @brief Returns range of hosts.
|
||||
///
|
||||
/// This method implements paged browsing of host databases. The
|
||||
/// parameters specify a page size, an index in sources and the
|
||||
/// starting host id of the range. If not zero this host id is
|
||||
/// excluded from the returned range. When a source is exhausted
|
||||
/// the index is updated. There is no guarantee about the order
|
||||
/// of returned host reservations, only the sources and
|
||||
/// reservations from the same source are ordered.
|
||||
///
|
||||
/// @param source_index Index of the source.
|
||||
/// @param lower_host_id Host identifier used as lower bound for the
|
||||
/// returned range.
|
||||
/// @param page_size maximum size of the page returned.
|
||||
///
|
||||
/// @return Host collection (may be empty).
|
||||
virtual ConstHostCollection
|
||||
getPage4(size_t& source_index,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const = 0;
|
||||
|
||||
/// @brief Returns range of hosts.
|
||||
///
|
||||
/// This method implements paged browsing of host databases. The
|
||||
/// parameters specify a page size, an index in sources and the
|
||||
/// starting host id of the range. If not zero this host id is
|
||||
/// excluded from the returned range. When a source is exhausted
|
||||
/// the index is updated. There is no guarantee about the order
|
||||
/// of returned host reservations, only the sources and
|
||||
/// reservations from the same source are ordered.
|
||||
///
|
||||
/// @param source_index Index of the source.
|
||||
/// @param lower_host_id Host identifier used as lower bound for the
|
||||
/// returned range.
|
||||
/// @param page_size maximum size of the page returned.
|
||||
///
|
||||
/// @return Host collection (may be empty).
|
||||
virtual ConstHostCollection
|
||||
getPage6(size_t& source_index,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const = 0;
|
||||
|
||||
/// @brief Returns a collection of hosts using the specified IPv4 address.
|
||||
///
|
||||
/// This method may return multiple @c Host objects if they are connected
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
// Copyright (C) 2014-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@@ -200,6 +200,58 @@ CfgHosts::getPage6(const SubnetID& subnet_id,
|
||||
return (collection);
|
||||
}
|
||||
|
||||
ConstHostCollection
|
||||
CfgHosts::getPage4(size_t& /*source_index*/,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const {
|
||||
// Do not issue logging message here because it will be logged by
|
||||
// the getPageInternal method.
|
||||
ConstHostCollection collection;
|
||||
getPageInternal<ConstHostCollection>(lower_host_id,
|
||||
page_size,
|
||||
collection);
|
||||
return (collection);
|
||||
}
|
||||
|
||||
HostCollection
|
||||
CfgHosts::getPage4(size_t& /*source_index*/,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) {
|
||||
// Do not issue logging message here because it will be logged by
|
||||
// the getPageInternal method.
|
||||
HostCollection collection;
|
||||
getPageInternal<HostCollection>(lower_host_id,
|
||||
page_size,
|
||||
collection);
|
||||
return (collection);
|
||||
}
|
||||
|
||||
ConstHostCollection
|
||||
CfgHosts::getPage6(size_t& /*source_index*/,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const {
|
||||
// Do not issue logging message here because it will be logged by
|
||||
// the getPageInternal method.
|
||||
ConstHostCollection collection;
|
||||
getPageInternal<ConstHostCollection>(lower_host_id,
|
||||
page_size,
|
||||
collection);
|
||||
return (collection);
|
||||
}
|
||||
|
||||
HostCollection
|
||||
CfgHosts::getPage6(size_t& /*source_index*/,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) {
|
||||
// Do not issue logging message here because it will be logged by
|
||||
// the getPageInternal method.
|
||||
HostCollection collection;
|
||||
getPageInternal<HostCollection>(lower_host_id,
|
||||
page_size,
|
||||
collection);
|
||||
return (collection);
|
||||
}
|
||||
|
||||
ConstHostCollection
|
||||
CfgHosts::getAll4(const IOAddress& address) const {
|
||||
// Do not issue logging message here because it will be logged by
|
||||
@@ -433,6 +485,40 @@ CfgHosts::getAllbyHostnameInternal6(const std::string& hostname,
|
||||
.arg(storage.size());
|
||||
}
|
||||
|
||||
template<typename Storage>
|
||||
void
|
||||
CfgHosts::getPageInternal(uint64_t lower_host_id,
|
||||
const HostPageSize& page_size,
|
||||
Storage& storage) const {
|
||||
|
||||
LOG_DEBUG(hosts_logger, HOSTS_DBG_TRACE, HOSTS_CFG_GET_ALL);
|
||||
|
||||
// Use the host id last index.
|
||||
const HostContainerIndex4& idx = hosts_.get<4>();
|
||||
HostContainerIndex4::const_iterator host = idx.lower_bound(lower_host_id);
|
||||
|
||||
// Exclude the lower bound id when it is not zero.
|
||||
if (lower_host_id &&
|
||||
(host != idx.end()) && ((*host)->getHostId() == lower_host_id)) {
|
||||
++host;
|
||||
}
|
||||
|
||||
// Return hosts within the page size.
|
||||
for (; host != idx.end(); ++host) {
|
||||
LOG_DEBUG(hosts_logger, HOSTS_DBG_TRACE_DETAIL_DATA,
|
||||
HOSTS_CFG_GET_ALL_HOST)
|
||||
.arg((*host)->toText());
|
||||
storage.push_back(*host);
|
||||
if (storage.size() >= page_size.page_size_) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Log how many hosts have been found.
|
||||
LOG_DEBUG(hosts_logger, HOSTS_DBG_RESULTS, HOSTS_CFG_GET_ALL_COUNT)
|
||||
.arg(storage.size());
|
||||
}
|
||||
|
||||
template<typename Storage>
|
||||
void
|
||||
CfgHosts::getPageInternal4(const SubnetID& subnet_id,
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
// Copyright (C) 2014-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@@ -261,6 +261,70 @@ public:
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size);
|
||||
|
||||
/// @brief Returns range of hosts.
|
||||
///
|
||||
/// This method returns a page of @c Host objects which represent
|
||||
/// reservations.
|
||||
///
|
||||
/// @param source_index Index of the source (unused).
|
||||
/// @param lower_host_id Host identifier used as lower bound for the
|
||||
/// returned range.
|
||||
/// @param page_size maximum size of the page returned.
|
||||
///
|
||||
/// @return Collection of const @c Host objects (may be empty).
|
||||
virtual ConstHostCollection
|
||||
getPage4(size_t& source_index,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const;
|
||||
|
||||
/// @brief Returns range of hosts.
|
||||
///
|
||||
/// This method returns a page of @c Host objects which represent
|
||||
/// reservations.
|
||||
///
|
||||
/// @param source_index Index of the source (unused).
|
||||
/// @param lower_host_id Host identifier used as lower bound for the
|
||||
/// returned range.
|
||||
/// @param page_size maximum size of the page returned.
|
||||
///
|
||||
/// @return Collection of non-const @c Host objects (may be empty).
|
||||
virtual HostCollection
|
||||
getPage4(size_t& source_index,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size);
|
||||
|
||||
/// @brief Returns range of hosts.
|
||||
///
|
||||
/// This method returns a page of @c Host objects which represent
|
||||
/// reservations.
|
||||
///
|
||||
/// @param source_index Index of the source (unused).
|
||||
/// @param lower_host_id Host identifier used as lower bound for the
|
||||
/// returned range.
|
||||
/// @param page_size maximum size of the page returned.
|
||||
///
|
||||
/// @return Collection of const @c Host objects (may be empty).
|
||||
virtual ConstHostCollection
|
||||
getPage6(size_t& source_index,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const;
|
||||
|
||||
/// @brief Returns range of hosts.
|
||||
///
|
||||
/// This method returns a page of @c Host objects which represent
|
||||
/// reservations.
|
||||
///
|
||||
/// @param source_index Index of the source (unused).
|
||||
/// @param lower_host_id Host identifier used as lower bound for the
|
||||
/// returned range.
|
||||
/// @param page_size maximum size of the page returned.
|
||||
///
|
||||
/// @return Collection of non-const @c Host objects (may be empty).
|
||||
virtual HostCollection
|
||||
getPage6(size_t& source_index,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size);
|
||||
|
||||
/// @brief Returns a collection of hosts using the specified IPv4 address.
|
||||
///
|
||||
/// This method may return multiple @c Host objects if they are connected
|
||||
@@ -630,6 +694,23 @@ private:
|
||||
const HostPageSize& page_size,
|
||||
Storage& storage) const;
|
||||
|
||||
/// @brief Returns a page of @c Host objects.
|
||||
///
|
||||
/// This private method is called by the @c CfgHosts::getPage4
|
||||
/// and @c CfgHosts::getPage6 methods which find the @c Host objects.
|
||||
/// The retrieved objects are appended to the @c storage container.
|
||||
///
|
||||
/// @param lower_host_id Host identifier used as lower bound for the
|
||||
/// returned range.
|
||||
/// @param page_size maximum size of the page returned.
|
||||
/// @param [out] storage Container to which the retrieved objects are
|
||||
/// appended.
|
||||
/// @tparam One of the @c ConstHostCollection of @c HostCollection.
|
||||
template<typename Storage>
|
||||
void getPageInternal(uint64_t lower_host_id,
|
||||
const HostPageSize& page_size,
|
||||
Storage& storage) const;
|
||||
|
||||
/// @brief Returns @c Host objects for the specified IPv4 address.
|
||||
///
|
||||
/// This private method is called by the @c CfgHosts::getAll4 methods
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
// Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
// Copyright (C) 2016-2017 Deutsche Telekom AG.
|
||||
//
|
||||
// Author: Andrei Pavel <andrei.pavel@qualitance.com>
|
||||
@@ -369,6 +369,22 @@ public:
|
||||
// (paging).
|
||||
static constexpr StatementTag GET_HOST_BY_IPV6_SUBNET_ID_PAGE =
|
||||
"GET_HOST_BY_IPV6_SUBNET_ID_PAGE";
|
||||
|
||||
// Retrieves host information; reservations and options associated
|
||||
// with it from first host (paging).
|
||||
static constexpr StatementTag GET_HOST_LIMIT = "GET_HOST_LIMIT";
|
||||
|
||||
// Retrieves host information; reservations and options associated
|
||||
// with it from host (paging).
|
||||
static constexpr StatementTag GET_HOST_KEY = "GET_HOST_KEY";
|
||||
|
||||
// Retrieves host information; reservations and options associated
|
||||
// with it from next host (paging).
|
||||
static constexpr StatementTag GET_HOST_NEXT_KEY = "GET_HOST_NEXT_KEY";
|
||||
|
||||
// Retrieves host information; reservations and options associated
|
||||
// with it from host with a limit (paging).
|
||||
static constexpr StatementTag GET_HOST_PAGE = "GET_HOST_PAGE";
|
||||
/// @}
|
||||
|
||||
/// @brief Cassandra statements
|
||||
@@ -498,6 +514,10 @@ constexpr StatementTag CqlHostExchange::GET_HOST_BY_IPV4_SUBNET_ID_KEY;
|
||||
constexpr StatementTag CqlHostExchange::GET_HOST_BY_IPV6_SUBNET_ID_KEY;
|
||||
constexpr StatementTag CqlHostExchange::GET_HOST_BY_IPV4_SUBNET_ID_PAGE;
|
||||
constexpr StatementTag CqlHostExchange::GET_HOST_BY_IPV6_SUBNET_ID_PAGE;
|
||||
constexpr StatementTag CqlHostExchange::GET_HOST_LIMIT;
|
||||
constexpr StatementTag CqlHostExchange::GET_HOST_NEXT_KEY;
|
||||
constexpr StatementTag CqlHostExchange::GET_HOST_KEY;
|
||||
constexpr StatementTag CqlHostExchange::GET_HOST_PAGE;
|
||||
constexpr StatementTag CqlHostExchange::DELETE_HOST;
|
||||
|
||||
StatementMap CqlHostExchange::tagged_statements_ = {
|
||||
@@ -1342,6 +1362,156 @@ StatementMap CqlHostExchange::tagged_statements_ = {
|
||||
"ALLOW FILTERING "
|
||||
}},
|
||||
|
||||
{GET_HOST_LIMIT,
|
||||
{GET_HOST_LIMIT,
|
||||
"SELECT "
|
||||
"key, "
|
||||
"id, "
|
||||
"host_identifier, "
|
||||
"host_identifier_type, "
|
||||
"host_ipv4_subnet_id, "
|
||||
"host_ipv6_subnet_id, "
|
||||
"host_ipv4_address, "
|
||||
"host_ipv4_next_server, "
|
||||
"host_ipv4_server_hostname, "
|
||||
"host_ipv4_boot_file_name, "
|
||||
"auth_key, "
|
||||
"hostname, "
|
||||
"user_context, "
|
||||
"host_ipv4_client_classes, "
|
||||
"host_ipv6_client_classes, "
|
||||
"reserved_ipv6_prefix_address, "
|
||||
"reserved_ipv6_prefix_length, "
|
||||
"reserved_ipv6_prefix_address_type, "
|
||||
"iaid, "
|
||||
"option_universe, "
|
||||
"option_code, "
|
||||
"option_value, "
|
||||
"option_formatted_value, "
|
||||
"option_space, "
|
||||
"option_is_persistent, "
|
||||
"option_client_class, "
|
||||
"option_subnet_id, "
|
||||
"option_user_context, "
|
||||
"option_scope_id "
|
||||
"FROM hosts "
|
||||
"LIMIT 1 "
|
||||
"ALLOW FILTERING "
|
||||
}},
|
||||
|
||||
{GET_HOST_NEXT_KEY,
|
||||
{GET_HOST_NEXT_KEY,
|
||||
"SELECT "
|
||||
"key, "
|
||||
"id, "
|
||||
"host_identifier, "
|
||||
"host_identifier_type, "
|
||||
"host_ipv4_subnet_id, "
|
||||
"host_ipv6_subnet_id, "
|
||||
"host_ipv4_address, "
|
||||
"host_ipv4_next_server, "
|
||||
"host_ipv4_server_hostname, "
|
||||
"host_ipv4_boot_file_name, "
|
||||
"auth_key, "
|
||||
"hostname, "
|
||||
"user_context, "
|
||||
"host_ipv4_client_classes, "
|
||||
"host_ipv6_client_classes, "
|
||||
"reserved_ipv6_prefix_address, "
|
||||
"reserved_ipv6_prefix_length, "
|
||||
"reserved_ipv6_prefix_address_type, "
|
||||
"iaid, "
|
||||
"option_universe, "
|
||||
"option_code, "
|
||||
"option_value, "
|
||||
"option_formatted_value, "
|
||||
"option_space, "
|
||||
"option_is_persistent, "
|
||||
"option_client_class, "
|
||||
"option_subnet_id, "
|
||||
"option_user_context, "
|
||||
"option_scope_id "
|
||||
"FROM hosts "
|
||||
"WHERE TOKEN(key) > TOKEN(?) "
|
||||
"LIMIT 1 "
|
||||
"ALLOW FILTERING "
|
||||
}},
|
||||
|
||||
{GET_HOST_KEY,
|
||||
{GET_HOST_KEY,
|
||||
"SELECT "
|
||||
"key, "
|
||||
"id, "
|
||||
"host_identifier, "
|
||||
"host_identifier_type, "
|
||||
"host_ipv4_subnet_id, "
|
||||
"host_ipv6_subnet_id, "
|
||||
"host_ipv4_address, "
|
||||
"host_ipv4_next_server, "
|
||||
"host_ipv4_server_hostname, "
|
||||
"host_ipv4_boot_file_name, "
|
||||
"auth_key, "
|
||||
"hostname, "
|
||||
"user_context, "
|
||||
"host_ipv4_client_classes, "
|
||||
"host_ipv6_client_classes, "
|
||||
"reserved_ipv6_prefix_address, "
|
||||
"reserved_ipv6_prefix_length, "
|
||||
"reserved_ipv6_prefix_address_type, "
|
||||
"iaid, "
|
||||
"option_universe, "
|
||||
"option_code, "
|
||||
"option_value, "
|
||||
"option_formatted_value, "
|
||||
"option_space, "
|
||||
"option_is_persistent, "
|
||||
"option_client_class, "
|
||||
"option_subnet_id, "
|
||||
"option_user_context, "
|
||||
"option_scope_id "
|
||||
"FROM hosts "
|
||||
"WHERE key = ? "
|
||||
"ALLOW FILTERING "
|
||||
}},
|
||||
|
||||
{GET_HOST_PAGE,
|
||||
{GET_HOST_PAGE,
|
||||
"SELECT "
|
||||
"key, "
|
||||
"id, "
|
||||
"host_identifier, "
|
||||
"host_identifier_type, "
|
||||
"host_ipv4_subnet_id, "
|
||||
"host_ipv6_subnet_id, "
|
||||
"host_ipv4_address, "
|
||||
"host_ipv4_next_server, "
|
||||
"host_ipv4_server_hostname, "
|
||||
"host_ipv4_boot_file_name, "
|
||||
"auth_key, "
|
||||
"hostname, "
|
||||
"user_context, "
|
||||
"host_ipv4_client_classes, "
|
||||
"host_ipv6_client_classes, "
|
||||
"reserved_ipv6_prefix_address, "
|
||||
"reserved_ipv6_prefix_length, "
|
||||
"reserved_ipv6_prefix_address_type, "
|
||||
"iaid, "
|
||||
"option_universe, "
|
||||
"option_code, "
|
||||
"option_value, "
|
||||
"option_formatted_value, "
|
||||
"option_space, "
|
||||
"option_is_persistent, "
|
||||
"option_client_class, "
|
||||
"option_subnet_id, "
|
||||
"option_user_context, "
|
||||
"option_scope_id "
|
||||
"FROM hosts "
|
||||
"WHERE id = ? "
|
||||
"LIMIT 1 "
|
||||
"ALLOW FILTERING "
|
||||
}},
|
||||
|
||||
{DELETE_HOST,
|
||||
{DELETE_HOST,
|
||||
"DELETE FROM hosts WHERE key = ? AND id = ? "
|
||||
@@ -2112,6 +2282,28 @@ public:
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const;
|
||||
|
||||
/// @brief Implementation of @ref CqlHostDataSource::getPage4()
|
||||
///
|
||||
/// See @ref CqlHostDataSource::getPage4() for parameter details.
|
||||
///
|
||||
/// @param lower_host_id Host identifier used as lower bound for the
|
||||
/// returned range.
|
||||
/// @param page_size maximum size of the page returned.
|
||||
virtual ConstHostCollection
|
||||
getPage4(uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const;
|
||||
|
||||
/// @brief Implementation of @ref CqlHostDataSource::getPage6()
|
||||
///
|
||||
/// See @ref CqlHostDataSource::getPage6() for parameter details.
|
||||
///
|
||||
/// @param lower_host_id Host identifier used as lower bound for the
|
||||
/// returned range.
|
||||
/// @param page_size maximum size of the page returned.
|
||||
virtual ConstHostCollection
|
||||
getPage6(uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const;
|
||||
|
||||
/// @brief Implementation of @ref CqlHostDataSource::getAll4()
|
||||
///
|
||||
/// See @ref CqlHostDataSource::getAll4() for parameter details.
|
||||
@@ -2221,6 +2413,26 @@ protected:
|
||||
uint64_t lower_host_id,
|
||||
size_t count = 0) const;
|
||||
|
||||
/// @brief Retrieves a page of hosts.
|
||||
///
|
||||
/// @param lower_host_id Host identifier used as lower bound for the
|
||||
/// returned range.
|
||||
/// @param count the size of the page
|
||||
///
|
||||
/// @return a collection of hosts containing one or more hosts
|
||||
virtual ConstHostCollection getHostCollectionPage4(uint64_t lower_host_id,
|
||||
size_t count = 0) const;
|
||||
|
||||
/// @brief Retrieves a page of hosts.
|
||||
///
|
||||
/// @param lower_host_id Host identifier used as lower bound for the
|
||||
/// returned range.
|
||||
/// @param count the size of the page
|
||||
///
|
||||
/// @return a collection of hosts containing one or more hosts
|
||||
virtual ConstHostCollection getHostCollectionPage6(uint64_t lower_host_id,
|
||||
size_t count = 0) const;
|
||||
|
||||
/// @brief Retrieves a host by key.
|
||||
///
|
||||
/// @param key identifier of the host
|
||||
@@ -2235,6 +2447,13 @@ protected:
|
||||
/// @return a host for the specific key
|
||||
virtual ConstHostPtr getHostByKey6(uint64_t key) const;
|
||||
|
||||
/// @brief Retrieves a host by key.
|
||||
///
|
||||
/// @param key identifier of the host
|
||||
///
|
||||
/// @return a host for the specific key
|
||||
virtual ConstHostPtr getHostByKey(uint64_t key) const;
|
||||
|
||||
/// @brief Retrieves a valid host key.
|
||||
/// if lower_host_id is 0 the key parameter will be updated with the key of
|
||||
/// the first host
|
||||
@@ -2246,7 +2465,7 @@ protected:
|
||||
/// returned range.
|
||||
/// @param key identifier of the host which will be updated
|
||||
///
|
||||
/// @return true if there is sunh a host
|
||||
/// @return true if there is such a host
|
||||
virtual bool getHostKey4(const SubnetID& subnet_id,
|
||||
uint64_t lower_host_id,
|
||||
uint64_t& key) const;
|
||||
@@ -2262,11 +2481,25 @@ protected:
|
||||
/// returned range.
|
||||
/// @param key identifier of the host which will be updated
|
||||
///
|
||||
/// @return true if there is sunh a host
|
||||
/// @return true if there is such a host
|
||||
virtual bool getHostKey6(const SubnetID& subnet_id,
|
||||
uint64_t lower_host_id,
|
||||
uint64_t& key) const;
|
||||
|
||||
/// @brief Retrieves a valid host key.
|
||||
/// if lower_host_id is 0 the key parameter will be updated with the key of
|
||||
/// the first host
|
||||
/// if lower_host_id is not 0 the key parameter will be updated with the
|
||||
/// next valid host key
|
||||
///
|
||||
/// @param lower_host_id Host identifier used as lower bound for the
|
||||
/// returned range.
|
||||
/// @param key identifier of the host which will be updated
|
||||
///
|
||||
/// @return true if there is such a host
|
||||
virtual bool getHostKey(uint64_t lower_host_id,
|
||||
uint64_t& key) const;
|
||||
|
||||
/// @brief Retrieves next valid host key.
|
||||
///
|
||||
/// @param subnet_id identifier of the subnet to which hosts belong
|
||||
@@ -2287,6 +2520,14 @@ protected:
|
||||
virtual bool getNextHostKey6(const SubnetID& subnet_id,
|
||||
uint64_t& key) const;
|
||||
|
||||
/// @brief Retrieves next valid host key.
|
||||
///
|
||||
/// @param key identifier of the host which will be updated with the next
|
||||
/// valid host key
|
||||
///
|
||||
/// @return true if there is such a host
|
||||
virtual bool getNextHostKey(uint64_t& key) const;
|
||||
|
||||
/// @brief Inserts or deletes a single host.
|
||||
///
|
||||
/// All information is available here. Calls @ref
|
||||
@@ -2707,6 +2948,26 @@ CqlHostDataSourceImpl::getPage6(const SubnetID& subnet_id,
|
||||
return (result);
|
||||
}
|
||||
|
||||
ConstHostCollection
|
||||
CqlHostDataSourceImpl::getPage4(uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const {
|
||||
// Run statement.
|
||||
ConstHostCollection result =
|
||||
getHostCollectionPage4(lower_host_id, page_size.page_size_);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
ConstHostCollection
|
||||
CqlHostDataSourceImpl::getPage6(uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const {
|
||||
// Run statement.
|
||||
ConstHostCollection result =
|
||||
getHostCollectionPage6(lower_host_id, page_size.page_size_);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
ConstHostCollection
|
||||
CqlHostDataSourceImpl::getAll4(const asiolink::IOAddress& address) const {
|
||||
// Convert to CQL data types.
|
||||
@@ -2933,6 +3194,31 @@ CqlHostDataSourceImpl::getHostByKey6(uint64_t key) const {
|
||||
return (*collection.begin());
|
||||
}
|
||||
|
||||
ConstHostPtr
|
||||
CqlHostDataSourceImpl::getHostByKey(uint64_t key) const {
|
||||
// Bind to array.
|
||||
AnyArray where_values;
|
||||
cass_int64_t key_data = static_cast<cass_int64_t>(key);
|
||||
where_values.add(&key_data);
|
||||
|
||||
// Run statement.
|
||||
ConstHostCollection collection =
|
||||
getHostCollection(CqlHostExchange::GET_HOST_KEY,
|
||||
where_values);
|
||||
|
||||
if (collection.empty()) {
|
||||
return (ConstHostPtr());
|
||||
}
|
||||
|
||||
if (collection.size() >= 2u) {
|
||||
isc_throw(MultipleRecords, "CqlHostDataSourceImpl::getHost(): multiple records were "
|
||||
"found in the database where only one was expected for statement "
|
||||
<< CqlHostExchange::GET_HOST_KEY);
|
||||
}
|
||||
|
||||
return (*collection.begin());
|
||||
}
|
||||
|
||||
ConstHostCollection
|
||||
CqlHostDataSourceImpl::getHostCollectionPage4(const SubnetID& subnet_id,
|
||||
uint64_t lower_host_id,
|
||||
@@ -2975,6 +3261,46 @@ CqlHostDataSourceImpl::getHostCollectionPage6(const SubnetID& subnet_id,
|
||||
return (result_collection);
|
||||
}
|
||||
|
||||
ConstHostCollection
|
||||
CqlHostDataSourceImpl::getHostCollectionPage4(uint64_t lower_host_id,
|
||||
size_t count) const {
|
||||
ConstHostCollection result_collection;
|
||||
for (; count; count--) {
|
||||
uint64_t key;
|
||||
bool valid_key = getHostKey(lower_host_id, key);
|
||||
|
||||
if (!valid_key) {
|
||||
break;
|
||||
}
|
||||
|
||||
ConstHostPtr host = getHostByKey(key);
|
||||
result_collection.push_back(host);
|
||||
lower_host_id = host->getHostId();
|
||||
}
|
||||
|
||||
return (result_collection);
|
||||
}
|
||||
|
||||
ConstHostCollection
|
||||
CqlHostDataSourceImpl::getHostCollectionPage6(uint64_t lower_host_id,
|
||||
size_t count) const {
|
||||
ConstHostCollection result_collection;
|
||||
for (; count; count--) {
|
||||
uint64_t key;
|
||||
bool valid_key = getHostKey(lower_host_id, key);
|
||||
|
||||
if (!valid_key) {
|
||||
break;
|
||||
}
|
||||
|
||||
ConstHostPtr host = getHostByKey6(key);
|
||||
result_collection.push_back(host);
|
||||
lower_host_id = host->getHostId();
|
||||
}
|
||||
|
||||
return (result_collection);
|
||||
}
|
||||
|
||||
bool
|
||||
CqlHostDataSourceImpl::getHostKey4(const SubnetID& subnet_id,
|
||||
uint64_t lower_host_id,
|
||||
@@ -3075,6 +3401,50 @@ CqlHostDataSourceImpl::getHostKey6(const SubnetID& subnet_id,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CqlHostDataSourceImpl::getHostKey(uint64_t lower_host_id,
|
||||
uint64_t& key) const {
|
||||
// Bind to array.
|
||||
AnyArray where_values;
|
||||
cass_int64_t host_data = 0;
|
||||
if (lower_host_id) {
|
||||
host_data = static_cast<cass_int64_t>(lower_host_id);
|
||||
where_values.add(&host_data);
|
||||
}
|
||||
|
||||
// Run statement.
|
||||
// This will retrieve first row of the first host (lower_host_id == 0)
|
||||
// or the first row of the host (lower_host_id != 0)
|
||||
std::unique_ptr<CqlHostExchange> host_exchange(new CqlHostExchange());
|
||||
AnyArray collection;
|
||||
if (lower_host_id) {
|
||||
collection = host_exchange->executeSelect(dbconn_, where_values,
|
||||
CqlHostExchange::GET_HOST_PAGE, false);
|
||||
} else {
|
||||
collection = host_exchange->executeSelect(dbconn_, where_values,
|
||||
CqlHostExchange::GET_HOST_LIMIT, false);
|
||||
}
|
||||
|
||||
// Create HostPtr objects.
|
||||
HostCollection host_collection;
|
||||
for (boost::any& host : collection) {
|
||||
host_collection.push_back(HostPtr(boost::any_cast<Host*>(host)));
|
||||
}
|
||||
|
||||
// If there is no host, just exit
|
||||
if (host_collection.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
key = host_exchange->hashIntoKey();
|
||||
|
||||
if (lower_host_id) {
|
||||
return getNextHostKey(key);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CqlHostDataSourceImpl::getNextHostKey4(const SubnetID& subnet_id,
|
||||
uint64_t& key) const {
|
||||
@@ -3137,6 +3507,34 @@ CqlHostDataSourceImpl::getNextHostKey6(const SubnetID& subnet_id,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CqlHostDataSourceImpl::getNextHostKey(uint64_t& key) const {
|
||||
// Convert to CQL data types.
|
||||
cass_int64_t key_data = static_cast<cass_int64_t>(key);
|
||||
|
||||
// Bind to array.
|
||||
AnyArray where_values;
|
||||
where_values.add(&key_data);
|
||||
|
||||
// This will retrieve first row of the next host (lower_host_id != 0)
|
||||
std::unique_ptr<CqlHostExchange> host_exchange(new CqlHostExchange());
|
||||
AnyArray collection = host_exchange->executeSelect(dbconn_, where_values,
|
||||
CqlHostExchange::GET_HOST_NEXT_KEY, false);
|
||||
|
||||
// Create HostPtr objects.
|
||||
HostCollection host_collection;
|
||||
for (boost::any& host : collection) {
|
||||
host_collection.push_back(HostPtr(boost::any_cast<Host*>(host)));
|
||||
}
|
||||
|
||||
if (host_collection.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
key = host_exchange->hashIntoKey();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CqlHostDataSourceImpl::insertOrDeleteHost(bool insert,
|
||||
const HostPtr& host,
|
||||
@@ -3305,6 +3703,24 @@ CqlHostDataSource::getPage6(const SubnetID& subnet_id,
|
||||
return (impl_->getPage6(subnet_id, lower_host_id, page_size));
|
||||
}
|
||||
|
||||
ConstHostCollection
|
||||
CqlHostDataSource::getPage4(size_t& /*source_index*/,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const {
|
||||
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_CQL_HOST_GET_ALL);
|
||||
|
||||
return (impl_->getPage4(lower_host_id, page_size));
|
||||
}
|
||||
|
||||
ConstHostCollection
|
||||
CqlHostDataSource::getPage6(size_t& /*source_index*/,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const {
|
||||
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_CQL_HOST_GET_ALL);
|
||||
|
||||
return (impl_->getPage6(lower_host_id, page_size));
|
||||
}
|
||||
|
||||
ConstHostCollection
|
||||
CqlHostDataSource::getAll4(const asiolink::IOAddress& address) const {
|
||||
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_CQL_HOST_GET_ALL);
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
// Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
// Copyright (C) 2016-2018 Deutsche Telekom AG.
|
||||
//
|
||||
// Author: Andrei Pavel <andrei.pavel@qualitance.com>
|
||||
@@ -264,6 +264,36 @@ public:
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const override;
|
||||
|
||||
/// @brief Returns range of hosts.
|
||||
///
|
||||
/// Not implemented.
|
||||
///
|
||||
/// @param source_index Index of the source (unused).
|
||||
/// @param lower_host_id Host identifier used as lower bound for the
|
||||
/// returned range.
|
||||
/// @param page_size maximum size of the page returned.
|
||||
///
|
||||
/// @return Collection of const @c Host objects (may be empty).
|
||||
virtual ConstHostCollection
|
||||
getPage4(size_t& source_index,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const override;
|
||||
|
||||
/// @brief Returns range of hosts.
|
||||
///
|
||||
/// Not implemented.
|
||||
///
|
||||
/// @param source_index Index of the source (unused).
|
||||
/// @param lower_host_id Host identifier used as lower bound for the
|
||||
/// returned range.
|
||||
/// @param page_size maximum size of the page returned.
|
||||
///
|
||||
/// @return Collection of const @c Host objects (may be empty).
|
||||
virtual ConstHostCollection
|
||||
getPage6(size_t& source_index,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const override;
|
||||
|
||||
/// @brief Returns a collection of hosts using the specified IPv4 address.
|
||||
///
|
||||
/// This method may return multiple @ref Host objects if they are connected
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
// Copyright (C) 2014-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@@ -233,6 +233,66 @@ HostMgr::getPage6(const SubnetID& subnet_id,
|
||||
return (getPage6(subnet_id, source_index, 0UL, page_size));
|
||||
}
|
||||
|
||||
ConstHostCollection
|
||||
HostMgr::getPage4(size_t& source_index,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const {
|
||||
// Return empty if (and only if) sources are exhausted.
|
||||
if (source_index > alternate_sources_.size()) {
|
||||
return (ConstHostCollection());
|
||||
}
|
||||
|
||||
ConstHostCollection hosts;
|
||||
// Source index 0 means config file.
|
||||
if (source_index == 0) {
|
||||
hosts = getCfgHosts()->
|
||||
getPage4(source_index, lower_host_id, page_size);
|
||||
} else {
|
||||
hosts = alternate_sources_[source_index - 1]->
|
||||
getPage4(source_index, lower_host_id, page_size);
|
||||
}
|
||||
|
||||
// When got something return it.
|
||||
if (!hosts.empty()) {
|
||||
return (hosts);
|
||||
}
|
||||
|
||||
// Nothing from this source: try the next one.
|
||||
// Note the recursion is limited to the number of sources in all cases.
|
||||
++source_index;
|
||||
return (getPage4(source_index, 0UL, page_size));
|
||||
}
|
||||
|
||||
ConstHostCollection
|
||||
HostMgr::getPage6(size_t& source_index,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const {
|
||||
// Return empty if (and only if) sources are exhausted.
|
||||
if (source_index > alternate_sources_.size()) {
|
||||
return (ConstHostCollection());
|
||||
}
|
||||
|
||||
ConstHostCollection hosts;
|
||||
// Source index 0 means config file.
|
||||
if (source_index == 0) {
|
||||
hosts = getCfgHosts()->
|
||||
getPage6(source_index, lower_host_id, page_size);
|
||||
} else {
|
||||
hosts = alternate_sources_[source_index - 1]->
|
||||
getPage6(source_index, lower_host_id, page_size);
|
||||
}
|
||||
|
||||
// When got something return it.
|
||||
if (!hosts.empty()) {
|
||||
return (hosts);
|
||||
}
|
||||
|
||||
// Nothing from this source: try the next one.
|
||||
// Note the recursion is limited to the number of sources in all cases.
|
||||
++source_index;
|
||||
return (getPage6(source_index, 0UL, page_size));
|
||||
}
|
||||
|
||||
ConstHostCollection
|
||||
HostMgr::getAll4(const IOAddress& address) const {
|
||||
ConstHostCollection hosts = getCfgHosts()->getAll4(address);
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
// Copyright (C) 2014-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@@ -255,6 +255,60 @@ public:
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const;
|
||||
|
||||
/// @brief Returns range of hosts.
|
||||
///
|
||||
/// This method returns a page of @c Host objects representing
|
||||
/// reservations as documented in the @c BaseHostDataSource::getPage4
|
||||
///
|
||||
/// The typical usage of this method is as follows:
|
||||
/// - Get the first page of hosts by specifying zero index and id
|
||||
/// as the beginning of the range.
|
||||
/// - Index and last id of the returned range should be used as
|
||||
/// starting index and id for the next page in the subsequent call.
|
||||
/// - All returned hosts are from the same source so if the number of
|
||||
/// hosts returned is lower than the page size, it does not indicate
|
||||
/// that the last page has been retrieved.
|
||||
/// - If there are no hosts returned it indicates that the previous page
|
||||
/// was the last page.
|
||||
///
|
||||
/// @param source_index Index of the source.
|
||||
/// @param lower_host_id Host identifier used as lower bound for the
|
||||
/// returned range.
|
||||
/// @param page_size maximum size of the page returned.
|
||||
///
|
||||
/// @return Host collection (may be empty).
|
||||
virtual ConstHostCollection
|
||||
getPage4(size_t& source_index,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const;
|
||||
|
||||
/// @brief Returns range of hosts.
|
||||
///
|
||||
/// This method returns a page of @c Host objects representing
|
||||
/// reservations as documented in the @c BaseHostDataSource::getPage6
|
||||
///
|
||||
/// The typical usage of this method is as follows:
|
||||
/// - Get the first page of hosts by specifying zero index and id
|
||||
/// as the beginning of the range.
|
||||
/// - Index and last id of the returned range should be used as
|
||||
/// starting index and id for the next page in the subsequent call.
|
||||
/// - All returned hosts are from the same source so if the number of
|
||||
/// hosts returned is lower than the page size, it does not indicate
|
||||
/// that the last page has been retrieved.
|
||||
/// - If there are no hosts returned it indicates that the previous page
|
||||
/// was the last page.
|
||||
///
|
||||
/// @param source_index Index of the source.
|
||||
/// @param lower_host_id Host identifier used as lower bound for the
|
||||
/// returned range.
|
||||
/// @param page_size maximum size of the page returned.
|
||||
///
|
||||
/// @return Host collection (may be empty).
|
||||
virtual ConstHostCollection
|
||||
getPage6(size_t& source_index,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const;
|
||||
|
||||
/// @brief Returns a collection of hosts using the specified IPv4 address.
|
||||
///
|
||||
/// This method may return multiple @c Host objects if they are connected to
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// File created from ../../../src/lib/dhcpsrv/hosts_messages.mes on Mon Jun 22 2020 17:23
|
||||
// File created from ../../../src/lib/dhcpsrv/hosts_messages.mes on Tue Sep 01 2020 12:49
|
||||
|
||||
#include <cstddef>
|
||||
#include <log/message_types.h>
|
||||
@@ -15,12 +15,15 @@ extern const isc::log::MessageID HOSTS_CFG_CACHE_HOST_DATA_SOURCE = "HOSTS_CFG_C
|
||||
extern const isc::log::MessageID HOSTS_CFG_CLOSE_HOST_DATA_SOURCE = "HOSTS_CFG_CLOSE_HOST_DATA_SOURCE";
|
||||
extern const isc::log::MessageID HOSTS_CFG_DEL_ALL_SUBNET4 = "HOSTS_CFG_DEL_ALL_SUBNET4";
|
||||
extern const isc::log::MessageID HOSTS_CFG_DEL_ALL_SUBNET6 = "HOSTS_CFG_DEL_ALL_SUBNET6";
|
||||
extern const isc::log::MessageID HOSTS_CFG_GET_ALL = "HOSTS_CFG_GET_ALL";
|
||||
extern const isc::log::MessageID HOSTS_CFG_GET_ALL_ADDRESS4 = "HOSTS_CFG_GET_ALL_ADDRESS4";
|
||||
extern const isc::log::MessageID HOSTS_CFG_GET_ALL_ADDRESS4_COUNT = "HOSTS_CFG_GET_ALL_ADDRESS4_COUNT";
|
||||
extern const isc::log::MessageID HOSTS_CFG_GET_ALL_ADDRESS4_HOST = "HOSTS_CFG_GET_ALL_ADDRESS4_HOST";
|
||||
extern const isc::log::MessageID HOSTS_CFG_GET_ALL_ADDRESS6 = "HOSTS_CFG_GET_ALL_ADDRESS6";
|
||||
extern const isc::log::MessageID HOSTS_CFG_GET_ALL_ADDRESS6_COUNT = "HOSTS_CFG_GET_ALL_ADDRESS6_COUNT";
|
||||
extern const isc::log::MessageID HOSTS_CFG_GET_ALL_ADDRESS6_HOST = "HOSTS_CFG_GET_ALL_ADDRESS6_HOST";
|
||||
extern const isc::log::MessageID HOSTS_CFG_GET_ALL_COUNT = "HOSTS_CFG_GET_ALL_COUNT";
|
||||
extern const isc::log::MessageID HOSTS_CFG_GET_ALL_HOST = "HOSTS_CFG_GET_ALL_HOST";
|
||||
extern const isc::log::MessageID HOSTS_CFG_GET_ALL_HOSTNAME = "HOSTS_CFG_GET_ALL_HOSTNAME";
|
||||
extern const isc::log::MessageID HOSTS_CFG_GET_ALL_HOSTNAME_COUNT = "HOSTS_CFG_GET_ALL_HOSTNAME_COUNT";
|
||||
extern const isc::log::MessageID HOSTS_CFG_GET_ALL_HOSTNAME_HOST = "HOSTS_CFG_GET_ALL_HOSTNAME_HOST";
|
||||
@@ -78,12 +81,15 @@ const char* values[] = {
|
||||
"HOSTS_CFG_CLOSE_HOST_DATA_SOURCE", "Closing host data source: %1",
|
||||
"HOSTS_CFG_DEL_ALL_SUBNET4", "deleted all %1 host(s) for subnet id %2",
|
||||
"HOSTS_CFG_DEL_ALL_SUBNET6", "deleted all %1 host(s) including %2 IPv6 reservation(s) for subnet id %3",
|
||||
"HOSTS_CFG_GET_ALL", "get all hosts with reservations",
|
||||
"HOSTS_CFG_GET_ALL_ADDRESS4", "get all hosts with reservations for IPv4 address %1",
|
||||
"HOSTS_CFG_GET_ALL_ADDRESS4_COUNT", "using address %1, found %2 host(s)",
|
||||
"HOSTS_CFG_GET_ALL_ADDRESS4_HOST", "using address %1 found host: %2",
|
||||
"HOSTS_CFG_GET_ALL_ADDRESS6", "get all hosts with reservations for IPv6 address %1",
|
||||
"HOSTS_CFG_GET_ALL_ADDRESS6_COUNT", "using address %1, found %2 host(s)",
|
||||
"HOSTS_CFG_GET_ALL_ADDRESS6_HOST", "using address %1 found host: %2",
|
||||
"HOSTS_CFG_GET_ALL_COUNT", "found %1 host(s)",
|
||||
"HOSTS_CFG_GET_ALL_HOST", "found host: %1",
|
||||
"HOSTS_CFG_GET_ALL_HOSTNAME", "get all hosts with reservations for hostname %1",
|
||||
"HOSTS_CFG_GET_ALL_HOSTNAME_COUNT", "using hostname %1, found %2 host(s)",
|
||||
"HOSTS_CFG_GET_ALL_HOSTNAME_HOST", "using hostname %1, found host: %2",
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// File created from ../../../src/lib/dhcpsrv/hosts_messages.mes on Mon Jun 22 2020 17:23
|
||||
// File created from ../../../src/lib/dhcpsrv/hosts_messages.mes on Tue Sep 01 2020 12:49
|
||||
|
||||
#ifndef HOSTS_MESSAGES_H
|
||||
#define HOSTS_MESSAGES_H
|
||||
@@ -16,12 +16,15 @@ extern const isc::log::MessageID HOSTS_CFG_CACHE_HOST_DATA_SOURCE;
|
||||
extern const isc::log::MessageID HOSTS_CFG_CLOSE_HOST_DATA_SOURCE;
|
||||
extern const isc::log::MessageID HOSTS_CFG_DEL_ALL_SUBNET4;
|
||||
extern const isc::log::MessageID HOSTS_CFG_DEL_ALL_SUBNET6;
|
||||
extern const isc::log::MessageID HOSTS_CFG_GET_ALL;
|
||||
extern const isc::log::MessageID HOSTS_CFG_GET_ALL_ADDRESS4;
|
||||
extern const isc::log::MessageID HOSTS_CFG_GET_ALL_ADDRESS4_COUNT;
|
||||
extern const isc::log::MessageID HOSTS_CFG_GET_ALL_ADDRESS4_HOST;
|
||||
extern const isc::log::MessageID HOSTS_CFG_GET_ALL_ADDRESS6;
|
||||
extern const isc::log::MessageID HOSTS_CFG_GET_ALL_ADDRESS6_COUNT;
|
||||
extern const isc::log::MessageID HOSTS_CFG_GET_ALL_ADDRESS6_HOST;
|
||||
extern const isc::log::MessageID HOSTS_CFG_GET_ALL_COUNT;
|
||||
extern const isc::log::MessageID HOSTS_CFG_GET_ALL_HOST;
|
||||
extern const isc::log::MessageID HOSTS_CFG_GET_ALL_HOSTNAME;
|
||||
extern const isc::log::MessageID HOSTS_CFG_GET_ALL_HOSTNAME_COUNT;
|
||||
extern const isc::log::MessageID HOSTS_CFG_GET_ALL_HOSTNAME_HOST;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2015-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
# Copyright (C) 2015-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@@ -43,6 +43,17 @@ have been deleted. The second argument specifies how many IPv6
|
||||
(addresses and prefixes) have been deleted. The third argument is the
|
||||
subnet identifier.
|
||||
|
||||
% HOSTS_CFG_GET_ALL get all hosts with reservations
|
||||
This debug message is issued when starting to retrieve all hosts.
|
||||
|
||||
% HOSTS_CFG_GET_ALL_COUNT found %1 host(s)
|
||||
This debug message include the details of the host found. The argument
|
||||
specifies the number of hosts found.
|
||||
|
||||
% HOSTS_CFG_GET_ALL_HOST found host: %1
|
||||
This debug message includes the details of the host found. The argument
|
||||
specifies found host details.
|
||||
|
||||
% HOSTS_CFG_GET_ALL_ADDRESS4 get all hosts with reservations for IPv4 address %1
|
||||
This debug message is issued when starting to retrieve all hosts, holding the
|
||||
reservation for the specific IPv4 address, from the configuration. The
|
||||
|
@@ -2004,6 +2004,8 @@ public:
|
||||
GET_HOST_HOSTNAME_SUBID6, // Gets hosts by hostname and IPv6 SubnetID
|
||||
GET_HOST_SUBID4_PAGE, // Gets hosts by IPv4 SubnetID beginning by HID
|
||||
GET_HOST_SUBID6_PAGE, // Gets hosts by IPv6 SubnetID beginning by HID
|
||||
GET_HOST_PAGE4, // Gets v4 hosts beginning by HID
|
||||
GET_HOST_PAGE6, // Gets v6 hosts beginning by HID
|
||||
INSERT_HOST, // Insert new host to collection
|
||||
INSERT_V6_RESRV, // Insert v6 reservation
|
||||
INSERT_V4_HOST_OPTION, // Insert DHCPv4 option
|
||||
@@ -2516,6 +2518,53 @@ TaggedStatementArray tagged_statements = { {
|
||||
"ON h.host_id = r.host_id "
|
||||
"ORDER BY h.host_id, o.option_id, r.reservation_id"},
|
||||
|
||||
// Retrieves host information along with the DHCPv4 options associated with
|
||||
// it. Left joining the dhcp4_options table results in multiple rows being
|
||||
// returned for the same host. Hosts are retrieved with a host id greater
|
||||
// than the start one.
|
||||
// The number of hosts returned is lower or equal to the limit.
|
||||
{MySqlHostDataSourceImpl::GET_HOST_PAGE4,
|
||||
"SELECT h.host_id, h.dhcp_identifier, h.dhcp_identifier_type, "
|
||||
"h.dhcp4_subnet_id, h.dhcp6_subnet_id, h.ipv4_address, h.hostname, "
|
||||
"h.dhcp4_client_classes, h.dhcp6_client_classes, h.user_context, "
|
||||
"h.dhcp4_next_server, h.dhcp4_server_hostname, "
|
||||
"h.dhcp4_boot_file_name, h.auth_key, "
|
||||
"o.option_id, o.code, o.value, o.formatted_value, o.space, "
|
||||
"o.persistent, o.user_context "
|
||||
"FROM ( SELECT * FROM hosts AS h "
|
||||
"WHERE h.host_id > ? "
|
||||
"ORDER BY h.host_id "
|
||||
"LIMIT ? ) AS h "
|
||||
"LEFT JOIN dhcp4_options AS o "
|
||||
"ON h.host_id = o.host_id "
|
||||
"ORDER BY h.host_id, o.option_id"},
|
||||
|
||||
// Retrieves host information, IPv6 reservations and DHCPv6 options
|
||||
// associated with a host. The number of rows returned is a multiplication
|
||||
// of number of IPv6 reservations and DHCPv6 options. Hosts are retrieved
|
||||
// with a host id greater than the start one.
|
||||
// The number of hosts returned is lower or equal to the limit.
|
||||
{MySqlHostDataSourceImpl::GET_HOST_PAGE6,
|
||||
"SELECT h.host_id, h.dhcp_identifier, "
|
||||
"h.dhcp_identifier_type, h.dhcp4_subnet_id, "
|
||||
"h.dhcp6_subnet_id, h.ipv4_address, h.hostname, "
|
||||
"h.dhcp4_client_classes, h.dhcp6_client_classes, h.user_context, "
|
||||
"h.dhcp4_next_server, h.dhcp4_server_hostname, "
|
||||
"h.dhcp4_boot_file_name, h.auth_key, "
|
||||
"o.option_id, o.code, o.value, o.formatted_value, o.space, "
|
||||
"o.persistent, o.user_context, "
|
||||
"r.reservation_id, r.address, r.prefix_len, r.type, "
|
||||
"r.dhcp6_iaid "
|
||||
"FROM ( SELECT * FROM hosts AS h "
|
||||
"WHERE h.host_id > ? "
|
||||
"ORDER BY h.host_id "
|
||||
"LIMIT ? ) AS h "
|
||||
"LEFT JOIN dhcp6_options AS o "
|
||||
"ON h.host_id = o.host_id "
|
||||
"LEFT JOIN ipv6_reservations AS r "
|
||||
"ON h.host_id = r.host_id "
|
||||
"ORDER BY h.host_id, o.option_id, r.reservation_id"},
|
||||
|
||||
// Inserts a host into the 'hosts' table.
|
||||
{MySqlHostDataSourceImpl::INSERT_HOST,
|
||||
"INSERT INTO hosts(host_id, dhcp_identifier, dhcp_identifier_type, "
|
||||
@@ -3311,6 +3360,68 @@ MySqlHostDataSource::getPage6(const SubnetID& subnet_id,
|
||||
return (result);
|
||||
}
|
||||
|
||||
ConstHostCollection
|
||||
MySqlHostDataSource::getPage4(size_t& /*source_index*/,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const {
|
||||
// Get a context
|
||||
MySqlHostContextAlloc get_context(*impl_);
|
||||
MySqlHostContextPtr ctx = get_context.ctx_;
|
||||
|
||||
// Set up the WHERE clause value
|
||||
MYSQL_BIND inbind[2];
|
||||
memset(inbind, 0, sizeof(inbind));
|
||||
|
||||
// Bind lower host id
|
||||
uint32_t host_id = lower_host_id;
|
||||
inbind[0].buffer_type = MYSQL_TYPE_LONG;
|
||||
inbind[0].buffer = reinterpret_cast<char*>(&host_id);
|
||||
inbind[0].is_unsigned = MLM_TRUE;
|
||||
|
||||
// Bind page size value
|
||||
uint32_t page_size_data = page_size.page_size_;
|
||||
inbind[1].buffer_type = MYSQL_TYPE_LONG;
|
||||
inbind[1].buffer = reinterpret_cast<char*>(&page_size_data);
|
||||
inbind[1].is_unsigned = MLM_TRUE;
|
||||
|
||||
ConstHostCollection result;
|
||||
impl_->getHostCollection(ctx, MySqlHostDataSourceImpl::GET_HOST_PAGE4, inbind,
|
||||
ctx->host_ipv4_exchange_, result, false);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
ConstHostCollection
|
||||
MySqlHostDataSource::getPage6(size_t& /*source_index*/,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const {
|
||||
// Get a context
|
||||
MySqlHostContextAlloc get_context(*impl_);
|
||||
MySqlHostContextPtr ctx = get_context.ctx_;
|
||||
|
||||
// Set up the WHERE clause value
|
||||
MYSQL_BIND inbind[2];
|
||||
memset(inbind, 0, sizeof(inbind));
|
||||
|
||||
// Bind lower host id
|
||||
uint32_t host_id = lower_host_id;
|
||||
inbind[0].buffer_type = MYSQL_TYPE_LONG;
|
||||
inbind[0].buffer = reinterpret_cast<char*>(&host_id);
|
||||
inbind[0].is_unsigned = MLM_TRUE;
|
||||
|
||||
// Bind page size value
|
||||
uint32_t page_size_data = page_size.page_size_;
|
||||
inbind[1].buffer_type = MYSQL_TYPE_LONG;
|
||||
inbind[1].buffer = reinterpret_cast<char*>(&page_size_data);
|
||||
inbind[1].is_unsigned = MLM_TRUE;
|
||||
|
||||
ConstHostCollection result;
|
||||
impl_->getHostCollection(ctx, MySqlHostDataSourceImpl::GET_HOST_PAGE6, inbind,
|
||||
ctx->host_ipv6_exchange_, result, false);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
ConstHostCollection
|
||||
MySqlHostDataSource::getAll4(const asiolink::IOAddress& address) const {
|
||||
// Get a context
|
||||
|
@@ -233,6 +233,36 @@ public:
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const;
|
||||
|
||||
/// @brief Returns range of hosts.
|
||||
///
|
||||
/// This method returns a page of @c Host objects which represent
|
||||
/// reservations.
|
||||
///
|
||||
/// @param source_index Index of the source (unused).
|
||||
/// @param lower_host_id Host identifier used as lower bound for the
|
||||
/// returned range.
|
||||
/// @param page_size maximum size of the page returned.
|
||||
///
|
||||
/// @return Collection of const @c Host objects (may be empty).
|
||||
virtual ConstHostCollection getPage4(size_t& source_index,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const;
|
||||
|
||||
/// @brief Returns range of hosts.
|
||||
///
|
||||
/// This method returns a page of @c Host objects which represent
|
||||
/// reservations.
|
||||
///
|
||||
/// @param source_index Index of the source (unused).
|
||||
/// @param lower_host_id Host identifier used as lower bound for the
|
||||
/// returned range.
|
||||
/// @param page_size maximum size of the page returned.
|
||||
///
|
||||
/// @return Collection of const @c Host objects (may be empty).
|
||||
virtual ConstHostCollection getPage6(size_t& source_index,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const;
|
||||
|
||||
/// @brief Returns a collection of hosts using the specified IPv4 address.
|
||||
///
|
||||
/// This method may return multiple @c Host objects if they are connected
|
||||
|
@@ -1368,6 +1368,8 @@ public:
|
||||
GET_HOST_HOSTNAME_SUBID6, // Gets hosts by hostname and IPv6 SubnetID
|
||||
GET_HOST_SUBID4_PAGE, // Gets hosts by IPv4 SubnetID beginning by HID
|
||||
GET_HOST_SUBID6_PAGE, // Gets hosts by IPv6 SubnetID beginning by HID
|
||||
GET_HOST_PAGE4, // Gets v4 hosts beginning by HID
|
||||
GET_HOST_PAGE6, // Gets v6 hosts beginning by HID
|
||||
INSERT_HOST, // Insert new host to collection
|
||||
INSERT_V6_RESRV, // Insert v6 reservation
|
||||
INSERT_V4_HOST_OPTION, // Insert DHCPv4 option
|
||||
@@ -1908,6 +1910,57 @@ TaggedStatementArray tagged_statements = { {
|
||||
"ORDER BY h.host_id, o.option_id, r.reservation_id"
|
||||
},
|
||||
|
||||
// PgSqlHostDataSourceImpl::GET_HOST_PAGE4
|
||||
// Retrieves host information along with the DHCPv4 options associated with
|
||||
// it. Left joining the dhcp4_options table results in multiple rows being
|
||||
// returned for the same host. The hosts are retrieved starting from
|
||||
// specified host id. Specified number of hosts is returned.
|
||||
{2,
|
||||
{ OID_INT8, OID_INT8 },
|
||||
"get_host_page4",
|
||||
"SELECT h.host_id, h.dhcp_identifier, h.dhcp_identifier_type, "
|
||||
" h.dhcp4_subnet_id, h.dhcp6_subnet_id, h.ipv4_address, h.hostname, "
|
||||
" h.dhcp4_client_classes, h.dhcp6_client_classes, h.user_context, "
|
||||
" h.dhcp4_next_server, h.dhcp4_server_hostname, "
|
||||
" h.dhcp4_boot_file_name, h.auth_key, "
|
||||
" o.option_id, o.code, o.value, o.formatted_value, o.space, "
|
||||
" o.persistent, o.user_context "
|
||||
"FROM ( SELECT * FROM hosts AS h "
|
||||
" WHERE h.host_id > $1 "
|
||||
" ORDER BY h.host_id "
|
||||
" LIMIT $2 ) AS h "
|
||||
"LEFT JOIN dhcp4_options AS o ON h.host_id = o.host_id "
|
||||
"ORDER BY h.host_id, o.option_id"
|
||||
},
|
||||
|
||||
// PgSqlHostDataSourceImpl::GET_HOST_PAGE6
|
||||
// Retrieves host information, IPv6 reservations and DHCPv6 options
|
||||
// associated with a host using IPv6 subnet id. This query returns
|
||||
// host information for a single host. However, multiple rows are
|
||||
// returned due to left joining IPv6 reservations and DHCPv6 options.
|
||||
// The number of rows returned is multiplication of number of existing
|
||||
// IPv6 reservations and DHCPv6 options.
|
||||
{2,
|
||||
{ OID_INT8, OID_INT8 },
|
||||
"get_host_page6",
|
||||
"SELECT h.host_id, h.dhcp_identifier, "
|
||||
" h.dhcp_identifier_type, h.dhcp4_subnet_id, "
|
||||
" h.dhcp6_subnet_id, h.ipv4_address, h.hostname, "
|
||||
" h.dhcp4_client_classes, h.dhcp6_client_classes, h.user_context, "
|
||||
" h.dhcp4_next_server, h.dhcp4_server_hostname, "
|
||||
" h.dhcp4_boot_file_name, h.auth_key, "
|
||||
" o.option_id, o.code, o.value, o.formatted_value, o.space, "
|
||||
" o.persistent, o.user_context, "
|
||||
" r.reservation_id, r.address, r.prefix_len, r.type, r.dhcp6_iaid "
|
||||
"FROM ( SELECT * FROM hosts AS h "
|
||||
" WHERE h.host_id > $1 "
|
||||
" ORDER BY h.host_id "
|
||||
" LIMIT $2 ) AS h "
|
||||
"LEFT JOIN dhcp6_options AS o ON h.host_id = o.host_id "
|
||||
"LEFT JOIN ipv6_reservations AS r ON h.host_id = r.host_id "
|
||||
"ORDER BY h.host_id, o.option_id, r.reservation_id"
|
||||
},
|
||||
|
||||
// PgSqlHostDataSourceImpl::INSERT_HOST
|
||||
// Inserts a host into the 'hosts' table. Returns the inserted host id.
|
||||
{13,
|
||||
@@ -2598,6 +2651,58 @@ PgSqlHostDataSource::getPage6(const SubnetID& subnet_id,
|
||||
return (result);
|
||||
}
|
||||
|
||||
ConstHostCollection
|
||||
PgSqlHostDataSource::getPage4(size_t& /*source_index*/,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const {
|
||||
// Get a context
|
||||
PgSqlHostContextAlloc get_context(*impl_);
|
||||
PgSqlHostContextPtr ctx = get_context.ctx_;
|
||||
|
||||
// Set up the WHERE clause value
|
||||
PsqlBindArrayPtr bind_array(new PsqlBindArray());
|
||||
|
||||
// Add the lower bound host id.
|
||||
bind_array->add(lower_host_id);
|
||||
|
||||
// Add the page size value.
|
||||
string page_size_data =
|
||||
boost::lexical_cast<std::string>(page_size.page_size_);
|
||||
bind_array->add(page_size_data);
|
||||
|
||||
ConstHostCollection result;
|
||||
impl_->getHostCollection(ctx, PgSqlHostDataSourceImpl::GET_HOST_PAGE4,
|
||||
bind_array, ctx->host_ipv4_exchange_, result, false);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
ConstHostCollection
|
||||
PgSqlHostDataSource::getPage6(size_t& /*source_index*/,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const {
|
||||
// Get a context
|
||||
PgSqlHostContextAlloc get_context(*impl_);
|
||||
PgSqlHostContextPtr ctx = get_context.ctx_;
|
||||
|
||||
// Set up the WHERE clause value
|
||||
PsqlBindArrayPtr bind_array(new PsqlBindArray());
|
||||
|
||||
// Add the lower bound host id.
|
||||
bind_array->add(lower_host_id);
|
||||
|
||||
// Add the page size value.
|
||||
string page_size_data =
|
||||
boost::lexical_cast<std::string>(page_size.page_size_);
|
||||
bind_array->add(page_size_data);
|
||||
|
||||
ConstHostCollection result;
|
||||
impl_->getHostCollection(ctx, PgSqlHostDataSourceImpl::GET_HOST_PAGE6,
|
||||
bind_array, ctx->host_ipv6_exchange_, result, false);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
ConstHostCollection
|
||||
PgSqlHostDataSource::getAll4(const asiolink::IOAddress& address) const {
|
||||
// Get a context
|
||||
|
@@ -272,6 +272,46 @@ public:
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const;
|
||||
|
||||
/// @brief Returns range of hosts.
|
||||
///
|
||||
/// This method implements paged browsing of host databases. The
|
||||
/// parameters specify a page size, an index in sources and the
|
||||
/// starting host id of the range. If not zero this host id is
|
||||
/// excluded from the returned range. When a source is exhausted
|
||||
/// the index is updated. There is no guarantee about the order
|
||||
/// of returned host reservations, only the sources and
|
||||
/// reservations from the same source are ordered.
|
||||
///
|
||||
/// @param source_index Index of the source (unused).
|
||||
/// @param lower_host_id Host identifier used as lower bound for the
|
||||
/// returned range.
|
||||
/// @param page_size maximum size of the page returned.
|
||||
///
|
||||
/// @return Collection of const @c Host objects (may be empty).
|
||||
virtual ConstHostCollection getPage4(size_t& source_index,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const;
|
||||
|
||||
/// @brief Returns range of hosts.
|
||||
///
|
||||
/// This method implements paged browsing of host databases. The
|
||||
/// parameters specify a page size, an index in sources and the
|
||||
/// starting host id of the range. If not zero this host id is
|
||||
/// excluded from the returned range. When a source is exhausted
|
||||
/// the index is updated. There is no guarantee about the order
|
||||
/// of returned host reservations, only the sources and
|
||||
/// reservations from the same source are ordered.
|
||||
///
|
||||
/// @param source_index Index of the source (unused).
|
||||
/// @param lower_host_id Host identifier used as lower bound for the
|
||||
/// returned range.
|
||||
/// @param page_size maximum size of the page returned.
|
||||
///
|
||||
/// @return Collection of const @c Host objects (may be empty).
|
||||
virtual ConstHostCollection getPage6(size_t& source_index,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const;
|
||||
|
||||
/// @brief Returns a collection of hosts using the specified IPv4 address.
|
||||
///
|
||||
/// This method may return multiple @c Host objects if they are connected
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
// Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@@ -635,6 +635,16 @@ public:
|
||||
return (getCollection());
|
||||
}
|
||||
|
||||
ConstHostCollection getPage4(size_t&, uint64_t,
|
||||
const HostPageSize&) const {
|
||||
return (getCollection());
|
||||
}
|
||||
|
||||
ConstHostCollection getPage6(size_t&, uint64_t,
|
||||
const HostPageSize&) const {
|
||||
return (getCollection());
|
||||
}
|
||||
|
||||
ConstHostCollection getAll4(const IOAddress&) const {
|
||||
return (getCollection());
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
// Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@@ -130,6 +130,40 @@ MemHostDataSource::getPage6(const SubnetID& subnet_id,
|
||||
return (hosts);
|
||||
}
|
||||
|
||||
ConstHostCollection
|
||||
MemHostDataSource::getPage4(size_t& /*source_index*/,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const {
|
||||
ConstHostCollection hosts;
|
||||
for (auto h = store_.begin(); h != store_.end(); ++h) {
|
||||
if (lower_host_id && ((*h)->getHostId() <= lower_host_id)) {
|
||||
continue;
|
||||
}
|
||||
hosts.push_back(*h);
|
||||
if (hosts.size() == page_size.page_size_) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return (hosts);
|
||||
}
|
||||
|
||||
ConstHostCollection
|
||||
MemHostDataSource::getPage6(size_t& /*source_index*/,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const {
|
||||
ConstHostCollection hosts;
|
||||
for (auto h = store_.begin(); h != store_.end(); ++h) {
|
||||
if (lower_host_id && ((*h)->getHostId() <= lower_host_id)) {
|
||||
continue;
|
||||
}
|
||||
hosts.push_back(*h);
|
||||
if (hosts.size() == page_size.page_size_) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return (hosts);
|
||||
}
|
||||
|
||||
ConstHostCollection
|
||||
MemHostDataSource::getAll4(const asiolink::IOAddress& /*address*/) const {
|
||||
return (ConstHostCollection());
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
// Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@@ -104,6 +104,28 @@ public:
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const;
|
||||
|
||||
/// @brief Return range of hosts.
|
||||
///
|
||||
/// @param source_index Index of the source (unused).
|
||||
/// @param lower_host_id Host identifier used as lower bound for the
|
||||
/// returned range.
|
||||
/// @param page_size maximum size of the page returned.
|
||||
virtual ConstHostCollection
|
||||
getPage4(size_t& source_index,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const;
|
||||
|
||||
/// @brief Return range of hosts.
|
||||
///
|
||||
/// @param source_index Index of the source (unused).
|
||||
/// @param lower_host_id Host identifier used as lower bound for the
|
||||
/// returned range.
|
||||
/// @param page_size maximum size of the page returned.
|
||||
virtual ConstHostCollection
|
||||
getPage6(size_t& source_index,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) const;
|
||||
|
||||
/// @brief Returns a collection of hosts using the specified IPv4 address.
|
||||
///
|
||||
/// Currently not implemented.
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
// Copyright (C) 2014-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@@ -138,6 +138,48 @@ public:
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) = 0;
|
||||
|
||||
/// @brief Returns range of hosts.
|
||||
///
|
||||
/// This method implements paged browsing of host databases. The
|
||||
/// parameters specify a page size, an index in sources and the
|
||||
/// starting host id of the range. If not zero this host id is
|
||||
/// excluded from the returned range. When a source is exhausted
|
||||
/// the index is updated. There is no guarantee about the order
|
||||
/// of returned host reservations, only the sources and
|
||||
/// reservations from the same source are ordered.
|
||||
///
|
||||
/// @param source_index Index of the source.
|
||||
/// @param lower_host_id Host identifier used as lower bound for the
|
||||
/// returned range.
|
||||
/// @param page_size maximum size of the page returned.
|
||||
///
|
||||
/// @return Collection of non-const @c Host objects.
|
||||
virtual HostCollection
|
||||
getPage4(size_t& source_index,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) = 0;
|
||||
|
||||
/// @brief Returns range of hosts.
|
||||
///
|
||||
/// This method implements paged browsing of host databases. The
|
||||
/// parameters specify a page size, an index in sources and the
|
||||
/// starting host id of the range. If not zero this host id is
|
||||
/// excluded from the returned range. When a source is exhausted
|
||||
/// the index is updated. There is no guarantee about the order
|
||||
/// of returned host reservations, only the sources and
|
||||
/// reservations from the same source are ordered.
|
||||
///
|
||||
/// @param source_index Index of the source.
|
||||
/// @param lower_host_id Host identifier used as lower bound for the
|
||||
/// returned range.
|
||||
/// @param page_size maximum size of the page returned.
|
||||
///
|
||||
/// @return Collection of non-const @c Host objects.
|
||||
virtual HostCollection
|
||||
getPage6(size_t& source_index,
|
||||
uint64_t lower_host_id,
|
||||
const HostPageSize& page_size) = 0;
|
||||
|
||||
/// @brief Returns a collection of hosts using the specified IPv4 address.
|
||||
///
|
||||
/// This method may return multiple @c Host objects if they are connected
|
||||
|
Reference in New Issue
Block a user