Kea 1.5.0
library_manager.h
Go to the documentation of this file.
1// Copyright (C) 2013-2017 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
71
73public:
87 LibraryManager(const std::string& name, int index,
88 const boost::shared_ptr<CalloutManager>& manager);
89
97
108 static bool validateLibrary(const std::string& name);
109
121 bool loadLibrary();
122
135 bool unloadLibrary();
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
153 bool openLibrary();
154
163 bool closeLibrary();
164
177 bool checkVersion() const;
178
185
193 bool runLoad();
194
202 bool runUnload();
203
204private:
212 LibraryManager(const std::string& name);
213
214 // Member variables
215
216 void* dl_handle_;
217 int index_;
218 boost::shared_ptr<CalloutManager> manager_;
220 std::string library_name_;
221
222 ServerHooksPtr server_hooks_;
223
224};
225
226} // namespace hooks
227} // namespace isc
228
229#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.
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 runUnload()
Run the unload function if present.
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-dhcp-ddns.