45 service_ = boost::make_shared<HAService>(io_service, network_state,
65 HA_BUFFER4_RECEIVE_PACKET_OPTIONS_SKIPPED)
68 }
catch (
const std::exception& ex) {
71 .arg(query4->getRemoteAddr().toText())
72 .arg(query4->getLocalAddr().toText())
73 .arg(query4->getIface())
78 static_cast<int64_t
>(1));
80 static_cast<int64_t
>(1));
90 .arg(query4->getLabel());
105 if (!
config_->amSendingLeaseUpdates()) {
122 callout_handle.
getArgument(
"deleted_leases4", deleted_leases4);
125 if (leases4->empty() && deleted_leases4->empty()) {
127 .arg(query4->getLabel());
139 if (
service_->asyncSendLeaseUpdates(query4, leases4, deleted_leases4, parking_lot) == 0) {
147 parking_lot->reference(query4);
170 HA_BUFFER6_RECEIVE_PACKET_OPTIONS_SKIPPED)
173 }
catch (
const std::exception& ex) {
176 .arg(query6->getRemoteAddr().toText())
177 .arg(query6->getLocalAddr().toText())
178 .arg(query6->getIface())
183 static_cast<int64_t
>(1));
185 static_cast<int64_t
>(1));
195 .arg(query6->getLabel());
210 if (!
config_->amSendingLeaseUpdates()) {
227 callout_handle.
getArgument(
"deleted_leases6", deleted_leases6);
230 if (leases6->empty() && deleted_leases6->empty()) {
232 .arg(query6->getLabel());
244 if (
service_->asyncSendLeaseUpdates(query6, leases6, deleted_leases6, parking_lot) == 0) {
252 parking_lot->reference(query6);
261 std::string command_name;
263 if (command_name ==
"dhcp-enable") {
285 unsigned int max_period_value = 0;
300 server_name = args->get(
"server-name");
315 (max_period->intValue() <= 0)) {
316 isc_throw(
BadValue,
"'max-period' must be a positive integer in the 'ha-sync' command");
319 max_period_value =
static_cast<unsigned int>(max_period->intValue());
322 }
catch (
const std::exception& ex) {
346 std::vector<std::string> scopes_vector;
372 for (
size_t i = 0; i < scopes->size(); ++i) {
377 scopes_vector.push_back(scope->stringValue());
380 }
catch (
const std::exception& ex) {
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Exception thrown during option unpacking This exception is thrown when an error has occurred,...
Configuration parser for High Availability.
void parse(const HAConfigPtr &config_storage, const data::ConstElementPtr &config)
Parses HA configuration.
Storage for High Availability configuration.
void scopesHandler(hooks::CalloutHandle &callout_handle)
Implements handler for the ha-scopes command.
void continueHandler(hooks::CalloutHandle &callout_handle)
Implements handler for the ha-continue command.
HAServicePtr service_
Pointer to the high availability service (state machine).
void configure(const data::ConstElementPtr &input_config)
Parases configuration.
void synchronizeHandler(hooks::CalloutHandle &callout_handle)
Implements handler for the ha-sync command.
void startService(const asiolink::IOServicePtr &io_service, const dhcp::NetworkStatePtr &network_state, const HAServerType &server_type)
Creates high availability service using current configuration.
void leases4Committed(hooks::CalloutHandle &callout_handle)
Implementation of the "leases4_committed" callout.
void buffer4Receive(hooks::CalloutHandle &callout_handle)
Implementation of the "buffer4_receive" callout.
HAConfigPtr config_
Holds parsed configuration.
void buffer6Receive(hooks::CalloutHandle &callout_handle)
Implementation of the "buffer6_receive" callout.
void commandProcessed(hooks::CalloutHandle &callout_handle)
Implementation of the "command_processed" callout.
void leases6Committed(hooks::CalloutHandle &callout_handle)
Implementation of the "leases6_committed" callout.
void heartbeatHandler(hooks::CalloutHandle &callout_handle)
Implements handle for the heartbeat command.
Per-packet callout handle.
@ NEXT_STEP_PARK
park the packet
@ NEXT_STEP_DROP
drop the packet
@ NEXT_STEP_SKIP
skip the next processing step
ParkingLotHandlePtr getParkingLotHandlePtr() const
Returns pointer to the parking lot handle for this hook point.
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.
static StatsMgr & instance()
Statistics Manager accessor method.
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.
void addValue(const std::string &name, const int64_t value)
Records incremental integer observation.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug 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.
std::string parseCommand(ConstElementPtr &arg, ConstElementPtr command)
ConstElementPtr createAnswer()
Creates a standard config/command level success answer message (i.e.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Lease4Collection > Lease4CollectionPtr
A shared pointer to the collection of IPv4 leases.
boost::shared_ptr< Pkt4 > Pkt4Ptr
A pointer to Pkt4 object.
boost::shared_ptr< NetworkState > NetworkStatePtr
Pointer to the NetworkState object.
boost::shared_ptr< Lease6Collection > Lease6CollectionPtr
A shared pointer to the collection of IPv6 leases.
boost::shared_ptr< Pkt6 > Pkt6Ptr
A pointer to Pkt6 packet.
isc::log::Logger ha_logger("ha-hooks")
HAServerType
Lists possible server types for which HA service is created.
boost::shared_ptr< ParkingLotHandle > ParkingLotHandlePtr
Pointer to the parking lot handle.
const int DBGLVL_TRACE_BASIC
Trace basic operations.
Defines the logger used by the top-level component of kea-dhcp-ddns.