fw: delete deprecated Strategy::sendInterest overload and violatesScope
refs #1756, #3841
Change-Id: Idd5fb5692435c864a0a9b140992e615b280243a3
diff --git a/daemon/fw/algorithm.cpp b/daemon/fw/algorithm.cpp
index 0eb9cce..320a92a 100644
--- a/daemon/fw/algorithm.cpp
+++ b/daemon/fw/algorithm.cpp
@@ -56,29 +56,6 @@
}
bool
-violatesScope(const pit::Entry& pitEntry, const Face& outFace)
-{
- if (outFace.getScope() == ndn::nfd::FACE_SCOPE_LOCAL) {
- return false;
- }
- BOOST_ASSERT(outFace.getScope() == ndn::nfd::FACE_SCOPE_NON_LOCAL);
-
- if (scope_prefix::LOCALHOST.isPrefixOf(pitEntry.getName())) {
- // face is non-local, violates localhost scope
- return true;
- }
-
- if (scope_prefix::LOCALHOP.isPrefixOf(pitEntry.getName())) {
- // face is non-local, violates localhop scope unless PIT entry has local in-record
- return std::none_of(pitEntry.in_begin(), pitEntry.in_end(),
- [] (const pit::InRecord& inRecord) { return inRecord.getFace().getScope() == ndn::nfd::FACE_SCOPE_LOCAL; });
- }
-
- // Name is not subject to scope control
- return false;
-}
-
-bool
canForwardToLegacy(const pit::Entry& pitEntry, const Face& face)
{
time::steady_clock::TimePoint now = time::steady_clock::now();
diff --git a/daemon/fw/algorithm.hpp b/daemon/fw/algorithm.hpp
index 88ad0b4..7e830e5 100644
--- a/daemon/fw/algorithm.hpp
+++ b/daemon/fw/algorithm.hpp
@@ -73,14 +73,6 @@
bool
wouldViolateScope(const Face& inFace, const Interest& interest, const Face& outFace);
-/** \brief determine whether forwarding the Interest in \p pitEntry to \p outFace would violate scope
- * \sa https://redmine.named-data.net/projects/nfd/wiki/ScopeControl
- * \deprecated use violatesScope(inFace, interest, outFace) instead
- */
-DEPRECATED(
-bool
-violatesScope(const pit::Entry& pitEntry, 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,
diff --git a/daemon/fw/strategy.cpp b/daemon/fw/strategy.cpp
index 5de2e75..218ce44 100644
--- a/daemon/fw/strategy.cpp
+++ b/daemon/fw/strategy.cpp
@@ -25,7 +25,6 @@
#include "strategy.hpp"
#include "forwarder.hpp"
-#include "algorithm.hpp"
#include "core/logger.hpp"
#include "core/random.hpp"
@@ -68,42 +67,6 @@
}
void
-Strategy::sendInterest(const shared_ptr<pit::Entry>& pitEntry, Face& outFace,
- bool wantNewNonce)
-{
- // scope control
- if (fw::violatesScope(*pitEntry, outFace)) {
- NFD_LOG_DEBUG("sendInterestLegacy face=" << outFace.getId() <<
- " interest=" << pitEntry->getName() << " violates scope");
- return;
- }
-
- // pick Interest
- // The outgoing Interest picked is the last incoming Interest that does not come from outFace.
- // If all in-records come from outFace, it's fine to pick that.
- // This happens when there's only one in-record that comes from outFace.
- // The legit use is for vehicular network; otherwise, strategy shouldn't send to the sole inFace.
- pit::InRecordCollection::iterator pickedInRecord = std::max_element(
- pitEntry->in_begin(), pitEntry->in_end(),
- [&outFace] (const pit::InRecord& a, const pit::InRecord& b) {
- bool isOutFaceA = &a.getFace() == &outFace;
- bool isOutFaceB = &b.getFace() == &outFace;
- return (isOutFaceA > isOutFaceB) ||
- (isOutFaceA == isOutFaceB && a.getLastRenewed() < b.getLastRenewed());
- });
- BOOST_ASSERT(pickedInRecord != pitEntry->in_end());
- auto interest = const_pointer_cast<Interest>(pickedInRecord->getInterest().shared_from_this());
-
- if (wantNewNonce) {
- interest = make_shared<Interest>(*interest);
- static std::uniform_int_distribution<uint32_t> dist;
- interest->setNonce(dist(getGlobalRng()));
- }
-
- this->sendInterest(pitEntry, outFace, *interest);
-}
-
-void
Strategy::sendNacks(const shared_ptr<pit::Entry>& pitEntry, const lp::NackHeader& header,
std::initializer_list<const Face*> exceptFaces)
{
diff --git a/daemon/fw/strategy.hpp b/daemon/fw/strategy.hpp
index 4346e78..f4ef3b1 100644
--- a/daemon/fw/strategy.hpp
+++ b/daemon/fw/strategy.hpp
@@ -140,18 +140,6 @@
m_forwarder.onOutgoingInterest(pitEntry, outFace, interest);
}
- /** \brief send Interest to outFace
- * \param pitEntry PIT entry
- * \param outFace face through which to send out the Interest
- * \param wantNewNonce if true, a new Nonce will be generated,
- * rather than reusing a Nonce from one of the PIT in-records
- * \deprecated use sendInterest(pitEntry, outFace, interest) instead
- */
- DEPRECATED(
- void
- sendInterest(const shared_ptr<pit::Entry>& pitEntry, Face& outFace,
- bool wantNewNonce = false));
-
/** \brief decide that a pending Interest cannot be forwarded
* \param pitEntry PIT entry
*
diff --git a/tests/daemon/fw/algorithm.t.cpp b/tests/daemon/fw/algorithm.t.cpp
index caebecc..0986d24 100644
--- a/tests/daemon/fw/algorithm.t.cpp
+++ b/tests/daemon/fw/algorithm.t.cpp
@@ -89,61 +89,6 @@
BOOST_AUTO_TEST_SUITE_END() // WouldViolateScope
-BOOST_FIXTURE_TEST_SUITE(ViolatesScope, ScopeControlFixture)
-
-BOOST_AUTO_TEST_CASE(Unrestricted)
-{
- shared_ptr<Interest> interest = makeInterest("ndn:/ieWRzDsCu");
- pit::Entry entry(*interest);
-
- entry.insertOrUpdateInRecord(*nonLocalFace1, *interest);
- BOOST_CHECK_EQUAL(violatesScope(entry, *nonLocalFace2), false);
- BOOST_CHECK_EQUAL(violatesScope(entry, *localFace4), false);
-}
-
-BOOST_AUTO_TEST_CASE(Localhost)
-{
- shared_ptr<Interest> interest = makeInterest("ndn:/localhost/5n1LzIt3");
- pit::Entry entry(*interest);
-
- entry.insertOrUpdateInRecord(*localFace3, *interest);
- BOOST_CHECK_EQUAL(violatesScope(entry, *nonLocalFace2), true);
- BOOST_CHECK_EQUAL(violatesScope(entry, *localFace4), false);
-}
-
-BOOST_AUTO_TEST_CASE(LocalhopFromLocal)
-{
- shared_ptr<Interest> interest = makeInterest("ndn:/localhop/YcIKWCRYJ");
- pit::Entry entry(*interest);
-
- entry.insertOrUpdateInRecord(*localFace3, *interest);
- BOOST_CHECK_EQUAL(violatesScope(entry, *nonLocalFace2), false);
- BOOST_CHECK_EQUAL(violatesScope(entry, *localFace4), false);
-}
-
-BOOST_AUTO_TEST_CASE(LocalhopFromNonLocal)
-{
- shared_ptr<Interest> interest = makeInterest("ndn:/localhop/x5uFr5IpqY");
- pit::Entry entry(*interest);
-
- entry.insertOrUpdateInRecord(*nonLocalFace1, *interest);
- BOOST_CHECK_EQUAL(violatesScope(entry, *nonLocalFace2), true);
- BOOST_CHECK_EQUAL(violatesScope(entry, *localFace4), false);
-}
-
-BOOST_AUTO_TEST_CASE(LocalhopFromLocalAndNonLocal)
-{
- shared_ptr<Interest> interest = makeInterest("ndn:/localhop/gNn2MJAXt");
- pit::Entry entry(*interest);
-
- entry.insertOrUpdateInRecord(*nonLocalFace1, *interest);
- entry.insertOrUpdateInRecord(*localFace3, *interest);
- BOOST_CHECK_EQUAL(violatesScope(entry, *nonLocalFace2), false);
- BOOST_CHECK_EQUAL(violatesScope(entry, *localFace4), false);
-}
-
-BOOST_AUTO_TEST_SUITE_END() // ViolatesScope
-
BOOST_AUTO_TEST_CASE(CanForwardToLegacy)
{
shared_ptr<Interest> interest = makeInterest("ndn:/WDsuBLIMG");