Kea 2.6.0
check_exists_add.cc
Go to the documentation of this file.
1// Copyright (C) 2023-2024 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
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// CheckExistsAddTransaction states
25
26// CheckExistsAddTransaction 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 "CheckExistsAddTransaction, request type must be CHG_ADD");
41 }
42}
43
45}
46
47void
49 // Call superclass impl first.
51
52 // Define CheckExistsAddTransaction 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 CheckExistsAddTransaction events by attempting to fetch them.
73}
74
75void
77 // Call superclass impl first.
79
80 // Define CheckExistsAddTransaction states.
81 defineState(READY_ST, "READY_ST",
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 CheckExistsAddTransaction 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.
250 .arg(getRequestId())
251 .arg(getNcr()->getFqdn())
252 .arg(getCurrentServer()->toText());
253
255 break;
256
258 // A response was received but was corrupt. Retry it like an IO
259 // error.
261 .arg(getRequestId())
262 .arg(getCurrentServer()->toText())
263 .arg(getNcr()->getFqdn());
264
266 break;
267
268 default:
269 // Any other value and we will fail this transaction, something
270 // bigger is wrong.
272 .arg(getRequestId())
273 .arg(getDnsUpdateStatus())
274 .arg(getNcr()->getFqdn())
275 .arg(getCurrentServer()->toText());
276
278 break;
279 } // end switch on dns_status
280
281 break;
282 } // end case IO_COMPLETE_EVT
283
284 default:
285 // Event is invalid.
287 "Wrong event for context: " << getContextStr());
288 }
289}
290
291void
293 if (doOnEntry()) {
294 // Clear the update attempts count on initial transition.
296 }
297
298 switch(getNextEvent()) {
299 case FQDN_IN_USE_EVT:
301 try {
304 } catch (const std::exception& ex) {
305 // While unlikely, the build might fail if we have invalid
306 // data. Should that be the case, we need to fail the
307 // transaction.
309 .arg(getRequestId())
310 .arg(getNcr()->toText())
311 .arg(ex.what());
313 break;
314 }
315
316 // Call sendUpdate() to initiate the async send. Note it also sets
317 // next event to NOP_EVT.
318 sendUpdate("Forward Replace");
319 break;
320
321 case IO_COMPLETED_EVT: {
322 switch (getDnsUpdateStatus()) {
323 case DNSClient::SUCCESS: {
324 // We successfully received a response packet from the server.
325 const dns::Rcode& rcode = getDnsUpdateResponse()->getRcode();
326 if (rcode == dns::Rcode::NOERROR()) {
327 // We were able to replace the forward mapping. Mark it as done.
329
330 // If request calls for reverse update then do that next,
331 // otherwise we can process ok.
332 if (getReverseDomain()) {
334 } else {
336 }
337 } else if (rcode == dns::Rcode::NXDOMAIN()) {
338 // FQDN is NOT in use so go back and do the forward add address.
339 // Covers the case that it was there when we tried to add it,
340 // but has since been removed per RFC 4703.
342 } else {
343 // Per RFC4703 any other value means cease.
344 // If we get not authorized should try the next server in
345 // the list? @todo This needs some discussion perhaps.
347 .arg(getRequestId())
348 .arg(getCurrentServer()->toText())
349 .arg(getNcr()->getFqdn())
350 .arg(rcode.getCode());
352 }
353
354 break;
355 }
356
358 // No response from the server, log it and set up
359 // to select the next server for a retry.
361 .arg(getRequestId())
362 .arg(getNcr()->getFqdn())
363 .arg(getCurrentServer()->toText());
364
366 break;
367
368 case DNSClient::OTHER:
369 // We couldn't send to the current server, log it and set up
370 // to select the next server for a retry.
372 .arg(getRequestId())
373 .arg(getNcr()->getFqdn())
374 .arg(getCurrentServer()->toText());
375
376 // If we are out of retries on this server, we go back and start
377 // all over on a new server.
379 break;
380
382 // A response was received but was corrupt. Retry it like an IO
383 // error.
385 .arg(getRequestId())
386 .arg(getCurrentServer()->toText())
387 .arg(getNcr()->getFqdn());
388
389 // If we are out of retries on this server, we go back and start
390 // all over on a new server.
392 break;
393
394 default:
395 // Any other value and we will fail this transaction, something
396 // bigger is wrong.
399 .arg(getRequestId())
400 .arg(getDnsUpdateStatus())
401 .arg(getNcr()->getFqdn())
402 .arg(getCurrentServer()->toText());
403
405 break;
406 } // end switch on dns_status
407
408 break;
409 } // end case IO_COMPLETE_EVT
410
411 default:
412 // Event is invalid.
414 "Wrong event for context: " << getContextStr());
415 }
416}
417
418void
420 switch(getNextEvent()) {
422 // First time through for this transaction, so initialize server
423 // selection.
425 break;
427 // We failed to communicate with current server. Attempt to select
428 // another one below.
429 break;
430 default:
431 // Event is invalid.
433 "Wrong event for context: " << getContextStr());
434 }
435
436 // Select the next server from the list of forward servers.
437 if (selectNextServer()) {
438 // We have a server to try.
440 }
441 else {
442 // Server list is exhausted, so fail the transaction.
444 }
445}
446
447
448void
450 if (doOnEntry()) {
451 // Clear the update attempts count on initial transition.
453 }
454
455 switch(getNextEvent()) {
457 try {
460 } catch (const std::exception& ex) {
461 // While unlikely, the build might fail if we have invalid
462 // data. Should that be the case, we need to fail the
463 // transaction.
465 .arg(getRequestId())
466 .arg(getNcr()->toText())
467 .arg(ex.what());
469 break;
470 }
471
472 // Call sendUpdate() to initiate the async send. Note it also sets
473 // next event to NOP_EVT.
474 sendUpdate("Reverse Replace");
475 break;
476
477 case IO_COMPLETED_EVT: {
478 switch (getDnsUpdateStatus()) {
479 case DNSClient::SUCCESS: {
480 // We successfully received a response packet from the server.
481 const dns::Rcode& rcode = getDnsUpdateResponse()->getRcode();
482 if (rcode == dns::Rcode::NOERROR()) {
483 // We were able to update the reverse mapping. Mark it as done.
486 } else {
487 // Per RFC4703 any other value means cease.
488 // If we get not authorized should try the next server in
489 // the list? @todo This needs some discussion perhaps.
491 .arg(getRequestId())
492 .arg(getCurrentServer()->toText())
493 .arg(getNcr()->getFqdn())
494 .arg(rcode.getCode());
496 }
497
498 break;
499 }
500
502 // No response from the server, log it and set up
503 // to select the next server for a retry.
505 .arg(getRequestId())
506 .arg(getNcr()->getFqdn())
507 .arg(getCurrentServer()->toText());
508
510 break;
511
512 case DNSClient::OTHER:
513 // We couldn't send to the current server, log it and set up
514 // to select the next server for a retry.
516 .arg(getRequestId())
517 .arg(getNcr()->getFqdn())
518 .arg(getCurrentServer()->toText());
519
520 // If we are out of retries on this server, we go back and start
521 // all over on a new server.
523 break;
524
526 // A response was received but was corrupt. Retry it like an IO
527 // error.
529 .arg(getRequestId())
530 .arg(getCurrentServer()->toText())
531 .arg(getNcr()->getFqdn());
532
533 // If we are out of retries on this server, we go back and start
534 // all over on a new server.
536 break;
537
538 default:
539 // Any other value and we will fail this transaction, something
540 // bigger is wrong.
543 .arg(getRequestId())
544 .arg(getDnsUpdateStatus())
545 .arg(getNcr()->getFqdn())
546 .arg(getCurrentServer()->toText());
547
549 break;
550 } // end switch on dns_status
551
552 break;
553 } // end case IO_COMPLETE_EVT
554
555 default:
556 // Event is invalid.
558 "Wrong event for context: " << getContextStr());
559 }
560}
561
562void
564 switch(getNextEvent()) {
565 case UPDATE_OK_EVT:
567 .arg(getRequestId())
568 .arg(getNcr()->toText());
570 endModel();
571 break;
572 default:
573 // Event is invalid.
575 "Wrong event for context: " << getContextStr());
576 }
577}
578
579void
581 switch(getNextEvent()) {
586 .arg(getRequestId())
588 endModel();
589 break;
590 default:
591 // Event is invalid.
593 "Wrong event for context: " << getContextStr());
594 }
595}
596
597void
599 // Construct an empty request.
601
602 // Construct dns::Name from NCR fqdn.
603 dns::Name fqdn(dns::Name(getNcr()->getFqdn()));
604
605 // Content on this request is based on RFC 4703, section 5.3.1
606 // First build the Prerequisite Section.
607
608 // Create 'FQDN Is Not In Use' prerequisite and add it to the
609 // prerequisite section.
610 // Based on RFC 2136, section 2.4.5
613 request->addRRset(D2UpdateMessage::SECTION_PREREQUISITE, prereq);
614
615 // Next build the Update Section.
616
617 // Create the TTL based on lease length.
618 dns::RRTTL lease_ttl(getNcr()->getLeaseLength());
619
620 // Create the FQDN/IP 'add' RR and add it to the to update section.
621 // Based on RFC 2136, section 2.5.1
622 dns::RRsetPtr update(new dns::RRset(fqdn, dns::RRClass::IN(),
623 getAddressRRType(), lease_ttl));
624
625 addLeaseAddressRdata(update);
626 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
627
628 // Now create the FQDN/DHCID 'add' RR and add it to update section.
629 // Based on RFC 2136, section 2.5.1
630 update.reset(new dns::RRset(fqdn, dns::RRClass::IN(),
631 dns::RRType::DHCID(), lease_ttl));
632 addDhcidRdata(update);
633 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
634
635 // Set the transaction's update request to the new request.
636 setDnsUpdateRequest(request);
637}
638
639void
641 // Construct an empty request.
643
644 // Construct dns::Name from NCR fqdn.
645 dns::Name fqdn(dns::Name(getNcr()->getFqdn()));
646
647 // First build the Prerequisite Section.
648
649 // Create an DHCID exists prerequisite RR and add it to the
650 // pre-requisite section.
651 // Based on RFC 2136, section 2.4.1.
652 dns::RRsetPtr prereq(new dns::RRset(fqdn, dns::RRClass::ANY(),
654 request->addRRset(D2UpdateMessage::SECTION_PREREQUISITE, prereq);
655
656 // Next build the Update Section.
657
658 // Create the TTL based on lease length.
659 dns::RRTTL lease_ttl(getNcr()->getLeaseLength());
660
661 // Create the FQDN/IP 'delete' RR and add it to the update section.
662 // Based on RFC 2136, section 2.5.2
663 dns::RRsetPtr update(new dns::RRset(fqdn, dns::RRClass::ANY(),
665 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
666
667 // Create the DHCID 'delete' RR and add it to the update section.
668 update.reset(new dns::RRset(fqdn, dns::RRClass::ANY(),
670 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
671
672 // Create the FQDN/IP 'add' RR and add it to the update section.
673 // Based on RFC 2136, section 2.5.1
674 update.reset(new dns::RRset(fqdn, dns::RRClass::IN(),
675 getAddressRRType(), lease_ttl));
676 addLeaseAddressRdata(update);
677 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
678
679 // Create the DHCID 'add' RR and add it to the update section.
680 update.reset(new dns::RRset(fqdn, dns::RRClass::IN(),
681 dns::RRType::DHCID(), lease_ttl));
682 addDhcidRdata(update);
683 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
684
685 // Set the transaction's update request to the new request.
686 setDnsUpdateRequest(request);
687}
688
689void
691 // Construct an empty request.
693
694 // Create the reverse IP address "FQDN".
695 std::string rev_addr = D2CfgMgr::reverseIpAddress(getNcr()->getIpAddress());
696 dns::Name rev_ip(rev_addr);
697
698 // Create the TTL based on lease length.
699 dns::RRTTL lease_ttl(getNcr()->getLeaseLength());
700
701 // Content on this request is based on RFC 4703, section 5.4
702 // Reverse replacement has no prerequisites so straight on to
703 // building the Update section.
704
705 // Create the PTR 'delete' RR and add it to update section.
706 dns::RRsetPtr update(new dns::RRset(rev_ip, dns::RRClass::ANY(),
708 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
709
710 // Create the DHCID 'delete' RR and add it to the update section.
711 update.reset(new dns::RRset(rev_ip, dns::RRClass::ANY(),
713 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
714
715 // Create the FQDN/IP PTR 'add' RR, add the FQDN as the PTR Rdata
716 // then add it to update section.
717 update.reset(new dns::RRset(rev_ip, dns::RRClass::IN(),
718 dns::RRType::PTR(), lease_ttl));
719 addPtrRdata(update);
720 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
721
722 // Create the DHCID 'add' RR, add the DHCID Rdata
723 // then add it to update section.
724 update.reset(new dns::RRset(rev_ip, dns::RRClass::IN(),
725 dns::RRType::DHCID(), lease_ttl));
726 addDhcidRdata(update);
727 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
728
729 // Set the transaction's update request to the new request.
730 setDnsUpdateRequest(request);
731}
732
733} // namespace isc::d2
734} // namespace isc
This file defines the class CheckExistsAddTransaction.
Thrown if the CheckExistsAddTransaction encounters a general error.
static const int FQDN_IN_USE_EVT
Event sent when an add attempt fails with address in use.
void buildReplaceFwdAddressRequest()
Builds a DNS request to replace forward DNS entry for an FQDN.
void selectingRevServerHandler()
State handler for SELECTING_REV_SERVER_ST.
virtual void verifyStates()
Validates the contents of the set of states.
virtual void verifyEvents()
Validates the contents of the set of events.
static const int REPLACING_FWD_ADDRS_ST
State that attempts to replace forward address records.
void replacingRevPtrsHandler()
State handler for REPLACING_REV_PTRS_ST.
static const int ADDING_FWD_ADDRS_ST
State that attempts to add forward address records.
void addingFwdAddrsHandler()
State handler for ADD_FWD_ADDRS_ST.
void processAddOkHandler()
State handler for PROCESS_TRANS_OK_ST.
void buildReplaceRevPtrsRequest()
Builds a DNS request to replace a reverse DNS entry for an FQDN.
virtual void defineEvents()
Adds events defined by CheckExistsAddTransaction to the event set.
static const int REPLACING_REV_PTRS_ST
State that attempts to replace reverse PTR records.
void buildAddFwdAddressRequest()
Builds a DNS request to add an forward DNS entry for an FQDN.
void processAddFailedHandler()
State handler for PROCESS_TRANS_FAILED_ST.
CheckExistsAddTransaction(asiolink::IOServicePtr &io_service, dhcp_ddns::NameChangeRequestPtr &ncr, DdnsDomainPtr &forward_domain, DdnsDomainPtr &reverse_domain, D2CfgMgrPtr &cfg_mgr)
Constructor.
void replacingFwdAddrsHandler()
State handler for REPLACING_FWD_ADDRS_ST.
void readyHandler()
State handler for READY_ST.
virtual ~CheckExistsAddTransaction()
Destructor.
void selectingFwdServerHandler()
State handler for SELECTING_FWD_SERVER_ST.
static const int FQDN_NOT_IN_USE_EVT
Event sent when replace attempt to fails with address not in use.
virtual void defineStates()
Adds states defined by CheckExistsAddTransaction to the state set.
static std::string reverseIpAddress(const std::string &address)
Generate a reverse order string for the given IP address.
Definition: d2_cfg_mgr.cc:169
@ 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
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
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:264
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:24
const isc::log::MessageID DHCP_DDNS_FORWARD_REPLACE_RESP_CORRUPT
Definition: d2_messages.h:45
boost::shared_ptr< DdnsDomain > DdnsDomainPtr
Defines a pointer for DdnsDomain instances.
Definition: d2_config.h:622
const isc::log::MessageID DHCP_DDNS_FORWARD_ADD_REJECTED
Definition: d2_messages.h:26
const isc::log::MessageID DHCP_DDNS_REVERSE_REPLACE_RESP_CORRUPT
Definition: d2_messages.h:83
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:44
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:25
const isc::log::MessageID DHCP_DDNS_REVERSE_REPLACE_TIMEOUT
Definition: d2_messages.h:84
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:41
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:28
const isc::log::MessageID DHCP_DDNS_REVERSE_REPLACE_REJECTED
Definition: d2_messages.h:82
const isc::log::MessageID DHCP_DDNS_REVERSE_REPLACE_BUILD_FAILURE
Definition: d2_messages.h:80
const isc::log::MessageID DHCP_DDNS_FORWARD_REPLACE_BUILD_FAILURE
Definition: d2_messages.h:42
const isc::log::MessageID DHCP_DDNS_FORWARD_ADD_BAD_DNSCLIENT_STATUS
Definition: d2_messages.h:23
const isc::log::MessageID DHCP_DDNS_FORWARD_REPLACE_TIMEOUT
Definition: d2_messages.h:46
const isc::log::MessageID DHCP_DDNS_REVERSE_REPLACE_BAD_DNSCLIENT_STATUS
Definition: d2_messages.h:79
const isc::log::MessageID DHCP_DDNS_REVERSE_REPLACE_IO_ERROR
Definition: d2_messages.h:81
const isc::log::MessageID DHCP_DDNS_FORWARD_REPLACE_IO_ERROR
Definition: d2_messages.h:43
const isc::log::MessageID DHCP_DDNS_FORWARD_ADD_RESP_CORRUPT
Definition: d2_messages.h:27
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.