Browse Source

[master] Finished merge of trac5126 (flat style)

Francis Dupont 7 years ago
parent
commit
63e8df70f1

+ 5 - 2
src/lib/cc/simple_parser.h

@@ -204,6 +204,7 @@ protected:
         }
     }
 
+public:
     /// @brief Returns a value converted to uint32_t
     ///
     /// Instantiation of getIntType() to uint32_t
@@ -212,7 +213,8 @@ protected:
     /// @param name name of the parameter
     /// @return an uint32_t value
     /// @throw isc::dhcp::DhcpConfigError when it is not an uint32_t
-    uint32_t getUint32(isc::data::ConstElementPtr scope, const std::string& name) {
+    uint32_t getUint32(isc::data::ConstElementPtr scope,
+                       const std::string& name) {
         return (getIntType<uint32_t>(scope, name));
     }
 
@@ -224,7 +226,8 @@ protected:
     /// @param name name of the parameter
     /// @return an uint16_t value
     /// @throw isc::dhcp::DhcpConfigError when it is not an uint16_t
-    uint16_t getUint16(isc::data::ConstElementPtr scope, const std::string& name) {
+    uint16_t getUint16(isc::data::ConstElementPtr scope,
+                       const std::string& name) {
         return (getIntType<uint16_t>(scope, name));
     }
 

+ 0 - 4
src/lib/cc/tests/simple_parser_unittest.cc

@@ -58,10 +58,6 @@ public:
 
 class SimpleParserClassTest : public SimpleParser {
 public:
-
-    /// Make getUint8 public
-    using SimpleParser::getUint8;
-
     /// @brief Instantiation of getAndConvert
     ///
     /// @param scope specified parameter will be extracted from this scope

+ 3 - 5
src/lib/dhcpsrv/parsers/client_class_def_parser.cc

@@ -103,15 +103,13 @@ ClientClassDefParser::parse(ClientClassDictionaryPtr& class_dictionary,
 
         if (next_server.getFamily() != AF_INET) {
             isc_throw(DhcpConfigError, "Invalid next-server value: '"
-                      << next_server_txt
-                      << "', must be IPv4 address ("
+                      << next_server_txt << "', must be IPv4 address ("
                       << getPosition("next-server", class_def_cfg) << ")");
         }
 
         if (next_server.isV4Bcast()) {
             isc_throw(DhcpConfigError, "Invalid next-server value: '"
-                      << next_server_txt
-                      << "', must not be a broadcast ("
+                      << next_server_txt << "', must not be a broadcast ("
                       << getPosition("next-server", class_def_cfg) << ")");
         }
     }
@@ -148,7 +146,7 @@ ClientClassDefParser::parse(ClientClassDictionaryPtr& class_dictionary,
         class_dictionary->addClass(name, match_expr, test, options,
                                    next_server, sname, filename);
     } catch (const std::exception& ex) {
-        isc_throw(DhcpConfigError, ex.what()
+        isc_throw(DhcpConfigError, "Can't add class: " << ex.what()
                   << " (" << class_def_cfg->getPosition() << ")");
     }
 }

+ 3 - 0
src/lib/dhcpsrv/parsers/duid_config_parser.cc

@@ -26,6 +26,9 @@ namespace dhcp {
 void
 DUIDConfigParser::parse(const CfgDUIDPtr& cfg,
                         isc::data::ConstElementPtr duid_configuration) {
+    if (!cfg) {
+        isc_throw(DhcpConfigError, "Must provide valid pointer to cfg when parsing duid");
+    }
 
     std::string param;
     try {