apps: Change to new HopCount tag that is carried in NDNLPv2 header between nodes

Change-Id: I3d16bcf29f4858049d1040a3e422e1a7131b3ba2
Refs: #3881
diff --git a/apps/ndn-consumer-zipf-mandelbrot.cpp b/apps/ndn-consumer-zipf-mandelbrot.cpp
index c6358c0..8fd1591 100644
--- a/apps/ndn-consumer-zipf-mandelbrot.cpp
+++ b/apps/ndn-consumer-zipf-mandelbrot.cpp
@@ -21,8 +21,6 @@
 
 #include "ndn-consumer-zipf-mandelbrot.hpp"
 
-#include "utils/ndn-fw-hop-count-tag.hpp"
-
 #include <math.h>
 
 NS_LOG_COMPONENT_DEFINE("ndn.ConsumerZipfMandelbrot");
diff --git a/apps/ndn-consumer.cpp b/apps/ndn-consumer.cpp
index 3ed9355..a174fb3 100644
--- a/apps/ndn-consumer.cpp
+++ b/apps/ndn-consumer.cpp
@@ -32,6 +32,8 @@
 #include "utils/ndn-ns3-packet-tag.hpp"
 #include "utils/ndn-rtt-mean-deviation.hpp"
 
+#include <ndn-cxx/lp/tags.hpp>
+
 #include <boost/lexical_cast.hpp>
 #include <boost/ref.hpp>
 
@@ -223,14 +225,11 @@
   NS_LOG_INFO("< DATA for " << seq);
 
   int hopCount = 0;
-  auto ns3PacketTag = data->getTag<Ns3PacketTag>();
-  if (ns3PacketTag != nullptr) { // e.g., packet came from local node's cache
-    FwHopCountTag hopCountTag;
-    if (ns3PacketTag->getPacket()->PeekPacketTag(hopCountTag)) {
-      hopCount = hopCountTag.Get();
-      NS_LOG_DEBUG("Hop count: " << hopCount);
-    }
+  auto hopCountTag = data->getTag<lp::HopCountTag>();
+  if (hopCountTag != nullptr) { // e.g., packet came from local node's cache
+    hopCount = *hopCountTag;
   }
+  NS_LOG_DEBUG("Hop count: " << hopCount);
 
   SeqTimeoutsContainer::iterator entry = m_seqLastDelay.find(seq);
   if (entry != m_seqLastDelay.end()) {
diff --git a/apps/ndn-consumer.hpp b/apps/ndn-consumer.hpp
index 872c46a..829c6ed 100644
--- a/apps/ndn-consumer.hpp
+++ b/apps/ndn-consumer.hpp
@@ -30,7 +30,6 @@
 
 #include "ns3/ndnSIM/model/ndn-common.hpp"
 #include "ns3/ndnSIM/utils/ndn-rtt-estimator.hpp"
-#include "ns3/ndnSIM/utils/ndn-fw-hop-count-tag.hpp"
 
 #include <set>
 #include <map>
diff --git a/tests/unit-tests/utils/tracers/ndn-app-delay-tracer.t.cpp b/tests/unit-tests/utils/tracers/ndn-app-delay-tracer.t.cpp
index c5e5f13..66e90a6 100644
--- a/tests/unit-tests/utils/tracers/ndn-app-delay-tracer.t.cpp
+++ b/tests/unit-tests/utils/tracers/ndn-app-delay-tracer.t.cpp
@@ -74,7 +74,6 @@
 
 BOOST_FIXTURE_TEST_SUITE(UtilsTracersNdnAppDelayTracer, AppDelayTracerFixture)
 
-BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(InstallAll, 1);
 BOOST_AUTO_TEST_CASE(InstallAll)
 {
   AppDelayTracer::InstallAll(TEST_TRACE.string());
@@ -90,15 +89,14 @@
 
   BOOST_CHECK_EQUAL(buffer.str(),
     "Time	Node	AppId	SeqNo	Type	DelayS	DelayUS	RetxCount	HopCount\n"
-    "0.0417424	1	0	0	LastDelay	0.0417424	41742.4	1	2\n"
-    "0.0417424	1	0	0	FullDelay	0.0417424	41742.4	1	2\n"
+    "0.0417712	1	0	0	LastDelay	0.0417712	41771.2	1	2\n"
+    "0.0417712	1	0	0	FullDelay	0.0417712	41771.2	1	2\n"
     "2	2	0	0	LastDelay	0	0	1	0\n"
     "2	2	0	0	FullDelay	0	0	1	0\n"
-    "3.02087	2	0	1	LastDelay	0.0208712	20871.2	1	1\n"
-    "3.02087	2	0	1	FullDelay	0.0208712	20871.2	1	1\n");
+    "3.02089	2	0	1	LastDelay	0.0208856	20885.6	1	1\n"
+    "3.02089	2	0	1	FullDelay	0.0208856	20885.6	1	1\n");
 }
 
-BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(InstallNodeContainer, 1);
 BOOST_AUTO_TEST_CASE(InstallNodeContainer)
 {
   NodeContainer nodes;
@@ -117,11 +115,10 @@
 
   BOOST_CHECK_EQUAL(buffer.str(),
     "Time	Node	AppId	SeqNo	Type	DelayS	DelayUS	RetxCount	HopCount\n"
-    "0.0417424	1	0	0	LastDelay	0.0417424	41742.4	1	2\n"
-    "0.0417424	1	0	0	FullDelay	0.0417424	41742.4	1	2\n");
+    "0.0417712	1	0	0	LastDelay	0.0417712	41771.2	1	2\n"
+    "0.0417712	1	0	0	FullDelay	0.0417712	41771.2	1	2\n");
 }
 
-BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(InstallNode, 1);
 BOOST_AUTO_TEST_CASE(InstallNode)
 {
   AppDelayTracer::Install(getNode("2"), TEST_TRACE.string());
@@ -139,11 +136,10 @@
     "Time	Node	AppId	SeqNo	Type	DelayS	DelayUS	RetxCount	HopCount\n"
     "2	2	0	0	LastDelay	0	0	1	0\n"
     "2	2	0	0	FullDelay	0	0	1	0\n"
-    "3.02087	2	0	1	LastDelay	0.0208712	20871.2	1	1\n"
-    "3.02087	2	0	1	FullDelay	0.0208712	20871.2	1	1\n");
+    "3.02089	2	0	1	LastDelay	0.0208856	20885.6	1	1\n"
+    "3.02089	2	0	1	FullDelay	0.0208856	20885.6	1	1\n");
 }
 
-BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(InstallNodeDumpStream, 1);
 BOOST_AUTO_TEST_CASE(InstallNodeDumpStream)
 {
   auto output = make_shared<boost::test_tools::output_test_stream>();
@@ -157,8 +153,8 @@
   BOOST_CHECK(output->is_equal(
     "2	2	0	0	LastDelay	0	0	1	0\n"
     "2	2	0	0	FullDelay	0	0	1	0\n"
-    "3.02087	2	0	1	LastDelay	0.0208712	20871.2	1	1\n"
-    "3.02087	2	0	1	FullDelay	0.0208712	20871.2	1	1\n"));
+    "3.02089	2	0	1	LastDelay	0.0208856	20885.6	1	1\n"
+    "3.02089	2	0	1	FullDelay	0.0208856	20885.6	1	1\n"));
 }
 
 BOOST_AUTO_TEST_SUITE_END()
diff --git a/utils/ndn-fw-hop-count-tag.cpp b/utils/ndn-fw-hop-count-tag.cpp
deleted file mode 100644
index cfa2126..0000000
--- a/utils/ndn-fw-hop-count-tag.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2011-2015  Regents of the University of California.
- *
- * This file is part of ndnSIM. See AUTHORS for complete list of ndnSIM authors and
- * contributors.
- *
- * ndnSIM 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.
- *
- * ndnSIM 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
- * ndnSIM, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- **/
-
-#include "ndn-fw-hop-count-tag.hpp"
-
-namespace ns3 {
-namespace ndn {
-
-TypeId
-FwHopCountTag::GetTypeId()
-{
-  static TypeId tid =
-    TypeId("ns3::ndn::FwHopCountTag").SetParent<Tag>().AddConstructor<FwHopCountTag>();
-  return tid;
-}
-
-TypeId
-FwHopCountTag::GetInstanceTypeId() const
-{
-  return FwHopCountTag::GetTypeId();
-}
-
-uint32_t
-FwHopCountTag::GetSerializedSize() const
-{
-  return sizeof(uint32_t);
-}
-
-void
-FwHopCountTag::Serialize(TagBuffer i) const
-{
-  i.WriteU32(m_hopCount);
-}
-
-void
-FwHopCountTag::Deserialize(TagBuffer i)
-{
-  m_hopCount = i.ReadU32();
-}
-
-void
-FwHopCountTag::Print(std::ostream& os) const
-{
-  os << m_hopCount;
-}
-
-} // namespace ndn
-} // namespace ns3
diff --git a/utils/ndn-fw-hop-count-tag.hpp b/utils/ndn-fw-hop-count-tag.hpp
deleted file mode 100644
index efbbdd0..0000000
--- a/utils/ndn-fw-hop-count-tag.hpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2011-2015  Regents of the University of California.
- *
- * This file is part of ndnSIM. See AUTHORS for complete list of ndnSIM authors and
- * contributors.
- *
- * ndnSIM 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.
- *
- * ndnSIM 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
- * ndnSIM, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- **/
-
-#ifndef NDN_FW_HOP_COUNT_TAG_H
-#define NDN_FW_HOP_COUNT_TAG_H
-
-#include "ns3/tag.h"
-
-namespace ns3 {
-namespace ndn {
-
-/**
- * @ingroup ndn-fw
- * @brief Packet tag that is used to track hop count for Interest-Data pairs
- */
-class FwHopCountTag : public Tag {
-public:
-  static TypeId
-  GetTypeId(void);
-
-  /**
-   * @brief Default constructor
-   */
-  FwHopCountTag()
-    : m_hopCount(0){};
-
-  /**
-   * @brief Destructor
-   */
-  ~FwHopCountTag()
-  {
-  }
-
-  /**
-   * @brief Increment hop count
-   */
-  void
-  Increment()
-  {
-    m_hopCount++;
-  }
-
-  /**
-   * @brief Get value of hop count
-   */
-  uint32_t
-  Get() const
-  {
-    return m_hopCount;
-  }
-
-  ////////////////////////////////////////////////////////
-  // from ObjectBase
-  ////////////////////////////////////////////////////////
-  virtual TypeId
-  GetInstanceTypeId() const;
-
-  ////////////////////////////////////////////////////////
-  // from Tag
-  ////////////////////////////////////////////////////////
-
-  virtual uint32_t
-  GetSerializedSize() const;
-
-  virtual void
-  Serialize(TagBuffer i) const;
-
-  virtual void
-  Deserialize(TagBuffer i);
-
-  virtual void
-  Print(std::ostream& os) const;
-
-private:
-  uint32_t m_hopCount;
-};
-
-} // namespace ndn
-} // namespace ns3
-
-#endif // NDN_FW_HOP_COUNT_TAG_H