fw: add FaceEndpoint parameter in Forwarding and Strategy API
refs: #4849
Change-Id: Ibe22557488fa83a555fd13d6eb8e03f8d81d0b2b
diff --git a/tests/daemon/fw/best-route-strategy2.t.cpp b/tests/daemon/fw/best-route-strategy2.t.cpp
index 933a431..80e2603 100644
--- a/tests/daemon/fw/best-route-strategy2.t.cpp
+++ b/tests/daemon/fw/best-route-strategy2.t.cpp
@@ -91,7 +91,7 @@
// first Interest goes to nexthop with lowest FIB cost,
// however face1 is downstream so it cannot be used
pitEntry->insertOrUpdateInRecord(*face1, 0, *interest);
- strategy.afterReceiveInterest(*face1, *interest, pitEntry);
+ strategy.afterReceiveInterest(FaceEndpoint(*face1, 0), *interest, pitEntry);
BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 1);
BOOST_CHECK_EQUAL(strategy.sendInterestHistory.back().outFaceId, face2->getId());
@@ -103,7 +103,7 @@
std::function<void()> periodicalRetxFrom4; // let periodicalRetxFrom4 lambda capture itself
periodicalRetxFrom4 = [&] {
pitEntry->insertOrUpdateInRecord(*face4, 0, *interest);
- strategy.afterReceiveInterest(*face4, *interest, pitEntry);
+ strategy.afterReceiveInterest(FaceEndpoint(*face4, 0), *interest, pitEntry);
size_t nSent = strategy.sendInterestHistory.size();
if (nSent > nSentLast) {
@@ -135,7 +135,7 @@
for (int i = 0; i < 3; ++i) {
this->advanceClocks(TICK, BestRouteStrategy2::RETX_SUPPRESSION_MAX * 2);
pitEntry->insertOrUpdateInRecord(*face5, 0, *interest);
- strategy.afterReceiveInterest(*face5, *interest, pitEntry);
+ strategy.afterReceiveInterest(FaceEndpoint(*face5, 0), *interest, pitEntry);
}
BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 3);
BOOST_CHECK_NE(strategy.sendInterestHistory[0].outFaceId, face1->getId());
diff --git a/tests/daemon/fw/dummy-strategy.cpp b/tests/daemon/fw/dummy-strategy.cpp
index 1dd79dd..4497ede 100644
--- a/tests/daemon/fw/dummy-strategy.cpp
+++ b/tests/daemon/fw/dummy-strategy.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018, Regents of the University of California,
+ * Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -54,13 +54,13 @@
}
void
-DummyStrategy::afterReceiveInterest(const Face& inFace, const Interest& interest,
+DummyStrategy::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
const shared_ptr<pit::Entry>& pitEntry)
{
++afterReceiveInterest_count;
if (interestOutFace != nullptr) {
- this->sendInterest(pitEntry, *interestOutFace, interest);
+ this->sendInterest(pitEntry, FaceEndpoint(*interestOutFace, 0), interest);
}
else {
this->rejectPendingInterest(pitEntry);
@@ -69,31 +69,31 @@
void
DummyStrategy::beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
- const Face& inFace, const Data& data)
+ const FaceEndpoint& ingress, const Data& data)
{
++beforeSatisfyInterest_count;
}
void
DummyStrategy::afterContentStoreHit(const shared_ptr<pit::Entry>& pitEntry,
- const Face& inFace, const Data& data)
+ const FaceEndpoint& ingress, const Data& data)
{
++afterContentStoreHit_count;
- Strategy::afterContentStoreHit(pitEntry, inFace, data);
+ Strategy::afterContentStoreHit(pitEntry, ingress, data);
}
void
DummyStrategy::afterReceiveData(const shared_ptr<pit::Entry>& pitEntry,
- const Face& inFace, const Data& data)
+ const FaceEndpoint& ingress, const Data& data)
{
++afterReceiveData_count;
- Strategy::afterReceiveData(pitEntry, inFace, data);
+ Strategy::afterReceiveData(pitEntry, ingress, data);
}
void
-DummyStrategy::afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+DummyStrategy::afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
const shared_ptr<pit::Entry>& pitEntry)
{
++afterReceiveNack_count;
diff --git a/tests/daemon/fw/dummy-strategy.hpp b/tests/daemon/fw/dummy-strategy.hpp
index 697d5ae..9a2445b 100644
--- a/tests/daemon/fw/dummy-strategy.hpp
+++ b/tests/daemon/fw/dummy-strategy.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018, Regents of the University of California,
+ * Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -37,6 +37,8 @@
*
* DummyStrategy registers itself as /dummy-strategy/<max-version>, so that it can be instantiated
* with any version number. Aliases can be created with \p registerAs function.
+ *
+ * \note This strategy is not EndpointId-aware.
*/
class DummyStrategy : public fw::Strategy
{
@@ -57,27 +59,27 @@
/** \brief after receive Interest trigger
*
- * If \p interestOutFace is not null, Interest is forwarded to that face via send Interest action;
+ * If \p interestOutFace is not null, Interest is forwarded to that face and endpoint via send Interest action;
* otherwise, reject pending Interest action is invoked.
*/
void
- afterReceiveInterest(const Face& inFace, const Interest& interest,
+ afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
const shared_ptr<pit::Entry>& pitEntry) override;
void
beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
- const Face& inFace, const Data& data) override;
+ const FaceEndpoint& ingress, const Data& data) override;
void
afterContentStoreHit(const shared_ptr<pit::Entry>& pitEntry,
- const Face& inFace, const Data& data) override;
+ const FaceEndpoint& ingress, const Data& data) override;
void
afterReceiveData(const shared_ptr<pit::Entry>& pitEntry,
- const Face& inFace, const Data& data) override;
+ const FaceEndpoint& ingress, const Data& data) override;
void
- afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+ afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
const shared_ptr<pit::Entry>& pitEntry) override;
protected:
diff --git a/tests/daemon/fw/forwarder.t.cpp b/tests/daemon/fw/forwarder.t.cpp
index b61c927..2c7c1d2 100644
--- a/tests/daemon/fw/forwarder.t.cpp
+++ b/tests/daemon/fw/forwarder.t.cpp
@@ -141,7 +141,7 @@
auto interestA2 = makeInterest("/A");
interestA2->setNonce(1698);
- forwarder.onOutgoingInterest(pitA, *face2, *interestA2);
+ forwarder.onOutgoingInterest(pitA, FaceEndpoint(*face2, 0), *interestA2);
pit::OutRecordCollection::iterator outA2 = pitA->getOutRecord(*face2, 0);
BOOST_REQUIRE(outA2 != pitA->out_end());
@@ -183,7 +183,7 @@
}
void
- onDataUnsolicited(Face& inFace, const Data& data) override
+ onDataUnsolicited(const FaceEndpoint& ingress, const Data& data) override
{
++onDataUnsolicited_count;
}
@@ -211,49 +211,49 @@
// local face, /localhost: OK
forwarder.dispatchToStrategy_count = 0;
shared_ptr<Interest> i1 = makeInterest("/localhost/A1");
- forwarder.onIncomingInterest(*face1, *i1);
+ forwarder.onIncomingInterest(FaceEndpoint(*face1, 0), *i1);
BOOST_CHECK_EQUAL(forwarder.dispatchToStrategy_count, 1);
// non-local face, /localhost: violate
forwarder.dispatchToStrategy_count = 0;
shared_ptr<Interest> i2 = makeInterest("/localhost/A2");
- forwarder.onIncomingInterest(*face2, *i2);
+ forwarder.onIncomingInterest(FaceEndpoint(*face2, 0), *i2);
BOOST_CHECK_EQUAL(forwarder.dispatchToStrategy_count, 0);
// local face, non-/localhost: OK
forwarder.dispatchToStrategy_count = 0;
shared_ptr<Interest> i3 = makeInterest("/A3");
- forwarder.onIncomingInterest(*face1, *i3);
+ forwarder.onIncomingInterest(FaceEndpoint(*face1, 0), *i3);
BOOST_CHECK_EQUAL(forwarder.dispatchToStrategy_count, 1);
// non-local face, non-/localhost: OK
forwarder.dispatchToStrategy_count = 0;
shared_ptr<Interest> i4 = makeInterest("/A4");
- forwarder.onIncomingInterest(*face2, *i4);
+ forwarder.onIncomingInterest(FaceEndpoint(*face2, 0), *i4);
BOOST_CHECK_EQUAL(forwarder.dispatchToStrategy_count, 1);
// local face, /localhost: OK
forwarder.onDataUnsolicited_count = 0;
shared_ptr<Data> d1 = makeData("/localhost/B1");
- forwarder.onIncomingData(*face1, *d1);
+ forwarder.onIncomingData(FaceEndpoint(*face1, 0), *d1);
BOOST_CHECK_EQUAL(forwarder.onDataUnsolicited_count, 1);
// non-local face, /localhost: OK
forwarder.onDataUnsolicited_count = 0;
shared_ptr<Data> d2 = makeData("/localhost/B2");
- forwarder.onIncomingData(*face2, *d2);
+ forwarder.onIncomingData(FaceEndpoint(*face2, 0), *d2);
BOOST_CHECK_EQUAL(forwarder.onDataUnsolicited_count, 0);
// local face, non-/localhost: OK
forwarder.onDataUnsolicited_count = 0;
shared_ptr<Data> d3 = makeData("/B3");
- forwarder.onIncomingData(*face1, *d3);
+ forwarder.onIncomingData(FaceEndpoint(*face1, 0), *d3);
BOOST_CHECK_EQUAL(forwarder.onDataUnsolicited_count, 1);
// non-local face, non-/localhost: OK
forwarder.onDataUnsolicited_count = 0;
shared_ptr<Data> d4 = makeData("/B4");
- forwarder.onIncomingData(*face2, *d4);
+ forwarder.onIncomingData(FaceEndpoint(*face2, 0), *d4);
BOOST_CHECK_EQUAL(forwarder.onDataUnsolicited_count, 1);
}
@@ -271,33 +271,33 @@
shared_ptr<Interest> interest1 = makeInterest("ndn:/A/1");
strategyA.afterReceiveInterest_count = 0;
strategyA.interestOutFace = face2;
- forwarder.startProcessInterest(*face1, *interest1);
+ forwarder.startProcessInterest(FaceEndpoint(*face1, 0), *interest1);
BOOST_CHECK_EQUAL(strategyA.afterReceiveInterest_count, 1);
shared_ptr<Interest> interest2 = makeInterest("ndn:/B/2");
strategyB.afterReceiveInterest_count = 0;
strategyB.interestOutFace = face2;
- forwarder.startProcessInterest(*face1, *interest2);
+ forwarder.startProcessInterest(FaceEndpoint(*face1, 0), *interest2);
BOOST_CHECK_EQUAL(strategyB.afterReceiveInterest_count, 1);
this->advanceClocks(time::milliseconds(1), time::milliseconds(5));
shared_ptr<Data> data1 = makeData("ndn:/A/1/a");
strategyA.beforeSatisfyInterest_count = 0;
- forwarder.startProcessData(*face2, *data1);
+ forwarder.startProcessData(FaceEndpoint(*face2, 0), *data1);
BOOST_CHECK_EQUAL(strategyA.beforeSatisfyInterest_count, 1);
shared_ptr<Data> data2 = makeData("ndn:/B/2/b");
strategyB.beforeSatisfyInterest_count = 0;
- forwarder.startProcessData(*face2, *data2);
+ forwarder.startProcessData(FaceEndpoint(*face2, 0), *data2);
BOOST_CHECK_EQUAL(strategyB.beforeSatisfyInterest_count, 1);
shared_ptr<Interest> interest3 = makeInterest("ndn:/A/3");
interest3->setInterestLifetime(time::milliseconds(30));
- forwarder.startProcessInterest(*face1, *interest3);
+ forwarder.startProcessInterest(FaceEndpoint(*face1, 0), *interest3);
shared_ptr<Interest> interest4 = makeInterest("ndn:/B/4");
interest4->setInterestLifetime(time::milliseconds(5000));
- forwarder.startProcessInterest(*face1, *interest4);
+ forwarder.startProcessInterest(FaceEndpoint(*face1, 0), *interest4);
}
BOOST_AUTO_TEST_CASE(IncomingData)
@@ -326,7 +326,7 @@
pitC->insertOrUpdateInRecord(*face4, 0, *interestC);
shared_ptr<Data> dataD = makeData("ndn:/A/B/C/D");
- forwarder.onIncomingData(*face3, *dataD);
+ forwarder.onIncomingData(FaceEndpoint(*face3, 0), *dataD);
this->advanceClocks(time::milliseconds(1), time::milliseconds(5));
BOOST_CHECK_EQUAL(face1->sentData.size(), 1);
@@ -364,14 +364,14 @@
lp::Nack nack1 = makeNack("/A/AYJqayrzF", 562, lp::NackReason::CONGESTION);
strategyA.afterReceiveNack_count = 0;
strategyB.afterReceiveNack_count = 0;
- forwarder.onIncomingNack(*face1, nack1);
+ forwarder.onIncomingNack(FaceEndpoint(*face1, 0), nack1);
BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 1);
BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
lp::Nack nack2 = makeNack("/B/EVyP73ru", 221, lp::NackReason::CONGESTION);
strategyA.afterReceiveNack_count = 0;
strategyB.afterReceiveNack_count = 0;
- forwarder.onIncomingNack(*face1, nack2);
+ forwarder.onIncomingNack(FaceEndpoint(*face1, 0), nack2);
BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 0);
BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 1);
@@ -385,7 +385,7 @@
lp::Nack nack3 = makeNack("/yEcw5HhdM", 243, lp::NackReason::CONGESTION);
strategyA.afterReceiveNack_count = 0;
strategyB.afterReceiveNack_count = 0;
- forwarder.onIncomingNack(*face1, nack3);
+ forwarder.onIncomingNack(FaceEndpoint(*face1, 0), nack3);
BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 0);
BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
@@ -397,7 +397,7 @@
lp::Nack nack4a = makeNack("/Etab4KpY", 157, lp::NackReason::CONGESTION);
strategyA.afterReceiveNack_count = 0;
strategyB.afterReceiveNack_count = 0;
- forwarder.onIncomingNack(*face2, nack4a);
+ forwarder.onIncomingNack(FaceEndpoint(*face2, 0), nack4a);
BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 0);
BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
@@ -405,7 +405,7 @@
lp::Nack nack4b = makeNack("/Etab4KpY", 294, lp::NackReason::CONGESTION);
strategyA.afterReceiveNack_count = 0;
strategyB.afterReceiveNack_count = 0;
- forwarder.onIncomingNack(*face1, nack4b);
+ forwarder.onIncomingNack(FaceEndpoint(*face1, 0), nack4b);
BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 0);
BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
@@ -413,7 +413,7 @@
pit4->insertOrUpdateOutRecord(*face3, 0, *interest4);
strategyA.afterReceiveNack_count = 0;
strategyB.afterReceiveNack_count = 0;
- forwarder.onIncomingNack(*face3, nack4a);
+ forwarder.onIncomingNack(FaceEndpoint(*face3, 0), nack4a);
BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 0);
BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
}
@@ -442,7 +442,7 @@
pit1->insertOrUpdateInRecord(*face1, 0, *interest1);
face2->sentNacks.clear();
- forwarder.onOutgoingNack(pit1, *face2, nackHeader);
+ forwarder.onOutgoingNack(pit1, FaceEndpoint(*face2, 0), nackHeader);
BOOST_CHECK_EQUAL(face2->sentNacks.size(), 0);
// send Nack with correct Nonce
@@ -453,7 +453,7 @@
pit2->insertOrUpdateInRecord(*face2, 0, *interest2b);
face1->sentNacks.clear();
- forwarder.onOutgoingNack(pit2, *face1, nackHeader);
+ forwarder.onOutgoingNack(pit2, FaceEndpoint(*face1, 0), nackHeader);
BOOST_REQUIRE_EQUAL(face1->sentNacks.size(), 1);
BOOST_CHECK_EQUAL(face1->sentNacks.back().getReason(), lp::NackReason::CONGESTION);
BOOST_CHECK_EQUAL(face1->sentNacks.back().getInterest().getNonce(), 152);
@@ -464,7 +464,7 @@
// send Nack with correct Nonce
face2->sentNacks.clear();
- forwarder.onOutgoingNack(pit2, *face2, nackHeader);
+ forwarder.onOutgoingNack(pit2, FaceEndpoint(*face2, 0), nackHeader);
BOOST_REQUIRE_EQUAL(face2->sentNacks.size(), 1);
BOOST_CHECK_EQUAL(face2->sentNacks.back().getReason(), lp::NackReason::CONGESTION);
BOOST_CHECK_EQUAL(face2->sentNacks.back().getInterest().getNonce(), 808);
@@ -478,7 +478,7 @@
pit2->insertOrUpdateInRecord(*face3, 0, *interest2c);
face3->sentNacks.clear();
- forwarder.onOutgoingNack(pit1, *face3, nackHeader);
+ forwarder.onOutgoingNack(pit1, FaceEndpoint(*face3, 0), nackHeader);
BOOST_CHECK_EQUAL(face3->sentNacks.size(), 0);
}
@@ -586,7 +586,7 @@
Pit& pit = forwarder.getPit();
BOOST_REQUIRE_EQUAL(pit.size(), 0);
- forwarder.startProcessInterest(*face1, *interest);
+ forwarder.startProcessInterest(FaceEndpoint(*face1, 0), *interest);
this->advanceClocks(time::milliseconds(100), time::seconds(20));
BOOST_CHECK_EQUAL(pit.size(), 0);
}
diff --git a/tests/daemon/fw/multicast-strategy.t.cpp b/tests/daemon/fw/multicast-strategy.t.cpp
index 09eeac7..1ee1ae9 100644
--- a/tests/daemon/fw/multicast-strategy.t.cpp
+++ b/tests/daemon/fw/multicast-strategy.t.cpp
@@ -78,7 +78,7 @@
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*face3, 0, *interest);
- strategy.afterReceiveInterest(*face3, *interest, pitEntry);
+ strategy.afterReceiveInterest(FaceEndpoint(*face3, 0), *interest, pitEntry);
BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 0);
BOOST_CHECK_EQUAL(strategy.sendInterestHistory.size(), 2);
std::set<FaceId> sentInterestFaceIds;
@@ -102,7 +102,7 @@
std::function<void()> periodicalRetxFrom4; // let periodicalRetxFrom4 lambda capture itself
periodicalRetxFrom4 = [&] {
pitEntry->insertOrUpdateInRecord(*face3, 0, *interest);
- strategy.afterReceiveInterest(*face3, *interest, pitEntry);
+ strategy.afterReceiveInterest(FaceEndpoint(*face3, 0), *interest, pitEntry);
size_t nSent = strategy.sendInterestHistory.size();
if (nSent > nSentLast) {
@@ -130,7 +130,7 @@
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*face1, 0, *interest);
- strategy.afterReceiveInterest(*face1, *interest, pitEntry);
+ strategy.afterReceiveInterest(FaceEndpoint(*face1, 0), *interest, pitEntry);
BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 1);
BOOST_CHECK_EQUAL(strategy.sendInterestHistory.size(), 0);
}
diff --git a/tests/daemon/fw/ncc-strategy.t.cpp b/tests/daemon/fw/ncc-strategy.t.cpp
index fed914c..1b71aa2 100644
--- a/tests/daemon/fw/ncc-strategy.t.cpp
+++ b/tests/daemon/fw/ncc-strategy.t.cpp
@@ -75,7 +75,7 @@
shared_ptr<pit::Entry> pitEntry1 = pit.insert(interest1).first;
pitEntry1->insertOrUpdateInRecord(*face3, 0, interest1);
- strategy.afterReceiveInterest(*face3, interest1, pitEntry1);
+ strategy.afterReceiveInterest(FaceEndpoint(*face3, 0), interest1, pitEntry1);
// forwards to face1 because routing says it's best
// (no io run here: afterReceiveInterest has already sent the Interest)
@@ -90,7 +90,7 @@
// face2 responds
shared_ptr<Data> data1p = makeData("ndn:/0Jm1ajrW/%00");
Data& data1 = *data1p;
- strategy.beforeSatisfyInterest(pitEntry1, *face2, data1);
+ strategy.beforeSatisfyInterest(pitEntry1, FaceEndpoint(*face2, 0), data1);
this->advanceClocks(time::milliseconds(10), time::milliseconds(500));
// second Interest: strategy knows face2 is best
@@ -100,7 +100,7 @@
shared_ptr<pit::Entry> pitEntry2 = pit.insert(interest2).first;
pitEntry2->insertOrUpdateInRecord(*face3, 0, interest2);
- strategy.afterReceiveInterest(*face3, interest2, pitEntry2);
+ strategy.afterReceiveInterest(FaceEndpoint(*face3, 0), interest2, pitEntry2);
// forwards to face2 because it responds previously
this->advanceClocks(time::milliseconds(1));
@@ -132,7 +132,7 @@
shared_ptr<pit::Entry> pitEntry1 = pit.insert(*interest1).first;
pitEntry1->insertOrUpdateInRecord(*face3, 0, *interest1);
- strategy.afterReceiveInterest(*face3, *interest1, pitEntry1);
+ strategy.afterReceiveInterest(FaceEndpoint(*face3, 0), *interest1, pitEntry1);
this->advanceClocks(time::milliseconds(1));
BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 1);
@@ -140,7 +140,7 @@
// face1 responds
shared_ptr<Data> data1 = makeData("ndn:/nztwIvHX/%00");
- strategy.beforeSatisfyInterest(pitEntry1, *face1, *data1);
+ strategy.beforeSatisfyInterest(pitEntry1, FaceEndpoint(*face1, 0), *data1);
this->advanceClocks(time::milliseconds(10), time::milliseconds(500));
// second Interest: bestFace is face1, nUpstreams becomes 0,
@@ -150,7 +150,7 @@
shared_ptr<pit::Entry> pitEntry2 = pit.insert(*interest2).first;
pitEntry2->insertOrUpdateInRecord(*face3, 0, *interest2);
- strategy.afterReceiveInterest(*face3, *interest2, pitEntry2);
+ strategy.afterReceiveInterest(FaceEndpoint(*face3, 0), *interest2, pitEntry2);
// FIB entry is changed before doPropagate executes
fibEntry.addOrUpdateNextHop(*face2, 0, 20);
@@ -184,7 +184,7 @@
shared_ptr<pit::Entry> pitEntry1 = pit.insert(*interest1).first;
pitEntry1->insertOrUpdateInRecord(*face3, 0, *interest1);
- strategy.afterReceiveInterest(*face3, *interest1, pitEntry1);
+ strategy.afterReceiveInterest(FaceEndpoint(*face3, 0), *interest1, pitEntry1);
limitedIo.run(2 - strategy.sendInterestHistory.size(),
time::milliseconds(2000), time::milliseconds(10));
BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 2);
@@ -193,11 +193,11 @@
// face1 responds
shared_ptr<Data> data1 = makeData("ndn:/seRMz5a6/%00");
- strategy.beforeSatisfyInterest(pitEntry1, *face1, *data1);
+ strategy.beforeSatisfyInterest(pitEntry1, FaceEndpoint(*face1, 0), *data1);
pitEntry1->clearInRecords();
this->advanceClocks(time::milliseconds(10));
// face2 also responds
- strategy.beforeSatisfyInterest(pitEntry1, *face2, *data1);
+ strategy.beforeSatisfyInterest(pitEntry1, FaceEndpoint(*face2, 0), *data1);
this->advanceClocks(time::milliseconds(10));
// second Interest: bestFace should be face 1
@@ -206,7 +206,7 @@
shared_ptr<pit::Entry> pitEntry2 = pit.insert(*interest2).first;
pitEntry2->insertOrUpdateInRecord(*face3, 0, *interest2);
- strategy.afterReceiveInterest(*face3, *interest2, pitEntry2);
+ strategy.afterReceiveInterest(FaceEndpoint(*face3, 0), *interest2, pitEntry2);
limitedIo.run(3 - strategy.sendInterestHistory.size(),
time::milliseconds(2000), time::milliseconds(10));
@@ -238,7 +238,7 @@
shared_ptr<pit::Entry> pitEntry1 = pit.insert(*interest1).first;
pitEntry1->insertOrUpdateInRecord(*face1, 0, *interest1);
- strategy.afterReceiveInterest(*face1, *interest1, pitEntry1);
+ strategy.afterReceiveInterest(FaceEndpoint(*face1, 0), *interest1, pitEntry1);
limitedIo.run(1 - strategy.sendInterestHistory.size(),
time::milliseconds(2000), time::milliseconds(10));
BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 1);
@@ -247,14 +247,14 @@
// face2 responds
shared_ptr<Data> data1 = makeData("ndn:/M4mBXCsd");
data1->setFreshnessPeriod(time::milliseconds(5));
- strategy.beforeSatisfyInterest(pitEntry1, *face2, *data1);
+ strategy.beforeSatisfyInterest(pitEntry1, FaceEndpoint(*face2, 0), *data1);
pitEntry1->deleteOutRecord(*face2, 0);
pitEntry1->clearInRecords();
this->advanceClocks(time::milliseconds(10));
// similar Interest: strategy should still forward it
pitEntry1->insertOrUpdateInRecord(*face1, 0, *interest1);
- strategy.afterReceiveInterest(*face1, *interest1, pitEntry1);
+ strategy.afterReceiveInterest(FaceEndpoint(*face1, 0), *interest1, pitEntry1);
limitedIo.run(2 - strategy.sendInterestHistory.size(),
time::milliseconds(2000), time::milliseconds(10));
BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 2);
@@ -283,7 +283,7 @@
shared_ptr<pit::Entry> pitEntry1 = pit.insert(*interest1).first;
pitEntry1->insertOrUpdateInRecord(*face1, 0, *interest1);
- strategy.afterReceiveInterest(*face1, *interest1, pitEntry1);
+ strategy.afterReceiveInterest(FaceEndpoint(*face1, 0), *interest1, pitEntry1);
// Interest shall go to face2, not loop back to face1
BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 1);
diff --git a/tests/daemon/fw/pit-expiry.t.cpp b/tests/daemon/fw/pit-expiry.t.cpp
index b8c0418..1e0b599 100644
--- a/tests/daemon/fw/pit-expiry.t.cpp
+++ b/tests/daemon/fw/pit-expiry.t.cpp
@@ -62,10 +62,10 @@
}
void
- afterReceiveInterest(const Face& inFace, const Interest& interest,
+ afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
const shared_ptr<pit::Entry>& pitEntry) override
{
- DummyStrategy::afterReceiveInterest(inFace, interest, pitEntry);
+ DummyStrategy::afterReceiveInterest(ingress, interest, pitEntry);
if (afterReceiveInterest_count <= 1) {
setExpiryTimer(pitEntry, 190_ms);
@@ -74,9 +74,9 @@
void
beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
- const Face& inFace, const Data& data) override
+ const FaceEndpoint& ingress, const Data& data) override
{
- DummyStrategy::beforeSatisfyInterest(pitEntry, inFace, data);
+ DummyStrategy::beforeSatisfyInterest(pitEntry, ingress, data);
if (beforeSatisfyInterest_count <= 2) {
setExpiryTimer(pitEntry, 190_ms);
@@ -85,18 +85,18 @@
void
afterContentStoreHit(const shared_ptr<pit::Entry>& pitEntry,
- const Face& inFace, const Data& data) override
+ const FaceEndpoint& ingress, const Data& data) override
{
if (afterContentStoreHit_count == 0) {
setExpiryTimer(pitEntry, 190_ms);
}
- DummyStrategy::afterContentStoreHit(pitEntry, inFace, data);
+ DummyStrategy::afterContentStoreHit(pitEntry, ingress, data);
}
void
afterReceiveData(const shared_ptr<pit::Entry>& pitEntry,
- const Face& inFace, const Data& data) override
+ const FaceEndpoint& ingress, const Data& data) override
{
++afterReceiveData_count;
@@ -104,14 +104,14 @@
setExpiryTimer(pitEntry, 290_ms);
}
- this->sendDataToAll(pitEntry, inFace, data);
+ this->sendDataToAll(pitEntry, ingress, data);
}
void
- afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+ afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
const shared_ptr<pit::Entry>& pitEntry) override
{
- DummyStrategy::afterReceiveNack(inFace, nack, pitEntry);
+ DummyStrategy::afterReceiveNack(ingress, nack, pitEntry);
if (afterReceiveNack_count <= 1) {
setExpiryTimer(pitEntry, 50_ms);
diff --git a/tests/daemon/fw/strategy-nack-return.t.cpp b/tests/daemon/fw/strategy-nack-return.t.cpp
index ed2e9e1..86c47f6 100644
--- a/tests/daemon/fw/strategy-nack-return.t.cpp
+++ b/tests/daemon/fw/strategy-nack-return.t.cpp
@@ -111,7 +111,7 @@
pitEntry->getOutRecord(*this->face3, 0)->setIncomingNack(nack3);
BOOST_REQUIRE(this->strategy.waitForAction(
- [&] { this->strategy.afterReceiveNack(*this->face3, nack3, pitEntry); },
+ [&] { this->strategy.afterReceiveNack(FaceEndpoint(*this->face3, 0), nack3, pitEntry); },
this->limitedIo, 2));
BOOST_REQUIRE_EQUAL(this->strategy.sendNackHistory.size(), 2);
@@ -143,14 +143,14 @@
lp::Nack nack3 = makeNack("/aS9FAyUV19", 286, lp::NackReason::CONGESTION);
pitEntry->getOutRecord(*this->face3, 0)->setIncomingNack(nack3);
- this->strategy.afterReceiveNack(*this->face3, nack3, pitEntry);
+ this->strategy.afterReceiveNack(FaceEndpoint(*this->face3, 0), nack3, pitEntry);
BOOST_CHECK_EQUAL(this->strategy.sendNackHistory.size(), 0); // don't send Nack until all upstreams have Nacked
lp::Nack nack4 = makeNack("/aS9FAyUV19", 286, lp::NackReason::CONGESTION);
pitEntry->getOutRecord(*this->face4, 0)->setIncomingNack(nack4);
BOOST_REQUIRE(this->strategy.waitForAction(
- [&] { this->strategy.afterReceiveNack(*this->face4, nack4, pitEntry); },
+ [&] { this->strategy.afterReceiveNack(FaceEndpoint(*this->face4, 0), nack4, pitEntry); },
this->limitedIo));
BOOST_REQUIRE_EQUAL(this->strategy.sendNackHistory.size(), 1);
@@ -183,7 +183,7 @@
lp::Nack nack4 = makeNack("/sIYw0TXWDj", 223, lp::NackReason::CONGESTION);
pitEntry->getOutRecord(*this->face4, 0)->setIncomingNack(nack4);
- this->strategy.afterReceiveNack(*this->face4, nack4, pitEntry);
+ this->strategy.afterReceiveNack(FaceEndpoint(*this->face4, 0), nack4, pitEntry);
BOOST_CHECK_EQUAL(this->strategy.sendNackHistory.size(), 0);
}
@@ -329,13 +329,13 @@
lp::Nack nack3 = makeNack(*interest1, Combination::getX());
pitEntry->getOutRecord(*face3, 0)->setIncomingNack(nack3);
- strategy.afterReceiveNack(*face3, nack3, pitEntry);
+ strategy.afterReceiveNack(FaceEndpoint(*face3, 0), nack3, pitEntry);
BOOST_CHECK_EQUAL(strategy.sendNackHistory.size(), 0);
lp::Nack nack4 = makeNack(*interest1, Combination::getY());
pitEntry->getOutRecord(*face4, 0)->setIncomingNack(nack4);
- strategy.afterReceiveNack(*face4, nack4, pitEntry);
+ strategy.afterReceiveNack(FaceEndpoint(*face4, 0), nack4, pitEntry);
BOOST_REQUIRE_EQUAL(strategy.sendNackHistory.size(), 1);
BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitInterest, pitEntry->getInterest());
diff --git a/tests/daemon/fw/strategy-no-route.t.cpp b/tests/daemon/fw/strategy-no-route.t.cpp
index 4719c5e..3c5be6b 100644
--- a/tests/daemon/fw/strategy-no-route.t.cpp
+++ b/tests/daemon/fw/strategy-no-route.t.cpp
@@ -164,7 +164,7 @@
pitEntry->insertOrUpdateInRecord(*this->face1, 0, *interest);
BOOST_REQUIRE(this->strategy.waitForAction(
- [&] { this->strategy.afterReceiveInterest(*this->face1, *interest, pitEntry); },
+ [&] { this->strategy.afterReceiveInterest(FaceEndpoint(*this->face1, 0), *interest, pitEntry); },
this->limitedIo, 2));
BOOST_REQUIRE_EQUAL(this->strategy.rejectPendingInterestHistory.size(), 1);
diff --git a/tests/daemon/fw/strategy-scope-control.t.cpp b/tests/daemon/fw/strategy-scope-control.t.cpp
index 029ab0e..984c792 100644
--- a/tests/daemon/fw/strategy-scope-control.t.cpp
+++ b/tests/daemon/fw/strategy-scope-control.t.cpp
@@ -125,7 +125,7 @@
pitEntry->insertOrUpdateInRecord(*this->localFace3, 0, *interest);
BOOST_REQUIRE(this->strategy.waitForAction(
- [&] { this->strategy.afterReceiveInterest(*this->localFace3, *interest, pitEntry); },
+ [&] { this->strategy.afterReceiveInterest(FaceEndpoint(*this->localFace3, 0), *interest, pitEntry); },
this->limitedIo));
BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 1);
@@ -144,7 +144,7 @@
pitEntry->insertOrUpdateInRecord(*this->localFace3, 0, *interest);
BOOST_REQUIRE(this->strategy.waitForAction(
- [&] { this->strategy.afterReceiveInterest(*this->localFace3, *interest, pitEntry); },
+ [&] { this->strategy.afterReceiveInterest(FaceEndpoint(*this->localFace3, 0), *interest, pitEntry); },
this->limitedIo, 1 + T::willSendNackNoRoute()));
BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 0);
@@ -167,7 +167,7 @@
pitEntry->insertOrUpdateInRecord(*this->localFace3, 0, *interest);
BOOST_REQUIRE(this->strategy.waitForAction(
- [&] { this->strategy.afterReceiveInterest(*this->localFace3, *interest, pitEntry); },
+ [&] { this->strategy.afterReceiveInterest(FaceEndpoint(*this->localFace3, 0), *interest, pitEntry); },
this->limitedIo));
BOOST_REQUIRE_EQUAL(this->strategy.sendInterestHistory.size(), 1);
@@ -187,7 +187,7 @@
pitEntry->insertOrUpdateInRecord(*this->nonLocalFace1, 0, *interest);
BOOST_REQUIRE(this->strategy.waitForAction(
- [&] { this->strategy.afterReceiveInterest(*this->nonLocalFace1, *interest, pitEntry); },
+ [&] { this->strategy.afterReceiveInterest(FaceEndpoint(*this->nonLocalFace1, 0), *interest, pitEntry); },
this->limitedIo, 1 + T::willSendNackNoRoute()));
BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 0);
@@ -210,7 +210,7 @@
pitEntry->insertOrUpdateInRecord(*this->nonLocalFace1, 0, *interest);
BOOST_REQUIRE(this->strategy.waitForAction(
- [&] { this->strategy.afterReceiveInterest(*this->nonLocalFace1, *interest, pitEntry); },
+ [&] { this->strategy.afterReceiveInterest(FaceEndpoint(*this->nonLocalFace1, 0), *interest, pitEntry); },
this->limitedIo));
BOOST_REQUIRE_EQUAL(this->strategy.sendInterestHistory.size(), 1);
@@ -233,7 +233,7 @@
pitEntry->insertOrUpdateOutRecord(*this->localFace4, 0, *interest)->setIncomingNack(nack);
BOOST_REQUIRE(this->strategy.waitForAction(
- [&] { this->strategy.afterReceiveNack(*this->localFace4, nack, pitEntry); },
+ [&] { this->strategy.afterReceiveNack(FaceEndpoint(*this->localFace4, 0), nack, pitEntry); },
this->limitedIo, T::canProcessNack()));
BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 0);
@@ -258,7 +258,7 @@
pitEntry->insertOrUpdateOutRecord(*this->localFace4, 0, *interest)->setIncomingNack(nack);
BOOST_REQUIRE(this->strategy.waitForAction(
- [&] { this->strategy.afterReceiveNack(*this->localFace4, nack, pitEntry); },
+ [&] { this->strategy.afterReceiveNack(FaceEndpoint(*this->localFace4, 0), nack, pitEntry); },
this->limitedIo, T::canProcessNack()));
BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 0);
diff --git a/tests/daemon/fw/strategy-tester.hpp b/tests/daemon/fw/strategy-tester.hpp
index c842327..5b5c98d 100644
--- a/tests/daemon/fw/strategy-tester.hpp
+++ b/tests/daemon/fw/strategy-tester.hpp
@@ -106,11 +106,11 @@
protected:
void
- sendInterest(const shared_ptr<pit::Entry>& pitEntry, Face& outFace,
+ sendInterest(const shared_ptr<pit::Entry>& pitEntry, const FaceEndpoint& egress,
const Interest& interest) override
{
- sendInterestHistory.push_back({pitEntry->getInterest(), outFace.getId(), interest});
- pitEntry->insertOrUpdateOutRecord(outFace, 0, interest);
+ sendInterestHistory.push_back({pitEntry->getInterest(), egress.face.getId(), interest});
+ pitEntry->insertOrUpdateOutRecord(egress.face, egress.endpoint, interest);
afterAction();
}
@@ -122,11 +122,11 @@
}
void
- sendNack(const shared_ptr<pit::Entry>& pitEntry, const Face& outFace,
+ sendNack(const shared_ptr<pit::Entry>& pitEntry, const FaceEndpoint& egress,
const lp::NackHeader& header) override
{
- sendNackHistory.push_back({pitEntry->getInterest(), outFace.getId(), header});
- pitEntry->deleteInRecord(outFace, 0);
+ sendNackHistory.push_back({pitEntry->getInterest(), egress.face.getId(), header});
+ pitEntry->deleteInRecord(egress.face, egress.endpoint);
afterAction();
}
diff --git a/tests/daemon/fw/unsolicited-data-policy.t.cpp b/tests/daemon/fw/unsolicited-data-policy.t.cpp
index 71f19b2..8cc7a70 100644
--- a/tests/daemon/fw/unsolicited-data-policy.t.cpp
+++ b/tests/daemon/fw/unsolicited-data-policy.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -118,7 +118,7 @@
forwarder.addFace(face1);
shared_ptr<Data> data1 = makeData("/unsolicited-from-local");
- forwarder.onIncomingData(*face1, *data1);
+ forwarder.onIncomingData(FaceEndpoint(*face1, 0), *data1);
BOOST_CHECK_EQUAL(isInCs(*data1), T::ShouldAdmitLocal::value);
auto face2 = make_shared<DummyFace>("dummy://", "dummy://",
@@ -126,7 +126,7 @@
forwarder.addFace(face2);
shared_ptr<Data> data2 = makeData("/unsolicited-from-non-local");
- forwarder.onIncomingData(*face2, *data2);
+ forwarder.onIncomingData(FaceEndpoint(*face2, 0), *data2);
BOOST_CHECK_EQUAL(isInCs(*data2), T::ShouldAdmitNonLocal::value);
}