diff options
Diffstat (limited to 'src/lib/dhcp_ddns/ncr_msg.cc')
-rw-r--r-- | src/lib/dhcp_ddns/ncr_msg.cc | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/lib/dhcp_ddns/ncr_msg.cc b/src/lib/dhcp_ddns/ncr_msg.cc index 418eaa0a1f..ae1816ff53 100644 --- a/src/lib/dhcp_ddns/ncr_msg.cc +++ b/src/lib/dhcp_ddns/ncr_msg.cc @@ -18,15 +18,36 @@ #include <asiolink/io_error.h> #include <cryptolink/cryptolink.h> +#include <boost/algorithm/string/predicate.hpp> #include <botan/sha2_32.h> #include <sstream> #include <limits> + namespace isc { namespace dhcp_ddns { +NameChangeFormat stringToNcrFormat(const std::string& fmt_str) { + if (boost::iequals(fmt_str, "JSON")) { + return FMT_JSON; + } + + isc_throw(BadValue, "Invalid NameChangeRequest format:" << fmt_str); +} + + +std::string ncrFormatToString(NameChangeFormat format) { + if (format == FMT_JSON) { + return ("JSON"); + } + + std::ostringstream stream; + stream << "UNKNOWN(" << format << ")"; + return (stream.str()); +} + /********************************* D2Dhcid ************************************/ namespace { @@ -590,7 +611,7 @@ NameChangeRequest::toText() const { << "Reverse Change: " << (reverse_change_ ? "yes" : "no") << std::endl << "FQDN: [" << fqdn_ << "]" << std::endl - << "IP Address: [" << ip_io_address_.toText() << "]" << std::endl + << "IP Address: [" << ip_io_address_ << "]" << std::endl << "DHCID: [" << dhcid_.toStr() << "]" << std::endl << "Lease Expires On: " << getLeaseExpiresOnStr() << std::endl << "Lease Length: " << lease_length_ << std::endl; |