face+table: move EndpointId typedef out of Transport and use it in table

refs: #4843

Change-Id: I2b200518a57b21d66eae4360166afda31c3bf11b
diff --git a/daemon/face/datagram-transport.hpp b/daemon/face/datagram-transport.hpp
index 669b46e..501b590 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 @@
 }
 
 template<class T, class U>
-Transport::EndpointId
+EndpointId
 DatagramTransport<T, U>::makeEndpointId(const typename protocol::endpoint&)
 {
   return 0;
diff --git a/daemon/face/face.hpp b/daemon/face/face.hpp
index a81a75e..f99bece 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 @@
 
 } // 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 cd6f873..905dc66 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 @@
 }
 
 std::tuple<bool, Block, lp::Packet>
-LpReassembler::receiveFragment(Transport::EndpointId remoteEndpoint, const lp::Packet& packet)
+LpReassembler::receiveFragment(EndpointId remoteEndpoint, const lp::Packet& packet)
 {
   BOOST_ASSERT(packet.has<lp::FragmentField>());
 
diff --git a/daemon/face/lp-reassembler.hpp b/daemon/face/lp-reassembler.hpp
index f416b2c..21f4e1c 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 @@
    *  \throw tlv::Error packet is malformed
    */
   std::tuple<bool, Block, lp::Packet>
-  receiveFragment(Transport::EndpointId remoteEndpoint, const lp::Packet& packet);
+  receiveFragment(EndpointId remoteEndpoint, const lp::Packet& packet);
 
   /** \brief count of partial packets
    */
@@ -97,7 +97,7 @@
    *  Before it's erased, this signal is emitted with the remote endpoint,
    *  and the number of fragments being dropped.
    */
-  signal::Signal<LpReassembler, Transport::EndpointId, size_t> beforeTimeout;
+  signal::Signal<LpReassembler, EndpointId, size_t> beforeTimeout;
 
 private:
   /** \brief holds all fragments of packet until reassembled
@@ -113,7 +113,7 @@
   /** \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 6e99a1c..ec50d7f 100644
--- a/daemon/face/multicast-udp-transport.cpp
+++ b/daemon/face/multicast-udp-transport.cpp
@@ -191,7 +191,7 @@
 }
 
 template<>
-Transport::EndpointId
+EndpointId
 DatagramTransport<boost::asio::ip::udp, Multicast>::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 72498d0..bea7cb4 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 @@
 // that would cause an implicit instantiation to take place, in every translation
 // unit in which such a use occurs".
 template<>
-Transport::EndpointId
+EndpointId
 DatagramTransport<boost::asio::ip::udp, Multicast>::makeEndpointId(const protocol::endpoint& ep);
 
 /**
diff --git a/daemon/face/transport.hpp b/daemon/face/transport.hpp
index 3f00424..8bbfe86 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 @@
 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 @@
 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 cf14936..53dd584 100644
--- a/daemon/table/fib-entry.cpp
+++ b/daemon/table/fib-entry.cpp
@@ -35,7 +35,7 @@
 }
 
 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 @@
 }
 
 bool
-Entry::hasNextHop(const Face& face, uint64_t endpointId) const
+Entry::hasNextHop(const Face& face, EndpointId endpointId) const
 {
   return const_cast<Entry*>(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 @@
 }
 
 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 2b86f66..5571da3 100644
--- a/daemon/table/fib-entry.hpp
+++ b/daemon/table/fib-entry.hpp
@@ -77,7 +77,7 @@
   /** \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 @@
    *  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 @@
   /** \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 e456c15..2b946c5 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 313508d..e0cf599 100644
--- a/daemon/table/fib-nexthop.hpp
+++ b/daemon/table/fib-nexthop.hpp
@@ -39,7 +39,7 @@
 {
 public:
   explicit
-  NextHop(Face& face, uint64_t endpointId);
+  NextHop(Face& face, EndpointId endpointId);
 
   Face&
   getFace() const
@@ -47,7 +47,7 @@
     return *m_face;
   }
 
-  uint64_t
+  EndpointId
   getEndpointId() const
   {
     return m_endpointId;
@@ -67,7 +67,7 @@
 
 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 ccde921..4c74e3f 100644
--- a/daemon/table/fib.cpp
+++ b/daemon/table/fib.cpp
@@ -143,7 +143,7 @@
 }
 
 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 cfdc4f1..c7fb9cc 100644
--- a/daemon/table/fib.hpp
+++ b/daemon/table/fib.hpp
@@ -108,7 +108,7 @@
   /** \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 2edbc9f..53929e6 100644
--- a/daemon/table/pit-entry.cpp
+++ b/daemon/table/pit-entry.cpp
@@ -50,7 +50,7 @@
 }
 
 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 @@
 }
 
 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 @@
 }
 
 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 @@
 }
 
 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 @@
 }
 
 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 @@
 }
 
 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 b1dc9ee..5a814bd 100644
--- a/daemon/table/pit-entry.hpp
+++ b/daemon/table/pit-entry.hpp
@@ -136,18 +136,18 @@
    *  \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 @@
    *  \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 61fef7e..212ad23 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 3e3f020..8f4132c 100644
--- a/daemon/table/pit-face-record.hpp
+++ b/daemon/table/pit-face-record.hpp
@@ -40,12 +40,12 @@
 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 @@
 
 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 @@
   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 7bb10b9..e26e767 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 d758097..f03c608 100644
--- a/daemon/table/pit-in-record.hpp
+++ b/daemon/table/pit-in-record.hpp
@@ -36,7 +36,7 @@
 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 75d7e7f..5a42151 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 c0537fd..985a129 100644
--- a/daemon/table/pit-out-record.hpp
+++ b/daemon/table/pit-out-record.hpp
@@ -36,7 +36,7 @@
 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 b1140d8..1d4ee6a 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 @@
   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<std::pair<Transport::EndpointId, size_t>> timeoutHistory;
+  std::vector<std::pair<EndpointId, size_t>> timeoutHistory;
 
   static const uint8_t data[10];
 };
@@ -304,7 +304,7 @@
   received2.add<lp::FragCountField>(2);
   received2.add<lp::SequenceField>(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);