face: reimplement EndpointId with std::variant
Refs: #5041
Change-Id: Ib8aced49a7aa14b137fb06de4a0ae8b979f07587
diff --git a/tests/daemon/face/datagram-transport.t.cpp b/tests/daemon/face/datagram-transport.t.cpp
index 055584c..4e88ff2 100644
--- a/tests/daemon/face/datagram-transport.t.cpp
+++ b/tests/daemon/face/datagram-transport.t.cpp
@@ -82,8 +82,12 @@
BOOST_REQUIRE_EQUAL(this->receivedPackets->size(), 2);
BOOST_CHECK(this->receivedPackets->at(0).packet == pkt1);
BOOST_CHECK(this->receivedPackets->at(1).packet == pkt2);
- BOOST_CHECK_EQUAL(this->receivedPackets->at(0).endpoint,
- this->receivedPackets->at(1).endpoint);
+ BOOST_CHECK(this->receivedPackets->at(0).endpoint == this->receivedPackets->at(1).endpoint);
+ // check that the endpoint is empty (monostate) if and only if the transport is unicast
+ constexpr bool isUnicast = std::is_same_v<typename std::remove_pointer_t<decltype(T::transport)>::addressing,
+ face::Unicast>;
+ BOOST_CHECK_EQUAL(std::holds_alternative<std::monostate>(this->receivedPackets->at(0).endpoint),
+ isUnicast);
}
BOOST_FIXTURE_TEST_CASE_TEMPLATE(ReceiveIncomplete, T, DatagramTransportFixtures, T)
diff --git a/tests/daemon/face/dummy-face.hpp b/tests/daemon/face/dummy-face.hpp
index 8374430..15ab445 100644
--- a/tests/daemon/face/dummy-face.hpp
+++ b/tests/daemon/face/dummy-face.hpp
@@ -60,17 +60,17 @@
/** \brief causes the face to receive an Interest
*/
void
- receiveInterest(const Interest& interest, const EndpointId& endpointId);
+ receiveInterest(const Interest& interest, const EndpointId& endpointId = {});
/** \brief causes the face to receive a Data
*/
void
- receiveData(const Data& data, const EndpointId& endpointId);
+ receiveData(const Data& data, const EndpointId& endpointId = {});
/** \brief causes the face to receive a Nack
*/
void
- receiveNack(const lp::Nack& nack, const EndpointId& endpointId);
+ receiveNack(const lp::Nack& nack, const EndpointId& endpointId = {});
/** \brief Emitted after a network-layer packet is sent.
*
diff --git a/tests/daemon/face/face-endpoint.t.cpp b/tests/daemon/face/face-endpoint.t.cpp
new file mode 100644
index 0000000..123a0f9
--- /dev/null
+++ b/tests/daemon/face/face-endpoint.t.cpp
@@ -0,0 +1,62 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2014-2022, Regents of the University of California,
+ * Arizona Board of Regents,
+ * Colorado State University,
+ * University Pierre & Marie Curie, Sorbonne University,
+ * Washington University in St. Louis,
+ * Beijing Institute of Technology,
+ * The University of Memphis.
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "face/face-endpoint.hpp"
+
+#include "tests/test-common.hpp"
+#include "dummy-face.hpp"
+
+#include <boost/lexical_cast.hpp>
+
+namespace nfd::tests {
+
+using namespace nfd::face;
+
+BOOST_AUTO_TEST_SUITE(Face)
+BOOST_AUTO_TEST_SUITE(TestFaceEndpoint)
+
+BOOST_AUTO_TEST_CASE(Print)
+{
+ DummyFace face;
+ FaceEndpoint faceEndpoint1(face);
+ BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(faceEndpoint1), "0");
+
+ ethernet::Address ethEp{0x01, 0x00, 0x5e, 0x90, 0x10, 0x01};
+ FaceEndpoint faceEndpoint2(face, ethEp);
+ BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(faceEndpoint2), "(0, 01:00:5e:90:10:01)");
+
+ udp::Endpoint udp4Ep{boost::asio::ip::address_v4(0xe00017aa), 56363};
+ FaceEndpoint faceEndpoint3(face, udp4Ep);
+ BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(faceEndpoint3), "(0, 224.0.23.170:56363)");
+
+ udp::Endpoint udp6Ep{boost::asio::ip::address_v6::loopback(), 12345};
+ FaceEndpoint faceEndpoint4(face, udp6Ep);
+ BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(faceEndpoint4), "(0, [::1]:12345)");
+}
+
+BOOST_AUTO_TEST_SUITE_END() // TestFaceEndpoint
+BOOST_AUTO_TEST_SUITE_END() // Face
+
+} // namespace nfd::tests
diff --git a/tests/daemon/face/face.t.cpp b/tests/daemon/face/face.t.cpp
index 34a19a7..8b8448d 100644
--- a/tests/daemon/face/face.t.cpp
+++ b/tests/daemon/face/face.t.cpp
@@ -104,16 +104,16 @@
face1->afterReceiveNack.connect([&] (auto&&...) { ++nReceivedNacks; });
for (size_t i = 0; i < nInInterests; ++i) {
- face1->receiveInterest(*makeInterest("/JSQdqward4"), 0);
+ face1->receiveInterest(*makeInterest("/JSQdqward4"));
}
for (size_t i = 0; i < nInData; ++i) {
- face1->receiveData(*makeData("/hT8FDigWn1"), 0);
+ face1->receiveData(*makeData("/hT8FDigWn1"));
}
for (size_t i = 0; i < nInNacks; ++i) {
face1->receiveNack(makeNack(*makeInterest("/StnEVTj4Ex", false, std::nullopt, 561),
- lp::NackReason::CONGESTION), 0);
+ lp::NackReason::CONGESTION));
}
for (size_t i = 0; i < nOutInterests; ++i) {
diff --git a/tests/daemon/face/lp-reassembler.t.cpp b/tests/daemon/face/lp-reassembler.t.cpp
index 16a3592..073c3db 100644
--- a/tests/daemon/face/lp-reassembler.t.cpp
+++ b/tests/daemon/face/lp-reassembler.t.cpp
@@ -38,7 +38,7 @@
LpReassemblerFixture()
{
reassembler.beforeTimeout.connect(
- [this] (EndpointId remoteEp, size_t nDroppedFragments) {
+ [this] (const EndpointId& remoteEp, size_t nDroppedFragments) {
timeoutHistory.emplace_back(remoteEp, nDroppedFragments);
});
}
@@ -72,7 +72,7 @@
bool isComplete = false;
Block netPacket;
lp::Packet packet;
- std::tie(isComplete, netPacket, packet) = reassembler.receiveFragment(0, received);
+ std::tie(isComplete, netPacket, packet) = reassembler.receiveFragment({}, received);
BOOST_REQUIRE(isComplete);
BOOST_CHECK(packet.has<lp::NextHopFaceIdField>());
@@ -93,7 +93,7 @@
bool isComplete = false;
Block netPacket;
lp::Packet packet;
- std::tie(isComplete, netPacket, packet) = reassembler.receiveFragment(0, received);
+ std::tie(isComplete, netPacket, packet) = reassembler.receiveFragment({}, received);
BOOST_REQUIRE(isComplete);
BOOST_CHECK(packet.has<lp::NextHopFaceIdField>());
@@ -113,7 +113,7 @@
bool isComplete = false;
Block netPacket;
lp::Packet packet;
- std::tie(isComplete, netPacket, packet) = reassembler.receiveFragment(0, received);
+ std::tie(isComplete, netPacket, packet) = reassembler.receiveFragment({}, received);
BOOST_REQUIRE(isComplete);
BOOST_CHECK(packet.has<lp::NextHopFaceIdField>());
@@ -132,7 +132,7 @@
bool isComplete = false;
Block netPacket;
lp::Packet packet;
- std::tie(isComplete, netPacket, packet) = reassembler.receiveFragment(0, received);
+ std::tie(isComplete, netPacket, packet) = reassembler.receiveFragment({}, received);
BOOST_REQUIRE(isComplete);
BOOST_CHECK(packet.has<lp::NextHopFaceIdField>());
@@ -172,15 +172,15 @@
Block netPacket;
lp::Packet packet;
- std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(0, received1);
- BOOST_REQUIRE(!isComplete);
+ std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment({}, received1);
+ BOOST_TEST(!isComplete);
BOOST_CHECK_EQUAL(reassembler.size(), 1);
- std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(0, received2);
- BOOST_REQUIRE(!isComplete);
+ std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment({}, received2);
+ BOOST_TEST(!isComplete);
BOOST_CHECK_EQUAL(reassembler.size(), 1);
- std::tie(isComplete, netPacket, packet) = reassembler.receiveFragment(0, received3);
+ std::tie(isComplete, netPacket, packet) = reassembler.receiveFragment({}, received3);
BOOST_REQUIRE(isComplete);
BOOST_CHECK(packet.has<lp::NextHopFaceIdField>());
BOOST_CHECK_EQUAL_COLLECTIONS(data, data + sizeof(data), netPacket.begin(), netPacket.end());
@@ -215,13 +215,13 @@
Block netPacket;
lp::Packet packet;
- std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(0, received1);
- BOOST_REQUIRE(!isComplete);
+ std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment({}, received1);
+ BOOST_TEST(!isComplete);
- std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(0, received2);
- BOOST_REQUIRE(!isComplete);
+ std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment({}, received2);
+ BOOST_TEST(!isComplete);
- std::tie(isComplete, netPacket, packet) = reassembler.receiveFragment(0, received3);
+ std::tie(isComplete, netPacket, packet) = reassembler.receiveFragment({}, received3);
BOOST_REQUIRE(isComplete);
BOOST_CHECK(packet.has<lp::NextHopFaceIdField>());
BOOST_CHECK_EQUAL_COLLECTIONS(data, data + sizeof(data), netPacket.begin(), netPacket.end());
@@ -254,14 +254,14 @@
bool isComplete = false;
- std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(0, frag2);
- BOOST_REQUIRE(!isComplete);
+ std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment({}, frag2);
+ BOOST_TEST(!isComplete);
- std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(0, frag0);
- BOOST_REQUIRE(!isComplete);
+ std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment({}, frag0);
+ BOOST_TEST(!isComplete);
- std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(0, frag1);
- BOOST_REQUIRE(isComplete);
+ std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment({}, frag1);
+ BOOST_TEST(isComplete);
}
BOOST_AUTO_TEST_CASE(Duplicate)
@@ -276,11 +276,11 @@
bool isComplete = false;
- std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(0, frag0);
- BOOST_REQUIRE(!isComplete);
+ std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment({}, frag0);
+ BOOST_TEST(!isComplete);
- std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(1, frag0);
- BOOST_REQUIRE(!isComplete);
+ std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment({}, frag0);
+ BOOST_TEST(!isComplete);
}
BOOST_AUTO_TEST_CASE(Timeout)
@@ -301,21 +301,21 @@
received2.add<lp::FragCountField>(2);
received2.add<lp::SequenceField>(1001);
- const EndpointId REMOTE_EP = 11028;
+ const EndpointId REMOTE_EP = ethernet::getDefaultMulticastAddress();
bool isComplete = false;
std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(REMOTE_EP, received1);
- BOOST_REQUIRE(!isComplete);
+ BOOST_TEST(!isComplete);
BOOST_CHECK_EQUAL(reassembler.size(), 1);
BOOST_CHECK(timeoutHistory.empty());
advanceClocks(1_ms, 600);
BOOST_CHECK_EQUAL(reassembler.size(), 0);
BOOST_REQUIRE_EQUAL(timeoutHistory.size(), 1);
- BOOST_CHECK_EQUAL(std::get<0>(timeoutHistory.back()), REMOTE_EP);
+ BOOST_CHECK(std::get<0>(timeoutHistory.back()) == REMOTE_EP);
BOOST_CHECK_EQUAL(std::get<1>(timeoutHistory.back()), 1);
std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(REMOTE_EP, received2);
- BOOST_REQUIRE(!isComplete);
+ BOOST_TEST(!isComplete);
}
BOOST_AUTO_TEST_CASE(MissingSequence)
@@ -344,19 +344,19 @@
bool isComplete = false;
- std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(0, received1);
- BOOST_REQUIRE(!isComplete);
+ std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment({}, received1);
+ BOOST_TEST(!isComplete);
- std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(0, received2);
- BOOST_REQUIRE(!isComplete);
+ std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment({}, received2);
+ BOOST_TEST(!isComplete);
- std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(0, received3);
- BOOST_REQUIRE(!isComplete);
+ std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment({}, received3);
+ BOOST_TEST(!isComplete);
advanceClocks(1_ms, 600);
- std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(0, received2);
- BOOST_REQUIRE(!isComplete);
+ std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment({}, received2);
+ BOOST_TEST(!isComplete);
}
BOOST_AUTO_TEST_CASE(FragCountOverLimit)
@@ -372,8 +372,8 @@
bool isComplete = false;
- std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(0, received1);
- BOOST_REQUIRE(!isComplete);
+ std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment({}, received1);
+ BOOST_TEST(!isComplete);
}
BOOST_AUTO_TEST_CASE(MissingFragCount)
@@ -403,14 +403,14 @@
bool isComplete = false;
- std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(0, received1);
- BOOST_REQUIRE(!isComplete);
+ std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment({}, received1);
+ BOOST_TEST(!isComplete);
- std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(0, received2);
- BOOST_REQUIRE(!isComplete);
+ std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment({}, received2);
+ BOOST_TEST(!isComplete);
- std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(0, received3);
- BOOST_REQUIRE(!isComplete);
+ std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment({}, received3);
+ BOOST_TEST(!isComplete);
}
BOOST_AUTO_TEST_CASE(OverFragCount)
@@ -444,14 +444,14 @@
bool isComplete = false;
- std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(0, received1);
- BOOST_REQUIRE(!isComplete);
+ std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment({}, received1);
+ BOOST_TEST(!isComplete);
- std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(0, received2);
- BOOST_REQUIRE(!isComplete);
+ std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment({}, received2);
+ BOOST_TEST(!isComplete);
- std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(0, received3);
- BOOST_REQUIRE(!isComplete);
+ std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment({}, received3);
+ BOOST_TEST(!isComplete);
}
BOOST_AUTO_TEST_SUITE_END() // MultiFragment
@@ -491,20 +491,23 @@
bool isComplete = false;
- std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(1, frag1_1);
- BOOST_REQUIRE(!isComplete);
+ const EndpointId REMOTE_EP_1 = ethernet::Address::fromString("11:22:33:45:67:89");
+ const EndpointId REMOTE_EP_2 = ethernet::Address::fromString("11:22:33:ab:cd:ef");
+
+ std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(REMOTE_EP_1, frag1_1);
+ BOOST_TEST(!isComplete);
BOOST_CHECK_EQUAL(reassembler.size(), 1);
- std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(2, frag2_2);
- BOOST_REQUIRE(!isComplete);
+ std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(REMOTE_EP_2, frag2_2);
+ BOOST_TEST(!isComplete);
BOOST_CHECK_EQUAL(reassembler.size(), 2);
- std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(1, frag1_2);
- BOOST_REQUIRE(isComplete);
+ std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(REMOTE_EP_1, frag1_2);
+ BOOST_TEST(isComplete);
BOOST_CHECK_EQUAL(reassembler.size(), 1);
- std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(2, frag2_1);
- BOOST_REQUIRE(isComplete);
+ std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(REMOTE_EP_2, frag2_1);
+ BOOST_TEST(isComplete);
BOOST_CHECK_EQUAL(reassembler.size(), 0);
}
diff --git a/tests/daemon/face/multicast-udp-transport.t.cpp b/tests/daemon/face/multicast-udp-transport.t.cpp
index f32d30f..efdd4f2 100644
--- a/tests/daemon/face/multicast-udp-transport.t.cpp
+++ b/tests/daemon/face/multicast-udp-transport.t.cpp
@@ -72,7 +72,7 @@
BOOST_CHECK_EQUAL(transport->canChangePersistencyTo(ndn::nfd::FACE_PERSISTENCY_PERMANENT), true);
}
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(ReceiveMultipleRemoteEndpoints, T, MulticastUdpTransportFixtures, T)
+BOOST_FIXTURE_TEST_CASE_TEMPLATE(ReceiveFromMultipleEndpoints, T, MulticastUdpTransportFixtures, T)
{
TRANSPORT_TEST_INIT();
@@ -93,8 +93,8 @@
BOOST_CHECK_EQUAL(this->transport->getState(), TransportState::UP);
BOOST_REQUIRE_EQUAL(this->receivedPackets->size(), 2);
- BOOST_CHECK_EQUAL(this->receivedPackets->at(0).endpoint,
- this->receivedPackets->at(1).endpoint);
+ BOOST_CHECK(this->receivedPackets->at(0).endpoint == this->receivedPackets->at(1).endpoint);
+ BOOST_CHECK(std::holds_alternative<nfd::udp::Endpoint>(this->receivedPackets->at(0).endpoint));
this->sendToGroup(remoteSockTx2, buf1);
this->sendToGroup(remoteSockTx2, buf2);
@@ -105,10 +105,11 @@
BOOST_CHECK_EQUAL(this->transport->getState(), TransportState::UP);
BOOST_REQUIRE_EQUAL(this->receivedPackets->size(), 4);
- BOOST_CHECK_EQUAL(this->receivedPackets->at(2).endpoint,
- this->receivedPackets->at(3).endpoint);
- BOOST_CHECK_NE(this->receivedPackets->at(0).endpoint,
- this->receivedPackets->at(2).endpoint);
+ EndpointId epId2(remoteSockTx2.local_endpoint());
+ BOOST_CHECK(this->receivedPackets->at(0).endpoint != epId2);
+ BOOST_CHECK(this->receivedPackets->at(1).endpoint != epId2);
+ BOOST_CHECK(this->receivedPackets->at(2).endpoint == epId2);
+ BOOST_CHECK(this->receivedPackets->at(3).endpoint == epId2);
}
BOOST_AUTO_TEST_SUITE_END() // TestMulticastUdpTransport
diff --git a/tests/daemon/face/stream-transport.t.cpp b/tests/daemon/face/stream-transport.t.cpp
index 9c13653..2acacfb 100644
--- a/tests/daemon/face/stream-transport.t.cpp
+++ b/tests/daemon/face/stream-transport.t.cpp
@@ -93,8 +93,8 @@
BOOST_REQUIRE_EQUAL(this->receivedPackets->size(), 2);
BOOST_CHECK(this->receivedPackets->at(0).packet == pkt1);
BOOST_CHECK(this->receivedPackets->at(1).packet == pkt2);
- BOOST_CHECK_EQUAL(this->receivedPackets->at(0).endpoint, 0);
- BOOST_CHECK_EQUAL(this->receivedPackets->at(1).endpoint, 0);
+ BOOST_CHECK(this->receivedPackets->at(0).endpoint == EndpointId{});
+ BOOST_CHECK(this->receivedPackets->at(1).endpoint == EndpointId{});
}
BOOST_FIXTURE_TEST_CASE_TEMPLATE(ReceiveMultipleSegments, T, StreamTransportFixtures, T)
diff --git a/tests/daemon/face/websocket-transport.t.cpp b/tests/daemon/face/websocket-transport.t.cpp
index fe79de9..e8733b2 100644
--- a/tests/daemon/face/websocket-transport.t.cpp
+++ b/tests/daemon/face/websocket-transport.t.cpp
@@ -166,8 +166,8 @@
BOOST_REQUIRE_EQUAL(this->serverReceivedPackets->size(), 2);
BOOST_CHECK(this->serverReceivedPackets->at(0).packet == pkt1);
BOOST_CHECK(this->serverReceivedPackets->at(1).packet == pkt2);
- BOOST_CHECK_EQUAL(this->serverReceivedPackets->at(0).endpoint, 0);
- BOOST_CHECK_EQUAL(this->serverReceivedPackets->at(1).endpoint, 0);
+ BOOST_CHECK(this->serverReceivedPackets->at(0).endpoint == EndpointId{});
+ BOOST_CHECK(this->serverReceivedPackets->at(1).endpoint == EndpointId{});
}
BOOST_FIXTURE_TEST_CASE_TEMPLATE(ReceiveMalformed, T, WebSocketTransportFixtures, T)
diff --git a/tests/daemon/fw/best-route-strategy.t.cpp b/tests/daemon/fw/best-route-strategy.t.cpp
index efaf90c..ce408ec 100644
--- a/tests/daemon/fw/best-route-strategy.t.cpp
+++ b/tests/daemon/fw/best-route-strategy.t.cpp
@@ -86,7 +86,7 @@
// first Interest goes to nexthop with lowest FIB cost,
// however face1 is downstream so it cannot be used
pitEntry->insertOrUpdateInRecord(*face1, *interest);
- strategy.afterReceiveInterest(*interest, FaceEndpoint(*face1, 0), pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face1), pitEntry);
BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 1);
BOOST_CHECK_EQUAL(strategy.sendInterestHistory.back().outFaceId, face2->getId());
@@ -98,7 +98,7 @@
std::function<void()> periodicalRetxFrom4; // let periodicalRetxFrom4 lambda capture itself
periodicalRetxFrom4 = [&] {
pitEntry->insertOrUpdateInRecord(*face4, *interest);
- strategy.afterReceiveInterest(*interest, FaceEndpoint(*face4, 0), pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face4), pitEntry);
size_t nSent = strategy.sendInterestHistory.size();
if (nSent > nSentLast) {
@@ -130,7 +130,7 @@
for (int i = 0; i < 3; ++i) {
this->advanceClocks(TICK, fw::RetxSuppressionExponential::DEFAULT_MAX_INTERVAL * 2);
pitEntry->insertOrUpdateInRecord(*face5, *interest);
- strategy.afterReceiveInterest(*interest, FaceEndpoint(*face5, 0), pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face5), pitEntry);
}
BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 3);
BOOST_CHECK_NE(strategy.sendInterestHistory[0].outFaceId, face1->getId());
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);
}
diff --git a/tests/daemon/fw/multicast-strategy.t.cpp b/tests/daemon/fw/multicast-strategy.t.cpp
index 3b91c63..a69c3a5 100644
--- a/tests/daemon/fw/multicast-strategy.t.cpp
+++ b/tests/daemon/fw/multicast-strategy.t.cpp
@@ -85,7 +85,7 @@
auto pitEntry = pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*face1, *interest);
- strategy.afterReceiveInterest(*interest, FaceEndpoint(*face1, 0), pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face1), pitEntry);
BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 0);
BOOST_CHECK_EQUAL(strategy.sendInterestHistory.size(), 1);
@@ -96,7 +96,7 @@
pitEntry = pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*face2, *interest);
- strategy.afterReceiveInterest(*interest, FaceEndpoint(*face2, 0), pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face2), pitEntry);
// Since the interest is the same as the one sent out earlier, the PIT entry should not be
// rejected, as any data coming back must be able to satisfy the original interest from face 1
BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 0);
@@ -162,7 +162,7 @@
auto pitEntry = pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*face3, *interest);
- strategy.afterReceiveInterest(*interest, FaceEndpoint(*face3, 0), pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face3), pitEntry);
BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 0);
BOOST_CHECK_EQUAL(strategy.sendInterestHistory.size(), 2);
BOOST_TEST(didSendInterestTo(*face1));
@@ -179,7 +179,7 @@
std::function<void()> periodicalRetxFrom4; // let periodicalRetxFrom4 lambda capture itself
periodicalRetxFrom4 = [&] {
pitEntry->insertOrUpdateInRecord(*face3, *interest);
- strategy.afterReceiveInterest(*interest, FaceEndpoint(*face3, 0), pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face3), pitEntry);
size_t nSent = strategy.sendInterestHistory.size();
if (nSent > nSentLast) {
@@ -207,7 +207,7 @@
auto pitEntry = pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*face1, *interest);
- strategy.afterReceiveInterest(*interest, FaceEndpoint(*face1, 0), pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face1), pitEntry);
BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 0);
BOOST_CHECK_EQUAL(strategy.sendInterestHistory.size(), 0);
}
@@ -227,7 +227,7 @@
auto interest = makeInterest("/t8ZiSOi3");
auto pitEntry = pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*face1, *interest);
- strategy.afterReceiveInterest(*interest, FaceEndpoint(*face1, 0), pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face1), pitEntry);
// forwarded to faces 2 and 3
BOOST_TEST(strategy.sendInterestHistory.size() == 2);
@@ -242,7 +242,7 @@
interest->refreshNonce();
pitEntry = pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*face2, *interest);
- strategy.afterReceiveInterest(*interest, FaceEndpoint(*face2, 0), pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face2), pitEntry);
// forwarded only to face 1, suppressed on face 3
BOOST_TEST(strategy.sendInterestHistory.size() == 1);
@@ -256,7 +256,7 @@
interest->refreshNonce();
pitEntry = pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*face3, *interest);
- strategy.afterReceiveInterest(*interest, FaceEndpoint(*face3, 0), pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face3), pitEntry);
// suppressed on face 1, forwarded on face 2 (and suppression window doubles)
BOOST_TEST(strategy.sendInterestHistory.size() == 1);
@@ -270,7 +270,7 @@
interest->refreshNonce();
pitEntry = pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*face3, *interest);
- strategy.afterReceiveInterest(*interest, FaceEndpoint(*face3, 0), pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face3), pitEntry);
// forwarded only to face 1, suppressed on face 2
BOOST_TEST(strategy.sendInterestHistory.size() == 1);
@@ -284,7 +284,7 @@
interest->refreshNonce();
pitEntry = pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*face1, *interest);
- strategy.afterReceiveInterest(*interest, FaceEndpoint(*face1, 0), pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face1), pitEntry);
// forwarded to faces 2 and 3
BOOST_TEST(strategy.sendInterestHistory.size() == 2);
@@ -303,7 +303,7 @@
auto pitEntry = pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*face1, *interest);
- strategy.afterReceiveInterest(*interest, FaceEndpoint(*face1, 0), pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face1), pitEntry);
BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 0);
BOOST_CHECK_EQUAL(strategy.sendInterestHistory.size(), 1);
@@ -491,12 +491,12 @@
auto interest = makeInterest("ndn:/localhop/H0D6i5fc");
auto pitEntry = this->pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*this->inFace1, *interest);
- this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->inFace1, 0), pitEntry);
+ this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->inFace1), pitEntry);
if (this->inFace2 != nullptr) {
auto interest2 = makeInterest("ndn:/localhop/H0D6i5fc");
pitEntry->insertOrUpdateInRecord(*this->inFace2, *interest2);
- this->strategy.afterReceiveInterest(*interest2, FaceEndpoint(*this->inFace2, 0), pitEntry);
+ this->strategy.afterReceiveInterest(*interest2, FaceEndpoint(*this->inFace2), pitEntry);
}
this->strategy.sendInterestHistory.clear();
diff --git a/tests/daemon/fw/pit-expiry.t.cpp b/tests/daemon/fw/pit-expiry.t.cpp
index c2b6c41..3153a7d 100644
--- a/tests/daemon/fw/pit-expiry.t.cpp
+++ b/tests/daemon/fw/pit-expiry.t.cpp
@@ -132,8 +132,8 @@
interest1->setInterestLifetime(90_ms);
interest2->setInterestLifetime(90_ms);
- face1->receiveInterest(*interest1, 0);
- face2->receiveInterest(*interest2, 0);
+ face1->receiveInterest(*interest1);
+ face2->receiveInterest(*interest2);
BOOST_CHECK_EQUAL(pit.size(), 2);
this->advanceClocks(100_ms);
@@ -156,10 +156,10 @@
interest->setInterestLifetime(90_ms);
auto data = makeData("/A/0");
- face1->receiveInterest(*interest, 0);
+ face1->receiveInterest(*interest);
this->advanceClocks(30_ms);
- face2->receiveData(*data, 0);
+ face2->receiveData(*data);
this->advanceClocks(1_ms);
BOOST_CHECK_EQUAL(pit.size(), 0);
@@ -191,14 +191,14 @@
Cs& cs = forwarder.getCs();
cs.insert(*data);
- face1->receiveInterest(*interest, 0);
+ face1->receiveInterest(*interest);
this->advanceClocks(1_ms);
BOOST_CHECK_EQUAL(pit.size(), 1);
this->advanceClocks(190_ms);
BOOST_CHECK_EQUAL(pit.size(), 0);
- face1->receiveInterest(*interest, 0);
+ face1->receiveInterest(*interest);
this->advanceClocks(1_ms);
BOOST_CHECK_EQUAL(pit.size(), 0);
}
@@ -224,13 +224,13 @@
auto interest = makeInterest("/A/0", false, 90_ms, 562);
lp::Nack nack = makeNack(*interest, lp::NackReason::CONGESTION);
- face1->receiveInterest(*interest, 0);
+ face1->receiveInterest(*interest);
auto entry = pit.find(*interest);
entry->insertOrUpdateOutRecord(*face2, *interest);
entry->insertOrUpdateOutRecord(*face3, *interest);
this->advanceClocks(10_ms);
- face2->receiveNack(nack, 0);
+ face2->receiveNack(nack);
this->advanceClocks(1_ms);
BOOST_CHECK_EQUAL(pit.size(), 1);
@@ -255,7 +255,7 @@
auto interest = makeInterest("/A/0", false, 90_ms);
- face->receiveInterest(*interest, 0);
+ face->receiveInterest(*interest);
BOOST_CHECK_EQUAL(pit.size(), 1);
this->advanceClocks(100_ms);
@@ -289,30 +289,30 @@
auto interest2 = makeInterest("/A/0", false, 90_ms);
auto data = makeData("/A/0");
- face1->receiveInterest(*interest1, 0);
- face2->receiveInterest(*interest2, 0);
+ face1->receiveInterest(*interest1);
+ face2->receiveInterest(*interest2);
BOOST_CHECK_EQUAL(pit.size(), 2);
// beforeSatisfyInterest: the first Data prolongs PIT expiry timer by 190 ms
this->advanceClocks(30_ms);
- face3->receiveData(*data, 0);
+ face3->receiveData(*data);
this->advanceClocks(189_ms);
BOOST_CHECK_EQUAL(pit.size(), 2);
this->advanceClocks(2_ms);
BOOST_CHECK_EQUAL(pit.size(), 0);
- face1->receiveInterest(*interest1, 0);
- face2->receiveInterest(*interest2, 0);
+ face1->receiveInterest(*interest1);
+ face2->receiveInterest(*interest2);
// beforeSatisfyInterest: the second Data prolongs PIT expiry timer
// and the third one sets the timer to now
this->advanceClocks(30_ms);
- face3->receiveData(*data, 0);
+ face3->receiveData(*data);
this->advanceClocks(1_ms);
BOOST_CHECK_EQUAL(pit.size(), 2);
this->advanceClocks(30_ms);
- face3->receiveData(*data, 0);
+ face3->receiveData(*data);
this->advanceClocks(1_ms);
BOOST_CHECK_EQUAL(pit.size(), 0);
@@ -341,27 +341,27 @@
auto interest = makeInterest("/A/0", false, 90_ms);
auto data = makeData("/A/0");
- face1->receiveInterest(*interest, 0);
+ face1->receiveInterest(*interest);
// afterReceiveData: the first Data prolongs PIT expiry timer by 290 ms
this->advanceClocks(30_ms);
- face2->receiveData(*data, 0);
+ face2->receiveData(*data);
this->advanceClocks(289_ms);
BOOST_CHECK_EQUAL(pit.size(), 1);
this->advanceClocks(2_ms);
BOOST_CHECK_EQUAL(pit.size(), 0);
- face1->receiveInterest(*interest, 0);
+ face1->receiveInterest(*interest);
// afterReceiveData: the second Data prolongs PIT expiry timer
// and the third one sets the timer to now
this->advanceClocks(30_ms);
- face2->receiveData(*data, 0);
+ face2->receiveData(*data);
this->advanceClocks(1_ms);
BOOST_CHECK_EQUAL(pit.size(), 1);
this->advanceClocks(30_ms);
- face2->receiveData(*data, 0);
+ face2->receiveData(*data);
this->advanceClocks(1_ms);
BOOST_CHECK_EQUAL(pit.size(), 0);
@@ -390,20 +390,20 @@
auto interest = makeInterest("/A/0", false, 90_ms, 562);
lp::Nack nack = makeNack(*interest, lp::NackReason::CONGESTION);
- face1->receiveInterest(*interest, 0);
+ face1->receiveInterest(*interest);
auto entry = pit.find(*interest);
entry->insertOrUpdateOutRecord(*face2, *interest);
entry->insertOrUpdateOutRecord(*face3, *interest);
//pitEntry is not erased after receiving the first Nack
this->advanceClocks(10_ms);
- face2->receiveNack(nack, 0);
+ face2->receiveNack(nack);
this->advanceClocks(1_ms);
BOOST_CHECK_EQUAL(pit.size(), 1);
//pitEntry is erased after receiving the second Nack
this->advanceClocks(10_ms);
- face3->receiveNack(nack, 0);
+ face3->receiveNack(nack);
this->advanceClocks(1_ms);
BOOST_CHECK_EQUAL(pit.size(), 0);
}
diff --git a/tests/daemon/fw/random-strategy.t.cpp b/tests/daemon/fw/random-strategy.t.cpp
index b89d48c..ae34b03 100644
--- a/tests/daemon/fw/random-strategy.t.cpp
+++ b/tests/daemon/fw/random-strategy.t.cpp
@@ -80,7 +80,7 @@
auto pitEntry = pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*face1, *interest);
- strategy.afterReceiveInterest(*interest, FaceEndpoint(*face1, 0), pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face1), pitEntry);
}
// Map outFaceId -> SentInterests
diff --git a/tests/daemon/fw/strategy-nack-return.t.cpp b/tests/daemon/fw/strategy-nack-return.t.cpp
index 9dcd0c9..4b6961d 100644
--- a/tests/daemon/fw/strategy-nack-return.t.cpp
+++ b/tests/daemon/fw/strategy-nack-return.t.cpp
@@ -108,7 +108,7 @@
pitEntry->getOutRecord(*this->face3)->setIncomingNack(nack3);
auto f = [&] {
- this->strategy.afterReceiveNack(nack3, FaceEndpoint(*this->face3, 0), pitEntry);
+ this->strategy.afterReceiveNack(nack3, FaceEndpoint(*this->face3), pitEntry);
};
BOOST_REQUIRE(this->strategy.waitForAction(f, this->limitedIo, 2));
@@ -144,7 +144,7 @@
lp::Nack nack3 = makeNack(*interest1, lp::NackReason::CONGESTION);
pitEntry->getOutRecord(*this->face3)->setIncomingNack(nack3);
- this->strategy.afterReceiveNack(nack3, FaceEndpoint(*this->face3, 0), pitEntry);
+ this->strategy.afterReceiveNack(nack3, FaceEndpoint(*this->face3), pitEntry);
BOOST_CHECK_EQUAL(this->strategy.sendNackHistory.size(), 0); // don't send Nack until all upstreams have Nacked
@@ -152,7 +152,7 @@
pitEntry->getOutRecord(*this->face4)->setIncomingNack(nack4);
auto f = [&] {
- this->strategy.afterReceiveNack(nack4, FaceEndpoint(*this->face4, 0), pitEntry);
+ this->strategy.afterReceiveNack(nack4, FaceEndpoint(*this->face4), pitEntry);
};
BOOST_REQUIRE(this->strategy.waitForAction(f, this->limitedIo));
@@ -186,7 +186,7 @@
lp::Nack nack4 = makeNack(*interest2, lp::NackReason::CONGESTION);
pitEntry->getOutRecord(*this->face4)->setIncomingNack(nack4);
- this->strategy.afterReceiveNack(nack4, FaceEndpoint(*this->face4, 0), pitEntry);
+ this->strategy.afterReceiveNack(nack4, FaceEndpoint(*this->face4), pitEntry);
BOOST_CHECK_EQUAL(this->strategy.sendNackHistory.size(), 0);
}
@@ -319,13 +319,13 @@
lp::Nack nack3 = makeNack(*interest1, Combination::firstReason);
pitEntry->getOutRecord(*face3)->setIncomingNack(nack3);
- strategy.afterReceiveNack(nack3, FaceEndpoint(*face3, 0), pitEntry);
+ strategy.afterReceiveNack(nack3, FaceEndpoint(*face3), pitEntry);
BOOST_CHECK_EQUAL(strategy.sendNackHistory.size(), 0);
lp::Nack nack4 = makeNack(*interest1, Combination::secondReason);
pitEntry->getOutRecord(*face4)->setIncomingNack(nack4);
- strategy.afterReceiveNack(nack4, FaceEndpoint(*face4, 0), pitEntry);
+ strategy.afterReceiveNack(nack4, FaceEndpoint(*face4), pitEntry);
BOOST_REQUIRE_EQUAL(strategy.sendNackHistory.size(), 1);
BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitInterest.wireEncode(),
diff --git a/tests/daemon/fw/strategy-no-route.t.cpp b/tests/daemon/fw/strategy-no-route.t.cpp
index 4fab4e5..3dfce2c 100644
--- a/tests/daemon/fw/strategy-no-route.t.cpp
+++ b/tests/daemon/fw/strategy-no-route.t.cpp
@@ -165,7 +165,7 @@
pitEntry->insertOrUpdateInRecord(*this->face1, *interest);
auto f = [&] {
- this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->face1, 0), pitEntry);
+ this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->face1), pitEntry);
};
BOOST_REQUIRE(this->strategy.waitForAction(f, this->limitedIo, 2));
diff --git a/tests/daemon/fw/strategy-scope-control.t.cpp b/tests/daemon/fw/strategy-scope-control.t.cpp
index d44460f..392becb 100644
--- a/tests/daemon/fw/strategy-scope-control.t.cpp
+++ b/tests/daemon/fw/strategy-scope-control.t.cpp
@@ -128,7 +128,7 @@
pitEntry->insertOrUpdateInRecord(*this->localFace3, *interest);
BOOST_REQUIRE(this->strategy.waitForAction(
- [&] { this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->localFace3, 0), pitEntry); },
+ [&] { this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->localFace3), pitEntry); },
this->limitedIo));
BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 1);
@@ -147,7 +147,7 @@
pitEntry->insertOrUpdateInRecord(*this->localFace3, *interest);
BOOST_REQUIRE(this->strategy.waitForAction(
- [&] { this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->localFace3, 0), pitEntry); },
+ [&] { this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->localFace3), pitEntry); },
this->limitedIo, T::willRejectPitEntry() + T::willSendNackNoRoute()));
BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 0);
@@ -170,7 +170,7 @@
pitEntry->insertOrUpdateInRecord(*this->localFace3, *interest);
BOOST_REQUIRE(this->strategy.waitForAction(
- [&] { this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->localFace3, 0), pitEntry); },
+ [&] { this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->localFace3), pitEntry); },
this->limitedIo));
BOOST_REQUIRE_EQUAL(this->strategy.sendInterestHistory.size(), 1);
@@ -190,7 +190,7 @@
pitEntry->insertOrUpdateInRecord(*this->nonLocalFace1, *interest);
BOOST_REQUIRE(this->strategy.waitForAction(
- [&] { this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->nonLocalFace1, 0), pitEntry); },
+ [&] { this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->nonLocalFace1), pitEntry); },
this->limitedIo, T::willRejectPitEntry() + T::willSendNackNoRoute()));
BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 0);
@@ -213,7 +213,7 @@
pitEntry->insertOrUpdateInRecord(*this->nonLocalFace1, *interest);
BOOST_REQUIRE(this->strategy.waitForAction(
- [&] { this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->nonLocalFace1, 0), pitEntry); },
+ [&] { this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->nonLocalFace1), pitEntry); },
this->limitedIo));
BOOST_REQUIRE_EQUAL(this->strategy.sendInterestHistory.size(), 1);
@@ -236,7 +236,7 @@
pitEntry->insertOrUpdateOutRecord(*this->localFace4, *interest)->setIncomingNack(nack);
BOOST_REQUIRE(this->strategy.waitForAction(
- [&] { this->strategy.afterReceiveNack(nack, FaceEndpoint(*this->localFace4, 0), pitEntry); },
+ [&] { this->strategy.afterReceiveNack(nack, FaceEndpoint(*this->localFace4), pitEntry); },
this->limitedIo, T::canProcessNack()));
BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 0);
@@ -261,7 +261,7 @@
pitEntry->insertOrUpdateOutRecord(*this->localFace4, *interest)->setIncomingNack(nack);
BOOST_REQUIRE(this->strategy.waitForAction(
- [&] { this->strategy.afterReceiveNack(nack, FaceEndpoint(*this->localFace4, 0), pitEntry); },
+ [&] { this->strategy.afterReceiveNack(nack, FaceEndpoint(*this->localFace4), pitEntry); },
this->limitedIo, T::canProcessNack()));
BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 0);
diff --git a/tests/daemon/fw/unsolicited-data-policy.t.cpp b/tests/daemon/fw/unsolicited-data-policy.t.cpp
index ee5ae77..67be5b2 100644
--- a/tests/daemon/fw/unsolicited-data-policy.t.cpp
+++ b/tests/daemon/fw/unsolicited-data-policy.t.cpp
@@ -114,7 +114,7 @@
faceTable.add(face1);
auto data1 = makeData("/unsolicited-from-local");
- forwarder.onIncomingData(*data1, FaceEndpoint(*face1, 0));
+ forwarder.onIncomingData(*data1, FaceEndpoint(*face1));
BOOST_CHECK_EQUAL(isInCs(*data1), T::ShouldAdmitLocal::value);
auto face2 = make_shared<DummyFace>("dummy://", "dummy://",
@@ -122,7 +122,7 @@
faceTable.add(face2);
auto data2 = makeData("/unsolicited-from-non-local");
- forwarder.onIncomingData(*data2, FaceEndpoint(*face2, 0));
+ forwarder.onIncomingData(*data2, FaceEndpoint(*face2));
BOOST_CHECK_EQUAL(isInCs(*data2), T::ShouldAdmitNonLocal::value);
}