summaryrefslogtreecommitdiffstats
path: root/src/lib/dhcpsrv/d2_client_cfg.cc
diff options
context:
space:
mode:
authorThomas Markwalder <tmark@isc.org>2016-04-06 17:41:38 +0200
committerThomas Markwalder <tmark@isc.org>2016-04-06 17:41:38 +0200
commit773659ff2359640392a4e6b0dc07cdbe792d4db3 (patch)
tree6459026b1362316bafa153ffe95cac42d9a74441 /src/lib/dhcpsrv/d2_client_cfg.cc
parent[4259] Updated admin guide and spec files (diff)
downloadkea-773659ff2359640392a4e6b0dc07cdbe792d4db3.tar.xz
kea-773659ff2359640392a4e6b0dc07cdbe792d4db3.zip
[4259] Addressed review comments
Moved string/enum conversion functions inside D2ClientConfig Changed underscores to hypens in replace-client-name values and changed all literal values to lower case. Fixed minor wording issues in admin guide and new log messages. Added commentary and extra error logging to unit tests Added test case for invalid value of replace-client-name
Diffstat (limited to 'src/lib/dhcpsrv/d2_client_cfg.cc')
-rw-r--r--src/lib/dhcpsrv/d2_client_cfg.cc24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/lib/dhcpsrv/d2_client_cfg.cc b/src/lib/dhcpsrv/d2_client_cfg.cc
index ef6f36ceb0..55df0be0bf 100644
--- a/src/lib/dhcpsrv/d2_client_cfg.cc
+++ b/src/lib/dhcpsrv/d2_client_cfg.cc
@@ -34,20 +34,21 @@ const char* D2ClientConfig::DFT_REPLACE_CLIENT_NAME_MODE = "NEVER";
const char* D2ClientConfig::DFT_GENERATED_PREFIX = "myhost";
-D2ClientConfig::ReplaceClientNameMode stringToReplaceClientNameMode(const std::string& mode_str) {
- if (boost::iequals(mode_str, "NEVER")) {
+D2ClientConfig::ReplaceClientNameMode
+D2ClientConfig::stringToReplaceClientNameMode(const std::string& mode_str) {
+ if (boost::iequals(mode_str, "never")) {
return (D2ClientConfig::RCM_NEVER);
}
- if (boost::iequals(mode_str, "ALWAYS")) {
+ if (boost::iequals(mode_str, "always")) {
return (D2ClientConfig::RCM_ALWAYS);
}
- if (boost::iequals(mode_str, "WHEN_PRESENT")) {
+ if (boost::iequals(mode_str, "when-present")) {
return (D2ClientConfig::RCM_WHEN_PRESENT);
}
- if (boost::iequals(mode_str, "WHEN_NOT_PRESENT")) {
+ if (boost::iequals(mode_str, "when-not-present")) {
return (D2ClientConfig::RCM_WHEN_NOT_PRESENT);
}
@@ -55,22 +56,23 @@ D2ClientConfig::ReplaceClientNameMode stringToReplaceClientNameMode(const std::s
"Invalid ReplaceClientNameMode: " << mode_str);
}
-std::string replaceClientNameModeToString(D2ClientConfig::ReplaceClientNameMode mode) {
+std::string
+D2ClientConfig::replaceClientNameModeToString(const ReplaceClientNameMode& mode) {
switch (mode) {
case D2ClientConfig::RCM_NEVER:
- return ("NEVER");
+ return ("never");
case D2ClientConfig::RCM_ALWAYS:
- return ("ALWAYS");
+ return ("always");
case D2ClientConfig::RCM_WHEN_PRESENT:
- return ("WHEN_PRESENT");
+ return ("when-present");
case D2ClientConfig::RCM_WHEN_NOT_PRESENT:
- return ("WHEN_NOT_PRESENT");
+ return ("when-not-present");
default:
break;
}
std::ostringstream stream;
- stream << "UNKNOWN(" << mode << ")";
+ stream << "unknown(" << mode << ")";
return (stream.str());
}