38 isc_throw (SimpleAddTransactionError,
39 "SimpleAddTransaction, request type must be CHG_ADD");
178 }
catch (
const std::exception& ex) {
252 .arg(
getNcr()->getFqdn());
321 }
catch (
const std::exception& ex) {
394 .arg(
getNcr()->getFqdn());
static std::string reverseIpAddress(const std::string &address)
Generate a reverse order string for the given IP address.
@ TIMEOUT
No response, timeout.
@ OTHER
Other, unclassified error.
@ INVALID_RESPONSE
Response received but invalid.
@ SUCCESS
Response received and is ok.
Embodies the "life-cycle" required to carry out a DDNS update.
static const int SELECTING_FWD_SERVER_ST
State in which forward DNS server selection is done.
void retryTransition(const int fail_to_state)
Determines the state and next event based on update attempts.
static const int PROCESS_TRANS_FAILED_ST
State which processes an unsuccessful transaction conclusion.
static const int READY_ST
State from which a transaction is started.
const D2UpdateMessagePtr & getDnsUpdateResponse() const
Fetches the most recent DNS update response packet.
static const int PROCESS_TRANS_OK_ST
State which processes successful transaction conclusion.
static const int UPDATE_OK_EVT
Issued when the attempted update successfully completed.
virtual void verifyStates()
Validates the contents of the set of states.
virtual D2UpdateMessagePtr prepNewRequest(DdnsDomainPtr domain)
Creates a new DNS update request based on the given domain.
static const int UPDATE_FAILED_EVT
Issued when the attempted update fails to complete.
const dns::RRType & getAddressRRType() const
Returns the DHCP data type for the lease address.
const dhcp_ddns::NameChangeRequestPtr & getNcr() const
Fetches the NameChangeRequest for this transaction.
void initServerSelection(const DdnsDomainPtr &domain)
Initializes server selection from the given DDNS domain.
static const int IO_COMPLETED_EVT
Issued when a DNS update packet exchange has completed.
static const int SELECT_SERVER_EVT
Issued when a server needs to be selected.
static const int SERVER_IO_ERROR_EVT
Issued when an update fails due to an IO error.
std::string getRequestId() const
Fetches the request id that identifies this transaction.
virtual void defineStates()
Adds states defined by NameChangeTransaction to the state set.
void addLeaseAddressRdata(dns::RRsetPtr &rrset)
Adds an RData for the lease address to the given RRset.
virtual void sendUpdate(const std::string &comment="")
Send the update request to the current server.
void setForwardChangeCompleted(const bool value)
Sets the forward change completion flag to the given value.
void addPtrRdata(dns::RRsetPtr &rrset)
Adds an RData for the lease FQDN to the given RRset.
bool selectNextServer()
Selects the next server in the current server list.
void setNcrStatus(const dhcp_ddns::NameChangeStatus &status)
Sets the status of the transaction's NameChangeRequest.
DdnsDomainPtr & getForwardDomain()
Fetches the forward DdnsDomain.
virtual void verifyEvents()
Validates the contents of the set of events.
void addDhcidRdata(dns::RRsetPtr &rrset)
Adds an RData for the lease client's DHCID to the given RRset.
void clearDnsUpdateRequest()
Destroys the current update request packet.
void clearUpdateAttempts()
Resets the update attempts count.
static const int SELECTING_REV_SERVER_ST
State in which reverse DNS server selection is done.
DNSClient::Status getDnsUpdateStatus() const
Fetches the most recent DNS update status.
void setDnsUpdateRequest(D2UpdateMessagePtr &request)
Sets the update request packet to the given packet.
static const int NO_MORE_SERVERS_EVT
Issued when there are no more servers from which to select.
virtual void defineEvents()
Adds events defined by NameChangeTransaction to the event set.
void setReverseChangeCompleted(const bool value)
Sets the reverse change completion flag to the given value.
const DnsServerInfoPtr & getCurrentServer() const
Fetches the currently selected server.
static const int SERVER_SELECTED_EVT
Issued when a server has been selected.
DdnsDomainPtr & getReverseDomain()
Fetches the reverse DdnsDomain.
std::string transactionOutcomeString() const
Returns a string version of transaction outcome.
Thrown if the SimpleAddTransaction encounters a general error.
void selectingFwdServerHandler()
State handler for SELECTING_FWD_SERVER_ST.
virtual void defineEvents()
Adds events defined by SimpleAddTransaction to the event set.
static const int FQDN_IN_USE_EVT
Event sent when an add attempt fails with address in use.
void readyHandler()
State handler for READY_ST.
void processAddOkHandler()
State handler for PROCESS_TRANS_OK_ST.
static const int REPLACING_REV_PTRS_ST
State that attempts to replace reverse PTR records.
void selectingRevServerHandler()
State handler for SELECTING_REV_SERVER_ST.
SimpleAddTransaction(asiolink::IOServicePtr &io_service, dhcp_ddns::NameChangeRequestPtr &ncr, DdnsDomainPtr &forward_domain, DdnsDomainPtr &reverse_domain, D2CfgMgrPtr &cfg_mgr)
Constructor.
void replacingFwdAddrsHandler()
State handler for REPLACING_FWD_ADDRS_ST.
void replacingRevPtrsHandler()
State handler for REPLACING_REV_PTRS_ST.
virtual void verifyEvents()
Validates the contents of the set of events.
void buildReplaceRevPtrsRequest()
Builds a DNS request to replace a reverse DNS entry for an FQDN.
static const int FQDN_NOT_IN_USE_EVT
Event sent when replace attempt to fails with address not in use.
virtual ~SimpleAddTransaction()
Destructor.
static const int REPLACING_FWD_ADDRS_ST
State that attempts to add forward address records.
virtual void verifyStates()
Validates the contents of the set of states.
void processAddFailedHandler()
State handler for PROCESS_TRANS_FAILED_ST.
virtual void defineStates()
Adds states defined by SimpleAddTransaction to the state set.
void buildReplaceFwdAddressRequest()
Builds a DNS request to add/replace a forward DNS entry for an FQDN.
The Name class encapsulates DNS names.
static const RRClass & ANY()
static const RRClass & IN()
The RRTTL class encapsulates TTLs used in DNS resource records.
static const RRType & PTR()
static const RRType & DHCID()
The RRset class is a concrete derived class of BasicRRset which contains a pointer to an additional R...
DNS Response Codes (RCODEs) class.
static const Rcode & NOERROR()
A constant object for the NOERROR Rcode (see Rcode::NOERROR_CODE).
uint16_t getCode() const
Returns the Rcode code value.
const EventPtr & getEvent(unsigned int value)
Fetches the event referred to by value.
void endModel()
Conducts a normal transition to the end of the model.
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.
unsigned int getNextEvent() const
Fetches the model's next event.
void defineEvent(unsigned int value, const std::string &label)
Adds an event value and associated label to the set of events.
void transition(unsigned int state, unsigned int event)
Sets up the model to transition into given state with a given event.
bool doOnEntry()
Checks if on entry flag is true.
static const int START_EVT
Event issued to start the model execution.
const StatePtr getStateInternal(unsigned int value)
Fetches the state referred to by value.
std::string getContextStr() const
Convenience method which returns a string rendition of the current state and next event.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
#define LOG_INFO(LOGGER, MESSAGE)
Macro to conveniently test info output and log it.
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
boost::shared_ptr< D2UpdateMessage > D2UpdateMessagePtr
Pointer to the DNS Update Message.
const isc::log::MessageID DHCP_DDNS_FORWARD_ADD_BUILD_FAILURE
boost::shared_ptr< DdnsDomain > DdnsDomainPtr
Defines a pointer for DdnsDomain instances.
const isc::log::MessageID DHCP_DDNS_FORWARD_ADD_REJECTED
const isc::log::MessageID DHCP_DDNS_REVERSE_REPLACE_RESP_CORRUPT
boost::shared_ptr< D2CfgMgr > D2CfgMgrPtr
Defines a shared pointer to D2CfgMgr.
const isc::log::MessageID DHCP_DDNS_ADD_SUCCEEDED
const isc::log::MessageID DHCP_DDNS_FORWARD_ADD_IO_ERROR
const isc::log::MessageID DHCP_DDNS_REVERSE_REPLACE_TIMEOUT
const isc::log::MessageID DHCP_DDNS_ADD_FAILED
isc::log::Logger d2_to_dns_logger("d2-to-dns")
const isc::log::MessageID DHCP_DDNS_FORWARD_ADD_TIMEOUT
const isc::log::MessageID DHCP_DDNS_REVERSE_REPLACE_REJECTED
const isc::log::MessageID DHCP_DDNS_REVERSE_REPLACE_BUILD_FAILURE
const isc::log::MessageID DHCP_DDNS_FORWARD_ADD_BAD_DNSCLIENT_STATUS
const isc::log::MessageID DHCP_DDNS_REVERSE_REPLACE_BAD_DNSCLIENT_STATUS
const isc::log::MessageID DHCP_DDNS_REVERSE_REPLACE_IO_ERROR
const isc::log::MessageID DHCP_DDNS_FORWARD_ADD_RESP_CORRUPT
boost::shared_ptr< NameChangeRequest > NameChangeRequestPtr
Defines a pointer to a NameChangeRequest.
boost::shared_ptr< AbstractRRset > RRsetPtr
A pointer-like type pointing to an RRset object.
Defines the logger used by the top-level component of kea-lfc.