Kea 2.7.6
command_creator.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_COMMAND_CREATOR_H
8#define HA_COMMAND_CREATOR_H
9
11#include <ha_server_type.h>
12#include <cc/data.h>
13#include <dhcpsrv/lease.h>
14#include <unordered_set>
15#include <string>
16
17namespace isc {
18namespace ha {
19
23public:
24
35 createDHCPDisable(const unsigned int origin_id,
36 const unsigned int max_period,
37 const HAServerType& server_type);
38
47 createDHCPEnable(const unsigned int origin_id,
48 const HAServerType& server_type);
49
57 createHAReset(const std::string& server_name,
58 const HAServerType& server_type);
59
67 createHeartbeat(const std::string& server_name,
68 const HAServerType& server_type);
69
81 createLease4Update(const dhcp::Lease4& lease4);
82
90 createLease4Delete(const dhcp::Lease4& lease4);
91
97
109 const uint32_t limit);
110
120 const dhcp::Lease6CollectionPtr& deleted_leases);
121
131
143 createLease6Update(const dhcp::Lease6& lease6);
144
152 createLease6Delete(const dhcp::Lease6& lease6);
153
159
171 const uint32_t limit);
172
183 createMaintenanceNotify(const std::string& server_name,
184 const bool cancel,
185 const int state,
186 const HAServerType& server_type);
187
197 createSyncCompleteNotify(const unsigned int origin_id,
198 const std::string& server_name,
199 const HAServerType& server_type);
200
202 static std::unordered_set<std::string> ha_commands4_;
203
205 static std::unordered_set<std::string> ha_commands6_;
206
207private:
208
220 static void insertLeaseExpireTime(data::ElementPtr& lease);
221
239 static void
240 insertService(data::ConstElementPtr& command,
241 const HAServerType& server_type);
242};
243
244} // end of namespace ha
245} // end of namespace isc
246
247#endif
Holds a collection of functions which generate commands used for High Availability.
static data::ConstElementPtr createLease4Delete(const dhcp::Lease4 &lease4)
Creates lease4-del command.
static data::ConstElementPtr createHeartbeat(const std::string &server_name, const HAServerType &server_type)
Creates ha-heartbeat command for DHCP server.
static std::unordered_set< std::string > ha_commands4_
List of commands used by the High Availability in v4.
static data::ConstElementPtr createLease4Update(const dhcp::Lease4 &lease4)
Creates lease4-update command.
static data::ConstElementPtr createLease6Update(const dhcp::Lease6 &lease6)
Creates lease6-update command.
static data::ConstElementPtr createSyncCompleteNotify(const unsigned int origin_id, const std::string &server_name, const HAServerType &server_type)
Creates ha-sync-complete-notify command.
static data::ConstElementPtr createLease6Delete(const dhcp::Lease6 &lease6)
Creates lease6-del command.
static data::ConstElementPtr createLease6BulkApply(const dhcp::Lease6CollectionPtr &leases, const dhcp::Lease6CollectionPtr &deleted_leases)
Creates lease6-bulk-apply command.
static data::ConstElementPtr createLease4GetAll()
Creates lease4-get-all command.
static data::ConstElementPtr createLease6GetPage(const dhcp::Lease6Ptr &lease6, const uint32_t limit)
Creates lease6-get-page command.
static data::ConstElementPtr createDHCPDisable(const unsigned int origin_id, const unsigned int max_period, const HAServerType &server_type)
Creates dhcp-disable command for DHCP server.
static data::ConstElementPtr createDHCPEnable(const unsigned int origin_id, const HAServerType &server_type)
Creates dhcp-enable command for DHCP server.
static data::ConstElementPtr createMaintenanceNotify(const std::string &server_name, const bool cancel, const int state, const HAServerType &server_type)
Creates ha-maintenance-notify command.
static std::unordered_set< std::string > ha_commands6_
List of commands used by the High Availability in v6.
static data::ConstElementPtr createHAReset(const std::string &server_name, const HAServerType &server_type)
Creates ha-reset command.
static data::ConstElementPtr createLease6GetAll()
Creates lease6-get-all command.
static data::ConstElementPtr createLease4GetPage(const dhcp::Lease4Ptr &lease4, const uint32_t limit)
Creates lease4-get-page command.
Queue holding a backlog of unsent lease updates.
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:29
boost::shared_ptr< Element > ElementPtr
Definition data.h:28
boost::shared_ptr< Lease6 > Lease6Ptr
Pointer to a Lease6 structure.
Definition lease.h:508
boost::shared_ptr< Lease6Collection > Lease6CollectionPtr
A shared pointer to the collection of IPv6 leases.
Definition lease.h:676
boost::shared_ptr< Lease4 > Lease4Ptr
Pointer to a Lease4 structure.
Definition lease.h:295
HAServerType
Lists possible server types for which HA service is created.
Defines the logger used by the top-level component of kea-lfc.
Structure that holds a lease for IPv4 address.
Definition lease.h:303
Structure that holds a lease for IPv6 address and/or prefix.
Definition lease.h:516