21 bool multi_threading_enabled)
const {
33 vector<string> current_libraries = HooksManager::getLibraryNames();
34 if (current_libraries.empty() && libraries_.empty()) {
40 vector<string> error_libs = HooksManager::validateLibraries(lib_names,
41 multi_threading_enabled);
42 if (!error_libs.empty()) {
45 string error_list = error_libs[0];
46 for (
size_t i = 1; i < error_libs.size(); ++i) {
47 error_list += (string(
", ") + error_libs[i]);
50 "hooks libraries failed to validate - "
51 "library or libraries in error are: "
52 << error_list <<
" (" << position <<
")");
57 HooksConfig::loadLibraries(
bool multi_threading_enabled)
const {
62 if (!HooksManager::loadLibraries(libraries_, multi_threading_enabled)) {
64 "One or more hook libraries failed to load");
79 for (isc::hooks::HookLibsCollection::const_iterator this_it = libraries_.begin();
80 this_it != libraries_.end(); ++this_it) {
82 for (isc::hooks::HookLibsCollection::const_iterator other_it =
83 other.libraries_.begin(); other_it != other.libraries_.end(); ++other_it) {
84 if (this_it->first != other_it->first) {
87 if (
isNull(this_it->second) &&
isNull(other_it->second)) {
91 if (
isNull(this_it->second) ||
isNull(other_it->second)) {
94 if (this_it->second->equals(*other_it->second)) {
108 HooksConfig::toElement()
const {
112 for (HookLibsCollection::const_iterator hl = libraries_.begin();
113 hl != libraries_.end(); ++hl) {
117 map->set(
"library", Element::create(hl->first));
119 if (!
isNull(hl->second)) {
120 map->set(
"parameters", hl->second);
Wrapper class that holds hooks libraries configuration.
Exception thrown when a library failed to validate.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
bool isNull(ConstElementPtr p)
Checks whether the given ElementPtr is a NULL pointer.
boost::shared_ptr< Element > ElementPtr
std::vector< std::string > extractNames(const isc::hooks::HookLibsCollection &libraries)
Extracts names from HookLibsCollection.
Defines the logger used by the top-level component of kea-lfc.
Represents the position of the data element within a configuration string.