Kea: simple_remove_without_dhcid.cc Source File

| Kea 3.2.0-git

simple_remove_without_dhcid.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
9#include <d2/simple_remove_without_dhcid.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// SimpleRemoveWithoutDHCIDTransaction states
20const int SimpleRemoveWithoutDHCIDTransaction::REMOVING_FWD_RRS_ST;
21const int SimpleRemoveWithoutDHCIDTransaction::REMOVING_REV_PTRS_ST;
22
23// SimpleRemoveWithoutDHCIDTransaction events
24// Currently SimpleRemoveWithoutDHCIDTransaction does not define any events.
25
26SimpleRemoveWithoutDHCIDTransaction::
27 SimpleRemoveWithoutDHCIDTransaction(asiolink::IOServicePtr& io_service,
28 dhcp_ddns::NameChangeRequestPtr& ncr,
29 DdnsDomainPtr& forward_domain,
30 DdnsDomainPtr& reverse_domain,
31 D2CfgMgrPtr& cfg_mgr)
32 : NameChangeTransaction(io_service, ncr, forward_domain, reverse_domain,
33 cfg_mgr) {
34 if (ncr->getChangeType() != isc::dhcp_ddns::CHG_REMOVE) {
35 isc_throw (SimpleRemoveWithoutDHCIDTransactionError,
36 "SimpleRemoveWithoutDHCIDTransaction, request type must be CHG_REMOVE");
37 }
38}
39
40SimpleRemoveWithoutDHCIDTransaction::~SimpleRemoveWithoutDHCIDTransaction(){
41}
42
43void
44SimpleRemoveWithoutDHCIDTransaction::defineEvents() {
45 // Call superclass impl first.
46 NameChangeTransaction::defineEvents();
47
48 // Define SimpleRemoveWithoutDHCIDTransaction events.
49 // Currently SimpleRemoveWithoutDHCIDTransaction does not define any events.
50 // defineEvent(TBD_EVENT, "TBD_EVT");
51}
52
53void
54SimpleRemoveWithoutDHCIDTransaction::verifyEvents() {
55 // Call superclass implementation first to verify its events. These are
56 // events common to all transactions, and they must be defined.
57 // SELECT_SERVER_EVT
58 // SERVER_SELECTED_EVT
59 // SERVER_IO_ERROR_EVT
60 // NO_MORE_SERVERS_EVT
61 // IO_COMPLETED_EVT
62 // UPDATE_OK_EVT
63 // UPDATE_FAILED_EVT
64 NameChangeTransaction::verifyEvents();
65
66 // Verify SimpleRemoveWithoutDHCIDTransaction events by attempting to fetch them.
67 // Currently SimpleRemoveWithoutDHCIDTransaction does not define any events.
68 // getEvent(TBD_EVENT);
69}
70
71void
72SimpleRemoveWithoutDHCIDTransaction::defineStates() {
73 // Call superclass impl first.
74 NameChangeTransaction::defineStates();
75
76 // Define SimpleRemoveWithoutDHCIDTransaction states.
77 defineState(READY_ST, "READY_ST",
78 std::bind(&SimpleRemoveWithoutDHCIDTransaction::readyHandler, this));
79
80 defineState(SELECTING_FWD_SERVER_ST, "SELECTING_FWD_SERVER_ST",
81 std::bind(&SimpleRemoveWithoutDHCIDTransaction::selectingFwdServerHandler,
82 this));
83
84 defineState(SELECTING_REV_SERVER_ST, "SELECTING_REV_SERVER_ST",
85 std::bind(&SimpleRemoveWithoutDHCIDTransaction::selectingRevServerHandler,
86 this));
87
88 defineState(REMOVING_FWD_RRS_ST, "REMOVING_FWD_RRS_ST",
89 std::bind(&SimpleRemoveWithoutDHCIDTransaction::removingFwdRRsHandler,
90 this));
91
92 defineState(REMOVING_REV_PTRS_ST, "REMOVING_REV_PTRS_ST",
93 std::bind(&SimpleRemoveWithoutDHCIDTransaction::removingRevPtrsHandler,
94 this));
95
96 defineState(PROCESS_TRANS_OK_ST, "PROCESS_TRANS_OK_ST",
97 std::bind(&SimpleRemoveWithoutDHCIDTransaction::processRemoveOkHandler,
98 this));
99
100 defineState(PROCESS_TRANS_FAILED_ST, "PROCESS_TRANS_FAILED_ST",
101 std::bind(&SimpleRemoveWithoutDHCIDTransaction::processRemoveFailedHandler,
102 this));
103}
104
105void
106SimpleRemoveWithoutDHCIDTransaction::verifyStates() {
107 // Call superclass implementation first to verify its states. These are
108 // states common to all transactions, and they must be defined.
109 // READY_ST
110 // SELECTING_FWD_SERVER_ST
111 // SELECTING_REV_SERVER_ST
112 // PROCESS_TRANS_OK_ST
113 // PROCESS_TRANS_FAILED_ST
114 NameChangeTransaction::verifyStates();
115
116 // Verify SimpleRemoveWithoutDHCIDTransaction states by attempting to fetch them.
117 getStateInternal(REMOVING_FWD_RRS_ST);
118 getStateInternal(REMOVING_REV_PTRS_ST);
119}
120
121void
122SimpleRemoveWithoutDHCIDTransaction::readyHandler() {
123 switch(getNextEvent()) {
124 case START_EVT:
125 if (getForwardDomain()) {
126 // Request includes a forward change, do that first.
127 transition(SELECTING_FWD_SERVER_ST, SELECT_SERVER_EVT);
128 } else {
129 // Reverse change only, transition accordingly.
130 transition(SELECTING_REV_SERVER_ST, SELECT_SERVER_EVT);
131 }
132
133 break;
134 default:
135 // Event is invalid.
136 isc_throw(SimpleRemoveWithoutDHCIDTransactionError,
137 "Wrong event for context: " << getContextStr());
138 }
139}
140
141void
142SimpleRemoveWithoutDHCIDTransaction::selectingFwdServerHandler() {
143 switch(getNextEvent()) {
144 case SELECT_SERVER_EVT:
145 // First time through for this transaction, so initialize server
146 // selection.
147 initServerSelection(getForwardDomain());
148 break;
149 case SERVER_IO_ERROR_EVT:
150 // We failed to communicate with current server. Attempt to select
151 // another one below.
152 break;
153 default:
154 // Event is invalid.
155 isc_throw(SimpleRemoveWithoutDHCIDTransactionError,
156 "Wrong event for context: " << getContextStr());
157 }
158
159 // Select the next server from the list of forward servers.
160 if (selectNextServer()) {
161 // We have a server to try.
162 transition(REMOVING_FWD_RRS_ST, SERVER_SELECTED_EVT);
163 }
164 else {
165 // Server list is exhausted, so fail the transaction.
166 transition(PROCESS_TRANS_FAILED_ST, NO_MORE_SERVERS_EVT);
167 }
168}
169
170void
171SimpleRemoveWithoutDHCIDTransaction::removingFwdRRsHandler() {
172 if (doOnEntry()) {
173 // Clear the update attempts count on initial transition.
174 clearUpdateAttempts();
175 }
176
177 switch(getNextEvent()) {
178 case UPDATE_OK_EVT:
179 case SERVER_SELECTED_EVT:
180 try {
181 clearDnsUpdateRequest();
182 buildRemoveFwdRRsRequest();
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.
187 LOG_ERROR(d2_to_dns_logger,
188 DHCP_DDNS_FORWARD_REMOVE_RRS_BUILD_FAILURE)
189 .arg(getRequestId())
190 .arg(getNcr()->toText())
191 .arg(ex.what());
192 transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
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 RR Remove");
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 // The RCODE will be based on a value-dependent RRset search,
206 // see RFC 2136 section 3.2.3/3.2.4.
207 const dns::Rcode& rcode = getDnsUpdateResponse()->getRcode();
208 if ((rcode == dns::Rcode::NOERROR()) ||
209 (rcode == dns::Rcode::NXRRSET())) {
210 // We were able to remove them or they were not there (
211 // Rcode of NXRRSET means there are no matching RRsets).
212 // In either case, we consider it success and mark it as done.
213 setForwardChangeCompleted(true);
214
215 // If request calls for reverse update then do that next,
216 // otherwise we can process ok.
217 if (getReverseDomain()) {
218 transition(SELECTING_REV_SERVER_ST, SELECT_SERVER_EVT);
219 } else {
220 transition(PROCESS_TRANS_OK_ST, UPDATE_OK_EVT);
221 }
222 } else {
223 // Any other value means cease.
224 // If we get not authorized should try the next server in
225 // the list? @todo This needs some discussion perhaps.
226 LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_REMOVE_RRS_REJECTED)
227 .arg(getRequestId())
228 .arg(getCurrentServer()->toText())
229 .arg(getNcr()->getFqdn())
230 .arg(rcode.getCode());
231 transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
232 }
233
234 break;
235 }
236
237 case DNSClient::TIMEOUT:
238 // No response from the server, log it and set up
239 // to select the next server for a retry.
240 LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_REMOVE_RRS_TIMEOUT)
241 .arg(getRequestId())
242 .arg(getNcr()->getFqdn())
243 .arg(getCurrentServer()->toText());
244
245 retryTransition(SELECTING_FWD_SERVER_ST);
246 break;
247
248 case DNSClient::OTHER:
249 // We couldn't send to the current server, log it and set up
250 // to select the next server for a retry.
251 LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_REMOVE_RRS_IO_ERROR)
252 .arg(getRequestId())
253 .arg(getNcr()->getFqdn())
254 .arg(getCurrentServer()->toText());
255
256 retryTransition(SELECTING_FWD_SERVER_ST);
257 break;
258
259 case DNSClient::INVALID_RESPONSE:
260 // A response was received but was corrupt. Retry it like an IO
261 // error.
262 LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_REMOVE_RRS_RESP_CORRUPT)
263 .arg(getRequestId())
264 .arg(getCurrentServer()->toText())
265 .arg(getNcr()->getFqdn());
266
267 retryTransition(SELECTING_FWD_SERVER_ST);
268 break;
269
270 default:
271 // Any other value and we will fail this transaction, something
272 // bigger is wrong.
273 LOG_ERROR(d2_to_dns_logger,
274 DHCP_DDNS_FORWARD_REMOVE_RRS_BAD_DNSCLIENT_STATUS)
275 .arg(getRequestId())
276 .arg(getDnsUpdateStatus())
277 .arg(getNcr()->getFqdn())
278 .arg(getCurrentServer()->toText());
279
280 transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
281 break;
282 } // end switch on dns_status
283
284 break;
285 } // end case IO_COMPLETE_EVT
286
287 default:
288 // Event is invalid.
289 isc_throw(SimpleRemoveWithoutDHCIDTransactionError,
290 "Wrong event for context: " << getContextStr());
291 }
292}
293
294
295void
296SimpleRemoveWithoutDHCIDTransaction::selectingRevServerHandler() {
297 switch(getNextEvent()) {
298 case SELECT_SERVER_EVT:
299 // First time through for this transaction, so initialize server
300 // selection.
301 initServerSelection(getReverseDomain());
302 break;
303 case SERVER_IO_ERROR_EVT:
304 // We failed to communicate with current server. Attempt to select
305 // another one below.
306 break;
307 default:
308 // Event is invalid.
309 isc_throw(SimpleRemoveWithoutDHCIDTransactionError,
310 "Wrong event for context: " << getContextStr());
311 }
312
313 // Select the next server from the list of forward servers.
314 if (selectNextServer()) {
315 // We have a server to try.
316 transition(REMOVING_REV_PTRS_ST, SERVER_SELECTED_EVT);
317 }
318 else {
319 // Server list is exhausted, so fail the transaction.
320 transition(PROCESS_TRANS_FAILED_ST, NO_MORE_SERVERS_EVT);
321 }
322}
323
324
325void
326SimpleRemoveWithoutDHCIDTransaction::removingRevPtrsHandler() {
327 if (doOnEntry()) {
328 // Clear the update attempts count on initial transition.
329 clearUpdateAttempts();
330 }
331
332 switch(getNextEvent()) {
333 case SERVER_SELECTED_EVT:
334 try {
335 clearDnsUpdateRequest();
336 buildRemoveRevPtrsRequest();
337 } catch (const std::exception& ex) {
338 // While unlikely, the build might fail if we have invalid
339 // data. Should that be the case, we need to fail the
340 // transaction.
341 LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_REVERSE_REMOVE_BUILD_FAILURE)
342 .arg(getRequestId())
343 .arg(getNcr()->toText())
344 .arg(ex.what());
345 transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
346 break;
347 }
348
349 // Call sendUpdate() to initiate the async send. Note it also sets
350 // next event to NOP_EVT.
351 sendUpdate("Reverse Remove");
352 break;
353
354 case IO_COMPLETED_EVT: {
355 switch (getDnsUpdateStatus()) {
356 case DNSClient::SUCCESS: {
357 // We successfully received a response packet from the server.
358 // The RCODE will be based on a value-dependent RRset search,
359 // see RFC 2136 section 3.2.3/3.2.4.
360 const dns::Rcode& rcode = getDnsUpdateResponse()->getRcode();
361 if ((rcode == dns::Rcode::NOERROR()) ||
362 (rcode == dns::Rcode::NXRRSET())) {
363 // We were able to remove the reverse mapping or they were
364 // not there (Rcode of NXRRSET means there are no matching
365 // RRsets). In either case, mark it as done.
366 setReverseChangeCompleted(true);
367 transition(PROCESS_TRANS_OK_ST, UPDATE_OK_EVT);
368 } else {
369 // Per RFC4703 any other value means cease.
370 // If we get not authorized should try the next server in
371 // the list? @todo This needs some discussion perhaps.
372 LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_REVERSE_REMOVE_REJECTED)
373 .arg(getRequestId())
374 .arg(getCurrentServer()->toText())
375 .arg(getNcr()->getFqdn())
376 .arg(rcode.getCode());
377 transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
378 }
379
380 break;
381 }
382
383 case DNSClient::TIMEOUT:
384 // No response from the server, log it and set up
385 // to select the next server for a retry.
386 LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_REVERSE_REMOVE_TIMEOUT)
387 .arg(getRequestId())
388 .arg(getNcr()->getFqdn())
389 .arg(getCurrentServer()->toText());
390
391 // If we are out of retries on this server, we go back and start
392 // all over on a new server.
393 retryTransition(SELECTING_REV_SERVER_ST);
394 break;
395
396 case DNSClient::OTHER:
397 // We couldn't send to the current server, log it and set up
398 // to select the next server for a retry.
399 LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_REVERSE_REMOVE_IO_ERROR)
400 .arg(getRequestId())
401 .arg(getNcr()->getFqdn())
402 .arg(getCurrentServer()->toText());
403
404 // If we are out of retries on this server, we go back and start
405 // all over on a new server.
406 retryTransition(SELECTING_REV_SERVER_ST);
407 break;
408
409 case DNSClient::INVALID_RESPONSE:
410 // A response was received but was corrupt. Retry it like an IO
411 // error.
412 LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_REVERSE_REMOVE_RESP_CORRUPT)
413 .arg(getRequestId())
414 .arg(getCurrentServer()->toText())
415 .arg(getNcr()->getFqdn());
416
417 // If we are out of retries on this server, we go back and start
418 // all over on a new server.
419 retryTransition(SELECTING_REV_SERVER_ST);
420 break;
421
422 default:
423 // Any other value and we will fail this transaction, something
424 // bigger is wrong.
425 LOG_ERROR(d2_to_dns_logger,
426 DHCP_DDNS_REVERSE_REMOVE_BAD_DNSCLIENT_STATUS)
427 .arg(getRequestId())
428 .arg(getDnsUpdateStatus())
429 .arg(getNcr()->getFqdn())
430 .arg(getCurrentServer()->toText());
431
432 transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
433 break;
434 } // end switch on dns_status
435
436 break;
437 } // end case IO_COMPLETE_EVT
438
439 default:
440 // Event is invalid.
441 isc_throw(SimpleRemoveWithoutDHCIDTransactionError,
442 "Wrong event for context: " << getContextStr());
443 }
444}
445
446
447void
448SimpleRemoveWithoutDHCIDTransaction::processRemoveOkHandler() {
449 switch(getNextEvent()) {
450 case UPDATE_OK_EVT:
451 LOG_INFO(d2_to_dns_logger, DHCP_DDNS_REMOVE_SUCCEEDED)
452 .arg(getRequestId())
453 .arg(getNcr()->toText());
454 setNcrStatus(dhcp_ddns::ST_COMPLETED);
455 endModel();
456 break;
457 default:
458 // Event is invalid.
459 isc_throw(SimpleRemoveWithoutDHCIDTransactionError,
460 "Wrong event for context: " << getContextStr());
461 }
462}
463
464void
465SimpleRemoveWithoutDHCIDTransaction::processRemoveFailedHandler() {
466 switch(getNextEvent()) {
467 case UPDATE_FAILED_EVT:
468 case NO_MORE_SERVERS_EVT:
469 case SERVER_IO_ERROR_EVT:
470 setNcrStatus(dhcp_ddns::ST_FAILED);
471 LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_REMOVE_FAILED)
472 .arg(getRequestId())
473 .arg(transactionOutcomeString());
474 endModel();
475 break;
476 default:
477 // Event is invalid.
478 isc_throw(SimpleRemoveWithoutDHCIDTransactionError,
479 "Wrong event for context: " << getContextStr());
480 }
481}
482
483void
484SimpleRemoveWithoutDHCIDTransaction::buildRemoveFwdRRsRequest() {
485 // Construct an empty request.
486 D2UpdateMessagePtr request = prepNewRequest(getForwardDomain());
487
488 // There are no pre-requisites.
489
490 // Build the Update Section
491 // Construct dns::Name from NCR fqdn.
492 dns::Name fqdn(dns::Name(getNcr()->getFqdn()));
493
494 // Build the Update Section.
495
496 // Create the FQDN/IP 'delete' RR and add it to update section.
497 dns::RRsetPtr update(new dns::RRset(fqdn, dns::RRClass::ANY(),
498 getAddressRRType(), dns::RRTTL(0)));
499
500 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
501
502 // Set the transaction's update request to the new request.
503 setDnsUpdateRequest(request);
504}
505
506void
507SimpleRemoveWithoutDHCIDTransaction::buildRemoveRevPtrsRequest() {
508 // Construct an empty request.
509 D2UpdateMessagePtr request = prepNewRequest(getReverseDomain());
510
511 // Create the reverse IP address "FQDN".
512 std::string rev_addr = D2CfgMgr::reverseIpAddress(getNcr()->getIpAddress());
513 dns::Name rev_ip(rev_addr);
514
515 // There are no pre-requisites.
516
517 // Build the Update section.
518
519 // Create the FQDN/IP PTR 'delete' RR for this IP and add it to
520 // the update section.
521 dns::RRsetPtr update(new dns::RRset(rev_ip, dns::RRClass::ANY(),
522 dns::RRType::PTR(), dns::RRTTL(0)));
523 request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
524
525 // Set the transaction's update request to the new request.
526 setDnsUpdateRequest(request);
527}
528
529} // namespace isc::d2
530} // namespace isc
isc::d2::D2CfgMgr::reverseIpAddress
static std::string reverseIpAddress(const std::string &address)
Generate a reverse order string for the given IP address.
Definition d2_cfg_mgr.cc:183
isc::d2::D2UpdateMessage::SECTION_UPDATE
@ SECTION_UPDATE
Definition d2_update_message.h:120
isc::d2::DNSClient::TIMEOUT
@ TIMEOUT
No response, timeout.
Definition dns_client.h:60
isc::d2::DNSClient::OTHER
@ OTHER
Other, unclassified error.
Definition dns_client.h:63
isc::d2::DNSClient::INVALID_RESPONSE
@ INVALID_RESPONSE
Response received but invalid.
Definition dns_client.h:62
isc::d2::DNSClient::SUCCESS
@ SUCCESS
Response received and is ok.
Definition dns_client.h:59
isc::d2::NameChangeTransaction::SELECTING_FWD_SERVER_ST
static const int SELECTING_FWD_SERVER_ST
State in which forward DNS server selection is done.
Definition nc_trans.h:91
isc::d2::NameChangeTransaction::retryTransition
void retryTransition(const int fail_to_state)
Determines the state and next event based on update attempts.
Definition nc_trans.cc:286
isc::d2::NameChangeTransaction::PROCESS_TRANS_FAILED_ST
static const int PROCESS_TRANS_FAILED_ST
State which processes an unsuccessful transaction conclusion.
Definition nc_trans.h:105
isc::d2::NameChangeTransaction::READY_ST
static const int READY_ST
State from which a transaction is started.
Definition nc_trans.h:83
isc::d2::NameChangeTransaction::getDnsUpdateResponse
const D2UpdateMessagePtr & getDnsUpdateResponse() const
Fetches the most recent DNS update response packet.
Definition nc_trans.cc:553
isc::d2::NameChangeTransaction::PROCESS_TRANS_OK_ST
static const int PROCESS_TRANS_OK_ST
State which processes successful transaction conclusion.
Definition nc_trans.h:102
isc::d2::NameChangeTransaction::UPDATE_OK_EVT
static const int UPDATE_OK_EVT
Issued when the attempted update successfully completed.
Definition nc_trans.h:135
isc::d2::NameChangeTransaction::verifyStates
virtual void verifyStates()
Validates the contents of the set of states.
Definition nc_trans.cc:265
isc::d2::NameChangeTransaction::prepNewRequest
virtual D2UpdateMessagePtr prepNewRequest(DdnsDomainPtr domain)
Creates a new DNS update request based on the given domain.
Definition nc_trans.cc:343
isc::d2::NameChangeTransaction::NameChangeTransaction
NameChangeTransaction(asiolink::IOServicePtr &io_service, dhcp_ddns::NameChangeRequestPtr &ncr, DdnsDomainPtr &forward_domain, DdnsDomainPtr &reverse_domain, D2CfgMgrPtr &cfg_mgr)
Constructor.
Definition nc_trans.cc:69
isc::d2::NameChangeTransaction::UPDATE_FAILED_EVT
static const int UPDATE_FAILED_EVT
Issued when the attempted update fails to complete.
Definition nc_trans.h:141
isc::d2::NameChangeTransaction::getAddressRRType
const dns::RRType & getAddressRRType() const
Returns the DHCP data type for the lease address.
Definition nc_trans.cc:573
isc::d2::NameChangeTransaction::getNcr
const dhcp_ddns::NameChangeRequestPtr & getNcr() const
Fetches the NameChangeRequest for this transaction.
Definition nc_trans.cc:425
isc::d2::NameChangeTransaction::initServerSelection
void initServerSelection(const DdnsDomainPtr &domain)
Initializes server selection from the given DDNS domain.
Definition nc_trans.cc:455
isc::d2::NameChangeTransaction::IO_COMPLETED_EVT
static const int IO_COMPLETED_EVT
Issued when a DNS update packet exchange has completed.
Definition nc_trans.h:130
isc::d2::NameChangeTransaction::SELECT_SERVER_EVT
static const int SELECT_SERVER_EVT
Issued when a server needs to be selected.
Definition nc_trans.h:113
isc::d2::NameChangeTransaction::SERVER_IO_ERROR_EVT
static const int SERVER_IO_ERROR_EVT
Issued when an update fails due to an IO error.
Definition nc_trans.h:119
isc::d2::NameChangeTransaction::getRequestId
std::string getRequestId() const
Fetches the request id that identifies this transaction.
Definition nc_trans.cc:435
isc::d2::NameChangeTransaction::defineStates
virtual void defineStates()
Adds states defined by NameChangeTransaction to the state set.
Definition nc_trans.cc:257
isc::d2::NameChangeTransaction::sendUpdate
virtual void sendUpdate(const std::string &comment="")
Send the update request to the current server.
Definition nc_trans.cc:192
isc::d2::NameChangeTransaction::setForwardChangeCompleted
void setForwardChangeCompleted(const bool value)
Sets the forward change completion flag to the given value.
Definition nc_trans.cc:328
isc::d2::NameChangeTransaction::selectNextServer
bool selectNextServer()
Selects the next server in the current server list.
Definition nc_trans.cc:467
isc::d2::NameChangeTransaction::setNcrStatus
void setNcrStatus(const dhcp_ddns::NameChangeStatus &status)
Sets the status of the transaction's NameChangeRequest.
Definition nc_trans.cc:538
isc::d2::NameChangeTransaction::getForwardDomain
DdnsDomainPtr & getForwardDomain()
Fetches the forward DdnsDomain.
Definition nc_trans.cc:445
isc::d2::NameChangeTransaction::verifyEvents
virtual void verifyEvents()
Validates the contents of the set of events.
Definition nc_trans.cc:242
isc::d2::NameChangeTransaction::clearDnsUpdateRequest
void clearDnsUpdateRequest()
Destroys the current update request packet.
Definition nc_trans.cc:303
isc::d2::NameChangeTransaction::clearUpdateAttempts
void clearUpdateAttempts()
Resets the update attempts count.
Definition nc_trans.cc:308
isc::d2::NameChangeTransaction::SELECTING_REV_SERVER_ST
static const int SELECTING_REV_SERVER_ST
State in which reverse DNS server selection is done.
Definition nc_trans.h:99
isc::d2::NameChangeTransaction::getDnsUpdateStatus
DNSClient::Status getDnsUpdateStatus() const
Fetches the most recent DNS update status.
Definition nc_trans.cc:548
isc::d2::NameChangeTransaction::setDnsUpdateRequest
void setDnsUpdateRequest(D2UpdateMessagePtr &request)
Sets the update request packet to the given packet.
Definition nc_trans.cc:298
isc::d2::NameChangeTransaction::NO_MORE_SERVERS_EVT
static const int NO_MORE_SERVERS_EVT
Issued when there are no more servers from which to select.
Definition nc_trans.h:125
isc::d2::NameChangeTransaction::defineEvents
virtual void defineEvents()
Adds events defined by NameChangeTransaction to the event set.
Definition nc_trans.cc:227
isc::d2::NameChangeTransaction::setReverseChangeCompleted
void setReverseChangeCompleted(const bool value)
Sets the reverse change completion flag to the given value.
Definition nc_trans.cc:333
isc::d2::NameChangeTransaction::getCurrentServer
const DnsServerInfoPtr & getCurrentServer() const
Fetches the currently selected server.
Definition nc_trans.cc:533
isc::d2::NameChangeTransaction::SERVER_SELECTED_EVT
static const int SERVER_SELECTED_EVT
Issued when a server has been selected.
Definition nc_trans.h:116
isc::d2::NameChangeTransaction::getReverseDomain
DdnsDomainPtr & getReverseDomain()
Fetches the reverse DdnsDomain.
Definition nc_trans.cc:450
isc::d2::NameChangeTransaction::transactionOutcomeString
std::string transactionOutcomeString() const
Returns a string version of transaction outcome.
Definition nc_trans.cc:170
isc::d2::SimpleRemoveWithoutDHCIDTransactionError
Thrown if the SimpleRemoveWithoutDHCIDTransaction encounters a general error.
Definition simple_remove_without_dhcid.h:18
isc::d2::SimpleRemoveWithoutDHCIDTransaction::processRemoveOkHandler
void processRemoveOkHandler()
State handler for PROCESS_TRANS_OK_ST.
Definition simple_remove_without_dhcid.cc:448
isc::d2::SimpleRemoveWithoutDHCIDTransaction::REMOVING_FWD_RRS_ST
static const int REMOVING_FWD_RRS_ST
State that attempts to remove FQDN/IP RR for an FQDN.
Definition simple_remove_without_dhcid.h:54
isc::d2::SimpleRemoveWithoutDHCIDTransaction::readyHandler
void readyHandler()
State handler for READY_ST.
Definition simple_remove_without_dhcid.cc:122
isc::d2::SimpleRemoveWithoutDHCIDTransaction::removingFwdRRsHandler
void removingFwdRRsHandler()
State handler for REMOVING_FWD_RRS_ST.
Definition simple_remove_without_dhcid.cc:171
isc::d2::SimpleRemoveWithoutDHCIDTransaction::verifyEvents
virtual void verifyEvents()
Validates the contents of the set of events.
Definition simple_remove_without_dhcid.cc:54
isc::d2::SimpleRemoveWithoutDHCIDTransaction::REMOVING_REV_PTRS_ST
static const int REMOVING_REV_PTRS_ST
State that attempts to remove reverse PTR records.
Definition simple_remove_without_dhcid.h:57
isc::d2::SimpleRemoveWithoutDHCIDTransaction::selectingRevServerHandler
void selectingRevServerHandler()
State handler for SELECTING_REV_SERVER_ST.
Definition simple_remove_without_dhcid.cc:296
isc::d2::SimpleRemoveWithoutDHCIDTransaction::defineEvents
virtual void defineEvents()
Adds events defined by SimpleRemoveWithoutDHCIDTransaction to the event set.
Definition simple_remove_without_dhcid.cc:44
isc::d2::SimpleRemoveWithoutDHCIDTransaction::processRemoveFailedHandler
void processRemoveFailedHandler()
State handler for PROCESS_TRANS_FAILED_ST.
Definition simple_remove_without_dhcid.cc:465
isc::d2::SimpleRemoveWithoutDHCIDTransaction::buildRemoveRevPtrsRequest
void buildRemoveRevPtrsRequest()
Builds a DNS request to remove a reverse DNS entry for a FQDN.
Definition simple_remove_without_dhcid.cc:507
isc::d2::SimpleRemoveWithoutDHCIDTransaction::buildRemoveFwdRRsRequest
void buildRemoveFwdRRsRequest()
Builds a DNS request to remove forward DNS RR for a FQDN.
Definition simple_remove_without_dhcid.cc:484
isc::d2::SimpleRemoveWithoutDHCIDTransaction::selectingFwdServerHandler
void selectingFwdServerHandler()
State handler for SELECTING_FWD_SERVER_ST.
Definition simple_remove_without_dhcid.cc:142
isc::d2::SimpleRemoveWithoutDHCIDTransaction::verifyStates
virtual void verifyStates()
Validates the contents of the set of states.
Definition simple_remove_without_dhcid.cc:106
isc::d2::SimpleRemoveWithoutDHCIDTransaction::defineStates
virtual void defineStates()
Adds states defined by SimpleRemoveWithoutDHCIDTransaction to the state set.
Definition simple_remove_without_dhcid.cc:72
isc::d2::SimpleRemoveWithoutDHCIDTransaction::removingRevPtrsHandler
void removingRevPtrsHandler()
State handler for REMOVING_REV_PTRS_ST.
Definition simple_remove_without_dhcid.cc:326
isc::d2::SimpleRemoveWithoutDHCIDTransaction::~SimpleRemoveWithoutDHCIDTransaction
virtual ~SimpleRemoveWithoutDHCIDTransaction()
Destructor.
Definition simple_remove_without_dhcid.cc:40
isc::d2::SimpleRemoveWithoutDHCIDTransaction::SimpleRemoveWithoutDHCIDTransaction
SimpleRemoveWithoutDHCIDTransaction(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 simple_remove_without_dhcid.cc:27
isc::dns::Name
The Name class encapsulates DNS names.
Definition name.h:219
isc::dns::RRClass::ANY
static const RRClass & ANY()
Definition rrclass.h:298
isc::dns::RRTTL
The RRTTL class encapsulates TTLs used in DNS resource records.
Definition rrttl.h:51
isc::dns::RRType::PTR
static const RRType & PTR()
Definition rrtype.h:303
isc::dns::RRset
The RRset class is a concrete derived class of BasicRRset which contains a pointer to an additional R...
Definition rrset.h:844
isc::dns::Rcode
DNS Response Codes (RCODEs) class.
Definition rcode.h:40
isc::dns::Rcode::NOERROR
static const Rcode & NOERROR()
A constant object for the NOERROR Rcode (see Rcode::NOERROR_CODE).
Definition rcode.h:228
isc::dns::Rcode::NXRRSET
static const Rcode & NXRRSET()
A constant object for the NXRRSET Rcode (see Rcode::NXRRSET_CODE).
Definition rcode.h:276
isc::dns::Rcode::getCode
uint16_t getCode() const
Returns the Rcode code value.
Definition rcode.h:106
isc::util::StateModel::endModel
void endModel()
Conducts a normal transition to the end of the model.
Definition state_model.cc:271
isc::util::StateModel::getStateInternal
const StatePtr getStateInternal(int value)
Fetches the state referred to by value.
Definition state_model.cc:219
isc::util::StateModel::doOnEntry
bool doOnEntry()
Checks if on entry flag is true.
Definition state_model.cc:339
isc::util::StateModel::START_EVT
static const int START_EVT
Event issued to start the model execution.
Definition state_model.h:295
isc::util::StateModel::defineState
void defineState(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
isc::util::StateModel::transition
void transition(int state, int event)
Sets up the model to transition into given state with a given event.
Definition state_model.cc:264
isc::util::StateModel::getNextEvent
int getNextEvent() const
Fetches the model's next event.
Definition state_model.cc:373
isc::util::StateModel::getContextStr
std::string getContextStr() const
Convenience method which returns a string rendition of the current state and next event.
Definition state_model.cc:443
d2_cfg_mgr.h
d2_log.h
isc_throw
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
Definition exceptions/exceptions.h:210
LOG_ERROR
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
Definition macros.h:32
LOG_INFO
#define LOG_INFO(LOGGER, MESSAGE)
Macro to conveniently test info output and log it.
Definition macros.h:20
isc::asiolink::IOServicePtr
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
Definition io_service.h:35
isc::d2
Definition check_exists_add.cc:19
isc::d2::D2UpdateMessagePtr
boost::shared_ptr< D2UpdateMessage > D2UpdateMessagePtr
Pointer to the DNS Update Message.
Definition d2_update_message.h:73
isc::d2::DdnsDomainPtr
boost::shared_ptr< DdnsDomain > DdnsDomainPtr
Defines a pointer for DdnsDomain instances.
Definition d2_config.h:624
isc::d2::DHCP_DDNS_FORWARD_REMOVE_RRS_TIMEOUT
const isc::log::MessageID DHCP_DDNS_FORWARD_REMOVE_RRS_TIMEOUT
Definition d2_messages.h:38
isc::d2::DHCP_DDNS_REVERSE_REMOVE_RESP_CORRUPT
const isc::log::MessageID DHCP_DDNS_REVERSE_REMOVE_RESP_CORRUPT
Definition d2_messages.h:74
isc::d2::D2CfgMgrPtr
boost::shared_ptr< D2CfgMgr > D2CfgMgrPtr
Defines a shared pointer to D2CfgMgr.
Definition d2_cfg_mgr.h:367
isc::d2::DHCP_DDNS_FORWARD_REMOVE_RRS_RESP_CORRUPT
const isc::log::MessageID DHCP_DDNS_FORWARD_REMOVE_RRS_RESP_CORRUPT
Definition d2_messages.h:37
isc::d2::DHCP_DDNS_FORWARD_REMOVE_RRS_REJECTED
const isc::log::MessageID DHCP_DDNS_FORWARD_REMOVE_RRS_REJECTED
Definition d2_messages.h:36
isc::d2::DHCP_DDNS_REMOVE_SUCCEEDED
const isc::log::MessageID DHCP_DDNS_REMOVE_SUCCEEDED
Definition d2_messages.h:68
isc::d2::d2_to_dns_logger
isc::log::Logger d2_to_dns_logger("d2-to-dns")
Definition d2_log.h:20
isc::d2::DHCP_DDNS_FORWARD_REMOVE_RRS_BUILD_FAILURE
const isc::log::MessageID DHCP_DDNS_FORWARD_REMOVE_RRS_BUILD_FAILURE
Definition d2_messages.h:34
isc::d2::DHCP_DDNS_REVERSE_REMOVE_TIMEOUT
const isc::log::MessageID DHCP_DDNS_REVERSE_REMOVE_TIMEOUT
Definition d2_messages.h:75
isc::d2::DHCP_DDNS_FORWARD_REMOVE_RRS_BAD_DNSCLIENT_STATUS
const isc::log::MessageID DHCP_DDNS_FORWARD_REMOVE_RRS_BAD_DNSCLIENT_STATUS
Definition d2_messages.h:33
isc::d2::DHCP_DDNS_REVERSE_REMOVE_IO_ERROR
const isc::log::MessageID DHCP_DDNS_REVERSE_REMOVE_IO_ERROR
Definition d2_messages.h:72
isc::d2::DHCP_DDNS_REVERSE_REMOVE_BAD_DNSCLIENT_STATUS
const isc::log::MessageID DHCP_DDNS_REVERSE_REMOVE_BAD_DNSCLIENT_STATUS
Definition d2_messages.h:70
isc::d2::DHCP_DDNS_REVERSE_REMOVE_BUILD_FAILURE
const isc::log::MessageID DHCP_DDNS_REVERSE_REMOVE_BUILD_FAILURE
Definition d2_messages.h:71
isc::d2::DHCP_DDNS_REMOVE_FAILED
const isc::log::MessageID DHCP_DDNS_REMOVE_FAILED
Definition d2_messages.h:67
isc::d2::DHCP_DDNS_FORWARD_REMOVE_RRS_IO_ERROR
const isc::log::MessageID DHCP_DDNS_FORWARD_REMOVE_RRS_IO_ERROR
Definition d2_messages.h:35
isc::d2::DHCP_DDNS_REVERSE_REMOVE_REJECTED
const isc::log::MessageID DHCP_DDNS_REVERSE_REMOVE_REJECTED
Definition d2_messages.h:73
isc::dhcp_ddns::ST_COMPLETED
@ ST_COMPLETED
Definition ncr_msg.h:54
isc::dhcp_ddns::ST_FAILED
@ ST_FAILED
Definition ncr_msg.h:55
isc::dhcp_ddns::NameChangeRequestPtr
boost::shared_ptr< NameChangeRequest > NameChangeRequestPtr
Defines a pointer to a NameChangeRequest.
Definition ncr_msg.h:241
isc::dhcp_ddns::CHG_REMOVE
@ CHG_REMOVE
Definition ncr_msg.h:47
isc::dns::RRsetPtr
boost::shared_ptr< AbstractRRset > RRsetPtr
A pointer-like type pointing to an RRset object.
Definition rrset.h:50
isc
Defines the logger used by the top-level component of kea-lfc.
Definition check_exists_add.cc:18
simple_remove_without_dhcid.h
This file defines the class SimpleRemoveWithoutDHCIDTransaction.