Use `inline` on all namespace-scope constants defined in headers
Change-Id: Ia6e68d3fe572f6c15978c77a646ac599fa47e575
diff --git a/ndn-cxx/encoding/block.cpp b/ndn-cxx/encoding/block.cpp
index b4bbd02..6b14d87 100644
--- a/ndn-cxx/encoding/block.cpp
+++ b/ndn-cxx/encoding/block.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -37,7 +37,7 @@
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Block>));
-const size_t MAX_SIZE_OF_BLOCK_FROM_STREAM = MAX_NDN_PACKET_SIZE;
+constexpr size_t MAX_SIZE_OF_BLOCK_FROM_STREAM = MAX_NDN_PACKET_SIZE;
// ---- constructor, creation, assignment ----
diff --git a/ndn-cxx/encoding/nfd-constants.hpp b/ndn-cxx/encoding/nfd-constants.hpp
index 6b3389f..55f1b7b 100644
--- a/ndn-cxx/encoding/nfd-constants.hpp
+++ b/ndn-cxx/encoding/nfd-constants.hpp
@@ -29,7 +29,7 @@
namespace ndn {
namespace nfd {
-const uint64_t INVALID_FACE_ID = 0;
+inline constexpr uint64_t INVALID_FACE_ID = 0;
/** \ingroup management
*/
diff --git a/ndn-cxx/encoding/tlv.hpp b/ndn-cxx/encoding/tlv.hpp
index 4513d13..be0fbfa 100644
--- a/ndn-cxx/encoding/tlv.hpp
+++ b/ndn-cxx/encoding/tlv.hpp
@@ -39,7 +39,7 @@
*
* If a packet is longer than this size, library and application MAY drop it.
*/
-const size_t MAX_NDN_PACKET_SIZE = 8800;
+inline constexpr size_t MAX_NDN_PACKET_SIZE = 8800;
/**
* @brief Contains constants and low-level functions related to the NDN packet format.
diff --git a/ndn-cxx/ims/in-memory-storage.cpp b/ndn-cxx/ims/in-memory-storage.cpp
index 64624a7..401e84c 100644
--- a/ndn-cxx/ims/in-memory-storage.cpp
+++ b/ndn-cxx/ims/in-memory-storage.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,8 +24,8 @@
namespace ndn {
-const time::milliseconds InMemoryStorage::INFINITE_WINDOW(-1);
-const time::milliseconds InMemoryStorage::ZERO_WINDOW(0);
+constexpr size_t MIN_CAPACITY = 16;
+constexpr time::milliseconds ZERO_WINDOW = 0_ms;
InMemoryStorage::const_iterator::const_iterator(const Data* ptr, const Cache* cache,
Cache::index<byFullName>::type::iterator it)
@@ -100,7 +100,7 @@
InMemoryStorage::init()
{
// TODO consider a more suitable initial value
- m_capacity = m_initCapacity;
+ m_capacity = MIN_CAPACITY;
if (m_limit != std::numeric_limits<size_t>::max() && m_capacity > m_limit) {
m_capacity = m_limit;
@@ -131,7 +131,7 @@
InMemoryStorage::setCapacity(size_t capacity)
{
size_t oldCapacity = m_capacity;
- m_capacity = std::max(capacity, m_initCapacity);
+ m_capacity = std::max(capacity, MIN_CAPACITY);
if (size() > m_capacity) {
ssize_t nAllowedFailures = size() - m_capacity;
@@ -367,17 +367,17 @@
}
void
-InMemoryStorage::afterInsert(InMemoryStorageEntry* entry)
+InMemoryStorage::afterInsert(InMemoryStorageEntry*)
{
}
void
-InMemoryStorage::beforeErase(InMemoryStorageEntry* entry)
+InMemoryStorage::beforeErase(InMemoryStorageEntry*)
{
}
void
-InMemoryStorage::afterAccess(InMemoryStorageEntry* entry)
+InMemoryStorage::afterAccess(InMemoryStorageEntry*)
{
}
diff --git a/ndn-cxx/ims/in-memory-storage.hpp b/ndn-cxx/ims/in-memory-storage.hpp
index 67fd76d..4694e31 100644
--- a/ndn-cxx/ims/in-memory-storage.hpp
+++ b/ndn-cxx/ims/in-memory-storage.hpp
@@ -326,17 +326,12 @@
init();
public:
- static const time::milliseconds INFINITE_WINDOW;
-
-private:
- static const time::milliseconds ZERO_WINDOW;
+ static constexpr time::milliseconds INFINITE_WINDOW = -1_ms;
private:
Cache m_cache;
/// user defined maximum capacity of the in-memory storage in packets
size_t m_limit;
- /// initial capacity, used as minimum capacity
- const size_t m_initCapacity = 16;
/// current capacity of the in-memory storage in packets
size_t m_capacity;
/// current number of packets in in-memory storage
diff --git a/ndn-cxx/interest.hpp b/ndn-cxx/interest.hpp
index d8ef0ea..4bf8e51 100644
--- a/ndn-cxx/interest.hpp
+++ b/ndn-cxx/interest.hpp
@@ -40,7 +40,7 @@
/**
* @brief Default value of `InterestLifetime`.
*/
-const time::milliseconds DEFAULT_INTEREST_LIFETIME = 4_s;
+inline constexpr time::milliseconds DEFAULT_INTEREST_LIFETIME = 4_s;
/**
* @brief Represents an %Interest packet.
diff --git a/ndn-cxx/key-locator.cpp b/ndn-cxx/key-locator.cpp
index 989a2e4..28ca7fe 100644
--- a/ndn-cxx/key-locator.cpp
+++ b/ndn-cxx/key-locator.cpp
@@ -34,7 +34,7 @@
static_assert(std::is_base_of<tlv::Error, KeyLocator::Error>::value,
"KeyLocator::Error must inherit from tlv::Error");
-const size_t MAX_KEY_DIGEST_OCTETS_TO_SHOW = 8;
+constexpr size_t MAX_KEY_DIGEST_OCTETS_TO_SHOW = 8;
KeyLocator::KeyLocator() = default;
diff --git a/ndn-cxx/lp/pit-token.cpp b/ndn-cxx/lp/pit-token.cpp
index 2448579..f232814 100644
--- a/ndn-cxx/lp/pit-token.cpp
+++ b/ndn-cxx/lp/pit-token.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -26,8 +26,8 @@
namespace ndn {
namespace lp {
-static constexpr size_t LENGTH_MIN = 1;
-static constexpr size_t LENGTH_MAX = 32;
+constexpr size_t LENGTH_MIN = 1;
+constexpr size_t LENGTH_MAX = 32;
void
PitToken::validate() const
diff --git a/ndn-cxx/meta-info.hpp b/ndn-cxx/meta-info.hpp
index f2dd699..e504c5c 100644
--- a/ndn-cxx/meta-info.hpp
+++ b/ndn-cxx/meta-info.hpp
@@ -35,7 +35,7 @@
/**
* @brief Default value of `FreshnessPeriod`.
*/
-const time::milliseconds DEFAULT_FRESHNESS_PERIOD{0};
+inline constexpr time::milliseconds DEFAULT_FRESHNESS_PERIOD = 0_ms;
/**
* @brief A MetaInfo holds the meta info which is signed inside the Data packet.
diff --git a/ndn-cxx/mgmt/nfd/command-options.cpp b/ndn-cxx/mgmt/nfd/command-options.cpp
index beeac16..36faba2 100644
--- a/ndn-cxx/mgmt/nfd/command-options.cpp
+++ b/ndn-cxx/mgmt/nfd/command-options.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,37 +24,27 @@
namespace ndn {
namespace nfd {
-const time::milliseconds CommandOptions::DEFAULT_TIMEOUT(10000);
-const Name CommandOptions::DEFAULT_PREFIX("ndn:/localhost/nfd");
-
-CommandOptions::CommandOptions()
- : m_timeout(DEFAULT_TIMEOUT)
- , m_prefix(DEFAULT_PREFIX)
-{
-}
-
CommandOptions&
-CommandOptions::setTimeout(const time::milliseconds& timeout)
+CommandOptions::setTimeout(time::milliseconds timeout)
{
- if (timeout <= time::milliseconds::zero()) {
+ if (timeout <= 0_ms) {
NDN_THROW(std::out_of_range("Timeout must be positive"));
}
-
m_timeout = timeout;
return *this;
}
CommandOptions&
-CommandOptions::setPrefix(const Name& prefix)
+CommandOptions::setPrefix(Name prefix)
{
- m_prefix = prefix;
+ m_prefix = std::move(prefix);
return *this;
}
CommandOptions&
-CommandOptions::setSigningInfo(const security::SigningInfo& signingInfo)
+CommandOptions::setSigningInfo(security::SigningInfo signingInfo)
{
- m_signingInfo = signingInfo;
+ m_signingInfo = std::move(signingInfo);
return *this;
}
diff --git a/ndn-cxx/mgmt/nfd/command-options.hpp b/ndn-cxx/mgmt/nfd/command-options.hpp
index 5101294..5a341fe 100644
--- a/ndn-cxx/mgmt/nfd/command-options.hpp
+++ b/ndn-cxx/mgmt/nfd/command-options.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -27,19 +27,21 @@
namespace ndn {
namespace nfd {
-/** \ingroup management
- * \brief Contains options for ControlCommand execution.
- * \note This type is intentionally copyable
+/**
+ * \ingroup management
+ * \brief Contains options for ControlCommand execution.
+ * \note This type is intentionally copyable.
*/
class CommandOptions
{
public:
- /** \brief Constructs CommandOptions.
- * \post getTimeout() == DEFAULT_TIMEOUT
- * \post getPrefix() == DEFAULT_PREFIX
- * \post getSigningInfo().getSignerType() == SIGNER_TYPE_NULL
+ /**
+ * \brief Constructs CommandOptions.
+ * \post getTimeout() == DEFAULT_TIMEOUT
+ * \post getPrefix() == DEFAULT_PREFIX
+ * \post getSigningInfo().getSignerType() == SIGNER_TYPE_NULL
*/
- CommandOptions();
+ CommandOptions() = default;
/**
* \brief Returns the command timeout.
@@ -50,13 +52,14 @@
return m_timeout;
}
- /** \brief Sets the command timeout.
- * \param timeout the new command timeout, must be positive
- * \throw std::out_of_range if timeout is non-positive
- * \return self
+ /**
+ * \brief Sets the command timeout.
+ * \param timeout the new command timeout, must be positive
+ * \return self
+ * \throw std::out_of_range if timeout is non-positive
*/
CommandOptions&
- setTimeout(const time::milliseconds& timeout);
+ setTimeout(time::milliseconds timeout);
/**
* \brief Returns the command prefix.
@@ -67,11 +70,12 @@
return m_prefix;
}
- /** \brief Sets the command prefix.
- * \return self
+ /**
+ * \brief Sets the command prefix.
+ * \return self
*/
CommandOptions&
- setPrefix(const Name& prefix);
+ setPrefix(Name prefix);
/**
* \brief Returns the signing parameters.
@@ -82,22 +86,23 @@
return m_signingInfo;
}
- /** \brief Sets the signing parameters.
- * \return self
+ /**
+ * \brief Sets the signing parameters.
+ * \return self
*/
CommandOptions&
- setSigningInfo(const security::SigningInfo& signingInfo);
+ setSigningInfo(security::SigningInfo signingInfo);
public:
/// The default command timeout: 10 seconds.
- static const time::milliseconds DEFAULT_TIMEOUT;
+ static constexpr time::milliseconds DEFAULT_TIMEOUT = 10_s;
/// The default command prefix: `/localhost/nfd`.
- static const Name DEFAULT_PREFIX;
+ static inline const Name DEFAULT_PREFIX{"/localhost/nfd"};
private:
- time::milliseconds m_timeout;
- Name m_prefix;
+ time::milliseconds m_timeout = DEFAULT_TIMEOUT;
+ Name m_prefix = DEFAULT_PREFIX;
security::SigningInfo m_signingInfo;
};
diff --git a/ndn-cxx/mgmt/nfd/control-parameters.hpp b/ndn-cxx/mgmt/nfd/control-parameters.hpp
index 2d1a3ea..682c590 100644
--- a/ndn-cxx/mgmt/nfd/control-parameters.hpp
+++ b/ndn-cxx/mgmt/nfd/control-parameters.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -53,7 +53,7 @@
CONTROL_PARAMETER_UBOUND
};
-const std::string CONTROL_PARAMETER_FIELD[CONTROL_PARAMETER_UBOUND] = {
+inline const std::string CONTROL_PARAMETER_FIELD[CONTROL_PARAMETER_UBOUND] = {
"Name",
"FaceId",
"Uri",
diff --git a/ndn-cxx/mgmt/nfd/controller.cpp b/ndn-cxx/mgmt/nfd/controller.cpp
index 6f0f74c..d1c2489 100644
--- a/ndn-cxx/mgmt/nfd/controller.cpp
+++ b/ndn-cxx/mgmt/nfd/controller.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -30,12 +30,6 @@
using ndn::util::SegmentFetcher;
-const uint32_t Controller::ERROR_TIMEOUT = 10060; // WinSock ESAETIMEDOUT
-const uint32_t Controller::ERROR_NACK = 10800; // 10000 + TLV-TYPE of Nack header
-const uint32_t Controller::ERROR_VALIDATION = 10021; // 10000 + TLS1_ALERT_DECRYPTION_FAILED
-const uint32_t Controller::ERROR_SERVER = 500;
-const uint32_t Controller::ERROR_LBOUND = 400;
-
Controller::Controller(Face& face, KeyChain& keyChain, security::Validator& validator)
: m_face(face)
, m_keyChain(keyChain)
diff --git a/ndn-cxx/mgmt/nfd/controller.hpp b/ndn-cxx/mgmt/nfd/controller.hpp
index 3cb2c0d..1d56b56 100644
--- a/ndn-cxx/mgmt/nfd/controller.hpp
+++ b/ndn-cxx/mgmt/nfd/controller.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,7 +25,6 @@
#include "ndn-cxx/mgmt/nfd/command-options.hpp"
#include "ndn-cxx/mgmt/nfd/control-command.hpp"
#include "ndn-cxx/mgmt/nfd/control-response.hpp"
-#include "ndn-cxx/mgmt/nfd/status-dataset.hpp"
#include "ndn-cxx/security/interest-signer.hpp"
#include "ndn-cxx/security/key-chain.hpp"
#include "ndn-cxx/security/validator-null.hpp"
@@ -74,7 +73,8 @@
~Controller();
- /** \brief Start command execution.
+ /**
+ * \brief Start command execution.
*/
template<typename Command>
void
@@ -86,7 +86,8 @@
startCommand(make_shared<Command>(), parameters, onSuccess, onFailure, options);
}
- /** \brief Start dataset fetching.
+ /**
+ * \brief Start dataset fetching.
*/
template<typename Dataset>
std::enable_if_t<std::is_default_constructible<Dataset>::value>
@@ -97,7 +98,8 @@
fetchDataset(make_shared<Dataset>(), onSuccess, onFailure, options);
}
- /** \brief Start dataset fetching.
+ /**
+ * \brief Start dataset fetching.
*/
template<typename Dataset, typename ParamType = typename Dataset::ParamType>
void
@@ -154,19 +156,19 @@
public:
/// Error code for timeout.
- static const uint32_t ERROR_TIMEOUT;
+ static constexpr uint32_t ERROR_TIMEOUT = 10060;
/// Error code for network %Nack.
- static const uint32_t ERROR_NACK;
+ static constexpr uint32_t ERROR_NACK = 10800;
/// Error code for response validation failure.
- static const uint32_t ERROR_VALIDATION;
+ static constexpr uint32_t ERROR_VALIDATION = 10021;
/// Error code for server error.
- static const uint32_t ERROR_SERVER;
+ static constexpr uint32_t ERROR_SERVER = 500;
/// Inclusive lower bound of error codes.
- static const uint32_t ERROR_LBOUND;
+ static constexpr uint32_t ERROR_LBOUND = 400;
protected:
Face& m_face;
diff --git a/ndn-cxx/mgmt/status-dataset-context.cpp b/ndn-cxx/mgmt/status-dataset-context.cpp
index ebb505b..0848a05 100644
--- a/ndn-cxx/mgmt/status-dataset-context.cpp
+++ b/ndn-cxx/mgmt/status-dataset-context.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,7 +24,7 @@
namespace ndn {
namespace mgmt {
-const size_t MAX_PAYLOAD_LENGTH = MAX_NDN_PACKET_SIZE - 800;
+constexpr size_t MAX_PAYLOAD_LENGTH = MAX_NDN_PACKET_SIZE - 800;
StatusDatasetContext::StatusDatasetContext(const Interest& interest,
DataSender dataSender, NackSender nackSender)
diff --git a/ndn-cxx/name.cpp b/ndn-cxx/name.cpp
index a72bd8a..50fd40c 100644
--- a/ndn-cxx/name.cpp
+++ b/ndn-cxx/name.cpp
@@ -47,8 +47,6 @@
static_assert(std::is_base_of<tlv::Error, Name::Error>::value,
"Name::Error must inherit from tlv::Error");
-const size_t Name::npos = std::numeric_limits<size_t>::max();
-
// ---- constructors, encoding, decoding ----
Name::Name()
diff --git a/ndn-cxx/name.hpp b/ndn-cxx/name.hpp
index 4786bc7..98ecb97 100644
--- a/ndn-cxx/name.hpp
+++ b/ndn-cxx/name.hpp
@@ -25,6 +25,7 @@
#include "ndn-cxx/name-component.hpp"
#include <iterator>
+#include <limits>
#include <optional>
namespace ndn {
@@ -704,7 +705,7 @@
/**
* @brief Indicates "until the end" in getSubName() and compare().
*/
- static const size_t npos;
+ static constexpr size_t npos = std::numeric_limits<size_t>::max();
private:
mutable Block m_wire;
diff --git a/ndn-cxx/net/ethernet.hpp b/ndn-cxx/net/ethernet.hpp
index ad79187..ed25834 100644
--- a/ndn-cxx/net/ethernet.hpp
+++ b/ndn-cxx/net/ethernet.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022 Regents of the University of California,
+ * Copyright (c) 2014-2023 Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -36,15 +36,15 @@
namespace ndn {
namespace ethernet {
-const uint16_t ETHERTYPE_NDN = 0x8624;
+inline constexpr uint16_t ETHERTYPE_NDN = 0x8624; ///< The NDN Ethertype
-const size_t ADDR_LEN = 6; ///< Octets in one Ethernet address
-const size_t TYPE_LEN = 2; ///< Octets in Ethertype field
-const size_t HDR_LEN = 14; ///< Total octets in Ethernet header (without 802.1Q tag)
-const size_t TAG_LEN = 4; ///< Octets in 802.1Q tag (TPID + priority + VLAN)
-const size_t MIN_DATA_LEN = 46; ///< Min octets in Ethernet payload (assuming no 802.1Q tag)
-const size_t MAX_DATA_LEN = 1500; ///< Max octets in Ethernet payload
-const size_t CRC_LEN = 4; ///< Octets in Ethernet frame check sequence
+inline constexpr size_t ADDR_LEN = 6; ///< Octets in one Ethernet address
+inline constexpr size_t TYPE_LEN = 2; ///< Octets in Ethertype field
+inline constexpr size_t HDR_LEN = 14; ///< Total octets in Ethernet header (without 802.1Q tag)
+inline constexpr size_t TAG_LEN = 4; ///< Octets in 802.1Q tag (TPID + priority + VLAN)
+inline constexpr size_t MIN_DATA_LEN = 46; ///< Min octets in Ethernet payload (assuming no 802.1Q tag)
+inline constexpr size_t MAX_DATA_LEN = 1500; ///< Max octets in Ethernet payload
+inline constexpr size_t CRC_LEN = 4; ///< Octets in Ethernet frame check sequence
/**
* \brief Represents an Ethernet hardware address.
diff --git a/ndn-cxx/security/additional-description.cpp b/ndn-cxx/security/additional-description.cpp
index 2b332f4..25cde15 100644
--- a/ndn-cxx/security/additional-description.cpp
+++ b/ndn-cxx/security/additional-description.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -35,8 +35,8 @@
static_assert(std::is_base_of<tlv::Error, AdditionalDescription::Error>::value,
"AdditionalDescription::Error must inherit from tlv::Error");
-static const size_t KEY_OFFSET = 0;
-static const size_t VALUE_OFFSET = 1;
+constexpr size_t KEY_OFFSET = 0;
+constexpr size_t VALUE_OFFSET = 1;
AdditionalDescription::AdditionalDescription(const Block& block)
{
diff --git a/ndn-cxx/security/certificate.cpp b/ndn-cxx/security/certificate.cpp
index fdce8ad..f912b4a 100644
--- a/ndn-cxx/security/certificate.cpp
+++ b/ndn-cxx/security/certificate.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -36,16 +36,6 @@
static_assert(std::is_base_of<Data::Error, Certificate::Error>::value,
"Certificate::Error must inherit from Data::Error");
-// /<IdentityName>/KEY/<KeyId>/<IssuerId>/<Version>
-const ssize_t Certificate::VERSION_OFFSET = -1;
-const ssize_t Certificate::ISSUER_ID_OFFSET = -2;
-const ssize_t Certificate::KEY_ID_OFFSET = -3;
-const ssize_t Certificate::KEY_COMPONENT_OFFSET = -4;
-const size_t Certificate::MIN_CERT_NAME_LENGTH = 4;
-const size_t Certificate::MIN_KEY_NAME_LENGTH = 2;
-const name::Component Certificate::KEY_COMPONENT("KEY");
-const name::Component Certificate::DEFAULT_ISSUER_ID("NA");
-
Certificate::Certificate()
{
setContentType(tlv::ContentType_Key);
diff --git a/ndn-cxx/security/certificate.hpp b/ndn-cxx/security/certificate.hpp
index 0578cd5..b533494 100644
--- a/ndn-cxx/security/certificate.hpp
+++ b/ndn-cxx/security/certificate.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -141,23 +141,24 @@
Block
getExtension(uint32_t type) const;
- // @TODO Implement extension enumeration (Issue #3907)
-public:
+ // TODO: Implement extension enumeration (Issue #3907)
+
/**
- * @brief Check if the specified name follows the naming convention for the certificate
+ * @brief Check if the specified name respects the naming conventions for certificates.
*/
static bool
isValidName(const Name& certName);
public:
- static const ssize_t VERSION_OFFSET;
- static const ssize_t ISSUER_ID_OFFSET;
- static const ssize_t KEY_COMPONENT_OFFSET;
- static const ssize_t KEY_ID_OFFSET;
- static const size_t MIN_CERT_NAME_LENGTH;
- static const size_t MIN_KEY_NAME_LENGTH;
- static const name::Component KEY_COMPONENT;
- static const name::Component DEFAULT_ISSUER_ID;
+ // Certificate name structure: /<IdentityName>/KEY/<KeyId>/<IssuerId>/<Version>
+ static constexpr ssize_t VERSION_OFFSET = -1;
+ static constexpr ssize_t ISSUER_ID_OFFSET = -2;
+ static constexpr ssize_t KEY_ID_OFFSET = -3;
+ static constexpr ssize_t KEY_COMPONENT_OFFSET = -4;
+ static constexpr size_t MIN_CERT_NAME_LENGTH = 4;
+ static constexpr size_t MIN_KEY_NAME_LENGTH = 2;
+ static inline const name::Component KEY_COMPONENT{"KEY"};
+ static inline const name::Component DEFAULT_ISSUER_ID{"NA"};
};
std::ostream&
diff --git a/ndn-cxx/security/key-chain.cpp b/ndn-cxx/security/key-chain.cpp
index 98b7080..20e522d 100644
--- a/ndn-cxx/security/key-chain.cpp
+++ b/ndn-cxx/security/key-chain.cpp
@@ -70,7 +70,7 @@
NDN_LOG_INIT(ndn.security.KeyChain);
-const name::Component SELF("self");
+const name::Component SELF{"self"};
KeyChain::PibFactories&
KeyChain::getPibFactories()
diff --git a/ndn-cxx/security/key-params.cpp b/ndn-cxx/security/key-params.cpp
index 817e780..c2bf0a7 100644
--- a/ndn-cxx/security/key-params.cpp
+++ b/ndn-cxx/security/key-params.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -42,14 +42,14 @@
namespace detail {
-const uint32_t MIN_RSA_KEY_SIZE = 2048;
-const uint32_t MAX_RSA_KEY_SIZE = 16384;
-const uint32_t DEFAULT_RSA_KEY_SIZE = 2048;
-const uint32_t EC_KEY_SIZES[] = {224, 256, 384, 521};
-const uint32_t DEFAULT_EC_KEY_SIZE = 256;
-const uint32_t AES_KEY_SIZES[] = {128, 192, 256};
-const uint32_t DEFAULT_AES_KEY_SIZE = 128;
-const uint32_t DEFAULT_HMAC_KEY_SIZE = 256;
+constexpr uint32_t MIN_RSA_KEY_SIZE = 2048;
+constexpr uint32_t MAX_RSA_KEY_SIZE = 16384;
+constexpr uint32_t DEFAULT_RSA_KEY_SIZE = 2048;
+constexpr uint32_t EC_KEY_SIZES[] = {224, 256, 384, 521};
+constexpr uint32_t DEFAULT_EC_KEY_SIZE = 256;
+constexpr uint32_t AES_KEY_SIZES[] = {128, 192, 256};
+constexpr uint32_t DEFAULT_AES_KEY_SIZE = 128;
+constexpr uint32_t DEFAULT_HMAC_KEY_SIZE = 256;
uint32_t
RsaKeyParamsInfo::checkKeySize(uint32_t size)
diff --git a/ndn-cxx/security/security-common.hpp b/ndn-cxx/security/security-common.hpp
index b193746..aedee38 100644
--- a/ndn-cxx/security/security-common.hpp
+++ b/ndn-cxx/security/security-common.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -31,13 +31,13 @@
namespace signed_interest {
-const ssize_t POS_SIG_VALUE = -1;
-const ssize_t POS_SIG_INFO = -2;
+inline constexpr ssize_t POS_SIG_VALUE = -1;
+inline constexpr ssize_t POS_SIG_INFO = -2;
/** \brief Minimum number of name components for an old-style Signed %Interest.
* \sa https://redmine.named-data.net/projects/ndn-cxx/wiki/SignedInterest
*/
-const size_t MIN_SIZE = 2;
+inline constexpr size_t MIN_SIZE = 2;
} // namespace signed_interest
@@ -45,13 +45,13 @@
using signed_interest::POS_SIG_VALUE;
using signed_interest::POS_SIG_INFO;
-const ssize_t POS_RANDOM_VAL = -3;
-const ssize_t POS_TIMESTAMP = -4;
+inline constexpr ssize_t POS_RANDOM_VAL = -3;
+inline constexpr ssize_t POS_TIMESTAMP = -4;
/** \brief Minimum number of name components for a Command %Interest.
* \sa https://redmine.named-data.net/projects/ndn-cxx/wiki/CommandInterest
*/
-const size_t MIN_SIZE = 4;
+inline constexpr size_t MIN_SIZE = 4;
} // namespace command_interest
diff --git a/ndn-cxx/security/transform/stream-source.cpp b/ndn-cxx/security/transform/stream-source.cpp
index 8acf41e..10e5fa6 100644
--- a/ndn-cxx/security/transform/stream-source.cpp
+++ b/ndn-cxx/security/transform/stream-source.cpp
@@ -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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -28,8 +28,6 @@
namespace security {
namespace transform {
-const std::size_t StreamSource::DEFAULT_BUFFER_LEN = 1024;
-
StreamSource::StreamSource(std::istream& is, size_t bufferSize)
: Source()
, m_is(is)
diff --git a/ndn-cxx/security/transform/stream-source.hpp b/ndn-cxx/security/transform/stream-source.hpp
index 2e022ff..886066b 100644
--- a/ndn-cxx/security/transform/stream-source.hpp
+++ b/ndn-cxx/security/transform/stream-source.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -52,7 +52,7 @@
doPump() final;
public:
- static const std::size_t DEFAULT_BUFFER_LEN;
+ static constexpr std::size_t DEFAULT_BUFFER_LEN = 1024;
private:
std::istream& m_is;
diff --git a/ndn-cxx/security/validity-period.cpp b/ndn-cxx/security/validity-period.cpp
index 385c895..22e53dd 100644
--- a/ndn-cxx/security/validity-period.cpp
+++ b/ndn-cxx/security/validity-period.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -33,9 +33,9 @@
static_assert(std::is_base_of<tlv::Error, ValidityPeriod::Error>::value,
"ValidityPeriod::Error must inherit from tlv::Error");
-static const size_t ISO_DATETIME_SIZE = 15;
-static const size_t NOT_BEFORE_OFFSET = 0;
-static const size_t NOT_AFTER_OFFSET = 1;
+constexpr size_t ISO_DATETIME_SIZE = 15;
+constexpr size_t NOT_BEFORE_OFFSET = 0;
+constexpr size_t NOT_AFTER_OFFSET = 1;
using boost::chrono::time_point_cast;
diff --git a/ndn-cxx/util/logging.cpp b/ndn-cxx/util/logging.cpp
index ba20396..d88a1a8 100644
--- a/ndn-cxx/util/logging.cpp
+++ b/ndn-cxx/util/logging.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -75,7 +75,7 @@
} // namespace log
-static const LogLevel INITIAL_DEFAULT_LEVEL = LogLevel::NONE;
+constexpr LogLevel INITIAL_DEFAULT_LEVEL = LogLevel::NONE;
Logging&
Logging::get()
diff --git a/ndn-cxx/util/segment-fetcher.cpp b/ndn-cxx/util/segment-fetcher.cpp
index 60fdc2a..02d566f 100644
--- a/ndn-cxx/util/segment-fetcher.cpp
+++ b/ndn-cxx/util/segment-fetcher.cpp
@@ -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-2023 Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -36,8 +36,6 @@
namespace ndn {
namespace util {
-constexpr double SegmentFetcher::MIN_SSTHRESH;
-
void
SegmentFetcher::Options::validate()
{
diff --git a/ndn-cxx/util/sha256.cpp b/ndn-cxx/util/sha256.cpp
index 1874b1e..c789a7e 100644
--- a/ndn-cxx/util/sha256.cpp
+++ b/ndn-cxx/util/sha256.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -30,8 +30,6 @@
namespace ndn {
namespace util {
-const size_t Sha256::DIGEST_SIZE;
-
Sha256::Sha256()
{
reset();
diff --git a/ndn-cxx/util/sha256.hpp b/ndn-cxx/util/sha256.hpp
index d776d30..76a094e 100644
--- a/ndn-cxx/util/sha256.hpp
+++ b/ndn-cxx/util/sha256.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -22,7 +22,6 @@
#ifndef NDN_CXX_UTIL_SHA256_HPP
#define NDN_CXX_UTIL_SHA256_HPP
-#include "ndn-cxx/encoding/block.hpp"
#include "ndn-cxx/encoding/buffer-stream.hpp"
#include "ndn-cxx/security/transform/step-source.hpp"
@@ -53,7 +52,7 @@
/**
* @brief Length in bytes of a SHA-256 digest.
*/
- static const size_t DIGEST_SIZE = 32;
+ static constexpr size_t DIGEST_SIZE = 32;
/**
* @brief Create an empty SHA-256 digest.
diff --git a/tests/unit/data.t.cpp b/tests/unit/data.t.cpp
index 9b530d6..5162f4d 100644
--- a/tests/unit/data.t.cpp
+++ b/tests/unit/data.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -26,7 +26,6 @@
#include "ndn-cxx/security/transform/signer-filter.hpp"
#include "ndn-cxx/security/transform/step-source.hpp"
#include "ndn-cxx/security/transform/stream-sink.hpp"
-#include "ndn-cxx/security/verification-helpers.hpp"
#include "ndn-cxx/util/sha256.hpp"
#include "ndn-cxx/util/string-helper.hpp"
@@ -113,50 +112,48 @@
security::transform::PublicKey m_pubKey;
private:
- static const uint8_t PRIVATE_KEY_DER[632];
-};
-
-const uint8_t DataSigningKeyFixture::PRIVATE_KEY_DER[] = {
- 0x30, 0x82, 0x02, 0x74, 0x02, 0x01, 0x00, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
- 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x82, 0x02, 0x5e, 0x30, 0x82, 0x02, 0x5a, 0x02, 0x01,
- 0x00, 0x02, 0x81, 0x81, 0x00, 0x9e, 0x06, 0x3e, 0x47, 0x85, 0xb2, 0x34, 0x37, 0xaa, 0x85, 0x47,
- 0xac, 0x03, 0x24, 0x83, 0xb5, 0x9c, 0xa8, 0x05, 0x3a, 0x24, 0x1e, 0xeb, 0x89, 0x01, 0xbb, 0xe9,
- 0x9b, 0xb2, 0xc3, 0x22, 0xac, 0x68, 0xe3, 0xf0, 0x6c, 0x02, 0xce, 0x68, 0xa6, 0xc4, 0xd0, 0xa7,
- 0x06, 0x90, 0x9c, 0xaa, 0x1b, 0x08, 0x1d, 0x8b, 0x43, 0x9a, 0x33, 0x67, 0x44, 0x6d, 0x21, 0xa3,
- 0x1b, 0x88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x57, 0xd5, 0x97,
- 0x4b, 0x65, 0x41, 0x86, 0x66, 0xc2, 0x26, 0x80, 0x1e, 0x3e, 0x55, 0x3e, 0x88, 0x63, 0xe2, 0x66,
- 0x03, 0x47, 0x31, 0xd8, 0xa2, 0x4e, 0x68, 0x45, 0x24, 0x0a, 0xca, 0x17, 0x61, 0xd5, 0x69, 0xca,
- 0x78, 0xab, 0x21, 0x02, 0x41, 0x00, 0x8f, 0xae, 0x7b, 0x4d, 0x00, 0xc7, 0x06, 0x92, 0xf0, 0x24,
- 0x9a, 0x83, 0x84, 0xbd, 0x62, 0x81, 0xbc, 0x2c, 0x27, 0x60, 0x2c, 0x0c, 0x33, 0xe5, 0x66, 0x1d,
- 0x28, 0xd9, 0x10, 0x1a, 0x7f, 0x4f, 0xea, 0x4f, 0x78, 0x6d, 0xb0, 0x14, 0xbf, 0xc9, 0xff, 0x17,
- 0xd6, 0x47, 0x4d, 0x4a, 0xa8, 0xf4, 0x39, 0x67, 0x3e, 0xb1, 0xec, 0x8f, 0xf1, 0x71, 0xbd, 0xb8,
- 0xa7, 0x50, 0x3d, 0xc7, 0xf7, 0xbb, 0x02, 0x40, 0x0d, 0x85, 0x32, 0x73, 0x9f, 0x0a, 0x33, 0x2f,
- 0x4b, 0xa2, 0xbd, 0xd1, 0xb1, 0x42, 0xf0, 0x72, 0xa8, 0x7a, 0xc8, 0x15, 0x37, 0x1b, 0xde, 0x76,
- 0x70, 0xce, 0xfd, 0x69, 0x20, 0x00, 0x4d, 0xc9, 0x4f, 0x35, 0x6f, 0xd1, 0x35, 0xa1, 0x04, 0x95,
- 0x30, 0xe8, 0x3b, 0xd5, 0x03, 0x5a, 0x50, 0x21, 0x6d, 0xa0, 0x84, 0x39, 0xe9, 0x2e, 0x1e, 0xfc,
- 0xe4, 0x82, 0x43, 0x20, 0x46, 0x7d, 0x0a, 0xb6
+ static constexpr uint8_t PRIVATE_KEY_DER[] = {
+ 0x30, 0x82, 0x02, 0x74, 0x02, 0x01, 0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xa8, 0xf4, 0x39, 0x67, 0x3e, 0xb1, 0xec, 0x8f, 0xf1, 0x71, 0xbd, 0xb8,
+ 0xa7, 0x50, 0x3d, 0xc7, 0xf7, 0xbb, 0x02, 0x40, 0x0d, 0x85, 0x32, 0x73, 0x9f, 0x0a, 0x33, 0x2f,
+ 0x4b, 0xa2, 0xbd, 0xd1, 0xb1, 0x42, 0xf0, 0x72, 0xa8, 0x7a, 0xc8, 0x15, 0x37, 0x1b, 0xde, 0x76,
+ 0x70, 0xce, 0xfd, 0x69, 0x20, 0x00, 0x4d, 0xc9, 0x4f, 0x35, 0x6f, 0xd1, 0x35, 0xa1, 0x04, 0x95,
+ 0x30, 0xe8, 0x3b, 0xd5, 0x03, 0x5a, 0x50, 0x21, 0x6d, 0xa0, 0x84, 0x39, 0xe9, 0x2e, 0x1e, 0xfc,
+ 0xe4, 0x82, 0x43, 0x20, 0x46, 0x7d, 0x0a, 0xb6,
+ };
};
BOOST_AUTO_TEST_SUITE(Encode)
diff --git a/tests/unit/security/transform/public-key.t.cpp b/tests/unit/security/transform/public-key.t.cpp
index e37cda5..655811c 100644
--- a/tests/unit/security/transform/public-key.t.cpp
+++ b/tests/unit/security/transform/public-key.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -54,8 +54,6 @@
"9rH58ynaAix0tcR/nBMRLUX+e3rURHg6UbSjJbdb9qmKM1fTGHKUzL/5pMG6uBU0\n"
"ywIDAQAB\n";
};
-constexpr KeyType RsaKeyTestData::type;
-constexpr size_t RsaKeyTestData::size;
struct EcKeyTestData
{
@@ -70,8 +68,6 @@
"//////////+85vqtpxeehPO5ysL8YyVRAgEBA0IABGhuFibgwLdEJBDOLdvSg1Hc\n"
"5EJTDxq6ls5FoYLfThp8HOjuwGSz0qw8ocMqyku1y0V5peQ4rEPd0bwcpZd9svA=\n";
};
-constexpr KeyType EcKeyTestData::type;
-constexpr size_t EcKeyTestData::size;
using KeyTestDataSets = boost::mpl::vector<RsaKeyTestData, EcKeyTestData>;
diff --git a/tests/unit/security/validator-fixture.cpp b/tests/unit/security/validator-fixture.cpp
index 8579fc8..0e780b4 100644
--- a/tests/unit/security/validator-fixture.cpp
+++ b/tests/unit/security/validator-fixture.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -28,9 +28,6 @@
inline namespace v2 {
namespace tests {
-const time::milliseconds ValidatorFixtureBase::s_mockPeriod{250};
-const int ValidatorFixtureBase::s_mockTimes = 200;
-
ValidatorFixtureBase::ValidatorFixtureBase()
{
processInterest = [this] (const Interest& interest) {
diff --git a/tests/unit/security/validator-fixture.hpp b/tests/unit/security/validator-fixture.hpp
index 7e1e0b5..39e4ed3 100644
--- a/tests/unit/security/validator-fixture.hpp
+++ b/tests/unit/security/validator-fixture.hpp
@@ -69,8 +69,8 @@
ValidationError lastError{ValidationError::NO_ERROR};
private:
- static const time::milliseconds s_mockPeriod;
- static const int s_mockTimes;
+ static constexpr time::milliseconds s_mockPeriod{250};
+ static constexpr int s_mockTimes{200};
};
template<class ValidationPolicyT, class CertificateFetcherT = CertificateFetcherFromNetwork>