]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2844] addressed comments
authorRazvan Becheriu <razvan@isc.org>
Thu, 6 Jun 2024 09:11:01 +0000 (12:11 +0300)
committerRazvan Becheriu <razvan@isc.org>
Fri, 7 Jun 2024 09:59:27 +0000 (12:59 +0300)
src/lib/dhcp/option.cc
src/lib/dhcp/option_custom.cc
src/lib/dhcp/tests/pkt4_unittest.cc
src/lib/dhcp/tests/pkt6_unittest.cc

index b9974b10dc86ca6e275b91a34c3e7c92e5a83737..1b6fb639b34186094d6f7b41825a2ab6a76414d4 100644 (file)
@@ -236,11 +236,11 @@ std::string Option::toText(int indent) const {
         output << setfill('0') << setw(2) << hex
                << static_cast<unsigned short>(data_[i]);
     }
-    if (!data_.size()) {
-        output << "(no data)";
+    if (data_.empty()) {
+        output << "''";
     } else if (str::isPrintable(data_)) {
         std::string printable(data_.cbegin(), data_.cend());
-        output << " (" << printable << ")";
+        output << " '" << printable << "'";
     }
 
     // Append suboptions.
index acfc587b71da65281ab0d4f11a29247ca4854c76..d73b4efa16f9998cc5c60b8eedcdc0955b18b911 100644 (file)
@@ -403,12 +403,12 @@ OptionCustom::dataFieldToText(const OptionDataType data_type,
     {
         auto data = readBinary(index);
         if (data.empty()) {
-            text << "(no data)";
+            text << "''";
         } else {
             text << util::encode::encodeHex(data);
             if (str::isPrintable(data)) {
                 std::string printable(data.cbegin(), data.cend());
-                text << " (" << printable << ") ";
+                text << " '" << printable << "'";
             }
         }
         break;
index 45e2441dd6965e4c255228cfb57491ea0735cb14..4b953e507816fa0edf911d324ec3ae7fa76c43ab 100644 (file)
@@ -1301,10 +1301,10 @@ TEST_F(Pkt4Test, toText) {
               "  type=087, len=011: \"lorem ipsum\" (string)\n"
               "  type=123, len=004: 192.0.2.3\n"
               "  type=156, len=004: 123456 (uint32)\n"
-              "  type=231, len=021: 61:62:63:64:65:66 (abcdef),\n"
+              "  type=231, len=020: 61:62:63:64:65:66 'abcdef',\n"
               "options:\n"
-              "    type=001, len=011: 30:31:32:33:34:35:36:37:38:39 (0123456789)\n"
-              "    type=002, len=000: (no data)",
+              "    type=001, len=010: 30:31:32:33:34:35:36:37:38:39 '0123456789'\n"
+              "    type=002, len=000: ''",
               pkt.toText());
 
     // Now remove all options, including Message Type and check if the
index 6daf29ccaf3a1eff67b14e38ab6624067c7ca8c1..5bf739872e8a71ff4aeccf729561104b7d2b81da 100644 (file)
@@ -1297,12 +1297,12 @@ TEST_F(Pkt6Test, toText) {
         "2 relay(s):\n"
         "relay[0]: msg-type=12(RELAY_FORWARD), hop-count=1,\n"
         "link-address=2001:888:db8:1::, peer-address=fe80::200:21ff:fe5c:18a9, 2 option(s)\n"
-        "type=00018, len=00028: 49:53:41:4d:31:34:34:7c:32:39:39:7c:69:70:76:36:7c:6e:74:3a:76:70:3a:31:3a:31:31:30 (ISAM144|299|ipv6|nt:vp:1:110)\n"
+        "type=00018, len=00028: 49:53:41:4d:31:34:34:7c:32:39:39:7c:69:70:76:36:7c:6e:74:3a:76:70:3a:31:3a:31:31:30 'ISAM144|299|ipv6|nt:vp:1:110'\n"
         "type=00037, len=00018: 6527 (uint32) 0001000118B033410000215C18A9 (binary)\n"
         "relay[1]: msg-type=12(RELAY_FORWARD), hop-count=0,\n"
         "link-address=::, peer-address=fe80::200:21ff:fe5c:18a9, 2 option(s)\n"
-        "type=00018, len=00021: 49:53:41:4d:31:34:34:20:65:74:68:20:31:2f:31:2f:30:35:2f:30:31 (ISAM144 eth 1/1/05/01)\n"
-        "type=00037, len=00004: 3561 (uint32) (no data) (binary)\n";
+        "type=00018, len=00021: 49:53:41:4d:31:34:34:20:65:74:68:20:31:2f:31:2f:30:35:2f:30:31 'ISAM144 eth 1/1/05/01'\n"
+        "type=00037, len=00004: 3561 (uint32) '' (binary)\n";
 
     EXPECT_EQ(expected, msg->toText());
 }