Kea  1.5.0
library_manager_collection.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_COLLECTION_H
8 #define LIBRARY_MANAGER_COLLECTION_H
9 
10 #include <exceptions/exceptions.h>
11 
12 #include <boost/shared_ptr.hpp>
13 #include <hooks/libinfo.h>
14 
15 #include <vector>
16 
17 namespace isc {
18 namespace hooks {
19 
25 public:
26  LoadLibrariesNotCalled(const char* file, size_t line, const char* what) :
27  isc::Exception(file, line, what) {}
28 };
29 
30 
31 // Forward declarations
32 class CalloutManager;
33 class LibraryManager;
34 
69 
71 public:
78 
83  static_cast<void>(unloadLibraries());
84  }
85 
95  bool loadLibraries();
96 
107  boost::shared_ptr<CalloutManager> getCalloutManager() const;
108 
114  std::vector<std::string> getLibraryNames() const {
115  return (library_names_);
116  }
117 
123  return (library_info_);
124  }
125 
132  int getLoadedLibraryCount() const;
133 
144  static std::vector<std::string>
145  validateLibraries(const std::vector<std::string>& libraries);
146 
147 protected:
152  void unloadLibraries();
153 
154 private:
155 
157  std::vector<std::string> library_names_;
158 
160  std::vector<boost::shared_ptr<LibraryManager> > lib_managers_;
161 
164  HookLibsCollection library_info_;
165 
167  boost::shared_ptr<CalloutManager> callout_manager_;
168 };
169 
170 } // namespace hooks
171 } // namespace isc
172 
173 
174 #endif // LIBRARY_MANAGER_COLLECTION_H
isc::hooks::LibraryManagerCollection::loadLibraries
bool loadLibraries()
Load libraries.
Definition: library_manager_collection.cc:53
isc::hooks::LibraryManagerCollection::~LibraryManagerCollection
~LibraryManagerCollection()
Destructor.
Definition: library_manager_collection.h:82
libinfo.h
isc::hooks::LibraryManagerCollection::LibraryManagerCollection
LibraryManagerCollection(const HookLibsCollection &libraries)
Constructor.
Definition: library_manager_collection.cc:40
isc::Exception
This is a base class for exceptions thrown from the DNS library module.
Definition: exceptions/exceptions.h:23
isc
Defines the logger used by the top-level component of kea-dhcp-ddns.
Definition: agent_parser.cc:144
isc::Exception::what
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Definition: exceptions/exceptions.cc:32
isc::hooks::LibraryManagerCollection::getLibraryNames
std::vector< std::string > getLibraryNames() const
Get library names.
Definition: library_manager_collection.h:114
isc::hooks::LoadLibrariesNotCalled
LoadLibraries not called.
Definition: library_manager_collection.h:24
isc::hooks::LibraryManagerCollection
Library manager collection.
Definition: library_manager_collection.h:70
isc::hooks::LoadLibrariesNotCalled::LoadLibrariesNotCalled
LoadLibrariesNotCalled(const char *file, size_t line, const char *what)
Definition: library_manager_collection.h:26
isc::hooks::LibraryManagerCollection::getLoadedLibraryCount
int getLoadedLibraryCount() const
Get number of loaded libraries.
Definition: library_manager_collection.cc:131
isc::hooks::LibraryManagerCollection::validateLibraries
static std::vector< std::string > validateLibraries(const std::vector< std::string > &libraries)
Validate libraries.
Definition: library_manager_collection.cc:137
isc::hooks::LibraryManagerCollection::getLibraryInfo
HookLibsCollection getLibraryInfo() const
Returns library info.
Definition: library_manager_collection.h:122
exceptions.h
isc::hooks::HookLibsCollection
std::vector< HookLibInfo > HookLibsCollection
A storage for information about hook libraries.
Definition: libinfo.h:31
isc::hooks::LibraryManagerCollection::unloadLibraries
void unloadLibraries()
Unload libraries.
Definition: library_manager_collection.cc:115
isc::hooks::LibraryManagerCollection::getCalloutManager
boost::shared_ptr< CalloutManager > getCalloutManager() const
Get callout manager.
Definition: library_manager_collection.cc:29