Commit 5414d2bd authored by Thomas Markwalder's avatar Thomas Markwalder

[3241] Add ability to build DNS update requests to d2::NameAddTransaction

Added methods for constructing all three types of DNS update requests
required by d2::NameAddTransaction to complete the implementation of its
state machine.  Also refactored some unit test code into nc_test_utils.h
and .cc, and ran much needed spell checking.
parent 9aad3742
......@@ -324,3 +324,30 @@ This is error message issued when the application is able to construct an update
message but the attempt to send it suffered a unexpected error. This is most
likely a programmatic error, rather than a communications issue. Some or all
of the DNS updates requested as part of this request did not succeed.
% DHCP_DDNS_FORWARD_ADD_BUILD_FAILURE A DNS udpate message to add a forward DNS entry could not be constructed for this request: %1 reason: %2
This is an error message issued when an error occurs attempting to construct
the server bound packet requesting a forward address addition. This is due
to invalid data contained in the NameChangeRequest. The request will be aborted.
This is most likely a configuration issue.
% DHCP_DDNS_FORWARD_REPLACE_BUILD_FAILURE A DNS update message to replace a foward DNS entry could not be constructed from this request: %1 reason: %2
This is an error message issued when an error occurs attempting to construct
the server bound packet requesting a forward address replacement. This is
due to invalid data contained in the NameChangeRequest. The request will be
aborted. This is most likely a configuration issue.
% DHCP_DDNS_REVERSE_REPLACE_BUILD_FAILURE A DNS update message to replace a reverse DNS entry could not be constructed from this request: %1 reason: %2
This is an error message issued when an error occurs attempting to construct
the server bound packet requesting a reverse PTR replacement. This is
due to invalid data contained in the NameChangeRequest. The request will be
aborted. This is most likely a configuration issue.
% DHCP_DDNS_ADD_SUCCEEDED DHCP_DDNS successfully added the DNS mapping addition for this request: %1
This is a debug message issued after DHCP_DDNS has submitted DNS mapping
additions which were received and accepted by an appropriate DNS server.
% DHCP_DDNS_ADD_FAILED DHCP_DDNS failed attempting to make DNS mapping additions for this request: %1
This is an error message issued after DHCP_DDNS attempts to submit DNS mapping
entry additions have failed. There precise reason for the failure should be
documented in preceding log entries.
......@@ -31,7 +31,7 @@ D2UpdateMessage::D2UpdateMessage(const Direction direction)
if (direction == OUTBOUND) {
message_.setOpcode(Opcode(Opcode::UPDATE_CODE));
message_.setHeaderFlag(dns::Message::HEADERFLAG_QR, false);
message_.setRcode(Rcode(Rcode::NOERROR_CODE));
}
}
......
......@@ -13,11 +13,15 @@
// PERFORMANCE OF THIS SOFTWARE.
#include <d2/d2_log.h>
#include <d2/d2_cfg_mgr.h>
#include <d2/nc_add.h>
#include <boost/function.hpp>
#include <boost/bind.hpp>
#include <util/buffer.h>
#include <dns/rdataclass.h>
namespace isc {
namespace d2 {
......@@ -168,7 +172,17 @@ NameAddTransaction::addingFwdAddrsHandler() {
case SERVER_SELECTED_EVT:
if (!getDnsUpdateRequest()) {
// Request hasn't been constructed yet, so build it.
buildAddFwdAddressRequest();
try {
buildAddFwdAddressRequest();
} catch (const std::exception& ex) {
// While unlikely, the build might fail if we have invalid
// data. Should that be the case, we need to fail the
// transaction.
LOG_ERROR(dctl_logger, DHCP_DDNS_FORWARD_ADD_BUILD_FAILURE)
.arg(getNcr()->toText())
.arg(ex.what());
transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
}
}
// Call sendUpdate() to initiate the async send. Note it also sets
......@@ -268,7 +282,17 @@ NameAddTransaction::replacingFwdAddrsHandler() {
case SERVER_SELECTED_EVT:
if (!getDnsUpdateRequest()) {
// Request hasn't been constructed yet, so build it.
buildReplaceFwdAddressRequest();
try {
buildReplaceFwdAddressRequest();
} catch (const std::exception& ex) {
// While unlikely, the build might fail if we have invalid
// data. Should that be the case, we need to fail the
// transaction.
LOG_ERROR(dctl_logger, DHCP_DDNS_FORWARD_REPLACE_BUILD_FAILURE)
.arg(getNcr()->toText())
.arg(ex.what());
transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
}
}
// Call sendUpdate() to initiate the async send. Note it also sets
......@@ -403,7 +427,17 @@ NameAddTransaction::replacingRevPtrsHandler() {
case SERVER_SELECTED_EVT:
if (!getDnsUpdateRequest()) {
// Request hasn't been constructed yet, so build it.
buildReplaceRevPtrsRequest();
try {
buildReplaceRevPtrsRequest();
} catch (const std::exception& ex) {
// While unlikely, the build might fail if we have invalid
// data. Should that be the case, we need to fail the
// transaction.
LOG_ERROR(dctl_logger, DHCP_DDNS_REVERSE_REPLACE_BUILD_FAILURE)
.arg(getNcr()->toText())
.arg(ex.what());
transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
}
}
// Call sendUpdate() to initiate the async send. Note it also sets
......@@ -488,7 +522,8 @@ void
NameAddTransaction::processAddOkHandler() {
switch(getNextEvent()) {
case UPDATE_OK_EVT:
// @todo do we need a log statement here?
LOG_DEBUG(dctl_logger, DBGLVL_TRACE_DETAIL, DHCP_DDNS_ADD_SUCCEEDED)
.arg(getNcr()->toText());
setNcrStatus(dhcp_ddns::ST_COMPLETED);
endModel();
break;
......@@ -503,7 +538,7 @@ void
NameAddTransaction::processAddFailedHandler() {
switch(getNextEvent()) {
case UPDATE_FAILED_EVT:
// @todo do we need a log statement here?
LOG_ERROR(dctl_logger, DHCP_DDNS_ADD_FAILED).arg(getNcr()->toText());
setNcrStatus(dhcp_ddns::ST_FAILED);
endModel();
break;
......@@ -516,23 +551,125 @@ NameAddTransaction::processAddFailedHandler() {
void
NameAddTransaction::buildAddFwdAddressRequest() {
// @todo For now construct a blank outbound message.
D2UpdateMessagePtr msg(new D2UpdateMessage(D2UpdateMessage::OUTBOUND));
setDnsUpdateRequest(msg);
// Construct an empty request.
D2UpdateMessagePtr request = prepNewRequest(getForwardDomain());
// Construct dns::Name from NCR fqdn.
dns::Name fqdn(dns::Name(getNcr()->getFqdn()));
// First build the Prerequisite Section.
// Create 'FQDN Is Not In Use' prerequisite (RFC 2136, section 2.4.5)
// Add the RR to prerequisite section.
dns::RRsetPtr prereq(new dns::RRset(fqdn, dns::RRClass::NONE(),
dns::RRType::ANY(), dns::RRTTL(0)));
request->addRRset(D2UpdateMessage::SECTION_PREREQUISITE, prereq);
// Next build the Update Section.
// Create the FQDN/IP 'add' RR (RFC 2136, section 2.5.1)
// Set the message RData to lease address.
// Add the RR to update section.
dns::RRsetPtr update(new dns::RRset(fqdn, dns::RRClass::IN(),
getAddressRRType(), dns::RRTTL(0)));
addLeaseAddressRdata(update);
request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
// Now create the FQDN/DHCID 'add' RR per RFC 4701)
// Set the message RData to DHCID.
// Add the RR to update section.
update.reset(new dns::RRset(fqdn, dns::RRClass::IN(),
dns::RRType::DHCID(), dns::RRTTL(0)));
addDhcidRdata(update);
request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
// Set the transaction's update request to the new request.
setDnsUpdateRequest(request);
}
void
NameAddTransaction::buildReplaceFwdAddressRequest() {
// @todo For now construct a blank outbound message.
D2UpdateMessagePtr msg(new D2UpdateMessage(D2UpdateMessage::OUTBOUND));
setDnsUpdateRequest(msg);
// Construct an empty request.
D2UpdateMessagePtr request = prepNewRequest(getForwardDomain());
// Construct dns::Name from NCR fqdn.
dns::Name fqdn(dns::Name(getNcr()->getFqdn()));
// First build the Prerequisite Section.
// Create an 'FQDN Is In Use' prerequisite (RFC 2136, section 2.4.4)
// Add it to the pre-requisite section.
dns::RRsetPtr prereq(new dns::RRset(fqdn, dns::RRClass::ANY(),
dns::RRType::ANY(), dns::RRTTL(0)));
request->addRRset(D2UpdateMessage::SECTION_PREREQUISITE, prereq);
// Now create an DHCID matches prerequisite RR.
// Set the RR's RData to DHCID.
// Add it to the pre-requisite section.
prereq.reset(new dns::RRset(fqdn, dns::RRClass::IN(),
dns::RRType::DHCID(), dns::RRTTL(0)));
addDhcidRdata(prereq);
request->addRRset(D2UpdateMessage::SECTION_PREREQUISITE, prereq);
// Next build the Update Section.
// Create the FQDN/IP 'delete' RR (RFC 2136, section 2.5.1)
// Set the message RData to lease address.
// Add the RR to update section.
dns::RRsetPtr update(new dns::RRset(fqdn, dns::RRClass::ANY(),
getAddressRRType(), dns::RRTTL(0)));
request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
// Create the FQDN/IP 'add' RR (RFC 2136, section 2.5.1)
// Set the message RData to lease address.
// Add the RR to update section.
update.reset(new dns::RRset(fqdn, dns::RRClass::IN(),
getAddressRRType(), dns::RRTTL(0)));
addLeaseAddressRdata(update);
request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
// Set the transaction's update request to the new request.
setDnsUpdateRequest(request);
}
void
NameAddTransaction::buildReplaceRevPtrsRequest() {
// @todo For now construct a blank outbound message.
D2UpdateMessagePtr msg(new D2UpdateMessage(D2UpdateMessage::OUTBOUND));
setDnsUpdateRequest(msg);
// Construct an empty request.
D2UpdateMessagePtr request = prepNewRequest(getReverseDomain());
// Create the reverse IP address "FQDN".
std::string rev_addr = D2CfgMgr::reverseIpAddress(getNcr()->getIpAddress());
dns::Name rev_ip(rev_addr);
// Reverse replacement has no prerequisites so straight on to
// building the Update section.
// Create the PTR 'delete' RR and add it to update section.
dns::RRsetPtr update(new dns::RRset(rev_ip, dns::RRClass::ANY(),
dns::RRType::PTR(), dns::RRTTL(0)));
request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
// Create the DHCID 'delete' RR and add it to the update section.
update.reset(new dns::RRset(rev_ip, dns::RRClass::ANY(),
dns::RRType::DHCID(), dns::RRTTL(0)));
request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
// Create the FQDN/IP PTR 'add' RR, add the FQDN as the PTR Rdata
// then add it to update section.
update.reset(new dns::RRset(rev_ip, dns::RRClass::IN(),
dns::RRType::PTR(), dns::RRTTL(0)));
addPtrRdata(update);
request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
// Create the FQDN/IP PTR 'add' RR, add the DHCID Rdata
// then add it to update section.
update.reset(new dns::RRset(rev_ip, dns::RRClass::IN(),
dns::RRType::DHCID(), dns::RRTTL(0)));
addDhcidRdata(update);
request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
// Set the transaction's update request to the new request.
setDnsUpdateRequest(request);
}
} // namespace isc::d2
......
......@@ -18,6 +18,7 @@
/// @file nc_add.h This file defines the class NameAddTransaction.
#include <d2/nc_trans.h>
#include <dns/rdata.h>
namespace isc {
namespace d2 {
......@@ -220,7 +221,7 @@ protected:
/// post a next event of IO_COMPLETED_EVT and then invoke runModel which
/// resumes execution of the state model.
///
/// When the handler is invoked with a next event of IO_COMPELTED_EVT,
/// When the handler is invoked with a next event of IO_COMPLETED_EVT,
/// the DNS update status is checked and acted upon accordingly:
///
/// Transitions to:
......@@ -270,7 +271,7 @@ protected:
/// post a next event of IO_COMPLETED_EVT and then invoke runModel which
/// resumes execution of the state model.
///
/// When the handler is invoked with a next event of IO_COMPELTED_EVT,
/// When the handler is invoked with a next event of IO_COMPLETED_EVT,
/// the DNS update status is checked and acted upon accordingly:
///
/// Transitions to:
......@@ -321,7 +322,7 @@ protected:
/// post a next event of IO_COMPLETED_EVT and then invoke runModel which
/// resumes execution of the state model.
///
/// When the handler is invoked with a next event of IO_COMPELTED_EVT,
/// When the handler is invoked with a next event of IO_COMPLETED_EVT,
/// the DNS update status is checked and acted upon accordingly:
///
/// Transitions to:
......@@ -380,25 +381,61 @@ protected:
/// @brief Builds a DNS request to add an forward DNS entry for an FQDN
///
/// @todo - Method not implemented yet
/// Constructs a DNS update request, based upon the NCR, for adding a
/// forward DNS mapping. Once constructed, the request is stored as
/// the transaction's DNS update request.
///
/// @throw isc::NotImplemented
/// The request content is adherent to RFC 4703 section 5.3.1:
///
/// Prerequisite RRsets:
/// 1. An assertion that the FQDN does not exist
///
/// Updates RRsets:
/// 1. An FQDN/IP RR addition (type A for IPv4, AAAA for IPv6)
/// 2. An FQDN/DHCID RR addition (type DHCID)
///
/// @throw This method does not throw but underlying methods may.
void buildAddFwdAddressRequest();
/// @brief Builds a DNS request to replace forward DNS entry for an FQDN
///
/// @todo - Method not implemented yet
/// Constructs a DNS update request, based upon the NCR, for replacing a
/// forward DNS mapping. Once constructed, the request is stored as
/// the transaction's DNS update request.
///
/// The request content is adherent to RFC 4703 section 5.3.2:
///
/// Prerequisite RRsets:
/// 1. An assertion that the FQDN is in use
/// 2. An assertion that the FQDN/DHCID RR exists for the lease client's
/// DHCID.
///
/// @throw isc::NotImplemented
/// Updates RRsets:
/// 1. A deletion of any existing FQDN RRs (type A for IPv4, AAAA for IPv6)
/// 2. A FQDN/IP RR addition (type A for IPv4, AAAA for IPv6)
///
/// @throw This method does not throw but underlying methods may.
void buildReplaceFwdAddressRequest();
/// @brief Builds a DNS request to replace a reverse DNS entry for an FQDN
///
/// @todo - Method not implemented yet
/// Constructs a DNS update request, based upon the NCR, for replacing a
/// reverse DNS mapping. Once constructed, the request is stored as
/// the transaction's DNS update request.
///
/// The request content is adherent to RFC 4703 section 5.4:
///
/// Prerequisite RRsets:
/// - There are not prerequisites.
///
/// @throw isc::NotImplemented
/// Updates RRsets:
/// 1. A delete of any existing PTR RRs for the lease address
/// 2. A delete of any existing DHCID RRs for the lease address
/// 3. A PTR RR addition for the lease address and FQDN
/// 4. A DHCID RR addition for the lease address and lease client DHCID
///
/// @throw This method does not throw but underlying methods may.
void buildReplaceRevPtrsRequest();
};
/// @brief Defines a pointer to a NameChangeTransaction.
......
......@@ -113,7 +113,7 @@ NameChangeTransaction::sendUpdate(bool /* use_tsig_ */) {
// It is presumed that any throw from doUpdate is due to a programmatic
// error, such as an unforeseen permutation of data, rather than an IO
// failure. IO errors should be caught by the underlying asiolink
// mechansisms and manifested as an unsuccessful IO statu in the
// mechanisms and manifested as an unsuccessful IO status in the
// DNSClient callback. Any problem here most likely means the request
// is corrupt in some way and cannot be completed, therefore we will
// log it and transition it to failure.
......@@ -232,6 +232,83 @@ NameChangeTransaction::setUpdateAttempts(const size_t value) {
update_attempts_ = value;
}
D2UpdateMessagePtr
NameChangeTransaction::prepNewRequest(DdnsDomainPtr domain) {
if (!domain) {
isc_throw(NameChangeTransactionError,
"prepNewRequest - domain cannot be null");
}
try {
// Create a "blank" update request.
D2UpdateMessagePtr request(new D2UpdateMessage(D2UpdateMessage::
OUTBOUND));
// Construct the Zone Section.
dns::Name zone_name(domain->getName());
request->setZone(zone_name, dns::RRClass::IN());
return (request);
} catch (const std::exception& ex) {
isc_throw(NameChangeTransactionError, "Cannot create new request :"
<< ex.what());
}
}
void
NameChangeTransaction::addLeaseAddressRdata(dns::RRsetPtr& rrset) {
if (!rrset) {
isc_throw(NameChangeTransactionError,
"addLeaseAddressRdata - RRset cannot cannot be null");
}
try {
// Manufacture an RData from the lease address then add it to the RR.
if (ncr_->isV4()) {
dns::rdata::in::A a_rdata(ncr_->getIpAddress());
rrset->addRdata(a_rdata);
} else {
dns::rdata::in::AAAA rdata(ncr_->getIpAddress());
rrset->addRdata(rdata);
}
} catch (const std::exception& ex) {
isc_throw(NameChangeTransactionError, "Cannot add address rdata: "
<< ex.what());
}
}
void
NameChangeTransaction::addDhcidRdata(dns::RRsetPtr& rrset) {
if (!rrset) {
isc_throw(NameChangeTransactionError,
"addDhcidRdata - RRset cannot cannot be null");
}
try {
const std::vector<uint8_t>& ncr_dhcid = ncr_->getDhcid().getBytes();
util::InputBuffer buffer(ncr_dhcid.data(), ncr_dhcid.size());
dns::rdata::in::DHCID rdata(buffer, ncr_dhcid.size());
rrset->addRdata(rdata);
} catch (const std::exception& ex) {
isc_throw(NameChangeTransactionError, "Cannot add DCHID rdata: "
<< ex.what());
}
}
void
NameChangeTransaction::addPtrRdata(dns::RRsetPtr& rrset) {
if (!rrset) {
isc_throw(NameChangeTransactionError,
"addPtrRdata - RRset cannot cannot be null");
}
try {
dns::rdata::generic::PTR rdata(getNcr()->getFqdn());
rrset->addRdata(rdata);
} catch (const std::exception& ex) {
isc_throw(NameChangeTransactionError, "Cannot add PTR rdata: "
<< ex.what());
}
}
const dhcp_ddns::NameChangeRequestPtr&
NameChangeTransaction::getNcr() const {
return (ncr_);
......@@ -333,5 +410,10 @@ NameChangeTransaction::getUpdateAttempts() const {
return (update_attempts_);
}
const dns::RRType&
NameChangeTransaction::getAddressRRType() const {
return (ncr_->isV4() ? dns::RRType::A(): dns::RRType::AAAA());
}
} // namespace isc::d2
} // namespace isc
......@@ -69,7 +69,7 @@ typedef isc::dhcp_ddns::D2Dhcid TransactionKey;
/// single update to the server and returns the response, asynchronously,
/// through a callback. At each point in a transaction's state model, where
/// an update is to be sent, the model "suspends" until notified by the
/// DNSClient via the callbacka. Suspension is done by posting a
/// DNSClient via the callback. Suspension is done by posting a
/// StateModel::NOP_EVT as the next event, stopping the state model execution.
///
/// Resuming state model execution when a DNS update completes is done by a
......@@ -204,7 +204,7 @@ protected:
/// currently selected server. Since the send is asynchronous, the method
/// posts NOP_EVT as the next event and then returns.
///
/// @param use_tsig True if the udpate should be include a TSIG key. This
/// @param use_tsig True if the update should be include a TSIG key. This
/// is not yet implemented.
///
/// If an exception occurs it will be logged and and the transaction will
......@@ -215,7 +215,7 @@ protected:
///
/// This method adds the events common to NCR transaction processing to
/// the set of define events. It invokes the superclass's implementation
/// first to maitain the hierarchical chain of event defintion.
/// first to maintain the hierarchical chain of event definition.
/// Derivations of NameChangeTransaction must invoke its implementation
/// in like fashion.
///
......@@ -237,7 +237,7 @@ protected:
///
/// This method adds the states common to NCR transaction processing to
/// the dictionary of states. It invokes the superclass's implementation
/// first to maitain the hierarchical chain of state defintion.
/// first to maintain the hierarchical chain of state definition.
/// Derivations of NameChangeTransaction must invoke its implementation
/// in like fashion.
///
......@@ -261,7 +261,7 @@ protected:
/// execution encounters a model violation: attempt to call an unmapped
/// state, an event not valid for the current state, or an uncaught
/// exception thrown during a state handler invocation. When such an
/// error occurs the transaction is deemed inoperable, and futher model
/// error occurs the transaction is deemed inoperable, and further model
/// execution cannot be performed. It marks the transaction as failed by
/// setting the NCR status to dhcp_ddns::ST_FAILED
///
......@@ -271,7 +271,7 @@ protected:
/// @brief Determines the state and next event based on update attempts.
///
/// This method will post a next event of SERVER_SELECTED_EVT to the
/// current state if the number of udpate attempts has not reached the
/// current state if the number of update attempts has not reached the
/// maximum allowed.
///
/// If the maximum number of attempts has been reached, it will transition
......@@ -334,7 +334,7 @@ protected:
///
/// This method is used to iterate over the list of servers. If there are
/// no more servers in the list, it returns false. Otherwise it sets the
/// the current server to the next server and creates a new DNSClient
/// current server to the next server and creates a new DNSClient
/// instance.
///
/// @return True if a server has been selected, false if there are no more
......@@ -364,6 +364,48 @@ protected:
return (io_service_);
}
/// @brief Creates a new DNS update request based on the given domain.
///
/// Constructs a new "empty", OUTBOUND, request with the message id set
/// and zone section populated based on the given domain.
///
/// @return A D2UpdateMessagePtr to the new request.
///
/// @throw NameChangeTransactionError if request cannot be constructed.
D2UpdateMessagePtr prepNewRequest(DdnsDomainPtr domain);
/// @brief Adds an RData for the lease address to the given RRset.
///
/// Creates an in::A() or in:AAAA() RData instance from the NCR
/// lease address and adds it to the given RRset.
///
/// @param RRset RRset to which to add the RData
///
/// @throw NameChangeTransactionError if RData cannot be constructed or
/// the RData cannot be added to the given RRset.
void addLeaseAddressRdata(dns::RRsetPtr& rrset);
/// @brief Adds an RData for the lease client's DHCID to the given RRset.
///
/// Creates an in::DHCID() RData instance from the NCR DHCID and adds
/// it to the given RRset.
///
/// @param RRset RRset to which to add the RData
///
/// @throw NameChangeTransactionError if RData cannot be constructed or
/// the RData cannot be added to the given RRset.
void addDhcidRdata(dns::RRsetPtr& rrset);
/// @brief Adds an RData for the lease FQDN to the given RRset.
///
/// Creates an in::PTR() RData instance from the NCR FQDN and adds
/// it to the given RRset.
///
/// @param RRset RRset to which to add the RData
///
/// @throw NameChangeTransactionError if RData cannot be constructed or
/// the RData cannot be added to the given RRset.
void addPtrRdata(dns::RRsetPtr& rrset);
public:
/// @brief Fetches the NameChangeRequest for this transaction.
......@@ -392,13 +434,13 @@ public:
/// @brief Fetches the forward DdnsDomain.
///
/// @return A pointer reference to the forward DdnsDomain. If the
/// @return A pointer reference to the forward DdnsDomain. If
/// the request does not include a forward change, the pointer will empty.
DdnsDomainPtr& getForwardDomain();
/// @brief Fetches the reverse DdnsDomain.
///
/// @return A pointer reference to the reverse DdnsDomain. If the
/// @return A pointer reference to the reverse DdnsDomain. If
/// the request does not include a reverse change, the pointer will empty.
DdnsDomainPtr& getReverseDomain();
......@@ -444,6 +486,12 @@ public:
/// been attempted against the current server.
size_t getUpdateAttempts() const;
/// @brief Returns the DHCP data type for the lease address
///
/// @return constant reference to dns::RRType::A() if the lease address
/// is IPv4 or dns::RRType::AAAA() if the lease address is IPv6.
const dns::RRType& getAddressRRType() const;
private:
/// @brief The IOService which should be used to for IO processing.
IOServicePtr io_service_;
......
......@@ -83,6 +83,7 @@ d2_unittests_SOURCES += d2_zone_unittests.cc
d2_unittests_SOURCES += dns_client_unittests.cc
d2_unittests_SOURCES += labeled_value_unittests.cc
d2_unittests_SOURCES += nc_add_unittests.cc
d2_unittests_SOURCES += nc_test_utils.cc nc_test_utils.h
d2_unittests_SOURCES += nc_trans_unittests.cc
d2_unittests_SOURCES += state_model_unittests.cc
nodist_d2_unittests_SOURCES = ../d2_messages.h ../d2_messages.cc
......
This diff is collapsed.
// Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE