20 #include <boost/shared_ptr.hpp>
213 virtual void sendUpdate(
const std::string& comment =
"");
355 return (io_service_);
560 bool forward_change_completed_;
563 bool reverse_change_completed_;
575 size_t next_server_pos_;
578 size_t update_attempts_;
virtual D2UpdateMessagePtr prepNewRequest(DdnsDomainPtr domain)
Creates a new DNS update request based on the given domain.
virtual void sendUpdate(const std::string &comment="")
Send the update request to the current server.
size_t getUpdateAttempts() const
Fetches the update attempt count for the current update.
Implements a finite state machine.
static const int PROCESS_TRANS_OK_ST
State which processes successful transaction conclusion.
Thrown if the transaction encounters a general error.
static const unsigned int MAX_UPDATE_TRIES_PER_SERVER
Maximum times to attempt a single update on a given server.
boost::shared_ptr< NameChangeTransaction > NameChangeTransactionPtr
Defines a pointer to a NameChangeTransaction.
boost::shared_ptr< DNSClient > DNSClientPtr
boost::shared_ptr< DdnsDomain > DdnsDomainPtr
Defines a pointer for DdnsDomain instances.
virtual void onModelFailure(const std::string &explanation)
Handler for fatal model execution errors.
boost::shared_ptr< D2UpdateMessage > D2UpdateMessagePtr
Pointer to the DNS Update Message.
void setNcrStatus(const dhcp_ddns::NameChangeStatus &status)
Sets the status of the transaction's NameChangeRequest.
bool getForwardChangeCompleted() const
Returns whether the forward change has completed or not.
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
static const int SELECTING_FWD_SERVER_ST
State in which forward DNS server selection is done.
std::string transactionOutcomeString() const
Returns a string version of transaction outcome.
boost::shared_ptr< NameChangeRequest > NameChangeRequestPtr
Defines a pointer to a NameChangeRequest.
void startTransaction()
Begins execution of the transaction.
static const int SERVER_IO_ERROR_EVT
Issued when an update fails due to an IO error.
const dhcp_ddns::NameChangeRequestPtr & getNcr() const
Fetches the NameChangeRequest for this transaction.
static const int IO_COMPLETED_EVT
Issued when a DNS update packet exchange has completed.
static const int NCT_DERIVED_STATE_MIN
Value at which custom states in a derived class should begin.
bool getReverseChangeCompleted() const
Returns whether the reverse change has completed or not.
Callback for the DNSClient class.
static const int NCT_DERIVED_EVENT_MIN
Value at which custom events in a derived class should begin.
void setForwardChangeCompleted(const bool value)
Sets the forward change completion flag to the given value.
void addDhcidRdata(dns::RRsetPtr &rrset)
Adds an RData for the lease client's DHCID to the given RRset.
std::string getRequestId() const
Fetches the request id that identifies this transaction.
static const int SERVER_SELECTED_EVT
Issued when a server has been selected.
void retryTransition(const int fail_to_state)
Determines the state and next event based on update attempts.
isc::dhcp_ddns::D2Dhcid TransactionKey
Defines the type used as the unique key for transactions.
const D2UpdateMessagePtr & getDnsUpdateRequest() const
Fetches the current DNS update request packet.
Status
A status code of the DNSClient.
NameChangeStatus
Defines the runtime processing status values for requests.
boost::shared_ptr< D2CfgMgr > D2CfgMgrPtr
Defines a shared pointer to D2CfgMgr.
DNSClient::Status getDnsUpdateStatus() const
Fetches the most recent DNS update status.
virtual void defineStates()
Adds states defined by NameChangeTransaction to the state set.
boost::shared_ptr< TSIGKey > TSIGKeyPtr
static const int SM_DERIVED_EVENT_MIN
Value at which custom events in a derived class should begin.
void setReverseChangeCompleted(const bool value)
Sets the reverse change completion flag to the given value.
static const unsigned int DNS_UPDATE_DEFAULT_TIMEOUT
Default time to assign to a single DNS update.
const asiolink::IOServicePtr & getIOService()
Fetches the IOService the transaction uses for IO processing.
static const int SM_DERIVED_STATE_MIN
Value at which custom states in a derived class should begin.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
static const int SELECTING_REV_SERVER_ST
State in which reverse DNS server selection is done.
void setDnsUpdateStatus(const DNSClient::Status &status)
Sets the update status to the given status value.
DdnsDomainPtr & getForwardDomain()
Fetches the forward DdnsDomain.
This is a base class for exceptions thrown from the DNS library module.
Defines the logger used by the top-level component of kea-dhcp-ddns.
NameChangeTransactionError(const char *file, size_t line, const char *what)
void addPtrRdata(dns::RRsetPtr &rrset)
Adds an RData for the lease FQDN to the given RRset.
const D2UpdateMessagePtr & getDnsUpdateResponse() const
Fetches the most recent DNS update response packet.
static const int NO_MORE_SERVERS_EVT
Issued when there are no more servers from which to select.
virtual void operator()(DNSClient::Status status)
Serves as the DNSClient IO completion event handler.
void setUpdateAttempts(const size_t value)
Sets the update attempt count to the given value.
const DNSClientPtr & getDNSClient() const
Fetches the DNSClient instance.
static const int PROCESS_TRANS_FAILED_ST
State which processes an unsuccessful transaction conclusion.
const DnsServerInfoPtr & getCurrentServer() const
Fetches the currently selected server.
std::string responseString() const
Returns a string version of the current response status and rcode.
The RRType class encapsulates DNS resource record types.
static const int SELECT_SERVER_EVT
Issued when a server needs to be selected.
void clearDnsUpdateRequest()
Destroys the current update request packet and resets update attempts count.
Container class for handling the DHCID value within a NameChangeRequest.
static const int READY_ST
State from which a transaction is started.
void setDnsUpdateRequest(D2UpdateMessagePtr &request)
Sets the update request packet to the given packet.
virtual void defineEvents()
Adds events defined by NameChangeTransaction to the event set.
Embodies the "life-cycle" required to carry out a DDNS update.
static const int UPDATE_OK_EVT
Issued when the attempted update successfully completed.
const dns::RRType & getAddressRRType() const
Returns the DHCP data type for the lease address.
void clearDnsUpdateResponse()
Destroys the current update response packet.
NameChangeTransaction(asiolink::IOServicePtr &io_service, dhcp_ddns::NameChangeRequestPtr &ncr, DdnsDomainPtr &forward_domain, DdnsDomainPtr &reverse_domain, D2CfgMgrPtr &cfg_mgr)
Constructor.
dhcp_ddns::NameChangeStatus getNcrStatus() const
Fetches the NameChangeRequest status of the transaction.
boost::shared_ptr< AbstractRRset > RRsetPtr
A pointer-like type pointing to an RRset object.
DdnsDomainPtr & getReverseDomain()
Fetches the reverse DdnsDomain.
boost::shared_ptr< DnsServerInfoStorage > DnsServerInfoStoragePtr
Defines a pointer to DnsServerInfo storage containers.
This file defines the class StateModel.
static const int UPDATE_FAILED_EVT
Issued when the attempted update fails to complete.
This file provides the classes needed to embody, compose, and decompose DNS update requests that are ...
virtual void verifyEvents()
Validates the contents of the set of events.
void addLeaseAddressRdata(dns::RRsetPtr &rrset)
Adds an RData for the lease address to the given RRset.
const TransactionKey & getTransactionKey() const
Fetches the unique key that identifies this transaction.
void initServerSelection(const DdnsDomainPtr &domain)
Initializes server selection from the given DDNS domain.
virtual ~NameChangeTransaction()
Destructor.
void setDnsUpdateResponse(D2UpdateMessagePtr &response)
Sets the update response packet to the given packet.
boost::shared_ptr< DnsServerInfo > DnsServerInfoPtr
Defines a pointer for DnsServerInfo instances.
bool selectNextServer()
Selects the next server in the current server list.
virtual void verifyStates()
Validates the contents of the set of states.