Kea 3.3.4
library_manager_collection.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_COLLECTION_H
8#define LIBRARY_MANAGER_COLLECTION_H
9
11
12#include <boost/shared_ptr.hpp>
13#include <hooks/libinfo.h>
14
15#include <vector>
16
17namespace isc {
18namespace hooks {
19
25public:
26 LoadLibrariesNotCalled(const char* file, size_t line, const char* what) :
27 isc::Exception(file, line, what) {}
28};
29
30
31// Forward declarations
32class CalloutManager;
33class LibraryManager;
34
69
71public:
78
83 static_cast<void>(unloadLibraries());
84 }
85
98 bool loadLibraries(bool multi_threading_enabled = false);
99
114 bool loadLibraries(bool multi_threading_enabled, std::string& info);
115
126 boost::shared_ptr<CalloutManager> getCalloutManager() const;
127
133 std::vector<std::string> getLibraryNames() const {
134 return (library_names_);
135 }
136
142 return (library_info_);
143 }
144
151 int getLoadedLibraryCount() const;
152
165 static std::vector<std::string> validateLibraries(const std::vector<std::string>& libraries,
166 bool multi_threading_enabled = false);
167
180
181protected:
186 void unloadLibraries();
187
188private:
189
191 std::vector<std::string> library_names_;
192
194 std::vector<boost::shared_ptr<LibraryManager> > lib_managers_;
195
198 HookLibsCollection library_info_;
199
201 boost::shared_ptr<CalloutManager> callout_manager_;
202};
203
204} // namespace hooks
205} // namespace isc
206
207
208#endif // LIBRARY_MANAGER_COLLECTION_H
Exception(const char *file, size_t line, const char *what)
Constructor for a given type for exceptions with file name and file line number.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
std::vector< std::string > getLibraryNames() const
Get library names.
HookLibsCollection getLibraryInfo() const
Returns library info.
LibraryManagerCollection(const HookLibsCollection &libraries)
Constructor.
boost::shared_ptr< CalloutManager > getCalloutManager() const
Get callout manager.
bool prepareUnloadLibraries()
Prepare libaries unloading.
int getLoadedLibraryCount() const
Get number of loaded libraries.
static std::vector< std::string > validateLibraries(const std::vector< std::string > &libraries, bool multi_threading_enabled=false)
Validate libraries.
bool loadLibraries(bool multi_threading_enabled=false)
Load libraries.
LoadLibrariesNotCalled(const char *file, size_t line, const char *what)
std::vector< HookLibInfo > HookLibsCollection
A storage for information about hook libraries.
Definition libinfo.h:51
Defines the logger used by the top-level component of kea-lfc.