Kea 2.2.0
library_manager.h
Go to the documentation of this file.
1// Copyright (C) 2013-2020 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
109 static bool validateLibrary(const std::string& name);
110
124 bool loadLibrary();
125
136
140 std::string getName() const {
141 return (library_name_);
142 }
143
144protected:
145 // The following methods are protected as they are accessed in testing.
146
159 bool unloadLibrary();
160
167 bool openLibrary();
168
177 bool closeLibrary();
178
191 bool checkVersion() const;
192
202
209
217 bool runLoad();
218
219private:
227 LibraryManager(const std::string& name);
228
229 // Member variables
230
231 void* dl_handle_;
232 int index_;
233 boost::shared_ptr<CalloutManager> manager_;
235 std::string library_name_;
236
237 ServerHooksPtr server_hooks_;
238
239};
240
241} // namespace hooks
242} // namespace isc
243
244#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.
LibraryManager(const std::string &name, int index, const boost::shared_ptr< CalloutManager > &manager)
Constructor.
bool unloadLibrary()
Unloads a library.
bool loadLibrary()
Loads a library.
bool openLibrary()
Open library.
bool closeLibrary()
Close library.
static bool validateLibrary(const std::string &name)
Validate library.
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 checkMultiThreadingCompatible() const
Check multi-threading compatibility.
NoCalloutManager(const char *file, size_t line, const char *what)
boost::shared_ptr< ServerHooks > ServerHooksPtr
Definition: server_hooks.h:42
Defines the logger used by the top-level component of kea-lfc.