Kea 2.7.5
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
182 createMaintenanceNotify(const std::string& server_name,
183 const bool cancel,
184 const HAServerType& server_type);
185
195 createSyncCompleteNotify(const unsigned int origin_id,
196 const std::string& server_name,
197 const HAServerType& server_type);
198
200 static std::unordered_set<std::string> ha_commands4_;
201
203 static std::unordered_set<std::string> ha_commands6_;
204
205private:
206
218 static void insertLeaseExpireTime(data::ElementPtr& lease);
219
237 static void
238 insertService(data::ConstElementPtr& command,
239 const HAServerType& server_type);
240};
241
242} // end of namespace ha
243} // end of namespace isc
244
245#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 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 createMaintenanceNotify(const std::string &server_name, const bool cancel, const HAServerType &server_type)
Creates ha-maintenance-notify 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