face: reimplement EndpointId with std::variant
Refs: #5041
Change-Id: Ib8aced49a7aa14b137fb06de4a0ae8b979f07587
diff --git a/tests/daemon/fw/forwarder.t.cpp b/tests/daemon/fw/forwarder.t.cpp
index 98f767f..6fbb688 100644
--- a/tests/daemon/fw/forwarder.t.cpp
+++ b/tests/daemon/fw/forwarder.t.cpp
@@ -69,7 +69,7 @@
BOOST_CHECK_EQUAL(forwarder.getCounters().nOutInterests, 0);
BOOST_CHECK_EQUAL(forwarder.getCounters().nCsHits, 0);
BOOST_CHECK_EQUAL(forwarder.getCounters().nCsMisses, 0);
- face1->receiveInterest(*makeInterest("/A/B"), 0);
+ face1->receiveInterest(*makeInterest("/A/B"));
this->advanceClocks(100_ms, 1_s);
BOOST_REQUIRE_EQUAL(face2->sentInterests.size(), 1);
BOOST_CHECK_EQUAL(face2->sentInterests[0].getName(), "/A/B");
@@ -83,7 +83,7 @@
BOOST_CHECK_EQUAL(forwarder.getCounters().nInData, 0);
BOOST_CHECK_EQUAL(forwarder.getCounters().nOutData, 0);
- face2->receiveData(*makeData("/A/B"), 0);
+ face2->receiveData(*makeData("/A/B"));
this->advanceClocks(100_ms, 1_s);
BOOST_REQUIRE_EQUAL(face1->sentData.size(), 1);
BOOST_CHECK_EQUAL(face1->sentData[0].getName(), "/A/B");
@@ -116,7 +116,7 @@
BOOST_CHECK_EQUAL(forwarder.getCounters().nCsHits, 0);
BOOST_CHECK_EQUAL(forwarder.getCounters().nCsMisses, 0);
- face1->receiveInterest(*makeInterest("/A", true), 0);
+ face1->receiveInterest(*makeInterest("/A", true));
this->advanceClocks(1_ms, 5_ms);
// Interest matching ContentStore should not be forwarded
BOOST_REQUIRE_EQUAL(face2->sentInterests.size(), 0);
@@ -145,7 +145,7 @@
auto interest = makeInterest("/A");
BOOST_CHECK_EQUAL(interest->hasNonce(), false);
- face1->receiveInterest(*interest, 0);
+ face1->receiveInterest(*interest);
// Ensure Nonce added if incoming packet did not have Nonce
BOOST_REQUIRE_EQUAL(face2->getCounters().nOutInterests, 1);
@@ -191,7 +191,7 @@
auto interest = makeInterest("/A/B");
interest->setTag(make_shared<lp::NextHopFaceIdTag>(face2->getId()));
- face1->receiveInterest(*interest, 0);
+ face1->receiveInterest(*interest);
this->advanceClocks(100_ms, 1_s);
BOOST_CHECK_EQUAL(face3->sentInterests.size(), 0);
BOOST_REQUIRE_EQUAL(face2->sentInterests.size(), 1);
@@ -211,7 +211,7 @@
// Incoming interest w/o HopLimit will not be dropped on send or receive paths
auto interestNoHopLimit = makeInterest("/remote/abcdefgh");
- faceIn->receiveInterest(*interestNoHopLimit, 0);
+ faceIn->receiveInterest(*interestNoHopLimit);
this->advanceClocks(100_ms, 1_s);
BOOST_CHECK_EQUAL(faceRemote->sentInterests.size(), 1);
BOOST_CHECK_EQUAL(faceRemote->getCounters().nInHopLimitZero, 0);
@@ -222,7 +222,7 @@
// Incoming interest w/ HopLimit > 1 will not be dropped on send/receive
auto interestHopLimit2 = makeInterest("/remote/ijklmnop");
interestHopLimit2->setHopLimit(2);
- faceIn->receiveInterest(*interestHopLimit2, 0);
+ faceIn->receiveInterest(*interestHopLimit2);
this->advanceClocks(100_ms, 1_s);
BOOST_CHECK_EQUAL(faceRemote->getCounters().nOutInterests, 2);
BOOST_CHECK_EQUAL(faceRemote->getCounters().nInHopLimitZero, 0);
@@ -234,7 +234,7 @@
// Incoming interest w/ HopLimit == 1 will be dropped on send path if going out on remote face
auto interestHopLimit1Remote = makeInterest("/remote/qrstuvwx");
interestHopLimit1Remote->setHopLimit(1);
- faceIn->receiveInterest(*interestHopLimit1Remote, 0);
+ faceIn->receiveInterest(*interestHopLimit1Remote);
this->advanceClocks(100_ms, 1_s);
BOOST_CHECK_EQUAL(faceRemote->getCounters().nOutInterests, 2);
BOOST_CHECK_EQUAL(faceRemote->getCounters().nInHopLimitZero, 0);
@@ -244,7 +244,7 @@
// Incoming interest w/ HopLimit == 1 will not be dropped on send path if going out on local face
auto interestHopLimit1Local = makeInterest("/local/abcdefgh");
interestHopLimit1Local->setHopLimit(1);
- faceIn->receiveInterest(*interestHopLimit1Local, 0);
+ faceIn->receiveInterest(*interestHopLimit1Local);
this->advanceClocks(100_ms, 1_s);
BOOST_CHECK_EQUAL(faceLocal->getCounters().nOutInterests, 1);
BOOST_CHECK_EQUAL(faceLocal->getCounters().nInHopLimitZero, 0);
@@ -256,7 +256,7 @@
// Interest w/ HopLimit == 0 will be dropped on receive path
auto interestHopLimit0 = makeInterest("/remote/yzabcdef");
interestHopLimit0->setHopLimit(0);
- faceIn->receiveInterest(*interestHopLimit0, 0);
+ faceIn->receiveInterest(*interestHopLimit0);
this->advanceClocks(100_ms, 1_s);
BOOST_CHECK_EQUAL(faceRemote->getCounters().nOutInterests, 2);
BOOST_CHECK_EQUAL(faceIn->getCounters().nInHopLimitZero, 1);
@@ -267,7 +267,7 @@
BOOST_AUTO_TEST_CASE(AddDefaultHopLimit)
{
auto face = addFace();
- auto faceEndpoint = FaceEndpoint(*face, 0);
+ auto faceEndpoint = FaceEndpoint(*face);
Pit& pit = forwarder.getPit();
auto i1 = makeInterest("/A");
auto pitA = pit.insert(*i1).first;
@@ -306,47 +306,47 @@
// local face, /localhost: OK
strategy.afterReceiveInterest_count = 0;
auto i1 = makeInterest("/localhost/A1");
- forwarder.onIncomingInterest(*i1, FaceEndpoint(*face1, 0));
+ forwarder.onIncomingInterest(*i1, FaceEndpoint(*face1));
BOOST_CHECK_EQUAL(strategy.afterReceiveInterest_count, 1);
// non-local face, /localhost: violate
strategy.afterReceiveInterest_count = 0;
auto i2 = makeInterest("/localhost/A2");
- forwarder.onIncomingInterest(*i2, FaceEndpoint(*face2, 0));
+ forwarder.onIncomingInterest(*i2, FaceEndpoint(*face2));
BOOST_CHECK_EQUAL(strategy.afterReceiveInterest_count, 0);
// local face, non-/localhost: OK
strategy.afterReceiveInterest_count = 0;
auto i3 = makeInterest("/A3");
- forwarder.onIncomingInterest(*i3, FaceEndpoint(*face1, 0));
+ forwarder.onIncomingInterest(*i3, FaceEndpoint(*face1));
BOOST_CHECK_EQUAL(strategy.afterReceiveInterest_count, 1);
// non-local face, non-/localhost: OK
strategy.afterReceiveInterest_count = 0;
auto i4 = makeInterest("/A4");
- forwarder.onIncomingInterest(*i4, FaceEndpoint(*face2, 0));
+ forwarder.onIncomingInterest(*i4, FaceEndpoint(*face2));
BOOST_CHECK_EQUAL(strategy.afterReceiveInterest_count, 1);
BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 0);
// local face, /localhost: OK
auto d1 = makeData("/localhost/B1");
- forwarder.onIncomingData(*d1, FaceEndpoint(*face1, 0));
+ forwarder.onIncomingData(*d1, FaceEndpoint(*face1));
BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 1);
// non-local face, /localhost: violate
auto d2 = makeData("/localhost/B2");
- forwarder.onIncomingData(*d2, FaceEndpoint(*face2, 0));
+ forwarder.onIncomingData(*d2, FaceEndpoint(*face2));
BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 1);
// local face, non-/localhost: OK
auto d3 = makeData("/B3");
- forwarder.onIncomingData(*d3, FaceEndpoint(*face1, 0));
+ forwarder.onIncomingData(*d3, FaceEndpoint(*face1));
BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 2);
// non-local face, non-/localhost: OK
auto d4 = makeData("/B4");
- forwarder.onIncomingData(*d4, FaceEndpoint(*face2, 0));
+ forwarder.onIncomingData(*d4, FaceEndpoint(*face2));
BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 3);
}
@@ -361,31 +361,31 @@
auto interest1 = makeInterest("/A/1");
strategyA.afterReceiveInterest_count = 0;
strategyA.interestOutFace = face2;
- forwarder.onIncomingInterest(*interest1, FaceEndpoint(*face1, 0));
+ forwarder.onIncomingInterest(*interest1, FaceEndpoint(*face1));
BOOST_CHECK_EQUAL(strategyA.afterReceiveInterest_count, 1);
auto interest2 = makeInterest("/B/2", true);
strategyB.afterReceiveInterest_count = 0;
strategyB.interestOutFace = face2;
- forwarder.onIncomingInterest(*interest2, FaceEndpoint(*face1, 0));
+ forwarder.onIncomingInterest(*interest2, FaceEndpoint(*face1));
BOOST_CHECK_EQUAL(strategyB.afterReceiveInterest_count, 1);
this->advanceClocks(1_ms, 5_ms);
auto data1 = makeData("/A/1");
strategyA.beforeSatisfyInterest_count = 0;
- forwarder.onIncomingData(*data1, FaceEndpoint(*face2, 0));
+ forwarder.onIncomingData(*data1, FaceEndpoint(*face2));
BOOST_CHECK_EQUAL(strategyA.beforeSatisfyInterest_count, 1);
auto data2 = makeData("/B/2/b");
strategyB.beforeSatisfyInterest_count = 0;
- forwarder.onIncomingData(*data2, FaceEndpoint(*face2, 0));
+ forwarder.onIncomingData(*data2, FaceEndpoint(*face2));
BOOST_CHECK_EQUAL(strategyB.beforeSatisfyInterest_count, 1);
auto interest3 = makeInterest("/A/3", false, 30_ms);
- forwarder.onIncomingInterest(*interest3, FaceEndpoint(*face1, 0));
+ forwarder.onIncomingInterest(*interest3, FaceEndpoint(*face1));
auto interest4 = makeInterest("/B/4", false, 5_s);
- forwarder.onIncomingInterest(*interest4, FaceEndpoint(*face1, 0));
+ forwarder.onIncomingInterest(*interest4, FaceEndpoint(*face1));
}
BOOST_AUTO_TEST_CASE(IncomingData)
@@ -409,7 +409,7 @@
pitC->insertOrUpdateInRecord(*face4, *interestC);
auto dataD = makeData("/A/B/C/D");
- forwarder.onIncomingData(*dataD, FaceEndpoint(*face3, 0));
+ forwarder.onIncomingData(*dataD, FaceEndpoint(*face3));
this->advanceClocks(1_ms, 5_ms);
BOOST_CHECK_EQUAL(face1->sentData.size(), 1);
@@ -477,14 +477,14 @@
auto nack1 = makeNack(*interest1, lp::NackReason::CONGESTION);
strategyA.afterReceiveNack_count = 0;
strategyB.afterReceiveNack_count = 0;
- forwarder.onIncomingNack(nack1, FaceEndpoint(*face1, 0));
+ forwarder.onIncomingNack(nack1, FaceEndpoint(*face1));
BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 1);
BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
auto nack2 = makeNack(*interest2, lp::NackReason::CONGESTION);
strategyA.afterReceiveNack_count = 0;
strategyB.afterReceiveNack_count = 0;
- forwarder.onIncomingNack(nack2, FaceEndpoint(*face1, 0));
+ forwarder.onIncomingNack(nack2, FaceEndpoint(*face1));
BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 0);
BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 1);
@@ -498,7 +498,7 @@
auto nack3 = makeNack(*makeInterest("/yEcw5HhdM", false, std::nullopt, 243), lp::NackReason::CONGESTION);
strategyA.afterReceiveNack_count = 0;
strategyB.afterReceiveNack_count = 0;
- forwarder.onIncomingNack(nack3, FaceEndpoint(*face1, 0));
+ forwarder.onIncomingNack(nack3, FaceEndpoint(*face1));
BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 0);
BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
@@ -510,7 +510,7 @@
auto nack4a = makeNack(*interest4, lp::NackReason::CONGESTION);
strategyA.afterReceiveNack_count = 0;
strategyB.afterReceiveNack_count = 0;
- forwarder.onIncomingNack(nack4a, FaceEndpoint(*face2, 0));
+ forwarder.onIncomingNack(nack4a, FaceEndpoint(*face2));
BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 0);
BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
@@ -518,7 +518,7 @@
auto nack4b = makeNack(*makeInterest("/Etab4KpY", false, std::nullopt, 294), lp::NackReason::CONGESTION);
strategyA.afterReceiveNack_count = 0;
strategyB.afterReceiveNack_count = 0;
- forwarder.onIncomingNack(nack4b, FaceEndpoint(*face1, 0));
+ forwarder.onIncomingNack(nack4b, FaceEndpoint(*face1));
BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 0);
BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
@@ -526,7 +526,7 @@
pit4->insertOrUpdateOutRecord(*face3, *interest4);
strategyA.afterReceiveNack_count = 0;
strategyB.afterReceiveNack_count = 0;
- forwarder.onIncomingNack(nack4a, FaceEndpoint(*face3, 0));
+ forwarder.onIncomingNack(nack4a, FaceEndpoint(*face3));
BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 0);
BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
}
@@ -620,19 +620,19 @@
// receive Interest on face1
face1->sentNacks.clear();
auto interest1a = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", false, std::nullopt, 732);
- face1->receiveInterest(*interest1a, 0);
+ face1->receiveInterest(*interest1a);
BOOST_CHECK(face1->sentNacks.empty());
// receive Interest with duplicate Nonce on face1: legit retransmission
face1->sentNacks.clear();
auto interest1b = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", false, std::nullopt, 732);
- face1->receiveInterest(*interest1b, 0);
+ face1->receiveInterest(*interest1b);
BOOST_CHECK(face1->sentNacks.empty());
// receive Interest with duplicate Nonce on face2
face2->sentNacks.clear();
auto interest2a = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", false, std::nullopt, 732);
- face2->receiveInterest(*interest2a, 0);
+ face2->receiveInterest(*interest2a);
BOOST_REQUIRE_EQUAL(face2->sentNacks.size(), 1);
BOOST_CHECK_EQUAL(face2->sentNacks.back().getInterest().wireEncode(), interest2a->wireEncode());
BOOST_CHECK_EQUAL(face2->sentNacks.back().getReason(), lp::NackReason::DUPLICATE);
@@ -640,13 +640,13 @@
// receive Interest with new Nonce on face2
face2->sentNacks.clear();
auto interest2b = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", false, std::nullopt, 944);
- face2->receiveInterest(*interest2b, 0);
+ face2->receiveInterest(*interest2b);
BOOST_CHECK(face2->sentNacks.empty());
// receive Interest with duplicate Nonce on face3, don't send Nack to multi-access face
face3->sentNacks.clear();
auto interest3a = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", false, std::nullopt, 732);
- face3->receiveInterest(*interest3a, 0);
+ face3->receiveInterest(*interest3a);
BOOST_CHECK(face3->sentNacks.empty());
}
@@ -659,7 +659,7 @@
face2->afterSend.connect([face1, face2] (uint32_t pktType) {
if (pktType == tlv::Interest) {
auto interest = make_shared<Interest>(face2->sentInterests.back());
- getScheduler().schedule(170_ms, [face1, interest] { face1->receiveInterest(*interest, 0); });
+ getScheduler().schedule(170_ms, [face1, interest] { face1->receiveInterest(*interest); });
}
});
@@ -669,7 +669,7 @@
// receive an Interest
auto interest = makeInterest("/A/1", false, 50_ms, 82101183);
- face1->receiveInterest(*interest, 0);
+ face1->receiveInterest(*interest);
// interest should be forwarded only once, as long as Nonce is in Dead Nonce List
BOOST_ASSERT(25_ms * 40 < forwarder.getDeadNonceList().getLifetime());
@@ -693,7 +693,7 @@
auto& pit = forwarder.getPit();
BOOST_CHECK_EQUAL(pit.size(), 0);
- forwarder.onIncomingInterest(*interest, FaceEndpoint(*face1, 0));
+ forwarder.onIncomingInterest(*interest, FaceEndpoint(*face1));
this->advanceClocks(100_ms, 20_s);
BOOST_CHECK_EQUAL(pit.size(), 0);
}
@@ -704,7 +704,7 @@
auto data = makeData("/A");
BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 0);
- forwarder.onIncomingData(*data, FaceEndpoint(*face1, 0));
+ forwarder.onIncomingData(*data, FaceEndpoint(*face1));
this->advanceClocks(1_ms, 10_ms);
BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 1);
}