diff --git a/daemon/face/generic-link-service.hpp b/daemon/face/generic-link-service.hpp
index 08ed9e1..b675ae2 100644
--- a/daemon/face/generic-link-service.hpp
+++ b/daemon/face/generic-link-service.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2016,  Regents of the University of California,
+ * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -75,9 +75,10 @@
 
 /** \brief GenericLinkService is a LinkService that implements the NDNLPv2 protocol
  *  \sa http://redmine.named-data.net/projects/nfd/wiki/NDNLPv2
+ *  \todo #3941 declare GenericLinkServiceCounters as virtual inheritance
  */
 class GenericLinkService : public LinkService
-                         , protected virtual GenericLinkServiceCounters
+                         , protected GenericLinkServiceCounters
 {
 public:
   /** \brief Options that control the behavior of GenericLinkService
@@ -111,7 +112,7 @@
 
   /** \brief counters provided by GenericLinkService
    */
-  typedef GenericLinkServiceCounters Counters;
+  using Counters = GenericLinkServiceCounters;
 
   explicit
   GenericLinkService(const Options& options = Options());
@@ -126,10 +127,10 @@
   void
   setOptions(const Options& options);
 
-  virtual const Counters&
+  const Counters&
   getCounters() const override;
 
-private: // send path
+PROTECTED_WITH_TESTS_ELSE_PRIVATE: // send path
   /** \brief send Interest
    */
   void
@@ -145,6 +146,7 @@
   void
   doSendNack(const ndn::lp::Nack& nack) override;
 
+private:
   /** \brief encode link protocol fields from tags onto an outgoing LpPacket
    *  \param netPkt network-layer packet to extract tags from
    *  \param lpPacket LpPacket to add link protocol fields to
diff --git a/tests/daemon/fw/link-forwarding.t.cpp b/tests/daemon/fw/link-forwarding.t.cpp
new file mode 100644
index 0000000..864d598
--- /dev/null
+++ b/tests/daemon/fw/link-forwarding.t.cpp
@@ -0,0 +1,202 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2017,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "fw/best-route-strategy2.hpp"
+
+#include "topology-tester.hpp"
+
+namespace nfd {
+namespace fw {
+namespace tests {
+
+using namespace nfd::tests;
+
+BOOST_AUTO_TEST_SUITE(Fw)
+BOOST_AUTO_TEST_SUITE(TestLinkForwarding)
+
+/**
+ *      /arizona/cs/avenir
+ *              |
+ *              v
+ *      /arizona/cs/hobo
+ *      |              |
+ *      v              v
+ *  /telia/terabits    /ucsd/caida/click
+ *        |                 |
+ *        v                 v
+ *  /net/ndnsim        /ucla/cs/spurs
+ *   (serverP)              |
+ *                          v
+ *                     /net/ndnsim
+ *                      (serverQ)
+ */
+class NdnsimTeliaUclaTopologyFixture : public UnitTestTimeFixture
+{
+public:
+  NdnsimTeliaUclaTopologyFixture()
+  {
+    topo.enablePcap();
+
+    nodeA = topo.addForwarder("avenir");
+    nodeH = topo.addForwarder("hobo");
+    nodeT = topo.addForwarder("terabits");
+    nodeP = topo.addForwarder("serverP");
+    nodeC = topo.addForwarder("click");
+    nodeS = topo.addForwarder("spurs");
+    nodeQ = topo.addForwarder("serverQ");
+    for (TopologyNode node : {nodeA, nodeH, nodeT, nodeP, nodeC, nodeS, nodeQ}) {
+      topo.setStrategy<BestRouteStrategy2>(node);
+    }
+
+    topo.getForwarder(nodeA).getNetworkRegionTable().insert("/arizona/cs/avenir");
+    topo.getForwarder(nodeH).getNetworkRegionTable().insert("/arizona/cs/hobo");
+    topo.getForwarder(nodeT).getNetworkRegionTable().insert("/telia/terabits/router");
+    topo.getForwarder(nodeP).getNetworkRegionTable().insert("/telia/terabits/serverP");
+    topo.getForwarder(nodeC).getNetworkRegionTable().insert("/ucsd/caida/click");
+    topo.getForwarder(nodeS).getNetworkRegionTable().insert("/ucla/cs/spurs");
+    topo.getForwarder(nodeQ).getNetworkRegionTable().insert("/ucla/cs/serverQ");
+
+    linkAH = topo.addLink("AH", time::milliseconds(10), {nodeA, nodeH});
+    linkHT = topo.addLink("HT", time::milliseconds(10), {nodeH, nodeT});
+    linkTP = topo.addLink("TP", time::milliseconds(10), {nodeT, nodeP});
+    linkHC = topo.addLink("HC", time::milliseconds(10), {nodeH, nodeC});
+    linkCS = topo.addLink("CS", time::milliseconds(10), {nodeC, nodeS});
+    linkSQ = topo.addLink("SQ", time::milliseconds(10), {nodeS, nodeQ});
+    consumerA = topo.addAppFace("avenir", nodeA);
+    producerP = topo.addAppFace("ndnsimP", nodeP, "/net/ndnsim");
+    producerQ = topo.addAppFace("ndnsimQ", nodeQ, "/net/ndnsim");
+
+    topo.addEchoProducer(producerP->getClientFace());
+    topo.addEchoProducer(producerQ->getClientFace());
+
+    topo.registerPrefix(nodeA, linkAH->getFace(nodeA), "/", 10);
+    topo.registerPrefix(nodeH, linkHT->getFace(nodeH), "/telia", 10);
+    topo.registerPrefix(nodeT, linkTP->getFace(nodeT), "/net/ndnsim", 10);
+    topo.registerPrefix(nodeH, linkHC->getFace(nodeH), "/ucla", 20);
+    topo.registerPrefix(nodeC, linkCS->getFace(nodeC), "/ucla", 10);
+    topo.registerPrefix(nodeS, linkSQ->getFace(nodeS), "/net/ndnsim", 10);
+
+    linkObject = makeLink("/net/ndnsim", {{10, "/telia/terabits"}, {20, "/ucla/cs"}});
+  }
+
+  /** \brief express an Interest with Link object from consumerA
+   */
+  void
+  consumerExpressInterest(int seq)
+  {
+    auto interest = makeInterest(Name("/net/ndnsim").appendNumber(seq));
+    interest->setLink(linkObject->wireEncode());
+    consumerA->getClientFace().expressInterest(*interest, nullptr, nullptr, nullptr);
+  }
+
+public:
+  TopologyTester topo;
+  TopologyNode nodeA, nodeH, nodeT, nodeP, nodeC, nodeS, nodeQ;
+  shared_ptr<TopologyLink> linkAH, linkHT, linkTP, linkHC, linkCS, linkSQ;
+  shared_ptr<TopologyAppLink> consumerA, producerP, producerQ;
+  shared_ptr<Link> linkObject;
+};
+
+BOOST_FIXTURE_TEST_SUITE(NdnsimTeliaUclaTopology, NdnsimTeliaUclaTopologyFixture)
+
+BOOST_AUTO_TEST_CASE(FetchTelia)
+{
+  this->consumerExpressInterest(1);
+  this->advanceClocks(time::milliseconds(11), 20);
+
+  // A forwards Interest according to default route, no change to Link and SelectedDelegation
+  BOOST_CHECK_EQUAL(linkAH->getFace(nodeA).getCounters().nOutInterests, 1);
+  const Interest& interestAH = topo.getPcap(linkAH->getFace(nodeA)).sentInterests.at(0);
+  BOOST_CHECK_EQUAL(interestAH.hasLink(), true);
+  BOOST_CHECK_EQUAL(interestAH.hasSelectedDelegation(), false);
+
+  // H prefers T, and sets SelectedDelegation
+  BOOST_CHECK_EQUAL(linkHT->getFace(nodeH).getCounters().nOutInterests, 1);
+  const Interest& interestHT = topo.getPcap(linkHT->getFace(nodeH)).sentInterests.at(0);
+  BOOST_CHECK_EQUAL(interestHT.hasLink(), true);
+  BOOST_CHECK_EQUAL(interestHT.hasSelectedDelegation(), true);
+  BOOST_CHECK_EQUAL(interestHT.getSelectedDelegation(), "/telia/terabits");
+
+  // T forwards to P, no change to Link and SelectedDelegation
+  BOOST_CHECK_EQUAL(linkTP->getFace(nodeT).getCounters().nOutInterests, 1);
+  const Interest& interestTP = topo.getPcap(linkTP->getFace(nodeT)).sentInterests.at(0);
+  BOOST_CHECK_EQUAL(interestTP.hasLink(), true);
+  BOOST_CHECK_EQUAL(interestTP.hasSelectedDelegation(), true);
+  BOOST_CHECK_EQUAL(interestTP.getSelectedDelegation(), "/telia/terabits");
+
+  // Data is served by P and reaches A
+  BOOST_CHECK_EQUAL(producerP->getForwarderFace().getCounters().nInData, 1);
+  BOOST_CHECK_EQUAL(consumerA->getForwarderFace().getCounters().nOutData, 1);
+}
+
+BOOST_AUTO_TEST_CASE(FetchUcla)
+{
+  // disconnect H-T and delete FIB entry
+  linkHT->fail();
+  topo.getForwarder(nodeH).getFib().erase("/telia");
+
+  this->consumerExpressInterest(1);
+  this->advanceClocks(time::milliseconds(11), 20);
+
+  // A forwards Interest according to default route, no change to Link and SelectedDelegation
+  BOOST_CHECK_EQUAL(linkAH->getFace(nodeA).getCounters().nOutInterests, 1);
+  const Interest& interestAH = topo.getPcap(linkAH->getFace(nodeA)).sentInterests.at(0);
+  BOOST_CHECK_EQUAL(interestAH.hasLink(), true);
+  BOOST_CHECK_EQUAL(interestAH.hasSelectedDelegation(), false);
+
+  // H forwards to C, and sets SelectedDelegation
+  BOOST_CHECK_EQUAL(linkHC->getFace(nodeH).getCounters().nOutInterests, 1);
+  const Interest& interestHC = topo.getPcap(linkHC->getFace(nodeH)).sentInterests.at(0);
+  BOOST_CHECK_EQUAL(interestHC.hasLink(), true);
+  BOOST_CHECK_EQUAL(interestHC.hasSelectedDelegation(), true);
+  BOOST_CHECK_EQUAL(interestHC.getSelectedDelegation(), "/ucla/cs");
+
+  // C forwards to S, no change to Link and SelectedDelegation
+  BOOST_CHECK_EQUAL(linkCS->getFace(nodeC).getCounters().nOutInterests, 1);
+  const Interest& interestCS = topo.getPcap(linkCS->getFace(nodeC)).sentInterests.at(0);
+  BOOST_CHECK_EQUAL(interestCS.hasLink(), true);
+  BOOST_CHECK_EQUAL(interestCS.hasSelectedDelegation(), true);
+  BOOST_CHECK_EQUAL(interestCS.getSelectedDelegation(), "/ucla/cs");
+
+  // S forwards to Q, no change to Link and SelectedDelegation
+  BOOST_CHECK_EQUAL(linkSQ->getFace(nodeS).getCounters().nOutInterests, 1);
+  const Interest& interestSQ = topo.getPcap(linkSQ->getFace(nodeS)).sentInterests.at(0);
+  BOOST_CHECK_EQUAL(interestSQ.hasLink(), true);
+  BOOST_CHECK_EQUAL(interestSQ.hasSelectedDelegation(), true);
+  BOOST_CHECK_EQUAL(interestSQ.getSelectedDelegation(), "/ucla/cs");
+
+  // Data is served by Q and reaches A
+  BOOST_CHECK_EQUAL(producerQ->getForwarderFace().getCounters().nInData, 1);
+  BOOST_CHECK_EQUAL(consumerA->getForwarderFace().getCounters().nOutData, 1);
+}
+
+BOOST_AUTO_TEST_SUITE_END() // NdnsimTeliaUclaTopology
+
+BOOST_AUTO_TEST_SUITE_END() // TestLinkForwarding
+BOOST_AUTO_TEST_SUITE_END() // Fw
+
+} // namespace tests
+} // namespace fw
+} // namespace nfd
diff --git a/tests/daemon/fw/strategy.t.cpp b/tests/daemon/fw/strategy.t.cpp
index 72d43b4..11f3f38 100644
--- a/tests/daemon/fw/strategy.t.cpp
+++ b/tests/daemon/fw/strategy.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2016,  Regents of the University of California,
+ * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -100,147 +100,7 @@
   BOOST_CHECK((strategy.removedFaces == std::vector<FaceId>{id2, id1}));
 }
 
-class LookupFibFixture : public BaseFixture
-{
-protected:
-  class TestStrategy : public DummyStrategy
-  {
-  public:
-    explicit
-    TestStrategy(Forwarder& forwarder)
-      : DummyStrategy(forwarder)
-    {
-    }
-
-    const fib::Entry&
-    lookupFib(const pit::Entry& pitEntry) const
-    {
-      return this->Strategy::lookupFib(pitEntry);
-    }
-  };
-
-  LookupFibFixture()
-    : strategy(forwarder)
-    , fib(forwarder.getFib())
-    , pit(forwarder.getPit())
-    , nrt(forwarder.getNetworkRegionTable())
-    , inFace(make_shared<DummyFace>())
-    , outFace(make_shared<DummyFace>())
-    , link(makeLink("/net/ndnsim", {{10, "/telia/terabits"}, {20, "/ucla/cs"}}))
-  {
-    forwarder.addFace(inFace);
-    forwarder.addFace(outFace);
-  }
-
-  const fib::Entry&
-  lookupFib(Interest& interest)
-  {
-    shared_ptr<pit::Entry> pitEntry = pit.insert(interest).first;
-    pitEntry->insertOrUpdateInRecord(*inFace, interest);
-    return strategy.lookupFib(*pitEntry);
-  }
-
-protected:
-  Forwarder forwarder;
-  TestStrategy strategy;
-  Fib& fib;
-  Pit& pit;
-  NetworkRegionTable& nrt;
-
-  shared_ptr<Face> inFace;
-  shared_ptr<Face> outFace;
-  shared_ptr<Link> link;
-};
-
-BOOST_FIXTURE_TEST_SUITE(LookupFib, LookupFibFixture)
-
-BOOST_AUTO_TEST_CASE(NoLink)
-{
-  fib.insert("/net/ndnsim").first->addNextHop(*outFace, 10);
-
-  auto interest = makeInterest("/net/ndnsim/www/index.html");
-  const fib::Entry& fibEntry = this->lookupFib(*interest);
-
-  BOOST_CHECK_EQUAL(fibEntry.getPrefix(), "/net/ndnsim");
-  BOOST_CHECK_EQUAL(interest->hasSelectedDelegation(), false);
-}
-
-BOOST_AUTO_TEST_CASE(ConsumerRegion)
-{
-  nrt.insert("/arizona/cs/avenir");
-  fib.insert("/").first->addNextHop(*outFace, 10);
-
-  auto interest = makeInterest("/net/ndnsim/www/index.html");
-  interest->setLink(link->wireEncode());
-  const fib::Entry& fibEntry = this->lookupFib(*interest);
-
-  BOOST_CHECK_EQUAL(fibEntry.getPrefix(), "/");
-  BOOST_CHECK_EQUAL(interest->hasSelectedDelegation(), false);
-}
-
-BOOST_AUTO_TEST_CASE(DefaultFreeFirstDelegation)
-{
-  nrt.insert("/arizona/cs/hobo");
-  fib.insert("/telia").first->addNextHop(*outFace, 20);
-  fib.insert("/ucla").first->addNextHop(*outFace, 10);
-
-  auto interest = makeInterest("/net/ndnsim/www/index.html");
-  interest->setLink(link->wireEncode());
-  const fib::Entry& fibEntry = this->lookupFib(*interest);
-
-  BOOST_CHECK_EQUAL(fibEntry.getPrefix(), "/telia");
-  BOOST_REQUIRE_EQUAL(interest->hasSelectedDelegation(), true);
-  BOOST_CHECK_EQUAL(interest->getSelectedDelegation(), "/telia/terabits");
-}
-
-BOOST_AUTO_TEST_CASE(DefaultFreeSecondDelegation)
-{
-  nrt.insert("/arizona/cs/hobo");
-  fib.insert("/ucla").first->addNextHop(*outFace, 10);
-
-  auto interest = makeInterest("/net/ndnsim/www/index.html");
-  interest->setLink(link->wireEncode());
-  const fib::Entry& fibEntry = this->lookupFib(*interest);
-
-  BOOST_CHECK_EQUAL(fibEntry.getPrefix(), "/ucla");
-  BOOST_REQUIRE_EQUAL(interest->hasSelectedDelegation(), true);
-  BOOST_CHECK_EQUAL(interest->getSelectedDelegation(), "/ucla/cs");
-}
-
-BOOST_AUTO_TEST_CASE(DefaultFreeHasSelectedDelegation)
-{
-  nrt.insert("/ucsd/caida/click");
-  fib.insert("/telia").first->addNextHop(*outFace, 10);
-  fib.insert("/ucla").first->addNextHop(*outFace, 10);
-
-  auto interest = makeInterest("/net/ndnsim/www/index.html");
-  interest->setLink(link->wireEncode());
-  interest->setSelectedDelegation("/ucla/cs");
-  const fib::Entry& fibEntry = this->lookupFib(*interest);
-
-  BOOST_CHECK_EQUAL(fibEntry.getPrefix(), "/ucla");
-  BOOST_REQUIRE_EQUAL(interest->hasSelectedDelegation(), true);
-  BOOST_CHECK_EQUAL(interest->getSelectedDelegation(), "/ucla/cs");
-}
-
-BOOST_AUTO_TEST_CASE(ProducerRegion)
-{
-  nrt.insert("/ucla/cs/spurs");
-  fib.insert("/").first->addNextHop(*outFace, 10);
-  fib.insert("/ucla").first->addNextHop(*outFace, 10);
-  fib.insert("/net/ndnsim").first->addNextHop(*outFace, 10);
-
-  auto interest = makeInterest("/net/ndnsim/www/index.html");
-  interest->setLink(link->wireEncode());
-  interest->setSelectedDelegation("/ucla/cs");
-  const fib::Entry& fibEntry = this->lookupFib(*interest);
-
-  BOOST_CHECK_EQUAL(fibEntry.getPrefix(), "/net/ndnsim");
-  BOOST_REQUIRE_EQUAL(interest->hasSelectedDelegation(), true);
-  BOOST_CHECK_EQUAL(interest->getSelectedDelegation(), "/ucla/cs");
-}
-
-BOOST_AUTO_TEST_SUITE_END() // LookupFib
+// LookupFib is tested in Fw/TestLinkForwarding test suite.
 
 BOOST_AUTO_TEST_SUITE_END() // TestStrategy
 BOOST_AUTO_TEST_SUITE_END() // Fw
diff --git a/tests/daemon/fw/topology-tester.cpp b/tests/daemon/fw/topology-tester.cpp
index 5742592..ad68447 100644
--- a/tests/daemon/fw/topology-tester.cpp
+++ b/tests/daemon/fw/topology-tester.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2016,  Regents of the University of California,
+ * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -114,6 +114,37 @@
   m_clientTransport->connectToForwarder(m_forwarderTransport);
 }
 
+class TopologyPcapLinkService : public GenericLinkService
+                              , public TopologyPcap
+{
+private:
+  ///\todo #3941 call GenericLinkServiceCounters constructor in TopologyPcapLinkService constructor
+
+  void
+  doSendInterest(const Interest& interest) override
+  {
+    this->sentInterests.push_back(interest);
+    this->sentInterests.back().setTag(std::make_shared<TopologyPcapTimestamp>(time::steady_clock::now()));
+    this->GenericLinkService::doSendInterest(interest);
+  }
+
+  void
+  doSendData(const Data& data) override
+  {
+    this->sentData.push_back(data);
+    this->sentData.back().setTag(std::make_shared<TopologyPcapTimestamp>(time::steady_clock::now()));
+    this->GenericLinkService::doSendData(data);
+  }
+
+  void
+  doSendNack(const lp::Nack& nack) override
+  {
+    this->sentNacks.push_back(nack);
+    this->sentNacks.back().setTag(std::make_shared<TopologyPcapTimestamp>(time::steady_clock::now()));
+    this->GenericLinkService::doSendNack(nack);
+  }
+};
+
 TopologyNode
 TopologyTester::addForwarder(const std::string& label)
 {
@@ -139,7 +170,8 @@
     Forwarder& forwarder = this->getForwarder(i);
     FaceUri localUri("topology://" + m_forwarderLabels.at(i) + "/" + label);
 
-    auto service = make_unique<GenericLinkService>();
+    unique_ptr<GenericLinkService> service = m_wantPcap ? make_unique<TopologyPcapLinkService>() :
+                                                          make_unique<GenericLinkService>();
     auto transport = make_unique<InternalForwarderTransport>(localUri, remoteUri,
                      ndn::nfd::FACE_SCOPE_NON_LOCAL, linkType);
     auto face = make_shared<Face>(std::move(service), std::move(transport));
@@ -159,7 +191,8 @@
   FaceUri localUri("topology://" + m_forwarderLabels.at(i) + "/local/" + label);
   FaceUri remoteUri("topology://" + m_forwarderLabels.at(i) + "/app/" + label);
 
-  auto service = make_unique<GenericLinkService>();
+  unique_ptr<GenericLinkService> service = m_wantPcap ? make_unique<TopologyPcapLinkService>() :
+                                                        make_unique<GenericLinkService>();
   auto transport = make_unique<InternalForwarderTransport>(localUri, remoteUri,
                    ndn::nfd::FACE_SCOPE_LOCAL, ndn::nfd::LINK_TYPE_POINT_TO_POINT);
   auto face = make_shared<Face>(std::move(service), std::move(transport));
@@ -180,6 +213,18 @@
 }
 
 void
+TopologyTester::enablePcap(bool isEnabled)
+{
+  m_wantPcap = isEnabled;
+}
+
+TopologyPcap&
+TopologyTester::getPcap(const Face& face)
+{
+  return dynamic_cast<TopologyPcapLinkService&>(*face.getLinkService());
+}
+
+void
 TopologyTester::registerPrefix(TopologyNode i, const Face& face, const Name& prefix, uint64_t cost)
 {
   Forwarder& forwarder = this->getForwarder(i);
diff --git a/tests/daemon/fw/topology-tester.hpp b/tests/daemon/fw/topology-tester.hpp
index ec122b6..9f97413 100644
--- a/tests/daemon/fw/topology-tester.hpp
+++ b/tests/daemon/fw/topology-tester.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2016,  Regents of the University of California,
+ * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -157,6 +157,20 @@
   shared_ptr<ndn::Face> m_client;
 };
 
+/** \brief captured packets on a face
+ */
+class TopologyPcap : noncopyable
+{
+public:
+  std::vector<Interest> sentInterests;
+  std::vector<Data> sentData;
+  std::vector<lp::Nack> sentNacks;
+};
+
+/** \brief captured packet timestamp tag
+ */
+using TopologyPcapTimestamp = ndn::SimpleTag<time::steady_clock::TimePoint, 0>;
+
 /** \brief builds a topology for forwarding tests
  */
 class TopologyTester : noncopyable
@@ -209,6 +223,17 @@
   shared_ptr<TopologyAppLink>
   addAppFace(const std::string& label, TopologyNode i, const Name& prefix, uint64_t cost = 0);
 
+  /** \brief enables packet capture on every forwarder face
+   */
+  void
+  enablePcap(bool isEnabled = true);
+
+  /** \return captured packets on a forwarder face
+   *  \pre enablePcap(true) is in effect when the face was created
+   */
+  TopologyPcap&
+  getPcap(const Face& face);
+
   /** \brief registers a prefix on a forwarder face
    */
   void
@@ -227,6 +252,7 @@
                       const time::nanoseconds& interval, size_t n);
 
 private:
+  bool m_wantPcap = false;
   std::vector<unique_ptr<Forwarder>> m_forwarders;
   std::vector<std::string> m_forwarderLabels;
   std::vector<shared_ptr<TopologyLink>> m_links;
