build: switch to C++17
Change-Id: Ia147b22fbdee68d87f0289851683ffbbb4466caa
diff --git a/src/mgmt/management-tool.cpp b/src/mgmt/management-tool.cpp
index 9ac88cf..33b704c 100644
--- a/src/mgmt/management-tool.cpp
+++ b/src/mgmt/management-tool.cpp
@@ -38,7 +38,6 @@
#include <ndn-cxx/security/signing-helpers.hpp>
#include <ndn-cxx/security/transform.hpp>
-
namespace ndn {
namespace ndns {
@@ -48,8 +47,6 @@
using security::transform::streamSink;
using security::transform::bufferSource;
using security::Certificate;
-using security::Identity;
-using security::Key;
ManagementTool::ManagementTool(const std::string& dbFile, KeyChain& keyChain)
: m_keyChain(keyChain)
@@ -112,14 +109,14 @@
NDNS_LOG_INFO("Generated D-Key's identityName: " + dkeyIdentityName.toUri());
Name dskName;
- Key ksk;
- Key dsk;
- Key dkey;
+ security::Key ksk;
+ security::Key dsk;
+ security::Key dkey;
Certificate dskCert;
Certificate kskCert;
Certificate dkeyCert;
- Identity zoneIdentity = m_keyChain.createIdentity(zoneIdentityName);
- Identity dkeyIdentity = m_keyChain.createIdentity(dkeyIdentityName);
+ auto zoneIdentity = m_keyChain.createIdentity(zoneIdentityName);
+ auto dkeyIdentity = m_keyChain.createIdentity(dkeyIdentityName);
if (dkeyCertName == DEFAULT_CERT) {
dkey = m_keyChain.createKey(dkeyIdentity);
@@ -319,7 +316,7 @@
const std::string& inFile,
const time::seconds& ttl,
const Name& inputDskCertName,
- const ndn::io::IoEncoding encoding,
+ ndn::io::IoEncoding encoding,
bool needResign)
{
//check precondition
@@ -397,7 +394,7 @@
}
void
-ManagementTool::listZone(const Name& zoneName, std::ostream& os, const bool printRaw)
+ManagementTool::listZone(const Name& zoneName, std::ostream& os, bool printRaw)
{
Zone zone(zoneName);
if (!m_dbMgr.find(zone)) {
@@ -440,7 +437,7 @@
|| re.getContentType() == NDNS_KEY
|| re.getContentType() == NDNS_AUTH ? 1 : re.getRrs().size();
- const std::vector<Block>& rrs = re.getRrs();
+ const auto& rrs = re.getRrs();
if (re.getContentType() != NDNS_BLOB && re.getContentType() != NDNS_KEY) {
os << "; rrset=" << rrset.getLabel().toUri()
@@ -515,7 +512,8 @@
}
void
-ManagementTool::listAllZones(std::ostream& os) {
+ManagementTool::listAllZones(std::ostream& os)
+{
std::vector<Zone> zones = m_dbMgr.listZones();
size_t nameWidth = 0;
@@ -622,8 +620,8 @@
bool
ManagementTool::matchCertificate(const Name& certName, const Name& identity)
{
- security::Identity id = m_keyChain.getPib().getIdentity(identity);
- for (const security::Key& key : id.getKeys()) {
+ auto id = m_keyChain.getPib().getIdentity(identity);
+ for (const auto& key : id.getKeys()) {
try {
key.getCertificate(certName);
return true;
diff --git a/src/mgmt/management-tool.hpp b/src/mgmt/management-tool.hpp
index ba00458..592205c 100644
--- a/src/mgmt/management-tool.hpp
+++ b/src/mgmt/management-tool.hpp
@@ -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.
@@ -35,14 +35,14 @@
namespace ndn {
namespace ndns {
-static const Name DEFAULT_CERT;
-static const Name ROOT_ZONE;
-static const time::seconds DEFAULT_CACHE_TTL = time::seconds(3600);
-static const time::seconds DEFAULT_CERT_TTL = time::days(365);
-static const std::vector<std::string> DEFAULT_CONTENTS;
-static const std::string DEFAULT_IO = "-";
-static const time::seconds DEFAULT_RR_TTL = time::seconds(0);
-static constexpr uint64_t VERSION_USE_UNIX_TIMESTAMP = std::numeric_limits<uint64_t>::max();
+inline const Name DEFAULT_CERT;
+inline const Name ROOT_ZONE;
+inline constexpr time::seconds DEFAULT_CACHE_TTL = time::seconds(3600);
+inline constexpr time::seconds DEFAULT_CERT_TTL = time::days(365);
+inline const std::vector<std::string> DEFAULT_CONTENTS;
+inline const std::string DEFAULT_IO = "-";
+inline constexpr time::seconds DEFAULT_RR_TTL = time::seconds(0);
+inline constexpr uint64_t VERSION_USE_UNIX_TIMESTAMP = std::numeric_limits<uint64_t>::max();
/**
* @brief provides management tools to the NDNS system, such as zone creation, zone delegation, DSK
@@ -139,7 +139,7 @@
const std::string& inFile = DEFAULT_IO,
const time::seconds& ttl = DEFAULT_RR_TTL,
const Name& dskCertName = DEFAULT_CERT,
- const ndn::io::IoEncoding encoding = ndn::io::BASE64,
+ ndn::io::IoEncoding encoding = ndn::io::BASE64,
bool needResign = false);
/** @brief Add rrset to the NDNS local database
@@ -211,7 +211,7 @@
* @throw Error if zoneName does not exist in the database
*/
void
- listZone(const Name& zoneName, std::ostream& os, const bool printRaw = false);
+ listZone(const Name& zoneName, std::ostream& os, bool printRaw = false);
/** @brief lists all existing zones within this name server.
*