 |
Kea
1.5.0
|
Go to the documentation of this file.
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));
83 callout_handle.
setStatus(CalloutHandle::NEXT_STEP_DROP);
90 .arg(query4->getLabel());
91 callout_handle.
setStatus(CalloutHandle::NEXT_STEP_DROP);
96 callout_handle.
setStatus(CalloutHandle::NEXT_STEP_SKIP);
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);
151 callout_handle.
setStatus(CalloutHandle::NEXT_STEP_PARK);
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));
188 callout_handle.
setStatus(CalloutHandle::NEXT_STEP_DROP);
195 .arg(query6->getLabel());
196 callout_handle.
setStatus(CalloutHandle::NEXT_STEP_DROP);
201 callout_handle.
setStatus(CalloutHandle::NEXT_STEP_SKIP);
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);
256 callout_handle.
setStatus(CalloutHandle::NEXT_STEP_PARK);
261 std::string command_name;
263 if (command_name ==
"dhcp-enable") {
285 unsigned int max_period_value = 0;
294 if (args->getType() != Element::map) {
300 server_name = args->get(
"server-name");
306 if (server_name->getType() != Element::string) {
314 if ((max_period->getType() != Element::integer) ||
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;
355 if (args->getType() != Element::map) {
366 if (scopes->getType() != Element::list) {
372 for (
size_t i = 0; i < scopes->size(); ++i) {
374 if (!scope || scope->getType() != Element::string) {
377 scopes_vector.push_back(scope->stringValue());
380 }
catch (
const std::exception& ex) {
Storage for High Availability configuration.
boost::shared_ptr< NetworkState > NetworkStatePtr
Pointer to the NetworkState object.
void setArgument(const std::string &name, T value)
Set argument.
Per-packet callout handle.
ConstElementPtr createAnswer(const int status_code, const std::string &text, const ConstElementPtr &arg)
void leases4Committed(hooks::CalloutHandle &callout_handle)
Implementation of the "leases4_committed" callout.
const int CONTROL_RESULT_ERROR
Status code indicating a general failure.
HAServicePtr service_
Pointer to the high availability service (state machine).
isc::log::Logger ha_logger("ha-hooks")
void commandProcessed(hooks::CalloutHandle &callout_handle)
Implementation of the "command_processed" callout.
void leases6Committed(hooks::CalloutHandle &callout_handle)
Implementation of the "leases6_committed" callout.
boost::shared_ptr< ParkingLotHandle > ParkingLotHandlePtr
Pointer to the parking lot handle.
Defines the logger used by the top-level component of kea-dhcp-ddns.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
boost::shared_ptr< Pkt4 > Pkt4Ptr
A pointer to Pkt4 object.
void getArgument(const std::string &name, T &value) const
Get argument.
void configure(const data::ConstElementPtr &input_config)
Parases configuration.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
void buffer4Receive(hooks::CalloutHandle &callout_handle)
Implementation of the "buffer4_receive" callout.
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
boost::shared_ptr< Lease6Collection > Lease6CollectionPtr
A shared pointer to the collection of IPv6 leases.
void startService(const asiolink::IOServicePtr &io_service, const dhcp::NetworkStatePtr &network_state, const HAServerType &server_type)
Creates high availability service using current configuration.
void synchronizeHandler(hooks::CalloutHandle &callout_handle)
Implements handler for the ha-sync command.
Exception thrown during option unpacking This exception is thrown when an error has occurred,...
HAServerType
Lists possible server types for which HA service is created.
boost::shared_ptr< Lease4Collection > Lease4CollectionPtr
A shared pointer to the collection of IPv4 leases.
HAConfigPtr config_
Holds parsed configuration.
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
std::string parseCommand(ConstElementPtr &arg, ConstElementPtr command)
const int DBGLVL_TRACE_BASIC
Trace basic operations.
void parse(const HAConfigPtr &config_storage, const data::ConstElementPtr &config)
Parses HA configuration.
Configuration parser for High Availability.
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 continueHandler(hooks::CalloutHandle &callout_handle)
Implements handler for the ha-continue command.
boost::shared_ptr< const Element > ConstElementPtr
static StatsMgr & instance()
Statistics Manager accessor method.
void addValue(const std::string &name, const int64_t value)
Records incremental integer observation.
void heartbeatHandler(hooks::CalloutHandle &callout_handle)
Implements handle for the heartbeat command.
boost::shared_ptr< Pkt6 > Pkt6Ptr
A pointer to Pkt6 packet.
void scopesHandler(hooks::CalloutHandle &callout_handle)
Implements handler for the ha-scopes command.
void buffer6Receive(hooks::CalloutHandle &callout_handle)
Implementation of the "buffer6_receive" callout.