34                               const boost::shared_ptr<CalloutManager>& manager)
 
   35        : dl_handle_(NULL), index_(index), manager_(manager),
 
   41                  "instantiating a LibraryManager object");
 
 
   53        : dl_handle_(NULL), index_(-1), manager_(), library_name_(name)
 
   76    dl_handle_ = dlopen(library_name_.c_str(), RTLD_NOW | RTLD_LOCAL);
 
   77    if (dl_handle_ == NULL) {
 
   82    return (dl_handle_ != NULL);
 
 
   92    if (dl_handle_ != NULL) {
 
   93        status = dlclose(dl_handle_);
 
  103    return (status == 0);
 
 
  114        int version = KEA_HOOKS_VERSION - 1; 
 
  122        if (
version == KEA_HOOKS_VERSION) {
 
  125                      .arg(library_name_).arg(
version);
 
  130                      .arg(
version).arg(KEA_HOOKS_VERSION);
 
 
  145    if (!multi_threading_enabled) {
 
  150    PointerConverter pc(dlsym(dl_handle_, MULTI_THREADING_COMPATIBLE_FUNCTION_NAME));
 
  166    if (compatible == 0) {
 
  170    return (compatible != 0);
 
 
  179    manager_->setLibraryIndex(index_);
 
  183    for (
size_t i = 0; i < hook_names.size(); ++i) {
 
  186        void* dlsym_ptr = dlsym(dl_handle_, hook_names[i].c_str());
 
  190            manager_->getLibraryHandle().registerCallout(hook_names[i],
 
  194                      .arg(hook_names[i]).arg(dlsym_ptr);
 
 
  214        int old_index = manager_->getLibraryHandle().getLibraryIndex();
 
  216            manager_->setLibraryIndex(index_);
 
  217            manager_->getLibraryHandle().setLibraryIndex(index_);
 
  218            status = (*pc.
loadPtr())(manager_->getLibraryHandle());
 
  221                .arg(library_name_).arg(ex.
what());
 
  222            manager_->getLibraryHandle().setLibraryIndex(old_index);
 
  226            manager_->getLibraryHandle().setLibraryIndex(old_index);
 
  230        manager_->getLibraryHandle().setLibraryIndex(old_index);
 
 
  256    if (dl_handle_ == NULL) {
 
  279                .arg(library_name_).arg(ex.
what());
 
  305    manager_->setLibraryIndex(index_);
 
  306    for (
size_t i = 0; i < 
hooks.size(); ++i) {
 
  307        bool removed = manager_->deregisterAllCallouts(
hooks[i], index_);
 
  310                .arg(
hooks[i]).arg(library_name_);
 
 
  387    if (dl_handle_ != NULL) {
 
 
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
LibraryManager(const std::string &name, int index, const boost::shared_ptr< CalloutManager > &manager)
Constructor.
bool unloadLibrary()
Unloads a library.
static bool validateLibrary(const std::string &name, bool multi_threading_enabled=false)
Validate library.
bool openLibrary()
Open library.
bool closeLibrary()
Close library.
~LibraryManager()
Destructor.
bool checkMultiThreadingCompatible(bool multi_threading_enabled) const
Check multi-threading compatibility.
bool checkVersion() const
Check library version.
void registerStandardCallouts()
Register standard callouts.
bool runLoad()
Run the load function if present.
bool prepareUnloadLibrary()
Prepares library unloading.
bool loadLibrary(bool multi_threading_enabled=false)
Loads a library.
Local class for conversion of void pointers to function pointers.
multi_threading_compatible_function_ptr multiThreadingCompatiblePtr() const
Return pointer to multi_threading_compatible function.
unload_function_ptr unloadPtr() const
Return pointer to unload function.
version_function_ptr versionPtr() const
Return pointer to version function.
CalloutPtr calloutPtr() const
Return pointer to callout function.
load_function_ptr loadPtr() const
Return pointer to load function.
static ServerHooks & getServerHooks()
Return ServerHooks object.
std::vector< std::string > getHookNames() const
Get hook names.
static void logDuplicatedMessages()
List duplicated log messages.
static void loadDictionary(bool ignore_duplicates=false)
Run-Time Initialization.
int version()
returns Kea hooks version.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
Logging initialization functions.
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
#define LOG_INFO(LOGGER, MESSAGE)
Macro to conveniently test info output and log it.
#define LOG_WARN(LOGGER, MESSAGE)
Macro to conveniently test warn output and log it.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
void hooksStaticLinkInit()
User-Library Initialization for Statically-Linked Kea.
const isc::log::MessageID HOOKS_LIBRARY_UNLOADED
const isc::log::MessageID HOOKS_LIBRARY_MULTI_THREADING_COMPATIBLE
const isc::log::MessageID HOOKS_LIBRARY_MULTI_THREADING_NOT_COMPATIBLE
const isc::log::MessageID HOOKS_LOAD_FRAMEWORK_EXCEPTION
const isc::log::MessageID HOOKS_UNLOAD_SUCCESS
const isc::log::MessageID HOOKS_LIBRARY_VERSION
const isc::log::MessageID HOOKS_NO_UNLOAD
const isc::log::MessageID HOOKS_VERSION_EXCEPTION
const isc::log::MessageID HOOKS_STD_CALLOUT_REGISTERED
isc::log::Logger hooks_logger("hooks")
Hooks Logger.
const isc::log::MessageID HOOKS_LIBRARY_UNLOADING
const isc::log::MessageID HOOKS_LIBRARY_LOADED
const isc::log::MessageID HOOKS_INCORRECT_VERSION
const isc::log::MessageID HOOKS_LIBRARY_LOADING
const isc::log::MessageID HOOKS_UNLOAD_EXCEPTION
const int HOOKS_DBG_CALLS
const isc::log::MessageID HOOKS_LOAD_ERROR
const int HOOKS_DBG_TRACE
Hooks debug Logging levels.
const isc::log::MessageID HOOKS_LIBRARY_CLOSED
const isc::log::MessageID HOOKS_LOAD_EXCEPTION
const isc::log::MessageID HOOKS_OPEN_ERROR
const isc::log::MessageID HOOKS_UNLOAD_FRAMEWORK_EXCEPTION
const isc::log::MessageID HOOKS_UNLOAD_ERROR
const isc::log::MessageID HOOKS_LOAD_SUCCESS
const isc::log::MessageID HOOKS_CLOSE_ERROR
const isc::log::MessageID HOOKS_NO_VERSION
const isc::log::MessageID HOOKS_NO_LOAD
const isc::log::MessageID HOOKS_CALLOUTS_REMOVED
const isc::log::MessageID HOOKS_MULTI_THREADING_COMPATIBLE_EXCEPTION
void initLogger(const string &root, isc::log::Severity severity, int dbglevel, const char *file, bool buffer)
Run-time initialization.
bool isLoggingInitialized()
Is logging initialized?
Defines the logger used by the top-level component of kea-lfc.