mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-28 12:37:55 +00:00
[#2795] add getAll6 by ip-address method
This commit is contained in:
parent
c5d56aaac8
commit
b1ca2faffe
@ -740,6 +740,23 @@ HostMgr::getAll6(const SubnetID& subnet_id,
|
||||
return getAll6(subnet_id, address, HostMgrOperationTarget::ALL_SOURCES);
|
||||
}
|
||||
|
||||
ConstHostCollection
|
||||
HostMgr::getAll6(const IOAddress& address, const HostMgrOperationTarget target) const {
|
||||
ConstHostCollection hosts;
|
||||
if (target & HostMgrOperationTarget::PRIMARY_SOURCE) {
|
||||
hosts = getCfgHosts()->getAll6(address);
|
||||
}
|
||||
|
||||
if (target & HostMgrOperationTarget::ALTERNATE_SOURCES) {
|
||||
for (auto source : alternate_sources_) {
|
||||
ConstHostCollection hosts_plus = source->getAll4(address);
|
||||
hosts.insert(hosts.end(), hosts_plus.begin(), hosts_plus.end());
|
||||
}
|
||||
}
|
||||
|
||||
return (hosts);
|
||||
}
|
||||
|
||||
void
|
||||
HostMgr::add(const HostPtr& host, const HostMgrOperationTarget target) {
|
||||
if (target & HostMgrOperationTarget::PRIMARY_SOURCE) {
|
||||
@ -959,6 +976,5 @@ HostMgr::setIPReservationsUnique(const bool unique) {
|
||||
return (true);
|
||||
}
|
||||
|
||||
|
||||
} // end of isc::dhcp namespace
|
||||
} // end of isc namespace
|
||||
|
@ -641,6 +641,24 @@ public:
|
||||
getAll6(const SubnetID& subnet_id,
|
||||
const asiolink::IOAddress& address) const;
|
||||
|
||||
/// @brief Returns a collection of hosts using the specified IPv6 address.
|
||||
///
|
||||
/// This method may return multiple @c Host objects if they are connected to
|
||||
/// different subnets or if there are multiple hosts with the same IPv6 address.
|
||||
///
|
||||
/// If matching reservations are both in the primary and the alternate
|
||||
/// data source, all of them are returned. The reservations from the
|
||||
/// primary data source are placed before the reservations from the
|
||||
/// alternate source.
|
||||
///
|
||||
/// @param address IPv6 address for which the @c Host object is searched.
|
||||
/// @param target The host data source being a target of the operation.
|
||||
///
|
||||
/// @return Collection of const @c Host objects.
|
||||
ConstHostCollection
|
||||
getAll6(const asiolink::IOAddress& address,
|
||||
const HostMgrOperationTarget target) const;
|
||||
|
||||
/// @brief Adds a new host to the alternate data source.
|
||||
///
|
||||
/// This method will throw an exception if no alternate data source is
|
||||
|
Loading…
x
Reference in New Issue
Block a user