| Kea 3.0.2-git

isc::ha::CommandCreator Class Reference

Holds a collection of functions which generate commands used for High Availability. More...

`#include <command_creator.h>`

## Static Public Member Functions
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 | createHAReset (const std::string &server_name, const HAServerType &server_type)
| Creates ha-reset command.
static data::ConstElementPtr | createHeartbeat (const std::string &server_name, const HAServerType &server_type)
| Creates ha-heartbeat command for DHCP server.
static data::ConstElementPtr | createLease4Delete (const dhcp::Lease4 &lease4)
| Creates lease4-del command.
static data::ConstElementPtr | createLease4GetAll ()
| Creates lease4-get-all command.
static data::ConstElementPtr | createLease4GetPage (const dhcp::Lease4Ptr &lease4, const uint32_t limit)
| Creates lease4-get-page command.
static data::ConstElementPtr | createLease4Update (const dhcp::Lease4 &lease4)
| Creates lease4-update command.
static data::ConstElementPtr | createLease6BulkApply (const dhcp::Lease6CollectionPtr &leases, const dhcp::Lease6CollectionPtr &deleted_leases)
| Creates lease6-bulk-apply command.
static data::ConstElementPtr | createLease6BulkApply (LeaseUpdateBacklog &leases)
| Creates lease6-bulk-apply command.
static data::ConstElementPtr | createLease6Delete (const dhcp::Lease6 &lease6)
| Creates lease6-del command.
static data::ConstElementPtr | createLease6GetAll ()
| Creates lease6-get-all command.
static data::ConstElementPtr | createLease6GetPage (const dhcp::Lease6Ptr &lease6, const uint32_t limit)
| Creates lease6-get-page command.
static data::ConstElementPtr | createLease6Update (const dhcp::Lease6 &lease6)
| Creates lease6-update command.
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 data::ConstElementPtr | createSyncCompleteNotify (const unsigned int origin_id, const std::string &server_name, const HAServerType &server_type)
| Creates ha-sync-complete-notify command.

## Static Public Attributes
static std::unordered_set< std::string > | ha_commands4_
| List of commands used by the High Availability in v4.
static std::unordered_set< std::string > | ha_commands6_
| List of commands used by the High Availability in v6.

## Detailed Description

Holds a collection of functions which generate commands used for High Availability.

Definition at line 22 of file command_creator.h.

## Member Function Documentation

## ◆ createDHCPDisable()

ConstElementPtr isc::ha::CommandCreator::createDHCPDisable | ( | const unsigned int | origin_id,
|  | const unsigned int | max_period,
|  | const HAServerType & | server_type )
| static

Creates dhcp-disable command for DHCP server.

Parameters

  origin_id | A numeric value of the origin created from the `HAService` identifier.
  max_period | The max-period time the service can stay disabled before automatically transitioning to enabled state.
  server_type | type of the DHCP server, i.e. v4 or v6.

Returns
  Pointer to the JSON representation of the command.

Definition at line 42 of file command_creator.cc.

References Element::create(), isc::config::createCommand(), and Element::createMap().

Referenced by isc::ha::HAService::asyncDisableDHCPService().

Here is the call graph for this function:

## ◆ createDHCPEnable()

ConstElementPtr isc::ha::CommandCreator::createDHCPEnable | ( | const unsigned int | origin_id,
|  | const HAServerType & | server_type )
| static

Creates dhcp-enable command for DHCP server.

Parameters

  origin_id | A numeric value of the origin created from the `HAService` identifier.
  server_type | type of the DHCP server, i.e. v4 or v6.

Returns
  Pointer to the JSON representation of the command.

Definition at line 60 of file command_creator.cc.

References Element::create(), isc::config::createCommand(), and Element::createMap().

Referenced by isc::ha::HAService::asyncEnableDHCPService().

Here is the call graph for this function:

## ◆ createHAReset()

ConstElementPtr isc::ha::CommandCreator::createHAReset | ( | const std::string & | server_name,
|  | const HAServerType & | server_type )
| static

Creates ha-reset command.

Parameters

  server_name | name of the server sending the command allowing for associating the command with the relationship.
  server_type | type of the DHCP server, i.e. v4 or v6.

Returns
  Pointer to the JSON representation of the command.

Definition at line 73 of file command_creator.cc.

References Element::create(), isc::config::createCommand(), and Element::createMap().

Referenced by isc::ha::HAService::asyncSendHAReset().

Here is the call graph for this function:

## ◆ createHeartbeat()

ConstElementPtr isc::ha::CommandCreator::createHeartbeat | ( | const std::string & | server_name,
|  | const HAServerType & | server_type )
| static

Creates ha-heartbeat command for DHCP server.

Parameters

  server_name | name of the server sending the command allowing for associating the command with the relationship.
  server_type | type of the DHCP server, i.e. v4 or v6.

Returns
  Pointer to the JSON representation of the command.

Definition at line 83 of file command_creator.cc.

References Element::create(), isc::config::createCommand(), and Element::createMap().

Referenced by isc::ha::HAService::asyncSendHeartbeat().

Here is the call graph for this function:

## ◆ createLease4Delete()

ConstElementPtr isc::ha::CommandCreator::createLease4Delete | ( | const dhcp::Lease4 & | lease4 | ) |
| static

Creates lease4-del command.

Parameters

  lease4 | Reference to a lease for which the command should be created.

Returns
  Pointer to the JSON representation of the command.

Definition at line 104 of file command_creator.cc.

References Element::create(), isc::config::createCommand(), isc::ha::DHCPv4, and isc::dhcp::Lease4::toElement().

Referenced by isc::ha::HAService::asyncSendLeaseUpdates(), and isc::ha::HAService::asyncSendLeaseUpdatesFromBacklog().

Here is the call graph for this function:

## ◆ createLease4GetAll()

ConstElementPtr isc::ha::CommandCreator::createLease4GetAll | ( |  | ) |
| static

Creates lease4-get-all command.

Returns
  Pointer to the JSON representation of the command.

Definition at line 114 of file command_creator.cc.

References isc::config::createCommand(), and isc::ha::DHCPv4.

Here is the call graph for this function:

## ◆ createLease4GetPage()

ConstElementPtr isc::ha::CommandCreator::createLease4GetPage | ( | const dhcp::Lease4Ptr & | lease4,
|  | const uint32_t | limit )
| static

Creates lease4-get-page command.

Parameters

  lease4 | Pointer to the last lease returned on the previous page of leases. This lease is used to set the value of the "from" parameter in the lease4-get-page command. If this command is sent to fetch the first page, the `lease4` parameter should be set to null.
  limit | Limit of leases on the page.

Returns
  Pointer to the JSON representation of the command.

Definition at line 121 of file command_creator.cc.

References Element::create(), isc::config::createCommand(), Element::createMap(), isc::ha::DHCPv4, and isc_throw.

Referenced by isc::ha::HAService::asyncSyncLeasesInternal().

Here is the call graph for this function:

## ◆ createLease4Update()

ConstElementPtr isc::ha::CommandCreator::createLease4Update | ( | const dhcp::Lease4 & | lease4 | ) |
| static

Creates lease4-update command.

It adds "force-create" parameter to the lease information to force the remote server to create the lease if it doesn't exist in its lease database.

Parameters

  lease4 | Reference to a lease for which the command should be created.

Returns
  Pointer to the JSON representation of the command.

Definition at line 93 of file command_creator.cc.

References Element::create(), isc::config::createCommand(), isc::ha::DHCPv4, and isc::dhcp::Lease4::toElement().

Referenced by isc::ha::HAService::asyncSendLeaseUpdates(), and isc::ha::HAService::asyncSendLeaseUpdatesFromBacklog().

Here is the call graph for this function:

## ◆ createLease6BulkApply() [1/2]

ConstElementPtr isc::ha::CommandCreator::createLease6BulkApply | ( | const dhcp::Lease6CollectionPtr & | leases,
|  | const dhcp::Lease6CollectionPtr & | deleted_leases )
| static

Creates lease6-bulk-apply command.

Parameters

  leases | Pointer to the collection of leases to be created or/and updated.
  deleted_leases | Pointer to the collection of leases to be deleted.

Returns
  Pointer to the JSON representation of the command.

Definition at line 146 of file command_creator.cc.

References Element::create(), isc::config::createCommand(), Element::createList(), Element::createMap(), isc::ha::DHCPv6, and isc::dhcp::Lease::STATE_RELEASED.

Referenced by isc::ha::HAService::asyncSendLeaseUpdates(), and isc::ha::HAService::asyncSendLeaseUpdatesFromBacklog().

Here is the call graph for this function:

## ◆ createLease6BulkApply() [2/2]

ConstElementPtr isc::ha::CommandCreator::createLease6BulkApply | ( | LeaseUpdateBacklog & | leases | ) |
| static

Creates lease6-bulk-apply command.

This command pops the leases from the backlog. As a result, the backlog is empty after calling this function.

Parameters

  leases | Reference to the collection of DHCPv6 leases backlog.

Returns
  Pointer to the JSON representation of the command.

Definition at line 181 of file command_creator.cc.

References Element::create(), isc::config::createCommand(), Element::createList(), Element::createMap(), isc::ha::LeaseUpdateBacklog::DELETE, isc::ha::DHCPv6, and isc::ha::LeaseUpdateBacklog::pop().

Here is the call graph for this function:

## ◆ createLease6Delete()

ConstElementPtr isc::ha::CommandCreator::createLease6Delete | ( | const dhcp::Lease6 & | lease6 | ) |
| static

Creates lease6-del command.

Parameters

  lease6 | Reference to a lease for which the command should be created.

Returns
  Pointer to the JSON representation of the command.

Definition at line 219 of file command_creator.cc.

References Element::create(), isc::config::createCommand(), isc::ha::DHCPv6, and isc::dhcp::Lease6::toElement().

Here is the call graph for this function:

## ◆ createLease6GetAll()

ConstElementPtr isc::ha::CommandCreator::createLease6GetAll | ( |  | ) |
| static

Creates lease6-get-all command.

Returns
  Pointer to the JSON representation of the command.

Definition at line 229 of file command_creator.cc.

References isc::config::createCommand(), and isc::ha::DHCPv6.

Here is the call graph for this function:

## ◆ createLease6GetPage()

ConstElementPtr isc::ha::CommandCreator::createLease6GetPage | ( | const dhcp::Lease6Ptr & | lease6,
|  | const uint32_t | limit )
| static

Creates lease6-get-page command.

Parameters

  lease6 | Pointer to the last lease returned on the previous page of leases. This lease is used to set the value of the "from" parameter in the lease6-get-page command. If this command is sent to fetch the first page, the `lease6` parameter should be set to null.
  limit | Limit of leases on the page.

Returns
  Pointer to the JSON representation of the command.

Definition at line 236 of file command_creator.cc.

References Element::create(), isc::config::createCommand(), Element::createMap(), isc::ha::DHCPv6, and isc_throw.

Referenced by isc::ha::HAService::asyncSyncLeasesInternal().

Here is the call graph for this function:

## ◆ createLease6Update()

ConstElementPtr isc::ha::CommandCreator::createLease6Update | ( | const dhcp::Lease6 & | lease6 | ) |
| static

Creates lease6-update command.

It adds "force-create" parameter to the lease information to force the remote server to create the lease if it doesn't exist in its lease database.

Parameters

  lease6 | Reference to a lease for which the command should be created.

Returns
  Pointer to the JSON representation of the command.

Definition at line 208 of file command_creator.cc.

References Element::create(), isc::config::createCommand(), isc::ha::DHCPv6, and isc::dhcp::Lease6::toElement().

Here is the call graph for this function:

## ◆ createMaintenanceNotify()

ConstElementPtr isc::ha::CommandCreator::createMaintenanceNotify | ( | const std::string & | server_name,
|  | const bool | cancel,
|  | const int | state,
|  | const HAServerType & | server_type )
| static

Creates ha-maintenance-notify command.

Parameters

  server_name | name of the server sending the command allowing for associating the command with the relationship.
  cancel | boolean value indicating if the maintenance is being cancelled (true) or requested (false).
  state | server state.
  server_type | type of the DHCP server, i.e. v4 or v6.

Returns
  Pointer to the JSON representation of the command.

Definition at line 261 of file command_creator.cc.

References Element::create(), isc::config::createCommand(), Element::createMap(), and isc::ha::stateToString().

Referenced by isc::ha::HAService::processMaintenanceCancel(), and isc::ha::HAService::processMaintenanceStart().

Here is the call graph for this function:

## ◆ createSyncCompleteNotify()

ConstElementPtr isc::ha::CommandCreator::createSyncCompleteNotify | ( | const unsigned int | origin_id,
|  | const std::string & | server_name,
|  | const HAServerType & | server_type )
| static

Creates ha-sync-complete-notify command.

Parameters

  origin_id | a numeric value of the origin created from the `HAService` identifier to enable the DHCP service.
  server_name | name of the server sending the command allowing for associating the command with the relationship.
  server_type | type of the DHCP server, i.e. v4 or v6.

Returns
  Pointer to the JSON representation of the command.

Definition at line 275 of file command_creator.cc.

References Element::create(), isc::config::createCommand(), and Element::createMap().

Referenced by isc::ha::HAService::asyncSyncCompleteNotify().

Here is the call graph for this function:

## Member Data Documentation

## ◆ ha_commands4_

unordered_set< string > isc::ha::CommandCreator::ha_commands4_
| static

Initial value:
= {
"list-commands", "status-get",
"dhcp-disable", "dhcp-enable",
"ha-reset", "ha-heartbeat",
"lease4-update", "lease4-del",
"lease4-get-all", "lease4-get-page",
"ha-maintenance-notify", "ha-sync-complete-notify"
}

List of commands used by the High Availability in v4.

Definition at line 202 of file command_creator.h.

Referenced by isc::ha::HAService::HAService().

## ◆ ha_commands6_

unordered_set< string > isc::ha::CommandCreator::ha_commands6_
| static

Initial value:
= {
"list-commands", "status-get",
"dhcp-disable", "dhcp-enable",
"ha-reset", "ha-heartbeat",
"lease6-bulk-apply",
"lease6-update", "lease6-del",
"lease6-get-all", "lease6-get-page",
"ha-maintenance-notify", "ha-sync-complete-notify"
}

List of commands used by the High Availability in v6.

Definition at line 205 of file command_creator.h.

Referenced by isc::ha::HAService::HAService().

The documentation for this class was generated from the following files:

- command_creator.h
- command_creator.cc