Kea  2.3.5-git
command_creator.h
Go to the documentation of this file.
1 // Copyright (C) 2018-2022 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 
10 #include <lease_update_backlog.h>
11 #include <ha_server_type.h>
12 #include <cc/data.h>
13 #include <dhcpsrv/lease.h>
14 #include <unordered_set>
15 #include <string>
16 
17 namespace isc {
18 namespace ha {
19 
23 public:
24 
33  createDHCPDisable(const unsigned int max_period,
34  const HAServerType& server_type);
35 
42  createDHCPEnable(const HAServerType& server_type);
43 
49  createHAReset(const HAServerType& server_type);
50 
55  createHeartbeat(const HAServerType& server_type);
56 
68  createLease4Update(const dhcp::Lease4& lease4);
69 
77  createLease4Delete(const dhcp::Lease4& lease4);
78 
84 
96  const uint32_t limit);
97 
105  static data::ConstElementPtr
107  const dhcp::Lease6CollectionPtr& deleted_leases);
108 
116  static data::ConstElementPtr
118 
129  static data::ConstElementPtr
130  createLease6Update(const dhcp::Lease6& lease6);
131 
138  static data::ConstElementPtr
139  createLease6Delete(const dhcp::Lease6& lease6);
140 
144  static data::ConstElementPtr
146 
156  static data::ConstElementPtr
157  createLease6GetPage(const dhcp::Lease6Ptr& lease6,
158  const uint32_t limit);
159 
166  static data::ConstElementPtr
167  createMaintenanceNotify(const bool cancel, const HAServerType& server_type);
168 
173  static data::ConstElementPtr
174  createSyncCompleteNotify(const HAServerType& server_type);
175 
177  static std::unordered_set<std::string> ha_commands4_;
178 
180  static std::unordered_set<std::string> ha_commands6_;
181 
182 private:
183 
195  static void insertLeaseExpireTime(data::ElementPtr& lease);
196 
214  static void
215  insertService(data::ConstElementPtr& command,
216  const HAServerType& server_type);
217 };
218 
219 } // end of namespace ha
220 } // end of namespace isc
221 
222 #endif
static data::ConstElementPtr createHAReset(const HAServerType &server_type)
Creates ha-reset command.
static data::ConstElementPtr createLease6GetAll()
Creates lease6-get-all command.
Structure that holds a lease for IPv4 address.
Definition: lease.h:305
static std::unordered_set< std::string > ha_commands6_
List of commands used by the High Availability in v6.
boost::shared_ptr< Element > ElementPtr
Definition: data.h:24
static data::ConstElementPtr createLease6GetPage(const dhcp::Lease6Ptr &lease6, const uint32_t limit)
Creates lease6-get-page command.
HAServerType
Lists possible server types for which HA service is created.
static data::ConstElementPtr createLease4GetAll()
Creates lease4-get-all command.
boost::shared_ptr< Lease4 > Lease4Ptr
Pointer to a Lease4 structure.
Definition: lease.h:294
static data::ConstElementPtr createLease4Update(const dhcp::Lease4 &lease4)
Creates lease4-update command.
static data::ConstElementPtr createSyncCompleteNotify(const HAServerType &server_type)
Creates ha-sync-complete-notify command.
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:27
static std::unordered_set< std::string > ha_commands4_
List of commands used by the High Availability in v4.
Structure that holds a lease for IPv6 address and/or prefix.
Definition: lease.h:530
static data::ConstElementPtr createLease4Delete(const dhcp::Lease4 &lease4)
Creates lease4-del command.
Defines the logger used by the top-level component of kea-lfc.
static data::ConstElementPtr createLease6Delete(const dhcp::Lease6 &lease6)
Creates lease6-del command.
boost::shared_ptr< Lease6Collection > Lease6CollectionPtr
A shared pointer to the collection of IPv6 leases.
Definition: lease.h:680
static data::ConstElementPtr createLease6BulkApply(const dhcp::Lease6CollectionPtr &leases, const dhcp::Lease6CollectionPtr &deleted_leases)
Creates lease6-bulk-apply command.
static data::ConstElementPtr createHeartbeat(const HAServerType &server_type)
Creates ha-heartbeat command for DHCP server.
static data::ConstElementPtr createLease6Update(const dhcp::Lease6 &lease6)
Creates lease6-update command.
boost::shared_ptr< Lease6 > Lease6Ptr
Pointer to a Lease6 structure.
Definition: lease.h:519
static data::ConstElementPtr createMaintenanceNotify(const bool cancel, const HAServerType &server_type)
Creates ha-maintenance-notify command.
Queue holding a backlog of unsent lease updates.
static data::ConstElementPtr createDHCPEnable(const HAServerType &server_type)
Creates dhcp-enable command for DHCP server.
static data::ConstElementPtr createDHCPDisable(const unsigned int max_period, const HAServerType &server_type)
Creates dhcp-disable command for DHCP server.
static data::ConstElementPtr createLease4GetPage(const dhcp::Lease4Ptr &lease4, const uint32_t limit)
Creates lease4-get-page command.
Holds a collection of functions which generate commands used for High Availability.