Kea 2.7.6
ha_impl.h
Go to the documentation of this file.
1// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#ifndef HA_IMPL_H
8#define HA_IMPL_H
9
10#include <ha_config.h>
11#include <ha_service.h>
12#include <asiolink/io_service.h>
13#include <cc/data.h>
15#include <hooks/hooks.h>
16#include <boost/noncopyable.hpp>
17#include <boost/shared_ptr.hpp>
18
19
20namespace isc {
21namespace ha {
22
31class HAImpl : public boost::noncopyable {
32public:
33
35 HAImpl();
36
41 void configure(const data::ConstElementPtr& input_config);
42
52 void startServices(const dhcp::NetworkStatePtr& network_state,
53 const HAServerType& server_type);
54
56 ~HAImpl();
57
69 return (config_->get());
70 }
71
77 HAConfigPtr getConfig(const std::string& partner_name) const {
78 return (config_->get(partner_name));
79 }
80
100 void buffer4Receive(hooks::CalloutHandle& callout_handle);
101
109 void subnet4Select(hooks::CalloutHandle& callout_handle);
110
114 void leases4Committed(hooks::CalloutHandle& callout_handle);
115
119 void lease4ServerDecline(hooks::CalloutHandle& callout_handle);
120
140 void buffer6Receive(hooks::CalloutHandle& callout_handle);
141
142
150 void subnet6Select(hooks::CalloutHandle& callout_handle);
151
155 void leases6Committed(hooks::CalloutHandle& callout_handle);
156
163 void commandProcessed(hooks::CalloutHandle& callout_handle);
164
168 void heartbeatHandler(hooks::CalloutHandle& callout_handle);
169
173 void synchronizeHandler(hooks::CalloutHandle& callout_handle);
174
178 void scopesHandler(hooks::CalloutHandle& callout_handle);
179
183 void continueHandler(hooks::CalloutHandle& callout_handle);
184
189
193 void maintenanceStartHandler(hooks::CalloutHandle& callout_handle);
194
199
203 void haResetHandler(hooks::CalloutHandle& callout_handle);
204
209
221 HAServicePtr getHAServiceByServerName(const std::string& command_name,
222 data::ConstElementPtr args) const;
223
230
235 io_service_ = io_service;
236 }
237
238protected:
239
242
245
248};
249
251typedef boost::shared_ptr<HAImpl> HAImplPtr;
252
253} // end of namespace isc::ha
254} // end of namespace isc
255
256#endif
High Availability hooks library implementation.
Definition ha_impl.h:31
void setIOService(isc::asiolink::IOServicePtr io_service)
Set the hook I/O service.
Definition ha_impl.h:234
void scopesHandler(hooks::CalloutHandle &callout_handle)
Implements handler for the ha-scopes command.
Definition ha_impl.cc:688
void continueHandler(hooks::CalloutHandle &callout_handle)
Implements handler for the ha-continue command.
Definition ha_impl.cc:747
HAConfigPtr getConfig(const std::string &partner_name) const
Returns parsed configuration by partner name.
Definition ha_impl.h:77
HAConfigMapperPtr config_
Holds parsed configuration.
Definition ha_impl.h:244
void syncCompleteNotifyHandler(hooks::CalloutHandle &callout_handle)
Implements handler for the ha-sync-complete-notify command.
Definition ha_impl.cc:861
HAServicePtr getHAServiceByServerName(const std::string &command_name, data::ConstElementPtr args) const
Attempts to get an HAService by server name.
Definition ha_impl.cc:907
HAServiceMapperPtr services_
Pointer to the high availability services (state machines).
Definition ha_impl.h:247
void startServices(const dhcp::NetworkStatePtr &network_state, const HAServerType &server_type)
Creates high availability services using current configuration.
Definition ha_impl.cc:43
void subnet4Select(hooks::CalloutHandle &callout_handle)
Implementation of the "subnet4_select" callout.
Definition ha_impl.cc:132
void configure(const data::ConstElementPtr &input_config)
Parses configuration.
Definition ha_impl.cc:38
~HAImpl()
Destructor.
Definition ha_impl.cc:63
void maintenanceCancelHandler(hooks::CalloutHandle &callout_handle)
Implements handler for the ha-maintenance-cancel command.
Definition ha_impl.cc:826
void haResetHandler(hooks::CalloutHandle &callout_handle)
Implements handler for the ha-reset command.
Definition ha_impl.cc:835
void maintenanceNotifyHandler(hooks::CalloutHandle &callout_handle)
Implements handler for the ha-maintenance-notify command.
Definition ha_impl.cc:772
void synchronizeHandler(hooks::CalloutHandle &callout_handle)
Implements handler for the ha-sync command.
Definition ha_impl.cc:623
void maintenanceStartHandler(hooks::CalloutHandle &callout_handle)
Implements handler for the ha-maintenance-start command.
Definition ha_impl.cc:812
isc::asiolink::IOServicePtr getIOService()
Get the hook I/O service.
Definition ha_impl.h:227
isc::asiolink::IOServicePtr io_service_
The hook I/O service.
Definition ha_impl.h:241
void leases4Committed(hooks::CalloutHandle &callout_handle)
Implementation of the "leases4_committed" callout.
Definition ha_impl.cc:216
HAConfigPtr getConfig() const
Returns a configuration for the first relationship.
Definition ha_impl.h:68
void buffer4Receive(hooks::CalloutHandle &callout_handle)
Implementation of the "buffer4_receive" callout.
Definition ha_impl.cc:75
void buffer6Receive(hooks::CalloutHandle &callout_handle)
Implementation of the "buffer6_receive" callout.
Definition ha_impl.cc:339
void commandProcessed(hooks::CalloutHandle &callout_handle)
Implementation of the "command_processed" callout.
Definition ha_impl.cc:563
HAImpl()
Constructor.
Definition ha_impl.cc:33
void leases6Committed(hooks::CalloutHandle &callout_handle)
Implementation of the "leases6_committed" callout.
Definition ha_impl.cc:480
void subnet6Select(hooks::CalloutHandle &callout_handle)
Implementation of the "subnet6_select" callout.
Definition ha_impl.cc:396
void lease4ServerDecline(hooks::CalloutHandle &callout_handle)
Implementation of the "lease4_server_decline" callout.
Definition ha_impl.cc:306
void heartbeatHandler(hooks::CalloutHandle &callout_handle)
Implements handle for the heartbeat command.
Definition ha_impl.cc:596
Per-packet callout handle.
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:29
boost::shared_ptr< NetworkState > NetworkStatePtr
Pointer to the NetworkState object.
boost::shared_ptr< HAImpl > HAImplPtr
Pointer to the High Availability hooks library implementation.
Definition ha_impl.h:251
boost::shared_ptr< HAConfigMapper > HAConfigMapperPtr
Pointer to an object mapping HAConfig to relationships.
Definition ha_config.h:43
boost::shared_ptr< HAServiceMapper > HAServiceMapperPtr
Pointer to an object mapping HAService to relationships.
Definition ha_service.h:45
boost::shared_ptr< HAConfig > HAConfigPtr
Pointer to the High Availability configuration structure.
Definition ha_config.h:37
HAServerType
Lists possible server types for which HA service is created.
boost::shared_ptr< HAService > HAServicePtr
Pointer to the HAService class.
Defines the logger used by the top-level component of kea-lfc.