mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-31 05:55:28 +00:00
[#1139] Added globalHost() convenience method
This function was added to the ClientContext4 for the DHCPv4 server to be able to quickly check if there are any global host reservations present and if the reservations contain client classes which could be possibly used for leases allocation.
This commit is contained in:
@@ -3075,6 +3075,18 @@ AllocEngine::ClientContext4::currentHost() const {
|
||||
return (ConstHostPtr());
|
||||
}
|
||||
|
||||
ConstHostPtr
|
||||
AllocEngine::ClientContext4::globalHost() const {
|
||||
if (subnet_ && subnet_->getHostReservationMode() == Network::HR_GLOBAL) {
|
||||
auto host = hosts_.find(SUBNET_ID_GLOBAL);
|
||||
if (host != hosts_.cend()) {
|
||||
return (host->second);
|
||||
}
|
||||
}
|
||||
|
||||
return (ConstHostPtr());
|
||||
}
|
||||
|
||||
DdnsParamsPtr
|
||||
AllocEngine::ClientContext4::getDdnsParams() {
|
||||
// We already have it, return it.
|
||||
|
@@ -1409,6 +1409,16 @@ public:
|
||||
/// @return Pointer to the host object.
|
||||
ConstHostPtr currentHost() const;
|
||||
|
||||
/// @brief Returns global host reservation if there is one
|
||||
///
|
||||
/// If the current subnet's reservation mode is global and
|
||||
/// there is a global host (i.e. reservation belonging to
|
||||
/// the global subnet), return it. Otherwise return an
|
||||
/// empty pointer.
|
||||
///
|
||||
/// @return Pointer to the host object.
|
||||
ConstHostPtr globalHost() const;
|
||||
|
||||
/// @brief Default constructor.
|
||||
ClientContext4();
|
||||
|
||||
|
Reference in New Issue
Block a user