[ndnSIM] fw: Extend forwarding pipelines with beforeSatisfyInterest and beforeExpirePendingInterest signals
Change-Id: I7d8266c3c53b0b6ef791b90c9c93de216b459ad2
Refs: #2361, #2362
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index 300dbc8..bf1cb39 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -27,6 +27,7 @@
#include "core/logger.hpp"
#include "core/random.hpp"
#include "strategy.hpp"
+#include "face/null-face.hpp"
#include <boost/random/uniform_int_distribution.hpp>
namespace nfd {
@@ -43,8 +44,10 @@
, m_pit(m_nameTree)
, m_measurements(m_nameTree)
, m_strategyChoice(m_nameTree, fw::makeDefaultStrategy(*this))
+ , m_csFace(make_shared<NullFace>(FaceUri("contentstore://")))
{
fw::installStrategies(*this);
+ getFaceTable().addReserved(m_csFace, FACEID_CONTENT_STORE);
}
Forwarder::~Forwarder()
@@ -141,6 +144,10 @@
{
NFD_LOG_DEBUG("onContentStoreHit interest=" << interest.getName());
+ beforeSatisfyInterest(*pitEntry, *m_csFace, data);
+ this->dispatchToStrategy(pitEntry, bind(&Strategy::beforeSatisfyInterest, _1,
+ pitEntry, cref(*m_csFace), cref(data)));
+
const_pointer_cast<Data>(data.shared_from_this())->setIncomingFaceId(FACEID_CONTENT_STORE);
// XXX should we lookup PIT for other Interests that also match csMatch?
@@ -250,6 +257,7 @@
NFD_LOG_DEBUG("onInterestUnsatisfied interest=" << pitEntry->getName());
// invoke PIT unsatisfied callback
+ beforeExpirePendingInterest(*pitEntry);
this->dispatchToStrategy(pitEntry, bind(&Strategy::beforeExpirePendingInterest, _1,
pitEntry));
@@ -322,6 +330,7 @@
}
// invoke PIT satisfy callback
+ beforeSatisfyInterest(*pitEntry, inFace, data);
this->dispatchToStrategy(pitEntry, bind(&Strategy::beforeSatisfyInterest, _1,
pitEntry, cref(inFace), cref(data)));