[ndnSIM] lp, face: Adding HopCount as an lp packet tag and properly decoding lp::HopCountTagField into tag

Change-Id: I2c25bcf29f3928049d1040a3e421e1c7151b3ba2
diff --git a/src/face.cpp b/src/face.cpp
index 57b22fa..aaf8b63 100644
--- a/src/face.cpp
+++ b/src/face.cpp
@@ -305,6 +305,10 @@
 {
   addTagFromField<lp::IncomingFaceIdTag, lp::IncomingFaceIdField>(netPacket, lpPacket);
   addTagFromField<lp::CongestionMarkTag, lp::CongestionMarkField>(netPacket, lpPacket);
+
+  if (lpPacket.has<lp::HopCountTagField>()) {
+    netPacket.setTag(make_shared<lp::HopCountTag>(lpPacket.get<lp::HopCountTagField>() + 1));
+  }
 }
 
 void
diff --git a/src/lp/fields.hpp b/src/lp/fields.hpp
index ce3a834..bd3c7cb 100644
--- a/src/lp/fields.hpp
+++ b/src/lp/fields.hpp
@@ -94,6 +94,12 @@
                   PrefixAnnouncement,
                   tlv::PrefixAnnouncement> PrefixAnnouncementField;
 BOOST_CONCEPT_ASSERT((Field<PrefixAnnouncementField>));
+
+typedef FieldDecl<field_location_tags::Header,
+                          uint64_t,
+                          tlv::HopCountTag> HopCountTagField;
+BOOST_CONCEPT_ASSERT((Field<HopCountTagField>));
+
 /**
  * The value of the wire encoded field is the data between the provided iterators. During
  * encoding, the data is copied from the Buffer into the wire buffer.
@@ -119,7 +125,8 @@
   AckField,
   TxSequenceField,
   NonDiscoveryField,
-  PrefixAnnouncementField
+  PrefixAnnouncementField,
+  HopCountTagField
   > FieldSet;
 
 } // namespace lp
diff --git a/src/lp/tags.hpp b/src/lp/tags.hpp
index 91400e2..aa0da14 100644
--- a/src/lp/tags.hpp
+++ b/src/lp/tags.hpp
@@ -72,6 +72,13 @@
  */
 typedef SimpleTag<PrefixAnnouncement, 15> PrefixAnnouncementTag;
 
+/** \class HopCountTag
+ *  \brief a packet tag for HopCount field
+ *
+ * This tag can be attached to Interest, Data, Nack.
+ */
+typedef SimpleTag<uint64_t, 0x60000000> HopCountTag;
+
 } // namespace lp
 } // namespace ndn
 
diff --git a/src/lp/tlv.hpp b/src/lp/tlv.hpp
index 1b409ca..bb88967 100644
--- a/src/lp/tlv.hpp
+++ b/src/lp/tlv.hpp
@@ -35,6 +35,7 @@
   Sequence = 81,
   FragIndex = 82,
   FragCount = 83,
+  HopCountTag = 84,
   Nack = 800,
   NackReason = 801,
   NextHopFaceId = 816,