Avoid deprecated ndn-cxx functions

Change-Id: Ib9220786a724327b89dcc328c8f34a5c8fe1fdd9
diff --git a/src/clients/response.cpp b/src/clients/response.cpp
index b183b1d..48b8a7d 100644
--- a/src/clients/response.cpp
+++ b/src/clients/response.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2020, Regents of the University of California.
+ * Copyright (c) 2014-2022, Regents of the University of California.
  *
  * This file is part of NDNS (Named Data Networking Domain Name Service).
  * See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -20,6 +20,8 @@
 #include "response.hpp"
 #include "logger.hpp"
 
+#include <ndn-cxx/encoding/block-helpers.hpp>
+
 namespace ndn {
 namespace ndns {
 
@@ -39,13 +41,13 @@
 {
 }
 
-template<encoding::Tag T>
+template<encoding::Tag TAG>
 size_t
-Response::wireEncode(EncodingImpl<T>& block) const
+Response::wireEncode(EncodingImpl<TAG>& encoder) const
 {
   if (m_contentType == NDNS_BLOB || m_contentType == NDNS_KEY) {
     // Raw application content
-    return block.prependBlock(m_appContent);
+    return prependBlock(encoder, m_appContent);
   }
 
   // Content :: = CONTENT-TYPE TLV-LENGTH
@@ -53,16 +55,15 @@
 
   size_t totalLength = 0;
   for (auto iter = m_rrs.rbegin(); iter != m_rrs.rend(); ++iter) {
-    totalLength += block.prependBlock(*iter);
+    totalLength += prependBlock(encoder, *iter);
   }
 
-  totalLength += block.prependVarNumber(totalLength);
-  totalLength += block.prependVarNumber(::ndn::tlv::Content);
-
+  totalLength += encoder.prependVarNumber(totalLength);
+  totalLength += encoder.prependVarNumber(ndn::tlv::Content);
   return totalLength;
 }
 
-const Block
+Block
 Response::wireEncode() const
 {
   if (m_contentType == NDNS_BLOB || m_contentType == NDNS_KEY) {
@@ -86,7 +87,7 @@
 
   wire.parse();
 
-  Block::element_const_iterator iter = wire.elements().begin();
+  auto iter = wire.elements().begin();
   for (; iter != wire.elements().end(); ++iter) {
     m_rrs.push_back(*iter);
   }
@@ -99,7 +100,7 @@
   if (wire.elements().size() != 2) {
     NDN_THROW(Error("Unexpected number of elements while decoding DOE record"));
   }
-  return std::make_pair(Name(wire.elements().front()), Name(wire.elements().back()));
+  return {Name(wire.elements().front()), Name(wire.elements().back())};
 }
 
 bool
diff --git a/src/clients/response.hpp b/src/clients/response.hpp
index a97fb76..4e8f335 100644
--- a/src/clients/response.hpp
+++ b/src/clients/response.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018, Regents of the University of California.
+ * Copyright (c) 2014-2022, Regents of the University of California.
  *
  * This file is part of NDNS (Named Data Networking Domain Name Service).
  * See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -24,16 +24,9 @@
 #include "ndns-enum.hpp"
 #include "ndns-label.hpp"
 
-
-#include <ndn-cxx/face.hpp>
-#include <ndn-cxx/name.hpp>
 #include <ndn-cxx/data.hpp>
-#include <ndn-cxx/encoding/block-helpers.hpp>
-#include <ndn-cxx/encoding/block.hpp>
 #include <ndn-cxx/meta-info.hpp>
 
-#include <vector>
-
 namespace ndn {
 namespace ndns {
 
@@ -102,7 +95,7 @@
   /**
    * @brief encode the app-level data
    */
-  const Block
+  Block
   wireEncode() const;
 
   /**
@@ -116,15 +109,12 @@
    */
   template<encoding::Tag T>
   size_t
-  wireEncode(EncodingImpl<T>& block) const;
+  wireEncode(EncodingImpl<T>& encoder) const;
 
   static std::pair<Name, Name>
   wireDecodeDoe(const Block& wire);
 
-public:
-  ///////////////////////////////////////////////
-  // getter and setter
-
+public: // getter and setter
   const Name&
   getZone() const
   {
diff --git a/src/daemon/db-mgr.cpp b/src/daemon/db-mgr.cpp
index 27c7332..e1ab0fc 100644
--- a/src/daemon/db-mgr.cpp
+++ b/src/daemon/db-mgr.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2021, Regents of the University of California.
+ * Copyright (c) 2014-2022, Regents of the University of California.
  *
  * This file is part of NDNS (Named Data Networking Domain Name Service).
  * See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -150,7 +150,7 @@
   while (nBytesLeft > 0) {
     bool hasDecodingSucceeded;
     name::Component component;
-    std::tie(hasDecodingSucceeded, component) = Block::fromBuffer(buffer, nBytesLeft);
+    std::tie(hasDecodingSucceeded, component) = Block::fromBuffer({buffer, nBytesLeft});
     if (!hasDecodingSucceeded) {
       NDN_THROW(Error("Error while decoding name from the database"));
     }
@@ -213,8 +213,8 @@
   }
 
   sqlite3_bind_int(stmt,  1, zone.getId());
-  sqlite3_bind_text(stmt, 2, key.data(),  key.length(), SQLITE_STATIC);
-  sqlite3_bind_blob(stmt, 3, value.wire(), value.size(), SQLITE_STATIC);
+  sqlite3_bind_text(stmt, 2, key.data(),   key.length(), SQLITE_STATIC);
+  sqlite3_bind_blob(stmt, 3, value.data(), value.size(), SQLITE_STATIC);
 
   rc = sqlite3_step(stmt);
   if (rc != SQLITE_DONE) {
@@ -250,8 +250,8 @@
 
   while (sqlite3_step(stmt) == SQLITE_ROW) {
     const char* key = reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0));
-    rtn[string(key)] = Block(static_cast<const uint8_t*>(sqlite3_column_blob(stmt, 1)),
-                             sqlite3_column_bytes(stmt, 1));
+    rtn[string(key)] = Block(make_span(static_cast<const uint8_t*>(sqlite3_column_blob(stmt, 1)),
+                                       sqlite3_column_bytes(stmt, 1)));
   }
 
   sqlite3_finalize(stmt);
@@ -364,10 +364,10 @@
   sqlite3_bind_int64(stmt, 1, rrset.getZone()->getId());
 
   saveName(rrset.getLabel(), stmt, 2);
-  sqlite3_bind_blob(stmt,  3, rrset.getType().wire(),    rrset.getType().size(),    SQLITE_STATIC);
-  sqlite3_bind_blob(stmt,  4, rrset.getVersion().wire(), rrset.getVersion().size(), SQLITE_STATIC);
+  sqlite3_bind_blob(stmt,  3, rrset.getType().data(),    rrset.getType().size(),    SQLITE_STATIC);
+  sqlite3_bind_blob(stmt,  4, rrset.getVersion().data(), rrset.getVersion().size(), SQLITE_STATIC);
   sqlite3_bind_int64(stmt, 5, rrset.getTtl().count());
-  sqlite3_bind_blob(stmt,  6, rrset.getData().wire(),    rrset.getData().size(),    SQLITE_STATIC);
+  sqlite3_bind_blob(stmt,  6, rrset.getData().data(),    rrset.getData().size(),    SQLITE_STATIC);
 
   rc = sqlite3_step(stmt);
   if (rc != SQLITE_DONE) {
@@ -405,15 +405,15 @@
   sqlite3_bind_int64(stmt, 1, rrset.getZone()->getId());
 
   saveName(rrset.getLabel(), stmt, 2);
-  sqlite3_bind_blob(stmt, 3, rrset.getType().wire(), rrset.getType().size(), SQLITE_STATIC);
+  sqlite3_bind_blob(stmt, 3, rrset.getType().data(), rrset.getType().size(), SQLITE_STATIC);
 
   if (sqlite3_step(stmt) == SQLITE_ROW) {
     rrset.setId(sqlite3_column_int64(stmt, 0));
     rrset.setTtl(time::seconds(sqlite3_column_int64(stmt, 1)));
-    rrset.setVersion(Block(static_cast<const uint8_t*>(sqlite3_column_blob(stmt, 2)),
-                           sqlite3_column_bytes(stmt, 2)));
-    rrset.setData(Block(static_cast<const uint8_t*>(sqlite3_column_blob(stmt, 3)),
-                        sqlite3_column_bytes(stmt, 3)));
+    rrset.setVersion(Block(make_span(static_cast<const uint8_t*>(sqlite3_column_blob(stmt, 2)),
+                                     sqlite3_column_bytes(stmt, 2))));
+    rrset.setData(Block(make_span(static_cast<const uint8_t*>(sqlite3_column_blob(stmt, 3)),
+                                  sqlite3_column_bytes(stmt, 3))));
   }
   else {
     rrset.setId(0);
@@ -449,15 +449,15 @@
   sqlite3_bind_int64(stmt, 1, rrset.getZone()->getId());
 
   saveName(rrset.getLabel(), stmt, 2);
-  sqlite3_bind_blob(stmt, 3, rrset.getType().wire(), rrset.getType().size(), SQLITE_STATIC);
+  sqlite3_bind_blob(stmt, 3, rrset.getType().data(), rrset.getType().size(), SQLITE_STATIC);
 
   if (sqlite3_step(stmt) == SQLITE_ROW) {
     rrset.setId(sqlite3_column_int64(stmt, 0));
     rrset.setTtl(time::seconds(sqlite3_column_int64(stmt, 1)));
-    rrset.setVersion(Block(static_cast<const uint8_t*>(sqlite3_column_blob(stmt, 2)),
-                           sqlite3_column_bytes(stmt, 2)));
-    rrset.setData(Block(static_cast<const uint8_t*>(sqlite3_column_blob(stmt, 3)),
-                        sqlite3_column_bytes(stmt, 3)));
+    rrset.setVersion(Block(make_span(static_cast<const uint8_t*>(sqlite3_column_blob(stmt, 2)),
+                                     sqlite3_column_bytes(stmt, 2))));
+    rrset.setData(Block(make_span(static_cast<const uint8_t*>(sqlite3_column_blob(stmt, 3)),
+                                  sqlite3_column_bytes(stmt, 3))));
   }
   else {
     rrset.setId(0);
@@ -493,13 +493,13 @@
 
     rrset.setId(sqlite3_column_int64(stmt, 0));
     rrset.setTtl(time::seconds(sqlite3_column_int64(stmt, 1)));
-    rrset.setVersion(Block(static_cast<const uint8_t*>(sqlite3_column_blob(stmt, 2)),
-                           sqlite3_column_bytes(stmt, 2)));
-    rrset.setData(Block(static_cast<const uint8_t*>(sqlite3_column_blob(stmt, 3)),
-                        sqlite3_column_bytes(stmt, 3)));
+    rrset.setVersion(Block(make_span(static_cast<const uint8_t*>(sqlite3_column_blob(stmt, 2)),
+                                     sqlite3_column_bytes(stmt, 2))));
+    rrset.setData(Block(make_span(static_cast<const uint8_t*>(sqlite3_column_blob(stmt, 3)),
+                                  sqlite3_column_bytes(stmt, 3))));
     rrset.setLabel(restoreName(stmt, 4));
-    rrset.setType(Block(static_cast<const uint8_t*>(sqlite3_column_blob(stmt, 5)),
-                  sqlite3_column_bytes(stmt, 5)));
+    rrset.setType(Block(make_span(static_cast<const uint8_t*>(sqlite3_column_blob(stmt, 5)),
+                                  sqlite3_column_bytes(stmt, 5))));
   }
   sqlite3_finalize(stmt);
 
@@ -523,7 +523,7 @@
   }
 
   sqlite3_bind_int64(stmt, 1, zone.getId());
-  sqlite3_bind_blob(stmt,  2, type.wire(), type.size(), SQLITE_STATIC);
+  sqlite3_bind_blob(stmt,  2, type.data(), type.size(), SQLITE_STATIC);
 
   rc = sqlite3_step(stmt);
   if (rc != SQLITE_DONE) {
@@ -578,8 +578,8 @@
   }
 
   sqlite3_bind_int64(stmt, 1, rrset.getTtl().count());
-  sqlite3_bind_blob(stmt,  2, rrset.getVersion().wire(), rrset.getVersion().size(), SQLITE_STATIC);
-  sqlite3_bind_blob(stmt,  3, rrset.getData().wire(),    rrset.getData().size(),    SQLITE_STATIC);
+  sqlite3_bind_blob(stmt,  2, rrset.getVersion().data(), rrset.getVersion().size(), SQLITE_STATIC);
+  sqlite3_bind_blob(stmt,  3, rrset.getData().data(),    rrset.getData().size(),    SQLITE_STATIC);
   sqlite3_bind_int64(stmt, 4, rrset.getId());
 
   sqlite3_step(stmt);
diff --git a/src/daemon/rrset-factory.cpp b/src/daemon/rrset-factory.cpp
index cded8e0..eed7ad0 100644
--- a/src/daemon/rrset-factory.cpp
+++ b/src/daemon/rrset-factory.cpp
@@ -60,7 +60,7 @@
 RrsetFactory::onlyCheckZone()
 {
   if (m_checked) {
-    return ;
+    return;
   }
   m_checked = true;
 
@@ -71,7 +71,6 @@
   }
 }
 
-
 std::pair<Rrset, Name>
 RrsetFactory::generateBaseRrset(const Name& label,
                                 const name::Component& type,
@@ -158,10 +157,9 @@
   std::tie(rrset, name) = generateBaseRrset(label, label::TXT_RR_TYPE, version, ttl);
 
   std::vector<Block> rrs;
+  rrs.reserve(strings.size());
   for (const auto& item : strings) {
-    rrs.push_back(makeBinaryBlock(ndns::tlv::RrData,
-                                  item.c_str(),
-                                  item.size()));
+    rrs.push_back(makeBinaryBlock(ndns::tlv::RrData, item.data(), item.size()));
   }
 
   Data data(name);
@@ -274,24 +272,23 @@
 }
 
 template<encoding::Tag TAG>
-inline size_t
-RrsetFactory::wireEncode(EncodingImpl<TAG>& block, const std::vector<Block>& rrs) const
+size_t
+RrsetFactory::wireEncode(EncodingImpl<TAG>& encoder, const std::vector<Block>& rrs) const
 {
   // Content :: = CONTENT-TYPE TLV-LENGTH
   //              Block*
 
   size_t totalLength = 0;
   for (auto iter = rrs.rbegin(); iter != rrs.rend(); ++iter) {
-    totalLength += block.prependBlock(*iter);
+    totalLength += prependBlock(encoder, *iter);
   }
 
-  totalLength += block.prependVarNumber(totalLength);
-  totalLength += block.prependVarNumber(::ndn::tlv::Content);
-
+  totalLength += encoder.prependVarNumber(totalLength);
+  totalLength += encoder.prependVarNumber(ndn::tlv::Content);
   return totalLength;
 }
 
-const Block
+Block
 RrsetFactory::wireEncode(const std::vector<Block>& rrs) const
 {
   EncodingEstimator estimator;
@@ -315,6 +312,5 @@
   return txts;
 }
 
-
 } // namespace ndns
 } // namespace ndn
diff --git a/src/daemon/rrset-factory.hpp b/src/daemon/rrset-factory.hpp
index bffb093..0daa27f 100644
--- a/src/daemon/rrset-factory.hpp
+++ b/src/daemon/rrset-factory.hpp
@@ -106,18 +106,17 @@
   matchCertificate(const Name& certName, const Name& identity);
 
   template<encoding::Tag TAG>
-  inline size_t
-  wireEncode(EncodingImpl<TAG>& block, const std::vector<Block>& rrs) const;
+  size_t
+  wireEncode(EncodingImpl<TAG>& encoder, const std::vector<Block>& rrs) const;
 
-  const Block
+  Block
   wireEncode(const std::vector<Block>& rrs) const;
 
   void
   sign(Data& data);
 
   void
-  setContentType(Data& data, NdnsContentType contentType,
-                 const time::seconds& ttl);
+  setContentType(Data& data, NdnsContentType contentType, const time::seconds& ttl);
 
 private:
   KeyChain& m_keyChain;
diff --git a/src/mgmt/management-tool.cpp b/src/mgmt/management-tool.cpp
index 02299c9..9ac88cf 100644
--- a/src/mgmt/management-tool.cpp
+++ b/src/mgmt/management-tool.cpp
@@ -217,7 +217,6 @@
   shared_ptr<Regex> regex = make_shared<Regex>("(<>*)<NDNS>(<>+)<CERT><>");
   if (!regex->match(certName)) {
     NDN_THROW(Error("Certificate name is illegal"));
-    return;
   }
 
   Name zoneName = regex->expand("\\1");
@@ -482,7 +481,7 @@
           os << std::endl;
         }
         else {
-          bufferSource(rrs[i].wire(), rrs[i].size()) >> base64Encode() >> streamSink(os);
+          bufferSource(rrs[i]) >> base64Encode() >> streamSink(os);
         }
       }
     }
@@ -504,7 +503,7 @@
           // cert.printCertificate(istream);
         }
         else {
-          bufferSource(re.getAppContent().wire(), re.getAppContent().size()) >> base64Encode() >> streamSink(os);
+          bufferSource(re.getAppContent()) >> base64Encode() >> streamSink(os);
         }
       }
       os << std::endl;
@@ -572,7 +571,7 @@
     return;
   }
 
-  bufferSource(rrset.getData().wire(), rrset.getData().size()) >> base64Encode() >> streamSink(os);
+  bufferSource(rrset.getData()) >> base64Encode() >> streamSink(os);
 }
 
 void
@@ -624,11 +623,12 @@
 ManagementTool::matchCertificate(const Name& certName, const Name& identity)
 {
   security::Identity id = m_keyChain.getPib().getIdentity(identity);
-  for (const security::Key& key: id.getKeys()) {
+  for (const security::Key& key : id.getKeys()) {
     try {
       key.getCertificate(certName);
       return true;
-    } catch (const std::exception&) {
+    }
+    catch (const std::exception&) {
     }
   }
   return false;
diff --git a/src/ndns-enum.cpp b/src/ndns-enum.cpp
index 37a5b7d..e8351a1 100644
--- a/src/ndns-enum.cpp
+++ b/src/ndns-enum.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018, Regents of the University of California.
+ * Copyright (c) 2014-2022, Regents of the University of California.
  *
  * This file is part of NDNS (Named Data Networking Domain Name Service).
  * See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -23,7 +23,7 @@
 namespace ndns {
 
 std::ostream&
-operator<<(std::ostream& os, const NdnsContentType ndnsType)
+operator<<(std::ostream& os, NdnsContentType ndnsType)
 {
   switch (ndnsType) {
   case NDNS_BLOB:
diff --git a/src/ndns-enum.hpp b/src/ndns-enum.hpp
index eb4ea35..f7ced20 100644
--- a/src/ndns-enum.hpp
+++ b/src/ndns-enum.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018, Regents of the University of California.
+ * Copyright (c) 2014-2022, Regents of the University of California.
  *
  * This file is part of NDNS (Named Data Networking Domain Name Service).
  * See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -27,7 +27,7 @@
 namespace ndns {
 
 /**
- * @brief contentType of response
+ * @brief ContentType of response
  */
 enum NdnsContentType {
   NDNS_BLOB = ndn::tlv::ContentType_Blob,
@@ -41,10 +41,10 @@
 };
 
 std::ostream&
-operator<<(std::ostream& os, const NdnsContentType contentType);
+operator<<(std::ostream& os, NdnsContentType contentType);
 
 /**
- * @brief define Return code of Update's Response
+ * @brief Return code of Update response
  */
 enum UpdateReturnCode {
   UPDATE_OK = 0, ///< Update succeeds
diff --git a/src/util/cert-helper.cpp b/src/util/cert-helper.cpp
index ae33e00..3e52f21 100644
--- a/src/util/cert-helper.cpp
+++ b/src/util/cert-helper.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2020, Regents of the University of California.
+ * Copyright (c) 2014-2022, Regents of the University of California.
  *
  * This file is part of NDNS (Named Data Networking Domain Name Service).
  * See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -108,7 +108,7 @@
   certificate.setFreshnessPeriod(time::hours(1));
 
   // set content
-  certificate.setContent(key.getPublicKey().data(), key.getPublicKey().size());
+  certificate.setContent(key.getPublicKey());
 
   // set signature-info
   // to overcome the round-up issue in ndn-cxx setPeriod (notBefore is round up to the the next whole second)
diff --git a/src/util/util.cpp b/src/util/util.cpp
index 8466733..d576311 100644
--- a/src/util/util.cpp
+++ b/src/util/util.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2020, Regents of the University of California.
+ * Copyright (c) 2014-2022, Regents of the University of California.
  *
  * This file is part of NDNS (Named Data Networking Domain Name Service).
  * See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -47,7 +47,7 @@
   else if (str == "link")
     return NDNS_LINK;
   else if (str == "key")
-    return NDNS_LINK;
+    return NDNS_KEY;
   else
     return NDNS_UNKNOWN;
 }
@@ -61,7 +61,7 @@
 
   const Block& block = data.wireEncode();
   if (!isPretty) {
-    bufferSource(block.wire(), block.size()) >> base64Encode() >> streamSink(os);
+    bufferSource(block) >> base64Encode() >> streamSink(os);
   }
   else {
     os << "Name: " << data.getName() << std::endl;
@@ -69,7 +69,7 @@
     if (kl) {
       os << "KeyLocator: " << kl->getName() << std::endl;
     }
-    bufferSource(block.wire(), block.size()) >> base64Encode() >> streamSink(os);
+    bufferSource(block) >> base64Encode() >> streamSink(os);
     os << std::endl;
   }
 }
diff --git a/tests/key-chain-fixture.cpp b/tests/key-chain-fixture.cpp
index c374fa3..c1abcf8 100644
--- a/tests/key-chain-fixture.cpp
+++ b/tests/key-chain-fixture.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of NDNS (Named Data Networking Domain Name Service).
  * See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -55,7 +55,7 @@
   cert.setFreshnessPeriod(1_h);
 
   // set content
-  cert.setContent(key.getPublicKey().data(), key.getPublicKey().size());
+  cert.setContent(key.getPublicKey());
 
   // set signature info
   ndn::SignatureInfo info;
diff --git a/tests/unit/daemon/name-server.t.cpp b/tests/unit/daemon/name-server.t.cpp
index 8ca796d..a0ec0f5 100644
--- a/tests/unit/daemon/name-server.t.cpp
+++ b/tests/unit/daemon/name-server.t.cpp
@@ -177,13 +177,12 @@
   str = "ns2.ndnsim.net";
   re.addRr(makeBinaryBlock(ndns::tlv::RrData, str.c_str(), str.size()));
 
-  shared_ptr<Data> data = re.toData();
+  auto data = re.toData();
   m_keyChain.sign(*data, security::signingByCertificate(m_cert));
 
   Query q(Name(zone), ndns::label::NDNS_ITERATIVE_QUERY);
-  const Block& block = data->wireEncode();
   Name name;
-  name.append(block);
+  name.append(ndn::tlv::GenericNameComponent, data->wireEncode());
 
   q.setRrLabel(name);
   q.setRrType(label::NDNS_UPDATE_LABEL);
@@ -228,13 +227,12 @@
   str = "ns2.ndnsim.net";
   re.addRr(makeBinaryBlock(ndns::tlv::RrData, str.c_str(), str.size()));
 
-  shared_ptr<Data> data = re.toData();
+  auto data = re.toData();
   m_keyChain.sign(*data, security::signingByCertificate(m_cert));
 
   Query q(Name(zone), ndns::label::NDNS_ITERATIVE_QUERY);
-  const Block& block = data->wireEncode();
   Name name;
-  name.append(block);
+  name.append(ndn::tlv::GenericNameComponent, data->wireEncode());
 
   q.setRrLabel(name);
   q.setRrType(label::NDNS_UPDATE_LABEL);
@@ -279,7 +277,7 @@
   dskCert.setName(dskCertName);
   dskCert.setContentType(ndn::tlv::ContentType_Key);
   dskCert.setFreshnessPeriod(time::hours(1));
-  dskCert.setContent(dsk.getPublicKey().data(), dsk.getPublicKey().size());
+  dskCert.setContent(dsk.getPublicKey());
   SignatureInfo info;
   info.setValidityPeriod(security::ValidityPeriod(time::system_clock::now(),
                                                   time::system_clock::now() + time::days(365)));
@@ -313,13 +311,12 @@
   str = "ns2.ndnsim.net";
   re.addRr(makeBinaryBlock(ndns::tlv::RrData, str.c_str(), str.size()));
 
-  shared_ptr<Data> data = re.toData();
+  auto data = re.toData();
   m_keyChain.sign(*data, security::signingByCertificate(dskCert));
 
   Query q(Name(zone), ndns::label::NDNS_ITERATIVE_QUERY);
-  const Block& block = data->wireEncode();
   Name name;
-  name.append(block);
+  name.append(ndn::tlv::GenericNameComponent, data->wireEncode());
 
   q.setRrLabel(name);
   q.setRrType(label::NDNS_UPDATE_LABEL);
@@ -353,11 +350,8 @@
 
     validatorFace.onSendInterest.connect([this] (const Interest& interest) {
       NDNS_LOG_TRACE("validatorFace get Interest: " << interest.getName());
-
-      shared_ptr<const Interest> i = interest.shared_from_this();
-      io.post([i, this] {
-          face.receive(*i);
-        });
+      auto i = interest.shared_from_this();
+      io.post([i, this] { face.receive(*i); });
     });
   }
 
@@ -391,13 +385,12 @@
   str = "ns2.ndnsim.net";
   re.addRr(makeBinaryBlock(ndns::tlv::RrData, str.c_str(), str.size()));
 
-  shared_ptr<Data> data = re.toData();
+  auto data = re.toData();
   m_keyChain.sign(*data, security::signingByCertificate(m_cert));
 
   Query q(Name(zone), ndns::label::NDNS_ITERATIVE_QUERY);
-  const Block& block = data->wireEncode();
   Name name;
-  name.append(block);
+  name.append(ndn::tlv::GenericNameComponent, data->wireEncode());
 
   q.setRrLabel(name);
   q.setRrType(label::NDNS_UPDATE_LABEL);
@@ -426,7 +419,7 @@
       block.parse();
       int ret = -1;
       BOOST_CHECK_EQUAL(block.type(), ndns::tlv::RrData);
-      Block::element_const_iterator val = block.elements_begin();
+      auto val = block.elements_begin();
       BOOST_CHECK_EQUAL(val->type(), ndns::tlv::UpdateReturnCode); // the first must be return code
       ret = readNonNegativeInteger(*val);
       BOOST_CHECK_EQUAL(ret, 0);
diff --git a/tests/unit/mgmt/management-tool.t.cpp b/tests/unit/mgmt/management-tool.t.cpp
index db2eaa0..97282d1 100644
--- a/tests/unit/mgmt/management-tool.t.cpp
+++ b/tests/unit/mgmt/management-tool.t.cpp
@@ -201,7 +201,6 @@
       }
     }
     NDN_THROW(Error("Certificate not found in keyChain"));
-    return rtn;
   }
 
   Certificate
@@ -1038,7 +1037,7 @@
   using security::transform::streamSink;
   using security::transform::bufferSource;
 
-  bufferSource(rrset1.getData().wire(), rrset1.getData().size()) >> base64Encode() >> streamSink(os);
+  bufferSource(rrset1.getData()) >> base64Encode() >> streamSink(os);
 
   std::string expectedValue = os.str();
 
diff --git a/tools/ndns-update.cpp b/tools/ndns-update.cpp
index 9c23a5b..4ad2c60 100644
--- a/tools/ndns-update.cpp
+++ b/tools/ndns-update.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2020, Regents of the University of California.
+ * Copyright (c) 2014-2022, Regents of the University of California.
  *
  * This file is part of NDNS (Named Data Networking Domain Name Service).
  * See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -28,13 +28,11 @@
 #include "util/util.hpp"
 #include "util/cert-helper.hpp"
 
+#include <ndn-cxx/face.hpp>
 #include <ndn-cxx/security/key-chain.hpp>
 #include <ndn-cxx/security/signing-helpers.hpp>
-#include <ndn-cxx/data.hpp>
 #include <ndn-cxx/util/io.hpp>
 #include <ndn-cxx/util/regex.hpp>
-#include <ndn-cxx/encoding/block.hpp>
-#include <ndn-cxx/encoding/block-helpers.hpp>
 
 #include <boost/asio/io_service.hpp>
 #include <boost/program_options.hpp>
@@ -91,7 +89,7 @@
     NDNS_LOG_INFO("get response of Update");
     int ret = -1;
     std::string msg;
-    std::tie(ret, msg) = this->parseResponse(data);
+    std::tie(ret, msg) = parseResponse(data);
     NDNS_LOG_INFO("Return Code: " << ret << ", and Update "
                   << (ret == UPDATE_OK ? "succeeds" : "fails"));
     if (ret != UPDATE_OK)
@@ -107,7 +105,7 @@
                           bind(&NdnsUpdate::onDataValidationFailed, this, _1, _2));
   }
 
-  std::tuple<int, std::string>
+  static std::tuple<int, std::string>
   parseResponse(const Data& data)
   {
     int ret = -1;
@@ -136,7 +134,7 @@
   makeUpdateInterest()
   {
     Query q(m_zone, label::NDNS_ITERATIVE_QUERY);
-    q.setRrLabel(Name().append(m_update->wireEncode()));
+    q.setRrLabel(Name().append(ndn::tlv::GenericNameComponent, m_update->wireEncode()));
     q.setRrType(label::NDNS_UPDATE_LABEL);
     q.setInterestLifetime(m_interestLifetime);
 
@@ -293,7 +291,6 @@
             catch (const std::exception&) {
               // If it cannot get a default certificate from one identity,
               // just ignore this one try next identity.
-              ;
             }
           }
         } // for
@@ -383,12 +380,11 @@
           return 1;
         }
       }
-      catch (const std::exception& e) {
+      catch (const std::exception&) {
         std::cerr << "Error: the loaded Data packet cannot parse to a Response stored at zone: "
                   << zone << std::endl;
         return 1;
       }
-
     }
   }
   catch (const std::exception& ex) {
diff --git a/wscript b/wscript
index 7683c06..ddae792 100644
--- a/wscript
+++ b/wscript
@@ -3,10 +3,8 @@
 from waflib import Context, Logs, Utils
 import os, subprocess
 
-VERSION = '0.1.0'
+VERSION = '0.1'
 APPNAME = 'ndns'
-BUGREPORT = 'https://redmine.named-data.net/projects/ndns'
-URL = 'http://named-data.net/doc/ndns/'
 GIT_TAG_PREFIX = 'ndns-'
 
 def options(opt):
@@ -29,12 +27,13 @@
 
     conf.find_program('dot', var='DOT', mandatory=False)
 
-    conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'], uselib_store='NDN_CXX',
-                   pkg_config_path=os.environ.get('PKG_CONFIG_PATH', '%s/pkgconfig' % conf.env.LIBDIR))
+    pkg_config_path = os.environ.get('PKG_CONFIG_PATH', f'{conf.env.LIBDIR}/pkgconfig')
+    conf.check_cfg(package='libndn-cxx', args=['libndn-cxx >= 0.8.0', '--cflags', '--libs'],
+                   uselib_store='NDN_CXX', pkg_config_path=pkg_config_path)
 
     conf.check_sqlite3()
 
-    boost_libs = ['system', 'program_options', 'filesystem', 'thread', 'log']
+    boost_libs = ['system', 'program_options', 'filesystem']
     if conf.env.WITH_TESTS:
         boost_libs.append('unit_test_framework')
     conf.check_boost(lib=boost_libs, mt=True)
@@ -53,23 +52,25 @@
 def build(bld):
     version(bld)
 
+    vmajor = int(VERSION_SPLIT[0])
+    vminor = int(VERSION_SPLIT[1]) if len(VERSION_SPLIT) >= 2 else 0
+    vpatch = int(VERSION_SPLIT[2]) if len(VERSION_SPLIT) >= 3 else 0
+
     bld(features='subst',
         name='version.hpp',
         source='src/version.hpp.in',
         target='src/version.hpp',
         VERSION_STRING=VERSION_BASE,
         VERSION_BUILD=VERSION,
-        VERSION=int(VERSION_SPLIT[0]) * 1000000 +
-                int(VERSION_SPLIT[1]) * 1000 +
-                int(VERSION_SPLIT[2]),
-        VERSION_MAJOR=VERSION_SPLIT[0],
-        VERSION_MINOR=VERSION_SPLIT[1],
-        VERSION_PATCH=VERSION_SPLIT[2])
+        VERSION=vmajor * 1000000 + vminor * 1000 + vpatch,
+        VERSION_MAJOR=str(vmajor),
+        VERSION_MINOR=str(vminor),
+        VERSION_PATCH=str(vpatch))
 
     bld.objects(
         name='ndns-objects',
         source=bld.path.ant_glob('src/**/*.cpp'),
-        use='version NDN_CXX BOOST',
+        use='version.hpp NDN_CXX BOOST',
         includes='src',
         export_includes='src')