-// Copyright (C) 2015-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-2017 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
HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("lease4_release");
HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("lease4_decline");
- CalloutManager::getSharedManager().reset();
+ HooksManager::getSharedCalloutManager().reset();
delete srv_;
}
IfaceMgr::instance().openSockets4();
// Libraries will be reloaded later
- CalloutManager::getSharedManager().reset(new CalloutManager(0));
+ HooksManager::getSharedCalloutManager().reset(new CalloutManager(0));
// Install a callout
EXPECT_NO_THROW(HooksManager::preCalloutsLibraryHandle().registerCallout(
IfaceMgr::instance().openSockets4();
// Libraries will be reloaded later
- CalloutManager::getSharedManager().reset(new CalloutManager(0));
+ HooksManager::getSharedCalloutManager().reset(new CalloutManager(0));
// Install a callout
EXPECT_NO_THROW(HooksManager::preCalloutsLibraryHandle().registerCallout(
-// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2017 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
// Clear static buffers
resetCalloutBuffers();
- // Reset the hook system in its original state
- HooksManager::unloadLibraries();
+ // Reset the hook system in its original state
+ HooksManager::unloadLibraries();
}
/// @brief destructor (deletes Dhcpv6Srv)
~HooksDhcpv6SrvTest() {
// Clear shared manager
- CalloutManager::getSharedManager().reset();
+ HooksManager::getSharedCalloutManager().reset();
}
IfaceMgrTestConfig test_config(true);
// Libraries will be reloaded later
- CalloutManager::getSharedManager().reset(new CalloutManager(0));
+ HooksManager::getSharedCalloutManager().reset(new CalloutManager(0));
// Install lease6_decline callout
EXPECT_NO_THROW(HooksManager::preCalloutsLibraryHandle().registerCallout(
IfaceMgrTestConfig test_config(true);
// Libraries will be reloaded later
- CalloutManager::getSharedManager().reset(new CalloutManager(0));
+ HooksManager::getSharedCalloutManager().reset(new CalloutManager(0));
// Install lease6_decline callout. It will set the status to skip
EXPECT_NO_THROW(HooksManager::preCalloutsLibraryHandle().registerCallout(
IfaceMgrTestConfig test_config(true);
// Libraries will be reloaded later
- CalloutManager::getSharedManager().reset(new CalloutManager(0));
+ HooksManager::getSharedCalloutManager().reset(new CalloutManager(0));
// Install lease6_decline callout. It will set the status to skip
EXPECT_NO_THROW(HooksManager::preCalloutsLibraryHandle().registerCallout(
-// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2015 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
namespace isc {
namespace hooks {
-boost::shared_ptr<CalloutManager> CalloutManager::shared_manager_;
-
// Constructor
CalloutManager::CalloutManager(int num_libraries)
: server_hooks_(ServerHooks::getServerHooks()),
-// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2015 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
//@}
- /// @brief Return the shared manager
- ///
- /// @return A reference to the shared manager
- static boost::shared_ptr<CalloutManager>& getSharedManager() {
- return (shared_manager_);
- }
-
private:
/// @brief Check library index
///
/// Number of libraries.
int num_libraries_;
-
- /// Shared manager to survive library reloads
- static boost::shared_ptr<CalloutManager> shared_manager_;
};
} // namespace util
-// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2017 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
return (LibraryManagerCollection::validateLibraries(libraries));
}
+// Shared callout manager
+boost::shared_ptr<CalloutManager>&
+HooksManager::getSharedCalloutManager() {
+ return (getHooksManager().shared_callout_manager_);
+}
+
} // namespace util
} // namespace isc
-// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2017 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
static const int CONTEXT_CREATE = ServerHooks::CONTEXT_CREATE;
static const int CONTEXT_DESTROY = ServerHooks::CONTEXT_DESTROY;
+ /// @brief Return the shared callout manager
+ ///
+ /// Declared as static as other methods but only one for the
+ /// singleton will be created.
+ ///
+ /// @return A reference to the shared callout manager
+ static boost::shared_ptr<CalloutManager>& getSharedCalloutManager();
+
private:
/// @brief Constructor
/// Callout manager for the set of library managers.
boost::shared_ptr<CalloutManager> callout_manager_;
+
+ /// Shared callout manager to survive library reloads.
+ boost::shared_ptr<CalloutManager> shared_callout_manager_;
+
};
} // namespace util
-// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2017 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
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <hooks/callout_manager.h>
+#include <hooks/hooks_manager.h>
#include <hooks/library_manager.h>
#include <hooks/library_manager_collection.h>
// To survive reloads an attempt to re-use the shared manager
// is performed when the list of library names is empty.
if (library_names_.empty()) {
- callout_manager_ = CalloutManager::getSharedManager();
+ callout_manager_ = HooksManager::getSharedCalloutManager();
}
if (!library_names_.empty() || !callout_manager_) {
callout_manager_.reset(new CalloutManager(library_names_.size()));
-// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2017 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
/// Unload all libraries and reset the shared manager.
~HooksManagerTest() {
HooksManager::unloadLibraries();
- CalloutManager::getSharedManager().reset();
+ HooksManager::getSharedCalloutManager().reset();
}
HookLibsCollection library_names;
// Initialize the shared manager.
- CalloutManager::getSharedManager().reset(new CalloutManager(0));
+ HooksManager::getSharedCalloutManager().reset(new CalloutManager(0));
// Load the pre- and post- callouts.
HooksManager::preCalloutsLibraryHandle().registerCallout("hookpt_two",
data::ConstElementPtr()));
// Initialize the shared manager.
- CalloutManager::getSharedManager().reset(new CalloutManager(0));
+ HooksManager::getSharedCalloutManager().reset(new CalloutManager(0));
// Load the pre- and post- callouts.
HooksManager::preCalloutsLibraryHandle().registerCallout("hookpt_two",
EXPECT_TRUE(HooksManager::loadLibraries(library_names));
// Initialize the shared manager (after loadLibraries so too late)
- CalloutManager::getSharedManager().reset(new CalloutManager(0));
+ HooksManager::getSharedCalloutManager().reset(new CalloutManager(0));
// Load the pre- and post- callouts.
HooksManager::preCalloutsLibraryHandle().registerCallout("hookpt_two",