diff --git a/daemon/face/datagram-transport.hpp b/daemon/face/datagram-transport.hpp index 669b46eb..501b590a 100644 --- a/daemon/face/datagram-transport.hpp +++ b/daemon/face/datagram-transport.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -260,7 +260,7 @@ DatagramTransport::resetRecentlyReceived() } template -Transport::EndpointId +EndpointId DatagramTransport::makeEndpointId(const typename protocol::endpoint&) { return 0; diff --git a/daemon/face/face.hpp b/daemon/face/face.hpp index a81a75e5..f99bece9 100644 --- a/daemon/face/face.hpp +++ b/daemon/face/face.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -299,6 +299,7 @@ operator<<(std::ostream& os, const FaceLogHelper& flh); } // namespace face +using face::EndpointId; using face::FaceId; using face::Face; diff --git a/daemon/face/lp-reassembler.cpp b/daemon/face/lp-reassembler.cpp index cd6f8739..905dc66a 100644 --- a/daemon/face/lp-reassembler.cpp +++ b/daemon/face/lp-reassembler.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, @@ -40,7 +40,7 @@ LpReassembler::LpReassembler(const LpReassembler::Options& options, const LinkSe } std::tuple -LpReassembler::receiveFragment(Transport::EndpointId remoteEndpoint, const lp::Packet& packet) +LpReassembler::receiveFragment(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 f416b2c1..21f4e1c6 100644 --- a/daemon/face/lp-reassembler.hpp +++ b/daemon/face/lp-reassembler.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -83,7 +83,7 @@ public: * \throw tlv::Error packet is malformed */ std::tuple - receiveFragment(Transport::EndpointId remoteEndpoint, const lp::Packet& packet); + receiveFragment(EndpointId remoteEndpoint, const lp::Packet& packet); /** \brief count of partial packets */ @@ -97,7 +97,7 @@ public: * Before it's erased, this signal is emitted with the remote endpoint, * and the number of fragments being dropped. */ - signal::Signal beforeTimeout; + signal::Signal beforeTimeout; private: /** \brief holds all fragments of packet until reassembled @@ -113,7 +113,7 @@ private: /** \brief index key for PartialPackets */ typedef std::tuple< - Transport::EndpointId, // remoteEndpoint + EndpointId, // remoteEndpoint lp::Sequence // message identifier (sequence of the first fragment) > Key; diff --git a/daemon/face/multicast-udp-transport.cpp b/daemon/face/multicast-udp-transport.cpp index 6e99a1ce..ec50d7f3 100644 --- a/daemon/face/multicast-udp-transport.cpp +++ b/daemon/face/multicast-udp-transport.cpp @@ -191,7 +191,7 @@ MulticastUdpTransport::openTxSocket(protocol::socket& sock, } template<> -Transport::EndpointId +EndpointId DatagramTransport::makeEndpointId(const protocol::endpoint& ep) { if (ep.address().is_v4()) { diff --git a/daemon/face/multicast-udp-transport.hpp b/daemon/face/multicast-udp-transport.hpp index 72498d05..bea7cb44 100644 --- a/daemon/face/multicast-udp-transport.hpp +++ b/daemon/face/multicast-udp-transport.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -40,7 +40,7 @@ NFD_LOG_MEMBER_DECL_SPECIALIZED((DatagramTransport -Transport::EndpointId +EndpointId DatagramTransport::makeEndpointId(const protocol::endpoint& ep); /** diff --git a/daemon/face/transport.hpp b/daemon/face/transport.hpp index 3f004245..8bbfe868 100644 --- a/daemon/face/transport.hpp +++ b/daemon/face/transport.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -37,6 +37,10 @@ namespace face { class Face; class LinkService; +/** \brief identifies an endpoint on the link + */ +typedef uint64_t EndpointId; + /** \brief indicates the state of a transport */ enum class TransportState { @@ -113,10 +117,6 @@ const ssize_t QUEUE_ERROR = -2; class Transport : protected virtual TransportCounters, noncopyable { public: - /** \brief identifies an endpoint on the link - */ - typedef uint64_t EndpointId; - /** \brief stores a packet along with the remote endpoint */ class Packet diff --git a/daemon/table/fib-entry.cpp b/daemon/table/fib-entry.cpp index cf14936f..53dd5845 100644 --- a/daemon/table/fib-entry.cpp +++ b/daemon/table/fib-entry.cpp @@ -35,7 +35,7 @@ Entry::Entry(const Name& prefix) } NextHopList::iterator -Entry::findNextHop(const Face& face, uint64_t endpointId) +Entry::findNextHop(const Face& face, EndpointId endpointId) { return std::find_if(m_nextHops.begin(), m_nextHops.end(), [&face, endpointId] (const NextHop& nexthop) { @@ -44,13 +44,13 @@ Entry::findNextHop(const Face& face, uint64_t endpointId) } bool -Entry::hasNextHop(const Face& face, uint64_t endpointId) const +Entry::hasNextHop(const Face& face, EndpointId endpointId) const { return const_cast(this)->findNextHop(face, endpointId) != m_nextHops.end(); } void -Entry::addOrUpdateNextHop(Face& face, uint64_t endpointId, uint64_t cost) +Entry::addOrUpdateNextHop(Face& face, EndpointId endpointId, uint64_t cost) { auto it = this->findNextHop(face, endpointId); if (it == m_nextHops.end()) { @@ -62,7 +62,7 @@ Entry::addOrUpdateNextHop(Face& face, uint64_t endpointId, uint64_t cost) } void -Entry::removeNextHop(const Face& face, uint64_t endpointId) +Entry::removeNextHop(const Face& face, EndpointId endpointId) { auto it = this->findNextHop(face, endpointId); if (it != m_nextHops.end()) { diff --git a/daemon/table/fib-entry.hpp b/daemon/table/fib-entry.hpp index 2b86f662..5571da31 100644 --- a/daemon/table/fib-entry.hpp +++ b/daemon/table/fib-entry.hpp @@ -77,7 +77,7 @@ public: /** \return whether there is a NextHop record for \p face with the given \p endpointId */ bool - hasNextHop(const Face& face, uint64_t endpointId) const; + hasNextHop(const Face& face, EndpointId endpointId) const; /** \brief adds a NextHop record * @@ -85,12 +85,12 @@ public: * its cost is updated. */ void - addOrUpdateNextHop(Face& face, uint64_t endpointId, uint64_t cost); + addOrUpdateNextHop(Face& face, EndpointId endpointId, uint64_t cost); /** \brief removes the NextHop record for \p face with the given \p endpointId */ void - removeNextHop(const Face& face, uint64_t endpointId); + removeNextHop(const Face& face, EndpointId endpointId); /** \brief removes all NextHop records on \p face for any \p endpointId */ @@ -101,7 +101,7 @@ private: /** \note This method is non-const because mutable iterators are needed by callers. */ NextHopList::iterator - findNextHop(const Face& face, uint64_t endpointId); + findNextHop(const Face& face, EndpointId endpointId); /** \brief sorts the nexthop list by cost */ diff --git a/daemon/table/fib-nexthop.cpp b/daemon/table/fib-nexthop.cpp index e456c15b..2b946c5a 100644 --- a/daemon/table/fib-nexthop.cpp +++ b/daemon/table/fib-nexthop.cpp @@ -28,7 +28,7 @@ namespace nfd { namespace fib { -NextHop::NextHop(Face& face, uint64_t endpointId) +NextHop::NextHop(Face& face, EndpointId endpointId) : m_face(&face) , m_endpointId(endpointId) , m_cost(0) diff --git a/daemon/table/fib-nexthop.hpp b/daemon/table/fib-nexthop.hpp index 313508d8..e0cf5998 100644 --- a/daemon/table/fib-nexthop.hpp +++ b/daemon/table/fib-nexthop.hpp @@ -39,7 +39,7 @@ class NextHop { public: explicit - NextHop(Face& face, uint64_t endpointId); + NextHop(Face& face, EndpointId endpointId); Face& getFace() const @@ -47,7 +47,7 @@ public: return *m_face; } - uint64_t + EndpointId getEndpointId() const { return m_endpointId; @@ -67,7 +67,7 @@ public: private: Face* m_face; - uint64_t m_endpointId; + EndpointId m_endpointId; uint64_t m_cost; }; diff --git a/daemon/table/fib.cpp b/daemon/table/fib.cpp index ccde921e..4c74e3fa 100644 --- a/daemon/table/fib.cpp +++ b/daemon/table/fib.cpp @@ -143,7 +143,7 @@ Fib::eraseIfEmpty(Entry& entry) } void -Fib::removeNextHop(Entry& entry, const Face& face, uint64_t endpointId) +Fib::removeNextHop(Entry& entry, const Face& face, EndpointId endpointId) { entry.removeNextHop(face, endpointId); this->eraseIfEmpty(entry); diff --git a/daemon/table/fib.hpp b/daemon/table/fib.hpp index cfdc4f16..c7fb9ccf 100644 --- a/daemon/table/fib.hpp +++ b/daemon/table/fib.hpp @@ -108,7 +108,7 @@ public: // mutation /** \brief removes the NextHop record for \p face with a given \p endpointId */ void - removeNextHop(Entry& entry, const Face& face, uint64_t endpointId); + removeNextHop(Entry& entry, const Face& face, EndpointId endpointId); /** \brief removes the NextHop record for \p face for any \p endpointId */ diff --git a/daemon/table/pit-entry.cpp b/daemon/table/pit-entry.cpp index 2edbc9f3..53929e61 100644 --- a/daemon/table/pit-entry.cpp +++ b/daemon/table/pit-entry.cpp @@ -50,7 +50,7 @@ Entry::canMatch(const Interest& interest, size_t nEqualNameComps) const } InRecordCollection::iterator -Entry::getInRecord(const Face& face, uint64_t endpointId) +Entry::getInRecord(const Face& face, EndpointId endpointId) { return std::find_if(m_inRecords.begin(), m_inRecords.end(), [&face, endpointId] (const InRecord& inRecord) { @@ -59,7 +59,7 @@ Entry::getInRecord(const Face& face, uint64_t endpointId) } InRecordCollection::iterator -Entry::insertOrUpdateInRecord(Face& face, uint64_t endpointId, const Interest& interest) +Entry::insertOrUpdateInRecord(Face& face, EndpointId endpointId, const Interest& interest) { BOOST_ASSERT(this->canMatch(interest)); @@ -77,7 +77,7 @@ Entry::insertOrUpdateInRecord(Face& face, uint64_t endpointId, const Interest& i } void -Entry::deleteInRecord(const Face& face, uint64_t endpointId) +Entry::deleteInRecord(const Face& face, EndpointId endpointId) { auto it = std::find_if(m_inRecords.begin(), m_inRecords.end(), [&face, endpointId] (const InRecord& inRecord) { @@ -95,7 +95,7 @@ Entry::clearInRecords() } OutRecordCollection::iterator -Entry::getOutRecord(const Face& face, uint64_t endpointId) +Entry::getOutRecord(const Face& face, EndpointId endpointId) { return std::find_if(m_outRecords.begin(), m_outRecords.end(), [&face, endpointId] (const OutRecord& outRecord) { @@ -104,7 +104,7 @@ Entry::getOutRecord(const Face& face, uint64_t endpointId) } OutRecordCollection::iterator -Entry::insertOrUpdateOutRecord(Face& face, uint64_t endpointId, const Interest& interest) +Entry::insertOrUpdateOutRecord(Face& face, EndpointId endpointId, const Interest& interest) { BOOST_ASSERT(this->canMatch(interest)); @@ -122,7 +122,7 @@ Entry::insertOrUpdateOutRecord(Face& face, uint64_t endpointId, const Interest& } void -Entry::deleteOutRecord(const Face& face, uint64_t endpointId) +Entry::deleteOutRecord(const Face& face, EndpointId endpointId) { auto it = std::find_if(m_outRecords.begin(), m_outRecords.end(), [&face, endpointId] (const OutRecord& outRecord) { diff --git a/daemon/table/pit-entry.hpp b/daemon/table/pit-entry.hpp index b1dc9ee4..5a814bd0 100644 --- a/daemon/table/pit-entry.hpp +++ b/daemon/table/pit-entry.hpp @@ -136,18 +136,18 @@ public: // in-record * \return an iterator to the in-record, or .in_end() if it does not exist */ InRecordCollection::iterator - getInRecord(const Face& face, uint64_t endpointId); + getInRecord(const Face& face, EndpointId endpointId); /** \brief insert or update an in-record * \return an iterator to the new or updated in-record */ InRecordCollection::iterator - insertOrUpdateInRecord(Face& face, uint64_t endpointId, const Interest& interest); + insertOrUpdateInRecord(Face& face, EndpointId endpointId, const Interest& interest); /** \brief delete the in-record for \p face and \p endpointId if it exists */ void - deleteInRecord(const Face& face, uint64_t endpointId); + deleteInRecord(const Face& face, EndpointId endpointId); /** \brief delete all in-records */ @@ -203,18 +203,18 @@ public: // out-record * \return an iterator to the out-record, or .out_end() if it does not exist */ OutRecordCollection::iterator - getOutRecord(const Face& face, uint64_t endpointId); + getOutRecord(const Face& face, EndpointId endpointId); /** \brief insert or update an out-record * \return an iterator to the new or updated out-record */ OutRecordCollection::iterator - insertOrUpdateOutRecord(Face& face, uint64_t endpointId, const Interest& interest); + insertOrUpdateOutRecord(Face& face, EndpointId endpointId, const Interest& interest); /** \brief delete the out-record for \p face and \p endpointId if it exists */ void - deleteOutRecord(const Face& face, uint64_t endpointId); + deleteOutRecord(const Face& face, EndpointId endpointId); public: // cleanup /** \brief delete all in-records and out-records for \p face if it exists diff --git a/daemon/table/pit-face-record.cpp b/daemon/table/pit-face-record.cpp index 61fef7e8..212ad237 100644 --- a/daemon/table/pit-face-record.cpp +++ b/daemon/table/pit-face-record.cpp @@ -28,7 +28,7 @@ namespace nfd { namespace pit { -FaceRecord::FaceRecord(Face& face, uint64_t endpointId) +FaceRecord::FaceRecord(Face& face, EndpointId endpointId) : m_face(face) , m_endpointId(endpointId) , m_lastNonce(0) diff --git a/daemon/table/pit-face-record.hpp b/daemon/table/pit-face-record.hpp index 3e3f0206..8f4132ca 100644 --- a/daemon/table/pit-face-record.hpp +++ b/daemon/table/pit-face-record.hpp @@ -40,12 +40,12 @@ namespace pit { class FaceRecord : public StrategyInfoHost { public: - FaceRecord(Face& face, uint64_t endpointId); + FaceRecord(Face& face, EndpointId endpointId); Face& getFace() const; - uint64_t + EndpointId getEndpointId() const; uint32_t @@ -67,7 +67,7 @@ public: private: Face& m_face; - uint64_t m_endpointId; + EndpointId m_endpointId; uint32_t m_lastNonce; time::steady_clock::TimePoint m_lastRenewed; time::steady_clock::TimePoint m_expiry; @@ -79,7 +79,7 @@ FaceRecord::getFace() const return m_face; } -inline uint64_t +inline EndpointId FaceRecord::getEndpointId() const { return m_endpointId; diff --git a/daemon/table/pit-in-record.cpp b/daemon/table/pit-in-record.cpp index 7bb10b9d..e26e767e 100644 --- a/daemon/table/pit-in-record.cpp +++ b/daemon/table/pit-in-record.cpp @@ -28,7 +28,7 @@ namespace nfd { namespace pit { -InRecord::InRecord(Face& face, uint64_t endpointId) +InRecord::InRecord(Face& face, EndpointId endpointId) : FaceRecord(face, endpointId) { } diff --git a/daemon/table/pit-in-record.hpp b/daemon/table/pit-in-record.hpp index d7580972..f03c6083 100644 --- a/daemon/table/pit-in-record.hpp +++ b/daemon/table/pit-in-record.hpp @@ -36,7 +36,7 @@ namespace pit { class InRecord : public FaceRecord { public: - InRecord(Face& face, uint64_t endpointId); + InRecord(Face& face, EndpointId endpointId); void update(const Interest& interest); diff --git a/daemon/table/pit-out-record.cpp b/daemon/table/pit-out-record.cpp index 75d7e7fe..5a421510 100644 --- a/daemon/table/pit-out-record.cpp +++ b/daemon/table/pit-out-record.cpp @@ -28,7 +28,7 @@ namespace nfd { namespace pit { -OutRecord::OutRecord(Face& face, uint64_t endpointId) +OutRecord::OutRecord(Face& face, EndpointId endpointId) : FaceRecord(face, endpointId) { } diff --git a/daemon/table/pit-out-record.hpp b/daemon/table/pit-out-record.hpp index c0537fdb..985a1298 100644 --- a/daemon/table/pit-out-record.hpp +++ b/daemon/table/pit-out-record.hpp @@ -36,7 +36,7 @@ namespace pit { class OutRecord : public FaceRecord { public: - OutRecord(Face& face, uint64_t endpointId); + OutRecord(Face& face, EndpointId endpointId); /** \return last NACK returned by \p getFace() * diff --git a/tests/daemon/face/lp-reassembler.t.cpp b/tests/daemon/face/lp-reassembler.t.cpp index b1140d8d..1d4ee6a4 100644 --- a/tests/daemon/face/lp-reassembler.t.cpp +++ b/tests/daemon/face/lp-reassembler.t.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, @@ -39,14 +39,14 @@ protected: LpReassemblerFixture() { reassembler.beforeTimeout.connect( - [this] (Transport::EndpointId remoteEp, size_t nDroppedFragments) { + [this] (EndpointId remoteEp, size_t nDroppedFragments) { timeoutHistory.push_back({remoteEp, nDroppedFragments}); }); } protected: LpReassembler reassembler{{}}; - std::vector> timeoutHistory; + std::vector> timeoutHistory; static const uint8_t data[10]; }; @@ -304,7 +304,7 @@ BOOST_AUTO_TEST_CASE(Timeout) received2.add(2); received2.add(1001); - const Transport::EndpointId REMOTE_EP = 11028; + const EndpointId REMOTE_EP = 11028; bool isComplete = false; std::tie(isComplete, std::ignore, std::ignore) = reassembler.receiveFragment(REMOTE_EP, received1); BOOST_REQUIRE(!isComplete);