Kea  2.3.3-git
nc_trans.cc
Go to the documentation of this file.
1 // Copyright (C) 2013-2021 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 <d2srv/d2_log.h>
10 #include <d2srv/nc_trans.h>
11 #include <dns/qid_gen.h>
12 #include <dns/rdata.h>
13 #include <hooks/hooks.h>
14 #include <hooks/hooks_manager.h>
15 
16 #include <sstream>
17 
18 using namespace isc::hooks;
19 using namespace isc::util;
20 
21 namespace {
22 
24 struct NcTransHooks {
25  int hooks_index_select_key_;
26 
28  NcTransHooks() {
29  hooks_index_select_key_ = HooksManager::registerHook("select_key");
30  }
31 };
32 
33 // Declare a Hooks object. As this is outside any function or method, it
34 // will be instantiated (and the constructor run) when the module is loaded.
35 // As a result, the hook indexes will be defined before any method in this
36 // module is called.
37 
38 NcTransHooks Hooks;
39 
40 }
41 
42 namespace isc {
43 namespace d2 {
44 
45 // Common transaction states
46 const int NameChangeTransaction::READY_ST;
47 const int NameChangeTransaction::SELECTING_FWD_SERVER_ST;
48 const int NameChangeTransaction::SELECTING_REV_SERVER_ST;
49 const int NameChangeTransaction::PROCESS_TRANS_OK_ST;
50 const int NameChangeTransaction::PROCESS_TRANS_FAILED_ST;
51 
52 const int NameChangeTransaction::NCT_DERIVED_STATE_MIN;
53 
54 // Common transaction events
55 const int NameChangeTransaction::SELECT_SERVER_EVT;
56 const int NameChangeTransaction::SERVER_SELECTED_EVT;
57 const int NameChangeTransaction::SERVER_IO_ERROR_EVT;
58 const int NameChangeTransaction::NO_MORE_SERVERS_EVT;
59 const int NameChangeTransaction::IO_COMPLETED_EVT;
60 const int NameChangeTransaction::UPDATE_OK_EVT;
61 const int NameChangeTransaction::UPDATE_FAILED_EVT;
62 
63 const int NameChangeTransaction::NCT_DERIVED_EVENT_MIN;
64 
65 const unsigned int NameChangeTransaction::MAX_UPDATE_TRIES_PER_SERVER;
66 
67 NameChangeTransaction::
68 NameChangeTransaction(asiolink::IOServicePtr& io_service,
70  DdnsDomainPtr& forward_domain,
71  DdnsDomainPtr& reverse_domain,
72  D2CfgMgrPtr& cfg_mgr)
73  : io_service_(io_service), ncr_(ncr), forward_domain_(forward_domain),
74  reverse_domain_(reverse_domain), dns_client_(), dns_update_request_(),
75  dns_update_status_(DNSClient::OTHER), dns_update_response_(),
76  forward_change_completed_(false), reverse_change_completed_(false),
77  current_server_list_(), current_server_(), next_server_pos_(0),
78  update_attempts_(0), cfg_mgr_(cfg_mgr), tsig_key_() {
81  if (!io_service_) {
82  isc_throw(NameChangeTransactionError, "IOServicePtr cannot be null");
83  }
84 
85  if (!ncr_) {
87  "NameChangeRequest cannot be null");
88  }
89 
90  if (ncr_->isForwardChange() && !(forward_domain_)) {
92  "Forward change must have a forward domain");
93  }
94 
95  if (ncr_->isReverseChange() && !(reverse_domain_)) {
97  "Reverse change must have a reverse domain");
98  }
99 
100  if (!cfg_mgr_) {
102  "Configuration manager cannot be null");
103  }
104 }
105 
107 }
108 
109 void
113  .arg(getRequestId());
114 
117 }
118 
119 void
121  // Stow the completion status and re-enter the run loop with the event
122  // set to indicate IO completed.
123  // runModel is exception safe so we are good to call it here.
124  // It won't exit until we hit the next IO wait or the state model ends.
125  setDnsUpdateStatus(status);
128  .arg(getRequestId())
129  .arg(current_server_->toText())
130  .arg(responseString());
131 
133 }
134 
135 std::string
137  std::ostringstream stream;
138  switch (getDnsUpdateStatus()) {
139  case DNSClient::SUCCESS:
140  stream << "SUCCESS, rcode: ";
141  if (getDnsUpdateResponse()) {
142  stream << getDnsUpdateResponse()->getRcode().toText();
143  } else {
144  stream << " update response is NULL";
145  }
146  break;
147  case DNSClient::TIMEOUT:
148  stream << "TIMEOUT";
149  break;
151  stream << "IO_STOPPED";
152  break;
154  stream << "INVALID_RESPONSE";
155  break;
156  case DNSClient::OTHER:
157  stream << "OTHER";
158  break;
159  default:
160  stream << "UNKNOWN("
161  << static_cast<int>(getDnsUpdateStatus()) << ")";
162  break;
163 
164  }
165 
166  return (stream.str());
167 }
168 
169 std::string
171  std::ostringstream stream;
172  stream << "Status: " << (getNcrStatus() == dhcp_ddns::ST_COMPLETED
173  ? "Completed, " : "Failed, ")
174  << "Event: " << getEventLabel(getNextEvent()) << ", ";
175 
176  if (ncr_->isForwardChange()) {
177  stream << " Forward change:" << (getForwardChangeCompleted()
178  ? " completed, " : " failed, ");
179  }
180 
181  if (ncr_->isReverseChange()) {
182  stream << " Reverse change:" << (getReverseChangeCompleted()
183  ? " completed, " : " failed, ");
184  }
185 
186  stream << " request: " << ncr_->toText();
187  return (stream.str());
188 }
189 
190 
191 void
192 NameChangeTransaction::sendUpdate(const std::string& comment) {
193  try {
194  ++update_attempts_;
195  // @todo add logic to add/replace TSIG key info in request if
196  // use_tsig_ is true. We should be able to navigate to the TSIG key
197  // for the current server. If not we would need to add that.
198 
199  D2ParamsPtr d2_params = cfg_mgr_->getD2Params();
200  dns_client_->doUpdate(*io_service_, current_server_->getIpAddress(),
201  current_server_->getPort(), *dns_update_request_,
202  d2_params->getDnsServerTimeout(), tsig_key_);
203  // Message is on its way, so the next event should be NOP_EVT.
207  .arg(getRequestId())
208  .arg(comment)
209  .arg(current_server_->toText());
210  } catch (const std::exception& ex) {
211  // We were unable to initiate the send.
212  // It is presumed that any throw from doUpdate is due to a programmatic
213  // error, such as an unforeseen permutation of data, rather than an IO
214  // failure. IO errors should be caught by the underlying asiolink
215  // mechanisms and manifested as an unsuccessful IO status in the
216  // DNSClient callback. Any problem here most likely means the request
217  // is corrupt in some way and cannot be completed, therefore we will
218  // log it and transition it to failure.
220  .arg(getRequestId())
221  .arg(ex.what());
223  }
224 }
225 
226 void
228  // Call superclass impl first.
230 
231  // Define NCT events.
232  defineEvent(SELECT_SERVER_EVT, "SELECT_SERVER_EVT");
233  defineEvent(SERVER_SELECTED_EVT, "SERVER_SELECTED_EVT");
234  defineEvent(SERVER_IO_ERROR_EVT, "SERVER_IO_ERROR_EVT");
235  defineEvent(NO_MORE_SERVERS_EVT, "NO_MORE_SERVERS_EVT");
236  defineEvent(IO_COMPLETED_EVT, "IO_COMPLETED_EVT");
237  defineEvent(UPDATE_OK_EVT, "UPDATE_OK_EVT");
238  defineEvent(UPDATE_FAILED_EVT, "UPDATE_FAILED_EVT");
239 }
240 
241 void
243  // Call superclass impl first.
245 
246  // Verify NCT events.
254 }
255 
256 void
258  // Call superclass impl first.
260  // This class is "abstract" in that it does not supply handlers for its
261  // states, derivations must do that therefore they must define them.
262 }
263 
264 void
266  // Call superclass impl first.
268 
269  // Verify NCT states. This ensures that derivations provide the handlers.
275 }
276 
277 void
278 NameChangeTransaction::onModelFailure(const std::string& explanation) {
281  .arg(getRequestId())
282  .arg(explanation);
283 }
284 
285 void
286 NameChangeTransaction::retryTransition(const int fail_to_state) {
287  if (update_attempts_ < MAX_UPDATE_TRIES_PER_SERVER) {
288  // Re-enter the current state with same server selected.
290  } else {
291  // Transition to given fail_to_state state if we are out
292  // of retries.
293  transition(fail_to_state, SERVER_IO_ERROR_EVT);
294  }
295 }
296 
297 void
299  dns_update_request_ = request;
300 }
301 
302 void
304  dns_update_request_.reset();
305 }
306 
307 void
309  update_attempts_ = 0;
310 }
311 
312 void
314  dns_update_status_ = status;
315 }
316 
317 void
319  dns_update_response_ = response;
320 }
321 
322 void
324  dns_update_response_.reset();
325 }
326 
327 void
329  forward_change_completed_ = value;
330 }
331 
332 void
334  reverse_change_completed_ = value;
335 }
336 
337 void
339  update_attempts_ = value;
340 }
341 
344  if (!domain) {
346  "prepNewRequest - domain cannot be null");
347  }
348 
349  try {
350  // Create a "blank" update request.
352  OUTBOUND));
353  // Set the query id
354  request->setId(dns::QidGenerator::getInstance().generateQid());
355  // Construct the Zone Section.
356  dns::Name zone_name(domain->getName());
357  request->setZone(zone_name, dns::RRClass::IN());
358  return (request);
359  } catch (const std::exception& ex) {
360  isc_throw(NameChangeTransactionError, "Cannot create new request :"
361  << ex.what());
362  }
363 }
364 
365 void
367  if (!rrset) {
369  "addLeaseAddressRdata - RRset cannot cannot be null");
370  }
371 
372  try {
373  // Manufacture an RData from the lease address then add it to the RR.
375  if (ncr_->isV4()) {
376  rdata.reset(new dns::rdata::in::A(ncr_->getIpAddress()));
377  } else {
378  rdata.reset(new dns::rdata::in::AAAA(ncr_->getIpAddress()));
379  }
380  rrset->addRdata(rdata);
381  } catch (const std::exception& ex) {
382  isc_throw(NameChangeTransactionError, "Cannot add address rdata: "
383  << ex.what());
384  }
385 }
386 
387 void
389  if (!rrset) {
391  "addDhcidRdata - RRset cannot cannot be null");
392  }
393 
394  try {
395  const std::vector<uint8_t>& ncr_dhcid = ncr_->getDhcid().getBytes();
396  util::InputBuffer buffer(ncr_dhcid.data(), ncr_dhcid.size());
397  dns::rdata::ConstRdataPtr rdata (new dns::rdata::in::
398  DHCID(buffer, ncr_dhcid.size()));
399  rrset->addRdata(rdata);
400  } catch (const std::exception& ex) {
401  isc_throw(NameChangeTransactionError, "Cannot add DCHID rdata: "
402  << ex.what());
403  }
404 
405 }
406 
407 void
409  if (!rrset) {
411  "addPtrRdata - RRset cannot cannot be null");
412  }
413 
414  try {
415  dns::rdata::ConstRdataPtr rdata(new dns::rdata::generic::
416  PTR(getNcr()->getFqdn()));
417  rrset->addRdata(rdata);
418  } catch (const std::exception& ex) {
419  isc_throw(NameChangeTransactionError, "Cannot add PTR rdata: "
420  << ex.what());
421  }
422 }
423 
426  return (ncr_);
427 }
428 
429 const TransactionKey&
431  return (ncr_->getDhcid());
432 }
433 
434 std::string
436  return (ncr_->getRequestId());
437 }
438 
441  return (ncr_->getStatus());
442 }
443 
446  return (forward_domain_);
447 }
448 
451  return (reverse_domain_);
452 }
453 
454 void
456  if (!domain) {
458  "initServerSelection called with an empty domain");
459  }
460 
461  current_server_list_ = domain->getServers();
462  next_server_pos_ = 0;
463  current_server_.reset();
464 }
465 
466 bool
468  for (;;) {
469  if ((current_server_list_) &&
470  (next_server_pos_ < current_server_list_->size())) {
471  current_server_ = (*current_server_list_)[next_server_pos_];
472  // Toss out any previous response.
473  dns_update_response_.reset();
474 
475  // Set the tsig_key to that of the current server.
476  if (!selectTSIGKey()) {
477  ++next_server_pos_;
478  continue;
479  }
480 
481  // @todo Protocol is set on DNSClient constructor. We need
482  // to propagate a configuration value downward, probably starting
483  // at global, then domain, finishing by server.
484  // Once that is supported we need to add it here.
485  dns_client_.reset(new DNSClient(dns_update_response_, this,
486  DNSClient::UDP));
487  ++next_server_pos_;
488  return (true);
489  }
490 
491  return (false);
492  }
493 }
494 
495 bool
497  TSIGKeyInfoPtr tsig_key_info = current_server_->getTSIGKeyInfo();
498  if (tsig_key_info) {
499  tsig_key_ = tsig_key_info->getTSIGKey();
500  } else {
501  tsig_key_.reset();
502  }
503 
504  // This hook point allows hooks libraries to overwrite the TSIG key.
505  if (HooksManager::calloutsPresent(Hooks.hooks_index_select_key_)) {
506  CalloutHandlePtr callout_handle = HooksManager::createCalloutHandle();
507 
508  callout_handle->setArgument("current_server", current_server_);
509  callout_handle->setArgument("tsig_key", tsig_key_);
510 
511  HooksManager::callCallouts(Hooks.hooks_index_select_key_,
512  *callout_handle);
513 
514  // This server is skipped because the status is not NEXT_STEP_CONTINUE.
515  if (callout_handle->getStatus() != CalloutHandle::NEXT_STEP_CONTINUE) {
516  return (false);
517  }
518 
519  // Reread the TSIG key.
520  callout_handle->getArgument("tsig_key", tsig_key_);
521  }
522 
523  return (true);
524 }
525 
526 
527 const DNSClientPtr&
529  return (dns_client_);
530 }
531 
532 const DnsServerInfoPtr&
534  return (current_server_);
535 }
536 
537 void
539  return (ncr_->setStatus(status));
540 }
541 
542 const D2UpdateMessagePtr&
544  return (dns_update_request_);
545 }
546 
549  return (dns_update_status_);
550 }
551 
552 const D2UpdateMessagePtr&
554  return (dns_update_response_);
555 }
556 
557 bool
559  return (forward_change_completed_);
560 }
561 
562 bool
564  return (reverse_change_completed_);
565 }
566 
567 size_t
569  return (update_attempts_);
570 }
571 
572 const dns::RRType&
574  return (ncr_->isV4() ? dns::RRType::A() : dns::RRType::AAAA());
575 }
576 
577 } // namespace isc::d2
578 } // namespace isc
virtual D2UpdateMessagePtr prepNewRequest(DdnsDomainPtr domain)
Creates a new DNS update request based on the given domain.
Definition: nc_trans.cc:343
static const int NOP_EVT
Signifies that no event has occurred.
Definition: state_model.h:292
The Name class encapsulates DNS names.
Definition: name.h:223
boost::shared_ptr< TSIGKeyInfo > TSIGKeyInfoPtr
Defines a pointer for TSIGKeyInfo instances.
Definition: d2_config.h:404
This file defines the class NameChangeTransaction.
const isc::log::MessageID DHCP_DDNS_STARTING_TRANSACTION
Definition: d2_messages.h:82
virtual void sendUpdate(const std::string &comment="")
Send the update request to the current server.
Definition: nc_trans.cc:192
boost::shared_ptr< D2Params > D2ParamsPtr
Defines a pointer for D2Params instances.
Definition: d2_config.h:257
The D2UpdateMessage encapsulates a DNS Update message.
static const int PROCESS_TRANS_OK_ST
State which processes successful transaction conclusion.
Definition: nc_trans.h:102
Thrown if the transaction encounters a general error.
Definition: nc_trans.h:27
static const unsigned int MAX_UPDATE_TRIES_PER_SERVER
Maximum times to attempt a single update on a given server.
Definition: nc_trans.h:154
The DNSClient class handles communication with the DNS server.
Definition: dns_client.h:47
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
std::string getEventLabel(const int event) const
Fetches the label associated with an event value.
Definition: state_model.cc:432
boost::shared_ptr< DNSClient > DNSClientPtr
Definition: dns_client.h:19
boost::shared_ptr< DdnsDomain > DdnsDomainPtr
Defines a pointer for DdnsDomain instances.
Definition: d2_config.h:612
const dhcp_ddns::NameChangeRequestPtr & getNcr() const
Fetches the NameChangeRequest for this transaction.
Definition: nc_trans.cc:425
virtual void onModelFailure(const std::string &explanation)
Handler for fatal model execution errors.
Definition: nc_trans.cc:278
boost::shared_ptr< D2UpdateMessage > D2UpdateMessagePtr
Pointer to the DNS Update Message.
const isc::log::MessageID DHCP_DDNS_UPDATE_REQUEST_SENT
Definition: d2_messages.h:85
void setNcrStatus(const dhcp_ddns::NameChangeStatus &status)
Sets the status of the transaction&#39;s NameChangeRequest.
Definition: nc_trans.cc:538
static const RRClass & IN()
Definition: rrclass.h:319
boost::shared_ptr< const Rdata > ConstRdataPtr
Definition: rdata.h:72
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
Definition: macros.h:32
No response, timeout.
Definition: dns_client.h:60
static const int SELECTING_FWD_SERVER_ST
State in which forward DNS server selection is done.
Definition: nc_trans.h:91
static int registerHook(const std::string &name)
Register Hook.
boost::shared_ptr< NameChangeRequest > NameChangeRequestPtr
Defines a pointer to a NameChangeRequest.
Definition: ncr_msg.h:212
void startTransaction()
Begins execution of the transaction.
Definition: nc_trans.cc:110
static const int SERVER_IO_ERROR_EVT
Issued when an update fails due to an IO error.
Definition: nc_trans.h:119
bool getReverseChangeCompleted() const
Returns whether the reverse change has completed or not.
Definition: nc_trans.cc:563
static const int IO_COMPLETED_EVT
Issued when a DNS update packet exchange has completed.
Definition: nc_trans.h:130
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
const DnsServerInfoPtr & getCurrentServer() const
Fetches the currently selected server.
Definition: nc_trans.cc:533
virtual void verifyStates()
Validates the contents of the set of states.
Definition: state_model.cc:253
std::string responseString() const
Returns a string version of the current response status and rcode.
Definition: nc_trans.cc:136
virtual void runModel(unsigned int event)
Processes events through the state model.
Definition: state_model.cc:112
const D2UpdateMessagePtr & getDnsUpdateRequest() const
Fetches the current DNS update request packet.
Definition: nc_trans.cc:543
const isc::log::MessageID DHCP_DDNS_TRANS_SEND_ERROR
Definition: d2_messages.h:84
Other, unclassified error.
Definition: dns_client.h:63
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
void setForwardChangeCompleted(const bool value)
Sets the forward change completion flag to the given value.
Definition: nc_trans.cc:328
void addDhcidRdata(dns::RRsetPtr &rrset)
Adds an RData for the lease client&#39;s DHCID to the given RRset.
Definition: nc_trans.cc:388
Definition: edns.h:19
bool selectTSIGKey()
Selects the TSIG key.
Definition: nc_trans.cc:496
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 retryTransition(const int fail_to_state)
Determines the state and next event based on update attempts.
Definition: nc_trans.cc:286
const TransactionKey & getTransactionKey() const
Fetches the unique key that identifies this transaction.
Definition: nc_trans.cc:430
static const RRType & A()
Definition: rrtype.h:341
Status
A status code of the DNSClient.
Definition: dns_client.h:58
NameChangeStatus
Defines the runtime processing status values for requests.
Definition: ncr_msg.h:52
boost::shared_ptr< D2CfgMgr > D2CfgMgrPtr
Defines a shared pointer to D2CfgMgr.
Definition: d2_cfg_mgr.h:334
const dns::RRType & getAddressRRType() const
Returns the DHCP data type for the lease address.
Definition: nc_trans.cc:573
virtual void defineStates()
Adds states defined by NameChangeTransaction to the state set.
Definition: nc_trans.cc:257
static QidGenerator & getInstance()
Returns the singleton instance of the QidGenerator.
Definition: qid_gen.cc:25
const isc::log::MessageID DHCP_DDNS_STATE_MODEL_UNEXPECTED_ERROR
Definition: d2_messages.h:83
const DNSClientPtr & getDNSClient() const
Fetches the DNSClient instance.
Definition: nc_trans.cc:528
unsigned int getNextEvent() const
Fetches the model&#39;s next event.
Definition: state_model.cc:373
void setReverseChangeCompleted(const bool value)
Sets the reverse change completion flag to the given value.
Definition: nc_trans.cc:333
unsigned int getCurrState() const
Fetches the model&#39;s current state.
Definition: state_model.cc:355
Response received and is ok.
Definition: dns_client.h:59
static const int SELECTING_REV_SERVER_ST
State in which reverse DNS server selection is done.
Definition: nc_trans.h:99
void startModel(const int start_state)
Begins execution of the model.
Definition: state_model.cc:100
void setDnsUpdateStatus(const DNSClient::Status &status)
Sets the update status to the given status value.
Definition: nc_trans.cc:313
DdnsDomainPtr & getForwardDomain()
Fetches the forward DdnsDomain.
Definition: nc_trans.cc:445
void clearUpdateAttempts()
Resets the update attempts count.
Definition: nc_trans.cc:308
Defines the logger used by the top-level component of kea-lfc.
void addPtrRdata(dns::RRsetPtr &rrset)
Adds an RData for the lease FQDN to the given RRset.
Definition: nc_trans.cc:408
virtual void defineStates()
Populates the set of states.
Definition: state_model.cc:245
static const int NO_MORE_SERVERS_EVT
Issued when there are no more servers from which to select.
Definition: nc_trans.h:125
size_t getUpdateAttempts() const
Fetches the update attempt count for the current update.
Definition: nc_trans.cc:568
std::string getRequestId() const
Fetches the request id that identifies this transaction.
Definition: nc_trans.cc:435
virtual void operator()(DNSClient::Status status)
Serves as the DNSClient IO completion event handler.
Definition: nc_trans.cc:120
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
DNSClient::Status getDnsUpdateStatus() const
Fetches the most recent DNS update status.
Definition: nc_trans.cc:548
Response received but invalid.
Definition: dns_client.h:62
boost::shared_ptr< CalloutHandle > CalloutHandlePtr
A shared pointer to a CalloutHandle object.
void setUpdateAttempts(const size_t value)
Sets the update attempt count to the given value.
Definition: nc_trans.cc:338
CtrlAgentHooks Hooks
static const int PROCESS_TRANS_FAILED_ST
State which processes an unsuccessful transaction conclusion.
Definition: nc_trans.h:105
std::string transactionOutcomeString() const
Returns a string version of transaction outcome.
Definition: nc_trans.cc:170
The RRType class encapsulates DNS resource record types.
Definition: rrtype.h:106
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.
Definition: nc_trans.cc:303
Container class for handling the DHCID value within a NameChangeRequest.
Definition: ncr_msg.h:86
static const int READY_ST
State from which a transaction is started.
Definition: nc_trans.h:83
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
Definition: macros.h:14
void setDnsUpdateRequest(D2UpdateMessagePtr &request)
Sets the update request packet to the given packet.
Definition: nc_trans.cc:298
The InputBuffer class is a buffer abstraction for manipulating read-only data.
Definition: buffer.h:81
bool getForwardChangeCompleted() const
Returns whether the forward change has completed or not.
Definition: nc_trans.cc:558
virtual void defineEvents()
Adds events defined by NameChangeTransaction to the event set.
Definition: nc_trans.cc:227
const StatePtr getStateInternal(unsigned int value)
Fetches the state referred to by value.
Definition: state_model.cc:219
static const int UPDATE_OK_EVT
Issued when the attempted update successfully completed.
Definition: nc_trans.h:135
const isc::log::MessageID DHCP_DDNS_UPDATE_RESPONSE_RECEIVED
Definition: d2_messages.h:86
void clearDnsUpdateResponse()
Destroys the current update response packet.
Definition: nc_trans.cc:323
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:450
const int DBGLVL_TRACE_DETAIL
Trace detailed operations.
Definition: log_dbglevels.h:75
const EventPtr & getEvent(unsigned int value)
Fetches the event referred to by value.
Definition: state_model.cc:186
dhcp_ddns::NameChangeStatus getNcrStatus() const
Fetches the NameChangeRequest status of the transaction.
Definition: nc_trans.cc:440
static const int UPDATE_FAILED_EVT
Issued when the attempted update fails to complete.
Definition: nc_trans.h:141
virtual void verifyEvents()
Validates the contents of the set of events.
Definition: nc_trans.cc:242
void addLeaseAddressRdata(dns::RRsetPtr &rrset)
Adds an RData for the lease address to the given RRset.
Definition: nc_trans.cc:366
static const RRType & AAAA()
Definition: rrtype.h:497
virtual void verifyEvents()
Validates the contents of the set of events.
Definition: state_model.cc:237
const D2UpdateMessagePtr & getDnsUpdateResponse() const
Fetches the most recent DNS update response packet.
Definition: nc_trans.cc:553
void initServerSelection(const DdnsDomainPtr &domain)
Initializes server selection from the given DDNS domain.
Definition: nc_trans.cc:455
virtual ~NameChangeTransaction()
Destructor.
Definition: nc_trans.cc:106
void setDnsUpdateResponse(D2UpdateMessagePtr &response)
Sets the update response packet to the given packet.
Definition: nc_trans.cc:318
boost::shared_ptr< DnsServerInfo > DnsServerInfoPtr
Defines a pointer for DnsServerInfo instances.
Definition: d2_config.h:542
virtual void defineEvents()
Populates the set of events.
Definition: state_model.cc:229
void postNextEvent(unsigned int event)
Sets the next event to the given event value.
Definition: state_model.cc:320
bool selectNextServer()
Selects the next server in the current server list.
Definition: nc_trans.cc:467
virtual void verifyStates()
Validates the contents of the set of states.
Definition: nc_trans.cc:265