]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[4497] Added Pkt method checking if retrieved options are copied.
authorMarcin Siodelski <marcin@isc.org>
Mon, 4 Jul 2016 14:24:24 +0000 (16:24 +0200)
committerMarcin Siodelski <marcin@isc.org>
Fri, 8 Jul 2016 05:50:19 +0000 (07:50 +0200)
src/lib/dhcp/pkt.h
src/lib/dhcp/tests/pkt4_unittest.cc

index 1b234e92519ee465e2e68ec88c3e239ce10935c4..21632cc45d206b4c47e2f84e755f3be8ebe6dd6a 100644 (file)
@@ -307,6 +307,15 @@ public:
         copy_retrieved_options_ = copy;
     }
 
+    /// @brief Returns whether the copying of retrieved options is enabled.
+    ///
+    /// Also see @ref setCopyRetrievedOptions.
+    ///
+    /// @return true if retrieved options are copied.
+    bool isCopyRetrievedOptions() const {
+        return (copy_retrieved_options_);
+    }
+
     /// @brief Update packet timestamp.
     ///
     /// Updates packet timestamp. This method is invoked
index 2c61cfea08d2ac0875505a9308a56fdb8177f36a..45cb0d05293e3fc07234499a9831cb7dece8d27e 100644 (file)
@@ -625,6 +625,7 @@ TEST_F(Pkt4Test, setCopyRetrievedOptions) {
 
     // Now force copying the options when they are retrieved.
     pkt->setCopyRetrievedOptions(true);
+    EXPECT_TRUE(pkt->isCopyRetrievedOptions());
 
     // Option pointer returned must point to a new instance of option 2.
     OptionPtr option2_copy = pkt->getOption(2);
@@ -632,6 +633,7 @@ TEST_F(Pkt4Test, setCopyRetrievedOptions) {
 
     // Disable copying.
     pkt->setCopyRetrievedOptions(false);
+    EXPECT_FALSE(pkt->isCopyRetrievedOptions());
 
     // Expect that the original pointer is returned. This guarantees that
     // option1 wasn't affected by copying option 2.