encoding: remove obsolete TLV-TYPE definitions

Also, consolidate all types in a single enum

Change-Id: I55c9d10de21183e17590bd2f73b51ae8b7c84304
diff --git a/ndn-cxx/encoding/encoder.hpp b/ndn-cxx/encoding/encoder.hpp
index d5f6965..8415156 100644
--- a/ndn-cxx/encoding/encoder.hpp
+++ b/ndn-cxx/encoding/encoder.hpp
@@ -65,28 +65,28 @@
 
   /**
    * @brief Prepend @p number encoded as a VAR-NUMBER in NDN-TLV format
-   * @sa https://named-data.net/doc/NDN-packet-spec/current/tlv.html
+   * @sa https://named-data.net/doc/NDN-packet-spec/0.3/tlv.html
    */
   size_t
   prependVarNumber(uint64_t number);
 
   /**
    * @brief Append @p number encoded as a VAR-NUMBER in NDN-TLV format
-   * @sa https://named-data.net/doc/NDN-packet-spec/current/tlv.html
+   * @sa https://named-data.net/doc/NDN-packet-spec/0.3/tlv.html
    */
   size_t
   appendVarNumber(uint64_t number);
 
   /**
    * @brief Prepend @p integer encoded as a NonNegativeInteger in NDN-TLV format
-   * @sa https://named-data.net/doc/NDN-packet-spec/current/tlv.html
+   * @sa https://named-data.net/doc/NDN-packet-spec/0.3/tlv.html
    */
   size_t
   prependNonNegativeInteger(uint64_t integer);
 
   /**
    * @brief Append @p integer encoded as a NonNegativeInteger in NDN-TLV format
-   * @sa https://named-data.net/doc/NDN-packet-spec/current/tlv.html
+   * @sa https://named-data.net/doc/NDN-packet-spec/0.3/tlv.html
    */
   size_t
   appendNonNegativeInteger(uint64_t integer);
diff --git a/ndn-cxx/encoding/tlv.hpp b/ndn-cxx/encoding/tlv.hpp
index b8bae95..7ff7895 100644
--- a/ndn-cxx/encoding/tlv.hpp
+++ b/ndn-cxx/encoding/tlv.hpp
@@ -61,15 +61,24 @@
 /**
  * @brief TLV-TYPE numbers defined in NDN Packet Format v0.3.
  * @sa https://named-data.net/doc/NDN-packet-spec/0.3/types.html
+ * @sa https://redmine.named-data.net/projects/ndn-tlv/wiki/NameComponentType
  */
 enum : uint32_t {
   Invalid                         = 0,
   Interest                        = 5,
   Data                            = 6,
+
   Name                            = 7,
   GenericNameComponent            = 8,
   ImplicitSha256DigestComponent   = 1,
   ParametersSha256DigestComponent = 2,
+  KeywordNameComponent            = 32,
+  SegmentNameComponent            = 50,
+  ByteOffsetNameComponent         = 52,
+  VersionNameComponent            = 54,
+  TimestampNameComponent          = 56,
+  SequenceNumNameComponent        = 58,
+
   CanBePrefix                     = 33,
   MustBeFresh                     = 18,
   ForwardingHint                  = 30,
@@ -79,6 +88,7 @@
   ApplicationParameters           = 36,
   InterestSignatureInfo           = 44,
   InterestSignatureValue          = 46,
+
   MetaInfo                        = 20,
   Content                         = 21,
   SignatureInfo                   = 22,
@@ -86,14 +96,21 @@
   ContentType                     = 24,
   FreshnessPeriod                 = 25,
   FinalBlockId                    = 26,
+
   SignatureType                   = 27,
   KeyLocator                      = 28,
   KeyDigest                       = 29,
   SignatureNonce                  = 38,
   SignatureTime                   = 40,
   SignatureSeqNum                 = 42,
-  LinkDelegation                  = 31,
-  LinkPreference                  = 30,
+
+  ValidityPeriod                  = 253,
+  NotBefore                       = 254,
+  NotAfter                        = 255,
+  AdditionalDescription           = 258,
+  DescriptionEntry                = 512,
+  DescriptionKey                  = 513,
+  DescriptionValue                = 514,
 
   NameComponentMin = 1,
   NameComponentMax = 65535,
@@ -103,35 +120,8 @@
 };
 
 /**
- * @brief TLV-TYPE numbers defined in NDN Packet Format v0.2 but not in v0.3.
- * @sa https://named-data.net/doc/NDN-packet-spec/0.2.1/types.html
- */
-enum : uint32_t {
-  Selectors                 = 9,
-  MinSuffixComponents       = 13,
-  MaxSuffixComponents       = 14,
-  PublisherPublicKeyLocator = 15,
-  Exclude                   = 16,
-  ChildSelector             = 17,
-  Any                       = 19,
-};
-
-/**
- * @brief TLV-TYPE numbers for typed name components.
- * @sa https://redmine.named-data.net/projects/ndn-tlv/wiki/NameComponentType
- */
-enum : uint32_t {
-  KeywordNameComponent     = 32,
-  SegmentNameComponent     = 50,
-  ByteOffsetNameComponent  = 52,
-  VersionNameComponent     = 54,
-  TimestampNameComponent   = 56,
-  SequenceNumNameComponent = 58,
-};
-
-/**
  * @brief SignatureType values.
- * @sa https://named-data.net/doc/NDN-packet-spec/0.3/signature.html
+ * @sa https://named-data.net/doc/NDN-packet-spec/0.3/signature.html#signaturetype
  * @sa https://redmine.named-data.net/projects/ndn-tlv/wiki/SignatureType
  */
 enum SignatureTypeValue : uint16_t {
@@ -147,22 +137,8 @@
 operator<<(std::ostream& os, SignatureTypeValue st);
 
 /**
- * @brief TLV-TYPE numbers for SignatureInfo extensions.
- * @sa <a href="../specs/certificate.html">NDN Certificate Format</a>
- */
-enum : uint32_t {
-  ValidityPeriod = 253,
-  NotBefore = 254,
-  NotAfter = 255,
-
-  AdditionalDescription = 258,
-  DescriptionEntry = 512,
-  DescriptionKey = 513,
-  DescriptionValue = 514
-};
-
-/**
  * @brief ContentType values.
+ * @sa https://named-data.net/doc/NDN-packet-spec/0.3/data.html#contenttype
  * @sa https://redmine.named-data.net/projects/ndn-tlv/wiki/ContentType
  */
 enum ContentTypeValue : uint32_t {
diff --git a/ndn-cxx/interest.cpp b/ndn-cxx/interest.cpp
index 6034ff6..b6d8f3c 100644
--- a/ndn-cxx/interest.cpp
+++ b/ndn-cxx/interest.cpp
@@ -217,10 +217,11 @@
         if (lastElement >= 4) {
           NDN_THROW(Error("ForwardingHint element is out of order"));
         }
-        // ForwardingHint = FORWARDING-HINT-TYPE TLV-LENGTH 1*Name
-        // [previous format]
-        // ForwardingHint = FORWARDING-HINT-TYPE TLV-LENGTH 1*Delegation
-        // Delegation = DELEGATION-TYPE TLV-LENGTH Preference Name
+        // Current format:
+        //   ForwardingHint = FORWARDING-HINT-TYPE TLV-LENGTH 1*Name
+        // Previous format, partially supported for backward compatibility:
+        //   ForwardingHint = FORWARDING-HINT-TYPE TLV-LENGTH 1*Delegation
+        //   Delegation = DELEGATION-TYPE TLV-LENGTH Preference Name
         element->parse();
         for (const auto& del : element->elements()) {
           switch (del.type()) {
@@ -232,7 +233,8 @@
                 NDN_THROW_NESTED(Error("Invalid Name in ForwardingHint"));
               }
               break;
-            case tlv::LinkDelegation:
+            case 31: // Delegation
+              // old ForwardingHint format, try to parse the nested Name for compatibility
               try {
                 del.parse();
                 m_forwardingHint.emplace_back(del.get(tlv::Name));
diff --git a/ndn-cxx/meta-info.hpp b/ndn-cxx/meta-info.hpp
index 0003c35..39be414 100644
--- a/ndn-cxx/meta-info.hpp
+++ b/ndn-cxx/meta-info.hpp
@@ -45,7 +45,7 @@
  * packets (NFD and previous versions of ndn-cxx will gracefully accept such packets).
  *
  * The following definition of the MetaInfo element is assumed in this implementation (compared
- * to the NDN-TLV spec, the definition is extended to allow optional AppMetaInfo elements):
+ * to the NDN packet spec, the definition is extended to allow optional AppMetaInfo elements):
  *
  *     MetaInfo = META-INFO-TYPE TLV-LENGTH
  *                  [ContentType]
diff --git a/ndn-cxx/name-component.hpp b/ndn-cxx/name-component.hpp
index b83d8e9..103a55d 100644
--- a/ndn-cxx/name-component.hpp
+++ b/ndn-cxx/name-component.hpp
@@ -22,7 +22,6 @@
 #ifndef NDN_CXX_NAME_COMPONENT_HPP
 #define NDN_CXX_NAME_COMPONENT_HPP
 
-#include "ndn-cxx/detail/common.hpp"
 #include "ndn-cxx/encoding/block.hpp"
 #include "ndn-cxx/encoding/block-helpers.hpp"
 #include "ndn-cxx/util/time.hpp"
@@ -30,8 +29,9 @@
 namespace ndn {
 namespace name {
 
-/** @brief Format used for the URI representation of a name.
- *  @sa http://named-data.net/doc/NDN-packet-spec/current/name.html#ndn-uri-scheme
+/**
+ * @brief Format used for the URI representation of a name.
+ * @sa https://named-data.net/doc/NDN-packet-spec/0.3/name.html#ndn-uri-scheme
  */
 enum class UriFormat {
   /// Always use `<type-number>=<percent-encoded-value>` format
@@ -46,8 +46,9 @@
   DEFAULT = ENV_OR_ALTERNATE,
 };
 
-/** @brief Identify a style of NDN Naming Conventions.
- *  @sa https://named-data.net/publications/techreports/ndn-tr-22-3-ndn-memo-naming-conventions/
+/**
+ * @brief Identify a style of NDN Naming Conventions.
+ * @sa https://named-data.net/publications/techreports/ndn-tr-22-3-ndn-memo-naming-conventions/
  */
 enum class Convention {
   MARKER = 1 << 0, ///< Component markers (revision 1)
@@ -55,8 +56,9 @@
   EITHER = MARKER | TYPED,
 };
 
-/** @brief Name component markers defined in Naming Conventions revision 1 (obsolete).
- *  @sa https://named-data.net/publications/techreports/ndn-tr-22-ndn-memo-naming-conventions/
+/**
+ * @brief Name component markers defined in Naming Conventions revision 1 (obsolete).
+ * @sa https://named-data.net/publications/techreports/ndn-tr-22-ndn-memo-naming-conventions/
  */
 enum : uint8_t {
   SEGMENT_MARKER = 0x00,
@@ -279,15 +281,15 @@
   fromEscapedString(const std::string& input);
 
   /**
-   * @brief Write *this to the output stream, escaping characters according to the NDN URI format.
-   * @sa https://named-data.net/doc/NDN-packet-spec/current/name.html#ndn-uri-scheme
+   * @brief Write `*this` to the output stream, escaping characters according to the NDN URI format.
+   * @sa https://named-data.net/doc/NDN-packet-spec/0.3/name.html#ndn-uri-scheme
    */
   void
   toUri(std::ostream& os, UriFormat format = UriFormat::DEFAULT) const;
 
   /**
-   * @brief Convert *this by escaping characters according to the NDN URI format.
-   * @sa https://named-data.net/doc/NDN-packet-spec/current/name.html#ndn-uri-scheme
+   * @brief Convert `*this` by escaping characters according to the NDN URI format.
+   * @sa https://named-data.net/doc/NDN-packet-spec/0.3/name.html#ndn-uri-scheme
    */
   std::string
   toUri(UriFormat format = UriFormat::DEFAULT) const;
@@ -295,7 +297,7 @@
 public: // naming conventions
   /**
    * @brief Check if the component is a NonNegativeInteger
-   * @sa https://named-data.net/doc/NDN-packet-spec/current/tlv.html#non-negative-integer-encoding
+   * @sa https://named-data.net/doc/NDN-packet-spec/0.3/tlv.html#non-negative-integer-encoding
    */
   bool
   isNumber() const noexcept;
@@ -345,7 +347,7 @@
 
   /**
    * @brief Interpret this name component as a NonNegativeInteger
-   * @sa https://named-data.net/doc/NDN-packet-spec/current/tlv.html#non-negative-integer-encoding
+   * @sa https://named-data.net/doc/NDN-packet-spec/0.3/tlv.html#non-negative-integer-encoding
    * @return The decoded non-negative integer.
    */
   uint64_t
@@ -408,7 +410,7 @@
   /**
    * @brief Create a component encoded as NonNegativeInteger
    *
-   * @sa https://named-data.net/doc/NDN-packet-spec/current/tlv.html#non-negative-integer-encoding
+   * @sa https://named-data.net/doc/NDN-packet-spec/0.3/tlv.html#non-negative-integer-encoding
    *
    * @param number The non-negative number
    * @param type TLV-TYPE
@@ -564,7 +566,7 @@
    * @retval zero this equals other
    * @retval positive this comes after other in canonical ordering
    *
-   * @sa https://named-data.net/doc/NDN-packet-spec/current/name.html#canonical-order
+   * @sa https://named-data.net/doc/NDN-packet-spec/0.3/name.html#canonical-order
    */
   int
   compare(const Component& other) const;
diff --git a/ndn-cxx/security/validation-policy-config.hpp b/ndn-cxx/security/validation-policy-config.hpp
index 8008397..bc4b9f5 100644
--- a/ndn-cxx/security/validation-policy-config.hpp
+++ b/ndn-cxx/security/validation-policy-config.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -33,10 +33,11 @@
 /**
  * @brief A validator that can be set up via a configuration file.
  *
- * @note For command Interest validation, this policy must be combined with
- *       @p ValidationPolicyCommandInterest, in order to guard against replay attacks.
+ * @note For %Command %Interest validation, this policy must be combined with
+ *       ValidationPolicyCommandInterest, in order to guard against replay attacks.
  * @note This policy does not support inner policies (a sole policy or a terminal inner policy)
- * @sa https://named-data.net/doc/ndn-cxx/current/tutorials/security-validator-config.html
+ *
+ * @sa <a href="../tutorials/security-validator-config.html">Validator Configuration File Format</a>
  */
 class ValidationPolicyConfig : public ValidationPolicy
 {