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.
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.
/// @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();