| Kea 3.0.2-git

load_unload.cc File Reference

Defines the load and unload hooks library functions. More...

`#include <config.h>`
`#include <asiolink/io_service.h>`
`#include <asiolink/io_service_mgr.h>`
`#include <cc/data.h>`
`#include <hooks/hooks.h>`
`#include <database/database_connection.h>`
`#include <dhcpsrv/cfgmgr.h>`
`#include <process/daemon.h>`
`#include <legal_log_log.h>`
`#include <legal_syslog.h>`
`#include <dhcpsrv/legal_log_mgr.h>`
`#include <rotating_file.h>`
`#include <boost/lexical_cast.hpp>`
`#include <sstream>`
`#include <string>`
Include dependency graph for forensic_log/load_unload.cc:

Go to the source code of this file.

## Functions
int | load (LibraryHandle &handle)
| Called by the Hooks library manager when the library is loaded.
int | multi_threading_compatible ()
| This function is called to retrieve the multi-threading compatibility.
int | unload ()
| Called by the Hooks library manager when the library is unloaded.

## Detailed Description

Defines the load and unload hooks library functions.

Definition in file forensic_log/load_unload.cc.

## Function Documentation

## ◆ load()

int load | ( | LibraryHandle & | handle | ) |

Called by the Hooks library manager when the library is loaded.

Instantiates the LegalLogMgr and then opens it. If there is no type or type is logfile, use a RotatingFile else use a Database.

Returns
  0 upon success, non-zero if the legal file cannot be opened

Definition at line 49 of file forensic_log/load_unload.cc.

References isc::dhcp::LegalLogMgrFactory::addBackend(), isc::legal_log::LegalSyslog::factory(), isc::legal_log::RotatingFile::factory(), isc::dhcp::CfgMgr::getFamily(), isc::hooks::LibraryHandle::getLibraryIndex(), isc::hooks::LibraryHandle::getParameters(), isc::process::Daemon::getProcName(), isc::dhcp::CfgMgr::instance(), isc_throw, LEGAL_LOG_DB_OPEN_CONNECTION_WITH_RETRY_FAILED, LEGAL_LOG_LOAD_ERROR, isc::legal_log::legal_log_logger, LOG_ERROR, LOG_INFO, isc::dhcp::LegalLogMgr::parseConfig(), isc::db::DatabaseConnection::redactedAccessString(), isc::dhcp::LegalLogMgrFactory::registerBackendFactory(), and isc::Exception::what().

Here is the call graph for this function:

## ◆ multi_threading_compatible()

int multi_threading_compatible | ( |  | ) |

This function is called to retrieve the multi-threading compatibility.

Returns
  1 which means compatible with multi-threading.

Definition at line 124 of file forensic_log/load_unload.cc.

## ◆ unload()

int unload | ( |  | ) |

Called by the Hooks library manager when the library is unloaded.

Explicitly destroys the LegalLogMgr instance. Any errors are logged but swallowed.

Returns
  Always 0.

Definition at line 102 of file forensic_log/load_unload.cc.

References isc::dhcp::LegalLogMgrFactory::delAllBackends(), isc::legal_log::legal_log_logger, LEGAL_LOG_UNLOAD_ERROR, LOG_ERROR, and isc::dhcp::LegalLogMgrFactory::unregisterBackendFactory().

Here is the call graph for this function: