Kea 2.7.5
nc_add.cc
Go to the documentation of this file.
1// Copyright (C) 2013-2023 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/nc_add.h>
10#include <d2srv/d2_cfg_mgr.h>
11#include <d2srv/d2_log.h>
12
13#include <util/buffer.h>
14#include <dns/rdataclass.h>
15
16#include <functional>
17
18namespace isc {
19namespace d2 {
20
21// NameAddTransaction states
25
26// NameAddTransaction events
29
33 DdnsDomainPtr& forward_domain,
34 DdnsDomainPtr& reverse_domain,
35 D2CfgMgrPtr& cfg_mgr)
36 : NameChangeTransaction(io_service, ncr, forward_domain, reverse_domain,
37 cfg_mgr) {
38 if (ncr->getChangeType() != isc::dhcp_ddns::CHG_ADD) {
40 "NameAddTransaction, request type must be CHG_ADD");
41 }
42}
43
46
47void
49 // Call superclass impl first.
51
52 // Define NameAddTransaction events.
53 defineEvent(FQDN_IN_USE_EVT, "FQDN_IN_USE_EVT");
54 defineEvent(FQDN_NOT_IN_USE_EVT, "FQDN_NOT_IN_USE_EVT");
55}
56
57void
59 // Call superclass implementation first to verify its events. These are
60 // events common to all transactions, and they must be defined.
61 // SELECT_SERVER_EVT
62 // SERVER_SELECTED_EVT
63 // SERVER_IO_ERROR_EVT
64 // NO_MORE_SERVERS_EVT
65 // IO_COMPLETED_EVT
66 // UPDATE_OK_EVT
67 // UPDATE_FAILED_EVT
69
70 // Verify NameAddTransaction events by attempting to fetch them.
73}
74
75void
77 // Call superclass impl first.
79
80 // Define NameAddTransaction states.
81 defineState(READY_ST, "READY_ST",
82 std::bind(&NameAddTransaction::readyHandler, this));
83
84 defineState(SELECTING_FWD_SERVER_ST, "SELECTING_FWD_SERVER_ST",
86
87 defineState(SELECTING_REV_SERVER_ST, "SELECTING_REV_SERVER_ST",
89
90 defineState(ADDING_FWD_ADDRS_ST, "ADDING_FWD_ADDRS_ST",
92
93 defineState(REPLACING_FWD_ADDRS_ST, "REPLACING_FWD_ADDRS_ST",
95
96 defineState(REPLACING_REV_PTRS_ST, "REPLACING_REV_PTRS_ST",
98
99 defineState(PROCESS_TRANS_OK_ST, "PROCESS_TRANS_OK_ST",
101
102 defineState(PROCESS_TRANS_FAILED_ST, "PROCESS_TRANS_FAILED_ST",
104}
105
106void
108 // Call superclass implementation first to verify its states. These are
109 // states common to all transactions, and they must be defined.
110 // READY_ST
111 // SELECTING_FWD_SERVER_ST
112 // SELECTING_REV_SERVER_ST
113 // PROCESS_TRANS_OK_ST
114 // PROCESS_TRANS_FAILED_ST
116
117 // Verify NameAddTransaction states by attempting to fetch them.
121}
122
123void
125 switch(getNextEvent()) {
126 case START_EVT:
127 if (getForwardDomain()) {
128 // Request includes a forward change, do that first.
130 } else {
131 // Reverse change only, transition accordingly.
133 }
134
135 break;
136 default:
137 // Event is invalid.
139 "Wrong event for context: " << getContextStr());
140 }
141}
142
143void
145 switch(getNextEvent()) {
147 // First time through for this transaction, so initialize server
148 // selection.
150 break;
152 // We failed to communicate with current server. Attempt to select
153 // another one below.
154 break;
155 default:
156 // Event is invalid.
158 "Wrong event for context: " << getContextStr());
159 }
160
161 // Select the next server from the list of forward servers.
162 if (selectNextServer()) {
163 // We have a server to try.
165 } else {
166 // Server list is exhausted, so fail the transaction.
168 }
169}
170
171void
173 if (doOnEntry()) {
174 // Clear the update attempts count on initial transition.
176 }
177
178 switch(getNextEvent()) {
180 try {
183 } catch (const std::exception& ex) {
184 // While unlikely, the build might fail if we have invalid
185 // data. Should that be the case, we need to fail the
186 // transaction.
188 .arg(getRequestId())
189 .arg(getNcr()->toText())
190 .arg(ex.what());
192 break;
193 }
194
195 // Call sendUpdate() to initiate the async send. Note it also sets
196 // next event to NOP_EVT.
197 sendUpdate("Forward Add");
198 break;
199
200 case IO_COMPLETED_EVT: {
201 switch (getDnsUpdateStatus()) {
202 case DNSClient::SUCCESS: {
203 // We successfully received a response packet from the server.
204 const dns::Rcode& rcode = getDnsUpdateResponse()->getRcode();
205 if (rcode == dns::Rcode::NOERROR()) {
206 // We were able to add it. Mark it as done.
208
209 // If request calls for reverse update then do that next,
210 // otherwise we can process ok.
211 if (getReverseDomain()) {
213 } else {
215 }
216 } else if (rcode == dns::Rcode::YXDOMAIN()) {
217 // FQDN is in use so we need to attempt to replace
218 // forward address.
220 } else {
221 // Per RFC4703 any other value means cease.
222 // If we get not authorized should we try the next server in
223 // the list? @todo This needs some discussion perhaps.
225 .arg(getRequestId())
226 .arg(getCurrentServer()->toText())
227 .arg(getNcr()->getFqdn())
228 .arg(rcode.getCode());
230 }
231
232 break;
233 }
234
236 // No response from the server, log it and set up
237 // to select the next server for a retry.
239 .arg(getRequestId())
240 .arg(getNcr()->getFqdn())
241 .arg(getCurrentServer()->toText());
242
244 break;
245
246 case DNSClient::OTHER:
247 // We couldn't send to the current server, log it and set up
248 // to select the next server for a retry.
249 // @note For now we treat OTHER as an IO error like TIMEOUT. It
250 // is not entirely clear if this is accurate.
252 .arg(getRequestId())
253 .arg(getNcr()->getFqdn())
254 .arg(getCurrentServer()->toText());
255
257 break;
258
260 // A response was received but was corrupt. Retry it like an IO
261 // error.
263 .arg(getRequestId())
264 .arg(getCurrentServer()->toText())
265 .arg(getNcr()->getFqdn());
266
268 break;
269
270 default:
271 // Any other value and we will fail this transaction, something
272 // bigger is wrong.
274 .arg(getRequestId())
275 .arg(getDnsUpdateStatus())
276 .arg(getNcr()->getFqdn())
277 .arg(getCurrentServer()->toText());
278
280 break;
281 } // end switch on dns_status
282
283 break;
284 } // end case IO_COMPLETE_EVT
285
286 default:
287 // Event is invalid.
289 "Wrong event for context: " << getContextStr());
290 }
291}
292
293void
295 if (doOnEntry()) {
296 // Clear the update attempts count on initial transition.
298 }
299
300 switch(getNextEvent()) {
301 case FQDN_IN_USE_EVT:
303 try {
306 } catch (const std::exception& ex) {
307 // While unlikely, the build might fail if we have invalid
308 // data. Should that be the case, we need to fail the
309 // transaction.
311 .arg(getRequestId())
312 .arg(getNcr()->toText())
313 .arg(ex.what());
315 break;
316 }
317
318 // Call sendUpdate() to initiate the async send. Note it also sets
319 // next event to NOP_EVT.
320 sendUpdate("Forward Replace");
321 break;
322
323 case IO_COMPLETED_EVT: {
324 switch (getDnsUpdateStatus()) {
325 case DNSClient::SUCCESS: {
326 // We successfully received a response packet from the server.
327 const dns::Rcode& rcode = getDnsUpdateResponse()->getRcode();
328 if (rcode == dns::Rcode::NOERROR()) {
329 // We were able to replace the forward mapping. Mark it as done.
331
332 // If request calls for reverse update then do that next,
333 // otherwise we can process ok.
334 if (getReverseDomain()) {
336 } else {
338 }
339 } else if (rcode == dns::Rcode::NXDOMAIN()) {
340 // FQDN is NOT in use so go back and do the forward add address.
341 // Covers the case that it was there when we tried to add it,
342 // but has since been removed per RFC 4703.
344 } else {
345 // Per RFC4703 any other value means cease.
346 // If we get not authorized should try the next server in
347 // the list? @todo This needs some discussion perhaps.
349 .arg(getRequestId())
350 .arg(getCurrentServer()->toText())
351 .arg(getNcr()->getFqdn())
352 .arg(rcode.getCode());
354 }
355
356 break;
357 }
358
360 // No response from the server, log it and set up
361 // to select the next server for a retry.
363 .arg(getRequestId())
364 .arg(getNcr()->getFqdn())
365 .arg(getCurrentServer()->toText());
366
368 break;
369
370 case DNSClient::OTHER:
371 // We couldn't send to the current server, log it and set up
372 // to select the next server for a retry.
374 .arg(getRequestId())
375 .arg(getNcr()->getFqdn())
376 .arg(getCurrentServer()->toText());
377
378 // If we are out of retries on this server, we go back and start
379 // all over on a new server.
381 break;
382
384 // A response was received but was corrupt. Retry it like an IO
385 // error.
387 .arg(getRequestId())
388 .arg(getCurrentServer()->toText())
389 .arg(getNcr()->getFqdn());
390
391 // If we are out of retries on this server, we go back and start
392 // all over on a new server.
394 break;
395
396 default:
397 // Any other value and we will fail this transaction, something
398 // bigger is wrong.
401 .arg(getRequestId())
402 .arg(getDnsUpdateStatus())
403 .arg(getNcr()->getFqdn())
404 .arg(getCurrentServer()->toText());
405
407 break;
408 } // end switch on dns_status
409
410 break;
411 } // end case IO_COMPLETE_EVT
412
413 default:
414 // Event is invalid.
416 "Wrong event for context: " << getContextStr());
417 }
418}
419
420void
422 switch(getNextEvent()) {
424 // First time through for this transaction, so initialize server
425 // selection.
427 break;
429 // We failed to communicate with current server. Attempt to select
430 // another one below.
431 break;
432 default:
433 // Event is invalid.
435 "Wrong event for context: " << getContextStr());
436 }
437
438 // Select the next server from the list of forward servers.
439 if (selectNextServer()) {
440 // We have a server to try.
442 } else {
443 // Server list is exhausted, so fail the transaction.
445 }
446}
447
448
449void
451 if (doOnEntry()) {
452 // Clear the update attempts count on initial transition.
454 }
455
456 switch(getNextEvent()) {
458 try {
461 } catch (const std::exception& ex) {
462 // While unlikely, the build might fail if we have invalid
463 // data. Should that be the case, we need to fail the
464 // transaction.
466 .arg(getRequestId())
467 .arg(getNcr()->toText())
468 .arg(ex.what());
470 break;
471 }
472
473 // Call sendUpdate() to initiate the async send. Note it also sets
474 // next event to NOP_EVT.
475 sendUpdate("Reverse Replace");
476 break;
477
478 case IO_COMPLETED_EVT: {
479 switch (getDnsUpdateStatus()) {
480 case DNSClient::SUCCESS: {
481 // We successfully received a response packet from the server.
482 const dns::Rcode& rcode = getDnsUpdateResponse()->getRcode();
483 if (rcode == dns::Rcode::NOERROR()) {
484 // We were able to update the reverse mapping. Mark it as done.
487 } else {
488 // Per RFC4703 any other value means cease.
489 // If we get not authorized should try the next server in
490 // the list? @todo This needs some discussion perhaps.
492 .arg(getRequestId())
493 .arg(getCurrentServer()->toText())
494 .arg(getNcr()->getFqdn())
495 .arg(rcode.getCode());
497 }
498
499 break;
500 }
501
503 // No response from the server, log it and set up
504 // to select the next server for a retry.
506 .arg(getRequestId())
507 .arg(getNcr()->getFqdn())
508 .arg(getCurrentServer()->toText());
509
511 break;
512
513 case DNSClient::OTHER:
514 // We couldn't send to the current server, log it and set up
515 // to select the next server for a retry.
517 .arg(getRequestId())
518 .arg(getNcr()->getFqdn())
519 .arg(getCurrentServer()->toText());
520
521 // If we are out of retries on this server, we go back and start
522 // all over on a new server.
524 break;
525
527 // A response was received but was corrupt. Retry it like an IO
528 // error.
530 .arg(getRequestId())
531 .arg(getCurrentServer()->toText())
532 .arg(getNcr()->getFqdn());
533
534 // If we are out of retries on this server, we go back and start
535 // all over on a new server.
537 break;
538
539 default:
540 // Any other value and we will fail this transaction, something
541 // bigger is wrong.
544 .arg(getRequestId())
545 .arg(getDnsUpdateStatus())
546 .arg(getNcr()->getFqdn())
547 .arg(getCurrentServer()->toText());
548
550 break;
551 } // end switch on dns_status
552
553 break;
554 } // end case IO_COMPLETE_EVT
555
556 default:
557 // Event is invalid.
559 "Wrong event for context: " << getContextStr());
560 }
561}
562
563void
565 switch(getNextEvent()) {
566 case UPDATE_OK_EVT:
568 .arg(getRequestId())
569 .arg(getNcr()->toText());
571 endModel();
572 break;
573 default:
574 // Event is invalid.
576 "Wrong event for context: " << getContextStr());
577 }
578}
579
580void
582 switch(getNextEvent()) {
587 .arg(getRequestId())
589 endModel();
590 break;
591 default:
592 // Event is invalid.
594 "Wrong event for context: " << getContextStr());
595 }
596}
597
598void
600 // Construct an empty request.
602
603 // Construct dns::Name from NCR fqdn.
604 dns::Name fqdn(dns::Name(getNcr()->getFqdn()));
605
606 // Content on this request is based on RFC 4703, section 5.3.1
607 // First build the Prerequisite Section.
608
609 // Create 'FQDN Is Not In Use' prerequisite and add it to the
610 // prerequisite section.
611 // Based on RFC 2136, section 2.4.5
614 request->addRRset(D2UpdateMessage::SECTION_PREREQUISITE, prereq);
615
616 // Next build the Update Section.
617
618 // Create the TTL based on lease length.
619 dns::RRTTL lease_ttl(getNcr()->getLeaseLength());
620
621 // Create the FQDN/IP 'add' RR and add it to the to update section.
622 // Based on RFC 2136, section 2.5.1
623 dns::RRsetPtr update(new dns::RRset(fqdn, dns::RRClass::IN(),
624 getAddressRRType(), lease_ttl));
625
626 addLeaseAddressRdata(update);
627 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
628
629 // Now create the FQDN/DHCID 'add' RR and add it to update section.
630 // Based on RFC 2136, section 2.5.1
631 update.reset(new dns::RRset(fqdn, dns::RRClass::IN(),
632 dns::RRType::DHCID(), lease_ttl));
633 addDhcidRdata(update);
634 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
635
636 // Set the transaction's update request to the new request.
637 setDnsUpdateRequest(request);
638}
639
640void
642 // Construct an empty request.
644
645 // Construct dns::Name from NCR fqdn.
646 dns::Name fqdn(dns::Name(getNcr()->getFqdn()));
647
648 // Content on this request is based on RFC 4703, section 5.3.2
649 // First build the Prerequisite Section.
650
651 // Create an 'FQDN Is In Use' prerequisite and add it to the
652 // pre-requisite section.
653 // Based on RFC 2136, section 2.4.4
654 dns::RRsetPtr prereq(new dns::RRset(fqdn, dns::RRClass::ANY(),
656 request->addRRset(D2UpdateMessage::SECTION_PREREQUISITE, prereq);
657
658 // Create an DHCID matches prerequisite RR and add it to the
659 // pre-requisite section.
660 // Based on RFC 2136, section 2.4.2.
661 prereq.reset(new dns::RRset(fqdn, dns::RRClass::IN(),
663 addDhcidRdata(prereq);
664 request->addRRset(D2UpdateMessage::SECTION_PREREQUISITE, prereq);
665
666 // Next build the Update Section.
667
668 // Create the TTL based on lease length.
669 dns::RRTTL lease_ttl(getNcr()->getLeaseLength());
670
671 // Create the FQDN/IP 'delete' RR and add it to the update section.
672 // Based on RFC 2136, section 2.5.2
673 dns::RRsetPtr update(new dns::RRset(fqdn, dns::RRClass::ANY(),
675 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
676
677 // Create the FQDN/IP 'add' RR and add it to the update section.
678 // Based on RFC 2136, section 2.5.1
679 update.reset(new dns::RRset(fqdn, dns::RRClass::IN(),
680 getAddressRRType(), lease_ttl));
681 addLeaseAddressRdata(update);
682 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
683
684 // Set the transaction's update request to the new request.
685 setDnsUpdateRequest(request);
686}
687
688void
690 // Construct an empty request.
692
693 // Create the reverse IP address "FQDN".
694 std::string rev_addr = D2CfgMgr::reverseIpAddress(getNcr()->getIpAddress());
695 dns::Name rev_ip(rev_addr);
696
697 // Create the TTL based on lease length.
698 dns::RRTTL lease_ttl(getNcr()->getLeaseLength());
699
700 // Content on this request is based on RFC 4703, section 5.4
701 // Reverse replacement has no prerequisites so straight on to
702 // building the Update section.
703
704 // Create the PTR 'delete' RR and add it to update section.
705 dns::RRsetPtr update(new dns::RRset(rev_ip, dns::RRClass::ANY(),
707 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
708
709 // Create the DHCID 'delete' RR and add it to the update section.
710 update.reset(new dns::RRset(rev_ip, dns::RRClass::ANY(),
712 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
713
714 // Create the FQDN/IP PTR 'add' RR, add the FQDN as the PTR Rdata
715 // then add it to update section.
716 update.reset(new dns::RRset(rev_ip, dns::RRClass::IN(),
717 dns::RRType::PTR(), lease_ttl));
718 addPtrRdata(update);
719 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
720
721 // Create the FQDN/IP PTR 'add' RR, add the DHCID Rdata
722 // then add it to update section.
723 update.reset(new dns::RRset(rev_ip, dns::RRClass::IN(),
724 dns::RRType::DHCID(), lease_ttl));
725 addDhcidRdata(update);
726 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
727
728 // Set the transaction's update request to the new request.
729 setDnsUpdateRequest(request);
730}
731
732} // namespace isc::d2
733} // namespace isc
static std::string reverseIpAddress(const std::string &address)
Generate a reverse order string for the given IP address.
@ TIMEOUT
No response, timeout.
Definition dns_client.h:60
@ OTHER
Other, unclassified error.
Definition dns_client.h:63
@ INVALID_RESPONSE
Response received but invalid.
Definition dns_client.h:62
@ SUCCESS
Response received and is ok.
Definition dns_client.h:59
Thrown if the NameAddTransaction encounters a general error.
Definition nc_add.h:19
void processAddFailedHandler()
State handler for PROCESS_TRANS_FAILED_ST.
Definition nc_add.cc:581
virtual void defineEvents()
Adds events defined by NameAddTransaction to the event set.
Definition nc_add.cc:48
static const int ADDING_FWD_ADDRS_ST
State that attempts to add forward address records.
Definition nc_add.h:57
virtual ~NameAddTransaction()
Destructor.
Definition nc_add.cc:44
void buildReplaceFwdAddressRequest()
Builds a DNS request to replace forward DNS entry for an FQDN.
Definition nc_add.cc:641
virtual void verifyStates()
Validates the contents of the set of states.
Definition nc_add.cc:107
static const int FQDN_NOT_IN_USE_EVT
Event sent when replace attempt to fails with address not in use.
Definition nc_add.h:71
void replacingFwdAddrsHandler()
State handler for REPLACING_FWD_ADDRS_ST.
Definition nc_add.cc:294
void processAddOkHandler()
State handler for PROCESS_TRANS_OK_ST.
Definition nc_add.cc:564
static const int REPLACING_FWD_ADDRS_ST
State that attempts to replace forward address records.
Definition nc_add.h:60
virtual void verifyEvents()
Validates the contents of the set of events.
Definition nc_add.cc:58
void addingFwdAddrsHandler()
State handler for ADD_FWD_ADDRS_ST.
Definition nc_add.cc:172
void selectingRevServerHandler()
State handler for SELECTING_REV_SERVER_ST.
Definition nc_add.cc:421
void replacingRevPtrsHandler()
State handler for REPLACING_REV_PTRS_ST.
Definition nc_add.cc:450
void readyHandler()
State handler for READY_ST.
Definition nc_add.cc:124
NameAddTransaction(asiolink::IOServicePtr &io_service, dhcp_ddns::NameChangeRequestPtr &ncr, DdnsDomainPtr &forward_domain, DdnsDomainPtr &reverse_domain, D2CfgMgrPtr &cfg_mgr)
Constructor.
Definition nc_add.cc:31
static const int FQDN_IN_USE_EVT
Event sent when an add attempt fails with address in use.
Definition nc_add.h:68
virtual void defineStates()
Adds states defined by NameAddTransaction to the state set.
Definition nc_add.cc:76
void selectingFwdServerHandler()
State handler for SELECTING_FWD_SERVER_ST.
Definition nc_add.cc:144
void buildReplaceRevPtrsRequest()
Builds a DNS request to replace a reverse DNS entry for an FQDN.
Definition nc_add.cc:689
void buildAddFwdAddressRequest()
Builds a DNS request to add an forward DNS entry for an FQDN.
Definition nc_add.cc:599
static const int REPLACING_REV_PTRS_ST
State that attempts to replace reverse PTR records.
Definition nc_add.h:63
Embodies the "life-cycle" required to carry out a DDNS update.
Definition nc_trans.h:77
static const int SELECTING_FWD_SERVER_ST
State in which forward DNS server selection is done.
Definition nc_trans.h:91
void retryTransition(const int fail_to_state)
Determines the state and next event based on update attempts.
Definition nc_trans.cc:287
static const int PROCESS_TRANS_FAILED_ST
State which processes an unsuccessful transaction conclusion.
Definition nc_trans.h:105
static const int READY_ST
State from which a transaction is started.
Definition nc_trans.h:83
const D2UpdateMessagePtr & getDnsUpdateResponse() const
Fetches the most recent DNS update response packet.
Definition nc_trans.cc:554
static const int PROCESS_TRANS_OK_ST
State which processes successful transaction conclusion.
Definition nc_trans.h:102
static const int UPDATE_OK_EVT
Issued when the attempted update successfully completed.
Definition nc_trans.h:135
virtual void verifyStates()
Validates the contents of the set of states.
Definition nc_trans.cc:266
virtual D2UpdateMessagePtr prepNewRequest(DdnsDomainPtr domain)
Creates a new DNS update request based on the given domain.
Definition nc_trans.cc:344
static const int UPDATE_FAILED_EVT
Issued when the attempted update fails to complete.
Definition nc_trans.h:141
const dns::RRType & getAddressRRType() const
Returns the DHCP data type for the lease address.
Definition nc_trans.cc:574
const dhcp_ddns::NameChangeRequestPtr & getNcr() const
Fetches the NameChangeRequest for this transaction.
Definition nc_trans.cc:426
void initServerSelection(const DdnsDomainPtr &domain)
Initializes server selection from the given DDNS domain.
Definition nc_trans.cc:456
static const int IO_COMPLETED_EVT
Issued when a DNS update packet exchange has completed.
Definition nc_trans.h:130
static const int SELECT_SERVER_EVT
Issued when a server needs to be selected.
Definition nc_trans.h:113
static const int SERVER_IO_ERROR_EVT
Issued when an update fails due to an IO error.
Definition nc_trans.h:119
std::string getRequestId() const
Fetches the request id that identifies this transaction.
Definition nc_trans.cc:436
virtual void defineStates()
Adds states defined by NameChangeTransaction to the state set.
Definition nc_trans.cc:258
void addLeaseAddressRdata(dns::RRsetPtr &rrset)
Adds an RData for the lease address to the given RRset.
Definition nc_trans.cc:367
virtual void sendUpdate(const std::string &comment="")
Send the update request to the current server.
Definition nc_trans.cc:193
void setForwardChangeCompleted(const bool value)
Sets the forward change completion flag to the given value.
Definition nc_trans.cc:329
void addPtrRdata(dns::RRsetPtr &rrset)
Adds an RData for the lease FQDN to the given RRset.
Definition nc_trans.cc:409
bool selectNextServer()
Selects the next server in the current server list.
Definition nc_trans.cc:468
void setNcrStatus(const dhcp_ddns::NameChangeStatus &status)
Sets the status of the transaction's NameChangeRequest.
Definition nc_trans.cc:539
DdnsDomainPtr & getForwardDomain()
Fetches the forward DdnsDomain.
Definition nc_trans.cc:446
virtual void verifyEvents()
Validates the contents of the set of events.
Definition nc_trans.cc:243
void addDhcidRdata(dns::RRsetPtr &rrset)
Adds an RData for the lease client's DHCID to the given RRset.
Definition nc_trans.cc:389
void clearDnsUpdateRequest()
Destroys the current update request packet.
Definition nc_trans.cc:304
void clearUpdateAttempts()
Resets the update attempts count.
Definition nc_trans.cc:309
static const int SELECTING_REV_SERVER_ST
State in which reverse DNS server selection is done.
Definition nc_trans.h:99
DNSClient::Status getDnsUpdateStatus() const
Fetches the most recent DNS update status.
Definition nc_trans.cc:549
void setDnsUpdateRequest(D2UpdateMessagePtr &request)
Sets the update request packet to the given packet.
Definition nc_trans.cc:299
static const int NO_MORE_SERVERS_EVT
Issued when there are no more servers from which to select.
Definition nc_trans.h:125
virtual void defineEvents()
Adds events defined by NameChangeTransaction to the event set.
Definition nc_trans.cc:228
void setReverseChangeCompleted(const bool value)
Sets the reverse change completion flag to the given value.
Definition nc_trans.cc:334
const DnsServerInfoPtr & getCurrentServer() const
Fetches the currently selected server.
Definition nc_trans.cc:534
static const int SERVER_SELECTED_EVT
Issued when a server has been selected.
Definition nc_trans.h:116
DdnsDomainPtr & getReverseDomain()
Fetches the reverse DdnsDomain.
Definition nc_trans.cc:451
std::string transactionOutcomeString() const
Returns a string version of transaction outcome.
Definition nc_trans.cc:171
The Name class encapsulates DNS names.
Definition name.h:219
static const RRClass & ANY()
Definition rrclass.h:298
static const RRClass & NONE()
Definition rrclass.h:316
static const RRClass & IN()
Definition rrclass.h:304
The RRTTL class encapsulates TTLs used in DNS resource records.
Definition rrttl.h:51
static const RRType & ANY()
Definition rrtype.h:345
static const RRType & PTR()
Definition rrtype.h:303
static const RRType & DHCID()
Definition rrtype.h:327
The RRset class is a concrete derived class of BasicRRset which contains a pointer to an additional R...
Definition rrset.h:844
DNS Response Codes (RCODEs) class.
Definition rcode.h:40
static const Rcode & NOERROR()
A constant object for the NOERROR Rcode (see Rcode::NOERROR_CODE).
Definition rcode.h:228
static const Rcode & NXDOMAIN()
A constant object for the NXDOMAIN Rcode (see Rcode::NXDOMAIN_CODE).
Definition rcode.h:246
static const Rcode & YXDOMAIN()
A constant object for the YXDOMAIN Rcode (see Rcode::YXDOMAIN_CODE).
Definition rcode.h:264
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.
Definition macros.h:32
#define LOG_INFO(LOGGER, MESSAGE)
Macro to conveniently test info output and log it.
Definition macros.h:20
boost::shared_ptr< D2UpdateMessage > D2UpdateMessagePtr
Pointer to the DNS Update Message.
const isc::log::MessageID DHCP_DDNS_FORWARD_ADD_BUILD_FAILURE
Definition d2_messages.h:22
const isc::log::MessageID DHCP_DDNS_FORWARD_REPLACE_RESP_CORRUPT
Definition d2_messages.h:43
boost::shared_ptr< DdnsDomain > DdnsDomainPtr
Defines a pointer for DdnsDomain instances.
Definition d2_config.h:624
const isc::log::MessageID DHCP_DDNS_FORWARD_ADD_REJECTED
Definition d2_messages.h:24
const isc::log::MessageID DHCP_DDNS_REVERSE_REPLACE_RESP_CORRUPT
Definition d2_messages.h:80
boost::shared_ptr< D2CfgMgr > D2CfgMgrPtr
Defines a shared pointer to D2CfgMgr.
Definition d2_cfg_mgr.h:367
const isc::log::MessageID DHCP_DDNS_FORWARD_REPLACE_REJECTED
Definition d2_messages.h:42
const isc::log::MessageID DHCP_DDNS_ADD_SUCCEEDED
Definition d2_messages.h:12
const isc::log::MessageID DHCP_DDNS_FORWARD_ADD_IO_ERROR
Definition d2_messages.h:23
const isc::log::MessageID DHCP_DDNS_REVERSE_REPLACE_TIMEOUT
Definition d2_messages.h:81
const isc::log::MessageID DHCP_DDNS_ADD_FAILED
Definition d2_messages.h:11
const isc::log::MessageID DHCP_DDNS_FORWARD_REPLACE_BAD_DNSCLIENT_STATUS
Definition d2_messages.h:39
isc::log::Logger d2_to_dns_logger("d2-to-dns")
Definition d2_log.h:20
const isc::log::MessageID DHCP_DDNS_FORWARD_ADD_TIMEOUT
Definition d2_messages.h:26
const isc::log::MessageID DHCP_DDNS_REVERSE_REPLACE_REJECTED
Definition d2_messages.h:79
const isc::log::MessageID DHCP_DDNS_REVERSE_REPLACE_BUILD_FAILURE
Definition d2_messages.h:77
const isc::log::MessageID DHCP_DDNS_FORWARD_REPLACE_BUILD_FAILURE
Definition d2_messages.h:40
const isc::log::MessageID DHCP_DDNS_FORWARD_ADD_BAD_DNSCLIENT_STATUS
Definition d2_messages.h:21
const isc::log::MessageID DHCP_DDNS_FORWARD_REPLACE_TIMEOUT
Definition d2_messages.h:44
const isc::log::MessageID DHCP_DDNS_REVERSE_REPLACE_BAD_DNSCLIENT_STATUS
Definition d2_messages.h:76
const isc::log::MessageID DHCP_DDNS_REVERSE_REPLACE_IO_ERROR
Definition d2_messages.h:78
const isc::log::MessageID DHCP_DDNS_FORWARD_REPLACE_IO_ERROR
Definition d2_messages.h:41
const isc::log::MessageID DHCP_DDNS_FORWARD_ADD_RESP_CORRUPT
Definition d2_messages.h:25
boost::shared_ptr< NameChangeRequest > NameChangeRequestPtr
Defines a pointer to a NameChangeRequest.
Definition ncr_msg.h:241
boost::shared_ptr< AbstractRRset > RRsetPtr
A pointer-like type pointing to an RRset object.
Definition rrset.h:50
Defines the logger used by the top-level component of kea-lfc.
This file defines the class NameAddTransaction.