Kea 2.0.2
nc_add.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 <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
45}
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 }
166 else {
167 // Server list is exhausted, so fail the transaction.
169 }
170}
171
172void
174 if (doOnEntry()) {
175 // Clear the update attempts count on initial transition.
177 }
178
179 switch(getNextEvent()) {
181 try {
184 } catch (const std::exception& ex) {
185 // While unlikely, the build might fail if we have invalid
186 // data. Should that be the case, we need to fail the
187 // transaction.
189 .arg(getRequestId())
190 .arg(getNcr()->toText())
191 .arg(ex.what());
193 break;
194 }
195
196 // Call sendUpdate() to initiate the async send. Note it also sets
197 // next event to NOP_EVT.
198 sendUpdate("Forward Add");
199 break;
200
201 case IO_COMPLETED_EVT: {
202 switch (getDnsUpdateStatus()) {
203 case DNSClient::SUCCESS: {
204 // We successfully received a response packet from the server.
205 const dns::Rcode& rcode = getDnsUpdateResponse()->getRcode();
206 if (rcode == dns::Rcode::NOERROR()) {
207 // We were able to add it. Mark it as done.
209
210 // If request calls for reverse update then do that next,
211 // otherwise we can process ok.
212 if (getReverseDomain()) {
214 } else {
216 }
217 } else if (rcode == dns::Rcode::YXDOMAIN()) {
218 // FQDN is in use so we need to attempt to replace
219 // forward address.
221 } else {
222 // Per RFC4703 any other value means cease.
223 // If we get not authorized should we try the next server in
224 // the list? @todo This needs some discussion perhaps.
226 .arg(getRequestId())
227 .arg(getCurrentServer()->toText())
228 .arg(getNcr()->getFqdn())
229 .arg(rcode.getCode());
231 }
232
233 break;
234 }
235
237 case DNSClient::OTHER:
238 // We couldn't send to the current server, log it and set up
239 // to select the next server for a retry.
240 // @note For now we treat OTHER as an IO error like TIMEOUT. It
241 // is not entirely clear if this is accurate.
243 .arg(getRequestId())
244 .arg(getNcr()->getFqdn())
245 .arg(getCurrentServer()->toText());
246
248 break;
249
251 // A response was received but was corrupt. Retry it like an IO
252 // error.
254 .arg(getRequestId())
255 .arg(getCurrentServer()->toText())
256 .arg(getNcr()->getFqdn());
257
259 break;
260
261 default:
262 // Any other value and we will fail this transaction, something
263 // bigger is wrong.
265 .arg(getRequestId())
266 .arg(getDnsUpdateStatus())
267 .arg(getNcr()->getFqdn())
268 .arg(getCurrentServer()->toText());
269
271 break;
272 } // end switch on dns_status
273
274 break;
275 } // end case IO_COMPLETE_EVT
276
277 default:
278 // Event is invalid.
280 "Wrong event for context: " << getContextStr());
281 }
282}
283
284void
286 if (doOnEntry()) {
287 // Clear the update attempts count on initial transition.
289 }
290
291 switch(getNextEvent()) {
292 case FQDN_IN_USE_EVT:
294 try {
297 } catch (const std::exception& ex) {
298 // While unlikely, the build might fail if we have invalid
299 // data. Should that be the case, we need to fail the
300 // transaction.
302 .arg(getRequestId())
303 .arg(getNcr()->toText())
304 .arg(ex.what());
306 break;
307 }
308
309 // Call sendUpdate() to initiate the async send. Note it also sets
310 // next event to NOP_EVT.
311 sendUpdate("Forward Replace");
312 break;
313
314 case IO_COMPLETED_EVT: {
315 switch (getDnsUpdateStatus()) {
316 case DNSClient::SUCCESS: {
317 // We successfully received a response packet from the server.
318 const dns::Rcode& rcode = getDnsUpdateResponse()->getRcode();
319 if (rcode == dns::Rcode::NOERROR()) {
320 // We were able to replace the forward mapping. Mark it as done.
322
323 // If request calls for reverse update then do that next,
324 // otherwise we can process ok.
325 if (getReverseDomain()) {
327 } else {
329 }
330 } else if (rcode == dns::Rcode::NXDOMAIN()) {
331 // FQDN is NOT in use so go back and do the forward add address.
332 // Covers the case that it was there when we tried to add it,
333 // but has since been removed per RFC 4703.
335 } else {
336 // Per RFC4703 any other value means cease.
337 // If we get not authorized should try the next server in
338 // the list? @todo This needs some discussion perhaps.
340 .arg(getRequestId())
341 .arg(getCurrentServer()->toText())
342 .arg(getNcr()->getFqdn())
343 .arg(rcode.getCode());
345 }
346
347 break;
348 }
349
351 case DNSClient::OTHER:
352 // We couldn't send to the current server, log it and set up
353 // to select the next server for a retry.
354 // @note For now we treat OTHER as an IO error like TIMEOUT. It
355 // is not entirely clear if this is accurate.
357 .arg(getRequestId())
358 .arg(getNcr()->getFqdn())
359 .arg(getCurrentServer()->toText());
360
361 // If we are out of retries on this server, we go back and start
362 // all over on a new server.
364 break;
365
367 // A response was received but was corrupt. Retry it like an IO
368 // error.
370 .arg(getRequestId())
371 .arg(getCurrentServer()->toText())
372 .arg(getNcr()->getFqdn());
373
374 // If we are out of retries on this server, we go back and start
375 // all over on a new server.
377 break;
378
379 default:
380 // Any other value and we will fail this transaction, something
381 // bigger is wrong.
384 .arg(getRequestId())
385 .arg(getDnsUpdateStatus())
386 .arg(getNcr()->getFqdn())
387 .arg(getCurrentServer()->toText());
388
390 break;
391 } // end switch on dns_status
392
393 break;
394 } // end case IO_COMPLETE_EVT
395
396 default:
397 // Event is invalid.
399 "Wrong event for context: " << getContextStr());
400 }
401}
402
403void
405 switch(getNextEvent()) {
407 // First time through for this transaction, so initialize server
408 // selection.
410 break;
412 // We failed to communicate with current server. Attempt to select
413 // another one below.
414 break;
415 default:
416 // Event is invalid.
418 "Wrong event for context: " << getContextStr());
419 }
420
421 // Select the next server from the list of forward servers.
422 if (selectNextServer()) {
423 // We have a server to try.
425 }
426 else {
427 // Server list is exhausted, so fail the transaction.
429 }
430}
431
432
433void
435 if (doOnEntry()) {
436 // Clear the update attempts count on initial transition.
438 }
439
440 switch(getNextEvent()) {
442 try {
445 } catch (const std::exception& ex) {
446 // While unlikely, the build might fail if we have invalid
447 // data. Should that be the case, we need to fail the
448 // transaction.
450 .arg(getRequestId())
451 .arg(getNcr()->toText())
452 .arg(ex.what());
454 break;
455 }
456
457 // Call sendUpdate() to initiate the async send. Note it also sets
458 // next event to NOP_EVT.
459 sendUpdate("Reverse Replace");
460 break;
461
462 case IO_COMPLETED_EVT: {
463 switch (getDnsUpdateStatus()) {
464 case DNSClient::SUCCESS: {
465 // We successfully received a response packet from the server.
466 const dns::Rcode& rcode = getDnsUpdateResponse()->getRcode();
467 if (rcode == dns::Rcode::NOERROR()) {
468 // We were able to update the reverse mapping. Mark it as done.
471 } else {
472 // Per RFC4703 any other value means cease.
473 // If we get not authorized should try the next server in
474 // the list? @todo This needs some discussion perhaps.
476 .arg(getRequestId())
477 .arg(getCurrentServer()->toText())
478 .arg(getNcr()->getFqdn())
479 .arg(rcode.getCode());
481 }
482
483 break;
484 }
485
487 case DNSClient::OTHER:
488 // We couldn't send to the current server, log it and set up
489 // to select the next server for a retry.
490 // @note For now we treat OTHER as an IO error like TIMEOUT. It
491 // is not entirely clear if this is accurate.
493 .arg(getRequestId())
494 .arg(getNcr()->getFqdn())
495 .arg(getCurrentServer()->toText());
496
497 // If we are out of retries on this server, we go back and start
498 // all over on a new server.
500 break;
501
503 // A response was received but was corrupt. Retry it like an IO
504 // error.
506 .arg(getRequestId())
507 .arg(getCurrentServer()->toText())
508 .arg(getNcr()->getFqdn());
509
510 // If we are out of retries on this server, we go back and start
511 // all over on a new server.
513 break;
514
515 default:
516 // Any other value and we will fail this transaction, something
517 // bigger is wrong.
520 .arg(getRequestId())
521 .arg(getDnsUpdateStatus())
522 .arg(getNcr()->getFqdn())
523 .arg(getCurrentServer()->toText());
524
526 break;
527 } // end switch on dns_status
528
529 break;
530 } // end case IO_COMPLETE_EVT
531
532 default:
533 // Event is invalid.
535 "Wrong event for context: " << getContextStr());
536 }
537}
538
539void
541 switch(getNextEvent()) {
542 case UPDATE_OK_EVT:
544 .arg(getRequestId())
545 .arg(getNcr()->toText());
547 endModel();
548 break;
549 default:
550 // Event is invalid.
552 "Wrong event for context: " << getContextStr());
553 }
554}
555
556void
558 switch(getNextEvent()) {
563 .arg(getRequestId())
565 endModel();
566 break;
567 default:
568 // Event is invalid.
570 "Wrong event for context: " << getContextStr());
571 }
572}
573
574void
576 // Construct an empty request.
578
579 // Construct dns::Name from NCR fqdn.
580 dns::Name fqdn(dns::Name(getNcr()->getFqdn()));
581
582 // Content on this request is based on RFC 4703, section 5.3.1
583 // First build the Prerequisite Section.
584
585 // Create 'FQDN Is Not In Use' prerequisite and add it to the
586 // prerequisite section.
587 // Based on RFC 2136, section 2.4.5
590 request->addRRset(D2UpdateMessage::SECTION_PREREQUISITE, prereq);
591
592 // Next build the Update Section.
593
594 // Create the TTL based on lease length.
595 dns::RRTTL lease_ttl(getNcr()->getLeaseLength());
596
597 // Create the FQDN/IP 'add' RR and add it to the to update section.
598 // Based on RFC 2136, section 2.5.1
599 dns::RRsetPtr update(new dns::RRset(fqdn, dns::RRClass::IN(),
600 getAddressRRType(), lease_ttl));
601
602 addLeaseAddressRdata(update);
603 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
604
605 // Now create the FQDN/DHCID 'add' RR and add it to update section.
606 // Based on RFC 2136, section 2.5.1
607 update.reset(new dns::RRset(fqdn, dns::RRClass::IN(),
608 dns::RRType::DHCID(), lease_ttl));
609 addDhcidRdata(update);
610 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
611
612 // Set the transaction's update request to the new request.
613 setDnsUpdateRequest(request);
614}
615
616void
618 // Construct an empty request.
620
621 // Construct dns::Name from NCR fqdn.
622 dns::Name fqdn(dns::Name(getNcr()->getFqdn()));
623
624 // Content on this request is based on RFC 4703, section 5.3.2
625 // First build the Prerequisite Section.
626
627 // Create an 'FQDN Is In Use' prerequisite and add it to the
628 // pre-requisite section.
629 // Based on RFC 2136, section 2.4.4
630 dns::RRsetPtr prereq(new dns::RRset(fqdn, dns::RRClass::ANY(),
632 request->addRRset(D2UpdateMessage::SECTION_PREREQUISITE, prereq);
633
634 // Create an DHCID matches prerequisite RR and add it to the
635 // pre-requisite section.
636 // Based on RFC 2136, section 2.4.2.
637 prereq.reset(new dns::RRset(fqdn, dns::RRClass::IN(),
639 addDhcidRdata(prereq);
640 request->addRRset(D2UpdateMessage::SECTION_PREREQUISITE, prereq);
641
642 // Next build the Update Section.
643
644 // Create the TTL based on lease length.
645 dns::RRTTL lease_ttl(getNcr()->getLeaseLength());
646
647 // Create the FQDN/IP 'delete' RR and add it to the update section.
648 // Based on RFC 2136, section 2.5.2
649 dns::RRsetPtr update(new dns::RRset(fqdn, dns::RRClass::ANY(),
651 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
652
653 // Create the FQDN/IP 'add' RR and add it to the update section.
654 // Based on RFC 2136, section 2.5.1
655 update.reset(new dns::RRset(fqdn, dns::RRClass::IN(),
656 getAddressRRType(), lease_ttl));
657 addLeaseAddressRdata(update);
658 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
659
660 // Set the transaction's update request to the new request.
661 setDnsUpdateRequest(request);
662}
663
664void
666 // Construct an empty request.
668
669 // Create the reverse IP address "FQDN".
670 std::string rev_addr = D2CfgMgr::reverseIpAddress(getNcr()->getIpAddress());
671 dns::Name rev_ip(rev_addr);
672
673 // Create the TTL based on lease length.
674 dns::RRTTL lease_ttl(getNcr()->getLeaseLength());
675
676 // Content on this request is based on RFC 4703, section 5.4
677 // Reverse replacement has no prerequisites so straight on to
678 // building the Update section.
679
680 // Create the PTR 'delete' RR and add it to update section.
681 dns::RRsetPtr update(new dns::RRset(rev_ip, dns::RRClass::ANY(),
683 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
684
685 // Create the DHCID 'delete' RR and add it to the update section.
686 update.reset(new dns::RRset(rev_ip, dns::RRClass::ANY(),
688 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
689
690 // Create the FQDN/IP PTR 'add' RR, add the FQDN as the PTR Rdata
691 // then add it to update section.
692 update.reset(new dns::RRset(rev_ip, dns::RRClass::IN(),
693 dns::RRType::PTR(), lease_ttl));
694 addPtrRdata(update);
695 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
696
697 // Create the FQDN/IP PTR 'add' RR, add the DHCID Rdata
698 // then add it to update section.
699 update.reset(new dns::RRset(rev_ip, dns::RRClass::IN(),
700 dns::RRType::DHCID(), lease_ttl));
701 addDhcidRdata(update);
702 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
703
704 // Set the transaction's update request to the new request.
705 setDnsUpdateRequest(request);
706}
707
708} // namespace isc::d2
709} // namespace isc
static std::string reverseIpAddress(const std::string &address)
Generate a reverse order string for the given IP address.
Definition: d2_cfg_mgr.cc:170
@ 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:557
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:617
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:285
void processAddOkHandler()
State handler for PROCESS_TRANS_OK_ST.
Definition: nc_add.cc:540
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:173
void selectingRevServerHandler()
State handler for SELECTING_REV_SERVER_ST.
Definition: nc_add.cc:404
void replacingRevPtrsHandler()
State handler for REPLACING_REV_PTRS_ST.
Definition: nc_add.cc:434
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:665
void buildAddFwdAddressRequest()
Builds a DNS request to add an forward DNS entry for an FQDN.
Definition: nc_add.cc:575
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:286
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:553
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:265
virtual D2UpdateMessagePtr prepNewRequest(DdnsDomainPtr domain)
Creates a new DNS update request based on the given domain.
Definition: nc_trans.cc:343
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:573
const dhcp_ddns::NameChangeRequestPtr & getNcr() const
Fetches the NameChangeRequest for this transaction.
Definition: nc_trans.cc:425
void initServerSelection(const DdnsDomainPtr &domain)
Initializes server selection from the given DDNS domain.
Definition: nc_trans.cc:455
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:435
virtual void defineStates()
Adds states defined by NameChangeTransaction to the state set.
Definition: nc_trans.cc:257
void addLeaseAddressRdata(dns::RRsetPtr &rrset)
Adds an RData for the lease address to the given RRset.
Definition: nc_trans.cc:366
virtual void sendUpdate(const std::string &comment="")
Send the update request to the current server.
Definition: nc_trans.cc:192
void setForwardChangeCompleted(const bool value)
Sets the forward change completion flag to the given value.
Definition: nc_trans.cc:328
void addPtrRdata(dns::RRsetPtr &rrset)
Adds an RData for the lease FQDN to the given RRset.
Definition: nc_trans.cc:408
bool selectNextServer()
Selects the next server in the current server list.
Definition: nc_trans.cc:467
void setNcrStatus(const dhcp_ddns::NameChangeStatus &status)
Sets the status of the transaction's NameChangeRequest.
Definition: nc_trans.cc:538
DdnsDomainPtr & getForwardDomain()
Fetches the forward DdnsDomain.
Definition: nc_trans.cc:445
virtual void verifyEvents()
Validates the contents of the set of events.
Definition: nc_trans.cc:242
void addDhcidRdata(dns::RRsetPtr &rrset)
Adds an RData for the lease client's DHCID to the given RRset.
Definition: nc_trans.cc:388
void clearDnsUpdateRequest()
Destroys the current update request packet.
Definition: nc_trans.cc:303
void clearUpdateAttempts()
Resets the update attempts count.
Definition: nc_trans.cc:308
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:548
void setDnsUpdateRequest(D2UpdateMessagePtr &request)
Sets the update request packet to the given packet.
Definition: nc_trans.cc:298
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:227
void setReverseChangeCompleted(const bool value)
Sets the reverse change completion flag to the given value.
Definition: nc_trans.cc:333
const DnsServerInfoPtr & getCurrentServer() const
Fetches the currently selected server.
Definition: nc_trans.cc:533
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:450
std::string transactionOutcomeString() const
Returns a string version of transaction outcome.
Definition: nc_trans.cc:170
The Name class encapsulates DNS names.
Definition: name.h:223
static const RRClass & ANY()
Definition: rrclass.h:301
static const RRClass & NONE()
Definition: rrclass.h:325
static const RRClass & IN()
Definition: rrclass.h:319
The RRTTL class encapsulates TTLs used in DNS resource records.
Definition: rrttl.h:55
static const RRType & ANY()
Definition: rrtype.h:527
static const RRType & PTR()
Definition: rrtype.h:443
static const RRType & DHCID()
Definition: rrtype.h:503
The RRset class is a concrete derived class of BasicRRset which contains a pointer to an additional R...
Definition: rrset.h:847
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:220
static const Rcode & NXDOMAIN()
A constant object for the NXDOMAIN Rcode (see Rcode::NXDOMAIN_CODE).
Definition: rcode.h:238
uint16_t getCode() const
Returns the Rcode code value.
Definition: rcode.h:106
static const Rcode & YXDOMAIN()
A constant object for the YXDOMAIN Rcode (see Rcode::YXDOMAIN_CODE).
Definition: rcode.h:256
const EventPtr & getEvent(unsigned int value)
Fetches the event referred to by value.
Definition: state_model.cc:186
void endModel()
Conducts a normal transition to the end of the model.
Definition: state_model.cc:271
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
unsigned int getNextEvent() const
Fetches the model's next event.
Definition: state_model.cc:373
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
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
bool doOnEntry()
Checks if on entry flag is true.
Definition: state_model.cc:339
static const int START_EVT
Event issued to start the model execution.
Definition: state_model.h:295
const StatePtr getStateInternal(unsigned int value)
Fetches the state referred to by value.
Definition: state_model.cc:219
std::string getContextStr() const
Convenience method which returns a string rendition of the current state and next event.
Definition: state_model.cc:443
#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:23
const isc::log::MessageID DHCP_DDNS_FORWARD_REPLACE_RESP_CORRUPT
Definition: d2_messages.h:41
boost::shared_ptr< DdnsDomain > DdnsDomainPtr
Defines a pointer for DdnsDomain instances.
Definition: d2_config.h:612
const isc::log::MessageID DHCP_DDNS_FORWARD_ADD_REJECTED
Definition: d2_messages.h:25
const isc::log::MessageID DHCP_DDNS_REVERSE_REPLACE_RESP_CORRUPT
Definition: d2_messages.h:76
boost::shared_ptr< D2CfgMgr > D2CfgMgrPtr
Defines a shared pointer to D2CfgMgr.
Definition: d2_cfg_mgr.h:334
const isc::log::MessageID DHCP_DDNS_FORWARD_REPLACE_REJECTED
Definition: d2_messages.h:40
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:24
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:37
isc::log::Logger d2_to_dns_logger("d2-to-dns")
Definition: d2_log.h:20
const isc::log::MessageID DHCP_DDNS_REVERSE_REPLACE_REJECTED
Definition: d2_messages.h:75
const isc::log::MessageID DHCP_DDNS_REVERSE_REPLACE_BUILD_FAILURE
Definition: d2_messages.h:73
const isc::log::MessageID DHCP_DDNS_FORWARD_REPLACE_BUILD_FAILURE
Definition: d2_messages.h:38
const isc::log::MessageID DHCP_DDNS_FORWARD_ADD_BAD_DNSCLIENT_STATUS
Definition: d2_messages.h:22
const isc::log::MessageID DHCP_DDNS_REVERSE_REPLACE_BAD_DNSCLIENT_STATUS
Definition: d2_messages.h:72
const isc::log::MessageID DHCP_DDNS_REVERSE_REPLACE_IO_ERROR
Definition: d2_messages.h:74
const isc::log::MessageID DHCP_DDNS_FORWARD_REPLACE_IO_ERROR
Definition: d2_messages.h:39
const isc::log::MessageID DHCP_DDNS_FORWARD_ADD_RESP_CORRUPT
Definition: d2_messages.h:26
boost::shared_ptr< NameChangeRequest > NameChangeRequestPtr
Defines a pointer to a NameChangeRequest.
Definition: ncr_msg.h:212
boost::shared_ptr< AbstractRRset > RRsetPtr
A pointer-like type pointing to an RRset object.
Definition: rrset.h:47
Defines the logger used by the top-level component of kea-lfc.
This file defines the class NameAddTransaction.