]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[4081] Option::toString() and OptionString::toString() implemented.
authorTomek Mrugalski <tomasz@isc.org>
Mon, 26 Oct 2015 19:12:17 +0000 (20:12 +0100)
committerTomek Mrugalski <tomasz@isc.org>
Mon, 26 Oct 2015 19:12:17 +0000 (20:12 +0100)
src/lib/Makefile.am
src/lib/dhcp/option.cc
src/lib/dhcp/option.h
src/lib/dhcp/option_string.cc
src/lib/dhcp/option_string.h

index fc52cef7d9ac29c20b1a6541352f95a846de9c96..4b77fcb324ebab237ea6dc7e627e99b887f08532 100644 (file)
@@ -1,3 +1,3 @@
 # The following build order must be maintained.
 SUBDIRS = exceptions util log hooks cryptolink dns cc asiolink dhcp config stats \
-          asiodns testutils dhcp_ddns dhcpsrv cfgrpt
+          asiodns testutils dhcp_ddns dhcpsrv cfgrpt eval
index c74a16909b3f449a01214a9c741e1928a2c298fd..063884ad345a4c787e792c9254ec914f94c2aa0a 100644 (file)
@@ -213,6 +213,13 @@ std::string Option::toText(int indent) {
     return (output.str());
 }
 
+std::string
+Option::toString() {
+    /// @todo: Implement actual conversion in derived classes.
+    return (toText(0));
+}
+
+
 std::string
 Option::headerToText(const int indent, const std::string& type_name) {
     std::stringstream output;
index 1b3022a0b869120ca158978046e695268d6ec68d..ad622e89ee4f7e07d35bf3e5eb3cb9c182b37500 100644 (file)
@@ -206,6 +206,14 @@ public:
     /// @return string with text representation.
     virtual std::string toText(int indent = 0);
 
+    /// @brief Returns string representation of the value
+    ///
+    /// This is terse repesentation used in cases where client classification
+    /// refers to a specific option.
+    ///
+    /// @return string that represents the value of the option.
+    virtual std::string toString();
+
     /// Returns option type (0-255 for DHCPv4, 0-65535 for DHCPv6)
     ///
     /// @return option type
index 8c1d0d4d1473c7a96fa4dd29052bd07451b3b1cc..b1bc4bbf47b50a2701b6e8e3f536f9324983e746 100644 (file)
@@ -92,5 +92,10 @@ OptionString::toText(int indent) {
     return (output.str());
 }
 
+std::string
+OptionString::toString() {
+    return (getValue());
+}
+
 } // end of isc::dhcp namespace
 } // end of isc namespace
index 1b24b2dce14fe46df64bd650eb0131cba1ea6621..844d593ba662d639682c7cb825d614b6175ac412 100644 (file)
@@ -110,6 +110,12 @@ public:
     ///
     /// @return Option information in the textual format.
     virtual std::string toText(int indent = 0);
+
+    /// @brief Returns actual value of the option in string format.
+    ///
+    /// This method is used in client classification.
+    /// @return Content of the option.
+    virtual std::string toString();
 };
 
 /// Pointer to the OptionString object.