tlv, name: add missing FaceEventKind TLV, deprecate Name::appendVersion/Segment

Change-Id: Ieaa1a16d9b49a908e1ba3c1d8cabf490b1f3725b
diff --git a/src/common.hpp b/src/common.hpp
index 281da0b..457ac23 100644
--- a/src/common.hpp
+++ b/src/common.hpp
@@ -36,6 +36,15 @@
 #include <boost/iostreams/categories.hpp>
 #include <boost/iostreams/stream.hpp>
 
+#if defined(__GNUC__) || defined(__clang__)
+#define DEPRECATED(func) func __attribute__ ((deprecated))
+#elif defined(_MSC_VER)
+#define DEPRECATED(func) __declspec(deprecated) func
+#else
+#pragma message("DEPRECATED not implemented")
+#define DEPRECATED(func) func
+#endif
+
 #if NDN_CPP_HAVE_CXX11
 
 #if (__cplusplus < 201103L)
diff --git a/src/encoding/tlv-nfd.hpp b/src/encoding/tlv-nfd.hpp
index aa4ed02..ec1b60a 100644
--- a/src/encoding/tlv-nfd.hpp
+++ b/src/encoding/tlv-nfd.hpp
@@ -37,6 +37,7 @@
   TotalOutgoingInterestCounter = 146,
   TotalOutgoingDataCounter     = 147,
   FaceEvent                    = 192,
+  FaceEventKind                = 193,
 
 };
 
diff --git a/src/name.hpp b/src/name.hpp
index 6d7582f..523b200 100644
--- a/src/name.hpp
+++ b/src/name.hpp
@@ -255,39 +255,55 @@
   toUri() const;
   
   /**
+   * @deprecated
    * Append a component with the encoded segment number.
    * @param segment The segment number.
    * @return This name so that you can chain calls to append.
    */  
-  Name& 
+  DEPRECATED(Name& 
   appendSegment(uint64_t segment)
   {
     m_nameBlock.push_back(Component::fromNumberWithMarker(segment, 0x00));
     return *this;
-  }
+  })
 
   /**
+   * @deprecated
    * Append a component with the encoded version number.
    * Note that this encodes the exact value of version without converting from a time representation.
    * @param version The version number.
    * @return This name so that you can chain calls to append.
    */  
-  Name& 
+  DEPRECATED(Name& 
   appendVersion(uint64_t version)
   {
     m_nameBlock.push_back(Component::fromNumberWithMarker(version, 0xFD));
     return *this;
-  }
+  })
 
   /**
+   * @deprecated
    * @brief Append a component with the encoded version number.
    * 
    * This version of the method creates version number based on the current timestamp
    * @return This name so that you can chain calls to append.
    */  
-  Name& 
-  appendVersion();
-  
+  DEPRECATED(Name& 
+             appendVersion());
+
+
+  /**
+   * @brief Append a component with the encoded non-negative number.
+   * @param number The non-negative number
+   * @return This name so that you can chain calls to append.
+   */
+  Name&
+  appendNumber(uint64_t number)
+  {
+    m_nameBlock.push_back(Component::fromNumber(number));
+    return *this;
+  }
+
   /**
    * Check if this name has the same component count and components as the given name.
    * @param name The Name to check.
diff --git a/tests/test-name.cpp b/tests/test-name.cpp
index b80e37e..32e3a10 100644
--- a/tests/test-name.cpp
+++ b/tests/test-name.cpp
@@ -1,3 +1,4 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
  * Copyright (C) 2013 Regents of the University of California.
  * See COPYING for copyright and distribution information.
@@ -96,6 +97,22 @@
                                 TestName, TestName+sizeof(TestName));
 }
 
+BOOST_AUTO_TEST_CASE(AppendNumber)
+{
+  Name name;
+  for (int i = 0; i < 10; i++)
+    {
+      name.appendNumber(i);
+    }
+
+  BOOST_CHECK_EQUAL(name.size(), 10);
+
+  for (int i = 0; i < 10; i++)
+    {
+      BOOST_CHECK_EQUAL(name[i].toNumber(), i);
+    }
+}
+
 BOOST_AUTO_TEST_SUITE_END()
 
 } // namespace ndn