]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[576-cb-cmds-empty-value-for-next-server-parameter-is-accepted-which-causes-misconfig...
authorFrancis Dupont <fdupont@isc.org>
Tue, 9 Jul 2019 09:38:15 +0000 (11:38 +0200)
committerFrancis Dupont <fdupont@isc.org>
Wed, 10 Jul 2019 08:01:47 +0000 (04:01 -0400)
src/lib/cc/element_value.h
src/lib/dhcpsrv/network.h

index 964fd0ee9293502b8d2435c8582864389ec2d0ec..ff48561f09604a2d02a2ce1c05e6910ddf84b388 100644 (file)
@@ -7,6 +7,7 @@
 #ifndef ELEMENT_VALUE_H
 #define ELEMENT_VALUE_H
 
+#include <asiolink/io_address.h>
 #include <cc/data.h>
 #include <string>
 
@@ -94,6 +95,22 @@ public:
     }
 };
 
+/// @brief The @c ElementValue specialization for IOAddress.
+template<>
+class ElementValue<asiolink::IOAddress> {
+public:
+
+    /// @brief Function operator extracting an @c Element value as
+    /// IOAddress.
+    ///
+    /// @note This does NOT support empty string value.
+    ///
+    /// @param el Element holding a value to be extracted.
+    asiolink::IOAddress operator()(ConstElementPtr el) const {
+        return (asiolink::IOAddress(el->stringValue()));
+    }
+};
+
 } // end of namespace isc::data
 } // end of namespace isc
 
index 0d795d6a9af3531c2484648f4524a0ba7e0e70b6..d526f30938bee04df2cee0a49a32be738231a689 100644 (file)
@@ -7,7 +7,6 @@
 #ifndef NETWORK_H
 #define NETWORK_H
 
-#include <asiolink/io_address.h>
 #include <cc/cfg_to_element.h>
 #include <cc/data.h>
 #include <cc/element_value.h>
 #include <functional>
 #include <string>
 
-namespace isc {
-namespace data {
-
-/// @brief The @c ElementValue specialization for IOAddress.
-template<>
-class ElementValue<asiolink::IOAddress> {
-public:
-
-    /// @brief Function operator extracting an @c Element value as string.
-    ///
-    /// @note This does NOT support empty string value.
-    ///
-    /// @param el Element holding a value to be extracted.
-    asiolink::IOAddress operator()(ConstElementPtr el) const {
-        return (asiolink::IOAddress(el->stringValue()));
-    }
-};
-
-} // end of namespace isc::data
-} // end of namespace isc
-
 namespace isc {
 namespace dhcp {
 
@@ -546,6 +524,14 @@ public:
 
 protected:
 
+    /// @brief Gets the optional callback function used to fetch globally
+    /// configured parameters.
+    ///
+    /// @return Pointer to the function.
+    FetchNetworkGlobalsFn getFetchGlobalsFn() const {
+        return (fetch_globals_fn_);
+    }
+
     /// @brief Returns a value of global configuration parameter with
     /// a given name.
     ///
@@ -591,6 +577,9 @@ protected:
     ///  - uses the string value of the parameter
     ///  - falls back when the value is empty
     ///
+    /// @note: use overloading vs specialization because full specialization
+    /// is not allowed in this scope.
+    ///
     /// @param property Value to be returned when it is specified or when
     /// no global value is found.
     /// @param global_name Name of the global parameter which value should
@@ -598,7 +587,7 @@ protected:
     ///
     /// @return Optional value fetched from the global level or the value
     /// of @c property.
-    template<> util::Optional<asiolink::IOAddress>
+    util::Optional<asiolink::IOAddress>
     getGlobalProperty(util::Optional<asiolink::IOAddress> property,
                       const std::string& global_name) const {
         if (!global_name.empty() && fetch_globals_fn_) {