diff --git a/daemon/face/datagram-transport.hpp b/daemon/face/datagram-transport.hpp index e053af24..51f06a0d 100644 --- a/daemon/face/datagram-transport.hpp +++ b/daemon/face/datagram-transport.hpp @@ -37,15 +37,18 @@ namespace nfd::face { struct Unicast {}; struct Multicast {}; -/** \brief Implements Transport for datagram-based protocols. +/** + * \brief Implements Transport for datagram-based protocols. * - * \tparam Protocol a datagram-based protocol in Boost.Asio + * \tparam Protocol A datagram-based protocol in Boost.Asio + * \tparam Addressing The addressing mode, either Unicast or Multicast */ -template +template class DatagramTransport : public Transport { public: using protocol = Protocol; + using addressing = Addressing; /** \brief Construct datagram transport. * @@ -85,9 +88,6 @@ protected: void resetRecentlyReceived(); - static EndpointId - makeEndpointId(const typename protocol::endpoint& ep); - protected: typename protocol::socket m_socket; typename protocol::endpoint m_sender; @@ -190,7 +190,10 @@ DatagramTransport::receiveDatagram(span buffer, } m_hasRecentlyReceived = true; - this->receive(element, makeEndpointId(m_sender)); + if constexpr (std::is_same_v) + this->receive(element, m_sender); + else + this->receive(element); } template @@ -254,13 +257,6 @@ DatagramTransport::resetRecentlyReceived() m_hasRecentlyReceived = false; } -template -EndpointId -DatagramTransport::makeEndpointId(const typename protocol::endpoint&) -{ - return 0; -} - } // namespace nfd::face #endif // NFD_DAEMON_FACE_DATAGRAM_TRANSPORT_HPP diff --git a/daemon/face/ethernet-transport.cpp b/daemon/face/ethernet-transport.cpp index 53de0b77..c122a803 100644 --- a/daemon/face/ethernet-transport.cpp +++ b/daemon/face/ethernet-transport.cpp @@ -29,8 +29,6 @@ #include -#include // for memcpy() - #include namespace nfd::face { @@ -207,13 +205,7 @@ EthernetTransport::receivePayload(span payload, const ethernet::A } m_hasRecentlyReceived = true; - static_assert(sizeof(EndpointId) >= ethernet::ADDR_LEN, "EndpointId is too small"); - EndpointId endpoint = 0; - if (m_destAddress.isMulticast()) { - std::memcpy(&endpoint, sender.data(), sender.size()); - } - - this->receive(element, endpoint); + this->receive(element, m_destAddress.isMulticast() ? sender : EndpointId{}); } void diff --git a/daemon/face/face-common.hpp b/daemon/face/face-common.hpp index 039d2fe3..996d7b6d 100644 --- a/daemon/face/face-common.hpp +++ b/daemon/face/face-common.hpp @@ -26,12 +26,14 @@ #ifndef NFD_DAEMON_FACE_FACE_COMMON_HPP #define NFD_DAEMON_FACE_FACE_COMMON_HPP -#include "core/common.hpp" +#include "ethernet-protocol.hpp" +#include "udp-protocol.hpp" #include "common/logger.hpp" #include #include +#include namespace nfd { namespace face { @@ -62,15 +64,17 @@ constexpr FaceId FACEID_RESERVED_MAX = 255; */ constexpr ssize_t MIN_MTU = 64; -/** \brief Identifies a remote endpoint on the link. +/** + * \brief Identifies a remote endpoint on the link. * - * This ID is only meaningful in the context of the same Transport. - * Incoming packets from the same remote endpoint have the same EndpointId, - * and incoming packets from different remote endpoints have different EndpointIds. + * This ID is only meaningful in the context of the same Transport. + * Incoming packets from the same remote endpoint have the same EndpointId, + * and incoming packets from different remote endpoints have different EndpointIds. * - * Typically, a point-to-point Transport has only one meaningful EndpointId (usually 0). + * Typically, a point-to-point Transport has only one meaningful EndpointId, + * represented by `std::monostate`. */ -using EndpointId = uint64_t; +using EndpointId = std::variant; /** \brief Parameters used to set Transport properties or LinkService options on a newly created face. * diff --git a/daemon/face/face-endpoint.cpp b/daemon/face/face-endpoint.cpp new file mode 100644 index 00000000..9871b2e7 --- /dev/null +++ b/daemon/face/face-endpoint.cpp @@ -0,0 +1,53 @@ +/* -*- 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 . + */ + +#include "face-endpoint.hpp" + +#include + +namespace nfd { + +FaceEndpoint::FaceEndpoint(Face& face, const EndpointId& endpoint) + : face(face) + , endpoint(endpoint) +{ +} + +void +FaceEndpoint::print(std::ostream& os) const +{ + std::visit(boost::hana::overload( + [&] (std::monostate) { + os << face.getId(); + }, + [&] (const ethernet::Address& ep) { + os << '(' << face.getId() << ", " << ep << ')'; + }, + [&] (const udp::Endpoint& ep) { + os << '(' << face.getId() << ", " << ep << ')'; + }), endpoint); +} + +} // namespace nfd diff --git a/daemon/face/face-endpoint.hpp b/daemon/face/face-endpoint.hpp index 366c7435..c9badef2 100644 --- a/daemon/face/face-endpoint.hpp +++ b/daemon/face/face-endpoint.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2021, Regents of the University of California, + * Copyright (c) 2014-2022, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -30,16 +30,25 @@ namespace nfd { -/** \brief Represents a face-endpoint pair in the forwarder. - * \sa face::Face, face::EndpointId +/** + * \brief Represents a face-endpoint pair in the forwarder. + * \sa face::Face, face::EndpointId */ class FaceEndpoint { public: - FaceEndpoint(Face& face, EndpointId endpoint) - : face(face) - , endpoint(endpoint) + explicit + FaceEndpoint(Face& face, const EndpointId& endpoint = {}); + +private: + void + print(std::ostream& os) const; + + friend std::ostream& + operator<<(std::ostream& os, const FaceEndpoint& fe) { + fe.print(os); + return os; } public: @@ -47,12 +56,6 @@ public: const EndpointId endpoint; }; -inline std::ostream& -operator<<(std::ostream& os, const FaceEndpoint& fe) -{ - return os << '(' << fe.face.getId() << ',' << fe.endpoint << ')'; -} - } // namespace nfd #endif // NFD_DAEMON_FACE_FACE_ENDPOINT_HPP diff --git a/daemon/face/lp-reassembler.cpp b/daemon/face/lp-reassembler.cpp index 6c27d80d..7f101bc3 100644 --- a/daemon/face/lp-reassembler.cpp +++ b/daemon/face/lp-reassembler.cpp @@ -40,7 +40,7 @@ LpReassembler::LpReassembler(const LpReassembler::Options& options, const LinkSe } std::tuple -LpReassembler::receiveFragment(EndpointId remoteEndpoint, const lp::Packet& packet) +LpReassembler::receiveFragment(const EndpointId& remoteEndpoint, const lp::Packet& packet) { BOOST_ASSERT(packet.has()); diff --git a/daemon/face/lp-reassembler.hpp b/daemon/face/lp-reassembler.hpp index 8009c67f..30fec049 100644 --- a/daemon/face/lp-reassembler.hpp +++ b/daemon/face/lp-reassembler.hpp @@ -79,19 +79,20 @@ public: * \throw tlv::Error packet is malformed */ std::tuple - receiveFragment(EndpointId remoteEndpoint, const lp::Packet& packet); + receiveFragment(const EndpointId& remoteEndpoint, const lp::Packet& packet); /** \brief count of partial packets */ size_t size() const; - /** \brief signals before a partial packet is dropped due to timeout + /** + * \brief Notifies before a partial packet is dropped due to timeout. * - * If a partial packet is incomplete and no new fragment is received - * within Options::reassemblyTimeout, it would be dropped due to timeout. - * Before it's erased, this signal is emitted with the remote endpoint, - * and the number of fragments being dropped. + * If a partial packet is incomplete and no new fragments are received within + * Options::reassemblyTimeout, the partial packet is dropped due to timeout. + * Before dropping the packet, this signal is emitted with the remote endpoint + * and the number of fragments being dropped. */ signal::Signal beforeTimeout; diff --git a/daemon/face/multicast-udp-transport.cpp b/daemon/face/multicast-udp-transport.cpp index e0b7ac5a..bcb799e9 100644 --- a/daemon/face/multicast-udp-transport.cpp +++ b/daemon/face/multicast-udp-transport.cpp @@ -31,7 +31,6 @@ #include #include -#include #ifdef __linux__ #include // for errno @@ -191,21 +190,4 @@ MulticastUdpTransport::openTxSocket(protocol::socket& sock, } } -template<> -EndpointId -DatagramTransport::makeEndpointId(const protocol::endpoint& ep) -{ - if (ep.address().is_v4()) { - return (static_cast(ep.port()) << 32) | - static_cast(ep.address().to_v4().to_ulong()); - } - else { - size_t seed = 0; - const auto& addrBytes = ep.address().to_v6().to_bytes(); - boost::hash_range(seed, addrBytes.begin(), addrBytes.end()); - boost::hash_combine(seed, ep.port()); - return seed; - } -} - } // namespace nfd::face diff --git a/daemon/face/multicast-udp-transport.hpp b/daemon/face/multicast-udp-transport.hpp index 5a19a0c4..23c1e1de 100644 --- a/daemon/face/multicast-udp-transport.hpp +++ b/daemon/face/multicast-udp-transport.hpp @@ -35,14 +35,6 @@ namespace nfd::face { NFD_LOG_MEMBER_DECL_SPECIALIZED((DatagramTransport)); -// Explicit specialization of makeEndpointId for the UDP multicast case. -// Note that this "shall be declared before the first use of the specialization -// that would cause an implicit instantiation to take place, in every translation -// unit in which such a use occurs". -template<> -EndpointId -DatagramTransport::makeEndpointId(const protocol::endpoint& ep); - /** * \brief A Transport that communicates on a UDP multicast group */ diff --git a/daemon/face/transport.hpp b/daemon/face/transport.hpp index ed91cbca..1c24c579 100644 --- a/daemon/face/transport.hpp +++ b/daemon/face/transport.hpp @@ -31,7 +31,8 @@ namespace nfd::face { -/** \brief Indicates the state of a transport. +/** + * \brief Indicates the state of a transport. */ enum class TransportState { NONE, @@ -263,13 +264,14 @@ public: // dynamic properties } protected: // upper interface to be invoked by subclass - /** \brief Pass a received link-layer packet to the upper layer for further processing - * \param packet the received packet, must be a valid and well-formed TLV block - * \param endpoint the source endpoint - * \warning Behavior is undefined if packet size exceeds the MTU limit + /** + * \brief Pass a received link-layer packet to the upper layer for further processing. + * \param packet The received packet, must be a valid and well-formed TLV block + * \param endpoint The source endpoint, optional for unicast transports + * \warning Behavior is undefined if packet size exceeds the MTU limit. */ void - receive(const Block& packet, const EndpointId& endpoint = 0); + receive(const Block& packet, const EndpointId& endpoint = {}); protected: // properties to be set by subclass void diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp index d984f0cb..f4f5928e 100644 --- a/daemon/fw/forwarder.cpp +++ b/daemon/fw/forwarder.cpp @@ -221,7 +221,7 @@ Forwarder::onContentStoreMiss(const Interest& interest, const FaceEndpoint& ingr // dispatch to strategy: after receive Interest m_strategyChoice.findEffectiveStrategy(*pitEntry) - .afterReceiveInterest(interest, FaceEndpoint(ingress.face, 0), pitEntry); + .afterReceiveInterest(interest, FaceEndpoint(ingress.face), pitEntry); } void diff --git a/tests/daemon/face/datagram-transport.t.cpp b/tests/daemon/face/datagram-transport.t.cpp index 055584c6..4e88ff2b 100644 --- a/tests/daemon/face/datagram-transport.t.cpp +++ b/tests/daemon/face/datagram-transport.t.cpp @@ -82,8 +82,12 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(ReceiveNormal, T, DatagramTransportFixtures, T) 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::addressing, + face::Unicast>; + BOOST_CHECK_EQUAL(std::holds_alternative(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 8374430c..15ab4454 100644 --- a/tests/daemon/face/dummy-face.hpp +++ b/tests/daemon/face/dummy-face.hpp @@ -60,17 +60,17 @@ public: /** \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 00000000..123a0f96 --- /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 . + */ + +#include "face/face-endpoint.hpp" + +#include "tests/test-common.hpp" +#include "dummy-face.hpp" + +#include + +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(faceEndpoint1), "0"); + + ethernet::Address ethEp{0x01, 0x00, 0x5e, 0x90, 0x10, 0x01}; + FaceEndpoint faceEndpoint2(face, ethEp); + BOOST_CHECK_EQUAL(boost::lexical_cast(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(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(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 34a19a79..8b8448db 100644 --- a/tests/daemon/face/face.t.cpp +++ b/tests/daemon/face/face.t.cpp @@ -104,16 +104,16 @@ BOOST_AUTO_TEST_CASE(LinkServiceSendReceive) 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 16a35921..073c3db7 100644 --- a/tests/daemon/face/lp-reassembler.t.cpp +++ b/tests/daemon/face/lp-reassembler.t.cpp @@ -38,7 +38,7 @@ protected: 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 @@ BOOST_AUTO_TEST_CASE(Normal) 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()); @@ -93,7 +93,7 @@ BOOST_AUTO_TEST_CASE(OmitFragIndex) 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()); @@ -113,7 +113,7 @@ BOOST_AUTO_TEST_CASE(OmitFragCount) 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()); @@ -132,7 +132,7 @@ BOOST_AUTO_TEST_CASE(OmitFragIndexAndFragCount) 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()); @@ -172,15 +172,15 @@ BOOST_AUTO_TEST_CASE(Normal) 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()); BOOST_CHECK_EQUAL_COLLECTIONS(data, data + sizeof(data), netPacket.begin(), netPacket.end()); @@ -215,13 +215,13 @@ BOOST_AUTO_TEST_CASE(OmitFragIndex0) 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()); BOOST_CHECK_EQUAL_COLLECTIONS(data, data + sizeof(data), netPacket.begin(), netPacket.end()); @@ -254,14 +254,14 @@ BOOST_AUTO_TEST_CASE(OutOfOrder) 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 @@ BOOST_AUTO_TEST_CASE(Duplicate) 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 @@ BOOST_AUTO_TEST_CASE(Timeout) received2.add(2); received2.add(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 @@ BOOST_AUTO_TEST_CASE(MissingSequence) 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 @@ BOOST_AUTO_TEST_CASE(FragCountOverLimit) 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 @@ BOOST_AUTO_TEST_CASE(MissingFragCount) 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 @@ BOOST_AUTO_TEST_CASE(OverFragCount) 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 @@ BOOST_AUTO_TEST_CASE(Normal) 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 f32d30fb..efdd4f2d 100644 --- a/tests/daemon/face/multicast-udp-transport.t.cpp +++ b/tests/daemon/face/multicast-udp-transport.t.cpp @@ -72,7 +72,7 @@ BOOST_AUTO_TEST_CASE(PersistencyChange) 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_FIXTURE_TEST_CASE_TEMPLATE(ReceiveMultipleRemoteEndpoints, T, MulticastUdp 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(this->receivedPackets->at(0).endpoint)); this->sendToGroup(remoteSockTx2, buf1); this->sendToGroup(remoteSockTx2, buf2); @@ -105,10 +105,11 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(ReceiveMultipleRemoteEndpoints, T, MulticastUdp 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 9c13653e..2acacfb3 100644 --- a/tests/daemon/face/stream-transport.t.cpp +++ b/tests/daemon/face/stream-transport.t.cpp @@ -93,8 +93,8 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(ReceiveNormal, T, StreamTransportFixtures, T) 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 fe79de92..e8733b20 100644 --- a/tests/daemon/face/websocket-transport.t.cpp +++ b/tests/daemon/face/websocket-transport.t.cpp @@ -166,8 +166,8 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(ReceiveNormal, T, WebSocketTransportFixtures, T 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 efaf90c5..ce408eca 100644 --- a/tests/daemon/fw/best-route-strategy.t.cpp +++ b/tests/daemon/fw/best-route-strategy.t.cpp @@ -86,7 +86,7 @@ BOOST_AUTO_TEST_CASE(Forward) // 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 @@ BOOST_AUTO_TEST_CASE(Forward) std::function 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 @@ BOOST_AUTO_TEST_CASE(Forward) 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 98f767f1..6fbb6880 100644 --- a/tests/daemon/fw/forwarder.t.cpp +++ b/tests/daemon/fw/forwarder.t.cpp @@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE(SimpleExchange) 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_AUTO_TEST_CASE(SimpleExchange) 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_AUTO_TEST_CASE(CsMatched) 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 @@ BOOST_AUTO_TEST_CASE(InterestWithoutNonce) 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 @@ BOOST_AUTO_TEST_CASE(NextHopFaceId) auto interest = makeInterest("/A/B"); interest->setTag(make_shared(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 @@ BOOST_AUTO_TEST_CASE(HopLimit) // 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 @@ BOOST_AUTO_TEST_CASE(HopLimit) // 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 @@ BOOST_AUTO_TEST_CASE(HopLimit) // 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 @@ BOOST_AUTO_TEST_CASE(HopLimit) // 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 @@ BOOST_AUTO_TEST_CASE(HopLimit) // 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(HopLimit) 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 @@ BOOST_AUTO_TEST_CASE(ScopeLocalhostIncoming) // 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 @@ BOOST_AUTO_TEST_CASE(IncomingInterestStrategyDispatch) 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 @@ BOOST_AUTO_TEST_CASE(IncomingData) 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 @@ BOOST_AUTO_TEST_CASE(IncomingNack) 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 @@ BOOST_AUTO_TEST_CASE(IncomingNack) 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 @@ BOOST_AUTO_TEST_CASE(IncomingNack) 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 @@ BOOST_AUTO_TEST_CASE(IncomingNack) 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 @@ BOOST_AUTO_TEST_CASE(IncomingNack) 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 @@ BOOST_AUTO_TEST_CASE(InterestLoopNack) // 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 @@ BOOST_AUTO_TEST_CASE(InterestLoopNack) // 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 @@ BOOST_AUTO_TEST_CASE(InterestLoopWithShortLifetime) // Bug 1953 face2->afterSend.connect([face1, face2] (uint32_t pktType) { if (pktType == tlv::Interest) { auto interest = make_shared(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 @@ BOOST_AUTO_TEST_CASE(InterestLoopWithShortLifetime) // Bug 1953 // 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 @@ BOOST_AUTO_TEST_CASE(PitLeak) // Bug 3484 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 @@ BOOST_AUTO_TEST_CASE(UnsolicitedData) 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 3b91c633..a69c3a55 100644 --- a/tests/daemon/fw/multicast-strategy.t.cpp +++ b/tests/daemon/fw/multicast-strategy.t.cpp @@ -85,7 +85,7 @@ BOOST_AUTO_TEST_CASE(Bug5123) 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 @@ BOOST_AUTO_TEST_CASE(Bug5123) 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 @@ BOOST_AUTO_TEST_CASE(Forward2) 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 @@ BOOST_AUTO_TEST_CASE(Forward2) std::function 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 @@ BOOST_AUTO_TEST_CASE(LoopingInterest) 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 @@ BOOST_AUTO_TEST_CASE(RetxSuppression) 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 @@ BOOST_AUTO_TEST_CASE(RetxSuppression) 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 @@ BOOST_AUTO_TEST_CASE(RetxSuppression) 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 @@ BOOST_AUTO_TEST_CASE(RetxSuppression) 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 @@ BOOST_AUTO_TEST_CASE(RetxSuppression) 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 @@ BOOST_AUTO_TEST_CASE(NewNextHop) 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 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(ForwardAsync, T, Tests, T) 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 c2b6c419..3153a7dd 100644 --- a/tests/daemon/fw/pit-expiry.t.cpp +++ b/tests/daemon/fw/pit-expiry.t.cpp @@ -132,8 +132,8 @@ BOOST_AUTO_TEST_CASE(UnsatisfiedInterest) 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 @@ BOOST_AUTO_TEST_CASE(SatisfiedInterest) 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 @@ BOOST_AUTO_TEST_CASE(CsHit) 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 @@ BOOST_AUTO_TEST_CASE(ReceiveNack) 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 @@ BOOST_AUTO_TEST_CASE(ResetTimerAfterReceiveInterest) 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 @@ BOOST_AUTO_TEST_CASE(ResetTimerBeforeSatisfyInterest) 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 @@ BOOST_AUTO_TEST_CASE(ResetTimerAfterReceiveData) 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 @@ BOOST_AUTO_TEST_CASE(ReceiveNackAfterResetTimer) 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 b89d48c0..ae34b036 100644 --- a/tests/daemon/fw/random-strategy.t.cpp +++ b/tests/daemon/fw/random-strategy.t.cpp @@ -80,7 +80,7 @@ BOOST_AUTO_TEST_CASE(Forward) 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 9dcd0c98..4b6961d2 100644 --- a/tests/daemon/fw/strategy-nack-return.t.cpp +++ b/tests/daemon/fw/strategy-nack-return.t.cpp @@ -108,7 +108,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(OneUpstream, 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 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(TwoUpstreams, 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 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(TwoUpstreams, 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 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(Timeout, 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 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(CombineReasons, 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 4fab4e50..3dfce2c3 100644 --- a/tests/daemon/fw/strategy-no-route.t.cpp +++ b/tests/daemon/fw/strategy-no-route.t.cpp @@ -165,7 +165,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(IncomingInterest, 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 d44460f8..392becbf 100644 --- a/tests/daemon/fw/strategy-scope-control.t.cpp +++ b/tests/daemon/fw/strategy-scope-control.t.cpp @@ -128,7 +128,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(LocalhostInterestToLocal, 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 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(LocalhostInterestToNonLocal, 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 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(LocalhostInterestToLocalAndNonLocal, 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 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(LocalhopInterestToNonLocal, 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 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(LocalhopInterestToNonLocalAndLocal, 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 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(LocalhostNackToNonLocal, 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 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(LocalhopNackToNonLocal, 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 ee5ae773..67be5b20 100644 --- a/tests/daemon/fw/unsolicited-data-policy.t.cpp +++ b/tests/daemon/fw/unsolicited-data-policy.t.cpp @@ -114,7 +114,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(FaceScopePolicy, T, FaceScopePolicyTests) 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("dummy://", "dummy://", @@ -122,7 +122,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(FaceScopePolicy, T, FaceScopePolicyTests) 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); }