fw: remove best-route strategy version 1
Change-Id: I7e86d5c19c01db65a84fdc0f289e7534f0774f4e
diff --git a/daemon/fw/access-strategy.hpp b/daemon/fw/access-strategy.hpp
index a766239..d6688fc 100644
--- a/daemon/fw/access-strategy.hpp
+++ b/daemon/fw/access-strategy.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, Regents of the University of California,
+ * Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -34,7 +34,7 @@
namespace nfd {
namespace fw {
-/** \brief Access Router Strategy version 1
+/** \brief Access Router strategy
*
* This strategy is designed for the last hop on the NDN testbed,
* where each nexthop connects to a laptop, links are lossy, and FIB is mostly correct.
diff --git a/daemon/fw/algorithm.cpp b/daemon/fw/algorithm.cpp
index 7dada21..a5d692f 100644
--- a/daemon/fw/algorithm.cpp
+++ b/daemon/fw/algorithm.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, Regents of the University of California,
+ * Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -24,6 +24,7 @@
*/
#include "algorithm.hpp"
+#include "scope-prefix.hpp"
namespace nfd {
namespace fw {
@@ -50,30 +51,6 @@
return false;
}
-bool
-canForwardToLegacy(const pit::Entry& pitEntry, const Face& face)
-{
- time::steady_clock::TimePoint now = time::steady_clock::now();
-
- bool hasUnexpiredOutRecord = std::any_of(pitEntry.out_begin(), pitEntry.out_end(),
- [&face, &now] (const pit::OutRecord& outRecord) {
- return &outRecord.getFace() == &face && outRecord.getExpiry() >= now;
- });
- if (hasUnexpiredOutRecord) {
- return false;
- }
-
- bool hasUnexpiredOtherInRecord = std::any_of(pitEntry.in_begin(), pitEntry.in_end(),
- [&face, &now] (const pit::InRecord& inRecord) {
- return &inRecord.getFace() != &face && inRecord.getExpiry() >= now;
- });
- if (!hasUnexpiredOtherInRecord) {
- return false;
- }
-
- return true;
-}
-
int
findDuplicateNonce(const pit::Entry& pitEntry, Interest::Nonce nonce, const Face& face)
{
diff --git a/daemon/fw/algorithm.hpp b/daemon/fw/algorithm.hpp
index 8a6b849..b37d540 100644
--- a/daemon/fw/algorithm.hpp
+++ b/daemon/fw/algorithm.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, Regents of the University of California,
+ * Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -26,8 +26,7 @@
#ifndef NFD_DAEMON_FW_ALGORITHM_HPP
#define NFD_DAEMON_FW_ALGORITHM_HPP
-#include "fw/scope-prefix.hpp"
-#include "table/fib.hpp"
+#include "table/fib-entry.hpp"
#include "table/pit-entry.hpp"
/** \file
@@ -43,19 +42,6 @@
bool
wouldViolateScope(const Face& inFace, const Interest& interest, const Face& outFace);
-/** \brief decide whether Interest can be forwarded to face
- *
- * \return true if out-record of this face does not exist or has expired,
- * and there is an in-record not of this face
- *
- * \note This algorithm has a weakness that it does not permit consumer retransmissions
- * before out-record expires. Therefore, it's not recommended to use this function
- * in new strategies.
- * \todo find a better name for this function
- */
-bool
-canForwardToLegacy(const pit::Entry& pitEntry, const Face& face);
-
/** \brief indicates where duplicate Nonces are found
*/
enum DuplicateNonceWhere {
@@ -63,7 +49,7 @@
DUPLICATE_NONCE_IN_SAME = (1 << 0), ///< in-record of same face
DUPLICATE_NONCE_IN_OTHER = (1 << 1), ///< in-record of other face
DUPLICATE_NONCE_OUT_SAME = (1 << 2), ///< out-record of same face
- DUPLICATE_NONCE_OUT_OTHER = (1 << 3) ///< out-record of other face
+ DUPLICATE_NONCE_OUT_OTHER = (1 << 3), ///< out-record of other face
};
/** \brief determine whether \p pitEntry has duplicate Nonce \p nonce
diff --git a/daemon/fw/best-route-strategy.cpp b/daemon/fw/best-route-strategy.cpp
deleted file mode 100644
index 82a3f56..0000000
--- a/daemon/fw/best-route-strategy.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2014-2020, Regents of the University of California,
- * Arizona Board of Regents,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University,
- * Washington University in St. Louis,
- * Beijing Institute of Technology,
- * The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "best-route-strategy.hpp"
-#include "algorithm.hpp"
-
-namespace nfd {
-namespace fw {
-
-BestRouteStrategyBase::BestRouteStrategyBase(Forwarder& forwarder)
- : Strategy(forwarder)
-{
-}
-
-void
-BestRouteStrategyBase::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
- const shared_ptr<pit::Entry>& pitEntry)
-{
- if (hasPendingOutRecords(*pitEntry)) {
- // not a new Interest, don't forward
- return;
- }
-
- const fib::Entry& fibEntry = this->lookupFib(*pitEntry);
- for (const auto& nexthop : fibEntry.getNextHops()) {
- Face& outFace = nexthop.getFace();
- if (!wouldViolateScope(ingress.face, interest, outFace) &&
- canForwardToLegacy(*pitEntry, outFace)) {
- this->sendInterest(pitEntry, outFace, interest);
- return;
- }
- }
-
- this->rejectPendingInterest(pitEntry);
-}
-
-NFD_REGISTER_STRATEGY(BestRouteStrategy);
-
-BestRouteStrategy::BestRouteStrategy(Forwarder& forwarder, const Name& name)
- : BestRouteStrategyBase(forwarder)
-{
- ParsedInstanceName parsed = parseInstanceName(name);
- if (!parsed.parameters.empty()) {
- NDN_THROW(std::invalid_argument("BestRouteStrategy does not accept parameters"));
- }
- if (parsed.version && *parsed.version != getStrategyName()[-1].toVersion()) {
- NDN_THROW(std::invalid_argument(
- "BestRouteStrategy does not support version " + to_string(*parsed.version)));
- }
- this->setInstanceName(makeInstanceName(name, getStrategyName()));
-}
-
-const Name&
-BestRouteStrategy::getStrategyName()
-{
- static Name strategyName("/localhost/nfd/strategy/best-route/%FD%01");
- return strategyName;
-}
-
-} // namespace fw
-} // namespace nfd
diff --git a/daemon/fw/best-route-strategy.hpp b/daemon/fw/best-route-strategy.hpp
deleted file mode 100644
index 2c5be36..0000000
--- a/daemon/fw/best-route-strategy.hpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2014-2020, Regents of the University of California,
- * Arizona Board of Regents,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University,
- * Washington University in St. Louis,
- * Beijing Institute of Technology,
- * The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NFD_DAEMON_FW_BEST_ROUTE_STRATEGY_HPP
-#define NFD_DAEMON_FW_BEST_ROUTE_STRATEGY_HPP
-
-#include "strategy.hpp"
-
-namespace nfd {
-namespace fw {
-
-class BestRouteStrategyBase : public Strategy
-{
-public:
- void
- afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
- const shared_ptr<pit::Entry>& pitEntry) override;
-
-protected:
- BestRouteStrategyBase(Forwarder& forwarder);
-};
-
-/** \brief Best Route strategy version 1
- *
- * This strategy forwards a new Interest to the lowest-cost nexthop
- * that is not same as the downstream, and does not violate scope.
- * Subsequent similar Interests or consumer retransmissions are suppressed
- * until after InterestLifetime expiry.
- *
- * \note This strategy is superceded by Best Route strategy version 2,
- * which allows consumer retransmissions. This version is kept for
- * comparison purposes and is not recommended for general usage.
- */
-class BestRouteStrategy : public BestRouteStrategyBase
-{
-public:
- explicit
- BestRouteStrategy(Forwarder& forwarder, const Name& name = getStrategyName());
-
- static const Name&
- getStrategyName();
-};
-
-} // namespace fw
-} // namespace nfd
-
-#endif // NFD_DAEMON_FW_BEST_ROUTE_STRATEGY_HPP
diff --git a/daemon/fw/best-route-strategy2.hpp b/daemon/fw/best-route-strategy2.hpp
index 79c6c0d..438ecd8 100644
--- a/daemon/fw/best-route-strategy2.hpp
+++ b/daemon/fw/best-route-strategy2.hpp
@@ -33,7 +33,7 @@
namespace nfd {
namespace fw {
-/** \brief Best Route strategy version 4
+/** \brief Best Route strategy
*
* This strategy forwards a new Interest to the lowest-cost nexthop (except downstream).
* After that, if consumer retransmits the Interest (and is not suppressed according to
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index e5c0c20..387ac0d 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -27,6 +27,7 @@
#include "algorithm.hpp"
#include "best-route-strategy2.hpp"
+#include "scope-prefix.hpp"
#include "strategy.hpp"
#include "common/global.hpp"
#include "common/logger.hpp"