Kea: check_exists_add.h Source File

| Kea 3.2.0-git

check_exists_add.h
Go to the documentation of this file.
1// Copyright (C) 2023-2025 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 CHECK_EXISTS_ADD_H
8#define CHECK_EXISTS_ADD_H
9
11
12#include <d2srv/nc_trans.h>
13#include <dns/rdata.h>
14
15namespace isc {
16namespace d2 {
17
19 class CheckExistsAddTransactionError : public isc::Exception {
20public:
21 CheckExistsAddTransactionError(const char* file, size_t line,
22 const char* what) :
23 isc::Exception(file, line, what) { }
24};
25
52 class CheckExistsAddTransaction : public NameChangeTransaction {
53public:
54
56
57 static const int ADDING_FWD_ADDRS_ST = NCT_DERIVED_STATE_MIN + 1;
58
60 static const int REPLACING_FWD_ADDRS_ST = NCT_DERIVED_STATE_MIN + 2;
61
63 static const int REPLACING_REV_PTRS_ST = NCT_DERIVED_STATE_MIN + 3;
65
67
68 static const int FQDN_IN_USE_EVT = NCT_DERIVED_EVENT_MIN + 1;
69
71 static const int FQDN_NOT_IN_USE_EVT = NCT_DERIVED_EVENT_MIN + 2;
73
86 CheckExistsAddTransaction(asiolink::IOServicePtr& io_service,
87 dhcp_ddns::NameChangeRequestPtr& ncr,
88 DdnsDomainPtr& forward_domain,
89 DdnsDomainPtr& reverse_domain,
90 D2CfgMgrPtr& cfg_mgr);
91
93 virtual ~CheckExistsAddTransaction();
94
95protected:
102 virtual void defineEvents();
103
111 virtual void verifyEvents();
112
119 virtual void defineStates();
120
128 virtual void verifyStates();
129
150 void readyHandler();
151
174 void selectingFwdServerHandler();
175
199 void selectingRevServerHandler();
200
249 void addingFwdAddrsHandler();
250
301 void replacingFwdAddrsHandler();
302
343 void replacingRevPtrsHandler();
344
360 void processAddOkHandler();
361
379 void processAddFailedHandler();
380
397 void buildAddFwdAddressRequest();
398
417 void buildReplaceFwdAddressRequest();
418
437 void buildReplaceRevPtrsRequest();
438};
439
441 typedef boost::shared_ptr<CheckExistsAddTransaction> CheckExistsAddTransactionPtr;
442
443} // namespace isc::d2
444} // namespace isc
445#endif
isc::Exception
This is a base class for exceptions thrown from the DNS library module.
Definition exceptions/exceptions.h:23
isc::Exception::Exception
Exception(const char *file, size_t line, const char *what)
Constructor for a given type for exceptions with file name and file line number.
Definition exceptions/exceptions.cc:17
isc::Exception::what
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Definition exceptions/exceptions.cc:32
isc::d2::CheckExistsAddTransactionError::CheckExistsAddTransactionError
CheckExistsAddTransactionError(const char *file, size_t line, const char *what)
Definition check_exists_add.h:21
isc::d2::CheckExistsAddTransaction::FQDN_IN_USE_EVT
static const int FQDN_IN_USE_EVT
Event sent when an add attempt fails with address in use.
Definition check_exists_add.h:68
isc::d2::CheckExistsAddTransaction::buildReplaceFwdAddressRequest
void buildReplaceFwdAddressRequest()
Builds a DNS request to replace forward DNS entry for an FQDN.
Definition check_exists_add.cc:640
isc::d2::CheckExistsAddTransaction::selectingRevServerHandler
void selectingRevServerHandler()
State handler for SELECTING_REV_SERVER_ST.
Definition check_exists_add.cc:419
isc::d2::CheckExistsAddTransaction::verifyStates
virtual void verifyStates()
Validates the contents of the set of states.
Definition check_exists_add.cc:107
isc::d2::CheckExistsAddTransaction::verifyEvents
virtual void verifyEvents()
Validates the contents of the set of events.
Definition check_exists_add.cc:58
isc::d2::CheckExistsAddTransaction::REPLACING_FWD_ADDRS_ST
static const int REPLACING_FWD_ADDRS_ST
State that attempts to replace forward address records.
Definition check_exists_add.h:60
isc::d2::CheckExistsAddTransaction::replacingRevPtrsHandler
void replacingRevPtrsHandler()
State handler for REPLACING_REV_PTRS_ST.
Definition check_exists_add.cc:449
isc::d2::CheckExistsAddTransaction::ADDING_FWD_ADDRS_ST
static const int ADDING_FWD_ADDRS_ST
State that attempts to add forward address records.
Definition check_exists_add.h:57
isc::d2::CheckExistsAddTransaction::addingFwdAddrsHandler
void addingFwdAddrsHandler()
State handler for ADD_FWD_ADDRS_ST.
Definition check_exists_add.cc:172
isc::d2::CheckExistsAddTransaction::processAddOkHandler
void processAddOkHandler()
State handler for PROCESS_TRANS_OK_ST.
Definition check_exists_add.cc:563
isc::d2::CheckExistsAddTransaction::buildReplaceRevPtrsRequest
void buildReplaceRevPtrsRequest()
Builds a DNS request to replace a reverse DNS entry for an FQDN.
Definition check_exists_add.cc:690
isc::d2::CheckExistsAddTransaction::defineEvents
virtual void defineEvents()
Adds events defined by CheckExistsAddTransaction to the event set.
Definition check_exists_add.cc:48
isc::d2::CheckExistsAddTransaction::REPLACING_REV_PTRS_ST
static const int REPLACING_REV_PTRS_ST
State that attempts to replace reverse PTR records.
Definition check_exists_add.h:63
isc::d2::CheckExistsAddTransaction::buildAddFwdAddressRequest
void buildAddFwdAddressRequest()
Builds a DNS request to add an forward DNS entry for an FQDN.
Definition check_exists_add.cc:598
isc::d2::CheckExistsAddTransaction::processAddFailedHandler
void processAddFailedHandler()
State handler for PROCESS_TRANS_FAILED_ST.
Definition check_exists_add.cc:580
isc::d2::CheckExistsAddTransaction::CheckExistsAddTransaction
CheckExistsAddTransaction(asiolink::IOServicePtr &io_service, dhcp_ddns::NameChangeRequestPtr &ncr, DdnsDomainPtr &forward_domain, DdnsDomainPtr &reverse_domain, D2CfgMgrPtr &cfg_mgr)
Constructor.
Definition check_exists_add.cc:31
isc::d2::CheckExistsAddTransaction::replacingFwdAddrsHandler
void replacingFwdAddrsHandler()
State handler for REPLACING_FWD_ADDRS_ST.
Definition check_exists_add.cc:292
isc::d2::CheckExistsAddTransaction::readyHandler
void readyHandler()
State handler for READY_ST.
Definition check_exists_add.cc:124
isc::d2::CheckExistsAddTransaction::~CheckExistsAddTransaction
virtual ~CheckExistsAddTransaction()
Destructor.
Definition check_exists_add.cc:44
isc::d2::CheckExistsAddTransaction::selectingFwdServerHandler
void selectingFwdServerHandler()
State handler for SELECTING_FWD_SERVER_ST.
Definition check_exists_add.cc:144
isc::d2::CheckExistsAddTransaction::FQDN_NOT_IN_USE_EVT
static const int FQDN_NOT_IN_USE_EVT
Event sent when replace attempt to fails with address not in use.
Definition check_exists_add.h:71
isc::d2::CheckExistsAddTransaction::defineStates
virtual void defineStates()
Adds states defined by CheckExistsAddTransaction to the state set.
Definition check_exists_add.cc:76
isc::d2::NameChangeTransaction::NameChangeTransaction
NameChangeTransaction(asiolink::IOServicePtr &io_service, dhcp_ddns::NameChangeRequestPtr &ncr, DdnsDomainPtr &forward_domain, DdnsDomainPtr &reverse_domain, D2CfgMgrPtr &cfg_mgr)
Constructor.
Definition nc_trans.cc:69
isc::d2::NameChangeTransaction::NCT_DERIVED_STATE_MIN
static const int NCT_DERIVED_STATE_MIN
Value at which custom states in a derived class should begin.
Definition nc_trans.h:108
isc::d2::NameChangeTransaction::NCT_DERIVED_EVENT_MIN
static const int NCT_DERIVED_EVENT_MIN
Value at which custom events in a derived class should begin.
Definition nc_trans.h:144
isc::asiolink::IOServicePtr
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
Definition io_service.h:35
isc::d2
Definition check_exists_add.cc:19
isc::d2::DdnsDomainPtr
boost::shared_ptr< DdnsDomain > DdnsDomainPtr
Defines a pointer for DdnsDomain instances.
Definition d2_config.h:624
isc::d2::D2CfgMgrPtr
boost::shared_ptr< D2CfgMgr > D2CfgMgrPtr
Defines a shared pointer to D2CfgMgr.
Definition d2_cfg_mgr.h:367
isc::d2::CheckExistsAddTransactionPtr
boost::shared_ptr< CheckExistsAddTransaction > CheckExistsAddTransactionPtr
Defines a pointer to a CheckExistsAddTransaction.
Definition check_exists_add.h:441
isc::dhcp_ddns::NameChangeRequestPtr
boost::shared_ptr< NameChangeRequest > NameChangeRequestPtr
Defines a pointer to a NameChangeRequest.
Definition ncr_msg.h:241
isc::util::file
Definition filesystem.cc:29
isc
Defines the logger used by the top-level component of kea-lfc.
Definition check_exists_add.cc:18
nc_trans.h
This file defines the class NameChangeTransaction.
rdata.h