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