tlv: introduce NullSignature signature type

Refs: #4900
Change-Id: Ib5ab76e1e7a4b0cbec09b945859fb30e9322dd6b
diff --git a/ndn-cxx/encoding/tlv.cpp b/ndn-cxx/encoding/tlv.cpp
index a9feab7..3f552c0 100644
--- a/ndn-cxx/encoding/tlv.cpp
+++ b/ndn-cxx/encoding/tlv.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2019 Regents of the University of California.
+ * Copyright (c) 2013-2020 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -41,6 +41,8 @@
       return os << "SignatureSha256WithEcdsa";
     case SignatureHmacWithSha256:
       return os << "SignatureHmacWithSha256";
+    case NullSignature:
+      return os << "NullSignature";
   }
   return os << "Unknown(" << static_cast<uint32_t>(st) << ')';
 }
@@ -65,7 +67,7 @@
       return os << "FLIC";
   }
 
-  if (ct >= 6 && ct <= 1023) {
+  if (ct <= 1023) {
     os << "Reserved(";
   }
   else if (ct >= 9000 && ct <= 9999) {
diff --git a/ndn-cxx/encoding/tlv.hpp b/ndn-cxx/encoding/tlv.hpp
index 63fb172..e1dffb2 100644
--- a/ndn-cxx/encoding/tlv.hpp
+++ b/ndn-cxx/encoding/tlv.hpp
@@ -126,12 +126,14 @@
 
 /** @brief SignatureType values
  *  @sa https://named-data.net/doc/NDN-packet-spec/current/signature.html
+ *  @sa https://redmine.named-data.net/projects/ndn-tlv/wiki/SignatureType
  */
 enum SignatureTypeValue : uint16_t {
   DigestSha256             = 0,
   SignatureSha256WithRsa   = 1,
   SignatureSha256WithEcdsa = 3,
   SignatureHmacWithSha256  = 4,
+  NullSignature            = 200,
 };
 
 std::ostream&
diff --git a/tests/make-interest-data.cpp b/tests/make-interest-data.cpp
index 9f5a790..b4f47a0 100644
--- a/tests/make-interest-data.cpp
+++ b/tests/make-interest-data.cpp
@@ -25,11 +25,14 @@
 namespace tests {
 
 shared_ptr<Interest>
-makeInterest(const Name& name, bool canBePrefix, time::milliseconds lifetime,
+makeInterest(const Name& name, bool canBePrefix, optional<time::milliseconds> lifetime,
              optional<Interest::Nonce> nonce)
 {
-  auto interest = std::make_shared<Interest>(name, lifetime);
+  auto interest = std::make_shared<Interest>(name);
   interest->setCanBePrefix(canBePrefix);
+  if (lifetime) {
+    interest->setInterestLifetime(*lifetime);
+  }
   interest->setNonce(nonce);
   return interest;
 }
@@ -44,7 +47,7 @@
 Data&
 signData(Data& data)
 {
-  data.setSignatureInfo(SignatureInfo(tlv::SignatureSha256WithRsa));
+  data.setSignatureInfo(SignatureInfo(tlv::NullSignature));
   data.setSignatureValue(std::make_shared<Buffer>());
   data.wireEncode();
   return data;
diff --git a/tests/make-interest-data.hpp b/tests/make-interest-data.hpp
index 2d12011..fd2b042 100644
--- a/tests/make-interest-data.hpp
+++ b/tests/make-interest-data.hpp
@@ -19,8 +19,8 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
 
-#ifndef NDN_TESTS_MAKE_INTEREST_DATA_HPP
-#define NDN_TESTS_MAKE_INTEREST_DATA_HPP
+#ifndef NDN_CXX_TESTS_MAKE_INTEREST_DATA_HPP
+#define NDN_CXX_TESTS_MAKE_INTEREST_DATA_HPP
 
 #include "ndn-cxx/data.hpp"
 #include "ndn-cxx/interest.hpp"
@@ -29,26 +29,30 @@
 namespace ndn {
 namespace tests {
 
-/** \brief create an Interest
+/**
+ * \brief Create an Interest
  */
 shared_ptr<Interest>
 makeInterest(const Name& name, bool canBePrefix = false,
-             time::milliseconds lifetime = DEFAULT_INTEREST_LIFETIME,
+             optional<time::milliseconds> lifetime = nullopt,
              optional<Interest::Nonce> nonce = nullopt);
 
-/** \brief create a Data with fake signature
- *  \note Data may be modified afterwards without losing the fake signature.
- *        If a real signature is desired, sign again with KeyChain.
+/**
+ * \brief Create a Data with a null (i.e., empty) signature
+ *
+ * If a real signature is desired, use IdentityManagementFixture and sign again with KeyChain.
  */
 shared_ptr<Data>
 makeData(const Name& name);
 
-/** \brief add a fake signature to Data
+/**
+ * \brief Add a null signature to \p data
  */
 Data&
 signData(Data& data);
 
-/** \brief add a fake signature to Data
+/**
+ * \brief Add a null signature to \p data
  */
 inline shared_ptr<Data>
 signData(shared_ptr<Data> data)
@@ -57,15 +61,17 @@
   return data;
 }
 
-/** \brief create a Nack
+/**
+ * \brief Create a Nack
  */
 lp::Nack
 makeNack(Interest interest, lp::NackReason reason);
 
-/** \brief replace a name component in a packet
- *  \param[inout] pkt the packet
- *  \param index the index of the name component to replace
- *  \param args arguments to name::Component constructor
+/**
+ * \brief Replace a name component in a packet
+ * \param[inout] pkt the packet
+ * \param index the index of the name component to replace
+ * \param args arguments to name::Component constructor
  */
 template<typename Packet, typename ...Args>
 void
@@ -79,4 +85,4 @@
 } // namespace tests
 } // namespace ndn
 
-#endif // NDN_TESTS_MAKE_INTEREST_DATA_HPP
+#endif // NDN_CXX_TESTS_MAKE_INTEREST_DATA_HPP
diff --git a/tests/unit/encoding/tlv.t.cpp b/tests/unit/encoding/tlv.t.cpp
index 478fd83..1acffa5 100644
--- a/tests/unit/encoding/tlv.t.cpp
+++ b/tests/unit/encoding/tlv.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2019 Regents of the University of California.
+ * Copyright (c) 2013-2020 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -569,7 +569,7 @@
 
 BOOST_AUTO_TEST_SUITE_END() // NonNegativeInteger
 
-BOOST_AUTO_TEST_SUITE(PrintHelpers)
+BOOST_AUTO_TEST_SUITE(OutputOperators)
 
 BOOST_AUTO_TEST_CASE(PrintSignatureTypeValue)
 {
@@ -579,7 +579,9 @@
   BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(SignatureSha256WithEcdsa), "SignatureSha256WithEcdsa");
   BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(SignatureHmacWithSha256), "SignatureHmacWithSha256");
   BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(static_cast<SignatureTypeValue>(5)), "Unknown(5)");
-  BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(static_cast<SignatureTypeValue>(200)), "Unknown(200)");
+  BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(static_cast<SignatureTypeValue>(199)), "Unknown(199)");
+  BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(NullSignature), "NullSignature");
+  BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(static_cast<SignatureTypeValue>(201)), "Unknown(201)");
 }
 
 BOOST_AUTO_TEST_CASE(PrintContentTypeValue)
@@ -601,7 +603,7 @@
   BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(static_cast<ContentTypeValue>(19910118)), "Unknown(19910118)");
 }
 
-BOOST_AUTO_TEST_SUITE_END() // PrintHelpers
+BOOST_AUTO_TEST_SUITE_END() // OutputOperators
 
 BOOST_AUTO_TEST_SUITE_END() // TestTlv
 BOOST_AUTO_TEST_SUITE_END() // Encoding
diff --git a/tests/unit/face.t.cpp b/tests/unit/face.t.cpp
index ef1cab3..b368667 100644
--- a/tests/unit/face.t.cpp
+++ b/tests/unit/face.t.cpp
@@ -426,14 +426,14 @@
 
   BOOST_CHECK_EQUAL(face.sentNacks.size(), 0);
 
-  face.put(makeNack(*makeInterest("/unsolicited", false, DEFAULT_INTEREST_LIFETIME, 18645250),
+  face.put(makeNack(*makeInterest("/unsolicited", false, nullopt, 18645250),
                     lp::NackReason::NO_ROUTE));
   advanceClocks(10_ms);
   BOOST_CHECK_EQUAL(face.sentNacks.size(), 0); // unsolicited Nack would not be sent
 
-  auto interest1 = makeInterest("/Hello/World", false, DEFAULT_INTEREST_LIFETIME, 14247162);
+  auto interest1 = makeInterest("/Hello/World", false, nullopt, 14247162);
   face.receive(*interest1);
-  auto interest2 = makeInterest("/another/prefix", false, DEFAULT_INTEREST_LIFETIME, 92203002);
+  auto interest2 = makeInterest("/another/prefix", false, nullopt, 92203002);
   face.receive(*interest2);
   advanceClocks(10_ms);
 
@@ -464,7 +464,7 @@
   face.setInterestFilter("/", bind([&] { hasInterest2 = true; }));
   advanceClocks(10_ms);
 
-  auto interest = makeInterest("/A", false, DEFAULT_INTEREST_LIFETIME, 14333271);
+  auto interest = makeInterest("/A", false, nullopt, 14333271);
   face.receive(*interest);
   advanceClocks(10_ms);
   BOOST_CHECK(hasInterest1);
@@ -495,7 +495,7 @@
   face.setInterestFilter(InterestFilter("/").allowLoopback(false),
     bind([] { BOOST_ERROR("Unexpected Interest on second InterestFilter"); }));
 
-  auto interest = makeInterest("/A", false, DEFAULT_INTEREST_LIFETIME, 28395852);
+  auto interest = makeInterest("/A", false, nullopt, 28395852);
   face.expressInterest(*interest,
                        bind([] { BOOST_FAIL("Unexpected data"); }),
                        [&] (const Interest&, const lp::Nack& nack) {