-// Copyright (C) 2013-2015 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
LibraryManager::LibraryManager(const std::string& name, int index,
const boost::shared_ptr<CalloutManager>& manager)
: dl_handle_(NULL), index_(index), manager_(manager),
- library_name_(name)
+ library_name_(name),
+ server_hooks_(ServerHooks::getServerHooksPtr())
{
if (!manager) {
isc_throw(NoCalloutManager, "must specify a CalloutManager when "
-// Copyright (C) 2013-2015 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
#define LIBRARY_MANAGER_H
#include <exceptions/exceptions.h>
-
+#include <hooks/server_hooks.h>
#include <boost/shared_ptr.hpp>
#include <string>
///< Callout manager for registration
std::string library_name_; ///< Name of the library
+ ServerHooksPtr server_hooks_; ///< Stores a pointer to ServerHooks.
+
};
} // namespace hooks
-// Copyright (C) 2013-2015 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
ServerHooks&
ServerHooks::getServerHooks() {
- static ServerHooks hooks;
+ return (*getServerHooksPtr());
+}
+
+ServerHooksPtr
+ServerHooks::getServerHooksPtr() {
+ static ServerHooksPtr hooks(new ServerHooks());
return (hooks);
}
-// Copyright (C) 2013-2015 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
#include <exceptions/exceptions.h>
#include <boost/noncopyable.hpp>
+#include <boost/shared_ptr.hpp>
#include <map>
#include <string>
isc::Exception(file, line, what) {}
};
+class ServerHooks;
+typedef boost::shared_ptr<ServerHooks> ServerHooksPtr;
/// @brief Server hook collection
///
/// @return Reference to the global ServerHooks object.
static ServerHooks& getServerHooks();
+ /// @brief Returns pointer to ServerHooks object.
+ ///
+ /// @return Pointer to the global ServerHooks object.
+ static ServerHooksPtr getServerHooksPtr();
+
private:
/// @brief Constructor
///