#include <hooks/hooks.h>
#include <process/daemon.h>
+#include <sstream>
+#include <string>
+
namespace isc {
namespace ha {
using namespace isc::ha;
using namespace isc::hooks;
using namespace isc::process;
+using namespace std;
extern "C" {
try {
isc::asiolink::IOServicePtr io_service;
handle.getArgument("io_context", io_service);
+ if (!io_service) {
+ // Should not happen!
+ handle.setStatus(isc::hooks::CalloutHandle::NEXT_STEP_DROP);
+ const string error("Error: io_context is null");
+ handle.setArgument("error", error);
+ return (1);
+ }
isc::dhcp::NetworkStatePtr network_state;
handle.getArgument("network_state", network_state);
impl->startService(io_service, network_state, HAServerType::DHCPv4);
LOG_ERROR(ha_logger, HA_DHCP4_START_SERVICE_FAILED)
.arg(ex.what());
handle.setStatus(isc::hooks::CalloutHandle::NEXT_STEP_DROP);
+ ostringstream os;
+ os << "Error: " << ex.what();
+ string error(os.str());
+ handle.setArgument("error", error);
return (1);
}
return (0);
try {
isc::asiolink::IOServicePtr io_service;
handle.getArgument("io_context", io_service);
+ if (!io_service) {
+ // Should not happen!
+ handle.setStatus(isc::hooks::CalloutHandle::NEXT_STEP_DROP);
+ const string error("Error: io_context is null");
+ handle.setArgument("error", error);
+ return (1);
+ }
isc::dhcp::NetworkStatePtr network_state;
handle.getArgument("network_state", network_state);
impl->startService(io_service, network_state, HAServerType::DHCPv6);
LOG_ERROR(ha_logger, HA_DHCP6_START_SERVICE_FAILED)
.arg(ex.what());
handle.setStatus(isc::hooks::CalloutHandle::NEXT_STEP_DROP);
+ ostringstream os;
+ os << "Error: " << ex.what();
+ string error(os.str());
+ handle.setArgument("error", error);
return (1);
}
return (0);
#include <mysql_cb_dhcp6.h>
#include <mysql_cb_log.h>
+#include <sstream>
+#include <string>
+
using namespace isc::cb;
using namespace isc::dhcp;
using namespace isc::hooks;
using namespace isc::log;
using namespace isc::process;
+using namespace std;
extern "C" {
int dhcp4_srv_configured(CalloutHandle& handle) {
isc::asiolink::IOServicePtr io_service;
handle.getArgument("io_context", io_service);
+ if (!io_service) {
+ const string error("Error: io_context is null");
+ handle.setArgument("error", error);
+ handle.setStatus(isc::hooks::CalloutHandle::NEXT_STEP_DROP);
+ return (1);
+ }
isc::dhcp::MySqlConfigBackendImpl::setIOService(io_service);
return (0);
}
int dhcp6_srv_configured(CalloutHandle& handle) {
isc::asiolink::IOServicePtr io_service;
handle.getArgument("io_context", io_service);
+ if (!io_service) {
+ const string error("Error: io_context is null");
+ handle.setArgument("error", error);
+ handle.setStatus(isc::hooks::CalloutHandle::NEXT_STEP_DROP);
+ return (1);
+ }
isc::dhcp::MySqlConfigBackendImpl::setIOService(io_service);
return (0);
}
#include <pgsql_cb_dhcp6.h>
#include <pgsql_cb_log.h>
+#include <sstream>
+#include <string>
+
using namespace isc::cb;
using namespace isc::dhcp;
using namespace isc::hooks;
using namespace isc::log;
using namespace isc::process;
+using namespace std;
extern "C" {
int dhcp4_srv_configured(CalloutHandle& handle) {
isc::asiolink::IOServicePtr io_service;
handle.getArgument("io_context", io_service);
+ if (!io_service) {
+ const string error("Error: io_context is null");
+ handle.setArgument("error", error);
+ handle.setStatus(isc::hooks::CalloutHandle::NEXT_STEP_DROP);
+ return (1);
+ }
isc::dhcp::PgSqlConfigBackendImpl::setIOService(io_service);
return (0);
}
int dhcp6_srv_configured(CalloutHandle& handle) {
isc::asiolink::IOServicePtr io_service;
handle.getArgument("io_context", io_service);
+ if (!io_service) {
+ const string error("Error: io_context is null");
+ handle.setArgument("error", error);
+ handle.setStatus(isc::hooks::CalloutHandle::NEXT_STEP_DROP);
+ return (1);
+ }
isc::dhcp::PgSqlConfigBackendImpl::setIOService(io_service);
return (0);
}
#include <dhcpsrv/subnet.h>
#include <process/daemon.h>
+#include <string>
+
namespace isc {
namespace run_script {
using namespace isc::process;
using namespace isc::run_script;
using namespace isc::util;
+using namespace std;
// Functions accessed by the hooks framework use C linkage to avoid the name
// mangling that accompanies use of the C++ compiler as well as to avoid
try {
// Make the hook library not loadable by d2 or ca.
uint16_t family = CfgMgr::instance().getFamily();
- const std::string& proc_name = Daemon::getProcName();
+ const string& proc_name = Daemon::getProcName();
if (family == AF_INET) {
if (proc_name != "kea-dhcp4") {
isc_throw(isc::Unexpected, "Bad process name: " << proc_name
impl.reset(new RunScriptImpl());
impl->configure(handle);
- } catch (const std::exception& ex) {
+ } catch (const exception& ex) {
LOG_ERROR(run_script_logger, RUN_SCRIPT_LOAD_ERROR)
.arg(ex.what());
return (1);
try {
isc::asiolink::IOServicePtr io_service;
handle.getArgument("io_context", io_service);
+ if (!io_service) {
+ // Should not happen!
+ handle.setStatus(isc::hooks::CalloutHandle::NEXT_STEP_DROP);
+ const string error("Error: io_context is null");
+ handle.setArgument("error", error);
+ return (1);
+ }
RunScriptImpl::setIOService(io_service);
- } catch (const std::exception& ex) {
+ } catch (const exception& ex) {
LOG_ERROR(run_script_logger, RUN_SCRIPT_LOAD_ERROR)
.arg(ex.what());
handle.setStatus(isc::hooks::CalloutHandle::NEXT_STEP_DROP);
try {
isc::asiolink::IOServicePtr io_service;
handle.getArgument("io_context", io_service);
+ if (!io_service) {
+ // Should not happen!
+ handle.setStatus(isc::hooks::CalloutHandle::NEXT_STEP_DROP);
+ const string error("Error: io_context is null");
+ handle.setArgument("error", error);
+ return (1);
+ }
RunScriptImpl::setIOService(io_service);
- } catch (const std::exception& ex) {
+ } catch (const exception& ex) {
LOG_ERROR(run_script_logger, RUN_SCRIPT_LOAD_ERROR)
.arg(ex.what());
handle.setStatus(isc::hooks::CalloutHandle::NEXT_STEP_DROP);