Parcourir la source

[trac3808] Enhance logging for D2

Split the logging into three loggers
 config & general
 dhcp to d2
 d2 to dns (and back)

Print out a request ID for each NCR event.  Currently this is the
DHCID but it could be changed in the future to allow for comparing
log entries between DHCP servers and D2.

Fix up some typos I ran across while reading the code
Shawn Routhier il y a 10 ans
Parent
commit
2becffcdc2

+ 16 - 2
doc/guide/logging.xml

@@ -231,9 +231,23 @@
           </listitem>
           <listitem>
             <simpara><command>kea-dhcp-ddns.dhcpddns</command> - this is the logger
-            used solely by the kea-dhcp-ddns deamon. This logger does not
-            specify logging settings for libraries used by the deamon.</simpara>
+            used by the kea-dhcp-ddns deamon for logging configuration and global
+            event information.  This logger does not specify logging settings
+            for libraries used by the deamon.</simpara>
+          </listitem>
+          <listitem>
+            <simpara><command>kea-dhcp-ddns.dhcp_to_d2</command> - this is the logger
+            used by the kea-dhcp-ddns deamon for logging information about events
+            dealing with receving messages from the DHCP servers and adding them
+            to the queue for processing.</simpara>
           </listitem>
+          <listitem>
+            <simpara><command>kea-dhcp-ddns.d2_to_dns</command> - this is the logger
+            used by the kea-dhcp-ddns deamon for logging information about events
+            dealing with sending and receiving messages with the DNS servers.
+            </simpara>
+          </listitem>
+
         </itemizedlist>
 
         <para>Additional loggers may be defined in the future. The easiest

+ 2 - 2
src/bin/d2/d2_cfg_mgr.h

@@ -134,7 +134,7 @@ public:
         return (boost::dynamic_pointer_cast<D2CfgContext>(getContext()));
     }
 
-    /// @brief Returns whether not forward updates are enabled.
+    /// @brief Returns whether or not forward updates are enabled.
     ///
     /// This method currently uses the presence or absence of Foward DDNS
     /// Domains to determine if forward updates are enabled or disabled.
@@ -144,7 +144,7 @@ public:
     /// @return true if forward updates are enabled, false otherwise.
     bool forwardUpdatesEnabled();
 
-    /// @brief Returns whether not reverse updates are enabled.
+    /// @brief Returns whether or not reverse updates are enabled.
     ///
     /// This method currently uses the presence or absence of Reverse DDNS
     /// Domains to determine if reverse updates are enabled or disabled.

+ 1 - 1
src/bin/d2/d2_config.cc

@@ -330,7 +330,7 @@ DdnsDomainListMgr::matchDomain(const std::string& fqdn, DdnsDomainPtr& domain) {
             return (true);
         }
 
-        LOG_WARN(dctl_logger, DHCP_DDNS_NO_MATCH).arg(fqdn);
+        LOG_WARN(dhcp_to_d2_logger, DHCP_DDNS_NO_MATCH).arg(fqdn);
         return (false);
     }
 

+ 1 - 1
src/bin/d2/d2_config.h

@@ -70,7 +70,7 @@ namespace d2 {
 /// any scalars which belong to the manager as well as creating and invoking a
 /// DdnsDomainListParser to parse its list of domain entries.
 ///
-/// A DdnsDomainListParser creates and invokes DdnsDomainListParser for each
+/// A DdnsDomainListParser creates and invokes a DdnsDomainParser for each
 /// domain entry in its list.
 ///
 /// A DdnsDomainParser handles the scalars which belong to the domain as well as

+ 3 - 1
src/bin/d2/d2_log.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2013  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013, 2015  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
@@ -21,6 +21,8 @@ namespace d2 {
 
 /// @brief Defines the logger used within D2.
 isc::log::Logger dctl_logger("dhcpddns");
+isc::log::Logger dhcp_to_d2_logger("dchp_to_d2");
+isc::log::Logger d2_to_dns_logger("d2_to_dns");
 
 } // namespace d2
 } // namespace isc

+ 4 - 3
src/bin/d2/d2_log.h

@@ -1,4 +1,4 @@
-// Copyright (C) 2013  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013, 2015  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
@@ -22,9 +22,10 @@
 namespace isc {
 namespace d2 {
 
-/// Define the logger for the "d2" logging.
+/// Define the loggers for the "d2" logging.
 extern isc::log::Logger dctl_logger;
-
+extern isc::log::Logger dhcp_to_d2_logger;
+extern isc::log::Logger d2_to_dns_logger;
 
 } // namespace d2
 } // namespace isc

+ 54 - 49
src/bin/d2/d2_messages.mes

@@ -97,12 +97,12 @@ application in standalone mode. This means it will not connected to the Kea
 message queue. Standalone mode is only useful during program development,
 and should not be used in a production environment.
 
-% DHCP_DDNS_ADD_FAILED DHCP_DDNS Transaction outcome: %1
+% DHCP_DDNS_ADD_FAILED DHCP_DDNS Request ID %1: Transaction outcome %2
 This is an error message issued after DHCP_DDNS attempts to submit DNS mapping
 entry additions have failed.  The precise reason for the failure should be
 documented in preceding log entries.
 
-% DHCP_DDNS_ADD_SUCCEEDED DHCP_DDNS successfully added the DNS mapping addition for this request: %1
+% DHCP_DDNS_ADD_SUCCEEDED DHCP_DDNS Request ID %1: successfully added the DNS mapping addition for this request: %2
 This is an informational message issued after DHCP_DDNS has submitted DNS
 mapping additions which were received and accepted by an appropriate DNS server.
 
@@ -136,110 +136,110 @@ has been invoked.
 This is a debug message issued when the DHCP-DDNS application encounters an
 unrecoverable error from within the event loop.
 
-% DHCP_DDNS_FORWARD_ADD_BAD_DNSCLIENT_STATUS DHCP_DDNS received an unknown DNSClient status: %1, while adding a forward address mapping for FQDN %2 to DNS server %3
+% DHCP_DDNS_FORWARD_ADD_BAD_DNSCLIENT_STATUS DHCP_DDNS Request ID %1: received an unknown DNSClient status: %2, while adding a forward address mapping for FQDN %3 to DNS server %4
 This is an error message issued when DNSClient returns an unrecognized status
 while DHCP_DDNS was adding a forward address mapping.  The request will be
 aborted.  This is most likely a programmatic issue and should be reported.
 
-% DHCP_DDNS_FORWARD_ADD_BUILD_FAILURE DNS udpate message to add a forward DNS entry could not be constructed for this request: %1, reason: %2
+% DHCP_DDNS_FORWARD_ADD_BUILD_FAILURE DNS Request ID %1:  udpate message to add a forward DNS entry could not be constructed for this request: %2, reason: %3
 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_ADD_IO_ERROR DHCP_DDNS encountered an IO error sending a forward mapping add for FQDN %1 to DNS server %2
+% DHCP_DDNS_FORWARD_ADD_IO_ERROR DHCP_DDNS Request ID %1: encountered an IO error sending a forward mapping add for FQDN %2 to DNS server %3
 This is an error message issued when a communication error occurs while
 DHCP_DDNS is carrying out a forward address update.  The application will
 retry against the same server or others as appropriate.
 
-% DHCP_DDNS_FORWARD_ADD_REJECTED DNS Server, %1, rejected a DNS update request to add the address mapping for FQDN, %2, with an RCODE: %3
+% DHCP_DDNS_FORWARD_ADD_REJECTED DNS Request ID %1: Server, %2, rejected a DNS update request to add the address mapping for FQDN, %3, with an RCODE: %4
 This is an error message issued when an update was rejected by the DNS server
 it was sent to for the reason given by the RCODE. The rcode values are defined
 in RFC 2136.
 
-% DHCP_DDNS_FORWARD_ADD_RESP_CORRUPT DHCP_DDNS received a corrupt response from the DNS server, %1, while adding forward address mapping for FQDN, %2
+% DHCP_DDNS_FORWARD_ADD_RESP_CORRUPT DHCP_DDNS Request ID %1: received a corrupt response from the DNS server, %2, while adding forward address mapping for FQDN, %3
 This is an error message issued when the response received by DHCP_DDNS, to a
 update request to add a forward address mapping,  is mangled or malformed.
 The application will retry against the same server or others as appropriate.
 
-% DHCP_DDNS_FORWARD_REMOVE_ADDRS_BAD_DNSCLIENT_STATUS DHCP_DDNS received an unknown DNSClient status: %1, while removing a forward address mapping for FQDN %2 to DNS server %3
+% DHCP_DDNS_FORWARD_REMOVE_ADDRS_BAD_DNSCLIENT_STATUS DHCP_DDNS Request ID %1: received an unknown DNSClient status: %2, while removing a forward address mapping for FQDN %3 to DNS server %4
 This is an error message issued when DNSClient returns an unrecognized status
 while DHCP_DDNS was removing a forward address mapping.  The request will be
 aborted.  This is most likely a programmatic issue and should be reported.
 
-% DHCP_DDNS_FORWARD_REMOVE_ADDRS_BUILD_FAILURE DNS udpate message to remove a forward DNS Address entry could not be constructed for this request: %1,  reason: %2
+% DHCP_DDNS_FORWARD_REMOVE_ADDRS_BUILD_FAILURE DNS Request ID %1: udpate message to remove a forward DNS Address entry could not be constructed for this request: %2, reason: %3
 This is an error message issued when an error occurs attempting to construct
 the server bound packet requesting a forward address (A or AAAA) removal.  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_REMOVE_ADDRS_IO_ERROR DHCP_DDNS encountered an IO error sending a forward mapping address removal for FQDN %1 to DNS server %2
+/*sar*/
+% DHCP_DDNS_FORWARD_REMOVE_ADDRS_IO_ERROR DHCP_DDNS Request ID %1: encountered an IO error sending a forward mapping address removal for FQDN %2 to DNS server %3
 This is an error message issued when a communication error occurs while
 DHCP_DDNS is carrying out a forward address remove.  The application will retry
 against the same server or others as appropriate.
 
-% DHCP_DDNS_FORWARD_REMOVE_ADDRS_REJECTED DNS Server, %1, rejected a DNS update request to remove the forward address mapping for FQDN, %2, with an RCODE: %3
+% DHCP_DDNS_FORWARD_REMOVE_ADDRS_REJECTED DNS Request ID %1: Server, %2, rejected a DNS update request to remove the forward address mapping for FQDN, %3, with an RCODE: %4
 This is an error message issued when an update was rejected by the DNS server
 it was sent to for the reason given by the RCODE. The rcode values are defined
 in RFC 2136.
 
-% DHCP_DDNS_FORWARD_REMOVE_ADDRS_RESP_CORRUPT DHCP_DDNS received a corrupt response from the DNS server, %1, while removing forward address mapping for FQDN, %2
+% DHCP_DDNS_FORWARD_REMOVE_ADDRS_RESP_CORRUPT DHCP_DDNS Request ID %1: received a corrupt response from the DNS server, %2, while removing forward address mapping for FQDN, %3
 This is an error message issued when the response received by DHCP_DDNS, to a
 update request to remove a forward address mapping, is mangled or malformed.
 The application will retry against the same server or others as appropriate.
 
-% DHCP_DDNS_FORWARD_REMOVE_RRS_BAD_DNSCLIENT_STATUS DHCP_DDNS received an unknown DNSClient status: %1, while removing forward RRs for FQDN %2 to DNS server %3
+% DHCP_DDNS_FORWARD_REMOVE_RRS_BAD_DNSCLIENT_STATUS DHCP_DDNS Request ID %1: received an unknown DNSClient status: %2, while removing forward RRs for FQDN %3 to DNS server %4
 This is an error message issued when DNSClient returns an unrecognized status
 while DHCP_DDNS was removing forward RRs.  The request will be aborted. This is
 most likely a programmatic issue and should be reported.
 
-% DHCP_DDNS_FORWARD_REMOVE_RRS_BUILD_FAILURE DNS udpate message to remove forward DNS RR entries could not be constructed for this request: %1,  reason: %2
+% DHCP_DDNS_FORWARD_REMOVE_RRS_BUILD_FAILURE DNS Request ID %1: udpate message to remove forward DNS RR entries could not be constructed for this request: %2,  reason: %3
 This is an error message issued when an error occurs attempting to construct
 the server bound packet requesting forward RR (DHCID RR) removal.  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_REMOVE_RRS_IO_ERROR DHCP_DDNS encountered an IO error sending a forward RR removal for FQDN %1 to DNS server %2
+% DHCP_DDNS_FORWARD_REMOVE_RRS_IO_ERROR DHCP_DDNS Request ID %1: encountered an IO error sending a forward RR removal for FQDN %2 to DNS server %3
 This is an error message issued when a communication error occurs while
 DHCP_DDNS is carrying out a forward RR remove.  The application will retry
 against the same server.
 
-% DHCP_DDNS_FORWARD_REMOVE_RRS_REJECTED DNS Server, %1, rejected a DNS update request to remove forward RR entries for FQDN, %2, with an RCODE: %3
+% DHCP_DDNS_FORWARD_REMOVE_RRS_REJECTED DNS Request ID %1: Server, %2, rejected a DNS update request to remove forward RR entries for FQDN, %3, with an RCODE: %4
 This is an error message issued when an update was rejected by the DNS server
 it was sent to for the reason given by the RCODE. The rcode values are defined
 in RFC 2136.
 
-% DHCP_DDNS_FORWARD_REMOVE_RRS_RESP_CORRUPT DHCP_DDNS received a corrupt response from the DNS server, %1, while removing forward RRs for FQDN, %2
+% DHCP_DDNS_FORWARD_REMOVE_RRS_RESP_CORRUPT DHCP_DDNS Request ID %1: received a corrupt response from the DNS server, %2, while removing forward RRs for FQDN, %3
 This is an error message issued when the response received by DHCP_DDNS, to a
 update request to remove forward RRs mapping, is mangled or malformed.
 The application will retry against the same server or others as appropriate.
-
-% DHCP_DDNS_FORWARD_REPLACE_BAD_DNSCLIENT_STATUS DHCP_DDNS received an unknown DNSClient status: %1, while replacing forward address mapping for FQDN %2 to DNS server %3
+/*sar*/
+% DHCP_DDNS_FORWARD_REPLACE_BAD_DNSCLIENT_STATUS DHCP_DDNS Request ID %1: received an unknown DNSClient status: %2, while replacing forward address mapping for FQDN %3 to DNS server %4
 This is an error message issued when DNSClient returns an unrecognized status
 while DHCP_DDNS was replacing a forward address mapping.  The request will be
 aborted.  This is most likely a programmatic issue and should be reported.
 
-% DHCP_DDNS_FORWARD_REPLACE_BUILD_FAILURE DNS update message to replace a forward DNS entry could not be constructed from this request: %1, reason: %2
+% DHCP_DDNS_FORWARD_REPLACE_BUILD_FAILURE DNS Request ID %1: update message to replace a forward DNS entry could not be constructed from this request: %2, reason: %3
 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_FORWARD_REPLACE_IO_ERROR DHCP_DDNS encountered an IO error sending a forward mapping replace for FQDN %1 to DNS server %2
+% DHCP_DDNS_FORWARD_REPLACE_IO_ERROR DHCP_DDNS Request ID %1: encountered an IO error sending a forward mapping replace for FQDN %2 to DNS server %3
 This is an error message issued when a communication error occurs while
 DHCP_DDNS is carrying out a forward address update.  The application will
 retry against the same server or others as appropriate.
 
-% DHCP_DDNS_FORWARD_REPLACE_REJECTED DNS Server, %1, rejected a DNS update request to replace the address mapping for FQDN, %2, with an RCODE: %3
+% DHCP_DDNS_FORWARD_REPLACE_REJECTED DNS Request ID %1: Server, %2, rejected a DNS update request to replace the address mapping for FQDN, %3, with an RCODE: %4
 This is an error message issued when an update was rejected by the DNS server
 it was sent to for the reason given by the RCODE. The rcode values are defined
 in RFC 2136.
 
-% DHCP_DDNS_FORWARD_REPLACE_RESP_CORRUPT DHCP_DDNS received a corrupt response from the DNS server, %1, while replacing forward address mapping for FQDN, %2
+% DHCP_DDNS_FORWARD_REPLACE_RESP_CORRUPT DHCP_DDNS Request ID %1: received a corrupt response from the DNS server, %2, while replacing forward address mapping for FQDN, %3
 This is an error message issued when the response received by DHCP_DDNS, to a
 update request to replace a forward address mapping,  is mangled or malformed.
 The application will retry against the same server or others as appropriate.
 
-% DHCP_DDNS_FWD_REQUEST_IGNORED Forward updates are disabled, the forward portion of request will be ignored: %1
+% DHCP_DDNS_FWD_REQUEST_IGNORED Request ID %1: Forward updates are disabled, the forward portion of request will be ignored: %2
 This is a debug message issued when forward DNS updates are disabled and
 DHCP_DDNS receives an update request containing a forward DNS update. The
 forward update will not performed.
@@ -257,12 +257,12 @@ change entries in the DNS. For this reason, addresses other than the IPv4 or
 IPv6 loopback addresses should only be used for testing purposes. A future
 version of Kea will implement authentication to guard against such attacks.
 
-% DHCP_DDNS_NO_ELIGIBLE_JOBS although there are queued requests, there are pending transactions for each Queue count: %1  Transaction count: %2
+% DHCP_DDNS_NO_ELIGIBLE_JOBS although there are queued requests, there are pending transactions for each, Queue count: %1  Transaction count: %2
 This is a debug message issued when all of the queued requests represent clients
 for which there is a an update already in progress.  This may occur under
 normal operations but should be temporary situation.
 
-% DHCP_DDNS_NO_FWD_MATCH_ERROR the configured list of forward DDNS domains does not contain a match for: %1  The request has been discarded.
+% DHCP_DDNS_NO_FWD_MATCH_ERROR Request ID %1: the configured list of forward DDNS domains does not contain a match for: %2  The request has been discarded.
 This is an error message that indicates that DHCP_DDNS received a request to
 update a the forward DNS information for the given FQDN but for which there are
 no configured DDNS domains in the DHCP_DDNS configuration.  Either the DHCP_DDNS
@@ -274,7 +274,7 @@ This is warning message issued when there are no domains in the configuration
 which match the cited fully qualified domain name (FQDN).  The DNS Update
 request for the FQDN cannot be processed.
 
-% DHCP_DDNS_NO_REV_MATCH_ERROR the configured list of reverse DDNS domains does not contain a match for: %1  The request has been discarded.
+% DHCP_DDNS_NO_REV_MATCH_ERROR Request ID %1: the configured list of reverse DDNS domains does not contain a match for: %2  The request has been discarded.
 This is an error message that indicates that DHCP_DDNS received a request to
 update a the reverse DNS information for the given FQDN but for which there are
 no configured DDNS domains in the DHCP_DDNS configuration.  Either the DHCP_DDNS
@@ -292,6 +292,11 @@ needs to be increased, the DHCP-DDNS clients are simply generating too many
 requests too quickly, or perhaps upstream DNS servers are experiencing
 load issues.
 
+% DHCP_DDNS_QUEUE_MGR_QUEUE_RECEIVE Request ID %1: received and queued a request.
+This is an informational message indicating that the NameChangeREquest listener used
+by DHCP-DDNS to receive a request has received a request and queued it for further
+processing.
+
 % DHCP_DDNS_QUEUE_MGR_RECONFIGURING application is reconfiguring the queue manager
 This is an informational message indicating that DHCP_DDNS is reconfiguring the queue manager as part of normal startup or in response to a new configuration.
 
@@ -302,7 +307,7 @@ requests.
 
 % DHCP_DDNS_QUEUE_MGR_RECV_ERROR application's queue manager was notified of a request receive error by its listener.
 This is an error message indicating that the NameChangeRequest listener used by
-DHCP-DDNS to receive requests encountered a IO error.  There should be
+DHCP-DDNS to receive requests encountered an IO error.  There should be
 corresponding log messages from the listener layer with more details. This may
 indicate a network connectivity or system resource issue.
 
@@ -359,74 +364,74 @@ receive was unexpected interrupted.  Normally, the read is receive is only
 interrupted as a normal part of stopping the queue manager.  This is most
 likely a programmatic issue that should be reported.
 
-% DHCP_DDNS_REMOVE_FAILED DHCP_DDNS Transaction outcome: %1
+% DHCP_DDNS_REMOVE_FAILED DHCP_DDNS Request ID %1: Transaction outcome: %2
 This is an error message issued after DHCP_DDNS attempts to submit DNS mapping
 entry removals have failed.  The precise reason for the failure should be
 documented in preceding log entries.
 
-% DHCP_DDNS_REMOVE_SUCCEEDED DHCP_DDNS successfully removed the DNS mapping addition for this request: %1
+% DHCP_DDNS_REMOVE_SUCCEEDED DHCP_DDNS Request ID %1: successfully removed the DNS mapping addition for this request: %2
 This is an informational message issued after DHCP_DDNS has submitted DNS
 mapping removals which were received and accepted by an appropriate DNS server.
 
-% DHCP_DDNS_REQUEST_DROPPED Request contains no enabled update requests and will be dropped: %1
+% DHCP_DDNS_REQUEST_DROPPED Request ID %1: Request contains no enabled update requests and will be dropped: %2
 This is a debug message issued when DHCP_DDNS receives a request which does not
 contain updates in a direction that is enabled.  In other words, if only forward
 updates are enabled and request is recevied that asks only for reverse updates
 then the request is dropped.
 
-% DHCP_DDNS_REVERSE_REMOVE_BAD_DNSCLIENT_STATUS DHCP_DDNS received an unknown DNSClient status: %1, while removing reverse address mapping for FQDN %2 to DNS server %3
+% DHCP_DDNS_REVERSE_REMOVE_BAD_DNSCLIENT_STATUS DHCP_DDNS Request ID %1: received an unknown DNSClient status: %2, while removing reverse address mapping for FQDN %3 to DNS server %4
 This is an error message issued when DNSClient returns an unrecognized status
 while DHCP_DDNS was removing a reverse address mapping.  The request will be
 aborted.  This is most likely a programmatic issue and should be reported.
 
-% DHCP_DDNS_REVERSE_REMOVE_BUILD_FAILURE DNS update message to remove a reverse DNS entry could not be constructed from this request: %1,  reason: %2
+% DHCP_DDNS_REVERSE_REMOVE_BUILD_FAILURE DNS Request ID %1: update message to remove a reverse DNS entry could not be constructed from this request: %2,  reason: %3
 This is an error message issued when an error occurs attempting to construct
 the server bound packet requesting a reverse PTR removal.  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_REMOVE_IO_ERROR DHCP_DDNS encountered an IO error sending a reverse mapping remove for FQDN %1 to DNS server %2
+% DHCP_DDNS_REVERSE_REMOVE_IO_ERROR DHCP_DDNS Request ID %1: encountered an IO error sending a reverse mapping remove for FQDN %2 to DNS server %3
 This is an error message issued when a communication error occurs while
 DHCP_DDNS is carrying out a reverse address update.  The application will
 retry against the same server or others as appropriate.
 
-% DHCP_DDNS_REVERSE_REMOVE_REJECTED DNS Server, %1, rejected a DNS update request to remove the reverse mapping for FQDN, %2, with an RCODE: %3
+% DHCP_DDNS_REVERSE_REMOVE_REJECTED DNS Request ID %1: Server, %2, rejected a DNS update request to remove the reverse mapping for FQDN, %3, with an RCODE: %4
 This is an error message issued when an update was rejected by the DNS server
 it was sent to for the reason given by the RCODE. The rcode values are defined
 in RFC 2136.
 
-% DHCP_DDNS_REVERSE_REMOVE_RESP_CORRUPT DHCP_DDNS received a corrupt response from the DNS server, %1, while removing reverse address mapping for FQDN, %2
+% DHCP_DDNS_REVERSE_REMOVE_RESP_CORRUPT DHCP_DDNS Request ID %1: received a corrupt response from the DNS server, %2, while removing reverse address mapping for FQDN, %3
 This is an error message issued when the response received by DHCP_DDNS, to a
 update request to remove a reverse address,  is mangled or malformed.
 The application will retry against the same server or others as appropriate.
 
-% DHCP_DDNS_REVERSE_REPLACE_BAD_DNSCLIENT_STATUS DHCP_DDNS received an unknown DNSClient status: %1, while replacing reverse address mapping for FQDN %2 to DNS server %3
+% DHCP_DDNS_REVERSE_REPLACE_BAD_DNSCLIENT_STATUS DHCP_DDNS Request ID %1: received an unknown DNSClient status: %2, while replacing reverse address mapping for FQDN %3 to DNS server %4
 This is an error message issued when DNSClient returns an unrecognized status
 while DHCP_DDNS was replacing a reverse address mapping.  The request will be
 aborted.  This is most likely a programmatic issue and should be reported.
 
-% DHCP_DDNS_REVERSE_REPLACE_BUILD_FAILURE DNS update message to replace a reverse DNS entry could not be constructed from this request: %1, reason: %2
+% DHCP_DDNS_REVERSE_REPLACE_BUILD_FAILURE DNS Request ID %1: update message to replace a reverse DNS entry could not be constructed from this request: %2, reason: %3
 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_REVERSE_REPLACE_IO_ERROR DHCP_DDNS encountered an IO error sending a reverse mapping replacement for FQDN %1 to DNS server %2
+% DHCP_DDNS_REVERSE_REPLACE_IO_ERROR DHCP_DDNS Request ID %1: encountered an IO error sending a reverse mapping replacement for FQDN %2 to DNS server %3
 This is an error message issued when a communication error occurs while
 DHCP_DDNS is carrying out a reverse address update.  The application will
 retry against the same server or others as appropriate.
 
-% DHCP_DDNS_REVERSE_REPLACE_REJECTED DNS Server, %1, rejected a DNS update request to replace the reverse mapping for FQDN, %2, with an RCODE: %3
+% DHCP_DDNS_REVERSE_REPLACE_REJECTED DNS Request ID %1: Server, %2, rejected a DNS update request to replace the reverse mapping for FQDN, %3, with an RCODE: %4
 This is an error message issued when an update was rejected by the DNS server
 it was sent to for the reason given by the RCODE. The rcode values are defined
 in RFC 2136.
 
-% DHCP_DDNS_REVERSE_REPLACE_RESP_CORRUPT DHCP_DDNS received a corrupt response from the DNS server, %1, while replacing reverse address mapping for FQDN, %2
+% DHCP_DDNS_REVERSE_REPLACE_RESP_CORRUPT DHCP_DDNS Request ID %1: received a corrupt response from the DNS server, %2, while replacing reverse address mapping for FQDN, %3
 This is an error message issued when the response received by DHCP_DDNS, to a
 update request to replace a reverse address,  is mangled or malformed.
 The application will retry against the same server or others as appropriate.
 
-% DHCP_DDNS_REV_REQUEST_IGNORED Reverse updates are disabled, the reverse portion of request will be ignored: %1
+% DHCP_DDNS_REV_REQUEST_IGNORED Request ID %1: Reverse updates are disabled, the reverse portion of request will be ignored: %2
 This is a debug message issued when reverse DNS updates are disabled and
 DHCP_DDNS receives an update request containing a reverse DNS update.  The
 reverse update will not performed.
@@ -462,19 +467,19 @@ The version is also printed.
 This is an informational message issued when controller for the
 service first starts. Version is also reported.
 
-% DHCP_DDNS_STARTING_TRANSACTION Transaction Key: %1
+% DHCP_DDNS_STARTING_TRANSACTION Request ID %1:
 This is a debug message issued when DHCP-DDNS has begun a transaction for
 a given request.
 
-% DHCP_DDNS_STATE_MODEL_UNEXPECTED_ERROR application encountered an unexpected error while carrying out a NameChangeRequest: %1
+% DHCP_DDNS_STATE_MODEL_UNEXPECTED_ERROR Request ID %1: application encountered an unexpected error while carrying out a NameChangeRequest: %2
 This is error message issued when the application fails to process a
 NameChangeRequest correctly. Some or all of the DNS updates requested as part
 of this update did not succeed. This is a programmatic error and should be
 reported.
 
-% DHCP_DDNS_TRANS_SEND_ERROR application encountered an unexpected error while attempting to send a DNS update: %1
+% DHCP_DDNS_TRANS_SEND_ERROR Request ID %1: application encountered an unexpected error while attempting to send a DNS update: %2
 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
+message but the attempt to send it suffered an 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.
 
@@ -484,10 +489,10 @@ unsupported signal.  This is a programming error indicating that the
 application has registered to receive the signal but no associated
 processing logic has been added.
 
-% DHCP_DDNS_UPDATE_REQUEST_SENT %1 for transaction key: %2 to server: %3
+% DHCP_DDNS_UPDATE_REQUEST_SENT Request ID %1: %2 to server: %3
 This is a debug message issued when DHCP_DDNS sends a DNS request to a DNS
 server.
 
-% DHCP_DDNS_UPDATE_RESPONSE_RECEIVED for transaction key: %1  to server: %2 status: %3
+% DHCP_DDNS_UPDATE_RESPONSE_RECEIVED Request ID %1: to server: %2 status: %3
 This is a debug message issued when DHCP_DDNS receives sends a DNS update
 response from a DNS server.

+ 1 - 1
src/bin/d2/d2_process.cc

@@ -319,7 +319,7 @@ D2Process::reconfigureQueueMgr() {
     // a valid configuration to work with so if we fail below, it will be
     // an operational issue, such as a busy IP address. That will leave
     // queue manager in INITTED state, which is fine.
-    // What we dont' want is to continually attempt to reconfigure so set
+    // What we don't want is to continually attempt to reconfigure so set
     // the flag false now.
     // @todo This method assumes only 1 type of listener.  This will change
     // to support at least a TCP version, possibly some form of RDBMS listener

+ 4 - 4
src/bin/d2/d2_process.h

@@ -65,7 +65,7 @@ public:
     /// @param io_service is the io_service used by the caller for
     /// asynchronous event handling.
     ///
-    /// @throw DProcessBaseError is io_service is NULL.
+    /// @throw DProcessBaseError if io_service is NULL.
     D2Process(const char* name, const asiolink::IOServicePtr& io_service);
 
     /// @brief Called after instantiation to perform initialization unique to
@@ -86,7 +86,7 @@ public:
     /// Once entered, the main control thread remains inside this method
     /// until shutdown.  The event loop logic is as follows:
     /// @code
-    ///    while should not down {
+    ///    while should not shutdown {
     ///       process queue manager state change
     ///       process completed jobs
     ///       dequeue new jobs
@@ -146,7 +146,7 @@ public:
     ///
     /// This method may be called multiple times during the process lifetime.
     /// Certainly once during process startup, and possibly later if the user
-    /// alters configuration. This method must not throw, it should catch any
+    /// alters the configuration. This method must not throw, it should catch any
     /// processing errors and return a success or failure answer as described
     /// below.
     ///
@@ -217,7 +217,7 @@ protected:
 
     /// @brief Initializes then starts the queue manager.
     ///
-    /// This method is initializes the queue manager with the current
+    /// This method initializes the queue manager with the current
     /// configuration parameters and instructs it to start listening.
     /// Note the existing listener instance (if it exists) is destroyed,
     /// and that a new listener is created during initialization.

+ 10 - 5
src/bin/d2/d2_queue_mgr.cc

@@ -54,13 +54,18 @@ D2QueueMgr::operator()(const dhcp_ddns::NameChangeListener::Result result,
             if (getQueueSize() < getMaxQueueSize()) {
                 // There's room on the queue, add to the end
                 enqueue(ncr);
+
+                // Log that we got the request
+                LOG_DEBUG(dhcp_to_d2_logger, DBGLVL_TRACE_DETAIL_DATA,
+                          DHCP_DDNS_QUEUE_MGR_QUEUE_RECEIVE)
+                          .arg(ncr->getRequestId());
                 return;
             }
 
             // Queue is full, stop the listener.
             // Note that we can move straight to a STOPPED state as there
             // is no receive in progress.
-            LOG_ERROR(dctl_logger, DHCP_DDNS_QUEUE_MGR_QUEUE_FULL)
+            LOG_ERROR(dhcp_to_d2_logger, DHCP_DDNS_QUEUE_MGR_QUEUE_FULL)
                       .arg(max_queue_size_);
             stopListening(STOPPED_QUEUE_FULL);
             break;
@@ -71,11 +76,11 @@ D2QueueMgr::operator()(const dhcp_ddns::NameChangeListener::Result result,
                 // callback will not be called again, unless its restarted.
                 updateStopState();
             } else {
-                // We should not get an receive complete status of stopped
+                // We should not get a receive complete status of stopped
                 // unless we canceled the read as part of stopping. Therefore
                 // this is unexpected so we will treat it as a receive error.
                 // This is most likely an unforeseen programmatic issue.
-                LOG_ERROR(dctl_logger, DHCP_DDNS_QUEUE_MGR_UNEXPECTED_STOP)
+                LOG_ERROR(dhcp_to_d2_logger, DHCP_DDNS_QUEUE_MGR_UNEXPECTED_STOP)
                           .arg(mgr_state_);
                 stopListening(STOPPED_RECV_ERROR);
             }
@@ -86,13 +91,13 @@ D2QueueMgr::operator()(const dhcp_ddns::NameChangeListener::Result result,
             // Receive failed, stop the listener.
             // Note that we can move straight to a STOPPED state as there
             // is no receive in progress.
-            LOG_ERROR(dctl_logger, DHCP_DDNS_QUEUE_MGR_RECV_ERROR);
+            LOG_ERROR(dhcp_to_d2_logger, DHCP_DDNS_QUEUE_MGR_RECV_ERROR);
             stopListening(STOPPED_RECV_ERROR);
             break;
         }
     } catch (const std::exception& ex) {
         // On the outside chance a throw occurs, let's log it and swallow it.
-        LOG_ERROR(dctl_logger, DHCP_DDNS_QUEUE_MGR_UNEXPECTED_HANDLER_ERROR)
+        LOG_ERROR(dhcp_to_d2_logger, DHCP_DDNS_QUEUE_MGR_UNEXPECTED_HANDLER_ERROR)
                   .arg(ex.what());
     }
 }

+ 2 - 2
src/bin/d2/d2_queue_mgr.h

@@ -72,10 +72,10 @@ public:
 
 /// @brief D2QueueMgr creates and manages a queue of DNS update requests.
 ///
-/// D2QueueMgr is class specifically designed as an integral part of DHCP-DDNS.
+/// D2QueueMgr is a class specifically designed as an integral part of DHCP-DDNS.
 /// Its primary responsibility is to listen for NameChangeRequests from
 /// DHCP-DDNS clients (e.g. DHCP servers) and queue them for processing. In
-/// addition it may provide a number services to locate entries in the queue
+/// addition it may provide a number of services to locate entries in the queue
 /// such as by FQDN or DHCID.  These services may eventually be used
 /// for processing optimization.  The initial implementation will support
 /// simple FIFO access.

+ 18 - 10
src/bin/d2/d2_update_mgr.cc

@@ -64,7 +64,7 @@ void D2UpdateMgr::sweep() {
     // frequently.  It will likely achieve max transactions quickly on its own.
     if (getQueueCount() > 0)  {
         if (getTransactionCount() >= max_transactions_) {
-            LOG_DEBUG(dctl_logger, DBGLVL_TRACE_DETAIL_DATA,
+            LOG_DEBUG(dhcp_to_d2_logger, DBGLVL_TRACE_DETAIL_DATA,
                       DHCP_DDNS_AT_MAX_TRANSACTIONS).arg(getQueueCount())
                       .arg(getMaxTransactions());
 
@@ -118,7 +118,7 @@ void D2UpdateMgr::pickNextJob() {
 
     // There were no eligible jobs. All of the current DHCIDs already have
     // transactions pending.
-    LOG_DEBUG(dctl_logger, DBGLVL_TRACE_DETAIL_DATA, DHCP_DDNS_NO_ELIGIBLE_JOBS)
+    LOG_DEBUG(dhcp_to_d2_logger, DBGLVL_TRACE_DETAIL_DATA, DHCP_DDNS_NO_ELIGIBLE_JOBS)
               .arg(getQueueCount()).arg(getTransactionCount());
 }
 
@@ -140,8 +140,10 @@ D2UpdateMgr::makeTransaction(dhcp_ddns::NameChangeRequestPtr& next_ncr) {
     if (next_ncr->isForwardChange()) {
         if (!cfg_mgr_->forwardUpdatesEnabled()) {
             next_ncr->setForwardChange(false);
-            LOG_DEBUG(dctl_logger, DBGLVL_TRACE_DETAIL_DATA,
-                      DHCP_DDNS_FWD_REQUEST_IGNORED).arg(next_ncr->toText());
+            LOG_DEBUG(dhcp_to_d2_logger, DBGLVL_TRACE_DETAIL_DATA,
+                      DHCP_DDNS_FWD_REQUEST_IGNORED)
+                      .arg(next_ncr->getRequestId())
+                      .arg(next_ncr->toText());
         } else {
             bool matched = cfg_mgr_->matchForward(next_ncr->getFqdn(),
                                                   forward_domain);
@@ -149,7 +151,8 @@ D2UpdateMgr::makeTransaction(dhcp_ddns::NameChangeRequestPtr& next_ncr) {
             // out. This has the net affect of dropping the request on the
             // floor.
             if (!matched) {
-                LOG_ERROR(dctl_logger, DHCP_DDNS_NO_FWD_MATCH_ERROR)
+                LOG_ERROR(dhcp_to_d2_logger, DHCP_DDNS_NO_FWD_MATCH_ERROR)
+                          .arg(next_ncr->getRequestId())
                           .arg(next_ncr->toText());
                 return;
             }
@@ -163,8 +166,10 @@ D2UpdateMgr::makeTransaction(dhcp_ddns::NameChangeRequestPtr& next_ncr) {
     if (next_ncr->isReverseChange()) {
         if (!cfg_mgr_->reverseUpdatesEnabled()) {
             next_ncr->setReverseChange(false);
-            LOG_DEBUG(dctl_logger, DBGLVL_TRACE_DETAIL_DATA,
-                      DHCP_DDNS_REV_REQUEST_IGNORED).arg(next_ncr->toText());
+            LOG_DEBUG(dhcp_to_d2_logger, DBGLVL_TRACE_DETAIL_DATA,
+                      DHCP_DDNS_REV_REQUEST_IGNORED)
+                      .arg(next_ncr->getRequestId())
+                      .arg(next_ncr->toText());
         } else {
             bool matched = cfg_mgr_->matchReverse(next_ncr->getIpAddress(),
                                                   reverse_domain);
@@ -172,7 +177,8 @@ D2UpdateMgr::makeTransaction(dhcp_ddns::NameChangeRequestPtr& next_ncr) {
             // out. This has the net affect of dropping the request on the
             // floor.
             if (!matched) {
-                LOG_ERROR(dctl_logger, DHCP_DDNS_NO_REV_MATCH_ERROR)
+                LOG_ERROR(dhcp_to_d2_logger, DHCP_DDNS_NO_REV_MATCH_ERROR)
+                          .arg(next_ncr->getRequestId())
                           .arg(next_ncr->toText());
                 return;
             }
@@ -184,8 +190,10 @@ D2UpdateMgr::makeTransaction(dhcp_ddns::NameChangeRequestPtr& next_ncr) {
     // If there is nothing to actually do, then the request falls on the floor.
     // Should we log this?
     if (!direction_count) {
-        LOG_DEBUG(dctl_logger, DBGLVL_TRACE_DETAIL_DATA,
-                  DHCP_DDNS_REQUEST_DROPPED).arg(next_ncr->toText());
+        LOG_DEBUG(dhcp_to_d2_logger, DBGLVL_TRACE_DETAIL_DATA,
+                  DHCP_DDNS_REQUEST_DROPPED)
+                  .arg(next_ncr->getRequestId())
+                  .arg(next_ncr->toText());
         return;
     }
 

+ 3 - 3
src/bin/d2/d2_update_mgr.h

@@ -49,7 +49,7 @@ typedef std::map<TransactionKey, NameChangeTransactionPtr> TransactionList;
 ///
 /// D2UpdateMgr uses the services of D2QueueMgr to monitor the queue of
 /// NameChangeRequests and select and dequeue requests for processing.
-/// When request is dequeued for processing it is removed from the queue and
+/// When a request is dequeued for processing it is removed from the queue and
 /// wrapped in NameChangeTransaction and added to the D2UpdateMgr's list of
 /// transactions.
 ///
@@ -65,7 +65,7 @@ typedef std::map<TransactionKey, NameChangeTransactionPtr> TransactionList;
 /// transactions complete,  D2UpdateMgr removes them from the transaction list,
 /// replacing them with new transactions.
 ///
-/// D2UpdateMgr carries out each of the above steps, from with a method called
+/// D2UpdateMgr carries out each of the above steps, with a method called
 /// sweep().  This method is intended to be called as IO events complete.
 /// The upper layer(s) are responsible for calling sweep in a timely and cyclic
 /// manner.
@@ -154,7 +154,7 @@ protected:
     ///
     /// If updates in a given direction are disabled requests for updates in
     /// that direction will be ignored.  For example: If a request is received
-    /// which asks for updates both directions but only forward updates are
+    /// which asks for updates in both directions but only forward updates are
     /// enabled; only the forward update will be attempted.  Effectively, the
     /// request will be treated as if it only asked for forward updates.
     ///

+ 1 - 1
src/bin/d2/d_cfg_mgr.cc

@@ -289,7 +289,7 @@ void DCfgMgrBase::buildAndCommit(std::string& element_id,
     // and store them in parser's local storage.
     parser->build(value);
 
-    // Invoke the parser's commit method. This "writes" the the data
+    // Invoke the parser's commit method. This "writes" the data
     // item(s) stored locally by the parser into the context.  (Note that
     // parsers are free to do more than update the context, but that is an
     // nothing something we are concerned with here.)

+ 3 - 4
src/bin/d2/d_controller.cc

@@ -90,7 +90,6 @@ DControllerBase::launch(int argc, char* argv[], const bool test_mode) {
                    "Application Process initialization failed: " << ex.what());
     }
 
-
     LOG_DEBUG(dctl_logger, DBGLVL_START_SHUT, DCTL_STANDALONE).arg(app_name_);
 
     // Step 3 is to load configuration from file.
@@ -305,20 +304,20 @@ isc::data::ConstElementPtr
 DControllerBase::executeCommand(const std::string& command,
                             isc::data::ConstElementPtr args) {
     // Shutdown is universal.  If its not that, then try it as
-    // an custom command supported by the derivation.  If that
+    // a custom command supported by the derivation.  If that
     // doesn't pan out either, than send to it the application
     // as it may be supported there.
     isc::data::ConstElementPtr answer;
     if (command.compare(SHUT_DOWN_COMMAND) == 0) {
         answer = shutdownProcess(args);
     } else {
-        // It wasn't shutdown, so may be a custom controller command.
+        // It wasn't shutdown, so it may be a custom controller command.
         int rcode = 0;
         answer = customControllerCommand(command, args);
         isc::config::parseAnswer(rcode, answer);
         if (rcode == COMMAND_INVALID)
         {
-            // It wasn't controller command, so may be an application command.
+            // It wasn't a controller command, so it may be an application command.
             answer = process_->command(command, args);
         }
     }

+ 4 - 4
src/bin/d2/d_controller.h

@@ -244,7 +244,7 @@ protected:
     /// any prefixing hyphen(s)
     /// @param optarg is the argument value (if one) associated with the option
     ///
-    /// @return must return true if the option was valid, false is it is
+    /// @return must return true if the option was valid, false if it is
     /// invalid. (Note the default implementation always returns false.)
     virtual bool customOption(int option, char *optarg);
 
@@ -305,12 +305,12 @@ protected:
     /// -# SIGHUP - instigates reloading the configuration file
     /// -# SIGINT - instigates a graceful shutdown
     /// -# SIGTERM - instigates a graceful shutdown
-    /// If received any other signal, it will issue a debug statement and
+    /// If it receives any other signal, it will issue a debug statement and
     /// discard it.
     /// Derivations wishing to support additional signals could override this
     /// method with one that: processes the signal if it is one of additional
     /// signals, otherwise invoke this method (DControllerBase::processSignal())
-    /// with signal value.
+    /// with the signal value.
     /// @todo Provide a convenient way for derivations to register additional
     /// signals.
     virtual void processSignal(int signum);
@@ -370,7 +370,7 @@ protected:
     /// @brief Processes the command line arguments. It is the first step
     /// taken after the controller has been launched.  It combines the stock
     /// list of options with those returned by getCustomOpts(), and uses
-    /// cstdlib's getopt to loop through the command line.  The stock options
+    /// cstdlib's getopt to loop through the command line.
     /// It handles stock options directly, and passes any custom options into
     /// the customOption method.  Currently there are only two stock options
     /// -c for specifying the configuration file, and -v for verbose logging.

+ 1 - 1
src/bin/d2/dns_client.cc

@@ -147,7 +147,7 @@ DNSClientImpl::operator()(asiodns::IOFetch::Result result) {
                                 tsig_context_.get());
         } catch (const isc::Exception& ex) {
             status = DNSClient::INVALID_RESPONSE;
-            LOG_DEBUG(dctl_logger, DBGLVL_TRACE_DETAIL,
+            LOG_DEBUG(d2_to_dns_logger, DBGLVL_TRACE_DETAIL,
                       DHCP_DDNS_INVALID_RESPONSE).arg(ex.what());
 
         }

+ 1 - 1
src/bin/d2/dns_client.h

@@ -75,7 +75,7 @@ public:
 
     /// @brief Callback for the @c DNSClient class.
     ///
-    /// This is is abstract class which represents the external callback for the
+    /// This is an abstract class which represents the external callback for the
     /// @c DNSClient. Caller must implement this class and supply its instance
     /// in the @c DNSClient constructor to get callbacks when the DNS Update
     /// exchange is complete (@see @c DNSClient).

+ 1 - 1
src/bin/d2/labeled_value.h

@@ -37,7 +37,7 @@ public:
 
 /// @brief Implements the concept of a constant value with a text label.
 ///
-/// This class implements an association between an constant integer value
+/// This class implements an association between a constant integer value
 /// and a text label. It provides a single constructor, accessors for both
 /// the value and label, and boolean operators which treat the value as
 /// the "key" for comparisons.  This allows them to be assembled into

+ 35 - 18
src/bin/d2/nc_add.cc

@@ -196,7 +196,8 @@ NameAddTransaction::addingFwdAddrsHandler() {
                 // 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)
+                LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_ADD_BUILD_FAILURE)
+                          .arg(getRequestId())
                           .arg(getNcr()->toText())
                           .arg(ex.what());
                 transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
@@ -233,7 +234,8 @@ NameAddTransaction::addingFwdAddrsHandler() {
                 // Per RFC4703 any other value means cease.
                 // If we get not authorized should we try the next server in
                 // the list? @todo  This needs some discussion perhaps.
-                LOG_ERROR(dctl_logger, DHCP_DDNS_FORWARD_ADD_REJECTED)
+                LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_ADD_REJECTED)
+                          .arg(getRequestId())
                           .arg(getCurrentServer()->toText())
                           .arg(getNcr()->getFqdn())
                           .arg(rcode.getCode());
@@ -249,7 +251,8 @@ NameAddTransaction::addingFwdAddrsHandler() {
             // to select the next server for a retry.
             // @note For now we treat OTHER as an IO error like TIMEOUT. It
             // is not entirely clear if this is accurate.
-            LOG_ERROR(dctl_logger, DHCP_DDNS_FORWARD_ADD_IO_ERROR)
+            LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_ADD_IO_ERROR)
+                      .arg(getRequestId())
                       .arg(getNcr()->getFqdn())
                       .arg(getCurrentServer()->toText());
 
@@ -259,7 +262,8 @@ NameAddTransaction::addingFwdAddrsHandler() {
         case DNSClient::INVALID_RESPONSE:
             // A response was received but was corrupt. Retry it like an IO
             // error.
-            LOG_ERROR(dctl_logger, DHCP_DDNS_FORWARD_ADD_RESP_CORRUPT)
+            LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_ADD_RESP_CORRUPT)
+                      .arg(getRequestId())
                       .arg(getCurrentServer()->toText())
                       .arg(getNcr()->getFqdn());
 
@@ -269,7 +273,8 @@ NameAddTransaction::addingFwdAddrsHandler() {
         default:
             // Any other value and we will fail this transaction, something
             // bigger is wrong.
-            LOG_ERROR(dctl_logger, DHCP_DDNS_FORWARD_ADD_BAD_DNSCLIENT_STATUS)
+            LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_ADD_BAD_DNSCLIENT_STATUS)
+                      .arg(getRequestId())
                       .arg(getDnsUpdateStatus())
                       .arg(getNcr()->getFqdn())
                       .arg(getCurrentServer()->toText());
@@ -307,7 +312,8 @@ NameAddTransaction::replacingFwdAddrsHandler() {
                 // 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)
+                LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_REPLACE_BUILD_FAILURE)
+                          .arg(getRequestId())
                           .arg(getNcr()->toText())
                           .arg(ex.what());
                 transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
@@ -345,7 +351,8 @@ NameAddTransaction::replacingFwdAddrsHandler() {
                 // Per RFC4703 any other value means cease.
                 // If we get not authorized should try the next server in
                 // the list? @todo  This needs some discussion perhaps.
-                LOG_ERROR(dctl_logger, DHCP_DDNS_FORWARD_REPLACE_REJECTED)
+                LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_REPLACE_REJECTED)
+                          .arg(getRequestId())
                           .arg(getCurrentServer()->toText())
                           .arg(getNcr()->getFqdn())
                           .arg(rcode.getCode());
@@ -361,7 +368,8 @@ NameAddTransaction::replacingFwdAddrsHandler() {
             // to select the next server for a retry.
             // @note For now we treat OTHER as an IO error like TIMEOUT. It
             // is not entirely clear if this is accurate.
-            LOG_ERROR(dctl_logger, DHCP_DDNS_FORWARD_REPLACE_IO_ERROR)
+            LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_REPLACE_IO_ERROR)
+                      .arg(getRequestId())
                       .arg(getNcr()->getFqdn())
                       .arg(getCurrentServer()->toText());
 
@@ -373,7 +381,8 @@ NameAddTransaction::replacingFwdAddrsHandler() {
         case DNSClient::INVALID_RESPONSE:
             // A response was received but was corrupt. Retry it like an IO
             // error.
-            LOG_ERROR(dctl_logger, DHCP_DDNS_FORWARD_REPLACE_RESP_CORRUPT)
+            LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_REPLACE_RESP_CORRUPT)
+                      .arg(getRequestId())
                       .arg(getCurrentServer()->toText())
                       .arg(getNcr()->getFqdn());
 
@@ -385,8 +394,9 @@ NameAddTransaction::replacingFwdAddrsHandler() {
         default:
             // Any other value and we will fail this transaction, something
             // bigger is wrong.
-            LOG_ERROR(dctl_logger,
+            LOG_ERROR(d2_to_dns_logger,
                       DHCP_DDNS_FORWARD_REPLACE_BAD_DNSCLIENT_STATUS)
+                      .arg(getRequestId())
                       .arg(getDnsUpdateStatus())
                       .arg(getNcr()->getFqdn())
                       .arg(getCurrentServer()->toText());
@@ -453,7 +463,8 @@ NameAddTransaction::replacingRevPtrsHandler() {
                 // 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)
+                LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_REVERSE_REPLACE_BUILD_FAILURE)
+                          .arg(getRequestId())
                           .arg(getNcr()->toText())
                           .arg(ex.what());
                 transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
@@ -479,7 +490,8 @@ NameAddTransaction::replacingRevPtrsHandler() {
                 // Per RFC4703 any other value means cease.
                 // If we get not authorized should try the next server in
                 // the list? @todo  This needs some discussion perhaps.
-                LOG_ERROR(dctl_logger, DHCP_DDNS_REVERSE_REPLACE_REJECTED)
+                LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_REVERSE_REPLACE_REJECTED)
+                          .arg(getRequestId())
                           .arg(getCurrentServer()->toText())
                           .arg(getNcr()->getFqdn())
                           .arg(rcode.getCode());
@@ -495,7 +507,8 @@ NameAddTransaction::replacingRevPtrsHandler() {
             // to select the next server for a retry.
             // @note For now we treat OTHER as an IO error like TIMEOUT. It
             // is not entirely clear if this is accurate.
-            LOG_ERROR(dctl_logger, DHCP_DDNS_REVERSE_REPLACE_IO_ERROR)
+            LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_REVERSE_REPLACE_IO_ERROR)
+                      .arg(getRequestId())
                       .arg(getNcr()->getFqdn())
                       .arg(getCurrentServer()->toText());
 
@@ -507,7 +520,8 @@ NameAddTransaction::replacingRevPtrsHandler() {
         case DNSClient::INVALID_RESPONSE:
             // A response was received but was corrupt. Retry it like an IO
             // error.
-            LOG_ERROR(dctl_logger, DHCP_DDNS_REVERSE_REPLACE_RESP_CORRUPT)
+            LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_REVERSE_REPLACE_RESP_CORRUPT)
+                      .arg(getRequestId())
                       .arg(getCurrentServer()->toText())
                       .arg(getNcr()->getFqdn());
 
@@ -519,8 +533,9 @@ NameAddTransaction::replacingRevPtrsHandler() {
         default:
             // Any other value and we will fail this transaction, something
             // bigger is wrong.
-            LOG_ERROR(dctl_logger,
+            LOG_ERROR(d2_to_dns_logger,
                       DHCP_DDNS_REVERSE_REPLACE_BAD_DNSCLIENT_STATUS)
+                      .arg(getRequestId())
                       .arg(getDnsUpdateStatus())
                       .arg(getNcr()->getFqdn())
                       .arg(getCurrentServer()->toText());
@@ -543,8 +558,9 @@ void
 NameAddTransaction::processAddOkHandler() {
     switch(getNextEvent()) {
     case UPDATE_OK_EVT:
-        LOG_INFO(dctl_logger, DHCP_DDNS_ADD_SUCCEEDED)
-                  .arg(getNcr()->toText());
+        LOG_INFO(d2_to_dns_logger, DHCP_DDNS_ADD_SUCCEEDED)
+                 .arg(getRequestId())
+                 .arg(getNcr()->toText());
         setNcrStatus(dhcp_ddns::ST_COMPLETED);
         endModel();
         break;
@@ -561,7 +577,8 @@ NameAddTransaction::processAddFailedHandler() {
     case UPDATE_FAILED_EVT:
     case NO_MORE_SERVERS_EVT:
         setNcrStatus(dhcp_ddns::ST_FAILED);
-        LOG_ERROR(dctl_logger, DHCP_DDNS_ADD_FAILED)
+        LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_ADD_FAILED)
+                  .arg(getRequestId())
                   .arg(transactionOutcomeString());
         endModel();
         break;

+ 34 - 17
src/bin/d2/nc_remove.cc

@@ -200,8 +200,9 @@ NameRemoveTransaction::removingFwdAddrsHandler() {
                 // 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,
+                LOG_ERROR(d2_to_dns_logger,
                           DHCP_DDNS_FORWARD_REMOVE_ADDRS_BUILD_FAILURE)
+                          .arg(getRequestId())
                           .arg(getNcr()->toText())
                           .arg(ex.what());
                 transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
@@ -230,7 +231,8 @@ NameRemoveTransaction::removingFwdAddrsHandler() {
                 // Per RFC4703 any other value means cease.
                 // If we get not authorized should we try the next server in
                 // the list? @todo  This needs some discussion perhaps.
-                LOG_ERROR(dctl_logger, DHCP_DDNS_FORWARD_REMOVE_ADDRS_REJECTED)
+                LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_REMOVE_ADDRS_REJECTED)
+                          .arg(getRequestId())
                           .arg(getCurrentServer()->toText())
                           .arg(getNcr()->getFqdn())
                           .arg(rcode.getCode());
@@ -246,7 +248,8 @@ NameRemoveTransaction::removingFwdAddrsHandler() {
             // to select the next server for a retry.
             // @note For now we treat OTHER as an IO error like TIMEOUT. It
             // is not entirely clear if this is accurate.
-            LOG_ERROR(dctl_logger, DHCP_DDNS_FORWARD_REMOVE_ADDRS_IO_ERROR)
+            LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_REMOVE_ADDRS_IO_ERROR)
+                      .arg(getRequestId())
                       .arg(getNcr()->getFqdn())
                       .arg(getCurrentServer()->toText());
 
@@ -256,7 +259,8 @@ NameRemoveTransaction::removingFwdAddrsHandler() {
         case DNSClient::INVALID_RESPONSE:
             // A response was received but was corrupt. Retry it like an IO
             // error.
-            LOG_ERROR(dctl_logger, DHCP_DDNS_FORWARD_REMOVE_ADDRS_RESP_CORRUPT)
+            LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_REMOVE_ADDRS_RESP_CORRUPT)
+                      .arg(getRequestId())
                       .arg(getCurrentServer()->toText())
                       .arg(getNcr()->getFqdn());
 
@@ -266,8 +270,9 @@ NameRemoveTransaction::removingFwdAddrsHandler() {
         default:
             // Any other value and we will fail this transaction, something
             // bigger is wrong.
-            LOG_ERROR(dctl_logger,
+            LOG_ERROR(d2_to_dns_logger,
                       DHCP_DDNS_FORWARD_REMOVE_ADDRS_BAD_DNSCLIENT_STATUS)
+                      .arg(getRequestId())
                       .arg(getDnsUpdateStatus())
                       .arg(getNcr()->getFqdn())
                       .arg(getCurrentServer()->toText());
@@ -306,8 +311,9 @@ NameRemoveTransaction::removingFwdRRsHandler() {
                 // 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,
+                LOG_ERROR(d2_to_dns_logger,
                           DHCP_DDNS_FORWARD_REMOVE_RRS_BUILD_FAILURE)
+                          .arg(getRequestId())
                           .arg(getNcr()->toText())
                           .arg(ex.what());
                 transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
@@ -345,7 +351,8 @@ NameRemoveTransaction::removingFwdRRsHandler() {
                 // Per RFC4703 any other value means cease.
                 // If we get not authorized should try the next server in
                 // the list? @todo  This needs some discussion perhaps.
-                LOG_ERROR(dctl_logger, DHCP_DDNS_FORWARD_REMOVE_RRS_REJECTED)
+                LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_REMOVE_RRS_REJECTED)
+                          .arg(getRequestId())
                           .arg(getCurrentServer()->toText())
                           .arg(getNcr()->getFqdn())
                           .arg(rcode.getCode());
@@ -361,7 +368,8 @@ NameRemoveTransaction::removingFwdRRsHandler() {
             // to select the next server for a retry.
             // @note For now we treat OTHER as an IO error like TIMEOUT. It
             // is not entirely clear if this is accurate.
-            LOG_ERROR(dctl_logger, DHCP_DDNS_FORWARD_REMOVE_RRS_IO_ERROR)
+            LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_REMOVE_RRS_IO_ERROR)
+                      .arg(getRequestId())
                       .arg(getNcr()->getFqdn())
                       .arg(getCurrentServer()->toText());
 
@@ -379,7 +387,8 @@ NameRemoveTransaction::removingFwdRRsHandler() {
         case DNSClient::INVALID_RESPONSE:
             // A response was received but was corrupt. Retry it like an IO
             // error.
-            LOG_ERROR(dctl_logger, DHCP_DDNS_FORWARD_REMOVE_RRS_RESP_CORRUPT)
+            LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_REMOVE_RRS_RESP_CORRUPT)
+                      .arg(getRequestId())
                       .arg(getCurrentServer()->toText())
                       .arg(getNcr()->getFqdn());
 
@@ -391,8 +400,9 @@ NameRemoveTransaction::removingFwdRRsHandler() {
         default:
             // Any other value and we will fail this transaction, something
             // bigger is wrong.
-            LOG_ERROR(dctl_logger,
+            LOG_ERROR(d2_to_dns_logger,
                       DHCP_DDNS_FORWARD_REMOVE_RRS_BAD_DNSCLIENT_STATUS)
+                      .arg(getRequestId())
                       .arg(getDnsUpdateStatus())
                       .arg(getNcr()->getFqdn())
                       .arg(getCurrentServer()->toText());
@@ -460,7 +470,8 @@ NameRemoveTransaction::removingRevPtrsHandler() {
                 // 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_REMOVE_BUILD_FAILURE)
+                LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_REVERSE_REMOVE_BUILD_FAILURE)
+                          .arg(getRequestId())
                           .arg(getNcr()->toText())
                           .arg(ex.what());
                 transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
@@ -491,7 +502,8 @@ NameRemoveTransaction::removingRevPtrsHandler() {
                 // Per RFC4703 any other value means cease.
                 // If we get not authorized should try the next server in
                 // the list? @todo  This needs some discussion perhaps.
-                LOG_ERROR(dctl_logger, DHCP_DDNS_REVERSE_REMOVE_REJECTED)
+                LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_REVERSE_REMOVE_REJECTED)
+                          .arg(getRequestId())
                           .arg(getCurrentServer()->toText())
                           .arg(getNcr()->getFqdn())
                           .arg(rcode.getCode());
@@ -507,7 +519,8 @@ NameRemoveTransaction::removingRevPtrsHandler() {
             // to select the next server for a retry.
             // @note For now we treat OTHER as an IO error like TIMEOUT. It
             // is not entirely clear if this is accurate.
-            LOG_ERROR(dctl_logger, DHCP_DDNS_REVERSE_REMOVE_IO_ERROR)
+            LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_REVERSE_REMOVE_IO_ERROR)
+                      .arg(getRequestId())
                       .arg(getNcr()->getFqdn())
                       .arg(getCurrentServer()->toText());
 
@@ -519,7 +532,8 @@ NameRemoveTransaction::removingRevPtrsHandler() {
         case DNSClient::INVALID_RESPONSE:
             // A response was received but was corrupt. Retry it like an IO
             // error.
-            LOG_ERROR(dctl_logger, DHCP_DDNS_REVERSE_REMOVE_RESP_CORRUPT)
+            LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_REVERSE_REMOVE_RESP_CORRUPT)
+                      .arg(getRequestId())
                       .arg(getCurrentServer()->toText())
                       .arg(getNcr()->getFqdn());
 
@@ -531,8 +545,9 @@ NameRemoveTransaction::removingRevPtrsHandler() {
         default:
             // Any other value and we will fail this transaction, something
             // bigger is wrong.
-            LOG_ERROR(dctl_logger,
+            LOG_ERROR(d2_to_dns_logger,
                       DHCP_DDNS_REVERSE_REMOVE_BAD_DNSCLIENT_STATUS)
+                      .arg(getRequestId())
                       .arg(getDnsUpdateStatus())
                       .arg(getNcr()->getFqdn())
                       .arg(getCurrentServer()->toText());
@@ -556,7 +571,8 @@ void
 NameRemoveTransaction::processRemoveOkHandler() {
     switch(getNextEvent()) {
     case UPDATE_OK_EVT:
-        LOG_INFO(dctl_logger, DHCP_DDNS_REMOVE_SUCCEEDED)
+        LOG_INFO(d2_to_dns_logger, DHCP_DDNS_REMOVE_SUCCEEDED)
+                .arg(getRequestId())
                 .arg(getNcr()->toText());
         setNcrStatus(dhcp_ddns::ST_COMPLETED);
         endModel();
@@ -575,7 +591,8 @@ NameRemoveTransaction::processRemoveFailedHandler() {
     case NO_MORE_SERVERS_EVT:
     case SERVER_IO_ERROR_EVT:
         setNcrStatus(dhcp_ddns::ST_FAILED);
-        LOG_ERROR(dctl_logger, DHCP_DDNS_REMOVE_FAILED)
+        LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_REMOVE_FAILED)
+                  .arg(getRequestId())
                   .arg(transactionOutcomeString());
         endModel();
         break;

+ 17 - 9
src/bin/d2/nc_trans.cc

@@ -89,9 +89,9 @@ NameChangeTransaction::~NameChangeTransaction(){
 
 void
 NameChangeTransaction::startTransaction() {
-    LOG_DEBUG(dctl_logger, DBGLVL_TRACE_DETAIL,
+    LOG_DEBUG(d2_to_dns_logger, DBGLVL_TRACE_DETAIL,
               DHCP_DDNS_STARTING_TRANSACTION)
-              .arg(getTransactionKey().toStr());
+              .arg(getRequestId());
 
     setNcrStatus(dhcp_ddns::ST_PENDING);
     startModel(READY_ST);
@@ -104,9 +104,9 @@ NameChangeTransaction::operator()(DNSClient::Status status) {
     // runModel is exception safe so we are good to call it here.
     // It won't exit until we hit the next IO wait or the state model ends.
     setDnsUpdateStatus(status);
-    LOG_DEBUG(dctl_logger, DBGLVL_TRACE_DETAIL,
+    LOG_DEBUG(d2_to_dns_logger, DBGLVL_TRACE_DETAIL,
               DHCP_DDNS_UPDATE_RESPONSE_RECEIVED)
-              .arg(getTransactionKey().toStr())
+              .arg(getRequestId())
               .arg(current_server_->toText())
               .arg(responseString());
 
@@ -183,10 +183,10 @@ NameChangeTransaction::sendUpdate(const std::string& comment) {
                               d2_params->getDnsServerTimeout(), tsig_key_);
         // Message is on its way, so the next event should be NOP_EVT.
         postNextEvent(NOP_EVT);
-        LOG_DEBUG(dctl_logger, DBGLVL_TRACE_DETAIL,
+        LOG_DEBUG(d2_to_dns_logger, DBGLVL_TRACE_DETAIL,
                   DHCP_DDNS_UPDATE_REQUEST_SENT)
+                  .arg(getRequestId())  
                   .arg(comment)
-                  .arg(getTransactionKey().toStr())
                   .arg(current_server_->toText());
     } catch (const std::exception& ex) {
         // We were unable to initiate the send.
@@ -197,7 +197,9 @@ NameChangeTransaction::sendUpdate(const std::string& comment) {
         // 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.
-        LOG_ERROR(dctl_logger, DHCP_DDNS_TRANS_SEND_ERROR).arg(ex.what());
+        LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_TRANS_SEND_ERROR)
+                  .arg(getRequestId())  
+                  .arg(ex.what());
         transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
     }
 }
@@ -256,8 +258,9 @@ NameChangeTransaction::verifyStates() {
 void
 NameChangeTransaction::onModelFailure(const std::string& explanation) {
     setNcrStatus(dhcp_ddns::ST_FAILED);
-    LOG_ERROR(dctl_logger, DHCP_DDNS_STATE_MODEL_UNEXPECTED_ERROR)
-                  .arg(explanation);
+    LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_STATE_MODEL_UNEXPECTED_ERROR)
+              .arg(getRequestId())
+              .arg(explanation);
 }
 
 void
@@ -403,6 +406,11 @@ NameChangeTransaction::getTransactionKey() const {
     return (ncr_->getDhcid());
 }
 
+std::string
+NameChangeTransaction::getRequestId() const {
+    return (ncr_->getRequestId());
+}
+
 dhcp_ddns::NameChangeStatus
 NameChangeTransaction::getNcrStatus() const {
     return (ncr_->getStatus());

+ 8 - 0
src/bin/d2/nc_trans.h

@@ -439,6 +439,14 @@ public:
     /// @return A const reference to the TransactionKey.
     const TransactionKey& getTransactionKey() const;
 
+    /// @brief Fetches the request id that identifies this transaction.
+    ///
+    /// This is a wrapper around getRequestID which currently returns DHCID
+    /// in the future we may include a distinct request id.
+    ///
+    /// @return a string with the the request's request ID (currently DHCID)
+    std::string getRequestId() const;
+
     /// @brief Fetches the NameChangeRequest status of the transaction.
     ///
     /// This is the current status of the NameChangeRequest, not to

+ 2 - 2
src/bin/d2/state_model.h

@@ -1,4 +1,4 @@
-// Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013, 2015 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
@@ -184,7 +184,7 @@ public:
 /// This loop is implemented in the runModel method.  This method accepts an
 /// event as argument which it "posts" as the next event.  It then retrieves the
 /// handler for the current state from the handler map and invokes it. runModel
-/// repeats this process until it either a NOP_EVT posts or the state changes
+/// repeats this process until either a NOP_EVT posts or the state changes
 /// to END_ST.  In other words each invocation of runModel causes the model to
 /// be traversed from the current state until it must wait or ends.
 ///

+ 3 - 0
src/bin/d2/tests/nc_trans_unittests.cc

@@ -464,6 +464,9 @@ TEST_F(NameChangeTransactionTest, accessors) {
     // Verify that getTransactionKey works.
     EXPECT_EQ(ncr->getDhcid(), name_change->getTransactionKey());
 
+    // Verify that getRequestId works.
+    EXPECT_EQ(ncr->getRequestId(), name_change->getRequestId());
+
     // Verify that NcrStatus can be set and retrieved.
     EXPECT_NO_THROW(name_change->setNcrStatus(dhcp_ddns::ST_FAILED));
     EXPECT_EQ(dhcp_ddns::ST_FAILED, ncr->getStatus());

+ 3 - 3
src/lib/dhcp_ddns/ncr_io.h

@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2015 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
@@ -48,7 +48,7 @@
 ///   class, NameChangeListener.
 ///
 ///    * senders - sends NCRs to a given target.  DHCP servers are senders.
-///   Senders are embodied by the class, NameChangeListener.
+///   Senders are embodied by the class, NameChangeSender.
 ///
 /// These two classes present a public interface for asynchronous
 /// communications that is independent of the IO layer mechanisms.  While the
@@ -393,7 +393,7 @@ public:
 /// It implements the high level logic flow to queue requests for delivery,
 /// and ship them one at a time, waiting for the send to complete prior to
 /// sending the next request in the queue.  If a send fails, the request
-/// will remain at the front of queue and will be the send will be retried
+/// will remain at the front of queue and the send will be retried
 /// endlessly unless the caller dequeues the request.  Note, it is presumed that
 /// a send failure is some form of IO error such as loss of connectivity and
 /// not a message content error.  It should not be possible to queue an invalid

+ 13 - 1
src/lib/dhcp_ddns/ncr_msg.h

@@ -1,4 +1,4 @@
-// Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013, 2015 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
@@ -583,6 +583,18 @@ public:
     /// or there is an odd number of digits.
     void setDhcid(isc::data::ConstElementPtr element);
 
+    /// @brief Fetches the request ID.
+    ///
+    /// @todo Currently this is the DHCID, in the future we may add a unique ID per
+    /// request to allow for correlating messages and events between the DHCP servers
+    /// and the D2 server.  If we do that we shall also need to add or update other
+    /// functions to: set the request ID, add it to the JSON strings, etc.
+    ///
+    /// @return a string with the the request's request ID (currently DHCID)
+    std::string getRequestId() const {
+        return (dhcid_.toStr());
+    }
+
     /// @brief Fetches the request lease expiration
     ///
     /// @return the lease expiration as the number of seconds since

+ 5 - 1
src/lib/dhcp_ddns/tests/ncr_unittests.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2013  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013, 2015  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
@@ -490,6 +490,10 @@ TEST(NameChangeRequestTest, basicJsonTest) {
     // original input string.
     std::string json_str = ncr->toJSON();
     EXPECT_EQ(msg_str, json_str);
+
+    // Verify that the request ID matches the string from the DHCID.
+    std::string dhcid_str = "010203040A7F8E3D";
+    EXPECT_EQ(ncr->getRequestId(), dhcid_str);
 }
 
 /// @brief Tests a variety of invalid JSON message strings.