diff --git a/daemon/fw/face-endpoint.hpp b/daemon/face/face-endpoint.hpp similarity index 92% rename from daemon/fw/face-endpoint.hpp rename to daemon/face/face-endpoint.hpp index acfbc2e3..cf2c466a 100644 --- a/daemon/fw/face-endpoint.hpp +++ b/daemon/face/face-endpoint.hpp @@ -23,10 +23,10 @@ * NFD, e.g., in COPYING.md file. If not, see . */ -#ifndef NFD_DAEMON_FW_FACE_ENDPOINT_HPP -#define NFD_DAEMON_FW_FACE_ENDPOINT_HPP +#ifndef NFD_DAEMON_FACE_FACE_ENDPOINT_HPP +#define NFD_DAEMON_FACE_FACE_ENDPOINT_HPP -#include "face/face.hpp" +#include "face.hpp" namespace nfd { @@ -54,4 +54,4 @@ operator<<(std::ostream& os, const FaceEndpoint& fe) } // namespace nfd -#endif // NFD_DAEMON_FW_FACE_ENDPOINT_HPP \ No newline at end of file +#endif // NFD_DAEMON_FACE_FACE_ENDPOINT_HPP diff --git a/daemon/face/face.hpp b/daemon/face/face.hpp index 440bb4d9..e96bc310 100644 --- a/daemon/face/face.hpp +++ b/daemon/face/face.hpp @@ -76,32 +76,32 @@ public: getTransport() const; public: // upper interface connected to forwarding - /** \brief sends Interest on Face + /** \brief send Interest to \p endpointId */ void - sendInterest(const Interest& interest); + sendInterest(const Interest& interest, const EndpointId& endpointId); - /** \brief sends Data on Face + /** \brief send Data to \p endpointId */ void - sendData(const Data& data); + sendData(const Data& data, const EndpointId& endpointId); - /** \brief sends Nack on Face + /** \brief send Nack to \p endpointId */ void - sendNack(const lp::Nack& nack); + sendNack(const lp::Nack& nack, const EndpointId& endpointId); /** \brief signals on Interest received */ - signal::Signal& afterReceiveInterest; + signal::Signal& afterReceiveInterest; /** \brief signals on Data received */ - signal::Signal& afterReceiveData; + signal::Signal& afterReceiveData; /** \brief signals on Nack received */ - signal::Signal& afterReceiveNack; + signal::Signal& afterReceiveNack; /** \brief signals on Interest dropped by reliability system for exceeding allowed number of retx */ @@ -201,21 +201,21 @@ Face::getTransport() const } inline void -Face::sendInterest(const Interest& interest) +Face::sendInterest(const Interest& interest, const EndpointId& endpointId) { - m_service->sendInterest(interest); + m_service->sendInterest(interest, endpointId); } inline void -Face::sendData(const Data& data) +Face::sendData(const Data& data, const EndpointId& endpointId) { - m_service->sendData(data); + m_service->sendData(data, endpointId); } inline void -Face::sendNack(const lp::Nack& nack) +Face::sendNack(const lp::Nack& nack, const EndpointId& endpointId) { - m_service->sendNack(nack); + m_service->sendNack(nack, endpointId); } inline FaceId diff --git a/daemon/face/generic-link-service.cpp b/daemon/face/generic-link-service.cpp index 55ec6ee8..09b874cc 100644 --- a/daemon/face/generic-link-service.cpp +++ b/daemon/face/generic-link-service.cpp @@ -65,15 +65,15 @@ GenericLinkService::setOptions(const GenericLinkService::Options& options) } void -GenericLinkService::requestIdlePacket() +GenericLinkService::requestIdlePacket(const EndpointId& endpointId) { // No need to request Acks to attach to this packet from LpReliability, as they are already // attached in sendLpPacket - this->sendLpPacket({}); + this->sendLpPacket({}, endpointId); } void -GenericLinkService::sendLpPacket(lp::Packet&& pkt) +GenericLinkService::sendLpPacket(lp::Packet&& pkt, const EndpointId& endpointId) { const ssize_t mtu = this->getTransport()->getMtu(); @@ -91,38 +91,38 @@ GenericLinkService::sendLpPacket(lp::Packet&& pkt) NFD_LOG_FACE_WARN("attempted to send packet over MTU limit"); return; } - this->sendPacket(std::move(tp)); + this->sendPacket(std::move(tp), endpointId); } void -GenericLinkService::doSendInterest(const Interest& interest) +GenericLinkService::doSendInterest(const Interest& interest, const EndpointId& endpointId) { lp::Packet lpPacket(interest.wireEncode()); encodeLpFields(interest, lpPacket); - this->sendNetPacket(std::move(lpPacket), true); + this->sendNetPacket(std::move(lpPacket), endpointId, true); } void -GenericLinkService::doSendData(const Data& data) +GenericLinkService::doSendData(const Data& data, const EndpointId& endpointId) { lp::Packet lpPacket(data.wireEncode()); encodeLpFields(data, lpPacket); - this->sendNetPacket(std::move(lpPacket), false); + this->sendNetPacket(std::move(lpPacket), endpointId, false); } void -GenericLinkService::doSendNack(const lp::Nack& nack) +GenericLinkService::doSendNack(const lp::Nack& nack, const EndpointId& endpointId) { lp::Packet lpPacket(nack.getInterest().wireEncode()); lpPacket.add(nack.getHeader()); encodeLpFields(nack, lpPacket); - this->sendNetPacket(std::move(lpPacket), false); + this->sendNetPacket(std::move(lpPacket), endpointId, false); } void @@ -154,7 +154,7 @@ GenericLinkService::encodeLpFields(const ndn::PacketBase& netPkt, lp::Packet& lp } void -GenericLinkService::sendNetPacket(lp::Packet&& pkt, bool isInterest) +GenericLinkService::sendNetPacket(lp::Packet&& pkt, const EndpointId& endpointId, bool isInterest) { std::vector frags; ssize_t mtu = this->getTransport()->getMtu(); @@ -206,7 +206,7 @@ GenericLinkService::sendNetPacket(lp::Packet&& pkt, bool isInterest) } for (lp::Packet& frag : frags) { - this->sendLpPacket(std::move(frag)); + this->sendLpPacket(std::move(frag), endpointId); } } @@ -302,7 +302,7 @@ GenericLinkService::doReceivePacket(Transport::Packet&& packet) std::tie(isReassembled, netPkt, firstPkt) = m_reassembler.receiveFragment(packet.remoteEndpoint, pkt); if (isReassembled) { - this->decodeNetPacket(netPkt, firstPkt); + this->decodeNetPacket(netPkt, firstPkt, packet.remoteEndpoint); } } catch (const tlv::Error& e) { @@ -312,20 +312,21 @@ GenericLinkService::doReceivePacket(Transport::Packet&& packet) } void -GenericLinkService::decodeNetPacket(const Block& netPkt, const lp::Packet& firstPkt) +GenericLinkService::decodeNetPacket(const Block& netPkt, const lp::Packet& firstPkt, + const EndpointId& endpointId) { try { switch (netPkt.type()) { case tlv::Interest: if (firstPkt.has()) { - this->decodeNack(netPkt, firstPkt); + this->decodeNack(netPkt, firstPkt, endpointId); } else { - this->decodeInterest(netPkt, firstPkt); + this->decodeInterest(netPkt, firstPkt, endpointId); } break; case tlv::Data: - this->decodeData(netPkt, firstPkt); + this->decodeData(netPkt, firstPkt, endpointId); break; default: ++this->nInNetInvalid; @@ -340,7 +341,8 @@ GenericLinkService::decodeNetPacket(const Block& netPkt, const lp::Packet& first } void -GenericLinkService::decodeInterest(const Block& netPkt, const lp::Packet& firstPkt) +GenericLinkService::decodeInterest(const Block& netPkt, const lp::Packet& firstPkt, + const EndpointId& endpointId) { BOOST_ASSERT(netPkt.type() == tlv::Interest); BOOST_ASSERT(!firstPkt.has()); @@ -387,11 +389,12 @@ GenericLinkService::decodeInterest(const Block& netPkt, const lp::Packet& firstP return; } - this->receiveInterest(*interest); + this->receiveInterest(*interest, endpointId); } void -GenericLinkService::decodeData(const Block& netPkt, const lp::Packet& firstPkt) +GenericLinkService::decodeData(const Block& netPkt, const lp::Packet& firstPkt, + const EndpointId& endpointId) { BOOST_ASSERT(netPkt.type() == tlv::Data); @@ -440,11 +443,12 @@ GenericLinkService::decodeData(const Block& netPkt, const lp::Packet& firstPkt) } } - this->receiveData(*data); + this->receiveData(*data, endpointId); } void -GenericLinkService::decodeNack(const Block& netPkt, const lp::Packet& firstPkt) +GenericLinkService::decodeNack(const Block& netPkt, const lp::Packet& firstPkt, + const EndpointId& endpointId) { BOOST_ASSERT(netPkt.type() == tlv::Interest); BOOST_ASSERT(firstPkt.has()); @@ -484,7 +488,7 @@ GenericLinkService::decodeNack(const Block& netPkt, const lp::Packet& firstPkt) return; } - this->receiveNack(nack); + this->receiveNack(nack, endpointId); } } // namespace face diff --git a/daemon/face/generic-link-service.hpp b/daemon/face/generic-link-service.hpp index c4409327..c28b9efa 100644 --- a/daemon/face/generic-link-service.hpp +++ b/daemon/face/generic-link-service.hpp @@ -173,28 +173,27 @@ PROTECTED_WITH_TESTS_ELSE_PRIVATE: // send path /** \brief request an IDLE packet to transmit pending service fields */ void - requestIdlePacket(); + requestIdlePacket(const EndpointId& endpointId); - /** \brief send an LpPacket fragment - * \param pkt LpPacket to send + /** \brief send an LpPacket to \p endpointId */ void - sendLpPacket(lp::Packet&& pkt); + sendLpPacket(lp::Packet&& pkt, const EndpointId& endpointId); /** \brief send Interest */ void - doSendInterest(const Interest& interest) OVERRIDE_WITH_TESTS_ELSE_FINAL; + doSendInterest(const Interest& interest, const EndpointId& endpointId) OVERRIDE_WITH_TESTS_ELSE_FINAL; /** \brief send Data */ void - doSendData(const Data& data) OVERRIDE_WITH_TESTS_ELSE_FINAL; + doSendData(const Data& data, const EndpointId& endpointId) OVERRIDE_WITH_TESTS_ELSE_FINAL; /** \brief send Nack */ void - doSendNack(const ndn::lp::Nack& nack) OVERRIDE_WITH_TESTS_ELSE_FINAL; + doSendNack(const ndn::lp::Nack& nack, const EndpointId& endpointId) OVERRIDE_WITH_TESTS_ELSE_FINAL; private: // send path /** \brief encode link protocol fields from tags onto an outgoing LpPacket @@ -206,10 +205,11 @@ private: // send path /** \brief send a complete network layer packet * \param pkt LpPacket containing a complete network layer packet + * \param endpointId destination endpoint to which LpPacket will be sent * \param isInterest whether the network layer packet is an Interest */ void - sendNetPacket(lp::Packet&& pkt, bool isInterest); + sendNetPacket(lp::Packet&& pkt, const EndpointId& endpointId, bool isInterest); /** \brief assign a sequence number to an LpPacket */ @@ -237,16 +237,18 @@ private: // receive path /** \brief decode incoming network-layer packet * \param netPkt reassembled network-layer packet * \param firstPkt LpPacket of first fragment + * \param endpointId endpoint of peer who sent the packet * * If decoding is successful, a receive signal is emitted; * otherwise, a warning is logged. */ void - decodeNetPacket(const Block& netPkt, const lp::Packet& firstPkt); + decodeNetPacket(const Block& netPkt, const lp::Packet& firstPkt, const EndpointId& endpointId); /** \brief decode incoming Interest * \param netPkt reassembled network-layer packet; TLV-TYPE must be Interest * \param firstPkt LpPacket of first fragment; must not have Nack field + * \param endpointId endpoint of peer who sent the Interest * * If decoding is successful, receiveInterest signal is emitted; * otherwise, a warning is logged. @@ -254,11 +256,12 @@ private: // receive path * \throw tlv::Error parse error in an LpHeader field */ void - decodeInterest(const Block& netPkt, const lp::Packet& firstPkt); + decodeInterest(const Block& netPkt, const lp::Packet& firstPkt, const EndpointId& endpointId); /** \brief decode incoming Interest * \param netPkt reassembled network-layer packet; TLV-TYPE must be Data * \param firstPkt LpPacket of first fragment + * \param endpointId endpoint of peer who sent the Data * * If decoding is successful, receiveData signal is emitted; * otherwise, a warning is logged. @@ -266,11 +269,12 @@ private: // receive path * \throw tlv::Error parse error in an LpHeader field */ void - decodeData(const Block& netPkt, const lp::Packet& firstPkt); + decodeData(const Block& netPkt, const lp::Packet& firstPkt, const EndpointId& endpointId); /** \brief decode incoming Interest * \param netPkt reassembled network-layer packet; TLV-TYPE must be Interest * \param firstPkt LpPacket of first fragment; must have Nack field + * \param endpointId endpoint of peer who sent the Nack * * If decoding is successful, receiveNack signal is emitted; * otherwise, a warning is logged. @@ -278,7 +282,7 @@ private: // receive path * \throw tlv::Error parse error in an LpHeader field */ void - decodeNack(const Block& netPkt, const lp::Packet& firstPkt); + decodeNack(const Block& netPkt, const lp::Packet& firstPkt, const EndpointId& endpointId); PROTECTED_WITH_TESTS_ELSE_PRIVATE: Options m_options; diff --git a/daemon/face/link-service.cpp b/daemon/face/link-service.cpp index c5dcdfcd..34abd58a 100644 --- a/daemon/face/link-service.cpp +++ b/daemon/face/link-service.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -52,66 +52,66 @@ LinkService::setFaceAndTransport(Face& face, Transport& transport) } void -LinkService::sendInterest(const Interest& interest) +LinkService::sendInterest(const Interest& interest, const EndpointId& endpointId) { BOOST_ASSERT(m_transport != nullptr); NFD_LOG_FACE_TRACE(__func__); ++this->nOutInterests; - doSendInterest(interest); + doSendInterest(interest, endpointId); } void -LinkService::sendData(const Data& data) +LinkService::sendData(const Data& data, const EndpointId& endpointId) { BOOST_ASSERT(m_transport != nullptr); NFD_LOG_FACE_TRACE(__func__); ++this->nOutData; - doSendData(data); + doSendData(data, endpointId); } void -LinkService::sendNack(const ndn::lp::Nack& nack) +LinkService::sendNack(const ndn::lp::Nack& nack, const EndpointId& endpointId) { BOOST_ASSERT(m_transport != nullptr); NFD_LOG_FACE_TRACE(__func__); ++this->nOutNacks; - doSendNack(nack); + doSendNack(nack, endpointId); } void -LinkService::receiveInterest(const Interest& interest) +LinkService::receiveInterest(const Interest& interest, const EndpointId& endpointId) { NFD_LOG_FACE_TRACE(__func__); ++this->nInInterests; - afterReceiveInterest(interest); + afterReceiveInterest(interest, endpointId); } void -LinkService::receiveData(const Data& data) +LinkService::receiveData(const Data& data, const EndpointId& endpointId) { NFD_LOG_FACE_TRACE(__func__); ++this->nInData; - afterReceiveData(data); + afterReceiveData(data, endpointId); } void -LinkService::receiveNack(const ndn::lp::Nack& nack) +LinkService::receiveNack(const ndn::lp::Nack& nack, const EndpointId& endpointId) { NFD_LOG_FACE_TRACE(__func__); ++this->nInNacks; - afterReceiveNack(nack); + afterReceiveNack(nack, endpointId); } void diff --git a/daemon/face/link-service.hpp b/daemon/face/link-service.hpp index 0caa857c..fd773913 100644 --- a/daemon/face/link-service.hpp +++ b/daemon/face/link-service.hpp @@ -112,35 +112,35 @@ public: getCounters() const; public: // upper interface to be used by forwarding - /** \brief send Interest + /** \brief send Interest to \p endpointId * \pre setTransport has been called */ void - sendInterest(const Interest& interest); + sendInterest(const Interest& interest, const EndpointId& endpointId); - /** \brief send Data + /** \brief send Data to \p endpointId * \pre setTransport has been called */ void - sendData(const Data& data); + sendData(const Data& data, const EndpointId& endpointId); - /** \brief send Nack + /** \brief send Nack to \p endpointId * \pre setTransport has been called */ void - sendNack(const ndn::lp::Nack& nack); + sendNack(const ndn::lp::Nack& nack, const EndpointId& endpointId); /** \brief signals on Interest received */ - signal::Signal afterReceiveInterest; + signal::Signal afterReceiveInterest; /** \brief signals on Data received */ - signal::Signal afterReceiveData; + signal::Signal afterReceiveData; /** \brief signals on Nack received */ - signal::Signal afterReceiveNack; + signal::Signal afterReceiveNack; /** \brief signals on Interest dropped by reliability system for exceeding allowed number of retx */ @@ -156,43 +156,43 @@ protected: // upper interface to be invoked in subclass (receive path terminatio /** \brief delivers received Interest to forwarding */ void - receiveInterest(const Interest& interest); + receiveInterest(const Interest& interest, const EndpointId& endpointId); /** \brief delivers received Data to forwarding */ void - receiveData(const Data& data); + receiveData(const Data& data, const EndpointId& endpointId); /** \brief delivers received Nack to forwarding */ void - receiveNack(const lp::Nack& nack); + receiveNack(const lp::Nack& nack, const EndpointId& endpointId); protected: // lower interface to be invoked in subclass (send path termination) - /** \brief sends a lower-layer packet via Transport + /** \brief send a lower-layer packet via Transport to \p endpointId */ void - sendPacket(Transport::Packet&& packet); + sendPacket(Transport::Packet&& packet, const EndpointId& endpointId); protected: void notifyDroppedInterest(const Interest& packet); private: // upper interface to be overridden in subclass (send path entrypoint) - /** \brief performs LinkService specific operations to send an Interest + /** \brief performs LinkService specific operations to send an Interest to \p endpointId */ virtual void - doSendInterest(const Interest& interest) = 0; + doSendInterest(const Interest& interest, const EndpointId& endpointId) = 0; - /** \brief performs LinkService specific operations to send a Data + /** \brief performs LinkService specific operations to send a Data to \p endpointId */ virtual void - doSendData(const Data& data) = 0; + doSendData(const Data& data, const EndpointId& endpointId) = 0; - /** \brief performs LinkService specific operations to send a Nack + /** \brief performs LinkService specific operations to send a Nack to \p endpointId */ virtual void - doSendNack(const lp::Nack& nack) = 0; + doSendNack(const lp::Nack& nack, const EndpointId& endpointId) = 0; private: // lower interface to be overridden in subclass virtual void @@ -234,8 +234,9 @@ LinkService::receivePacket(Transport::Packet&& packet) } inline void -LinkService::sendPacket(Transport::Packet&& packet) +LinkService::sendPacket(Transport::Packet&& packet, const EndpointId& endpointId) { + packet.remoteEndpoint = endpointId; m_transport->send(std::move(packet)); } diff --git a/daemon/face/lp-reliability.cpp b/daemon/face/lp-reliability.cpp index 7f7ee140..f19f7132 100644 --- a/daemon/face/lp-reliability.cpp +++ b/daemon/face/lp-reliability.cpp @@ -202,7 +202,7 @@ LpReliability::startIdleAckTimer() m_idleAckTimer = getScheduler().schedule(m_options.idleAckTimerPeriod, [this] { while (!m_ackQueue.empty()) { - m_linkService->requestIdlePacket(); + m_linkService->requestIdlePacket(0); } m_isIdleAckTimerRunning = false; @@ -302,7 +302,7 @@ LpReliability::onLpPacketLost(lp::Sequence txSeq) deleteUnackedFrag(txSeqIt); // Retransmit fragment - m_linkService->sendLpPacket(lp::Packet(newTxFrag.pkt)); + m_linkService->sendLpPacket(lp::Packet(newTxFrag.pkt), 0); // Start RTO timer for this sequence newTxFrag.rtoTimer = getScheduler().schedule(m_rto.computeRto(), [=] { onLpPacketLost(newTxSeq); }); diff --git a/daemon/face/null-link-service.hpp b/daemon/face/null-link-service.hpp index 7a8e8ba0..d31304b6 100644 --- a/daemon/face/null-link-service.hpp +++ b/daemon/face/null-link-service.hpp @@ -37,17 +37,17 @@ class NullLinkService final : public LinkService { private: void - doSendInterest(const Interest&) final + doSendInterest(const Interest&, const EndpointId&) final { } void - doSendData(const Data&) final + doSendData(const Data&, const EndpointId&) final { } void - doSendNack(const lp::Nack&) final + doSendNack(const lp::Nack&, const EndpointId&) final { } diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp index 17751bff..b2cb4b0b 100644 --- a/daemon/fw/forwarder.cpp +++ b/daemon/fw/forwarder.cpp @@ -53,16 +53,16 @@ Forwarder::Forwarder() { m_faceTable.afterAdd.connect([this] (Face& face) { face.afterReceiveInterest.connect( - [this, &face] (const Interest& interest) { - this->startProcessInterest(FaceEndpoint(face, 0), interest); + [this, &face] (const Interest& interest, const EndpointId& endpointId) { + this->startProcessInterest(FaceEndpoint(face, endpointId), interest); }); face.afterReceiveData.connect( - [this, &face] (const Data& data) { - this->startProcessData(FaceEndpoint(face, 0), data); + [this, &face] (const Data& data, const EndpointId& endpointId) { + this->startProcessData(FaceEndpoint(face, endpointId), data); }); face.afterReceiveNack.connect( - [this, &face] (const lp::Nack& nack) { - this->startProcessNack(FaceEndpoint(face, 0), nack); + [this, &face] (const lp::Nack& nack, const EndpointId& endpointId) { + this->startProcessNack(FaceEndpoint(face, endpointId), nack); }); face.onDroppedInterest.connect( [this, &face] (const Interest& interest) { @@ -157,7 +157,7 @@ Forwarder::onInterestLoop(const FaceEndpoint& ingress, const Interest& interest) // note: Don't enter outgoing Nack pipeline because it needs an in-record. lp::Nack nack(interest); nack.setReason(lp::NackReason::DUPLICATE); - ingress.face.sendNack(nack); + ingress.face.sendNack(nack, ingress.endpoint); } void @@ -232,7 +232,7 @@ Forwarder::onOutgoingInterest(const shared_ptr& pitEntry, pitEntry->insertOrUpdateOutRecord(egress.face, egress.endpoint, interest); // send Interest - egress.face.sendInterest(interest); + egress.face.sendInterest(interest, egress.endpoint); ++m_counters.nOutInterests; } @@ -371,7 +371,7 @@ Forwarder::onDataUnsolicited(const FaceEndpoint& ingress, const Data& data) } void -Forwarder::onOutgoingData(const Data& data, FaceEndpoint egress) +Forwarder::onOutgoingData(const Data& data, const FaceEndpoint& egress) { if (egress.face.getId() == face::INVALID_FACEID) { NFD_LOG_WARN("onOutgoingData out=(invalid) data=" << data.getName()); @@ -391,7 +391,7 @@ Forwarder::onOutgoingData(const Data& data, FaceEndpoint egress) // TODO traffic manager // send Data - egress.face.sendData(data); + egress.face.sendData(data, egress.endpoint); ++m_counters.nOutData; } @@ -493,7 +493,7 @@ Forwarder::onOutgoingNack(const shared_ptr& pitEntry, pitEntry->deleteInRecord(egress.face, egress.endpoint); // send Nack on face - egress.face.sendNack(nackPkt); + egress.face.sendNack(nackPkt, egress.endpoint); ++m_counters.nOutNacks; } diff --git a/daemon/fw/forwarder.hpp b/daemon/fw/forwarder.hpp index 18ca4839..cc1d048e 100644 --- a/daemon/fw/forwarder.hpp +++ b/daemon/fw/forwarder.hpp @@ -26,10 +26,10 @@ #ifndef NFD_DAEMON_FW_FORWARDER_HPP #define NFD_DAEMON_FW_FORWARDER_HPP -#include "face-endpoint.hpp" #include "face-table.hpp" #include "forwarder-counters.hpp" #include "unsolicited-data-policy.hpp" +#include "face/face-endpoint.hpp" #include "table/fib.hpp" #include "table/pit.hpp" #include "table/cs.hpp" @@ -228,7 +228,7 @@ PUBLIC_WITH_TESTS_ELSE_PRIVATE: // pipelines /** \brief outgoing Data pipeline */ VIRTUAL_WITH_TESTS void - onOutgoingData(const Data& data, FaceEndpoint egress); + onOutgoingData(const Data& data, const FaceEndpoint& egress); /** \brief incoming Nack pipeline */ diff --git a/tests/daemon/face/dummy-face.cpp b/tests/daemon/face/dummy-face.cpp index 9e7e0b6b..b7e74ca1 100644 --- a/tests/daemon/face/dummy-face.cpp +++ b/tests/daemon/face/dummy-face.cpp @@ -51,21 +51,21 @@ DummyFace::setState(FaceState state) } void -DummyFace::receiveInterest(const Interest& interest) +DummyFace::receiveInterest(const Interest& interest, const EndpointId& endpointId) { - getDummyLinkService()->receiveInterest(interest); + getDummyLinkService()->receiveInterest(interest, endpointId); } void -DummyFace::receiveData(const Data& data) +DummyFace::receiveData(const Data& data, const EndpointId& endpointId) { - getDummyLinkService()->receiveData(data); + getDummyLinkService()->receiveData(data, endpointId); } void -DummyFace::receiveNack(const lp::Nack& nack) +DummyFace::receiveNack(const lp::Nack& nack, const EndpointId& endpointId) { - getDummyLinkService()->receiveNack(nack); + getDummyLinkService()->receiveNack(nack, endpointId); } DummyLinkService* diff --git a/tests/daemon/face/dummy-face.hpp b/tests/daemon/face/dummy-face.hpp index 387206a6..94b53639 100644 --- a/tests/daemon/face/dummy-face.hpp +++ b/tests/daemon/face/dummy-face.hpp @@ -62,17 +62,17 @@ public: /** \brief causes the face to receive an Interest */ void - receiveInterest(const Interest& interest); + receiveInterest(const Interest& interest, const EndpointId& endpointId); /** \brief causes the face to receive a Data */ void - receiveData(const Data& data); + receiveData(const Data& data, const EndpointId& endpointId); /** \brief causes the face to receive a Nack */ void - receiveNack(const lp::Nack& nack); + receiveNack(const lp::Nack& nack, const EndpointId& endpointId); /** \brief Emitted after a network-layer packet is sent. * diff --git a/tests/daemon/face/dummy-link-service.cpp b/tests/daemon/face/dummy-link-service.cpp index 2c92a529..019e9dcf 100644 --- a/tests/daemon/face/dummy-link-service.cpp +++ b/tests/daemon/face/dummy-link-service.cpp @@ -30,7 +30,7 @@ namespace face { namespace tests { void -DummyLinkService::doSendInterest(const Interest& interest) +DummyLinkService::doSendInterest(const Interest& interest, const EndpointId& endpointId) { if (m_loggingFlags & LogSentInterests) sentInterests.push_back(interest); @@ -39,7 +39,7 @@ DummyLinkService::doSendInterest(const Interest& interest) } void -DummyLinkService::doSendData(const Data& data) +DummyLinkService::doSendData(const Data& data, const EndpointId& endpointId) { if (m_loggingFlags & LogSentData) sentData.push_back(data); @@ -48,7 +48,7 @@ DummyLinkService::doSendData(const Data& data) } void -DummyLinkService::doSendNack(const lp::Nack& nack) +DummyLinkService::doSendNack(const lp::Nack& nack, const EndpointId& endpointId) { if (m_loggingFlags & LogSentNacks) sentNacks.push_back(nack); diff --git a/tests/daemon/face/dummy-link-service.hpp b/tests/daemon/face/dummy-link-service.hpp index 3717336d..b1caf8c8 100644 --- a/tests/daemon/face/dummy-link-service.hpp +++ b/tests/daemon/face/dummy-link-service.hpp @@ -67,13 +67,13 @@ public: private: void - doSendInterest(const Interest& interest) final; + doSendInterest(const Interest& interest, const EndpointId& endpointId) final; void - doSendData(const Data& data) final; + doSendData(const Data& data, const EndpointId& endpointId) final; void - doSendNack(const lp::Nack& nack) final; + doSendNack(const lp::Nack& nack, const EndpointId& endpointId) final; void doReceivePacket(Transport::Packet&& packet) final; diff --git a/tests/daemon/face/face.t.cpp b/tests/daemon/face/face.t.cpp index 2dd3c955..165d5db6 100644 --- a/tests/daemon/face/face.t.cpp +++ b/tests/daemon/face/face.t.cpp @@ -107,32 +107,32 @@ BOOST_AUTO_TEST_CASE(LinkServiceSendReceive) for (size_t i = 0; i < nInInterests; ++i) { shared_ptr interest = makeInterest("/JSQdqward4"); - face1->receiveInterest(*interest); + face1->receiveInterest(*interest, 0); } for (size_t i = 0; i < nInData; ++i) { shared_ptr data = makeData("/hT8FDigWn1"); - face1->receiveData(*data); + face1->receiveData(*data, 0); } for (size_t i = 0; i < nInNacks; ++i) { lp::Nack nack = makeNack("/StnEVTj4Ex", 561, lp::NackReason::CONGESTION); - face1->receiveNack(nack); + face1->receiveNack(nack, 0); } for (size_t i = 0; i < nOutInterests; ++i) { shared_ptr interest = makeInterest("/XyUAFYQDmd"); - face1->sendInterest(*interest); + face1->sendInterest(*interest, 0); } for (size_t i = 0; i < nOutData; ++i) { shared_ptr data = makeData("/GigPEtPH6"); - face1->sendData(*data); + face1->sendData(*data, 0); } for (size_t i = 0; i < nOutNacks; ++i) { lp::Nack nack = makeNack("/9xK6FbwIBM", 365, lp::NackReason::CONGESTION); - face1->sendNack(nack); + face1->sendNack(nack, 0); } BOOST_CHECK_EQUAL(face1->getCounters().nInInterests, nInInterests); diff --git a/tests/daemon/face/generic-link-service.t.cpp b/tests/daemon/face/generic-link-service.t.cpp index 64682c05..74e388f6 100644 --- a/tests/daemon/face/generic-link-service.t.cpp +++ b/tests/daemon/face/generic-link-service.t.cpp @@ -75,11 +75,11 @@ protected: transport = static_cast(face->getTransport()); face->afterReceiveInterest.connect( - [this] (const Interest& interest) { receivedInterests.push_back(interest); }); + [this] (const Interest& interest, const EndpointId&) { receivedInterests.push_back(interest); }); face->afterReceiveData.connect( - [this] (const Data& data) { receivedData.push_back(data); }); + [this] (const Data& data, const EndpointId&) { receivedData.push_back(data); }); face->afterReceiveNack.connect( - [this] (const lp::Nack& nack) { receivedNacks.push_back(nack); }); + [this] (const lp::Nack& nack, const EndpointId&) { receivedNacks.push_back(nack); }); } lp::PrefixAnnouncementHeader @@ -112,7 +112,7 @@ BOOST_AUTO_TEST_CASE(SendInterest) shared_ptr interest1 = makeInterest("/localhost/test"); - face->sendInterest(*interest1); + face->sendInterest(*interest1, 0); BOOST_CHECK_EQUAL(service->getCounters().nOutInterests, 1); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 1); @@ -131,7 +131,7 @@ BOOST_AUTO_TEST_CASE(SendData) shared_ptr data1 = makeData("/localhost/test"); - face->sendData(*data1); + face->sendData(*data1, 0); BOOST_CHECK_EQUAL(service->getCounters().nOutData, 1); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 1); @@ -150,7 +150,7 @@ BOOST_AUTO_TEST_CASE(SendNack) lp::Nack nack1 = makeNack("/localhost/test", 323, lp::NackReason::NO_ROUTE); - face->sendNack(nack1); + face->sendNack(nack1, 0); BOOST_CHECK_EQUAL(service->getCounters().nOutNacks, 1); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 1); @@ -287,7 +287,7 @@ BOOST_AUTO_TEST_CASE(FragmentationDisabledExceedMtuDrop) transport->setMtu(55); shared_ptr data = makeData("/test/data/123456789/987654321/123456789"); - face->sendData(*data); + face->sendData(*data, 0); BOOST_CHECK_EQUAL(transport->sentPackets.size(), 0); BOOST_CHECK_EQUAL(service->getCounters().nOutOverMtu, 1); @@ -303,7 +303,7 @@ BOOST_AUTO_TEST_CASE(FragmentationUnlimitedMtu) transport->setMtu(MTU_UNLIMITED); shared_ptr data = makeData("/test/data/123456789/987654321/123456789"); - face->sendData(*data); + face->sendData(*data, 0); BOOST_CHECK_EQUAL(transport->sentPackets.size(), 1); } @@ -318,7 +318,7 @@ BOOST_AUTO_TEST_CASE(FragmentationUnderMtu) transport->setMtu(105); shared_ptr data = makeData("/test/data/123456789/987654321/123456789"); - face->sendData(*data); + face->sendData(*data, 0); BOOST_CHECK_EQUAL(transport->sentPackets.size(), 1); } @@ -333,7 +333,7 @@ BOOST_AUTO_TEST_CASE(FragmentationOverMtu) transport->setMtu(60); shared_ptr data = makeData("/test/data/123456789/987654321/123456789"); - face->sendData(*data); + face->sendData(*data, 0); BOOST_CHECK_GT(transport->sentPackets.size(), 1); } @@ -425,7 +425,7 @@ BOOST_AUTO_TEST_CASE(SendInterest) shared_ptr interest1 = makeInterest("/localhost/test"); - face->sendInterest(*interest1); + face->sendInterest(*interest1, 0); BOOST_CHECK_EQUAL(service->getCounters().nOutInterests, 1); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 1); @@ -445,7 +445,7 @@ BOOST_AUTO_TEST_CASE(SendData) shared_ptr data1 = makeData("/localhost/test"); - face->sendData(*data1); + face->sendData(*data1, 0); BOOST_CHECK_EQUAL(service->getCounters().nOutData, 1); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 1); @@ -465,7 +465,7 @@ BOOST_AUTO_TEST_CASE(SendNack) lp::Nack nack1 = makeNack("/localhost/test", 323, lp::NackReason::NO_ROUTE); - face->sendNack(nack1); + face->sendNack(nack1, 0); BOOST_CHECK_EQUAL(service->getCounters().nOutNacks, 1); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 1); @@ -497,7 +497,7 @@ BOOST_AUTO_TEST_CASE(NoCongestion) // no congestion transport->setSendQueueLength(0); - face->sendInterest(*interest); + face->sendInterest(*interest, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 1); lp::Packet pkt1; BOOST_REQUIRE_NO_THROW(pkt1.wireDecode(transport->sentPackets.back().packet)); @@ -508,7 +508,7 @@ BOOST_AUTO_TEST_CASE(NoCongestion) // no congestion transport->setSendQueueLength(32768); - face->sendInterest(*interest); + face->sendInterest(*interest, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 2); lp::Packet pkt2; BOOST_REQUIRE_NO_THROW(pkt2.wireDecode(transport->sentPackets.back().packet)); @@ -535,7 +535,7 @@ BOOST_AUTO_TEST_CASE(CongestionCoDel) // first congested packet, will be marked transport->setSendQueueLength(32769); - face->sendInterest(*interest); + face->sendInterest(*interest, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 1); lp::Packet pkt1; BOOST_REQUIRE_NO_THROW(pkt1.wireDecode(transport->sentPackets.back().packet)); @@ -553,7 +553,7 @@ BOOST_AUTO_TEST_CASE(CongestionCoDel) // second congested packet, but within marking interval, will not be marked transport->setSendQueueLength(33000); - face->sendInterest(*interest); + face->sendInterest(*interest, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 2); lp::Packet pkt2; BOOST_REQUIRE_NO_THROW(pkt2.wireDecode(transport->sentPackets.back().packet)); @@ -568,7 +568,7 @@ BOOST_AUTO_TEST_CASE(CongestionCoDel) // first congested packet after waiting marking interval, will be marked transport->setSendQueueLength(40000); - face->sendInterest(*interest); + face->sendInterest(*interest, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 3); lp::Packet pkt3; BOOST_REQUIRE_NO_THROW(pkt3.wireDecode(transport->sentPackets.back().packet)); @@ -589,7 +589,7 @@ BOOST_AUTO_TEST_CASE(CongestionCoDel) // still congested, but within marking interval cycle transport->setSendQueueLength(38000); - face->sendInterest(*interest); + face->sendInterest(*interest, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 4); lp::Packet pkt4; BOOST_REQUIRE_NO_THROW(pkt4.wireDecode(transport->sentPackets.back().packet)); @@ -604,7 +604,7 @@ BOOST_AUTO_TEST_CASE(CongestionCoDel) // still congested, after marking interval cycle transport->setSendQueueLength(39000); - face->sendInterest(*interest); + face->sendInterest(*interest, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 5); lp::Packet pkt5; BOOST_REQUIRE_NO_THROW(pkt5.wireDecode(transport->sentPackets.back().packet)); @@ -624,7 +624,7 @@ BOOST_AUTO_TEST_CASE(CongestionCoDel) // still congested, but within marking interval cycle transport->setSendQueueLength(38000); - face->sendInterest(*interest); + face->sendInterest(*interest, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 6); lp::Packet pkt6; BOOST_REQUIRE_NO_THROW(pkt6.wireDecode(transport->sentPackets.back().packet)); @@ -638,7 +638,7 @@ BOOST_AUTO_TEST_CASE(CongestionCoDel) // still congested, after marking interval cycle transport->setSendQueueLength(34000); - face->sendInterest(*interest); + face->sendInterest(*interest, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 7); lp::Packet pkt7; BOOST_REQUIRE_NO_THROW(pkt7.wireDecode(transport->sentPackets.back().packet)); @@ -656,7 +656,7 @@ BOOST_AUTO_TEST_CASE(CongestionCoDel) // no more congestion transport->setSendQueueLength(30000); - face->sendInterest(*interest); + face->sendInterest(*interest, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 8); lp::Packet pkt8; BOOST_REQUIRE_NO_THROW(pkt8.wireDecode(transport->sentPackets.back().packet)); @@ -670,7 +670,7 @@ BOOST_AUTO_TEST_CASE(CongestionCoDel) // send queue congested again, but can't mark packet because within one full interval of last mark transport->setSendQueueLength(50000); - face->sendInterest(*interest); + face->sendInterest(*interest, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 9); lp::Packet pkt9; BOOST_REQUIRE_NO_THROW(pkt9.wireDecode(transport->sentPackets.back().packet)); @@ -684,7 +684,7 @@ BOOST_AUTO_TEST_CASE(CongestionCoDel) this->advanceClocks(51_ms); transport->setSendQueueLength(40000); - face->sendInterest(*interest); + face->sendInterest(*interest, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 10); lp::Packet pkt10; BOOST_REQUIRE_NO_THROW(pkt10.wireDecode(transport->sentPackets.back().packet)); @@ -702,7 +702,7 @@ BOOST_AUTO_TEST_CASE(CongestionCoDel) // not marked since within 100ms window before can mark again transport->setSendQueueLength(50000); - face->sendInterest(*interest); + face->sendInterest(*interest, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 11); lp::Packet pkt11; BOOST_REQUIRE_NO_THROW(pkt11.wireDecode(transport->sentPackets.back().packet)); @@ -717,7 +717,7 @@ BOOST_AUTO_TEST_CASE(CongestionCoDel) // markable packet, queue length still above threshold transport->setSendQueueLength(33000); - face->sendInterest(*interest); + face->sendInterest(*interest, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 12); lp::Packet pkt12; BOOST_REQUIRE_NO_THROW(pkt12.wireDecode(transport->sentPackets.back().packet)); @@ -735,7 +735,7 @@ BOOST_AUTO_TEST_CASE(CongestionCoDel) // no more congestion transport->setSendQueueLength(10000); - face->sendInterest(*interest); + face->sendInterest(*interest, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 13); lp::Packet pkt13; BOOST_REQUIRE_NO_THROW(pkt13.wireDecode(transport->sentPackets.back().packet)); @@ -750,7 +750,7 @@ BOOST_AUTO_TEST_CASE(CongestionCoDel) // start congestion again transport->setSendQueueLength(50000); - face->sendInterest(*interest); + face->sendInterest(*interest, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 14); lp::Packet pkt14; BOOST_REQUIRE_NO_THROW(pkt14.wireDecode(transport->sentPackets.back().packet)); @@ -765,7 +765,7 @@ BOOST_AUTO_TEST_CASE(CongestionCoDel) // no more congestion, cancel marking interval transport->setSendQueueLength(5000); - face->sendInterest(*interest); + face->sendInterest(*interest, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 15); lp::Packet pkt15; BOOST_REQUIRE_NO_THROW(pkt15.wireDecode(transport->sentPackets.back().packet)); @@ -793,7 +793,7 @@ BOOST_AUTO_TEST_CASE(DefaultThreshold) // no congestion transport->setSendQueueLength(0); - face->sendInterest(*interest); + face->sendInterest(*interest, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 1); lp::Packet pkt1; BOOST_REQUIRE_NO_THROW(pkt1.wireDecode(transport->sentPackets.back().packet)); @@ -804,7 +804,7 @@ BOOST_AUTO_TEST_CASE(DefaultThreshold) // no congestion transport->setSendQueueLength(65536); - face->sendInterest(*interest); + face->sendInterest(*interest, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 2); lp::Packet pkt2; BOOST_REQUIRE_NO_THROW(pkt2.wireDecode(transport->sentPackets.back().packet)); @@ -815,7 +815,7 @@ BOOST_AUTO_TEST_CASE(DefaultThreshold) // first congested (and marked) packet transport->setSendQueueLength(65537); - face->sendInterest(*interest); + face->sendInterest(*interest, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 3); lp::Packet pkt3; BOOST_REQUIRE_NO_THROW(pkt3.wireDecode(transport->sentPackets.back().packet)); @@ -973,7 +973,7 @@ BOOST_AUTO_TEST_CASE(SendIncomingFaceId) shared_ptr interest = makeInterest("/12345678"); interest->setTag(make_shared(1000)); - face->sendInterest(*interest); + face->sendInterest(*interest, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 1); lp::Packet sent(transport->sentPackets.back().packet); @@ -991,7 +991,7 @@ BOOST_AUTO_TEST_CASE(SendIncomingFaceIdDisabled) shared_ptr interest = makeInterest("/12345678"); interest->setTag(make_shared(1000)); - face->sendInterest(*interest); + face->sendInterest(*interest, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 1); lp::Packet sent(transport->sentPackets.back().packet); @@ -1058,7 +1058,7 @@ BOOST_AUTO_TEST_CASE(SendCongestionMarkInterest) shared_ptr interest = makeInterest("/12345678"); interest->setTag(make_shared(1)); - face->sendInterest(*interest); + face->sendInterest(*interest, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 1); lp::Packet sent(transport->sentPackets.back().packet); @@ -1071,7 +1071,7 @@ BOOST_AUTO_TEST_CASE(SendCongestionMarkData) shared_ptr data = makeData("/12345678"); data->setTag(make_shared(0)); - face->sendData(*data); + face->sendData(*data, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 1); lp::Packet sent(transport->sentPackets.back().packet); @@ -1084,7 +1084,7 @@ BOOST_AUTO_TEST_CASE(SendCongestionMarkNack) lp::Nack nack = makeNack("/localhost/test", 123, lp::NackReason::NO_ROUTE); nack.setTag(make_shared(std::numeric_limits::max())); - face->sendNack(nack); + face->sendNack(nack, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 1); lp::Packet sent(transport->sentPackets.back().packet); @@ -1146,7 +1146,7 @@ BOOST_AUTO_TEST_CASE(SendNonDiscovery) shared_ptr interest = makeInterest("/12345678"); interest->setTag(make_shared(lp::EmptyValue{})); - face->sendInterest(*interest); + face->sendInterest(*interest, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 1); lp::Packet sent(transport->sentPackets.back().packet); @@ -1162,7 +1162,7 @@ BOOST_AUTO_TEST_CASE(SendNonDiscoveryDisabled) shared_ptr interest = makeInterest("/12345678"); interest->setTag(make_shared(lp::EmptyValue{})); - face->sendInterest(*interest); + face->sendInterest(*interest, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 1); lp::Packet sent(transport->sentPackets.back().packet); @@ -1250,7 +1250,7 @@ BOOST_AUTO_TEST_CASE(SendPrefixAnnouncement) auto pah = makePrefixAnnHeader("/local/ndn/prefix"); data->setTag(make_shared(pah)); - face->sendData(*data); + face->sendData(*data, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 1); lp::Packet sent(transport->sentPackets.back().packet); @@ -1267,7 +1267,7 @@ BOOST_AUTO_TEST_CASE(SendPrefixAnnouncementDisabled) auto pah = makePrefixAnnHeader("/local/ndn/prefix"); data->setTag(make_shared(pah)); - face->sendData(*data); + face->sendData(*data, 0); BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 1); lp::Packet sent(transport->sentPackets.back().packet); diff --git a/tests/daemon/face/internal-face.t.cpp b/tests/daemon/face/internal-face.t.cpp index ecd1d002..a830e3e1 100644 --- a/tests/daemon/face/internal-face.t.cpp +++ b/tests/daemon/face/internal-face.t.cpp @@ -45,11 +45,11 @@ public: std::tie(forwarderFace, clientFace) = makeInternalFace(m_keyChain); forwarderFace->afterReceiveInterest.connect( - [this] (const Interest& interest) { receivedInterests.push_back(interest); } ); + [this] (const Interest& interest, const EndpointId&) { receivedInterests.push_back(interest); } ); forwarderFace->afterReceiveData.connect( - [this] (const Data& data) { receivedData.push_back(data); } ); + [this] (const Data& data, const EndpointId&) { receivedData.push_back(data); } ); forwarderFace->afterReceiveNack.connect( - [this] (const lp::Nack& nack) { receivedNacks.push_back(nack); } ); + [this] (const lp::Nack& nack, const EndpointId&) { receivedNacks.push_back(nack); } ); } protected: @@ -117,7 +117,7 @@ BOOST_AUTO_TEST_CASE(ReceiveInterestSendData) BOOST_REQUIRE_EQUAL(receivedInterests.size(), 1); BOOST_CHECK_EQUAL(receivedInterests.back().getName(), "/PQstEJGdL"); - forwarderFace->sendData(*makeData("/PQstEJGdL/aI7oCrDXNX")); + forwarderFace->sendData(*makeData("/PQstEJGdL/aI7oCrDXNX"), 0); this->advanceClocks(1_ms, 10); BOOST_CHECK(hasReceivedData); @@ -140,7 +140,7 @@ BOOST_AUTO_TEST_CASE(ReceiveInterestSendNack) BOOST_REQUIRE_EQUAL(receivedInterests.size(), 1); BOOST_CHECK_EQUAL(receivedInterests.back().getName(), "/1HrsRM1X"); - forwarderFace->sendNack(makeNack("/1HrsRM1X", 152, lp::NackReason::NO_ROUTE)); + forwarderFace->sendNack(makeNack("/1HrsRM1X", 152, lp::NackReason::NO_ROUTE), 0); this->advanceClocks(1_ms, 10); BOOST_CHECK(hasReceivedNack); @@ -157,7 +157,7 @@ BOOST_AUTO_TEST_CASE(SendInterestReceiveData) clientFace->put(*makeData("/Wpc8TnEeoF/f6SzV8hD/3uytUJCuIi")); }); - forwarderFace->sendInterest(*makeInterest("/Wpc8TnEeoF/f6SzV8hD")); + forwarderFace->sendInterest(*makeInterest("/Wpc8TnEeoF/f6SzV8hD"), 0); this->advanceClocks(1_ms, 10); BOOST_CHECK(hasDeliveredInterest); @@ -176,7 +176,7 @@ BOOST_AUTO_TEST_CASE(SendInterestReceiveNack) clientFace->put(makeNack("/4YgJKWcXN/5oaTe05o", 191, lp::NackReason::NO_ROUTE)); }); - forwarderFace->sendInterest(*makeInterest("/4YgJKWcXN/5oaTe05o", 191)); + forwarderFace->sendInterest(*makeInterest("/4YgJKWcXN/5oaTe05o", 191), 0); this->advanceClocks(1_ms, 10); BOOST_CHECK(hasDeliveredInterest); @@ -210,7 +210,7 @@ BOOST_AUTO_TEST_CASE(CloseClientFace) g_io.poll(); // #3248 workaround clientFace.reset(); - forwarderFace->sendInterest(*makeInterest("/aau42XQqb")); + forwarderFace->sendInterest(*makeInterest("/aau42XQqb"), 0); BOOST_CHECK_NO_THROW(this->advanceClocks(1_ms, 10)); } diff --git a/tests/daemon/face/lp-reliability.t.cpp b/tests/daemon/face/lp-reliability.t.cpp index f9951744..2b3a48ee 100644 --- a/tests/daemon/face/lp-reliability.t.cpp +++ b/tests/daemon/face/lp-reliability.t.cpp @@ -62,25 +62,25 @@ public: } for (lp::Packet frag : frags) { - this->sendLpPacket(std::move(frag)); + this->sendLpPacket(std::move(frag), 0); } } private: void - doSendInterest(const Interest&) final + doSendInterest(const Interest&, const EndpointId&) final { BOOST_ASSERT(false); } void - doSendData(const Data&) final + doSendData(const Data&, const EndpointId&) final { BOOST_ASSERT(false); } void - doSendNack(const lp::Nack&) final + doSendNack(const lp::Nack&, const EndpointId&) final { BOOST_ASSERT(false); } diff --git a/tests/daemon/face/null-face.t.cpp b/tests/daemon/face/null-face.t.cpp index d7f7d290..de343e06 100644 --- a/tests/daemon/face/null-face.t.cpp +++ b/tests/daemon/face/null-face.t.cpp @@ -74,10 +74,10 @@ BOOST_AUTO_TEST_CASE(Send) auto face = makeNullFace(); BOOST_CHECK_EQUAL(face->getState(), FaceState::UP); - face->sendInterest(*makeInterest("/A")); + face->sendInterest(*makeInterest("/A"), 0); BOOST_CHECK_EQUAL(face->getState(), FaceState::UP); - face->sendData(*makeData("/B")); + face->sendData(*makeData("/B"), 0); BOOST_CHECK_EQUAL(face->getState(), FaceState::UP); } diff --git a/tests/daemon/fw/forwarder.t.cpp b/tests/daemon/fw/forwarder.t.cpp index d07d1603..7325f248 100644 --- a/tests/daemon/fw/forwarder.t.cpp +++ b/tests/daemon/fw/forwarder.t.cpp @@ -60,7 +60,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(*interestAB); + face1->receiveInterest(*interestAB, 0); this->advanceClocks(100_ms, 1_s); BOOST_REQUIRE_EQUAL(face2->sentInterests.size(), 1); BOOST_CHECK_EQUAL(face2->sentInterests[0].getName(), "/A/B"); @@ -73,7 +73,7 @@ BOOST_AUTO_TEST_CASE(SimpleExchange) BOOST_CHECK_EQUAL(forwarder.getCounters().nInData, 0); BOOST_CHECK_EQUAL(forwarder.getCounters().nOutData, 0); - face2->receiveData(*dataABC); + face2->receiveData(*dataABC, 0); this->advanceClocks(100_ms, 1_s); BOOST_REQUIRE_EQUAL(face1->sentData.size(), 1); BOOST_CHECK_EQUAL(face1->sentData[0].getName(), "/A/B/C"); @@ -110,7 +110,7 @@ BOOST_AUTO_TEST_CASE(CsMatched) BOOST_CHECK_EQUAL(forwarder.getCounters().nCsHits, 0); BOOST_CHECK_EQUAL(forwarder.getCounters().nCsMisses, 0); - face1->receiveInterest(*interestA); + face1->receiveInterest(*interestA, 0); this->advanceClocks(1_ms, 5_ms); // Interest matching ContentStore should not be forwarded BOOST_REQUIRE_EQUAL(face2->sentInterests.size(), 0); @@ -170,7 +170,7 @@ BOOST_AUTO_TEST_CASE(NextHopFaceId) shared_ptr interest = makeInterest("/A/B"); interest->setTag(make_shared(face2->getId())); - face1->receiveInterest(*interest); + face1->receiveInterest(*interest, 0); this->advanceClocks(100_ms, 1_s); BOOST_CHECK_EQUAL(face3->sentInterests.size(), 0); BOOST_REQUIRE_EQUAL(face2->sentInterests.size(), 1); @@ -501,19 +501,19 @@ BOOST_AUTO_TEST_CASE(InterestLoopNack) // receive Interest on face1 face1->sentNacks.clear(); shared_ptr interest1a = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", 732); - face1->receiveInterest(*interest1a); + face1->receiveInterest(*interest1a, 0); BOOST_CHECK(face1->sentNacks.empty()); // receive Interest with duplicate Nonce on face1: legit retransmission face1->sentNacks.clear(); shared_ptr interest1b = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", 732); - face1->receiveInterest(*interest1b); + face1->receiveInterest(*interest1b, 0); BOOST_CHECK(face1->sentNacks.empty()); // receive Interest with duplicate Nonce on face2 face2->sentNacks.clear(); shared_ptr interest2a = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", 732); - face2->receiveInterest(*interest2a); + face2->receiveInterest(*interest2a, 0); BOOST_REQUIRE_EQUAL(face2->sentNacks.size(), 1); BOOST_CHECK_EQUAL(face2->sentNacks.back().getInterest(), *interest2a); BOOST_CHECK_EQUAL(face2->sentNacks.back().getReason(), lp::NackReason::DUPLICATE); @@ -521,13 +521,13 @@ BOOST_AUTO_TEST_CASE(InterestLoopNack) // receive Interest with new Nonce on face2 face2->sentNacks.clear(); shared_ptr interest2b = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", 944); - face2->receiveInterest(*interest2b); + face2->receiveInterest(*interest2b, 0); BOOST_CHECK(face2->sentNacks.empty()); // receive Interest with duplicate Nonce on face3, don't send Nack to multi-access face face3->sentNacks.clear(); shared_ptr interest3a = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", 732); - face3->receiveInterest(*interest3a); + face3->receiveInterest(*interest3a, 0); BOOST_CHECK(face3->sentNacks.empty()); } @@ -543,7 +543,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); }); + getScheduler().schedule(170_ms, [face1, interest] { face1->receiveInterest(*interest, 0); }); } }); @@ -554,7 +554,7 @@ BOOST_AUTO_TEST_CASE(InterestLoopWithShortLifetime) // Bug 1953 shared_ptr interest = makeInterest("ndn:/A/1"); interest->setNonce(82101183); interest->setInterestLifetime(50_ms); - face1->receiveInterest(*interest); + face1->receiveInterest(*interest, 0); // interest should be forwarded only once, as long as Nonce is in Dead Nonce List BOOST_ASSERT(25_ms * 40 < forwarder.getDeadNonceList().getLifetime()); diff --git a/tests/daemon/fw/pit-expiry.t.cpp b/tests/daemon/fw/pit-expiry.t.cpp index 5467c4ae..94caac96 100644 --- a/tests/daemon/fw/pit-expiry.t.cpp +++ b/tests/daemon/fw/pit-expiry.t.cpp @@ -135,8 +135,8 @@ BOOST_AUTO_TEST_CASE(UnsatisfiedInterest) interest1->setInterestLifetime(90_ms); interest2->setInterestLifetime(90_ms); - face1->receiveInterest(*interest1); - face2->receiveInterest(*interest2); + face1->receiveInterest(*interest1, 0); + face2->receiveInterest(*interest2, 0); BOOST_CHECK_EQUAL(pit.size(), 2); this->advanceClocks(100_ms); @@ -158,10 +158,10 @@ BOOST_AUTO_TEST_CASE(SatisfiedInterest) interest->setInterestLifetime(90_ms); shared_ptr data = makeData("/A/0"); - face1->receiveInterest(*interest); + face1->receiveInterest(*interest, 0); this->advanceClocks(30_ms); - face2->receiveData(*data); + face2->receiveData(*data, 0); this->advanceClocks(1_ms); BOOST_CHECK_EQUAL(pit.size(), 0); @@ -192,14 +192,14 @@ BOOST_AUTO_TEST_CASE(CsHit) Cs& cs = forwarder.getCs(); cs.insert(*data); - face1->receiveInterest(*interest); + face1->receiveInterest(*interest, 0); this->advanceClocks(1_ms); BOOST_CHECK_EQUAL(pit.size(), 1); this->advanceClocks(190_ms); BOOST_CHECK_EQUAL(pit.size(), 0); - face1->receiveInterest(*interest); + face1->receiveInterest(*interest, 0); this->advanceClocks(1_ms); BOOST_CHECK_EQUAL(pit.size(), 0); } @@ -225,13 +225,13 @@ BOOST_AUTO_TEST_CASE(ReceiveNack) interest->setInterestLifetime(90_ms); lp::Nack nack = makeNack("/A/0", 562, lp::NackReason::CONGESTION); - face1->receiveInterest(*interest); + face1->receiveInterest(*interest, 0); auto entry = pit.find(*interest); entry->insertOrUpdateOutRecord(*face2, 0, *interest); entry->insertOrUpdateOutRecord(*face3, 0, *interest); this->advanceClocks(10_ms); - face2->receiveNack(nack); + face2->receiveNack(nack, 0); this->advanceClocks(1_ms); BOOST_CHECK_EQUAL(pit.size(), 1); @@ -256,7 +256,7 @@ BOOST_AUTO_TEST_CASE(ResetTimerAfterReceiveInterest) shared_ptr interest = makeInterest("/A/0"); interest->setInterestLifetime(90_ms); - face->receiveInterest(*interest); + face->receiveInterest(*interest, 0); BOOST_CHECK_EQUAL(pit.size(), 1); this->advanceClocks(100_ms); @@ -291,30 +291,30 @@ BOOST_AUTO_TEST_CASE(ResetTimerBeforeSatisfyInterest) interest2->setInterestLifetime(90_ms); shared_ptr data = makeData("/A/0"); - face1->receiveInterest(*interest1); - face2->receiveInterest(*interest2); + face1->receiveInterest(*interest1, 0); + face2->receiveInterest(*interest2, 0); BOOST_CHECK_EQUAL(pit.size(), 2); // beforeSatisfyInterest: the first Data prolongs PIT expiry timer by 190 ms this->advanceClocks(30_ms); - face3->receiveData(*data); + face3->receiveData(*data, 0); this->advanceClocks(189_ms); BOOST_CHECK_EQUAL(pit.size(), 2); this->advanceClocks(2_ms); BOOST_CHECK_EQUAL(pit.size(), 0); - face1->receiveInterest(*interest1); - face2->receiveInterest(*interest2); + face1->receiveInterest(*interest1, 0); + face2->receiveInterest(*interest2, 0); // beforeSatisfyInterest: the second Data prolongs PIT expiry timer // and the third one sets the timer to now this->advanceClocks(30_ms); - face3->receiveData(*data); + face3->receiveData(*data, 0); this->advanceClocks(1_ms); BOOST_CHECK_EQUAL(pit.size(), 2); this->advanceClocks(30_ms); - face3->receiveData(*data); + face3->receiveData(*data, 0); this->advanceClocks(1_ms); BOOST_CHECK_EQUAL(pit.size(), 0); @@ -343,27 +343,27 @@ BOOST_AUTO_TEST_CASE(ResetTimerAfterReceiveData) interest->setInterestLifetime(90_ms); shared_ptr data = makeData("/A/0"); - face1->receiveInterest(*interest); + face1->receiveInterest(*interest, 0); // afterReceiveData: the first Data prolongs PIT expiry timer by 290 ms this->advanceClocks(30_ms); - face2->receiveData(*data); + face2->receiveData(*data, 0); this->advanceClocks(289_ms); BOOST_CHECK_EQUAL(pit.size(), 1); this->advanceClocks(2_ms); BOOST_CHECK_EQUAL(pit.size(), 0); - face1->receiveInterest(*interest); + face1->receiveInterest(*interest, 0); // afterReceiveData: the second Data prolongs PIT expiry timer // and the third one sets the timer to now this->advanceClocks(30_ms); - face2->receiveData(*data); + face2->receiveData(*data, 0); this->advanceClocks(1_ms); BOOST_CHECK_EQUAL(pit.size(), 1); this->advanceClocks(30_ms); - face2->receiveData(*data); + face2->receiveData(*data, 0); this->advanceClocks(1_ms); BOOST_CHECK_EQUAL(pit.size(), 0); @@ -392,20 +392,20 @@ BOOST_AUTO_TEST_CASE(ReceiveNackAfterResetTimer) interest->setInterestLifetime(90_ms); lp::Nack nack = makeNack("/A/0", 562, lp::NackReason::CONGESTION); - face1->receiveInterest(*interest); + face1->receiveInterest(*interest, 0); auto entry = pit.find(*interest); entry->insertOrUpdateOutRecord(*face2, 0, *interest); entry->insertOrUpdateOutRecord(*face3, 0, *interest); //pitEntry is not erased after receiving the first Nack this->advanceClocks(10_ms); - face2->receiveNack(nack); + face2->receiveNack(nack, 0); 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); + face3->receiveNack(nack, 0); this->advanceClocks(1_ms); BOOST_CHECK_EQUAL(pit.size(), 0); } diff --git a/tests/daemon/fw/topology-tester.cpp b/tests/daemon/fw/topology-tester.cpp index 5c63f61e..2c077ba1 100644 --- a/tests/daemon/fw/topology-tester.cpp +++ b/tests/daemon/fw/topology-tester.cpp @@ -138,27 +138,27 @@ private: ///\todo #3941 call GenericLinkServiceCounters constructor in TopologyPcapLinkService constructor void - doSendInterest(const Interest& interest) override + doSendInterest(const Interest& interest, const EndpointId& endpointId) override { this->sentInterests.push_back(interest); this->sentInterests.back().setTag(std::make_shared(time::steady_clock::now())); - this->GenericLinkService::doSendInterest(interest); + this->GenericLinkService::doSendInterest(interest, endpointId); } void - doSendData(const Data& data) override + doSendData(const Data& data, const EndpointId& endpointId) override { this->sentData.push_back(data); this->sentData.back().setTag(std::make_shared(time::steady_clock::now())); - this->GenericLinkService::doSendData(data); + this->GenericLinkService::doSendData(data, endpointId); } void - doSendNack(const lp::Nack& nack) override + doSendNack(const lp::Nack& nack, const EndpointId& endpointId) override { this->sentNacks.push_back(nack); this->sentNacks.back().setTag(std::make_shared(time::steady_clock::now())); - this->GenericLinkService::doSendNack(nack); + this->GenericLinkService::doSendNack(nack, endpointId); } }; diff --git a/tests/daemon/mgmt/face-manager-update-face.t.cpp b/tests/daemon/mgmt/face-manager-update-face.t.cpp index a20394fc..f7e89f8b 100644 --- a/tests/daemon/mgmt/face-manager-update-face.t.cpp +++ b/tests/daemon/mgmt/face-manager-update-face.t.cpp @@ -110,7 +110,7 @@ public: if (isForOnDemandFace) { auto face = target.faceTable.get(static_cast(this->faceId)); // to force creation of on-demand face - face->sendInterest(*make_shared("/hello/world")); + face->sendInterest(*make_shared("/hello/world"), 0); } }); diff --git a/tests/other/face-benchmark.cpp b/tests/other/face-benchmark.cpp index 1b86cd5b..5c7703ff 100644 --- a/tests/other/face-benchmark.cpp +++ b/tests/other/face-benchmark.cpp @@ -148,9 +148,15 @@ private: static void tieFaces(const shared_ptr& face1, const shared_ptr& face2) { - face1->afterReceiveInterest.connect([face2] (const Interest& interest) { face2->sendInterest(interest); }); - face1->afterReceiveData.connect([face2] (const Data& data) { face2->sendData(data); }); - face1->afterReceiveNack.connect([face2] (const ndn::lp::Nack& nack) { face2->sendNack(nack); }); + face1->afterReceiveInterest.connect([face2] (const Interest& interest, const EndpointId&) { + face2->sendInterest(interest, 0); + }); + face1->afterReceiveData.connect([face2] (const Data& data, const EndpointId&) { + face2->sendData(data, 0); + }); + face1->afterReceiveNack.connect([face2] (const ndn::lp::Nack& nack, const EndpointId&) { + face2->sendNack(nack, 0); + }); } static void