Kea 2.7.5
|
Wrapper class that holds hooks libraries configuration. More...
#include <hooks_config.h>
Public Member Functions | |
HooksConfig () | |
Default constructor. | |
void | add (std::string libname, isc::data::ConstElementPtr parameters) |
Adds additional hooks libraries. | |
void | clear () |
Removes all configured hooks libraries. | |
bool | equal (const HooksConfig &other) const |
Compares two Hooks Config classes for equality. | |
const isc::hooks::HookLibsCollection & | get () const |
Provides access to the configured hooks libraries. | |
void | loadLibraries (bool multi_threading_enabled) const |
Commits hooks libraries configuration. | |
isc::data::ElementPtr | toElement () const |
Unparse a configuration object. | |
void | verifyLibraries (const isc::data::Element::Position &position, bool multi_threading_enabled) const |
Verifies that libraries stored in libraries_ are valid. | |
Public Member Functions inherited from isc::data::CfgToElement | |
virtual | ~CfgToElement () |
Destructor. | |
Wrapper class that holds hooks libraries configuration.
This was moved from HooksLibrariesParser
However, this class does more than just check the list of library names. It does two other things:
and it provides a toElement() method to unparse a configuration.
Definition at line 36 of file hooks_config.h.
|
inline |
Default constructor.
Definition at line 40 of file hooks_config.h.
|
inline |
Adds additional hooks libraries.
libname | full filename with path to the library. |
parameters | map of parameters that configure the library. |
Definition at line 46 of file hooks_config.h.
|
inline |
Removes all configured hooks libraries.
Definition at line 59 of file hooks_config.h.
bool isc::hooks::HooksConfig::equal | ( | const HooksConfig & | other | ) | const |
Compares two Hooks Config classes for equality.
other | other hooksconfig to compare with |
We don't have any libraries that are interacting (or would change their behavior depending on the order in which their callouts are executed), so the code is ok for now.
Definition at line 66 of file hooks_config.cc.
References isc::data::isNull().
Referenced by isc::dhcp::SrvConfig::equals().
|
inline |
Provides access to the configured hooks libraries.
Definition at line 54 of file hooks_config.h.
Referenced by isc::dhcp::SrvConfig::copy(), isc::dhcp::SrvConfig::equals(), isc::agent::AgentSimpleParser::parse(), isc::d2::D2SimpleParser::parse(), and isc::netconf::NetconfSimpleParser::parse().
void isc::hooks::HooksConfig::loadLibraries | ( | bool | multi_threading_enabled | ) | const |
Commits hooks libraries configuration.
This method calls necessary methods in HooksManager that will unload any libraries that may be currently loaded and will load the actual libraries. Providing that the specified libraries are valid and are different to those already loaded, this method loads the new set of libraries (and unloads the existing set).
multi_threading_enabled | The flag which indicates if MT is enabled (used to check hook libraries compatibility with MT). |
InvalidHooksLibraries | if the call to HooksManager fails. |
Commits the list of libraries to the configuration manager storage if the list of libraries has changed.
Definition at line 54 of file hooks_config.cc.
References isc_throw, and isc::hooks::HooksManager::loadLibraries().
|
virtual |
Unparse a configuration object.
Returns an element which must parse into the same object, i.e.
Implements isc::data::CfgToElement.
Definition at line 103 of file hooks_config.cc.
References isc::data::Element::create(), isc::data::Element::createList(), isc::data::Element::createMap(), and isc::data::isNull().
Referenced by isc::agent::CtrlAgentCfgContext::toElement(), isc::d2::D2CfgContext::toElement(), isc::dhcp::SrvConfig::toElement(), and isc::netconf::NetconfConfig::toElement().
void isc::hooks::HooksConfig::verifyLibraries | ( | const isc::data::Element::Position & | position, |
bool | multi_threading_enabled ) const |
Verifies that libraries stored in libraries_ are valid.
This method is a smart wrapper around isc::hooks::HooksManager::validateLibraries(). It tries to validate all the libraries stored in libraries_.
position | position of the hooks-library map for error reporting |
multi_threading_enabled | The flag which indicates if MT is enabled (used to check hook libraries compatibility with MT). |
InvalidHooksLibraries | if any issue is discovered. |
Definition at line 20 of file hooks_config.cc.
References isc::hooks::extractNames(), isc::hooks::HooksManager::getLibraryNames(), isc_throw, and isc::hooks::HooksManager::validateLibraries().
Referenced by isc::dhcp::processDhcp4Config(), and isc::dhcp::processDhcp6Config().