meta-info: deprecate MetaInfo::TYPE_* constants

The following items are deprecated:

* tlv::ContentType_Default
* MetaInfo::TYPE_DEFAULT
* MetaInfo::TYPE_BLOB
* MetaInfo::TYPE_LINK
* MetaInfo::TYPE_KEY
* MetaInfo::TYPE_NACK

refs #2128

Change-Id: I01f0aa0dd27d32a18a9fff79401b5784d9ddcb10
diff --git a/src/encoding/tlv.hpp b/src/encoding/tlv.hpp
index 284ca26..6a7589e 100644
--- a/src/encoding/tlv.hpp
+++ b/src/encoding/tlv.hpp
@@ -95,12 +95,32 @@
   SignatureSha256WithEcdsa = 3
 };
 
+/** @brief indicates a possible value of ContentType field
+ */
 enum ContentTypeValue {
-  ContentType_Default = 0,
+  /** @brief indicates content is the actual data bits
+   */
+  ContentType_Blob = 0,
+
+  /** @brief indicates content is another name which identifies actual data content
+   */
   ContentType_Link = 1,
-  ContentType_Key = 2
+
+  /** @brief indicates content is a public key
+   */
+  ContentType_Key = 2,
+
+  /** @brief indicates a producer generated NACK
+   *  @warning Experimental. Not defined in NDN-TLV spec.
+   */
+  ContentType_Nack = 3
 };
 
+/** @deprecated use ContentType_Blob
+ */
+static const uint32_t DEPRECATED(ContentType_Default) = ContentType_Blob;
+
+
 /**
  * @brief Read VAR-NUMBER in NDN-TLV encoding
  *
diff --git a/src/meta-info.cpp b/src/meta-info.cpp
index 3db4cb3..a4f9938 100644
--- a/src/meta-info.cpp
+++ b/src/meta-info.cpp
@@ -33,7 +33,7 @@
               "MetaInfo::Error must inherit from tlv::Error");
 
 MetaInfo::MetaInfo()
-  : m_type(TYPE_DEFAULT)
+  : m_type(tlv::ContentType_Blob)
   , m_freshnessPeriod(-1)
 {
 }
@@ -154,7 +154,7 @@
     }
 
   // ContentType
-  if (m_type != TYPE_DEFAULT)
+  if (m_type != tlv::ContentType_Blob)
     {
       totalLength += prependNonNegativeIntegerBlock(blk, tlv::ContentType, m_type);
     }
@@ -207,7 +207,7 @@
     ++val;
   }
   else {
-    m_type = TYPE_DEFAULT;
+    m_type = tlv::ContentType_Blob;
   }
 
   // FreshnessPeriod
diff --git a/src/meta-info.hpp b/src/meta-info.hpp
index aece256..520a0c8 100644
--- a/src/meta-info.hpp
+++ b/src/meta-info.hpp
@@ -66,29 +66,6 @@
     }
   };
 
-  /** \brief ContentType codes
-   */
-  enum {
-    /** @brief indicates content is the actual data bits
-     */
-    TYPE_BLOB = 0,
-
-    /** @brief indicates content is another name which identifies actual data content
-     */
-    TYPE_LINK = 1,
-
-    /** @brief indicates content is a public key
-     */
-    TYPE_KEY = 2,
-
-    /** @brief indicates a producer generated NACK
-     *  @warning Experimental. Not defined in NDN-TLV spec.
-     */
-    TYPE_NACK = 3,
-
-    TYPE_DEFAULT = TYPE_BLOB
-  };
-
   MetaInfo();
 
   /**
@@ -107,12 +84,13 @@
   void
   wireDecode(const Block& wire);
 
-  ///////////////////////////////////////////////////////////////////////////////
-  // Getters/setters
-
+public: // getter/setter
   uint32_t
   getType() const;
 
+  /** @brief set ContentType
+   *  @param type a code defined in tlv::ContentTypeValue
+   */
   MetaInfo&
   setType(uint32_t type);
 
@@ -128,6 +106,7 @@
   MetaInfo&
   setFinalBlockId(const name::Component& finalBlockId);
 
+public: // app-defined MetaInfo items
   /**
    * @brief Get all app-defined MetaInfo items
    *
@@ -205,6 +184,27 @@
   bool
   operator!=(const MetaInfo& other) const;
 
+public: // deprecated
+  /** @deprecated use tlv::ContentType_Blob
+   */
+  static const uint32_t DEPRECATED(TYPE_BLOB) = tlv::ContentType_Blob;
+
+  /** @deprecated use tlv::ContentType_Link
+   */
+  static const uint32_t DEPRECATED(TYPE_LINK) = tlv::ContentType_Link;
+
+  /** @deprecated use tlv::ContentType_Key
+   */
+  static const uint32_t DEPRECATED(TYPE_KEY) = tlv::ContentType_Key;
+
+  /** @deprecated use tlv::ContentType_Nack
+   */
+  static const uint32_t DEPRECATED(TYPE_NACK) = tlv::ContentType_Nack;
+
+  /** @deprecated use tlv::ContentType_Default
+   */
+  static const uint32_t DEPRECATED(TYPE_DEFAULT) = tlv::ContentType_Blob;
+
 private:
   uint32_t m_type;
   time::milliseconds m_freshnessPeriod;
diff --git a/src/security/certificate.cpp b/src/security/certificate.cpp
index 7173d52..59afa4f 100644
--- a/src/security/certificate.cpp
+++ b/src/security/certificate.cpp
@@ -169,7 +169,7 @@
   idCert.MessageEnd();
 
   setContent(os.buf());
-  setContentType(MetaInfo::TYPE_KEY);
+  setContentType(tlv::ContentType_Key);
 }
 
 void
diff --git a/tests/unit-tests/test-data.cpp b/tests/unit-tests/test-data.cpp
index c4a9263..2493b89 100644
--- a/tests/unit-tests/test-data.cpp
+++ b/tests/unit-tests/test-data.cpp
@@ -224,7 +224,7 @@
   BOOST_REQUIRE_NO_THROW(d.wireDecode(dataBlock));
 
   BOOST_REQUIRE_EQUAL(d.getName().toUri(), "/local/ndn/prefix");
-  BOOST_REQUIRE_EQUAL(d.getContentType(), static_cast<uint32_t>(MetaInfo::TYPE_DEFAULT));
+  BOOST_REQUIRE_EQUAL(d.getContentType(), static_cast<uint32_t>(tlv::ContentType_Blob));
   BOOST_REQUIRE_EQUAL(d.getFreshnessPeriod(), time::seconds(10));
 
   BOOST_REQUIRE_EQUAL(std::string(reinterpret_cast<const char*>(d.getContent().value()),
@@ -253,7 +253,7 @@
   // manual data packet creation for now
 
   ndn::Data d(ndn::Name("/local/ndn/prefix"));
-  d.setContentType(MetaInfo::TYPE_DEFAULT);
+  d.setContentType(tlv::ContentType_Blob);
   d.setFreshnessPeriod(time::seconds(10));
 
   d.setContent(Content1, sizeof(Content1));
@@ -343,7 +343,7 @@
   // Encoding pipeline
 
   ndn::Data d(ndn::Name("/local/ndn/prefix"));
-  d.setContentType(MetaInfo::TYPE_DEFAULT);
+  d.setContentType(tlv::ContentType_Blob);
   d.setFreshnessPeriod(time::seconds(10));
 
   d.setContent(Content1, sizeof(Content1));
diff --git a/tests/unit-tests/test-meta-info.cpp b/tests/unit-tests/test-meta-info.cpp
index 6ffc5c5..fe25005 100644
--- a/tests/unit-tests/test-meta-info.cpp
+++ b/tests/unit-tests/test-meta-info.cpp
@@ -43,7 +43,7 @@
 BOOST_AUTO_TEST_CASE(Encode)
 {
   MetaInfo meta;
-  meta.setType(MetaInfo::TYPE_DEFAULT);
+  meta.setType(tlv::ContentType_Blob);
   meta.setFreshnessPeriod(time::seconds(10));
 
   BOOST_REQUIRE_NO_THROW(meta.wireEncode());
@@ -55,7 +55,7 @@
   BOOST_REQUIRE_EQUAL_COLLECTIONS(MetaInfo2, MetaInfo2+sizeof(MetaInfo2),
                                   meta.wireEncode().begin(), meta.wireEncode().end());
 
-  meta.setType(MetaInfo::TYPE_LINK);
+  meta.setType(tlv::ContentType_Link);
   BOOST_REQUIRE_NO_THROW(meta.wireEncode());
   BOOST_REQUIRE_EQUAL_COLLECTIONS(MetaInfo3, MetaInfo3+sizeof(MetaInfo3),
                                   meta.wireEncode().begin(), meta.wireEncode().end());
@@ -64,17 +64,17 @@
 BOOST_AUTO_TEST_CASE(Decode)
 {
   MetaInfo meta(Block(MetaInfo1, sizeof(MetaInfo1)));
-  BOOST_CHECK_EQUAL(meta.getType(), static_cast<uint32_t>(MetaInfo::TYPE_DEFAULT));
+  BOOST_CHECK_EQUAL(meta.getType(), static_cast<uint32_t>(tlv::ContentType_Blob));
   BOOST_CHECK_EQUAL(meta.getFreshnessPeriod(), time::seconds(10));
   BOOST_CHECK_EQUAL(meta.getFinalBlockId(), name::Component());
 
   meta.wireDecode(Block(MetaInfo2, sizeof(MetaInfo2)));
-  BOOST_CHECK_EQUAL(meta.getType(), static_cast<uint32_t>(MetaInfo::TYPE_DEFAULT));
+  BOOST_CHECK_EQUAL(meta.getType(), static_cast<uint32_t>(tlv::ContentType_Blob));
   BOOST_CHECK_EQUAL(meta.getFreshnessPeriod(), time::seconds(10));
   BOOST_CHECK_EQUAL(meta.getFinalBlockId(), name::Component("hello,world!"));
 
   meta.wireDecode(Block(MetaInfo3, sizeof(MetaInfo3)));
-  BOOST_CHECK_EQUAL(meta.getType(), static_cast<uint32_t>(MetaInfo::TYPE_LINK));
+  BOOST_CHECK_EQUAL(meta.getType(), static_cast<uint32_t>(tlv::ContentType_Link));
   BOOST_CHECK_EQUAL(meta.getFreshnessPeriod(), time::seconds(10));
   BOOST_CHECK_EQUAL(meta.getFinalBlockId(), name::Component("hello,world!"));
 }