fw: rename RetransmissionSuppression to RetxSuppressionFixed

This commit also declares RetxSuppression base class as the API
for any retransmission suppression decision algorithms,
so that other algorithms can be introduced.

refs #1913

Change-Id: I5539565d2dd238d1421f5bd828fde4ecfba0a820
diff --git a/tests/daemon/fw/best-route-strategy2.cpp b/tests/daemon/fw/best-route-strategy2.cpp
index 687bfcb..5357bc8 100644
--- a/tests/daemon/fw/best-route-strategy2.cpp
+++ b/tests/daemon/fw/best-route-strategy2.cpp
@@ -62,13 +62,13 @@
   shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
 
   const time::nanoseconds TICK = time::duration_cast<time::nanoseconds>(
-    fw::RetransmissionSuppression::MIN_RETRANSMISSION_INTERVAL * 0.01);
+    fw::RetxSuppressionFixed::DEFAULT_MIN_RETX_INTERVAL * 0.01);
   const time::nanoseconds RETRANSMISSION_10P = time::duration_cast<time::nanoseconds>(
-    fw::RetransmissionSuppression::MIN_RETRANSMISSION_INTERVAL * 0.1); // 10%
+    fw::RetxSuppressionFixed::DEFAULT_MIN_RETX_INTERVAL * 0.1); // 10%
   const time::nanoseconds RETRANSMISSION_70P = time::duration_cast<time::nanoseconds>(
-    fw::RetransmissionSuppression::MIN_RETRANSMISSION_INTERVAL * 0.7); // 70%
+    fw::RetxSuppressionFixed::DEFAULT_MIN_RETX_INTERVAL * 0.7); // 70%
   const time::nanoseconds RETRANSMISSION_2 = time::duration_cast<time::nanoseconds>(
-    fw::RetransmissionSuppression::MIN_RETRANSMISSION_INTERVAL * 2.0); // x2
+    fw::RetxSuppressionFixed::DEFAULT_MIN_RETX_INTERVAL * 2.0); // x2
 
   // first Interest goes to nexthop with lowest FIB cost,
   // however face1 is downstream so it cannot be used
@@ -78,7 +78,7 @@
   BOOST_CHECK_EQUAL(strategy.m_sendInterestHistory.back().get<1>(), face2);
 
   // downstream retransmits frequently, but the strategy should not send Interests
-  // more often than MIN_RETRANSMISSION_INTERVAL
+  // more often than DEFAULT_MIN_RETX_INTERVAL
   scheduler::EventId retxFrom4Evt;
   size_t nSentLast = strategy.m_sendInterestHistory.size();
   time::steady_clock::TimePoint timeSentLast = time::steady_clock::now();
@@ -99,7 +99,7 @@
     retxFrom4Evt = scheduler::schedule(RETRANSMISSION_10P, periodicalRetxFrom4);
   };
   periodicalRetxFrom4();
-  this->advanceClocks(TICK, fw::RetransmissionSuppression::MIN_RETRANSMISSION_INTERVAL * 16);
+  this->advanceClocks(TICK, fw::RetxSuppressionFixed::DEFAULT_MIN_RETX_INTERVAL * 16);
   scheduler::cancel(retxFrom4Evt);
 
   // nexthops for accepted retransmissions: follow FIB cost,
diff --git a/tests/daemon/fw/retransmission-suppression.cpp b/tests/daemon/fw/retx-suppression.cpp
similarity index 84%
rename from tests/daemon/fw/retransmission-suppression.cpp
rename to tests/daemon/fw/retx-suppression.cpp
index c1ba968..e4417ce 100644
--- a/tests/daemon/fw/retransmission-suppression.cpp
+++ b/tests/daemon/fw/retx-suppression.cpp
@@ -23,7 +23,8 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "fw/retransmission-suppression.hpp"
+#include "fw/retx-suppression.hpp"
+#include "fw/retx-suppression-fixed.hpp"
 #include "strategy-tester.hpp"
 
 #include "tests/test-common.hpp"
@@ -32,15 +33,17 @@
 namespace nfd {
 namespace tests {
 
-using fw::RetransmissionSuppression;
+using fw::RetxSuppression;
+using fw::RetxSuppressionFixed;
 
-BOOST_FIXTURE_TEST_SUITE(FwRetransmissionSuppression, UnitTestTimeFixture)
+BOOST_FIXTURE_TEST_SUITE(FwRetxSuppression, UnitTestTimeFixture)
 
-BOOST_AUTO_TEST_CASE(Basic)
+BOOST_AUTO_TEST_CASE(Fixed)
 {
   Forwarder forwarder;
   Pit& pit = forwarder.getPit();
-  RetransmissionSuppression rs;
+  static const time::milliseconds MIN_RETX_INTERVAL(200);
+  RetxSuppressionFixed rs(MIN_RETX_INTERVAL);
 
   shared_ptr<DummyFace> face1 = make_shared<DummyFace>();
   shared_ptr<DummyFace> face2 = make_shared<DummyFace>();
@@ -52,36 +55,36 @@
   shared_ptr<Interest> interest = makeInterest("ndn:/0JiimvmxK8");
   shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
 
-  const time::nanoseconds RETRANSMISSION_10P = time::duration_cast<time::nanoseconds>(
-    fw::RetransmissionSuppression::MIN_RETRANSMISSION_INTERVAL * 0.1);
+  const time::nanoseconds RETRANSMISSION_10P =
+      time::duration_cast<time::nanoseconds>(MIN_RETX_INTERVAL * 0.1);
 
   // @ time 0
   pitEntry->insertOrUpdateInRecord(face1, *interest);
-  BOOST_CHECK_EQUAL(rs.decide(*face1, *interest, *pitEntry), RetransmissionSuppression::NEW);
+  BOOST_CHECK_EQUAL(rs.decide(*face1, *interest, *pitEntry), RetxSuppression::NEW);
   pitEntry->insertOrUpdateOutRecord(face3, *interest);
 
   this->advanceClocks(RETRANSMISSION_10P, 5); // @ time 0.5 interval
   pitEntry->insertOrUpdateInRecord(face1, *interest);
-  BOOST_CHECK_EQUAL(rs.decide(*face1, *interest, *pitEntry), RetransmissionSuppression::SUPPRESS);
+  BOOST_CHECK_EQUAL(rs.decide(*face1, *interest, *pitEntry), RetxSuppression::SUPPRESS);
   pitEntry->insertOrUpdateInRecord(face2, *interest);
-  BOOST_CHECK_EQUAL(rs.decide(*face2, *interest, *pitEntry), RetransmissionSuppression::SUPPRESS);
+  BOOST_CHECK_EQUAL(rs.decide(*face2, *interest, *pitEntry), RetxSuppression::SUPPRESS);
 
   this->advanceClocks(RETRANSMISSION_10P, 6); // @ time 1.1 interval
   pitEntry->insertOrUpdateInRecord(face2, *interest);
-  BOOST_CHECK_EQUAL(rs.decide(*face2, *interest, *pitEntry), RetransmissionSuppression::FORWARD);
+  BOOST_CHECK_EQUAL(rs.decide(*face2, *interest, *pitEntry), RetxSuppression::FORWARD);
   // but strategy decides not to forward
 
   this->advanceClocks(RETRANSMISSION_10P, 1); // @ time 1.2 interval
   pitEntry->insertOrUpdateInRecord(face1, *interest);
-  BOOST_CHECK_EQUAL(rs.decide(*face1, *interest, *pitEntry), RetransmissionSuppression::FORWARD);
+  BOOST_CHECK_EQUAL(rs.decide(*face1, *interest, *pitEntry), RetxSuppression::FORWARD);
   // retransmission suppress shall still give clearance for forwarding
   pitEntry->insertOrUpdateOutRecord(face3, *interest); // and strategy forwards
 
   this->advanceClocks(RETRANSMISSION_10P, 2); // @ time 1.4 interval
   pitEntry->insertOrUpdateInRecord(face1, *interest);
-  BOOST_CHECK_EQUAL(rs.decide(*face1, *interest, *pitEntry), RetransmissionSuppression::SUPPRESS);
+  BOOST_CHECK_EQUAL(rs.decide(*face1, *interest, *pitEntry), RetxSuppression::SUPPRESS);
   pitEntry->insertOrUpdateInRecord(face2, *interest);
-  BOOST_CHECK_EQUAL(rs.decide(*face2, *interest, *pitEntry), RetransmissionSuppression::SUPPRESS);
+  BOOST_CHECK_EQUAL(rs.decide(*face2, *interest, *pitEntry), RetxSuppression::SUPPRESS);
 }
 
 BOOST_AUTO_TEST_SUITE_END()