54 const string error(
"Error: io_context is null");
62 }
catch (
const std::exception& ex) {
67 os <<
"Error: " << ex.what();
68 string error(os.str());
80 if (status == CalloutHandle::NEXT_STEP_DROP) {
85 impl->buffer4Receive(handle);
87 }
catch (
const std::exception& ex) {
101 if (status == CalloutHandle::NEXT_STEP_DROP ||
102 status == CalloutHandle::NEXT_STEP_SKIP) {
107 impl->leases4Committed(handle);
109 }
catch (
const std::exception& ex) {
128 const string error(
"Error: io_context is null");
133 handle.
getArgument(
"network_state", network_state);
136 }
catch (
const std::exception& ex) {
141 os <<
"Error: " << ex.what();
142 string error(os.str());
154 if (status == CalloutHandle::NEXT_STEP_DROP ||
155 status == CalloutHandle::NEXT_STEP_SKIP) {
160 impl->buffer6Receive(handle);
162 }
catch (
const std::exception& ex) {
176 if (status == CalloutHandle::NEXT_STEP_DROP ||
177 status == CalloutHandle::NEXT_STEP_SKIP) {
182 impl->leases6Committed(handle);
184 }
catch (
const std::exception& ex) {
198 impl->commandProcessed(handle);
200 }
catch (
const std::exception& ex) {
212 impl->heartbeatHandler(handle);
214 }
catch (
const std::exception& ex) {
226 impl->synchronizeHandler(handle);
228 }
catch (
const std::exception& ex) {
239 impl->scopesHandler(handle);
241 }
catch (
const std::exception& ex) {
252 impl->continueHandler(handle);
254 }
catch (
const std::exception& ex) {
265 impl->maintenanceNotifyHandler(handle);
267 }
catch (
const std::exception& ex) {
278 impl->maintenanceStartHandler(handle);
280 }
catch (
const std::exception& ex) {
291 impl->maintenanceCancelHandler(handle);
293 }
catch (
const std::exception& ex) {
304 impl->haResetHandler(handle);
306 }
catch (
const std::exception& ex) {
317 impl->syncCompleteNotifyHandler(handle);
318 }
catch (
const std::exception& ex) {
339 uint16_t family = CfgMgr::instance().getFamily();
340 const std::string& proc_name = Daemon::getProcName();
341 if (family == AF_INET) {
342 if (proc_name !=
"kea-dhcp4") {
344 <<
", expected kea-dhcp4");
347 if (proc_name !=
"kea-dhcp6") {
349 <<
", expected kea-dhcp6");
353 impl = boost::make_shared<HAImpl>();
354 impl->configure(config);
366 }
catch (
const std::exception& ex) {
A generic exception that is thrown when an unexpected error condition occurs.
Per-packet callout handle.
CalloutNextStep
Specifies allowed next steps.
@ NEXT_STEP_DROP
drop the packet
CalloutNextStep getStatus() const
Returns the next processing step.
void setStatus(const CalloutNextStep next)
Sets the next processing step.
void getArgument(const std::string &name, T &value) const
Get argument.
void setArgument(const std::string &name, T value)
Set argument.
isc::data::ConstElementPtr getParameter(const std::string &name)
Returns configuration parameter for the library.
void registerCommandCallout(const std::string &command_name, CalloutPtr callout)
Register control command handler.
This file contains several functions and constants that are used for handling commands and responses ...
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
int maintenance_cancel_command(CalloutHandle &handle)
ha-maintenance-cancel command handler implementation.
int dhcp4_srv_configured(CalloutHandle &handle)
dhcp4_srv_configured callout implementation.
int leases6_committed(CalloutHandle &handle)
leases6_committed callout implementation.
int sync_complete_notify_command(CalloutHandle &handle)
ha-sync-complete-notify command handler implementation.
int scopes_command(CalloutHandle &handle)
ha-scopes command handler implementation.
int heartbeat_command(CalloutHandle &handle)
Heartbeat command handler implementation.
int command_processed(CalloutHandle &handle)
command_processed callout implementation.
int leases4_committed(CalloutHandle &handle)
leases4_committed callout implementation.
int multi_threading_compatible()
This function is called to retrieve the multi-threading compatibility.
int maintenance_notify_command(CalloutHandle &handle)
ha-maintenance-notify command handler implementation.
int unload()
This function is called when the library is unloaded.
int dhcp6_srv_configured(CalloutHandle &handle)
dhcp6_srv_configured callout implementation.
int buffer4_receive(CalloutHandle &handle)
buffer4_receive callout implementation.
int continue_command(CalloutHandle &handle)
ha-continue command handler implementation.
int ha_reset_command(CalloutHandle &handle)
ha-reset command handler implementation.
int maintenance_start_command(CalloutHandle &handle)
ha-maintenance-start command handler implementation.
int buffer6_receive(CalloutHandle &handle)
buffer6_receive callout implementation.
int sync_command(CalloutHandle &handle)
ha-sync command handler implementation.
int load(LibraryHandle &handle)
This function is called when the library is loaded.
#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.
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
const int CONTROL_RESULT_ERROR
Status code indicating a general failure.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< NetworkState > NetworkStatePtr
Pointer to the NetworkState object.
const isc::log::MessageID HA_BUFFER4_RECEIVE_FAILED
boost::shared_ptr< HAImpl > HAImplPtr
Pointer to the High Availability hooks library implementation.
const isc::log::MessageID HA_DEINIT_OK
const isc::log::MessageID HA_COMMAND_PROCESSED_FAILED
const isc::log::MessageID HA_LEASES4_COMMITTED_FAILED
const isc::log::MessageID HA_CONTINUE_HANDLER_FAILED
const isc::log::MessageID HA_MAINTENANCE_CANCEL_HANDLER_FAILED
const isc::log::MessageID HA_HEARTBEAT_HANDLER_FAILED
isc::log::Logger ha_logger("ha-hooks")
const isc::log::MessageID HA_RESET_HANDLER_FAILED
const isc::log::MessageID HA_DHCP6_START_SERVICE_FAILED
const isc::log::MessageID HA_MAINTENANCE_START_HANDLER_FAILED
const isc::log::MessageID HA_BUFFER6_RECEIVE_FAILED
const isc::log::MessageID HA_SYNC_COMPLETE_NOTIFY_HANDLER_FAILED
const isc::log::MessageID HA_INIT_OK
const isc::log::MessageID HA_MISSING_CONFIGURATION
const isc::log::MessageID HA_LEASES6_COMMITTED_FAILED
const isc::log::MessageID HA_DHCP4_START_SERVICE_FAILED
const isc::log::MessageID HA_CONFIGURATION_FAILED
const isc::log::MessageID HA_MAINTENANCE_NOTIFY_HANDLER_FAILED
const isc::log::MessageID HA_SYNC_HANDLER_FAILED
const isc::log::MessageID HA_SCOPES_HANDLER_FAILED
Defines the logger used by the top-level component of kea-lfc.