Kea 2.7.5
isc::d2::NameRemoveTransaction Class Reference

Embodies the "life-cycle" required to carry out a DDNS Remove update. More...

#include <nc_remove.h>

+ Inheritance diagram for isc::d2::NameRemoveTransaction:

Public Member Functions

 NameRemoveTransaction (asiolink::IOServicePtr &io_service, dhcp_ddns::NameChangeRequestPtr &ncr, DdnsDomainPtr &forward_domain, DdnsDomainPtr &reverse_domain, D2CfgMgrPtr &cfg_mgr)
 Event sent when replace attempt to fails with address not in use.
 
virtual ~NameRemoveTransaction ()
 Destructor.
 
- Public Member Functions inherited from isc::d2::NameChangeTransaction
 NameChangeTransaction (asiolink::IOServicePtr &io_service, dhcp_ddns::NameChangeRequestPtr &ncr, DdnsDomainPtr &forward_domain, DdnsDomainPtr &reverse_domain, D2CfgMgrPtr &cfg_mgr)
 Constructor.
 
virtual ~NameChangeTransaction ()
 Destructor.
 
const dns::RRTypegetAddressRRType () const
 Returns the DHCP data type for the lease address.
 
const DnsServerInfoPtrgetCurrentServer () const
 Fetches the currently selected server.
 
const DNSClientPtrgetDNSClient () const
 Fetches the DNSClient instance.
 
const D2UpdateMessagePtrgetDnsUpdateRequest () const
 Fetches the current DNS update request packet.
 
const D2UpdateMessagePtrgetDnsUpdateResponse () const
 Fetches the most recent DNS update response packet.
 
DNSClient::Status getDnsUpdateStatus () const
 Fetches the most recent DNS update status.
 
bool getForwardChangeCompleted () const
 Returns whether the forward change has completed or not.
 
DdnsDomainPtrgetForwardDomain ()
 Fetches the forward DdnsDomain.
 
const dhcp_ddns::NameChangeRequestPtrgetNcr () const
 Fetches the NameChangeRequest for this transaction.
 
dhcp_ddns::NameChangeStatus getNcrStatus () const
 Fetches the NameChangeRequest status of the transaction.
 
std::string getRequestId () const
 Fetches the request id that identifies this transaction.
 
bool getReverseChangeCompleted () const
 Returns whether the reverse change has completed or not.
 
DdnsDomainPtrgetReverseDomain ()
 Fetches the reverse DdnsDomain.
 
const TransactionKeygetTransactionKey () const
 Fetches the unique key that identifies this transaction.
 
size_t getUpdateAttempts () const
 Fetches the update attempt count for the current update.
 
virtual void operator() (DNSClient::Status status)
 Serves as the DNSClient IO completion event handler.
 
void startTransaction ()
 Begins execution of the transaction.
 
- Public Member Functions inherited from isc::d2::DNSClient::Callback
virtual ~Callback ()
 Virtual destructor.
 
- Public Member Functions inherited from isc::util::StateModel
 StateModel ()
 Constructor.
 
virtual ~StateModel ()
 Destructor.
 
bool didModelFail () const
 Returns whether or not the model failed.
 
void endModel ()
 Conducts a normal transition to the end of the model.
 
std::string getContextStr () const
 Convenience method which returns a string rendition of the current state and next event.
 
unsigned int getCurrState () const
 Fetches the model's current state.
 
std::string getEventLabel (const int event) const
 Fetches the label associated with an event value.
 
unsigned int getLastEvent () const
 Fetches the model's last event.
 
unsigned int getNextEvent () const
 Fetches the model's next event.
 
std::string getPrevContextStr () const
 Convenience method which returns a string rendition of the previous state and last event.
 
unsigned int getPrevState () const
 Fetches the model's previous state.
 
std::string getStateLabel (const int state) const
 Fetches the label associated with an state value.
 
bool isModelDone () const
 Returns whether or not the model has finished execution.
 
bool isModelNew () const
 Returns whether or not the model is new.
 
bool isModelPaused () const
 Returns whether or not the model is paused.
 
bool isModelRunning () const
 Returns whether or not the model is running.
 
bool isModelWaiting () const
 Returns whether or not the model is waiting.
 
void nopStateHandler ()
 An empty state handler.
 
virtual void runModel (unsigned int event)
 Processes events through the state model.
 
void startModel (const int start_state)
 Begins execution of the model.
 
void unpauseModel ()
 Unpauses state model.
 

Static Public Attributes

static const int REMOVING_FWD_ADDRS_ST = NCT_DERIVED_STATE_MIN + 1
 State that attempts to remove specific forward address record.
 
static const int REMOVING_FWD_RRS_ST = NCT_DERIVED_STATE_MIN + 2
 State that attempts to remove any other forward RRs for the DHCID.
 
static const int REMOVING_REV_PTRS_ST = NCT_DERIVED_STATE_MIN + 3
 State that attempts to remove reverse PTR records.
 
- Static Public Attributes inherited from isc::d2::NameChangeTransaction
static const unsigned int DNS_UPDATE_DEFAULT_TIMEOUT = 100
 Default time to assign to a single DNS update.
 
static const int IO_COMPLETED_EVT = SM_DERIVED_EVENT_MIN + 5
 Issued when a DNS update packet exchange has completed.
 
static const unsigned int MAX_UPDATE_TRIES_PER_SERVER = 3
 Maximum times to attempt a single update on a given server.
 
static const int NCT_DERIVED_EVENT_MIN = SM_DERIVED_EVENT_MIN + 101
 Value at which custom events in a derived class should begin.
 
static const int NCT_DERIVED_STATE_MIN = SM_DERIVED_STATE_MIN + 101
 Value at which custom states in a derived class should begin.
 
static const int NO_MORE_SERVERS_EVT =SM_DERIVED_EVENT_MIN + 4
 Issued when there are no more servers from which to select.
 
static const int PROCESS_TRANS_FAILED_ST = SM_DERIVED_STATE_MIN + 5
 State which processes an unsuccessful transaction conclusion.
 
static const int PROCESS_TRANS_OK_ST = SM_DERIVED_STATE_MIN + 4
 State which processes successful transaction conclusion.
 
static const int READY_ST = SM_DERIVED_STATE_MIN + 1
 State from which a transaction is started.
 
static const int SELECT_SERVER_EVT = SM_DERIVED_EVENT_MIN + 1
 Issued when a server needs to be selected.
 
static const int SELECTING_FWD_SERVER_ST = SM_DERIVED_STATE_MIN + 2
 State in which forward DNS server selection is done.
 
static const int SELECTING_REV_SERVER_ST = SM_DERIVED_STATE_MIN + 3
 State in which reverse DNS server selection is done.
 
static const int SERVER_IO_ERROR_EVT = SM_DERIVED_EVENT_MIN + 3
 Issued when an update fails due to an IO error.
 
static const int SERVER_SELECTED_EVT = SM_DERIVED_EVENT_MIN + 2
 Issued when a server has been selected.
 
static const int UPDATE_FAILED_EVT = SM_DERIVED_EVENT_MIN + 7
 Issued when the attempted update fails to complete.
 
static const int UPDATE_OK_EVT = SM_DERIVED_EVENT_MIN + 6
 Issued when the attempted update successfully completed.
 
- Static Public Attributes inherited from isc::util::StateModel
static const int END_EVT = 2
 Event issued to end the model execution.
 
static const int END_ST = 1
 Final state, all the state model has reached its conclusion.
 
static const int FAIL_EVT = 3
 Event issued to abort the model execution.
 
static const int NEW_ST = 0
 State that a state model is in immediately after construction.
 
static const int NOP_EVT = 0
 Signifies that no event has occurred.
 
static const int SM_DERIVED_EVENT_MIN = 11
 Value at which custom events in a derived class should begin.
 
static const int SM_DERIVED_STATE_MIN = 11
 Value at which custom states in a derived class should begin.
 
static const int START_EVT = 1
 Event issued to start the model execution.
 

Protected Member Functions

void buildRemoveFwdAddressRequest ()
 Builds a DNS request to remove a forward DNS address for a FQDN.
 
void buildRemoveFwdRRsRequest ()
 Builds a DNS request to remove all forward DNS RRs for a FQDN.
 
void buildRemoveRevPtrsRequest ()
 Builds a DNS request to remove a reverse DNS entry for a FQDN.
 
virtual void defineEvents ()
 Adds events defined by NameRemoveTransaction to the event set.
 
virtual void defineStates ()
 Adds states defined by NameRemoveTransaction to the state set.
 
void processRemoveFailedHandler ()
 State handler for PROCESS_TRANS_FAILED_ST.
 
void processRemoveOkHandler ()
 State handler for PROCESS_TRANS_OK_ST.
 
void readyHandler ()
 State handler for READY_ST.
 
void removingFwdAddrsHandler ()
 State handler for REMOVING_FWD_ADDRS_ST.
 
void removingFwdRRsHandler ()
 State handler for REMOVING_FWD_RRS_ST.
 
void removingRevPtrsHandler ()
 State handler for REMOVING_REV_PTRS_ST.
 
void selectingFwdServerHandler ()
 State handler for SELECTING_FWD_SERVER_ST.
 
void selectingRevServerHandler ()
 State handler for SELECTING_REV_SERVER_ST.
 
virtual void verifyEvents ()
 Validates the contents of the set of events.
 
virtual void verifyStates ()
 Validates the contents of the set of states.
 
- Protected Member Functions inherited from isc::d2::NameChangeTransaction
void addDhcidRdata (dns::RRsetPtr &rrset)
 Adds an RData for the lease client's DHCID to the given RRset.
 
void addLeaseAddressRdata (dns::RRsetPtr &rrset)
 Adds an RData for the lease address to the given RRset.
 
void addPtrRdata (dns::RRsetPtr &rrset)
 Adds an RData for the lease FQDN to the given RRset.
 
void clearDnsUpdateRequest ()
 Destroys the current update request packet.
 
void clearDnsUpdateResponse ()
 Destroys the current update response packet.
 
void clearUpdateAttempts ()
 Resets the update attempts count.
 
const asiolink::IOServicePtrgetIOService ()
 Fetches the IOService the transaction uses for IO processing.
 
void initServerSelection (const DdnsDomainPtr &domain)
 Initializes server selection from the given DDNS domain.
 
virtual void onModelFailure (const std::string &explanation)
 Handler for fatal model execution errors.
 
virtual D2UpdateMessagePtr prepNewRequest (DdnsDomainPtr domain)
 Creates a new DNS update request based on the given domain.
 
std::string responseString () const
 Returns a string version of the current response status and rcode.
 
void retryTransition (const int fail_to_state)
 Determines the state and next event based on update attempts.
 
bool selectNextServer ()
 Selects the next server in the current server list.
 
bool selectTSIGKey ()
 Selects the TSIG key.
 
virtual void sendUpdate (const std::string &comment="")
 Send the update request to the current server.
 
void setDnsUpdateRequest (D2UpdateMessagePtr &request)
 Sets the update request packet to the given packet.
 
void setDnsUpdateResponse (D2UpdateMessagePtr &response)
 Sets the update response packet to the given packet.
 
void setDnsUpdateStatus (const DNSClient::Status &status)
 Sets the update status to the given status value.
 
void setForwardChangeCompleted (const bool value)
 Sets the forward change completion flag to the given value.
 
void setNcrStatus (const dhcp_ddns::NameChangeStatus &status)
 Sets the status of the transaction's NameChangeRequest.
 
void setReverseChangeCompleted (const bool value)
 Sets the reverse change completion flag to the given value.
 
void setUpdateAttempts (const size_t value)
 Sets the update attempt count to the given value.
 
std::string transactionOutcomeString () const
 Returns a string version of transaction outcome.
 
- Protected Member Functions inherited from isc::util::StateModel
void abortModel (const std::string &explanation)
 Aborts model execution.
 
void defineEvent (unsigned int value, const std::string &label)
 Adds an event value and associated label to the set of events.
 
void defineState (unsigned int value, const std::string &label, StateHandler handler, const StatePausing &state_pausing=STATE_PAUSE_NEVER)
 Adds an state value and associated label to the set of states.
 
bool doOnEntry ()
 Checks if on entry flag is true.
 
bool doOnExit ()
 Checks if on exit flag is true.
 
const EventPtrgetEvent (unsigned int value)
 Fetches the event referred to by value.
 
const StatePtr getState (unsigned int value)
 Fetches the state referred to by value.
 
const StatePtr getStateInternal (unsigned int value)
 Fetches the state referred to by value.
 
void initDictionaries ()
 Initializes the event and state dictionaries.
 
void postNextEvent (unsigned int event)
 Sets the next event to the given event value.
 
void setState (unsigned int state)
 Sets the current state to the given state value.
 
void transition (unsigned int state, unsigned int event)
 Sets up the model to transition into given state with a given event.
 

Detailed Description

Embodies the "life-cycle" required to carry out a DDNS Remove update.

NameRemoveTransaction implements a state machine for removing a forward and/or reverse DNS mappings. This state machine is based upon the processing logic described in RFC 4703, Section 5.5. That logic may be paraphrased as follows:

If the request includes a forward change:
Select a forward server
Send the server a request to remove client's specific forward address RR
If it succeeds or the server responds with name no longer in use
Send a server a request to delete any other RRs for that FQDN, such
as the DHCID RR.
otherwise
abandon the update
If the request includes a reverse change:
Select a reverse server
Send a server a request to delete reverse entry (PTR RR)

This class derives from NameChangeTransaction from which it inherits states, events, and methods common to NameChangeRequest processing.

Definition at line 51 of file nc_remove.h.

Constructor & Destructor Documentation

◆ NameRemoveTransaction()

isc::d2::NameRemoveTransaction::NameRemoveTransaction ( asiolink::IOServicePtr & io_service,
dhcp_ddns::NameChangeRequestPtr & ncr,
DdnsDomainPtr & forward_domain,
DdnsDomainPtr & reverse_domain,
D2CfgMgrPtr & cfg_mgr )

Event sent when replace attempt to fails with address not in use.

Todo
Currently none have been identified.

Constructor

Instantiates an Remove transaction that is ready to be started.

Parameters
io_serviceIO service to be used for IO processing
ncris the NameChangeRequest to fulfill
forward_domainis the domain to use for forward DNS updates
reverse_domainis the domain to use for reverse DNS updates
cfg_mgrpointer to the configuration manager
Exceptions
NameRemoveTransactionerror if given request is not a CHG_REMOVE, NameChangeTransaction error for base class construction errors.

Definition at line 27 of file nc_remove.cc.

References isc::dhcp_ddns::CHG_REMOVE, and isc_throw.

◆ ~NameRemoveTransaction()

isc::d2::NameRemoveTransaction::~NameRemoveTransaction ( )
virtual

Destructor.

Definition at line 41 of file nc_remove.cc.

Member Function Documentation

◆ buildRemoveFwdAddressRequest()

void isc::d2::NameRemoveTransaction::buildRemoveFwdAddressRequest ( )
protected

Builds a DNS request to remove a forward DNS address for a FQDN.

Constructs a DNS update request, based upon the NCR, for removing a forward DNS address mapping. Once constructed, the request is stored as the transaction's DNS update request.

The request content is adherent to RFC 4703 section 5.5, paragraph 4.

Prerequisite RRsets:

  1. An assertion that a matching DHCID RR exists

Updates RRsets:

  1. A delete of the FQDN/IP RR (type A for IPv4, AAAA for IPv6)
Exceptions
Thismethod does not throw but underlying methods may.

Definition at line 614 of file nc_remove.cc.

References isc::d2::NameChangeTransaction::addDhcidRdata(), isc::d2::NameChangeTransaction::addLeaseAddressRdata(), isc::dns::RRType::DHCID(), isc::d2::NameChangeTransaction::getAddressRRType(), isc::d2::NameChangeTransaction::getForwardDomain(), isc::d2::NameChangeTransaction::getNcr(), isc::dns::RRClass::IN(), isc::dns::RRClass::NONE(), isc::d2::NameChangeTransaction::prepNewRequest(), isc::d2::D2UpdateMessage::SECTION_PREREQUISITE, isc::d2::D2UpdateMessage::SECTION_UPDATE, and isc::d2::NameChangeTransaction::setDnsUpdateRequest().

Referenced by removingFwdAddrsHandler().

+ Here is the call graph for this function:

◆ buildRemoveFwdRRsRequest()

void isc::d2::NameRemoveTransaction::buildRemoveFwdRRsRequest ( )
protected

Builds a DNS request to remove all forward DNS RRs for a FQDN.

Constructs a DNS update request, based upon the NCR, for removing any remaining forward DNS RRs, once all A or AAAA entries for the FQDN have been removed. Once constructed, the request is stored as the transaction's DNS update request.

The request content is adherent to RFC 4703 section 5.5, paragraph 5.

Prerequisite RRsets:

  1. An assertion that a matching DHCID RR exists
  2. An assertion that no A RRs for the FQDN exist
  3. An assertion that no AAAA RRs for the FQDN exist

Updates RRsets:

  1. A delete of all RRs for the FQDN
Exceptions
Thismethod does not throw but underlying methods may.

Definition at line 646 of file nc_remove.cc.

References isc::dns::RRType::A(), isc::dns::RRType::AAAA(), isc::d2::NameChangeTransaction::addDhcidRdata(), isc::dns::RRClass::ANY(), isc::dns::RRType::ANY(), isc::dns::RRType::DHCID(), isc::d2::NameChangeTransaction::getForwardDomain(), isc::d2::NameChangeTransaction::getNcr(), isc::dns::RRClass::IN(), isc::dns::RRClass::NONE(), isc::d2::NameChangeTransaction::prepNewRequest(), isc::d2::D2UpdateMessage::SECTION_PREREQUISITE, isc::d2::D2UpdateMessage::SECTION_UPDATE, and isc::d2::NameChangeTransaction::setDnsUpdateRequest().

Referenced by removingFwdRRsHandler().

+ Here is the call graph for this function:

◆ buildRemoveRevPtrsRequest()

void isc::d2::NameRemoveTransaction::buildRemoveRevPtrsRequest ( )
protected

Builds a DNS request to remove a reverse DNS entry for a FQDN.

Constructs a DNS update request, based upon the NCR, for removing a reverse DNS mapping. Once constructed, the request is stored as the transaction's DNS update request.

The request content is adherent to RFC 4703 section 5.5, paragraph 2:

Prerequisite RRsets:

  1. An assertion that a PTR record matching the client's FQDN exists.

Updates RRsets:

  1. A delete of all RRs for the FQDN
Exceptions
Thismethod does not throw but underlying methods may.

Definition at line 694 of file nc_remove.cc.

References isc::d2::NameChangeTransaction::addPtrRdata(), isc::dns::RRClass::ANY(), isc::dns::RRType::ANY(), isc::d2::NameChangeTransaction::getNcr(), isc::d2::NameChangeTransaction::getReverseDomain(), isc::dns::RRClass::IN(), isc::d2::NameChangeTransaction::prepNewRequest(), isc::dns::RRType::PTR(), isc::d2::D2CfgMgr::reverseIpAddress(), isc::d2::D2UpdateMessage::SECTION_PREREQUISITE, isc::d2::D2UpdateMessage::SECTION_UPDATE, and isc::d2::NameChangeTransaction::setDnsUpdateRequest().

Referenced by removingRevPtrsHandler().

+ Here is the call graph for this function:

◆ defineEvents()

void isc::d2::NameRemoveTransaction::defineEvents ( )
protectedvirtual

Adds events defined by NameRemoveTransaction to the event set.

Invokes NameChangeTransaction's implementation and then defines the events unique to NCR Remove transaction processing.

Exceptions
StateModelErrorif an event definition is invalid or a duplicate.

Reimplemented from isc::d2::NameChangeTransaction.

Definition at line 45 of file nc_remove.cc.

References isc::d2::NameChangeTransaction::defineEvents().

+ Here is the call graph for this function:

◆ defineStates()

void isc::d2::NameRemoveTransaction::defineStates ( )
protectedvirtual

Adds states defined by NameRemoveTransaction to the state set.

Invokes NameChangeTransaction's implementation and then defines the states unique to NCR Remove transaction processing.

Exceptions
StateModelErrorif an state definition is invalid or a duplicate.

Reimplemented from isc::d2::NameChangeTransaction.

Definition at line 73 of file nc_remove.cc.

References isc::util::StateModel::defineState(), isc::d2::NameChangeTransaction::defineStates(), isc::d2::NameChangeTransaction::PROCESS_TRANS_FAILED_ST, isc::d2::NameChangeTransaction::PROCESS_TRANS_OK_ST, processRemoveFailedHandler(), processRemoveOkHandler(), isc::d2::NameChangeTransaction::READY_ST, readyHandler(), REMOVING_FWD_ADDRS_ST, REMOVING_FWD_RRS_ST, REMOVING_REV_PTRS_ST, removingFwdAddrsHandler(), removingFwdRRsHandler(), removingRevPtrsHandler(), isc::d2::NameChangeTransaction::SELECTING_FWD_SERVER_ST, isc::d2::NameChangeTransaction::SELECTING_REV_SERVER_ST, selectingFwdServerHandler(), and selectingRevServerHandler().

+ Here is the call graph for this function:

◆ processRemoveFailedHandler()

void isc::d2::NameRemoveTransaction::processRemoveFailedHandler ( )
protected

State handler for PROCESS_TRANS_FAILED_ST.

Entered from:

  • SELECTING_FWD_SERVER_ST with a next event of NO_MORE_SERVERS
  • REMOVING_FWD_ADDRS_ST with a next event of UPDATE_FAILED_EVT
  • REMOVING_FWD_RRS_ST with a next event of UPDATE_FAILED_EVT
  • REMOVING_FWD_RRS_ST with a next event of SERVER_IO_ERROR_EVT
  • SELECTING_REV_SERVER_ST with a next event of NO_MORE_SERVERS
  • REMOVING_REV_PTRS_ST with a next event of UPDATE_FAILED_EVT

Sets the transaction status to indicate failure and ends model execution.

Transitions to:

  • END_ST with a next event of FAIL_EVT.
Exceptions
NameRemoveTransactionErrorif upon entry next event is not: UPDATE_FAILED_EVT

Definition at line 595 of file nc_remove.cc.

References isc::d2::d2_to_dns_logger, isc::d2::DHCP_DDNS_REMOVE_FAILED, isc::util::StateModel::endModel(), isc::util::StateModel::getContextStr(), isc::util::StateModel::getNextEvent(), isc::d2::NameChangeTransaction::getRequestId(), isc_throw, LOG_ERROR, isc::d2::NameChangeTransaction::NO_MORE_SERVERS_EVT, isc::d2::NameChangeTransaction::SERVER_IO_ERROR_EVT, isc::d2::NameChangeTransaction::setNcrStatus(), isc::dhcp_ddns::ST_FAILED, isc::d2::NameChangeTransaction::transactionOutcomeString(), and isc::d2::NameChangeTransaction::UPDATE_FAILED_EVT.

Referenced by defineStates().

+ Here is the call graph for this function:

◆ processRemoveOkHandler()

void isc::d2::NameRemoveTransaction::processRemoveOkHandler ( )
protected

State handler for PROCESS_TRANS_OK_ST.

Entered from:

  • REMOVING_FWD_RRS_ST with a next event of UPDATE_OK_EVT
  • REMOVING_REV_PTRS_ST with a next event of UPDATE_OK_EVT

Sets the transaction action status to indicate success and ends model execution.

Transitions to:

  • END_ST with a next event of END_EVT.
Exceptions
NameRemoveTransactionErrorif upon entry next event is not: UPDATE_OK_EVT

Definition at line 578 of file nc_remove.cc.

References isc::d2::d2_to_dns_logger, isc::d2::DHCP_DDNS_REMOVE_SUCCEEDED, isc::util::StateModel::endModel(), isc::util::StateModel::getContextStr(), isc::d2::NameChangeTransaction::getNcr(), isc::util::StateModel::getNextEvent(), isc::d2::NameChangeTransaction::getRequestId(), isc_throw, LOG_INFO, isc::d2::NameChangeTransaction::setNcrStatus(), isc::dhcp_ddns::ST_COMPLETED, and isc::d2::NameChangeTransaction::UPDATE_OK_EVT.

Referenced by defineStates().

+ Here is the call graph for this function:

◆ readyHandler()

void isc::d2::NameRemoveTransaction::readyHandler ( )
protected

State handler for READY_ST.

Entered from:

  • INIT_ST with next event of START_EVT

The READY_ST is the state the model transitions into when the inherited method, startTransaction() is invoked. This handler, therefore, is the entry point into the state model execution. Its primary task is to determine whether to start with a forward DNS change or a reverse DNS change.

Transitions to:

  • SELECTING_FWD_SERVER_ST with next event of SERVER_SELECT_ST if request includes a forward change.
  • SELECTING_REV_SERVER_ST with next event of SERVER_SELECT_ST if request includes only a reverse change.
Exceptions
NameRemoveTransactionErrorif upon entry next event is not START_EVT.

Definition at line 128 of file nc_remove.cc.

References isc::util::StateModel::getContextStr(), isc::d2::NameChangeTransaction::getForwardDomain(), isc::util::StateModel::getNextEvent(), isc_throw, isc::d2::NameChangeTransaction::SELECT_SERVER_EVT, isc::d2::NameChangeTransaction::SELECTING_FWD_SERVER_ST, isc::d2::NameChangeTransaction::SELECTING_REV_SERVER_ST, isc::util::StateModel::START_EVT, and isc::util::StateModel::transition().

Referenced by defineStates().

+ Here is the call graph for this function:

◆ removingFwdAddrsHandler()

void isc::d2::NameRemoveTransaction::removingFwdAddrsHandler ( )
protected

State handler for REMOVING_FWD_ADDRS_ST.

Entered from:

  • SELECTING_FWD_SERVER with next event of SERVER_SELECTED_EVT

Attempts to remove the forward DNS entry for a given FQDN, provided a DHCID RR exists which matches the requesting DHCID. If this is first invocation of the handler after transitioning into this state, any previous update request context is deleted. If next event is SERVER_SELECTED_EVT, the handler builds the forward remove request, schedules an asynchronous send via sendUpdate(), and returns. Note that sendUpdate will post NOP_EVT as next event.

Posting the NOP_EVT will cause runModel() to suspend execution of the state model thus affecting a "wait" for the update IO to complete. Update completion occurs via the DNSClient callback operator() method inherited from NameChangeTransaction. When invoked this callback will post a next event of IO_COMPLETED_EVT and then invoke runModel which resumes execution of the state model.

When the handler is invoked with a next event of IO_COMPLETED_EVT, the DNS update status is checked and acted upon accordingly:

Transitions to:

  • REMOVING_FWD_RRS_ST with next event of UPDATE_OK_EVT upon successful removal or RCODE of indication FQDN is no longer in use (NXDOMAIN).
  • PROCESS_TRANS_FAILED_ST with next event of UPDATE_FAILED_EVT if the DNS server rejected the update for any reason or the IO completed with an unrecognized status.
  • RE-ENTER this state with next event of SERVER_SELECTED_EVT if there was an IO error communicating with the server and the number of per server retries has not been exhausted.
  • SELECTING_FWD_SERVER_ST with next event of SERVER_IO_ERROR_EVT if there was an IO error communicating with the server and the number of per server retries has been exhausted.
Exceptions
NameRemoveTransactionErrorif upon entry next event is not SERVER_SELECTED_EVT or IO_COMPLETE_EVT

Definition at line 176 of file nc_remove.cc.

References buildRemoveFwdAddressRequest(), isc::d2::NameChangeTransaction::clearDnsUpdateRequest(), isc::d2::NameChangeTransaction::clearUpdateAttempts(), isc::d2::d2_to_dns_logger, isc::d2::DHCP_DDNS_FORWARD_REMOVE_ADDRS_BAD_DNSCLIENT_STATUS, isc::d2::DHCP_DDNS_FORWARD_REMOVE_ADDRS_BUILD_FAILURE, isc::d2::DHCP_DDNS_FORWARD_REMOVE_ADDRS_IO_ERROR, isc::d2::DHCP_DDNS_FORWARD_REMOVE_ADDRS_REJECTED, isc::d2::DHCP_DDNS_FORWARD_REMOVE_ADDRS_RESP_CORRUPT, isc::d2::DHCP_DDNS_FORWARD_REMOVE_ADDRS_TIMEOUT, isc::util::StateModel::doOnEntry(), isc::util::StateModel::getContextStr(), isc::d2::NameChangeTransaction::getCurrentServer(), isc::d2::NameChangeTransaction::getDnsUpdateResponse(), isc::d2::NameChangeTransaction::getDnsUpdateStatus(), isc::d2::NameChangeTransaction::getNcr(), isc::util::StateModel::getNextEvent(), isc::d2::NameChangeTransaction::getRequestId(), isc::d2::DNSClient::INVALID_RESPONSE, isc::d2::NameChangeTransaction::IO_COMPLETED_EVT, isc_throw, LOG_ERROR, isc::dns::Rcode::NOERROR(), isc::dns::Rcode::NXRRSET(), isc::d2::DNSClient::OTHER, isc::d2::NameChangeTransaction::PROCESS_TRANS_FAILED_ST, REMOVING_FWD_RRS_ST, isc::d2::NameChangeTransaction::retryTransition(), isc::d2::NameChangeTransaction::SELECTING_FWD_SERVER_ST, isc::d2::NameChangeTransaction::sendUpdate(), isc::d2::NameChangeTransaction::SERVER_SELECTED_EVT, isc::d2::DNSClient::SUCCESS, isc::d2::DNSClient::TIMEOUT, isc::util::StateModel::transition(), isc::d2::NameChangeTransaction::UPDATE_FAILED_EVT, and isc::d2::NameChangeTransaction::UPDATE_OK_EVT.

Referenced by defineStates().

+ Here is the call graph for this function:

◆ removingFwdRRsHandler()

void isc::d2::NameRemoveTransaction::removingFwdRRsHandler ( )
protected

State handler for REMOVING_FWD_RRS_ST.

Entered from:

  • REMOVING_FWD_ADDRS_ST with next event of UPDATE_OK_EVT

Attempts to delete any remaining RRs associated with the given FQDN such as the DHCID RR. If this is first invocation of the handler after transitioning into this state, any previous update request context is deleted and the handler builds the forward remove request. It then schedules an asynchronous send via sendUpdate(), and returns. Note that sendUpdate will post NOP_EVT as the next event.

Posting the NOP_EVT will cause runModel() to suspend execution of the state model thus affecting a "wait" for the update IO to complete. Update completion occurs via the DNSClient callback operator() method inherited from NameChangeTransaction. When invoked this callback will post a next event of IO_COMPLETED_EVT and then invoke runModel which resumes execution of the state model.

When the handler is invoked with a next event of IO_COMPLETED_EVT, the DNS update status is checked and acted upon accordingly:

Transitions to:

  • SELECTING_REV_SERVER_ST with a next event of SELECT_SERVER_EVT upon successful completion and the request includes a reverse DNS update.
  • PROCESS_TRANS_OK_ST with next event of UPDATE_OK_EVT upon successful completion and the request does not include a reverse DNS update.
  • PROCESS_TRANS_FAILED_ST with a next event of UPDATE_FAILED_EVT if the DNS server rejected the update for any other reason or the IO completed with an unrecognized status.
  • RE-ENTER this state with a next event of SERVER_SELECTED_EVT if there was an IO error communicating with the server and the number of per server retries has not been exhausted.
  • PROCESS_TRANS_FAILED_ST with a next event of SERVER_IO_ERROR_EVT if there we have reached maximum number of retries without success on the current server.
Note
If we exhaust the IO retries for the current server due to IO failures, we will abort the remaining updates. The rational is that we are only in this state, if the remove of the forward address RR succeeded (removingFwdAddrsHandler) on the current server so we should not attempt another removal on a different server. This is perhaps a point for discussion.
Todo
Should we go ahead with the reverse remove?
Exceptions
NameRemoveTransactionErrorif upon entry next event is not: UPDATE_OK_EVT or IO_COMPLETE_EVT

Definition at line 291 of file nc_remove.cc.

References buildRemoveFwdRRsRequest(), isc::d2::NameChangeTransaction::clearDnsUpdateRequest(), isc::d2::NameChangeTransaction::clearUpdateAttempts(), isc::d2::d2_to_dns_logger, isc::d2::DHCP_DDNS_FORWARD_REMOVE_RRS_BAD_DNSCLIENT_STATUS, isc::d2::DHCP_DDNS_FORWARD_REMOVE_RRS_BUILD_FAILURE, isc::d2::DHCP_DDNS_FORWARD_REMOVE_RRS_IO_ERROR, isc::d2::DHCP_DDNS_FORWARD_REMOVE_RRS_REJECTED, isc::d2::DHCP_DDNS_FORWARD_REMOVE_RRS_RESP_CORRUPT, isc::d2::DHCP_DDNS_FORWARD_REMOVE_RRS_TIMEOUT, isc::util::StateModel::doOnEntry(), isc::util::StateModel::getContextStr(), isc::d2::NameChangeTransaction::getCurrentServer(), isc::d2::NameChangeTransaction::getDnsUpdateResponse(), isc::d2::NameChangeTransaction::getDnsUpdateStatus(), isc::d2::NameChangeTransaction::getNcr(), isc::util::StateModel::getNextEvent(), isc::d2::NameChangeTransaction::getRequestId(), isc::d2::NameChangeTransaction::getReverseDomain(), isc::d2::DNSClient::INVALID_RESPONSE, isc::d2::NameChangeTransaction::IO_COMPLETED_EVT, isc_throw, LOG_ERROR, isc::dns::Rcode::NOERROR(), isc::dns::Rcode::NXRRSET(), isc::d2::DNSClient::OTHER, isc::d2::NameChangeTransaction::PROCESS_TRANS_FAILED_ST, isc::d2::NameChangeTransaction::PROCESS_TRANS_OK_ST, isc::d2::NameChangeTransaction::retryTransition(), isc::d2::NameChangeTransaction::SELECT_SERVER_EVT, isc::d2::NameChangeTransaction::SELECTING_REV_SERVER_ST, isc::d2::NameChangeTransaction::sendUpdate(), isc::d2::NameChangeTransaction::SERVER_SELECTED_EVT, isc::d2::NameChangeTransaction::setForwardChangeCompleted(), isc::d2::DNSClient::SUCCESS, isc::d2::DNSClient::TIMEOUT, isc::util::StateModel::transition(), isc::d2::NameChangeTransaction::UPDATE_FAILED_EVT, and isc::d2::NameChangeTransaction::UPDATE_OK_EVT.

Referenced by defineStates().

+ Here is the call graph for this function:

◆ removingRevPtrsHandler()

void isc::d2::NameRemoveTransaction::removingRevPtrsHandler ( )
protected

State handler for REMOVING_REV_PTRS_ST.

Entered from:

  • SELECTING_REV_SERVER_ST with a next event of SERVER_SELECTED_EVT

Attempts to delete a reverse DNS entry for a given FQDN. If this is first invocation of the handler after transitioning into this state, any previous update request context is deleted. If next event is SERVER_SELECTED_EVT, the handler builds the reverse remove request, schedules an asynchronous send via sendUpdate(), and then returns. Note that sendUpdate will post NOP_EVT as next event.

Posting the NOP_EVT will cause runModel() to suspend execution of the state model thus affecting a "wait" for the update IO to complete. Update completion occurs via the DNSClient callback operator() method inherited from NameChangeTransaction. When invoked this callback will post a next event of IO_COMPLETED_EVT and then invoke runModel which resumes execution of the state model.

When the handler is invoked with a next event of IO_COMPLETED_EVT, the DNS update status is checked and acted upon accordingly:

Transitions to:

  • PROCESS_TRANS_OK_ST with a next event of UPDATE_OK_EVT upon successful completion.
  • PROCESS_TRANS_FAILED_ST with a next event of UPDATE_FAILED_EVT If the DNS server rejected the update for any reason or the IO completed with an unrecognized status.
  • RE-ENTER this state with a next event of SERVER_SELECTED_EVT if there was an IO error communicating with the server and the number of per server retries has not been exhausted.
  • SELECTING_REV_SERVER_ST with next event of SERVER_IO_ERROR_EVT if there was an IO error communicating with the server and the number of per server retries has been exhausted.
Exceptions
NameRemoveTransactionErrorif upon entry next event is not: SERVER_SELECTED_EVT or IO_COMPLETED_EVT

Definition at line 456 of file nc_remove.cc.

References buildRemoveRevPtrsRequest(), isc::d2::NameChangeTransaction::clearDnsUpdateRequest(), isc::d2::NameChangeTransaction::clearUpdateAttempts(), isc::d2::d2_to_dns_logger, isc::d2::DHCP_DDNS_REVERSE_REMOVE_BAD_DNSCLIENT_STATUS, isc::d2::DHCP_DDNS_REVERSE_REMOVE_BUILD_FAILURE, isc::d2::DHCP_DDNS_REVERSE_REMOVE_IO_ERROR, isc::d2::DHCP_DDNS_REVERSE_REMOVE_REJECTED, isc::d2::DHCP_DDNS_REVERSE_REMOVE_RESP_CORRUPT, isc::d2::DHCP_DDNS_REVERSE_REMOVE_TIMEOUT, isc::util::StateModel::doOnEntry(), isc::util::StateModel::getContextStr(), isc::d2::NameChangeTransaction::getCurrentServer(), isc::d2::NameChangeTransaction::getDnsUpdateResponse(), isc::d2::NameChangeTransaction::getDnsUpdateStatus(), isc::d2::NameChangeTransaction::getNcr(), isc::util::StateModel::getNextEvent(), isc::d2::NameChangeTransaction::getRequestId(), isc::d2::DNSClient::INVALID_RESPONSE, isc::d2::NameChangeTransaction::IO_COMPLETED_EVT, isc_throw, LOG_ERROR, isc::dns::Rcode::NOERROR(), isc::dns::Rcode::NXRRSET(), isc::d2::DNSClient::OTHER, isc::d2::NameChangeTransaction::PROCESS_TRANS_FAILED_ST, isc::d2::NameChangeTransaction::PROCESS_TRANS_OK_ST, isc::d2::NameChangeTransaction::retryTransition(), isc::d2::NameChangeTransaction::SELECTING_REV_SERVER_ST, isc::d2::NameChangeTransaction::sendUpdate(), isc::d2::NameChangeTransaction::SERVER_SELECTED_EVT, isc::d2::NameChangeTransaction::setReverseChangeCompleted(), isc::d2::DNSClient::SUCCESS, isc::d2::DNSClient::TIMEOUT, isc::util::StateModel::transition(), isc::d2::NameChangeTransaction::UPDATE_FAILED_EVT, and isc::d2::NameChangeTransaction::UPDATE_OK_EVT.

Referenced by defineStates().

+ Here is the call graph for this function:

◆ selectingFwdServerHandler()

void isc::d2::NameRemoveTransaction::selectingFwdServerHandler ( )
protected

State handler for SELECTING_FWD_SERVER_ST.

Entered from:

  • READY_ST with next event of SELECT_SERVER_EVT
  • REMOVING_FWD_ADDRS_ST with next event of SERVER_IO_ERROR_EVT

Selects the server to be used from the forward domain for the forward DNS update. If next event is SELECT_SERVER_EVT the handler initializes the forward domain's server selection mechanism and then attempts to select the next server. If next event is SERVER_IO_ERROR_EVT then the handler simply attempts to select the next server.

Transitions to:

  • REMOVING_FWD_ADDRS_ST with next event of SERVER_SELECTED upon successful server selection
  • PROCESS_TRANS_FAILED with next event of NO_MORE_SERVERS_EVT upon failure to select a server
Exceptions
NameRemoveTransactionErrorif upon entry next event is not SELECT_SERVER_EVT or SERVER_IO_ERROR_EVT.

Definition at line 148 of file nc_remove.cc.

References isc::util::StateModel::getContextStr(), isc::d2::NameChangeTransaction::getForwardDomain(), isc::util::StateModel::getNextEvent(), isc::d2::NameChangeTransaction::initServerSelection(), isc_throw, isc::d2::NameChangeTransaction::NO_MORE_SERVERS_EVT, isc::d2::NameChangeTransaction::PROCESS_TRANS_FAILED_ST, REMOVING_FWD_ADDRS_ST, isc::d2::NameChangeTransaction::SELECT_SERVER_EVT, isc::d2::NameChangeTransaction::selectNextServer(), isc::d2::NameChangeTransaction::SERVER_IO_ERROR_EVT, isc::d2::NameChangeTransaction::SERVER_SELECTED_EVT, and isc::util::StateModel::transition().

Referenced by defineStates().

+ Here is the call graph for this function:

◆ selectingRevServerHandler()

void isc::d2::NameRemoveTransaction::selectingRevServerHandler ( )
protected

State handler for SELECTING_REV_SERVER_ST.

Entered from:

  • READY_ST with next event of SELECT_SERVER_EVT
  • REMOVING_FWD_RRS_ST with next event of SELECT_SERVER_EVT
  • REMOVING_REV_PTRS_ST with next event of SERVER_IO_ERROR_EVT

Selects the server to be used from the reverse domain for the reverse DNS update. If next event is SELECT_SERVER_EVT the handler initializes the reverse domain's server selection mechanism and then attempts to select the next server. If next event is SERVER_IO_ERROR_EVT then the handler simply attempts to select the next server.

Transitions to:

  • REMOVING_REV_PTRS_ST with next event of SERVER_SELECTED upon successful server selection
  • PROCESS_TRANS_FAILED with next event of NO_MORE_SERVERS_EVT upon failure to select a server
Exceptions
NameRemoveTransactionErrorif upon entry next event is not SELECT_SERVER_EVT or SERVER_IO_ERROR_EVT.

Definition at line 427 of file nc_remove.cc.

References isc::util::StateModel::getContextStr(), isc::util::StateModel::getNextEvent(), isc::d2::NameChangeTransaction::getReverseDomain(), isc::d2::NameChangeTransaction::initServerSelection(), isc_throw, isc::d2::NameChangeTransaction::NO_MORE_SERVERS_EVT, isc::d2::NameChangeTransaction::PROCESS_TRANS_FAILED_ST, REMOVING_REV_PTRS_ST, isc::d2::NameChangeTransaction::SELECT_SERVER_EVT, isc::d2::NameChangeTransaction::selectNextServer(), isc::d2::NameChangeTransaction::SERVER_IO_ERROR_EVT, isc::d2::NameChangeTransaction::SERVER_SELECTED_EVT, and isc::util::StateModel::transition().

Referenced by defineStates().

+ Here is the call graph for this function:

◆ verifyEvents()

void isc::d2::NameRemoveTransaction::verifyEvents ( )
protectedvirtual

Validates the contents of the set of events.

Invokes NameChangeTransaction's implementation and then verifies the Remove transaction's events. This tests that the needed events are in the event dictionary.

Exceptions
StateModelErrorif an event value is undefined.

Reimplemented from isc::d2::NameChangeTransaction.

Definition at line 55 of file nc_remove.cc.

References isc::d2::NameChangeTransaction::verifyEvents().

+ Here is the call graph for this function:

◆ verifyStates()

void isc::d2::NameRemoveTransaction::verifyStates ( )
protectedvirtual

Validates the contents of the set of states.

Invokes NameChangeTransaction's implementation and then verifies the Remove transaction's states. This tests that the needed states are in the state dictionary.

Exceptions
StateModelErrorif an event value is undefined.

Reimplemented from isc::d2::NameChangeTransaction.

Definition at line 111 of file nc_remove.cc.

References isc::util::StateModel::getStateInternal(), REMOVING_FWD_ADDRS_ST, REMOVING_FWD_RRS_ST, REMOVING_REV_PTRS_ST, and isc::d2::NameChangeTransaction::verifyStates().

+ Here is the call graph for this function:

Member Data Documentation

◆ REMOVING_FWD_ADDRS_ST

const int isc::d2::NameRemoveTransaction::REMOVING_FWD_ADDRS_ST = NCT_DERIVED_STATE_MIN + 1
static

State that attempts to remove specific forward address record.

Definition at line 56 of file nc_remove.h.

Referenced by defineStates(), selectingFwdServerHandler(), and verifyStates().

◆ REMOVING_FWD_RRS_ST

const int isc::d2::NameRemoveTransaction::REMOVING_FWD_RRS_ST = NCT_DERIVED_STATE_MIN + 2
static

State that attempts to remove any other forward RRs for the DHCID.

Definition at line 59 of file nc_remove.h.

Referenced by defineStates(), removingFwdAddrsHandler(), and verifyStates().

◆ REMOVING_REV_PTRS_ST

const int isc::d2::NameRemoveTransaction::REMOVING_REV_PTRS_ST = NCT_DERIVED_STATE_MIN + 3
static

State that attempts to remove reverse PTR records.

Definition at line 62 of file nc_remove.h.

Referenced by defineStates(), selectingRevServerHandler(), and verifyStates().


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