Kea: ha_service.h Source File

| Kea 2.2.0

ha_service.h
Go to the documentation of this file.
1// Copyright (C) 2018-2021 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_SERVICE_H
8#define HA_SERVICE_H
9
10#include <communication_state.h>
11#include <ha_config.h>
12#include <ha_server_type.h>
13#include <lease_update_backlog.h>
14#include <query_filter.h>
15#include <asiolink/asio_wrapper.h>
16#include <asiolink/io_service.h>
17#include <asiolink/tls_socket.h>
18#include <cc/data.h>
19#include <config/cmd_http_listener.h>
20#include <dhcp/pkt4.h>
21#include <http/response.h>
22#include <dhcpsrv/lease.h>
23#include <dhcpsrv/network_state.h>
24#include <hooks/parking_lots.h>
25#include <http/client.h>
26#include <util/state_model.h>
27
28#include <boost/noncopyable.hpp>
29#include <boost/shared_ptr.hpp>
30#include <functional>
31#include <map>
32#include <mutex>
33#include <vector>
34
35namespace isc {
36namespace ha {
37
43 class HAService : public boost::noncopyable, public util::StateModel {
44public:
45
47 static const int HA_HEARTBEAT_COMPLETE_EVT = SM_DERIVED_EVENT_MIN + 1;
48
50 static const int HA_LEASE_UPDATES_COMPLETE_EVT = SM_DERIVED_EVENT_MIN + 2;
51
53 static const int HA_SYNCING_FAILED_EVT = SM_DERIVED_EVENT_MIN + 3;
54
56 static const int HA_SYNCING_SUCCEEDED_EVT = SM_DERIVED_EVENT_MIN + 4;
57
59 static const int HA_MAINTENANCE_NOTIFY_EVT = SM_DERIVED_EVENT_MIN + 5;
60
62 static const int HA_MAINTENANCE_START_EVT = SM_DERIVED_EVENT_MIN + 6;
63
65 static const int HA_MAINTENANCE_CANCEL_EVT = SM_DERIVED_EVENT_MIN + 7;
66
69 static const int HA_SYNCED_PARTNER_UNAVAILABLE_EVT = SM_DERIVED_EVENT_MIN + 8;
70
72 static const int HA_CONTROL_RESULT_MAINTENANCE_NOT_ALLOWED = 1001;
73
74protected:
75
82 typedef std::function<void(const bool, const std::string&, const int)> PostRequestCallback;
83
91 typedef std::function<void(const bool, const std::string&, const bool)> PostSyncCallback;
92
93public:
94
106 HAService(const asiolink::IOServicePtr& io_service,
107 const dhcp::NetworkStatePtr& network_state,
108 const HAConfigPtr& config,
109 const HAServerType& server_type = HAServerType::DHCPv4);
110
115 virtual ~HAService();
116
118 HAServerType getServerType() const {
119 return (server_type_);
120 }
121
123 virtual void defineEvents();
124
126 virtual void verifyEvents();
127
129 virtual void defineStates();
130
143 void backupStateHandler();
144
172 void communicationRecoveryHandler();
173
202 void normalStateHandler();
203
213 void inMaintenanceStateHandler();
214
239 void partnerDownStateHandler();
240
261 void partnerInMaintenanceStateHandler();
262
270 void passiveBackupStateHandler();
271
287 void readyStateHandler();
288
305 void syncingStateHandler();
306
324 void terminatedStateHandler();
325
349 void waitingStateHandler();
350
353 int getPartnerState() const {
354 return (communication_state_->getPartnerState());
355 }
356
357protected:
358
362 void verboseTransition(const unsigned state);
363
370 int getNormalState() const;
371
372public:
373
381 bool unpause();
382
383protected:
384
389 void conditionalLogPausedState() const;
390
391public:
392
397 void serveDefaultScopes();
398
412 bool inScope(dhcp::Pkt4Ptr& query4);
413
427 bool inScope(dhcp::Pkt6Ptr& query6);
428
429private:
430
444 template<typename QueryPtrType>
445 bool inScopeInternal(QueryPtrType& query);
446
447public:
448
453 void adjustNetworkState();
454
455protected:
456
470 bool shouldPartnerDown() const;
471
483 bool shouldTerminate() const;
484
489 bool isMaintenanceCanceled() const;
490
506 bool isPartnerStateInvalid() const;
507
508public:
509
543 size_t asyncSendLeaseUpdates(const dhcp::Pkt4Ptr& query,
544 const dhcp::Lease4CollectionPtr& leases,
545 const dhcp::Lease4CollectionPtr& deleted_leases,
546 const hooks::ParkingLotHandlePtr& parking_lot);
547
566 size_t asyncSendLeaseUpdates(const dhcp::Pkt6Ptr& query,
567 const dhcp::Lease6CollectionPtr& leases,
568 const dhcp::Lease6CollectionPtr& deleted_leases,
569 const hooks::ParkingLotHandlePtr& parking_lot);
570
571protected:
572
585 template<typename QueryPtrType>
586 void asyncSendLeaseUpdate(const QueryPtrType& query,
587 const HAConfig::PeerConfigPtr& config,
588 const data::ConstElementPtr& command,
589 const hooks::ParkingLotHandlePtr& parking_lot);
590
600 void logFailedLeaseUpdates(const dhcp::PktPtr& query,
601 const data::ConstElementPtr& args) const;
602
613 bool shouldSendLeaseUpdates(const HAConfig::PeerConfigPtr& peer_config) const;
614
626 bool shouldQueueLeaseUpdates(const HAConfig::PeerConfigPtr& peer_config) const;
627
628public:
629
654 data::ConstElementPtr processHeartbeat();
655
660 data::ConstElementPtr processStatusGet() const;
661
674 data::ConstElementPtr processHAReset();
675
676protected:
677
679 void asyncSendHeartbeat();
680
686 void scheduleHeartbeat();
687
689 void startHeartbeat();
690
702 void asyncDisableDHCPService(http::HttpClient& http_client,
703 const std::string& server_name,
704 const unsigned int max_period,
705 PostRequestCallback post_request_action);
706
716 void asyncEnableDHCPService(http::HttpClient& http_client,
717 const std::string& server_name,
718 PostRequestCallback post_request_action);
719
721 void localDisableDHCPService();
722
724 void localEnableDHCPService();
725
741 void asyncSyncLeases();
742
793 void asyncSyncLeases(http::HttpClient& http_client,
794 const std::string& server_name,
795 const unsigned int max_period,
796 const dhcp::LeasePtr& last_lease,
797 PostSyncCallback post_sync_action,
798 const bool dhcp_disabled = false);
799
826 void asyncSyncLeasesInternal(http::HttpClient& http_client,
827 const std::string& server_name,
828 const unsigned int max_period,
829 const dhcp::LeasePtr& last_lease,
830 PostSyncCallback post_sync_action,
831 const bool dhcp_disabled);
832
833public:
834
854 data::ConstElementPtr processSynchronize(const std::string& server_name,
855 const unsigned int max_period);
856
857protected:
858
879 int synchronize(std::string& status_message, const std::string& server_name,
880 const unsigned int max_period);
881
900 void asyncSendLeaseUpdatesFromBacklog(http::HttpClient& http_client,
901 const HAConfig::PeerConfigPtr& remote_config,
902 PostRequestCallback post_request_action);
903
917 bool sendLeaseUpdatesFromBacklog();
918
925 void asyncSendHAReset(http::HttpClient& http_client,
926 const HAConfig::PeerConfigPtr& remote_config,
927 PostRequestCallback post_request_action);
928
941 bool sendHAReset();
942
943public:
944
950 data::ConstElementPtr processScopes(const std::vector<std::string>& scopes);
951
955 data::ConstElementPtr processContinue();
956
977 data::ConstElementPtr processMaintenanceNotify(const bool cancel);
978
995 data::ConstElementPtr processMaintenanceStart();
996
1012 data::ConstElementPtr processMaintenanceCancel();
1013
1019 void checkPermissionsClientAndListener();
1020
1021protected:
1022
1032 void asyncSyncCompleteNotify(http::HttpClient& http_client,
1033 const std::string& server_name,
1034 PostRequestCallback post_request_action);
1035
1036public:
1037
1049 data::ConstElementPtr processSyncCompleteNotify();
1050
1058 void startClientAndListener();
1059
1066 void pauseClientAndListener();
1067
1074 void resumeClientAndListener();
1075
1081 void stopClientAndListener();
1082
1083protected:
1084
1095 data::ConstElementPtr verifyAsyncResponse(const http::HttpResponsePtr& response,
1096 int& rcode);
1097
1107 bool clientConnectHandler(const boost::system::error_code& ec, int tcp_native_fd);
1108
1114 bool clientHandshakeHandler(const boost::system::error_code&) {
1115 return (true);
1116 }
1117
1134 void socketReadyHandler(int tcp_native_fd);
1135
1143 void clientCloseHandler(int tcp_native_fd);
1144
1147 asiolink::IOServicePtr io_service_;
1148
1150 dhcp::NetworkStatePtr network_state_;
1151
1153 HAConfigPtr config_;
1154
1156 HAServerType server_type_;
1157
1159 http::HttpClientPtr client_;
1160
1163 config::CmdHttpListenerPtr listener_;
1164
1166 CommunicationStatePtr communication_state_;
1167
1169 QueryFilter query_filter_;
1170
1187 template<typename QueryPtrType>
1188 bool leaseUpdateComplete(QueryPtrType& query,
1189 const hooks::ParkingLotHandlePtr& parking_lot);
1190
1196 template<typename QueryPtrType>
1197 void updatePendingRequest(QueryPtrType& query);
1198
1203 size_t pendingRequestSize();
1204
1214 template<typename QueryPtrType>
1215 int getPendingRequest(const QueryPtrType& query);
1216
1217private:
1236 template<typename QueryPtrType>
1237 bool leaseUpdateCompleteInternal(QueryPtrType& query,
1238 const hooks::ParkingLotHandlePtr& parking_lot);
1239
1247 template<typename QueryPtrType>
1248 void updatePendingRequestInternal(QueryPtrType& query);
1249
1260 template<typename QueryPtrType>
1261 int getPendingRequestInternal(const QueryPtrType& query);
1262
1264 std::mutex mutex_;
1265
1274 std::map<boost::shared_ptr<dhcp::Pkt>, int> pending_requests_;
1275
1276protected:
1277
1283 LeaseUpdateBacklog lease_update_backlog_;
1284
1292 bool sync_complete_notified_;
1293};
1294
1296 typedef boost::shared_ptr<HAService> HAServicePtr;
1297
1298} // end of namespace isc::ha
1299} // end of namespace isc
1300
1301#endif
asio_wrapper.h
isc::ha::HAConfig::PeerConfigPtr
boost::shared_ptr< PeerConfig > PeerConfigPtr
Pointer to the server's configuration.
Definition: ha_config.h:229
isc::ha::HAService
High availability service.
Definition: ha_service.h:43
isc::ha::HAService::HA_MAINTENANCE_START_EVT
static const int HA_MAINTENANCE_START_EVT
ha-maintenance-start command received.
Definition: ha_service.h:62
isc::ha::HAService::inScope
bool inScope(dhcp::Pkt4Ptr &query4)
Checks if the DHCPv4 query should be processed by this server.
Definition: ha_service.cc:1008
isc::ha::HAService::adjustNetworkState
void adjustNetworkState()
Enables or disables network state depending on the served scopes.
Definition: ha_service.cc:1038
isc::ha::HAService::stopClientAndListener
void stopClientAndListener()
Stop the client and(or) listener instances.
Definition: ha_service.cc:3128
isc::ha::HAService::getNormalState
int getNormalState() const
Returns normal operation state for the current configuration.
Definition: ha_service.cc:966
isc::ha::HAService::shouldQueueLeaseUpdates
bool shouldQueueLeaseUpdates(const HAConfig::PeerConfigPtr &peer_config) const
Checks if the lease updates should be queued.
Definition: ha_service.cc:1488
isc::ha::HAService::HA_HEARTBEAT_COMPLETE_EVT
static const int HA_HEARTBEAT_COMPLETE_EVT
Finished heartbeat command.
Definition: ha_service.h:47
isc::ha::HAService::asyncSendHAReset
void asyncSendHAReset(http::HttpClient &http_client, const HAConfig::PeerConfigPtr &remote_config, PostRequestCallback post_request_action)
Sends ha-reset command to partner asynchronously.
Definition: ha_service.cc:2463
isc::ha::HAService::clientConnectHandler
bool clientConnectHandler(const boost::system::error_code &ec, int tcp_native_fd)
HttpClient connect callback handler.
Definition: ha_service.cc:2970
isc::ha::HAService::asyncSyncLeases
void asyncSyncLeases()
Asynchronously reads leases from a peer and updates local lease database.
Definition: ha_service.cc:1971
isc::ha::HAService::isMaintenanceCanceled
bool isMaintenanceCanceled() const
Convenience method checking if the current state is a result of canceling the maintenance.
Definition: ha_service.cc:1110
isc::ha::HAService::processMaintenanceCancel
data::ConstElementPtr processMaintenanceCancel()
Processes ha-maintenance-cancel command and returns a response.
Definition: ha_service.cc:2719
isc::ha::HAService::checkPermissionsClientAndListener
void checkPermissionsClientAndListener()
Check client and(or) listener current thread permissions to perform thread pool state transition.
Definition: ha_service.cc:3048
isc::ha::HAService::asyncSendLeaseUpdate
void asyncSendLeaseUpdate(const QueryPtrType &query, const HAConfig::PeerConfigPtr &config, const data::ConstElementPtr &command, const hooks::ParkingLotHandlePtr &parking_lot)
Asynchronously sends lease update to the peer.
Definition: ha_service.cc:1329
isc::ha::HAService::verboseTransition
void verboseTransition(const unsigned state)
Transitions to a desired state and logs it.
Definition: ha_service.cc:901
isc::ha::HAService::sendLeaseUpdatesFromBacklog
bool sendLeaseUpdatesFromBacklog()
Attempts to send all lease updates from the backlog synchronously.
Definition: ha_service.cc:2422
isc::ha::HAService::listener_
config::CmdHttpListenerPtr listener_
HTTP listener instance used to receive and respond to HA commands and lease updates.
Definition: ha_service.h:1163
isc::ha::HAService::clientCloseHandler
void clientCloseHandler(int tcp_native_fd)
HttpClient close callback handler.
Definition: ha_service.cc:3010
isc::ha::HAService::asyncSyncCompleteNotify
void asyncSyncCompleteNotify(http::HttpClient &http_client, const std::string &server_name, PostRequestCallback post_request_action)
Schedules asynchronous "ha-sync-complete-notify" command to the specified server.
Definition: ha_service.cc:2815
isc::ha::HAService::leaseUpdateComplete
bool leaseUpdateComplete(QueryPtrType &query, const hooks::ParkingLotHandlePtr &parking_lot)
Handle last pending request for this query.
Definition: ha_service.cc:1275
isc::ha::HAService::config_
HAConfigPtr config_
Pointer to the HA hooks library configuration.
Definition: ha_service.h:1153
isc::ha::HAService::processMaintenanceStart
data::ConstElementPtr processMaintenanceStart()
Processes ha-maintenance-start command and returns a response.
Definition: ha_service.cc:2589
isc::ha::HAService::server_type_
HAServerType server_type_
DHCP server type.
Definition: ha_service.h:1156
isc::ha::HAService::sync_complete_notified_
bool sync_complete_notified_
An indicator that a partner sent ha-sync-complete-notify command.
Definition: ha_service.h:1292
isc::ha::HAService::asyncEnableDHCPService
void asyncEnableDHCPService(http::HttpClient &http_client, const std::string &server_name, PostRequestCallback post_request_action)
Schedules asynchronous "dhcp-enable" command to the specified server.
Definition: ha_service.cc:1884
isc::ha::HAService::shouldTerminate
bool shouldTerminate() const
Indicates if the server should transition to the terminated state as a result of high clock skew.
Definition: ha_service.cc:1097
isc::ha::HAService::asyncSyncLeasesInternal
void asyncSyncLeasesInternal(http::HttpClient &http_client, const std::string &server_name, const unsigned int max_period, const dhcp::LeasePtr &last_lease, PostSyncCallback post_sync_action, const bool dhcp_disabled)
Implements fetching one page of leases during synchronization.
Definition: ha_service.cc:2018
isc::ha::HAService::terminatedStateHandler
void terminatedStateHandler()
Handler for "terminated" state.
Definition: ha_service.cc:772
isc::ha::HAService::processScopes
data::ConstElementPtr processScopes(const std::vector< std::string > &scopes)
Processes ha-scopes command and returns a response.
Definition: ha_service.cc:2532
isc::ha::HAService::network_state_
dhcp::NetworkStatePtr network_state_
Pointer to the state of the DHCP service (enabled/disabled).
Definition: ha_service.h:1150
isc::ha::HAService::HAService
HAService(const asiolink::IOServicePtr &io_service, const dhcp::NetworkStatePtr &network_state, const HAConfigPtr &config, const HAServerType &server_type=HAServerType::DHCPv4)
Constructor.
Definition: ha_service.cc:67
isc::ha::HAService::processSynchronize
data::ConstElementPtr processSynchronize(const std::string &server_name, const unsigned int max_period)
Processes ha-sync command and returns a response.
Definition: ha_service.cc:2214
isc::ha::HAService::scheduleHeartbeat
void scheduleHeartbeat()
Schedules asynchronous heartbeat to a peer if it is not scheduled.
Definition: ha_service.cc:1788
isc::ha::HAService::passiveBackupStateHandler
void passiveBackupStateHandler()
Handler for "passive-backup" state.
Definition: ha_service.cc:586
isc::ha::HAService::query_filter_
QueryFilter query_filter_
Selects queries to be processed/dropped.
Definition: ha_service.h:1169
isc::ha::HAService::HA_MAINTENANCE_NOTIFY_EVT
static const int HA_MAINTENANCE_NOTIFY_EVT
ha-maintenance-notify command received.
Definition: ha_service.h:59
isc::ha::HAService::HA_SYNCED_PARTNER_UNAVAILABLE_EVT
static const int HA_SYNCED_PARTNER_UNAVAILABLE_EVT
The heartbeat command failed after receiving ha-sync-complete-notify command from the partner.
Definition: ha_service.h:69
isc::ha::HAService::inMaintenanceStateHandler
void inMaintenanceStateHandler()
Handler for the "in-maintenance" state.
Definition: ha_service.cc:432
isc::ha::HAService::verifyEvents
virtual void verifyEvents()
Verifies events used by the HA service.
Definition: ha_service.cc:158
isc::ha::HAService::conditionalLogPausedState
void conditionalLogPausedState() const
Logs if the server is paused in the current state.
Definition: ha_service.cc:992
isc::ha::HAService::unpause
bool unpause()
Unpauses the HA state machine with logging.
Definition: ha_service.cc:982
isc::ha::HAService::HA_CONTROL_RESULT_MAINTENANCE_NOT_ALLOWED
static const int HA_CONTROL_RESULT_MAINTENANCE_NOT_ALLOWED
Control result returned in response to ha-maintenance-notify.
Definition: ha_service.h:72
isc::ha::HAService::serveDefaultScopes
void serveDefaultScopes()
Instructs the HA service to serve default scopes.
Definition: ha_service.cc:1003
isc::ha::HAService::asyncSendLeaseUpdates
size_t asyncSendLeaseUpdates(const dhcp::Pkt4Ptr &query, const dhcp::Lease4CollectionPtr &leases, const dhcp::Lease4CollectionPtr &deleted_leases, const hooks::ParkingLotHandlePtr &parking_lot)
Schedules asynchronous IPv4 leases updates.
Definition: ha_service.cc:1145
isc::ha::HAService::pendingRequestSize
size_t pendingRequestSize()
Get the number of entries in the pending request map.
Definition: ha_service.cc:3017
isc::ha::HAService::HA_SYNCING_SUCCEEDED_EVT
static const int HA_SYNCING_SUCCEEDED_EVT
Lease database synchronization succeeded.
Definition: ha_service.h:56
isc::ha::HAService::sendHAReset
bool sendHAReset()
Sends ha-reset command to partner synchronously.
Definition: ha_service.cc:2513
isc::ha::HAService::PostRequestCallback
std::function< void(const bool, const std::string &, const int)> PostRequestCallback
Callback invoked when request was sent and a response received or an error occurred.
Definition: ha_service.h:82
isc::ha::HAService::defineEvents
virtual void defineEvents()
Defines events used by the HA service.
Definition: ha_service.cc:144
isc::ha::HAService::io_service_
asiolink::IOServicePtr io_service_
Pointer to the IO service object shared between this hooks library and the DHCP server.
Definition: ha_service.h:1147
isc::ha::HAService::localDisableDHCPService
void localDisableDHCPService()
Disables local DHCP service.
Definition: ha_service.cc:1961
isc::ha::HAService::communication_state_
CommunicationStatePtr communication_state_
Holds communication state with a peer.
Definition: ha_service.h:1166
isc::ha::HAService::logFailedLeaseUpdates
void logFailedLeaseUpdates(const dhcp::PktPtr &query, const data::ConstElementPtr &args) const
Log failed lease updates.
Definition: ha_service.cc:1501
isc::ha::HAService::clientHandshakeHandler
bool clientHandshakeHandler(const boost::system::error_code &)
HttpClient handshake callback handler.
Definition: ha_service.h:1114
isc::ha::HAService::lease_update_backlog_
LeaseUpdateBacklog lease_update_backlog_
Backlog of DHCP lease updates.
Definition: ha_service.h:1283
isc::ha::HAService::processSyncCompleteNotify
data::ConstElementPtr processSyncCompleteNotify()
Process ha-sync-complete-notify command and returns a response.
Definition: ha_service.cc:2896
isc::ha::HAService::~HAService
virtual ~HAService()
Destructor.
Definition: ha_service.cc:136
isc::ha::HAService::asyncDisableDHCPService
void asyncDisableDHCPService(http::HttpClient &http_client, const std::string &server_name, const unsigned int max_period, PostRequestCallback post_request_action)
Schedules asynchronous "dhcp-disable" command to the specified server.
Definition: ha_service.cc:1804
isc::ha::HAService::HA_SYNCING_FAILED_EVT
static const int HA_SYNCING_FAILED_EVT
Lease database synchronization failed.
Definition: ha_service.h:53
isc::ha::HAService::HA_MAINTENANCE_CANCEL_EVT
static const int HA_MAINTENANCE_CANCEL_EVT
ha-maintenance-cancel command received.
Definition: ha_service.h:65
isc::ha::HAService::getPartnerState
int getPartnerState() const
Returns last known state of the partner.
Definition: ha_service.h:353
isc::ha::HAService::asyncSendLeaseUpdatesFromBacklog
void asyncSendLeaseUpdatesFromBacklog(http::HttpClient &http_client, const HAConfig::PeerConfigPtr &remote_config, PostRequestCallback post_request_action)
Sends lease updates from backlog to partner asynchronously.
Definition: ha_service.cc:2346
isc::ha::HAService::processHeartbeat
data::ConstElementPtr processHeartbeat()
Processes ha-heartbeat command and returns a response.
Definition: ha_service.cc:1602
isc::ha::HAService::processHAReset
data::ConstElementPtr processHAReset()
Processes ha-reset command and returns a response.
Definition: ha_service.cc:1625
isc::ha::HAService::readyStateHandler
void readyStateHandler()
Handler for "ready" state.
Definition: ha_service.cc:604
isc::ha::HAService::defineStates
virtual void defineStates()
Defines states of the HA service.
Definition: ha_service.cc:172
isc::ha::HAService::backupStateHandler
void backupStateHandler()
Handler for the "backup" state.
Definition: ha_service.cc:225
isc::ha::HAService::asyncSendHeartbeat
void asyncSendHeartbeat()
Starts asynchronous heartbeat to a peer.
Definition: ha_service.cc:1635
isc::ha::HAService::communicationRecoveryHandler
void communicationRecoveryHandler()
Handler for the "communication-recovery" state.
Definition: ha_service.cc:240
isc::ha::HAService::isPartnerStateInvalid
bool isPartnerStateInvalid() const
Indicates if the partner's state is invalid.
Definition: ha_service.cc:1115
isc::ha::HAService::startClientAndListener
void startClientAndListener()
Start the client and(or) listener instances.
Definition: ha_service.cc:3075
isc::ha::HAService::verifyAsyncResponse
data::ConstElementPtr verifyAsyncResponse(const http::HttpResponsePtr &response, int &rcode)
Checks if the response is valid or contains an error.
Definition: ha_service.cc:2907
isc::ha::HAService::resumeClientAndListener
void resumeClientAndListener()
Resumes client and(or) listener thread pool operations.
Definition: ha_service.cc:3110
isc::ha::HAService::synchronize
int synchronize(std::string &status_message, const std::string &server_name, const unsigned int max_period)
Synchronizes lease database with a partner.
Definition: ha_service.cc:2222
isc::ha::HAService::normalStateHandler
void normalStateHandler()
Handler for the "hot-standby" and "load-balancing" states.
Definition: ha_service.cc:357
isc::ha::HAService::processStatusGet
data::ConstElementPtr processStatusGet() const
Processes status-get command and returns a response.
Definition: ha_service.cc:1553
isc::ha::HAService::getPendingRequest
int getPendingRequest(const QueryPtrType &query)
Get the number of scheduled requests for a given query.
Definition: ha_service.cc:3028
isc::ha::HAService::waitingStateHandler
void waitingStateHandler()
Handler for "waiting" state.
Definition: ha_service.cc:793
isc::ha::HAService::shouldSendLeaseUpdates
bool shouldSendLeaseUpdates(const HAConfig::PeerConfigPtr &peer_config) const
Checks if the lease updates should be sent as result of leases allocation or release.
Definition: ha_service.cc:1456
isc::ha::HAService::localEnableDHCPService
void localEnableDHCPService()
Enables local DHCP service.
Definition: ha_service.cc:1966
isc::ha::HAService::HA_LEASE_UPDATES_COMPLETE_EVT
static const int HA_LEASE_UPDATES_COMPLETE_EVT
Finished lease updates commands.
Definition: ha_service.h:50
isc::ha::HAService::getServerType
HAServerType getServerType() const
Returns HA server type used in object construction.
Definition: ha_service.h:118
isc::ha::HAService::partnerDownStateHandler
void partnerDownStateHandler()
Handler for "partner-down" state.
Definition: ha_service.cc:457
isc::ha::HAService::socketReadyHandler
void socketReadyHandler(int tcp_native_fd)
IfaceMgr external socket ready callback handler.
Definition: ha_service.cc:3001
isc::ha::HAService::client_
http::HttpClientPtr client_
HTTP client instance used to send HA commands and lease updates.
Definition: ha_service.h:1159
isc::ha::HAService::updatePendingRequest
void updatePendingRequest(QueryPtrType &query)
Update pending request counter for this query.
Definition: ha_service.cc:1308
isc::ha::HAService::shouldPartnerDown
bool shouldPartnerDown() const
Indicates if the server should transition to the partner down state.
Definition: ha_service.cc:1070
isc::ha::HAService::startHeartbeat
void startHeartbeat()
Unconditionally starts one heartbeat to a peer.
Definition: ha_service.cc:1795
isc::ha::HAService::processContinue
data::ConstElementPtr processContinue()
Processes ha-continue command and returns a response.
Definition: ha_service.cc:2545
isc::ha::HAService::pauseClientAndListener
void pauseClientAndListener()
Pauses client and(or) listener thread pool operations.
Definition: ha_service.cc:3092
isc::ha::HAService::PostSyncCallback
std::function< void(const bool, const std::string &, const bool)> PostSyncCallback
Callback invoked when lease database synchronization is complete.
Definition: ha_service.h:91
isc::ha::HAService::processMaintenanceNotify
data::ConstElementPtr processMaintenanceNotify(const bool cancel)
Processes ha-maintenance-notify command and returns a response.
Definition: ha_service.cc:2553
isc::ha::HAService::syncingStateHandler
void syncingStateHandler()
Handler for "syncing" state.
Definition: ha_service.cc:683
isc::ha::HAService::partnerInMaintenanceStateHandler
void partnerInMaintenanceStateHandler()
Handler for "partner-in-maintenance" state.
Definition: ha_service.cc:547
isc::ha::LeaseUpdateBacklog
Queue holding a backlog of unsent lease updates.
Definition: lease_update_backlog.h:45
isc::ha::QueryFilter
DHCP query filtering class.
Definition: query_filter.h:61
isc::http::HttpClient
HTTP client class.
Definition: client.h:87
isc::util::StateModel
Implements a finite state machine.
Definition: state_model.h:274
isc::util::StateModel::SM_DERIVED_EVENT_MIN
static const int SM_DERIVED_EVENT_MIN
Value at which custom events in a derived class should begin.
Definition: state_model.h:304
client.h
cmd_http_listener.h
communication_state.h
data.h
ha_config.h
ha_server_type.h
io_service.h
lease.h
lease_update_backlog.h
isc::asiolink::IOServicePtr
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
Definition: io_service.h:110
isc::config::CmdHttpListenerPtr
boost::shared_ptr< CmdHttpListener > CmdHttpListenerPtr
Defines a shared pointer to CmdHttpListener.
Definition: cmd_http_listener.h:155
isc::data::ConstElementPtr
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:27
isc::dhcp::PktPtr
boost::shared_ptr< isc::dhcp::Pkt > PktPtr
A pointer to either Pkt4 or Pkt6 packet.
Definition: pkt.h:797
isc::dhcp::Lease4CollectionPtr
boost::shared_ptr< Lease4Collection > Lease4CollectionPtr
A shared pointer to the collection of IPv4 leases.
Definition: lease.h:501
isc::dhcp::Pkt4Ptr
boost::shared_ptr< Pkt4 > Pkt4Ptr
A pointer to Pkt4 object.
Definition: pkt4.h:544
isc::dhcp::LeasePtr
boost::shared_ptr< Lease > LeasePtr
Pointer to the lease object.
Definition: lease.h:22
isc::dhcp::NetworkStatePtr
boost::shared_ptr< NetworkState > NetworkStatePtr
Pointer to the NetworkState object.
Definition: network_state.h:204
isc::dhcp::Lease6CollectionPtr
boost::shared_ptr< Lease6Collection > Lease6CollectionPtr
A shared pointer to the collection of IPv6 leases.
Definition: lease.h:665
isc::dhcp::Pkt6Ptr
boost::shared_ptr< Pkt6 > Pkt6Ptr
A pointer to Pkt6 packet.
Definition: pkt6.h:28
isc::ha::CommunicationStatePtr
boost::shared_ptr< CommunicationState > CommunicationStatePtr
Type of the pointer to the CommunicationState object.
Definition: communication_state.h:589
isc::ha::HAConfigPtr
boost::shared_ptr< HAConfig > HAConfigPtr
Pointer to the High Availability configuration structure.
Definition: ha_config.h:786
isc::ha::HAServerType
HAServerType
Lists possible server types for which HA service is created.
Definition: ha_server_type.h:14
isc::ha::HAServerType::DHCPv4
@ DHCPv4
isc::ha::HAServicePtr
boost::shared_ptr< HAService > HAServicePtr
Pointer to the HAService class.
Definition: ha_service.h:1296
isc::hooks::ParkingLotHandlePtr
boost::shared_ptr< ParkingLotHandle > ParkingLotHandlePtr
Pointer to the parking lot handle.
Definition: parking_lots.h:381
isc::http::HttpClientPtr
boost::shared_ptr< HttpClient > HttpClientPtr
Defines a pointer to an HttpClient instance.
Definition: client.h:337
isc::http::HttpResponsePtr
boost::shared_ptr< HttpResponse > HttpResponsePtr
Pointer to the HttpResponse object.
Definition: response.h:78
isc
Defines the logger used by the top-level component of kea-lfc.
Definition: agent_parser.cc:143
network_state.h
parking_lots.h
pkt4.h
query_filter.h
response.h
state_model.h
This file defines the class StateModel.
tls_socket.h