Kea  1.9.9-git
simple_add.cc
Go to the documentation of this file.
1 // Copyright (C) 2020 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #include <config.h>
8 
9 #include <d2/d2_log.h>
10 #include <d2/d2_cfg_mgr.h>
11 #include <d2/simple_add.h>
12 
13 #include <util/buffer.h>
14 #include <dns/rdataclass.h>
15 
16 #include <functional>
17 
18 namespace isc {
19 namespace d2 {
20 
21 // SimpleAddTransaction states
24 
25 // SimpleAddTransaction events
28 
32  DdnsDomainPtr& forward_domain,
33  DdnsDomainPtr& reverse_domain,
34  D2CfgMgrPtr& cfg_mgr)
35  : NameChangeTransaction(io_service, ncr, forward_domain, reverse_domain,
36  cfg_mgr) {
37  if (ncr->getChangeType() != isc::dhcp_ddns::CHG_ADD) {
39  "SimpleAddTransaction, request type must be CHG_ADD");
40  }
41 }
42 
44 }
45 
46 void
48  // Call superclass impl first.
50 
51  // Define SimpleAddTransaction events.
52  defineEvent(FQDN_IN_USE_EVT, "FQDN_IN_USE_EVT");
53  defineEvent(FQDN_NOT_IN_USE_EVT, "FQDN_NOT_IN_USE_EVT");
54 }
55 
56 void
58  // Call superclass implementation first to verify its events. These are
59  // events common to all transactions, and they must be defined.
60  // SELECT_SERVER_EVT
61  // SERVER_SELECTED_EVT
62  // SERVER_IO_ERROR_EVT
63  // NO_MORE_SERVERS_EVT
64  // IO_COMPLETED_EVT
65  // UPDATE_OK_EVT
66  // UPDATE_FAILED_EVT
68 
69  // Verify SimpleAddTransaction events by attempting to fetch them.
72 }
73 
74 void
76  // Call superclass impl first.
78 
79  // Define SimpleAddTransaction states.
80  defineState(READY_ST, "READY_ST",
81  std::bind(&SimpleAddTransaction::readyHandler, this));
82 
83  defineState(SELECTING_FWD_SERVER_ST, "SELECTING_FWD_SERVER_ST",
85 
86  defineState(SELECTING_REV_SERVER_ST, "SELECTING_REV_SERVER_ST",
88 
89  defineState(REPLACING_FWD_ADDRS_ST, "REPLACING_FWD_ADDRS_ST",
91 
92  defineState(REPLACING_REV_PTRS_ST, "REPLACING_REV_PTRS_ST",
94 
95  defineState(PROCESS_TRANS_OK_ST, "PROCESS_TRANS_OK_ST",
97 
98  defineState(PROCESS_TRANS_FAILED_ST, "PROCESS_TRANS_FAILED_ST",
100 }
101 
102 void
104  // Call superclass implementation first to verify its states. These are
105  // states common to all transactions, and they must be defined.
106  // READY_ST
107  // SELECTING_FWD_SERVER_ST
108  // SELECTING_REV_SERVER_ST
109  // PROCESS_TRANS_OK_ST
110  // PROCESS_TRANS_FAILED_ST
112 
113  // Verify SimpleAddTransaction states by attempting to fetch them.
116 }
117 
118 void
120  switch(getNextEvent()) {
121  case START_EVT:
122  if (getForwardDomain()) {
123  // Request includes a forward change, do that first.
125  } else {
126  // Reverse change only, transition accordingly.
128  }
129 
130  break;
131  default:
132  // Event is invalid.
134  "Wrong event for context: " << getContextStr());
135  }
136 }
137 
138 void
140  switch(getNextEvent()) {
141  case SELECT_SERVER_EVT:
142  // First time through for this transaction, so initialize server
143  // selection.
145  break;
146  case SERVER_IO_ERROR_EVT:
147  // We failed to communicate with current server. Attempt to select
148  // another one below.
149  break;
150  default:
151  // Event is invalid.
153  "Wrong event for context: " << getContextStr());
154  }
155 
156  // Select the next server from the list of forward servers.
157  if (selectNextServer()) {
158  // We have a server to try.
160  }
161  else {
162  // Server list is exhausted, so fail the transaction.
164  }
165 }
166 
167 void
169  if (doOnEntry()) {
170  // Clear the request on initial transition. This allows us to reuse
171  // the request on retries if necessary.
173  }
174 
175  switch(getNextEvent()) {
176  case SERVER_SELECTED_EVT:
177  if (!getDnsUpdateRequest()) {
178  // Request hasn't been constructed yet, so build it.
179  try {
181  } catch (const std::exception& ex) {
182  // While unlikely, the build might fail if we have invalid
183  // data. Should that be the case, we need to fail the
184  // transaction.
186  .arg(getRequestId())
187  .arg(getNcr()->toText())
188  .arg(ex.what());
190  break;
191  }
192  }
193 
194  // Call sendUpdate() to initiate the async send. Note it also sets
195  // next event to NOP_EVT.
196  sendUpdate("Forward Add");
197  break;
198 
199  case IO_COMPLETED_EVT: {
200  switch (getDnsUpdateStatus()) {
201  case DNSClient::SUCCESS: {
202  // We successfully received a response packet from the server.
203  const dns::Rcode& rcode = getDnsUpdateResponse()->getRcode();
204  if (rcode == dns::Rcode::NOERROR()) {
205  // We were able to add it. Mark it as done.
207 
208  // If request calls for reverse update then do that next,
209  // otherwise we can process ok.
210  if (getReverseDomain()) {
212  } else {
214  }
215  } else {
216  // Any other value means cease. Really shouldn't happen.
218  .arg(getRequestId())
219  .arg(getCurrentServer()->toText())
220  .arg(getNcr()->getFqdn())
221  .arg(rcode.getCode());
223  }
224 
225  break;
226  }
227 
228  case DNSClient::TIMEOUT:
229  case DNSClient::OTHER:
230  // We couldn't send to the current server, log it and set up
231  // to select the next server for a retry.
232  // @note For now we treat OTHER as an IO error like TIMEOUT. It
233  // is not entirely clear if this is accurate.
235  .arg(getRequestId())
236  .arg(getNcr()->getFqdn())
237  .arg(getCurrentServer()->toText());
238 
240  break;
241 
243  // A response was received but was corrupt. Retry it like an IO
244  // error.
246  .arg(getRequestId())
247  .arg(getCurrentServer()->toText())
248  .arg(getNcr()->getFqdn());
249 
251  break;
252 
253  default:
254  // Any other value and we will fail this transaction, something
255  // bigger is wrong.
257  .arg(getRequestId())
258  .arg(getDnsUpdateStatus())
259  .arg(getNcr()->getFqdn())
260  .arg(getCurrentServer()->toText());
261 
263  break;
264  } // end switch on dns_status
265 
266  break;
267  } // end case IO_COMPLETE_EVT
268 
269  default:
270  // Event is invalid.
272  "Wrong event for context: " << getContextStr());
273  }
274 }
275 
276 void
278  switch(getNextEvent()) {
279  case SELECT_SERVER_EVT:
280  // First time through for this transaction, so initialize server
281  // selection.
283  break;
284  case SERVER_IO_ERROR_EVT:
285  // We failed to communicate with current server. Attempt to select
286  // another one below.
287  break;
288  default:
289  // Event is invalid.
291  "Wrong event for context: " << getContextStr());
292  }
293 
294  // Select the next server from the list of forward servers.
295  if (selectNextServer()) {
296  // We have a server to try.
298  }
299  else {
300  // Server list is exhausted, so fail the transaction.
302  }
303 }
304 
305 
306 void
308  if (doOnEntry()) {
309  // Clear the request on initial transition. This allows us to reuse
310  // the request on retries if necessary.
312  }
313 
314  switch(getNextEvent()) {
315  case SERVER_SELECTED_EVT:
316  if (!getDnsUpdateRequest()) {
317  // Request hasn't been constructed yet, so build it.
318  try {
320  } catch (const std::exception& ex) {
321  // While unlikely, the build might fail if we have invalid
322  // data. Should that be the case, we need to fail the
323  // transaction.
325  .arg(getRequestId())
326  .arg(getNcr()->toText())
327  .arg(ex.what());
329  break;
330  }
331  }
332 
333  // Call sendUpdate() to initiate the async send. Note it also sets
334  // next event to NOP_EVT.
335  sendUpdate("Reverse Replace");
336  break;
337 
338  case IO_COMPLETED_EVT: {
339  switch (getDnsUpdateStatus()) {
340  case DNSClient::SUCCESS: {
341  // We successfully received a response packet from the server.
342  const dns::Rcode& rcode = getDnsUpdateResponse()->getRcode();
343  if (rcode == dns::Rcode::NOERROR()) {
344  // We were able to update the reverse mapping. Mark it as done.
347  } else {
348  // Per RFC4703 any other value means cease.
349  // If we get not authorized should try the next server in
350  // the list? @todo This needs some discussion perhaps.
352  .arg(getRequestId())
353  .arg(getCurrentServer()->toText())
354  .arg(getNcr()->getFqdn())
355  .arg(rcode.getCode());
357  }
358 
359  break;
360  }
361 
362  case DNSClient::TIMEOUT:
363  case DNSClient::OTHER:
364  // We couldn't send to the current server, log it and set up
365  // to select the next server for a retry.
366  // @note For now we treat OTHER as an IO error like TIMEOUT. It
367  // is not entirely clear if this is accurate.
369  .arg(getRequestId())
370  .arg(getNcr()->getFqdn())
371  .arg(getCurrentServer()->toText());
372 
373  // If we are out of retries on this server, we go back and start
374  // all over on a new server.
376  break;
377 
379  // A response was received but was corrupt. Retry it like an IO
380  // error.
382  .arg(getRequestId())
383  .arg(getCurrentServer()->toText())
384  .arg(getNcr()->getFqdn());
385 
386  // If we are out of retries on this server, we go back and start
387  // all over on a new server.
389  break;
390 
391  default:
392  // Any other value and we will fail this transaction, something
393  // bigger is wrong.
396  .arg(getRequestId())
397  .arg(getDnsUpdateStatus())
398  .arg(getNcr()->getFqdn())
399  .arg(getCurrentServer()->toText());
400 
402  break;
403  } // end switch on dns_status
404 
405  break;
406  } // end case IO_COMPLETE_EVT
407 
408  default:
409  // Event is invalid.
411  "Wrong event for context: " << getContextStr());
412  }
413 }
414 
415 void
417  switch(getNextEvent()) {
418  case UPDATE_OK_EVT:
420  .arg(getRequestId())
421  .arg(getNcr()->toText());
423  endModel();
424  break;
425  default:
426  // Event is invalid.
428  "Wrong event for context: " << getContextStr());
429  }
430 }
431 
432 void
434  switch(getNextEvent()) {
435  case UPDATE_FAILED_EVT:
436  case NO_MORE_SERVERS_EVT:
439  .arg(getRequestId())
440  .arg(transactionOutcomeString());
441  endModel();
442  break;
443  default:
444  // Event is invalid.
446  "Wrong event for context: " << getContextStr());
447  }
448 }
449 
450 void
452  // Construct an empty request.
454 
455  // Construct dns::Name from NCR fqdn.
456  dns::Name fqdn(dns::Name(getNcr()->getFqdn()));
457 
458  // There are no prerequisites.
459 
460  // Build the Update Section. First we delete any pre-existing
461  // FQDN/IP and DHCID RRs. Then we add new ones.
462 
463  // Create the FQDN/IP 'delete' RR and add it to update section.
464  dns::RRsetPtr update(new dns::RRset(fqdn, dns::RRClass::ANY(),
466 
467  request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
468 
469  // Create the DHCID 'delete' RR and add it to the update section.
470  update.reset(new dns::RRset(fqdn, dns::RRClass::ANY(),
472  request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
473 
474  // Now make the new RRs.
475  // Create the TTL based on lease length.
476  dns::RRTTL lease_ttl(getNcr()->getLeaseLength());
477 
478  // Create the FQDN/IP 'add' RR and add it to the to update section.
479  // Based on RFC 2136, section 2.5.1
480  update.reset(new dns::RRset(fqdn, dns::RRClass::IN(),
481  getAddressRRType(), lease_ttl));
482 
483  addLeaseAddressRdata(update);
484  request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
485 
486  // Now create the FQDN/DHCID 'add' RR and add it to update section.
487  // Based on RFC 2136, section 2.5.1
488  update.reset(new dns::RRset(fqdn, dns::RRClass::IN(),
489  dns::RRType::DHCID(), lease_ttl));
490 
491  // We add the DHCID for auditing purposes and in the event
492  // conflict resolution is later enabled.
493  addDhcidRdata(update);
494  request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
495 
496  // Set the transaction's update request to the new request.
497  setDnsUpdateRequest(request);
498 }
499 
500 void
502  // Construct an empty request.
504 
505  // Create the reverse IP address "FQDN".
506  std::string rev_addr = D2CfgMgr::reverseIpAddress(getNcr()->getIpAddress());
507  dns::Name rev_ip(rev_addr);
508 
509  // Create the TTL based on lease length.
510  dns::RRTTL lease_ttl(getNcr()->getLeaseLength());
511 
512  // There are no prerequisites.
513 
514  // Create the FQDN/IP PTR 'delete' RR for this IP and add it to
515  // the update section.
516  dns::RRsetPtr update(new dns::RRset(rev_ip, dns::RRClass::ANY(),
518  request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
519 
520  // Create the DHCID 'delete' RR and add it to the update section.
521  update.reset(new dns::RRset(rev_ip, dns::RRClass::ANY(),
523  request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
524 
525  // Create the FQDN/IP PTR 'add' RR, add the FQDN as the PTR Rdata
526  // then add it to update section.
527  update.reset(new dns::RRset(rev_ip, dns::RRClass::IN(),
528  dns::RRType::PTR(), lease_ttl));
529  addPtrRdata(update);
530  request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
531 
532  // Create the FQDN/IP PTR 'add' RR, add the DHCID Rdata
533  // then add it to update section.
534  update.reset(new dns::RRset(rev_ip, dns::RRClass::IN(),
535  dns::RRType::DHCID(), lease_ttl));
536  addDhcidRdata(update);
537  request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
538 
539  // Set the transaction's update request to the new request.
540  setDnsUpdateRequest(request);
541 }
542 
543 } // namespace isc::d2
544 } // namespace isc
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.
Definition: state_model.cc:196
virtual D2UpdateMessagePtr prepNewRequest(DdnsDomainPtr domain)
Creates a new DNS update request based on the given domain.
Definition: nc_trans.cc:316
The Name class encapsulates DNS names.
Definition: name.h:223
virtual void sendUpdate(const std::string &comment="")
Send the update request to the current server.
Definition: nc_trans.cc:169
const isc::log::MessageID DHCP_DDNS_REVERSE_REPLACE_RESP_CORRUPT
Definition: d2_messages.h:75
static const RRType & DHCID()
Definition: rrtype.h:503
virtual void defineEvents()
Adds events defined by SimpleAddTransaction to the event set.
Definition: simple_add.cc:47
static const int PROCESS_TRANS_OK_ST
State which processes successful transaction conclusion.
Definition: nc_trans.h:102
const isc::log::MessageID DHCP_DDNS_REVERSE_REPLACE_REJECTED
Definition: d2_messages.h:74
void defineEvent(unsigned int value, const std::string &label)
Adds an event value and associated label to the set of events.
Definition: state_model.cc:170
static const RRType & PTR()
Definition: rrtype.h:443
#define LOG_INFO(LOGGER, MESSAGE)
Macro to conveniently test info output and log it.
Definition: macros.h:20
const isc::log::MessageID DHCP_DDNS_FORWARD_ADD_BUILD_FAILURE
Definition: d2_messages.h:22
void selectingFwdServerHandler()
State handler for SELECTING_FWD_SERVER_ST.
Definition: simple_add.cc:139
static std::string reverseIpAddress(const std::string &address)
Generate a reverse order string for the given IP address.
Definition: d2_cfg_mgr.cc:170
boost::shared_ptr< DdnsDomain > DdnsDomainPtr
Defines a pointer for DdnsDomain instances.
Definition: d2_config.h:591
static const Rcode & NOERROR()
A constant object for the NOERROR Rcode (see Rcode::NOERROR_CODE).
Definition: rcode.h:220
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.
Definition: nc_trans.cc:479
const isc::log::MessageID DHCP_DDNS_FORWARD_ADD_BAD_DNSCLIENT_STATUS
Definition: d2_messages.h:21
static const RRClass & IN()
Definition: rrclass.h:319
static const int START_EVT
Event issued to start the model execution.
Definition: state_model.h:295
static const int REPLACING_FWD_ADDRS_ST
State that attempts to add forward address records.
Definition: simple_add.h:52
void replacingFwdAddrsHandler()
State handler for REPLACING_FWD_ADDRS_ST.
Definition: simple_add.cc:168
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
Definition: macros.h:32
const isc::log::MessageID DHCP_DDNS_ADD_SUCCEEDED
Definition: d2_messages.h:12
No response, timeout.
Definition: dns_client.h:62
static const int SELECTING_FWD_SERVER_ST
State in which forward DNS server selection is done.
Definition: nc_trans.h:91
virtual ~SimpleAddTransaction()
Destructor.
Definition: simple_add.cc:43
std::string transactionOutcomeString() const
Returns a string version of transaction outcome.
Definition: nc_trans.cc:147
DNS Response Codes (RCODEs) class.
Definition: rcode.h:40
const isc::log::MessageID DHCP_DDNS_FORWARD_ADD_REJECTED
Definition: d2_messages.h:24
boost::shared_ptr< NameChangeRequest > NameChangeRequestPtr
Defines a pointer to a NameChangeRequest.
Definition: ncr_msg.h:212
void endModel()
Conducts a normal transition to the end of the model.
Definition: state_model.cc:271
static const int SERVER_IO_ERROR_EVT
Issued when an update fails due to an IO error.
Definition: nc_trans.h:119
const dhcp_ddns::NameChangeRequestPtr & getNcr() const
Fetches the NameChangeRequest for this transaction.
Definition: nc_trans.cc:398
static const int IO_COMPLETED_EVT
Issued when a DNS update packet exchange has completed.
Definition: nc_trans.h:130
virtual void verifyStates()
Validates the contents of the set of states.
Definition: simple_add.cc:103
static const int FQDN_IN_USE_EVT
Event sent when an add attempt fails with address in use.
Definition: simple_add.h:60
void processAddOkHandler()
State handler for PROCESS_TRANS_OK_ST.
Definition: simple_add.cc:416
Other, unclassified error.
Definition: dns_client.h:65
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
const isc::log::MessageID DHCP_DDNS_REVERSE_REPLACE_IO_ERROR
Definition: d2_messages.h:73
void setForwardChangeCompleted(const bool value)
Sets the forward change completion flag to the given value.
Definition: nc_trans.cc:301
void addDhcidRdata(dns::RRsetPtr &rrset)
Adds an RData for the lease client's DHCID to the given RRset.
Definition: nc_trans.cc:361
std::string getRequestId() const
Fetches the request id that identifies this transaction.
Definition: nc_trans.cc:408
isc::log::Logger d2_to_dns_logger("d2-to-dns")
Definition: d2_log.h:20
static const int SERVER_SELECTED_EVT
Issued when a server has been selected.
Definition: nc_trans.h:116
void selectingRevServerHandler()
State handler for SELECTING_REV_SERVER_ST.
Definition: simple_add.cc:277
void replacingRevPtrsHandler()
State handler for REPLACING_REV_PTRS_ST.
Definition: simple_add.cc:307
void buildReplaceRevPtrsRequest()
Builds a DNS request to replace a reverse DNS entry for an FQDN.
Definition: simple_add.cc:501
void retryTransition(const int fail_to_state)
Determines the state and next event based on update attempts.
Definition: nc_trans.cc:263
bool doOnEntry()
Checks if on entry flag is true.
Definition: state_model.cc:339
const isc::log::MessageID DHCP_DDNS_REVERSE_REPLACE_BUILD_FAILURE
Definition: d2_messages.h:72
const isc::log::MessageID DHCP_DDNS_FORWARD_ADD_IO_ERROR
Definition: d2_messages.h:23
const D2UpdateMessagePtr & getDnsUpdateRequest() const
Fetches the current DNS update request packet.
Definition: nc_trans.cc:484
boost::shared_ptr< D2CfgMgr > D2CfgMgrPtr
Defines a shared pointer to D2CfgMgr.
Definition: d2_cfg_mgr.h:334
DNSClient::Status getDnsUpdateStatus() const
Fetches the most recent DNS update status.
Definition: nc_trans.cc:489
virtual void defineStates()
Adds states defined by NameChangeTransaction to the state set.
Definition: nc_trans.cc:234
const isc::log::MessageID DHCP_DDNS_FORWARD_ADD_RESP_CORRUPT
Definition: d2_messages.h:25
The RRTTL class encapsulates TTLs used in DNS resource records.
Definition: rrttl.h:55
void readyHandler()
State handler for READY_ST.
Definition: simple_add.cc:119
void setReverseChangeCompleted(const bool value)
Sets the reverse change completion flag to the given value.
Definition: nc_trans.cc:306
static const int FQDN_NOT_IN_USE_EVT
Event sent when replace attempt to fails with address not in use.
Definition: simple_add.h:63
Response received and is ok.
Definition: dns_client.h:61
static const int REPLACING_REV_PTRS_ST
State that attempts to replace reverse PTR records.
Definition: simple_add.h:55
static const RRClass & ANY()
Definition: rrclass.h:301
static const int SELECTING_REV_SERVER_ST
State in which reverse DNS server selection is done.
Definition: nc_trans.h:99
std::string getContextStr() const
Convenience method which returns a string rendition of the current state and next event...
Definition: state_model.cc:443
DdnsDomainPtr & getForwardDomain()
Fetches the forward DdnsDomain.
Definition: nc_trans.cc:418
Defines the logger used by the top-level component of kea-dhcp-ddns.
void addPtrRdata(dns::RRsetPtr &rrset)
Adds an RData for the lease FQDN to the given RRset.
Definition: nc_trans.cc:381
const D2UpdateMessagePtr & getDnsUpdateResponse() const
Fetches the most recent DNS update response packet.
Definition: nc_trans.cc:494
static const int NO_MORE_SERVERS_EVT
Issued when there are no more servers from which to select.
Definition: nc_trans.h:125
void buildReplaceFwdAddressRequest()
Builds a DNS request to add/replace a forward DNS entry for an FQDN.
Definition: simple_add.cc:451
void transition(unsigned int state, unsigned int event)
Sets up the model to transition into given state with a given event.
Definition: state_model.cc:264
The RRset class is a concrete derived class of BasicRRset which contains a pointer to an additional R...
Definition: rrset.h:847
Response received but invalid.
Definition: dns_client.h:64
Thrown if the SimpleAddTransaction encounters a general error.
Definition: simple_add.h:19
static const int PROCESS_TRANS_FAILED_ST
State which processes an unsuccessful transaction conclusion.
Definition: nc_trans.h:105
const isc::log::MessageID DHCP_DDNS_REVERSE_REPLACE_BAD_DNSCLIENT_STATUS
Definition: d2_messages.h:71
const DnsServerInfoPtr & getCurrentServer() const
Fetches the currently selected server.
Definition: nc_trans.cc:474
virtual void defineStates()
Adds states defined by SimpleAddTransaction to the state set.
Definition: simple_add.cc:75
static const int SELECT_SERVER_EVT
Issued when a server needs to be selected.
Definition: nc_trans.h:113
void clearDnsUpdateRequest()
Destroys the current update request packet and resets update attempts count.
Definition: nc_trans.cc:280
static const int READY_ST
State from which a transaction is started.
Definition: nc_trans.h:83
void setDnsUpdateRequest(D2UpdateMessagePtr &request)
Sets the update request packet to the given packet.
Definition: nc_trans.cc:275
const isc::log::MessageID DHCP_DDNS_ADD_FAILED
Definition: d2_messages.h:11
virtual void defineEvents()
Adds events defined by NameChangeTransaction to the event set.
Definition: nc_trans.cc:204
Embodies the "life-cycle" required to carry out a DDNS update.
Definition: nc_trans.h:77
const StatePtr getStateInternal(unsigned int value)
Fetches the state referred to by value.
Definition: state_model.cc:219
virtual void verifyEvents()
Validates the contents of the set of events.
Definition: simple_add.cc:57
static const int UPDATE_OK_EVT
Issued when the attempted update successfully completed.
Definition: nc_trans.h:135
const dns::RRType & getAddressRRType() const
Returns the DHCP data type for the lease address.
Definition: nc_trans.cc:514
boost::shared_ptr< AbstractRRset > RRsetPtr
A pointer-like type pointing to an RRset object.
Definition: rrset.h:47
DdnsDomainPtr & getReverseDomain()
Fetches the reverse DdnsDomain.
Definition: nc_trans.cc:423
const EventPtr & getEvent(unsigned int value)
Fetches the event referred to by value.
Definition: state_model.cc:186
SimpleAddTransaction(asiolink::IOServicePtr &io_service, dhcp_ddns::NameChangeRequestPtr &ncr, DdnsDomainPtr &forward_domain, DdnsDomainPtr &reverse_domain, D2CfgMgrPtr &cfg_mgr)
Constructor.
Definition: simple_add.cc:30
unsigned int getNextEvent() const
Fetches the model's next event.
Definition: state_model.cc:373
void processAddFailedHandler()
State handler for PROCESS_TRANS_FAILED_ST.
Definition: simple_add.cc:433
static const int UPDATE_FAILED_EVT
Issued when the attempted update fails to complete.
Definition: nc_trans.h:141
uint16_t getCode() const
Returns the Rcode code value.
Definition: rcode.h:106
virtual void verifyEvents()
Validates the contents of the set of events.
Definition: nc_trans.cc:219
void addLeaseAddressRdata(dns::RRsetPtr &rrset)
Adds an RData for the lease address to the given RRset.
Definition: nc_trans.cc:339
void initServerSelection(const DdnsDomainPtr &domain)
Initializes server selection from the given DDNS domain.
Definition: nc_trans.cc:428
bool selectNextServer()
Selects the next server in the current server list.
Definition: nc_trans.cc:448
virtual void verifyStates()
Validates the contents of the set of states.
Definition: nc_trans.cc:242