22 const std::string& cfgname ) {
24 libraries_.push_back(info);
29 bool multi_threading_enabled)
const {
39 if (current_libraries.empty() && libraries_.empty()) {
46 multi_threading_enabled);
47 if (!error_libs.empty()) {
50 string error_list = error_libs[0];
51 for (
size_t i = 1; i < error_libs.size(); ++i) {
52 error_list += (string(
", ") + error_libs[i]);
55 "hooks libraries failed to validate - "
56 "library or libraries in error are: "
57 << error_list <<
" (" << position <<
")");
69 "One or more hook libraries failed to load");
84 for (
auto const& this_it : libraries_) {
86 for (
auto const& other_it : other.libraries_) {
87 if (this_it == other_it) {
107 for (
auto const& hl : libraries_) {
113 if (!
isNull(hl.parameters_)) {
114 map->set(
"parameters", hl.parameters_);
static ElementPtr create(const Position &pos=ZERO_POSITION())
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
bool equal(const HooksConfig &other) const
Compares two Hooks Config classes for equality.
void add(const std::string &libname, isc::data::ConstElementPtr parameters, const std::string &cfgname="")
Adds additional hooks libraries.
void verifyLibraries(const isc::data::Element::Position &position, bool multi_threading_enabled) const
Verifies that libraries stored in libraries_ are valid.
isc::data::ElementPtr toElement() const
Unparse a configuration object.
HooksConfig()
Default constructor.
void loadLibraries(bool multi_threading_enabled) const
Commits hooks libraries configuration.
static std::vector< std::string > getLibraryNames()
Return list of loaded libraries.
static std::vector< std::string > validateLibraries(const std::vector< std::string > &libraries, bool multi_threading_enabled=false)
Validate library list.
static bool loadLibraries(const HookLibsCollection &libraries, bool multi_threading_enabled=false)
Load and reload libraries.
Exception thrown when a library failed to validate.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< const Element > ConstElementPtr
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.
Entity that holds information about hook libraries and their parameters.