Kea
1.9.9-git
|
Embodies the "life-cycle" required to carry out a DDNS Add update. More...
#include <nc_add.h>
Public Member Functions | |
NameAddTransaction (asiolink::IOServicePtr &io_service, dhcp_ddns::NameChangeRequestPtr &ncr, DdnsDomainPtr &forward_domain, DdnsDomainPtr &reverse_domain, D2CfgMgrPtr &cfg_mgr) | |
Constructor. More... | |
virtual | ~NameAddTransaction () |
Destructor. More... | |
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. More... | |
virtual | ~NameChangeTransaction () |
Destructor. More... | |
const dns::RRType & | getAddressRRType () const |
Returns the DHCP data type for the lease address. More... | |
const DnsServerInfoPtr & | getCurrentServer () const |
Fetches the currently selected server. More... | |
const DNSClientPtr & | getDNSClient () const |
Fetches the DNSClient instance. More... | |
const D2UpdateMessagePtr & | getDnsUpdateRequest () const |
Fetches the current DNS update request packet. More... | |
const D2UpdateMessagePtr & | getDnsUpdateResponse () const |
Fetches the most recent DNS update response packet. More... | |
DNSClient::Status | getDnsUpdateStatus () const |
Fetches the most recent DNS update status. More... | |
bool | getForwardChangeCompleted () const |
Returns whether the forward change has completed or not. More... | |
DdnsDomainPtr & | getForwardDomain () |
Fetches the forward DdnsDomain. More... | |
const dhcp_ddns::NameChangeRequestPtr & | getNcr () const |
Fetches the NameChangeRequest for this transaction. More... | |
dhcp_ddns::NameChangeStatus | getNcrStatus () const |
Fetches the NameChangeRequest status of the transaction. More... | |
std::string | getRequestId () const |
Fetches the request id that identifies this transaction. More... | |
bool | getReverseChangeCompleted () const |
Returns whether the reverse change has completed or not. More... | |
DdnsDomainPtr & | getReverseDomain () |
Fetches the reverse DdnsDomain. More... | |
const TransactionKey & | getTransactionKey () const |
Fetches the unique key that identifies this transaction. More... | |
size_t | getUpdateAttempts () const |
Fetches the update attempt count for the current update. More... | |
virtual void | operator() (DNSClient::Status status) |
Serves as the DNSClient IO completion event handler. More... | |
void | startTransaction () |
Begins execution of the transaction. More... | |
Public Member Functions inherited from isc::d2::DNSClient::Callback | |
virtual | ~Callback () |
Virtual destructor. More... | |
Public Member Functions inherited from isc::util::StateModel | |
StateModel () | |
Constructor. More... | |
virtual | ~StateModel () |
Destructor. More... | |
bool | didModelFail () const |
Returns whether or not the model failed. More... | |
void | endModel () |
Conducts a normal transition to the end of the model. More... | |
std::string | getContextStr () const |
Convenience method which returns a string rendition of the current state and next event. More... | |
unsigned int | getCurrState () const |
Fetches the model's current state. More... | |
std::string | getEventLabel (const int event) const |
Fetches the label associated with an event value. More... | |
unsigned int | getLastEvent () const |
Fetches the model's last event. More... | |
unsigned int | getNextEvent () const |
Fetches the model's next event. More... | |
std::string | getPrevContextStr () const |
Convenience method which returns a string rendition of the previous state and last event. More... | |
unsigned int | getPrevState () const |
Fetches the model's previous state. More... | |
std::string | getStateLabel (const int state) const |
Fetches the label associated with an state value. More... | |
bool | isModelDone () const |
Returns whether or not the model has finished execution. More... | |
bool | isModelNew () const |
Returns whether or not the model is new. More... | |
bool | isModelPaused () const |
Returns whether or not the model is paused. More... | |
bool | isModelRunning () const |
Returns whether or not the model is running. More... | |
bool | isModelWaiting () const |
Returns whether or not the model is waiting. More... | |
void | nopStateHandler () |
An empty state handler. More... | |
virtual void | runModel (unsigned int event) |
Processes events through the state model. More... | |
void | startModel (const int start_state) |
Begins execution of the model. More... | |
void | unpauseModel () |
Unpauses state model. More... | |
Static Public Attributes | |
static const int | ADDING_FWD_ADDRS_ST = NCT_DERIVED_STATE_MIN + 1 |
State that attempts to add forward address records. More... | |
static const int | REPLACING_FWD_ADDRS_ST = NCT_DERIVED_STATE_MIN + 2 |
State that attempts to replace forward address records. More... | |
static const int | REPLACING_REV_PTRS_ST = NCT_DERIVED_STATE_MIN + 3 |
State that attempts to replace reverse PTR records. More... | |
static const int | FQDN_IN_USE_EVT = NCT_DERIVED_EVENT_MIN + 1 |
Event sent when an add attempt fails with address in use. More... | |
static const int | FQDN_NOT_IN_USE_EVT = NCT_DERIVED_EVENT_MIN + 2 |
Event sent when replace attempt to fails with address not in use. More... | |
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. More... | |
static const unsigned int | MAX_UPDATE_TRIES_PER_SERVER = 3 |
Maximum times to attempt a single update on a given server. More... | |
static const int | READY_ST = SM_DERIVED_STATE_MIN + 1 |
State from which a transaction is started. More... | |
static const int | SELECTING_FWD_SERVER_ST = SM_DERIVED_STATE_MIN + 2 |
State in which forward DNS server selection is done. More... | |
static const int | SELECTING_REV_SERVER_ST = SM_DERIVED_STATE_MIN + 3 |
State in which reverse DNS server selection is done. More... | |
static const int | PROCESS_TRANS_OK_ST = SM_DERIVED_STATE_MIN + 4 |
State which processes successful transaction conclusion. More... | |
static const int | PROCESS_TRANS_FAILED_ST = SM_DERIVED_STATE_MIN + 5 |
State which processes an unsuccessful transaction conclusion. More... | |
static const int | NCT_DERIVED_STATE_MIN = SM_DERIVED_STATE_MIN + 101 |
Value at which custom states in a derived class should begin. More... | |
static const int | SELECT_SERVER_EVT = SM_DERIVED_EVENT_MIN + 1 |
Issued when a server needs to be selected. More... | |
static const int | SERVER_SELECTED_EVT = SM_DERIVED_EVENT_MIN + 2 |
Issued when a server has been selected. More... | |
static const int | SERVER_IO_ERROR_EVT = SM_DERIVED_EVENT_MIN + 3 |
Issued when an update fails due to an IO error. More... | |
static const int | NO_MORE_SERVERS_EVT =SM_DERIVED_EVENT_MIN + 4 |
Issued when there are no more servers from which to select. More... | |
static const int | IO_COMPLETED_EVT = SM_DERIVED_EVENT_MIN + 5 |
Issued when a DNS update packet exchange has completed. More... | |
static const int | UPDATE_OK_EVT = SM_DERIVED_EVENT_MIN + 6 |
Issued when the attempted update successfully completed. More... | |
static const int | UPDATE_FAILED_EVT = SM_DERIVED_EVENT_MIN + 7 |
Issued when the attempted update fails to complete. More... | |
static const int | NCT_DERIVED_EVENT_MIN = SM_DERIVED_EVENT_MIN + 101 |
Value at which custom events in a derived class should begin. More... | |
Static Public Attributes inherited from isc::util::StateModel | |
static const int | NEW_ST = 0 |
State that a state model is in immediately after construction. More... | |
static const int | END_ST = 1 |
Final state, all the state model has reached its conclusion. More... | |
static const int | SM_DERIVED_STATE_MIN = 11 |
Value at which custom states in a derived class should begin. More... | |
static const int | NOP_EVT = 0 |
Signifies that no event has occurred. More... | |
static const int | START_EVT = 1 |
Event issued to start the model execution. More... | |
static const int | END_EVT = 2 |
Event issued to end the model execution. More... | |
static const int | FAIL_EVT = 3 |
Event issued to abort the model execution. More... | |
static const int | SM_DERIVED_EVENT_MIN = 11 |
Value at which custom events in a derived class should begin. More... | |
Protected Member Functions | |
void | addingFwdAddrsHandler () |
State handler for ADD_FWD_ADDRS_ST. More... | |
void | buildAddFwdAddressRequest () |
Builds a DNS request to add an forward DNS entry for an FQDN. More... | |
void | buildReplaceFwdAddressRequest () |
Builds a DNS request to replace forward DNS entry for an FQDN. More... | |
void | buildReplaceRevPtrsRequest () |
Builds a DNS request to replace a reverse DNS entry for an FQDN. More... | |
virtual void | defineEvents () |
Adds events defined by NameAddTransaction to the event set. More... | |
virtual void | defineStates () |
Adds states defined by NameAddTransaction to the state set. More... | |
void | processAddFailedHandler () |
State handler for PROCESS_TRANS_FAILED_ST. More... | |
void | processAddOkHandler () |
State handler for PROCESS_TRANS_OK_ST. More... | |
void | readyHandler () |
State handler for READY_ST. More... | |
void | replacingFwdAddrsHandler () |
State handler for REPLACING_FWD_ADDRS_ST. More... | |
void | replacingRevPtrsHandler () |
State handler for REPLACING_REV_PTRS_ST. More... | |
void | selectingFwdServerHandler () |
State handler for SELECTING_FWD_SERVER_ST. More... | |
void | selectingRevServerHandler () |
State handler for SELECTING_REV_SERVER_ST. More... | |
virtual void | verifyEvents () |
Validates the contents of the set of events. More... | |
virtual void | verifyStates () |
Validates the contents of the set of states. More... | |
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. More... | |
void | addLeaseAddressRdata (dns::RRsetPtr &rrset) |
Adds an RData for the lease address to the given RRset. More... | |
void | addPtrRdata (dns::RRsetPtr &rrset) |
Adds an RData for the lease FQDN to the given RRset. More... | |
void | clearDnsUpdateRequest () |
Destroys the current update request packet and resets update attempts count. More... | |
void | clearDnsUpdateResponse () |
Destroys the current update response packet. More... | |
const asiolink::IOServicePtr & | getIOService () |
Fetches the IOService the transaction uses for IO processing. More... | |
void | initServerSelection (const DdnsDomainPtr &domain) |
Initializes server selection from the given DDNS domain. More... | |
virtual void | onModelFailure (const std::string &explanation) |
Handler for fatal model execution errors. More... | |
virtual D2UpdateMessagePtr | prepNewRequest (DdnsDomainPtr domain) |
Creates a new DNS update request based on the given domain. More... | |
std::string | responseString () const |
Returns a string version of the current response status and rcode. More... | |
void | retryTransition (const int fail_to_state) |
Determines the state and next event based on update attempts. More... | |
bool | selectNextServer () |
Selects the next server in the current server list. More... | |
virtual void | sendUpdate (const std::string &comment="") |
Send the update request to the current server. More... | |
void | setDnsUpdateRequest (D2UpdateMessagePtr &request) |
Sets the update request packet to the given packet. More... | |
void | setDnsUpdateResponse (D2UpdateMessagePtr &response) |
Sets the update response packet to the given packet. More... | |
void | setDnsUpdateStatus (const DNSClient::Status &status) |
Sets the update status to the given status value. More... | |
void | setForwardChangeCompleted (const bool value) |
Sets the forward change completion flag to the given value. More... | |
void | setNcrStatus (const dhcp_ddns::NameChangeStatus &status) |
Sets the status of the transaction's NameChangeRequest. More... | |
void | setReverseChangeCompleted (const bool value) |
Sets the reverse change completion flag to the given value. More... | |
void | setUpdateAttempts (const size_t value) |
Sets the update attempt count to the given value. More... | |
std::string | transactionOutcomeString () const |
Returns a string version of transaction outcome. More... | |
Protected Member Functions inherited from isc::util::StateModel | |
void | abortModel (const std::string &explanation) |
Aborts model execution. More... | |
void | defineEvent (unsigned int value, const std::string &label) |
Adds an event value and associated label to the set of events. More... | |
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. More... | |
bool | doOnEntry () |
Checks if on entry flag is true. More... | |
bool | doOnExit () |
Checks if on exit flag is true. More... | |
const EventPtr & | getEvent (unsigned int value) |
Fetches the event referred to by value. More... | |
const StatePtr | getState (unsigned int value) |
Fetches the state referred to by value. More... | |
const StatePtr | getStateInternal (unsigned int value) |
Fetches the state referred to by value. More... | |
void | initDictionaries () |
Initializes the event and state dictionaries. More... | |
void | postNextEvent (unsigned int event) |
Sets the next event to the given event value. More... | |
void | setState (unsigned int state) |
Sets the current state to the given state value. More... | |
void | transition (unsigned int state, unsigned int event) |
Sets up the model to transition into given state with a given event. More... | |
Embodies the "life-cycle" required to carry out a DDNS Add update.
NameAddTransaction implements a state machine for adding (or replacing) a forward and/or reverse DNS mapping. This state machine is based upon the processing logic described in RFC 4703, Sections 5.3 and 5.4. That logic may be paraphrased as follows:
This class derives from NameChangeTransaction from which it inherits states, events, and methods common to NameChangeRequest processing.
isc::d2::NameAddTransaction::NameAddTransaction | ( | asiolink::IOServicePtr & | io_service, |
dhcp_ddns::NameChangeRequestPtr & | ncr, | ||
DdnsDomainPtr & | forward_domain, | ||
DdnsDomainPtr & | reverse_domain, | ||
D2CfgMgrPtr & | cfg_mgr | ||
) |
Constructor.
Instantiates an Add transaction that is ready to be started.
io_service | IO service to be used for IO processing |
ncr | is the NameChangeRequest to fulfill |
forward_domain | is the domain to use for forward DNS updates |
reverse_domain | is the domain to use for reverse DNS updates |
cfg_mgr | pointer to the configuration manager |
NameAddTransaction | error if given request is not a CHG_ADD, NameChangeTransaction error for base class construction errors. |
Definition at line 31 of file nc_add.cc.
References isc::dhcp_ddns::CHG_ADD, and isc_throw.
|
virtual |
|
protected |
State handler for ADD_FWD_ADDRS_ST.
Entered from:
Attempts to add a forward 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 forward add 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:
NameAddTransactionError | if upon entry next event is not SERVER_SELECTED_EVT or IO_COMPLETE_EVT. |
Definition at line 173 of file nc_add.cc.
References buildAddFwdAddressRequest(), isc::d2::NameChangeTransaction::clearDnsUpdateRequest(), isc::d2::d2_to_dns_logger, isc::d2::DHCP_DDNS_FORWARD_ADD_BAD_DNSCLIENT_STATUS, isc::d2::DHCP_DDNS_FORWARD_ADD_BUILD_FAILURE, isc::d2::DHCP_DDNS_FORWARD_ADD_IO_ERROR, isc::d2::DHCP_DDNS_FORWARD_ADD_REJECTED, isc::d2::DHCP_DDNS_FORWARD_ADD_RESP_CORRUPT, isc::util::StateModel::doOnEntry(), FQDN_IN_USE_EVT, isc::dns::Rcode::getCode(), isc::util::StateModel::getContextStr(), isc::d2::NameChangeTransaction::getCurrentServer(), isc::d2::NameChangeTransaction::getDnsUpdateRequest(), 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::d2::DNSClient::OTHER, isc::d2::NameChangeTransaction::PROCESS_TRANS_FAILED_ST, isc::d2::NameChangeTransaction::PROCESS_TRANS_OK_ST, REPLACING_FWD_ADDRS_ST, isc::d2::NameChangeTransaction::retryTransition(), isc::d2::NameChangeTransaction::SELECT_SERVER_EVT, isc::d2::NameChangeTransaction::SELECTING_FWD_SERVER_ST, 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, isc::d2::NameChangeTransaction::UPDATE_OK_EVT, and isc::dns::Rcode::YXDOMAIN().
Referenced by defineStates().
|
protected |
Builds a DNS request to add an forward DNS entry for an FQDN.
Constructs a DNS update request, based upon the NCR, for adding a forward 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.3.1:
Prerequisite RRsets:
Updates RRsets:
This | method does not throw but underlying methods may. |
Definition at line 584 of file nc_add.cc.
References isc::d2::NameChangeTransaction::addDhcidRdata(), isc::d2::NameChangeTransaction::addLeaseAddressRdata(), isc::dns::RRType::ANY(), 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 addingFwdAddrsHandler().
|
protected |
Builds a DNS request to replace forward DNS entry for an FQDN.
Constructs a DNS update request, based upon the NCR, for replacing a forward 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.3.2:
Prerequisite RRsets:
Updates RRsets:
This | method does not throw but underlying methods may. |
Definition at line 626 of file nc_add.cc.
References isc::d2::NameChangeTransaction::addDhcidRdata(), isc::d2::NameChangeTransaction::addLeaseAddressRdata(), isc::dns::RRClass::ANY(), isc::dns::RRType::ANY(), isc::dns::RRType::DHCID(), isc::d2::NameChangeTransaction::getAddressRRType(), isc::d2::NameChangeTransaction::getForwardDomain(), isc::d2::NameChangeTransaction::getNcr(), isc::dns::RRClass::IN(), isc::d2::NameChangeTransaction::prepNewRequest(), isc::d2::D2UpdateMessage::SECTION_PREREQUISITE, isc::d2::D2UpdateMessage::SECTION_UPDATE, and isc::d2::NameChangeTransaction::setDnsUpdateRequest().
Referenced by replacingFwdAddrsHandler().
|
protected |
Builds a DNS request to replace a reverse DNS entry for an FQDN.
Constructs a DNS update request, based upon the NCR, for replacing 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.4:
Prerequisite RRsets:
Updates RRsets:
This | method does not throw but underlying methods may. |
Definition at line 674 of file nc_add.cc.
References isc::d2::NameChangeTransaction::addDhcidRdata(), isc::d2::NameChangeTransaction::addPtrRdata(), isc::dns::RRClass::ANY(), isc::dns::RRType::DHCID(), 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_UPDATE, and isc::d2::NameChangeTransaction::setDnsUpdateRequest().
Referenced by replacingRevPtrsHandler().
|
protectedvirtual |
Adds events defined by NameAddTransaction to the event set.
Invokes NameChangeTransaction's implementation and then defines the events unique to NCR Add transaction processing.
StateModelError | if an event definition is invalid or a duplicate. |
Reimplemented from isc::d2::NameChangeTransaction.
Definition at line 48 of file nc_add.cc.
References isc::util::StateModel::defineEvent(), isc::d2::NameChangeTransaction::defineEvents(), FQDN_IN_USE_EVT, and FQDN_NOT_IN_USE_EVT.
|
protectedvirtual |
Adds states defined by NameAddTransaction to the state set.
Invokes NameChangeTransaction's implementation and then defines the states unique to NCR Add transaction processing.
StateModelError | if an state definition is invalid or a duplicate. |
Reimplemented from isc::d2::NameChangeTransaction.
Definition at line 76 of file nc_add.cc.
References ADDING_FWD_ADDRS_ST, addingFwdAddrsHandler(), isc::util::StateModel::defineState(), isc::d2::NameChangeTransaction::defineStates(), isc::d2::NameChangeTransaction::PROCESS_TRANS_FAILED_ST, isc::d2::NameChangeTransaction::PROCESS_TRANS_OK_ST, processAddFailedHandler(), processAddOkHandler(), isc::d2::NameChangeTransaction::READY_ST, readyHandler(), REPLACING_FWD_ADDRS_ST, REPLACING_REV_PTRS_ST, replacingFwdAddrsHandler(), replacingRevPtrsHandler(), isc::d2::NameChangeTransaction::SELECTING_FWD_SERVER_ST, isc::d2::NameChangeTransaction::SELECTING_REV_SERVER_ST, selectingFwdServerHandler(), and selectingRevServerHandler().
|
protected |
State handler for PROCESS_TRANS_FAILED_ST.
Entered from:
Sets the transaction status to indicate failure and ends model execution.
Transitions to:
NameAddTransactionError | if upon entry next event is not: UPDATE_FAILED_EVT |
Definition at line 566 of file nc_add.cc.
References isc::d2::d2_to_dns_logger, isc::d2::DHCP_DDNS_ADD_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::setNcrStatus(), isc::dhcp_ddns::ST_FAILED, isc::d2::NameChangeTransaction::transactionOutcomeString(), and isc::d2::NameChangeTransaction::UPDATE_FAILED_EVT.
Referenced by defineStates().
|
protected |
State handler for PROCESS_TRANS_OK_ST.
Entered from:
Sets the transaction action status to indicate success and ends model execution.
Transitions to:
NameAddTransactionError | if upon entry next event is not: UPDATE_OK_EVT |
Definition at line 549 of file nc_add.cc.
References isc::d2::d2_to_dns_logger, isc::d2::DHCP_DDNS_ADD_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().
|
protected |
State handler for READY_ST.
Entered from:
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.h Its primary task is to determine whether to start with a forward DNS change or a reverse DNS change.
Transitions to:
NameAddTransactionError | if upon entry next event is not START_EVT. |
Definition at line 124 of file nc_add.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().
|
protected |
State handler for REPLACING_FWD_ADDRS_ST.
Entered from:
Attempts to delete and then add a forward 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 FDQN_IN_USE_EVT or SERVER_SELECTED_EVT, the handler builds the forward replacement request, 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:
NameAddTransactionError | if upon entry next event is not: FQDN_IN_USE_EVT, SERVER_SELECTED_EVT or IO_COMPLETE_EVT. |
Definition at line 288 of file nc_add.cc.
References ADDING_FWD_ADDRS_ST, buildReplaceFwdAddressRequest(), isc::d2::NameChangeTransaction::clearDnsUpdateRequest(), isc::d2::d2_to_dns_logger, isc::d2::DHCP_DDNS_FORWARD_REPLACE_BAD_DNSCLIENT_STATUS, isc::d2::DHCP_DDNS_FORWARD_REPLACE_BUILD_FAILURE, isc::d2::DHCP_DDNS_FORWARD_REPLACE_IO_ERROR, isc::d2::DHCP_DDNS_FORWARD_REPLACE_REJECTED, isc::d2::DHCP_DDNS_FORWARD_REPLACE_RESP_CORRUPT, isc::util::StateModel::doOnEntry(), FQDN_IN_USE_EVT, isc::dns::Rcode::getCode(), isc::util::StateModel::getContextStr(), isc::d2::NameChangeTransaction::getCurrentServer(), isc::d2::NameChangeTransaction::getDnsUpdateRequest(), 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::NXDOMAIN(), 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_FWD_SERVER_ST, 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().
|
protected |
State handler for REPLACING_REV_PTRS_ST.
Entered from:
Attempts to delete and then add 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 replacement add 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:
NameAddTransactionError | if upon entry next event is not: SERVER_SELECTED_EVT or IO_COMPLETED_EVT |
Definition at line 440 of file nc_add.cc.
References buildReplaceRevPtrsRequest(), isc::d2::NameChangeTransaction::clearDnsUpdateRequest(), isc::d2::d2_to_dns_logger, isc::d2::DHCP_DDNS_REVERSE_REPLACE_BAD_DNSCLIENT_STATUS, isc::d2::DHCP_DDNS_REVERSE_REPLACE_BUILD_FAILURE, isc::d2::DHCP_DDNS_REVERSE_REPLACE_IO_ERROR, isc::d2::DHCP_DDNS_REVERSE_REPLACE_REJECTED, isc::d2::DHCP_DDNS_REVERSE_REPLACE_RESP_CORRUPT, isc::util::StateModel::doOnEntry(), isc::dns::Rcode::getCode(), isc::util::StateModel::getContextStr(), isc::d2::NameChangeTransaction::getCurrentServer(), isc::d2::NameChangeTransaction::getDnsUpdateRequest(), 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::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().
|
protected |
State handler for SELECTING_FWD_SERVER_ST.
Entered from:
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:
NameAddTransactionError | if upon entry next event is not SELECT_SERVER_EVT or SERVER_IO_ERROR_EVT. |
Definition at line 144 of file nc_add.cc.
References ADDING_FWD_ADDRS_ST, 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, 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().
|
protected |
State handler for SELECTING_REV_SERVER_ST.
Entered from:
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:
NameAddTransactionError | if upon entry next event is not SELECT_SERVER_EVT or SERVER_IO_ERROR_EVT. |
Definition at line 410 of file nc_add.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, REPLACING_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().
|
protectedvirtual |
Validates the contents of the set of events.
Invokes NameChangeTransaction's implementation and then verifies the Add transaction's. This tests that the needed events are in the event dictionary.
StateModelError | if an event value is undefined. |
Reimplemented from isc::d2::NameChangeTransaction.
Definition at line 58 of file nc_add.cc.
References FQDN_IN_USE_EVT, FQDN_NOT_IN_USE_EVT, isc::util::StateModel::getEvent(), and isc::d2::NameChangeTransaction::verifyEvents().
|
protectedvirtual |
Validates the contents of the set of states.
Invokes NameChangeTransaction's implementation and then verifies the Add transaction's states. This tests that the needed states are in the state dictionary.
StateModelError | if an event value is undefined. |
Reimplemented from isc::d2::NameChangeTransaction.
Definition at line 107 of file nc_add.cc.
References ADDING_FWD_ADDRS_ST, isc::util::StateModel::getStateInternal(), REPLACING_FWD_ADDRS_ST, REPLACING_REV_PTRS_ST, and isc::d2::NameChangeTransaction::verifyStates().
|
static |
State that attempts to add forward address records.
Definition at line 57 of file nc_add.h.
Referenced by defineStates(), replacingFwdAddrsHandler(), selectingFwdServerHandler(), and verifyStates().
|
static |
Event sent when an add attempt fails with address in use.
Definition at line 68 of file nc_add.h.
Referenced by addingFwdAddrsHandler(), defineEvents(), replacingFwdAddrsHandler(), and verifyEvents().
|
static |
Event sent when replace attempt to fails with address not in use.
Definition at line 71 of file nc_add.h.
Referenced by defineEvents(), and verifyEvents().
|
static |
State that attempts to replace forward address records.
Definition at line 60 of file nc_add.h.
Referenced by addingFwdAddrsHandler(), defineStates(), and verifyStates().
|
static |
State that attempts to replace reverse PTR records.
Definition at line 63 of file nc_add.h.
Referenced by defineStates(), selectingRevServerHandler(), and verifyStates().