From f3410d8c59b49eff99048e7df8a1599e4eed59f6 Mon Sep 17 00:00:00 2001 From: Junxiao Shi Date: Tue, 5 Apr 2016 13:49:44 -0700 Subject: [PATCH] fw: use scope_prefix::LOCALHOST in Forwarder refs #3546 Change-Id: I10a05b642284e7466746cac121d13e7948ca8667 --- daemon/fw/forwarder.cpp | 8 +++----- daemon/fw/forwarder.hpp | 2 -- daemon/fw/pit-algorithm.cpp | 4 ++-- daemon/fw/pit-algorithm.hpp | 3 ++- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp index b575e3b5..612b3e22 100644 --- a/daemon/fw/forwarder.cpp +++ b/daemon/fw/forwarder.cpp @@ -36,8 +36,6 @@ NFD_LOG_INIT("Forwarder"); using fw::Strategy; -const Name Forwarder::LOCALHOST_NAME("ndn:/localhost"); - Forwarder::Forwarder() : m_faceTable(*this) , m_fib(m_nameTree) @@ -110,7 +108,7 @@ Forwarder::onIncomingInterest(Face& inFace, const Interest& interest) // /localhost scope control bool isViolatingLocalhost = inFace.getScope() == ndn::nfd::FACE_SCOPE_NON_LOCAL && - LOCALHOST_NAME.isPrefixOf(interest.getName()); + scope_prefix::LOCALHOST.isPrefixOf(interest.getName()); if (isViolatingLocalhost) { NFD_LOG_DEBUG("onIncomingInterest face=" << inFace.getId() << " interest=" << interest.getName() << " violates /localhost"); @@ -378,7 +376,7 @@ Forwarder::onIncomingData(Face& inFace, const Data& data) // /localhost scope control bool isViolatingLocalhost = inFace.getScope() == ndn::nfd::FACE_SCOPE_NON_LOCAL && - LOCALHOST_NAME.isPrefixOf(data.getName()); + scope_prefix::LOCALHOST.isPrefixOf(data.getName()); if (isViolatingLocalhost) { NFD_LOG_DEBUG("onIncomingData face=" << inFace.getId() << " data=" << data.getName() << " violates /localhost"); @@ -464,7 +462,7 @@ Forwarder::onOutgoingData(const Data& data, Face& outFace) // /localhost scope control bool isViolatingLocalhost = outFace.getScope() == ndn::nfd::FACE_SCOPE_NON_LOCAL && - LOCALHOST_NAME.isPrefixOf(data.getName()); + scope_prefix::LOCALHOST.isPrefixOf(data.getName()); if (isViolatingLocalhost) { NFD_LOG_DEBUG("onOutgoingData face=" << outFace.getId() << " data=" << data.getName() << " violates /localhost"); diff --git a/daemon/fw/forwarder.hpp b/daemon/fw/forwarder.hpp index bb3935cc..99838bb6 100644 --- a/daemon/fw/forwarder.hpp +++ b/daemon/fw/forwarder.hpp @@ -239,8 +239,6 @@ private: DeadNonceList m_deadNonceList; NetworkRegionTable m_networkRegionTable; - static const Name LOCALHOST_NAME; - // allow Strategy (base class) to enter pipelines friend class fw::Strategy; }; diff --git a/daemon/fw/pit-algorithm.cpp b/daemon/fw/pit-algorithm.cpp index ca54dfea..ecc8acd3 100644 --- a/daemon/fw/pit-algorithm.cpp +++ b/daemon/fw/pit-algorithm.cpp @@ -26,13 +26,13 @@ #include "pit-algorithm.hpp" namespace nfd { -namespace fw { - namespace scope_prefix { const Name LOCALHOST("ndn:/localhost"); const Name LOCALHOP("ndn:/localhop"); } // namespace scope_prefix +namespace fw { + bool violatesScope(const pit::Entry& pitEntry, const Face& outFace) { diff --git a/daemon/fw/pit-algorithm.hpp b/daemon/fw/pit-algorithm.hpp index c5732b86..f9013165 100644 --- a/daemon/fw/pit-algorithm.hpp +++ b/daemon/fw/pit-algorithm.hpp @@ -33,7 +33,6 @@ */ namespace nfd { -namespace fw { /** \brief contain Name prefix that affects namespace-based scope control * \sa http://redmine.named-data.net/projects/nfd/wiki/ScopeControl @@ -68,6 +67,8 @@ extern const Name LOCALHOP; } // namespace scope_prefix +namespace fw { + /** \brief determine whether forwarding the Interest in \p pitEntry to \p outFace would violate scope * \sa http://redmine.named-data.net/projects/nfd/wiki/ScopeControl */