Kea 2.5.8
library_manager.h
Go to the documentation of this file.
1// Copyright (C) 2013-2023 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#ifndef LIBRARY_MANAGER_H
8#define LIBRARY_MANAGER_H
9
11#include <hooks/server_hooks.h>
12#include <boost/shared_ptr.hpp>
13
14#include <string>
15
16namespace isc {
17namespace hooks {
18
24public:
25 NoCalloutManager(const char* file, size_t line, const char* what) :
26 isc::Exception(file, line, what) {}
27};
28
29class CalloutManager;
30class LibraryHandle;
31class LibraryManager;
32
72
74public:
88 LibraryManager(const std::string& name, int index,
89 const boost::shared_ptr<CalloutManager>& manager);
90
98
111 static bool validateLibrary(const std::string& name,
112 bool multi_threading_enabled = false);
113
130 bool loadLibrary(bool multi_threading_enabled = false);
131
142
146 std::string getName() const {
147 return (library_name_);
148 }
149
150protected:
151 // The following methods are protected as they are accessed in testing.
152
165 bool unloadLibrary();
166
173 bool openLibrary();
174
183 bool closeLibrary();
184
197 bool checkVersion() const;
198
210 bool checkMultiThreadingCompatible(bool multi_threading_enabled) const;
211
218
226 bool runLoad();
227
228private:
236 LibraryManager(const std::string& name);
237
238 // Member variables
239
240 void* dl_handle_;
241 int index_;
242 boost::shared_ptr<CalloutManager> manager_;
244 std::string library_name_;
245
246 ServerHooksPtr server_hooks_;
247
248};
249
250} // namespace hooks
251} // namespace isc
252
253#endif // LIBRARY_MANAGER_H
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
bool unloadLibrary()
Unloads a library.
static bool validateLibrary(const std::string &name, bool multi_threading_enabled=false)
Validate library.
bool openLibrary()
Open library.
bool closeLibrary()
Close library.
bool checkMultiThreadingCompatible(bool multi_threading_enabled) const
Check multi-threading compatibility.
std::string getName() const
Return library name.
bool checkVersion() const
Check library version.
void registerStandardCallouts()
Register standard callouts.
bool runLoad()
Run the load function if present.
bool prepareUnloadLibrary()
Prepares library unloading.
bool loadLibrary(bool multi_threading_enabled=false)
Loads a library.
NoCalloutManager(const char *file, size_t line, const char *what)
boost::shared_ptr< ServerHooks > ServerHooksPtr
Definition: server_hooks.h:43
Defines the logger used by the top-level component of kea-lfc.