]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1227] addressed review
authorRazvan Becheriu <razvan@isc.org>
Fri, 15 May 2020 17:27:19 +0000 (20:27 +0300)
committerRazvan Becheriu <razvan@isc.org>
Fri, 15 May 2020 18:21:41 +0000 (21:21 +0300)
src/bin/dhcp6/dhcp6_srv.cc
src/lib/dhcpsrv/alloc_engine.cc
src/lib/dhcpsrv/cb_ctl_dhcp4.cc
src/lib/dhcpsrv/cb_ctl_dhcp6.cc
src/lib/hooks/hooks_manager.h
src/lib/hooks/library_handle.cc

index 18efcf8743002f171a7e5045f3aa626e739b96a2..b2c744d17f02f5a4565814ef42ee527369dc4f35 100644 (file)
@@ -279,7 +279,7 @@ Dhcpv6Srv::~Dhcpv6Srv() {
     LeaseMgrFactory::destroy();
 
     // Explicitly unload hooks
-    HooksManager::getHooksManager().unloadLibraries();
+    HooksManager::unloadLibraries();
 }
 
 void Dhcpv6Srv::shutdown() {
index dc2e56f597e14b6458fbdfccd5a7c711767b4003..af25d3e222769fbb0b20ede11137691f46284af9 100644 (file)
@@ -1695,7 +1695,7 @@ AllocEngine::reuseExpiredLease(Lease6Ptr& expired, ClientContext6& ctx,
 
     // Let's execute all callouts registered for lease6_select
     if (ctx.callout_handle_ &&
-        HooksManager::getHooksManager().calloutsPresent(hook_index_lease6_select_)) {
+        HooksManager::calloutsPresent(hook_index_lease6_select_)) {
 
         // Use the RAII wrapper to make sure that the callout handle state is
         // reset when this object goes out of scope. All hook points must do
@@ -1811,7 +1811,7 @@ Lease6Ptr AllocEngine::createLease6(ClientContext6& ctx,
 
     // Let's execute all callouts registered for lease6_select
     if (ctx.callout_handle_ &&
-        HooksManager::getHooksManager().calloutsPresent(hook_index_lease6_select_)) {
+        HooksManager::calloutsPresent(hook_index_lease6_select_)) {
 
         // Use the RAII wrapper to make sure that the callout handle state is
         // reset when this object goes out of scope. All hook points must do
@@ -2287,7 +2287,7 @@ AllocEngine::reclaimExpiredLeases6(const size_t max_leases, const uint16_t timeo
     // lease6_expire callouts installed.
     CalloutHandlePtr callout_handle;
     if (!leases.empty() &&
-        HooksManager::getHooksManager().calloutsPresent(Hooks.hook_index_lease6_expire_)) {
+        HooksManager::calloutsPresent(Hooks.hook_index_lease6_expire_)) {
         callout_handle = HooksManager::createCalloutHandle();
     }
 
@@ -2425,7 +2425,7 @@ AllocEngine::reclaimExpiredLeases4(const size_t max_leases, const uint16_t timeo
     // lease4_expire callouts installed.
     CalloutHandlePtr callout_handle;
     if (!leases.empty() &&
-        HooksManager::getHooksManager().calloutsPresent(Hooks.hook_index_lease4_expire_)) {
+        HooksManager::calloutsPresent(Hooks.hook_index_lease4_expire_)) {
         callout_handle = HooksManager::createCalloutHandle();
     }
 
@@ -2726,7 +2726,7 @@ AllocEngine::reclaimDeclined(const Lease4Ptr& lease) {
         return (true);
     }
 
-    if (HooksManager::getHooksManager().calloutsPresent(Hooks.hook_index_lease4_recover_)) {
+    if (HooksManager::calloutsPresent(Hooks.hook_index_lease4_recover_)) {
         CalloutHandlePtr callout_handle = HooksManager::createCalloutHandle();
 
         // Use the RAII wrapper to make sure that the callout handle state is
@@ -2780,7 +2780,7 @@ AllocEngine::reclaimDeclined(const Lease6Ptr& lease) {
         return (true);
     }
 
-    if (HooksManager::getHooksManager().calloutsPresent(Hooks.hook_index_lease6_recover_)) {
+    if (HooksManager::calloutsPresent(Hooks.hook_index_lease6_recover_)) {
         CalloutHandlePtr callout_handle = HooksManager::createCalloutHandle();
 
         // Use the RAII wrapper to make sure that the callout handle state is
@@ -3653,7 +3653,7 @@ AllocEngine::createLease4(const ClientContext4& ctx, const IOAddress& addr,
 
     // Let's execute all callouts registered for lease4_select
     if (ctx.callout_handle_ &&
-        HooksManager::getHooksManager().calloutsPresent(hook_index_lease4_select_)) {
+        HooksManager::calloutsPresent(hook_index_lease4_select_)) {
 
         // Use the RAII wrapper to make sure that the callout handle state is
         // reset when this object goes out of scope. All hook points must do
@@ -3768,8 +3768,7 @@ AllocEngine::renewLease4(const Lease4Ptr& lease,
 
     bool skip = false;
     // Execute all callouts registered for lease4_renew.
-    if (HooksManager::getHooksManager().
-        calloutsPresent(Hooks.hook_index_lease4_renew_)) {
+    if (HooksManager::calloutsPresent(Hooks.hook_index_lease4_renew_)) {
 
         // Use the RAII wrapper to make sure that the callout handle state is
         // reset when this object goes out of scope. All hook points must do
@@ -3871,8 +3870,8 @@ AllocEngine::reuseExpiredLease4(Lease4Ptr& expired,
         .arg(expired->toText());
 
     // Let's execute all callouts registered for lease4_select
-    if (ctx.callout_handle_ &&  HooksManager::getHooksManager()
-        .calloutsPresent(hook_index_lease4_select_)) {
+    if (ctx.callout_handle_ &&
+        HooksManager::calloutsPresent(hook_index_lease4_select_)) {
 
         // Enable copying options from the packet within hook library.
         ScopedEnableOptionsCopy<Pkt4> query4_options_copy(ctx.query_);
index c64d655bdb51680a5701d5a9e462c1d063e4b7bc..90bfce315e84b027761ba7f9010128bbc40bd56f 100644 (file)
@@ -209,7 +209,7 @@ CBControlDHCPv4::databaseConfigApply(const BackendSelector& backend_selector,
     LOG_INFO(dhcpsrv_logger, DHCPSRV_CFGMGR_CONFIG4_MERGED);
 
     if (!audit_entries.empty() &&
-        HooksManager::getHooksManager().calloutsPresent(hooks_.hook_index_cb4_updated_)) {
+        HooksManager::calloutsPresent(hooks_.hook_index_cb4_updated_)) {
         CalloutHandlePtr callout_handle = HooksManager::createCalloutHandle();
 
         // Use the RAII wrapper to make sure that the callout handle state is
index 0ad5eb09f9be3940f5fc2490bee5d985c172e4f6..7e83175e9cb95cb529115cfd6ed54c91adad8e10 100644 (file)
@@ -208,7 +208,7 @@ CBControlDHCPv6::databaseConfigApply(const db::BackendSelector& backend_selector
     LOG_INFO(dhcpsrv_logger, DHCPSRV_CFGMGR_CONFIG6_MERGED);
 
     if (!audit_entries.empty() &&
-        HooksManager::getHooksManager().calloutsPresent(hooks_.hook_index_cb6_updated_)) {
+        HooksManager::calloutsPresent(hooks_.hook_index_cb6_updated_)) {
         CalloutHandlePtr callout_handle = HooksManager::createCalloutHandle();
 
         // Use the RAII wrapper to make sure that the callout handle state is
index 911d8af741eefbce536f414a75800f16caa32cf6..5d1f9e9c417a119fb08e60528c9c8e340527f049 100644 (file)
@@ -37,10 +37,6 @@ class LibraryManagerCollection;
 
 class HooksManager : boost::noncopyable {
 public:
-    /// @brief Get singleton hooks manager
-    ///
-    /// @return Reference to the singleton hooks manager.
-    static HooksManager& getHooksManager();
 
     /// @brief Load and reload libraries
     ///
@@ -333,6 +329,11 @@ private:
     /// through the getHooksManager() static method.
     HooksManager();
 
+    /// @brief Get singleton hooks manager
+    ///
+    /// @return Reference to the singleton hooks manager.
+    static HooksManager& getHooksManager();
+
     /// @brief Park an object (packet).
     ///
     /// @tparam Type of the parked object.
index 6593febc5b4760cf65dfeb33875c713ccd2d7dfd..da6ec25c29d5fee70473edd0f140d687120cb326 100644 (file)
@@ -72,7 +72,7 @@ LibraryHandle::deregisterAllCallouts(const std::string& name) {
 
 isc::data::ConstElementPtr
 LibraryHandle::getParameters() {
-    HookLibsCollection libinfo = HooksManager::getHooksManager().getLibraryInfo();
+    HookLibsCollection libinfo = HooksManager::getLibraryInfo();
 
     int index = index_;