Kea 2.0.3
nc_remove.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_remove.h>
10#include <d2srv/d2_cfg_mgr.h>
11#include <d2srv/d2_log.h>
12
13#include <functional>
14
15namespace isc {
16namespace d2 {
17
18
19// NameRemoveTransaction states
23
24// NameRemoveTransaction events
25// Currently NameRemoveTransaction does not define any events.
26
30 DdnsDomainPtr& forward_domain,
31 DdnsDomainPtr& reverse_domain,
32 D2CfgMgrPtr& cfg_mgr)
33 : NameChangeTransaction(io_service, ncr, forward_domain, reverse_domain,
34 cfg_mgr) {
35 if (ncr->getChangeType() != isc::dhcp_ddns::CHG_REMOVE) {
37 "NameRemoveTransaction, request type must be CHG_REMOVE");
38 }
39}
40
42}
43
44void
46 // Call superclass impl first.
48
49 // Define NameRemoveTransaction events.
50 // Currently NameRemoveTransaction does not define any events.
51 // defineEvent(TBD_EVENT, "TBD_EVT");
52}
53
54void
56 // Call superclass implementation first to verify its events. These are
57 // events common to all transactions, and they must be defined.
58 // SELECT_SERVER_EVT
59 // SERVER_SELECTED_EVT
60 // SERVER_IO_ERROR_EVT
61 // NO_MORE_SERVERS_EVT
62 // IO_COMPLETED_EVT
63 // UPDATE_OK_EVT
64 // UPDATE_FAILED_EVT
66
67 // Verify NameRemoveTransaction events by attempting to fetch them.
68 // Currently NameRemoveTransaction does not define any events.
69 // getEvent(TBD_EVENT);
70}
71
72void
74 // Call superclass impl first.
76
77 // Define NameRemoveTransaction states.
78 defineState(READY_ST, "READY_ST",
79 std::bind(&NameRemoveTransaction::readyHandler, this));
80
81 defineState(SELECTING_FWD_SERVER_ST, "SELECTING_FWD_SERVER_ST",
83 this));
84
85 defineState(SELECTING_REV_SERVER_ST, "SELECTING_REV_SERVER_ST",
87 this));
88
89 defineState(REMOVING_FWD_ADDRS_ST, "REMOVING_FWD_ADDRS_ST",
91 this));
92
93 defineState(REMOVING_FWD_RRS_ST, "REMOVING_FWD_RRS_ST",
95 this));
96
97 defineState(REMOVING_REV_PTRS_ST, "REMOVING_REV_PTRS_ST",
99 this));
100
101 defineState(PROCESS_TRANS_OK_ST, "PROCESS_TRANS_OK_ST",
103 this));
104
105 defineState(PROCESS_TRANS_FAILED_ST, "PROCESS_TRANS_FAILED_ST",
107 this));
108}
109
110void
112 // Call superclass implementation first to verify its states. These are
113 // states common to all transactions, and they must be defined.
114 // READY_ST
115 // SELECTING_FWD_SERVER_ST
116 // SELECTING_REV_SERVER_ST
117 // PROCESS_TRANS_OK_ST
118 // PROCESS_TRANS_FAILED_ST
120
121 // Verify NameRemoveTransaction states by attempting to fetch them.
125}
126
127void
129 switch(getNextEvent()) {
130 case START_EVT:
131 if (getForwardDomain()) {
132 // Request includes a forward change, do that first.
134 } else {
135 // Reverse change only, transition accordingly.
137 }
138
139 break;
140 default:
141 // Event is invalid.
143 "Wrong event for context: " << getContextStr());
144 }
145}
146
147void
149 switch(getNextEvent()) {
151 // First time through for this transaction, so initialize server
152 // selection.
154 break;
156 // We failed to communicate with current server. Attempt to select
157 // another one below.
158 break;
159 default:
160 // Event is invalid.
162 "Wrong event for context: " << getContextStr());
163 }
164
165 // Select the next server from the list of forward servers.
166 if (selectNextServer()) {
167 // We have a server to try.
169 }
170 else {
171 // Server list is exhausted, so fail the transaction.
173 }
174}
175
176void
178 if (doOnEntry()) {
179 // Clear the update attempts count on initial transition.
181 }
182
183 switch(getNextEvent()) {
185 try {
188 } catch (const std::exception& ex) {
189 // While unlikely, the build might fail if we have invalid
190 // data. Should that be the case, we need to fail the
191 // transaction.
194 .arg(getRequestId())
195 .arg(getNcr()->toText())
196 .arg(ex.what());
198 break;
199 }
200
201 // Call sendUpdate() to initiate the async send. Note it also sets
202 // next event to NOP_EVT.
203 sendUpdate("Forward A/AAAA Remove");
204 break;
205
206 case IO_COMPLETED_EVT: {
207 switch (getDnsUpdateStatus()) {
208 case DNSClient::SUCCESS: {
209 // We successfully received a response packet from the server.
210 // The RCODE will be based on a value-dependent RRset search,
211 // see RFC 2136 section 3.2.3/3.2.4.
212 const dns::Rcode& rcode = getDnsUpdateResponse()->getRcode();
213 if ((rcode == dns::Rcode::NOERROR()) ||
214 (rcode == dns::Rcode::NXRRSET())) {
215 // We were able to remove it or it wasn't there, now we
216 // need to remove any other RRs for this FQDN.
218 } else {
219 // Per RFC4703 any other value means cease.
220 // If we get not authorized should we try the next server in
221 // the list? @todo This needs some discussion perhaps.
223 .arg(getRequestId())
224 .arg(getCurrentServer()->toText())
225 .arg(getNcr()->getFqdn())
226 .arg(rcode.getCode());
228 }
229
230 break;
231 }
232
234 case DNSClient::OTHER:
235 // We couldn't send to the current server, log it and set up
236 // to select the next server for a retry.
237 // @note For now we treat OTHER as an IO error like TIMEOUT. It
238 // is not entirely clear if this is accurate.
240 .arg(getRequestId())
241 .arg(getNcr()->getFqdn())
242 .arg(getCurrentServer()->toText());
243
245 break;
246
248 // A response was received but was corrupt. Retry it like an IO
249 // error.
251 .arg(getRequestId())
252 .arg(getCurrentServer()->toText())
253 .arg(getNcr()->getFqdn());
254
256 break;
257
258 default:
259 // Any other value and we will fail this transaction, something
260 // bigger is wrong.
263 .arg(getRequestId())
264 .arg(getDnsUpdateStatus())
265 .arg(getNcr()->getFqdn())
266 .arg(getCurrentServer()->toText());
267
269 break;
270 } // end switch on dns_status
271
272 break;
273 } // end case IO_COMPLETE_EVT
274
275 default:
276 // Event is invalid.
278 "Wrong event for context: " << getContextStr());
279 }
280}
281
282
283void
285 if (doOnEntry()) {
286 // Clear the update attempts count on initial transition.
288 }
289
290 switch(getNextEvent()) {
291 case UPDATE_OK_EVT:
293 try {
296 } catch (const std::exception& ex) {
297 // While unlikely, the build might fail if we have invalid
298 // data. Should that be the case, we need to fail the
299 // 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 RR Remove");
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 // The RCODE will be based on a value-dependent RRset search,
319 // see RFC 2136 section 3.2.3/3.2.4.
320 const dns::Rcode& rcode = getDnsUpdateResponse()->getRcode();
321 if ((rcode == dns::Rcode::NOERROR()) ||
322 (rcode == dns::Rcode::NXRRSET())) {
323 // We were able to remove them or they were not there (
324 // Rcode of NXRRSET means there are no matching RRsets).
325 // In either case, we consider it success and mark it as done.
327
328 // If request calls for reverse update then do that next,
329 // otherwise we can process ok.
330 if (getReverseDomain()) {
332 } else {
334 }
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 // @note If we exhaust the IO retries for the current server
362 // due to IO failures, we will abort the remaining updates.
363 // The rational is that we are only in this state, if the remove
364 // of the forward address RR succeeded (removingFwdAddrsHandler)
365 // on the current server. Therefore we should not attempt another
366 // removal on a different server. This is perhaps a point
367 // for discussion.
368 // @todo Should we go ahead with the reverse remove?
370 break;
371
373 // A response was received but was corrupt. Retry it like an IO
374 // error.
376 .arg(getRequestId())
377 .arg(getCurrentServer()->toText())
378 .arg(getNcr()->getFqdn());
379
380 // If we are out of retries on this server abandon the transaction.
381 // (Same logic as the case for TIMEOUT above).
383 break;
384
385 default:
386 // Any other value and we will fail this transaction, something
387 // bigger is wrong.
390 .arg(getRequestId())
391 .arg(getDnsUpdateStatus())
392 .arg(getNcr()->getFqdn())
393 .arg(getCurrentServer()->toText());
394
396 break;
397 } // end switch on dns_status
398
399 break;
400 } // end case IO_COMPLETE_EVT
401
402 default:
403 // Event is invalid.
405 "Wrong event for context: " << getContextStr());
406 }
407}
408
409
410void
412 switch(getNextEvent()) {
414 // First time through for this transaction, so initialize server
415 // selection.
417 break;
419 // We failed to communicate with current server. Attempt to select
420 // another one below.
421 break;
422 default:
423 // Event is invalid.
425 "Wrong event for context: " << getContextStr());
426 }
427
428 // Select the next server from the list of forward servers.
429 if (selectNextServer()) {
430 // We have a server to try.
432 }
433 else {
434 // Server list is exhausted, so fail the transaction.
436 }
437}
438
439
440void
442 if (doOnEntry()) {
443 // Clear the update attempts count on initial transition.
445 }
446
447 switch(getNextEvent()) {
449 try {
452 } catch (const std::exception& ex) {
453 // While unlikely, the build might fail if we have invalid
454 // data. Should that be the case, we need to fail the
455 // transaction.
457 .arg(getRequestId())
458 .arg(getNcr()->toText())
459 .arg(ex.what());
461 break;
462 }
463
464 // Call sendUpdate() to initiate the async send. Note it also sets
465 // next event to NOP_EVT.
466 sendUpdate("Reverse Remove");
467 break;
468
469 case IO_COMPLETED_EVT: {
470 switch (getDnsUpdateStatus()) {
471 case DNSClient::SUCCESS: {
472 // We successfully received a response packet from the server.
473 // The RCODE will be based on a value-dependent RRset search,
474 // see RFC 2136 section 3.2.3/3.2.4.
475 const dns::Rcode& rcode = getDnsUpdateResponse()->getRcode();
476 if ((rcode == dns::Rcode::NOERROR()) ||
477 (rcode == dns::Rcode::NXRRSET())) {
478 // We were able to remove the reverse mapping or they were
479 // not there (Rcode of NXRRSET means there are no matching
480 // RRsets). In either case, mark it as done.
483 } else {
484 // Per RFC4703 any other value means cease.
485 // If we get not authorized should try the next server in
486 // the list? @todo This needs some discussion perhaps.
488 .arg(getRequestId())
489 .arg(getCurrentServer()->toText())
490 .arg(getNcr()->getFqdn())
491 .arg(rcode.getCode());
493 }
494
495 break;
496 }
497
499 case DNSClient::OTHER:
500 // We couldn't send to the current server, log it and set up
501 // to select the next server for a retry.
502 // @note For now we treat OTHER as an IO error like TIMEOUT. It
503 // is not entirely clear if this is accurate.
505 .arg(getRequestId())
506 .arg(getNcr()->getFqdn())
507 .arg(getCurrentServer()->toText());
508
509 // If we are out of retries on this server, we go back and start
510 // all over on a new server.
512 break;
513
515 // A response was received but was corrupt. Retry it like an IO
516 // error.
518 .arg(getRequestId())
519 .arg(getCurrentServer()->toText())
520 .arg(getNcr()->getFqdn());
521
522 // If we are out of retries on this server, we go back and start
523 // all over on a new server.
525 break;
526
527 default:
528 // Any other value and we will fail this transaction, something
529 // bigger is wrong.
532 .arg(getRequestId())
533 .arg(getDnsUpdateStatus())
534 .arg(getNcr()->getFqdn())
535 .arg(getCurrentServer()->toText());
536
538 break;
539 } // end switch on dns_status
540
541 break;
542 } // end case IO_COMPLETE_EVT
543
544 default:
545 // Event is invalid.
547 "Wrong event for context: " << getContextStr());
548 }
549}
550
551
552void
554 switch(getNextEvent()) {
555 case UPDATE_OK_EVT:
557 .arg(getRequestId())
558 .arg(getNcr()->toText());
560 endModel();
561 break;
562 default:
563 // Event is invalid.
565 "Wrong event for context: " << getContextStr());
566 }
567}
568
569void
571 switch(getNextEvent()) {
577 .arg(getRequestId())
579 endModel();
580 break;
581 default:
582 // Event is invalid.
584 "Wrong event for context: " << getContextStr());
585 }
586}
587
588void
590 // Construct an empty request.
592
593 // Content on this request is based on RFC 4703, section 5.5, paragraph 4.
594 // Construct dns::Name from NCR fqdn.
595 dns::Name fqdn(dns::Name(getNcr()->getFqdn()));
596 // First build the Prerequisite Section
597
598 // Create an DHCID matches prerequisite RR and add it to the
599 // pre-requisite section
600 // Based on RFC 2136, section 2.4.2.
601 dns::RRsetPtr prereq(new dns::RRset(fqdn, dns::RRClass::IN(),
603 addDhcidRdata(prereq);
604 request->addRRset(D2UpdateMessage::SECTION_PREREQUISITE, prereq);
605
606 // Next build the Update Section
607
608 // Create the FQDN/IP 'delete' RR and add it to the update section.
609 // Add the RR to update section.
610 // Based on 2136 section 2.5.4
613 addLeaseAddressRdata(update);
614 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
615
616 // Set the transaction's update request to the new request.
617 setDnsUpdateRequest(request);
618}
619
620void
622 // Construct an empty request.
624
625 // Construct dns::Name from NCR fqdn.
626 dns::Name fqdn(dns::Name(getNcr()->getFqdn()));
627
628 // Content on this request is based on RFC 4703, section 5.5, paragraph 5.
629 // First build the Prerequisite Section.
630
631 // Now create an DHCID matches prerequisite RR.
632 // Set the RR's RData to DHCID.
633 // Add it to the pre-requisite section.
634 // Based on RFC 2136, section 2.4.2.
635 dns::RRsetPtr prereq(new dns::RRset(fqdn, dns::RRClass::IN(),
637 addDhcidRdata(prereq);
638 request->addRRset(D2UpdateMessage::SECTION_PREREQUISITE, prereq);
639
640 // Create an assertion that there are no A RRs for the FQDN.
641 // Add it to the pre-reqs.
642 // Based on RFC 2136, section 2.4.3.
643 prereq.reset(new dns::RRset(fqdn, dns::RRClass::NONE(),
645 request->addRRset(D2UpdateMessage::SECTION_PREREQUISITE, prereq);
646
647 // Create an assertion that there are no A RRs for the FQDN.
648 // Add it to the pre-reqs.
649 // Based on RFC 2136, section 2.4.3.
650 prereq.reset(new dns::RRset(fqdn, dns::RRClass::NONE(),
652 request->addRRset(D2UpdateMessage::SECTION_PREREQUISITE, prereq);
653
654 // Next build the Update Section.
655
656 // Create the 'delete' of all RRs for FQDN.
657 // Set the message RData to lease address.
658 // Add the RR to update section.
659 // Based on RFC 2136, section 2.5.3.
660 dns::RRsetPtr update(new dns::RRset(fqdn, dns::RRClass::ANY(),
662 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
663
664 // Set the transaction's update request to the new request.
665 setDnsUpdateRequest(request);
666}
667
668void
670 // Construct an empty request.
672
673 // Create the reverse IP address "FQDN".
674 std::string rev_addr = D2CfgMgr::reverseIpAddress(getNcr()->getIpAddress());
675 dns::Name rev_ip(rev_addr);
676
677 // Content on this request is based on RFC 4703, section 5.5, paragraph 2.
678 // First build the Prerequisite Section.
679 // (Note that per RFC 4703, section 5.4, there is no need to validate
680 // DHCID RR for PTR entries.)
681
682 // Create an assertion that the PTRDNAME in the PTR record matches the
683 // client's FQDN for the address that was released.
684 // Based on RFC 2136, section 3.2.3
685 dns::RRsetPtr prereq(new dns::RRset(rev_ip, dns::RRClass::IN(),
687 addPtrRdata(prereq);
688 request->addRRset(D2UpdateMessage::SECTION_PREREQUISITE, prereq);
689
690 // Now, build the Update section.
691
692 // Create a delete of any RRs for the FQDN and add it to update section.
693 // Based on RFC 2136, section 3.4.2.3
694 dns::RRsetPtr update(new dns::RRset(rev_ip, dns::RRClass::ANY(),
696 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
697
698 // Set the transaction's update request to the new request.
699 setDnsUpdateRequest(request);
700}
701
702} // namespace isc::d2
703} // 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
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
Thrown if the NameRemoveTransaction encounters a general error.
Definition: nc_remove.h:18
virtual void verifyStates()
Validates the contents of the set of states.
Definition: nc_remove.cc:111
virtual void defineEvents()
Adds events defined by NameRemoveTransaction to the event set.
Definition: nc_remove.cc:45
void processRemoveOkHandler()
State handler for PROCESS_TRANS_OK_ST.
Definition: nc_remove.cc:553
void readyHandler()
State handler for READY_ST.
Definition: nc_remove.cc:128
void buildRemoveRevPtrsRequest()
Builds a DNS request to remove a reverse DNS entry for a FQDN.
Definition: nc_remove.cc:669
virtual void verifyEvents()
Validates the contents of the set of events.
Definition: nc_remove.cc:55
void selectingRevServerHandler()
State handler for SELECTING_REV_SERVER_ST.
Definition: nc_remove.cc:411
void removingFwdAddrsHandler()
State handler for REMOVING_FWD_ADDRS_ST.
Definition: nc_remove.cc:177
static const int REMOVING_REV_PTRS_ST
State that attempts to remove reverse PTR records.
Definition: nc_remove.h:62
virtual void defineStates()
Adds states defined by NameRemoveTransaction to the state set.
Definition: nc_remove.cc:73
void removingRevPtrsHandler()
State handler for REMOVING_REV_PTRS_ST.
Definition: nc_remove.cc:441
NameRemoveTransaction(asiolink::IOServicePtr &io_service, dhcp_ddns::NameChangeRequestPtr &ncr, DdnsDomainPtr &forward_domain, DdnsDomainPtr &reverse_domain, D2CfgMgrPtr &cfg_mgr)
Event sent when replace attempt to fails with address not in use.
Definition: nc_remove.cc:28
void removingFwdRRsHandler()
State handler for REMOVING_FWD_RRS_ST.
Definition: nc_remove.cc:284
static const int REMOVING_FWD_RRS_ST
State that attempts to remove any other forward RRs for the DHCID.
Definition: nc_remove.h:59
void selectingFwdServerHandler()
State handler for SELECTING_FWD_SERVER_ST.
Definition: nc_remove.cc:148
void buildRemoveFwdAddressRequest()
Builds a DNS request to remove a forward DNS address for a FQDN.
Definition: nc_remove.cc:589
void buildRemoveFwdRRsRequest()
Builds a DNS request to remove all forward DNS RRs for a FQDN.
Definition: nc_remove.cc:621
virtual ~NameRemoveTransaction()
Destructor.
Definition: nc_remove.cc:41
void processRemoveFailedHandler()
State handler for PROCESS_TRANS_FAILED_ST.
Definition: nc_remove.cc:570
static const int REMOVING_FWD_ADDRS_ST
State that attempts to remove specific forward address record.
Definition: nc_remove.h:56
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 & AAAA()
Definition: rrtype.h:497
static const RRType & PTR()
Definition: rrtype.h:443
static const RRType & DHCID()
Definition: rrtype.h:503
static const RRType & A()
Definition: rrtype.h:341
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 & NXRRSET()
A constant object for the NXRRSET Rcode (see Rcode::NXRRSET_CODE).
Definition: rcode.h:268
uint16_t getCode() const
Returns the Rcode code value.
Definition: rcode.h:106
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 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
const isc::log::MessageID DHCP_DDNS_FORWARD_REMOVE_ADDRS_IO_ERROR
Definition: d2_messages.h:29
boost::shared_ptr< D2UpdateMessage > D2UpdateMessagePtr
Pointer to the DNS Update Message.
boost::shared_ptr< DdnsDomain > DdnsDomainPtr
Defines a pointer for DdnsDomain instances.
Definition: d2_config.h:612
const isc::log::MessageID DHCP_DDNS_REVERSE_REMOVE_RESP_CORRUPT
Definition: d2_messages.h:71
boost::shared_ptr< D2CfgMgr > D2CfgMgrPtr
Defines a shared pointer to D2CfgMgr.
Definition: d2_cfg_mgr.h:334
const isc::log::MessageID DHCP_DDNS_FORWARD_REMOVE_RRS_RESP_CORRUPT
Definition: d2_messages.h:36
const isc::log::MessageID DHCP_DDNS_FORWARD_REMOVE_ADDRS_REJECTED
Definition: d2_messages.h:30
const isc::log::MessageID DHCP_DDNS_FORWARD_REMOVE_ADDRS_RESP_CORRUPT
Definition: d2_messages.h:31
const isc::log::MessageID DHCP_DDNS_FORWARD_REMOVE_RRS_REJECTED
Definition: d2_messages.h:35
const isc::log::MessageID DHCP_DDNS_REMOVE_SUCCEEDED
Definition: d2_messages.h:65
isc::log::Logger d2_to_dns_logger("d2-to-dns")
Definition: d2_log.h:20
const isc::log::MessageID DHCP_DDNS_FORWARD_REMOVE_RRS_BUILD_FAILURE
Definition: d2_messages.h:33
const isc::log::MessageID DHCP_DDNS_FORWARD_REMOVE_ADDRS_BUILD_FAILURE
Definition: d2_messages.h:28
const isc::log::MessageID DHCP_DDNS_FORWARD_REMOVE_RRS_BAD_DNSCLIENT_STATUS
Definition: d2_messages.h:32
const isc::log::MessageID DHCP_DDNS_REVERSE_REMOVE_IO_ERROR
Definition: d2_messages.h:69
const isc::log::MessageID DHCP_DDNS_REVERSE_REMOVE_BAD_DNSCLIENT_STATUS
Definition: d2_messages.h:67
const isc::log::MessageID DHCP_DDNS_REVERSE_REMOVE_BUILD_FAILURE
Definition: d2_messages.h:68
const isc::log::MessageID DHCP_DDNS_REMOVE_FAILED
Definition: d2_messages.h:64
const isc::log::MessageID DHCP_DDNS_FORWARD_REMOVE_ADDRS_BAD_DNSCLIENT_STATUS
Definition: d2_messages.h:27
const isc::log::MessageID DHCP_DDNS_FORWARD_REMOVE_RRS_IO_ERROR
Definition: d2_messages.h:34
const isc::log::MessageID DHCP_DDNS_REVERSE_REMOVE_REJECTED
Definition: d2_messages.h:70
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 NameRemoveTransaction.