diff options
Diffstat (limited to 'src/hooks/dhcp/run_script/run_script_callouts.cc')
-rw-r--r-- | src/hooks/dhcp/run_script/run_script_callouts.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/hooks/dhcp/run_script/run_script_callouts.cc b/src/hooks/dhcp/run_script/run_script_callouts.cc index c16c24b4a9..50ca846f8c 100644 --- a/src/hooks/dhcp/run_script/run_script_callouts.cc +++ b/src/hooks/dhcp/run_script/run_script_callouts.cc @@ -25,6 +25,7 @@ RunScriptImplPtr impl; } // namespace isc using namespace isc; +using namespace isc::asiolink; using namespace isc::data; using namespace isc::dhcp; using namespace isc::hooks; @@ -63,6 +64,40 @@ int unload() { return (0); } +/// @brief dhcp4_srv_configured callout implementation. +/// +/// @param handle callout handle. +int dhcp4_srv_configured(CalloutHandle& handle) { + try { + isc::asiolink::IOServicePtr io_service; + handle.getArgument("io_context", io_service); + RunScriptImpl::setIOService(io_service); + + } catch (const std::exception& ex) { + LOG_ERROR(run_script_logger, RUN_SCRIPT_LOAD_ERROR) + .arg(ex.what()); + return (1); + } + return (0); +} + +/// @brief dhcp6_srv_configured callout implementation. +/// +/// @param handle callout handle. +int dhcp6_srv_configured(CalloutHandle& handle) { + try { + isc::asiolink::IOServicePtr io_service; + handle.getArgument("io_context", io_service); + RunScriptImpl::setIOService(io_service); + + } catch (const std::exception& ex) { + LOG_ERROR(run_script_logger, RUN_SCRIPT_LOAD_ERROR) + .arg(ex.what()); + return (1); + } + return (0); +} + /// @brief handle @ref lease4_renew hook and set environment parameters for the /// script. /// IN: query4 subnet4 clientid hwaddr lease4 |