Refactor and modernize namespace declarations
* Completely remove inline namespace v2
* Flatten some unnecessarily deep namespace nesting
* Move DummyClientFace, Segmenter, SegmentFetcher to namespace ndn
* Move all unit tests to namespace ndn::tests
Change-Id: I8bcfcf9fd669936a3277d2d5d505f765b4b05742
diff --git a/docs/code-style.rst b/docs/code-style.rst
index 2baac21..738e20c 100644
--- a/docs/code-style.rst
+++ b/docs/code-style.rst
@@ -3,11 +3,11 @@
Based on
-* "C++ Programming Style Guidelines" by Geotechnical Software Services, Copyright © 1996 – 2011.
- The original document is available at `<http://geosoft.no/development/cppstyle.html>`_
+* "C++ Programming Style Guidelines" by Geotechnical Software Services, Copyright © 1996-2011.
+ The original document is available at `<http://geosoft.no/development/cppstyle.html>`__
* NDN Platform "C++, C, C#, Java and JavaScript Code Guidelines".
- The original document is available at `<https://named-data.net/codebase/platform/documentation/ndn-platform-development-guidelines/cpp-code-guidelines/>`_
+ The original document is available at `<https://named-data.net/codebase/platform/documentation/ndn-platform-development-guidelines/cpp-code-guidelines/>`__
1. Code layout
--------------
@@ -52,11 +52,11 @@
} // namespace example
- Note that code inside namespace is **not** indented. Avoid the following:
+ Note that code inside the namespace is **not** indented. Avoid the following:
.. code-block:: c++
- // NOT
+ // WRONG
//
// namespace example {
//
@@ -479,13 +479,11 @@
.. code-block:: c++
- namespace model {
- namespace analyzer {
+ namespace model::analyzer {
...
- } // namespace analyzer
- } // namespace model
+ } // namespace model::analyzer
2.7. Names representing generic template types should be a single uppercase letter.
diff --git a/docs/doxygen.conf.in b/docs/doxygen.conf.in
index c48312c..afcd331 100644
--- a/docs/doxygen.conf.in
+++ b/docs/doxygen.conf.in
@@ -1739,16 +1739,6 @@
LATEX_HIDE_INDICES = NO
-# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
-# code with syntax highlighting in the LaTeX output.
-#
-# Note that which sources are shown also depends on other settings such as
-# SOURCE_BROWSER.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_SOURCE_CODE = NO
-
# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
# bibliography, e.g. plainnat, or ieeetr. See
# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
@@ -1821,16 +1811,6 @@
RTF_EXTENSIONS_FILE =
-# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code
-# with syntax highlighting in the RTF output.
-#
-# Note that which sources are shown also depends on other settings such as
-# SOURCE_BROWSER.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_SOURCE_CODE = NO
-
#---------------------------------------------------------------------------
# Configuration options related to the man page output
#---------------------------------------------------------------------------
@@ -1920,15 +1900,6 @@
DOCBOOK_OUTPUT = docbook
-# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the
-# program listings (including syntax highlighting and cross-referencing
-# information) to the DOCBOOK output. Note that enabling this will significantly
-# increase the size of the DOCBOOK output.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
-
-DOCBOOK_PROGRAMLISTING = NO
-
#---------------------------------------------------------------------------
# Configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
@@ -2119,15 +2090,6 @@
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
-# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram
-# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
-# NO turns the diagrams off. Note that this option also works with HAVE_DOT
-# disabled, but it is recommended to install and use dot, since it yields more
-# powerful graphs.
-# The default value is: YES.
-
-CLASS_DIAGRAMS = YES
-
# You can include diagrams made with dia in doxygen documentation. Doxygen will
# then run dia to produce the diagram and insert it in the documentation. The
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
diff --git a/docs/release-notes/release-notes-0.2.0.rst b/docs/release-notes/release-notes-0.2.0.rst
index 5d804bf..89d7c08 100644
--- a/docs/release-notes/release-notes-0.2.0.rst
+++ b/docs/release-notes/release-notes-0.2.0.rst
@@ -66,7 +66,7 @@
+ Introduce ``util::EventEmitter``, :ndn-cxx:`util::NotificationSubscriber`,
:ndn-cxx:`util::NotificationStream`, and :ndn-cxx:`nfd::FaceMonitor` utility classes
- + Introduce :ndn-cxx:`util::SegmentFetcher` helper class to fetch multi-segmented data
+ + Introduce :ndn-cxx:`SegmentFetcher` helper class to fetch multi-segmented data
(:issue:`1879`)
- **Build**
diff --git a/docs/release-notes/release-notes-0.5.1.rst b/docs/release-notes/release-notes-0.5.1.rst
index 8108300..2ba1ec1 100644
--- a/docs/release-notes/release-notes-0.5.1.rst
+++ b/docs/release-notes/release-notes-0.5.1.rst
@@ -63,27 +63,27 @@
Deprecated
^^^^^^^^^^
-- Old security framework. All old security framework classes are moved to
+- Old security framework. All old security framework classes are moved to the
``ndn::security::v1`` namespace in this release and will be removed in the next release.
- * ``v1::KeyChain``, use :ndn-cxx:`v2::KeyChain` instead
+ * ``v1::KeyChain``; use ``v2::KeyChain`` instead.
* ``v1::Validator`` interface and all implementations of this interface (``ValidatorRegex``,
- ``ValidatorConfig``, ``ValidatorNull``). Use :ndn-cxx:`v2::Validator` and the
- corresponding implementations of :ndn-cxx:`ValidationPolicy` interfaces (will be introduced
- before 0.6.0 release).
+ ``ValidatorConfig``, ``ValidatorNull``). Use ``v2::Validator`` and the corresponding
+ implementations of :ndn-cxx:`ValidationPolicy` interfaces (will be introduced before
+ the 0.6.0 release).
* ``v1::SecPublicInfo`` and its implementation (``SecPublicInfoSqlite``), ``SecTpm`` and its
implementations (``SecTpmFile``, ``SecTpmOsx``). These classes are internal implementation
- and not intended to be used without ``v1::KeyChain``. :ndn-cxx:`v2::KeyChain` internally
- uses the newly introduced :ndn-cxx:`Pib` and :ndn-cxx:`Tpm` interfaces with their
- corresponding implementations.
+ and not intended to be used without ``v1::KeyChain``. ``v2::KeyChain`` internally uses
+ the newly introduced :ndn-cxx:`Pib` and :ndn-cxx:`Tpm` interfaces with their corresponding
+ implementations.
* ``v1::Certificate``, ``v1::IdentityCertificate``, ``v1::CertificateExtension``,
- ``v1::CertificateSubjectDescription``, use :ndn-cxx:`v2::Certificate` and
- :ndn-cxx:`AdditionalDescription`
+ ``v1::CertificateSubjectDescription``; use ``v2::Certificate`` and ``AdditionalDescription``
+ instead.
- * ``v1::SecuredBag``, use ``v2::SafeBag`` instead
+ * ``v1::SecuredBag``; use :ndn-cxx:`SafeBag` instead.
- Constant ``io::BASE_64``, use ``io::BASE64`` instead (:issue:`3741`)
diff --git a/docs/release-notes/release-notes-0.6.0.rst b/docs/release-notes/release-notes-0.6.0.rst
index 904eb1d..f5d7766 100644
--- a/docs/release-notes/release-notes-0.6.0.rst
+++ b/docs/release-notes/release-notes-0.6.0.rst
@@ -102,23 +102,23 @@
- Old security framework.
- * ``v1::KeyChain``, use :ndn-cxx:`v2::KeyChain` instead
+ * ``v1::KeyChain``; use :ndn-cxx:`KeyChain` instead.
* ``v1::Validator`` interface and ``ValidatorRegex`` implementation of this
interface. ``ValidatorConfig``, ``ValidatorNull`` implementation refactored to be based on
the new validation framework.
* ``v1::SecPublicInfo`` and its implementation (``SecPublicInfoSqlite``), ``SecTpm`` and its
- implementations (``SecTpmFile``, ``SecTpmOsx``). These classes are internal implementation
- and not intended to be used without ``v1::KeyChain``. :ndn-cxx:`v2::KeyChain` internally
+ implementations (``SecTpmFile``, ``SecTpmOsx``). These classes are internal implementation
+ and not intended to be used without ``v1::KeyChain``. The new :ndn-cxx:`KeyChain` internally
uses the newly introduced :ndn-cxx:`Pib` and :ndn-cxx:`Tpm` interfaces with their
corresponding implementations.
* ``v1::Certificate``, ``v1::IdentityCertificate``, ``v1::CertificateExtension``,
- ``v1::CertificateSubjectDescription``, use :ndn-cxx:`v2::Certificate` and
- :ndn-cxx:`AdditionalDescription`
+ ``v1::CertificateSubjectDescription``; use the new :ndn-cxx:`Certificate` and
+ :ndn-cxx:`AdditionalDescription` instead.
- * ``v1::SecuredBag``, use ``v2::SafeBag`` instead
+ * ``v1::SecuredBag``; use :ndn-cxx:`SafeBag` instead.
- Constant ``io::BASE_64``, use ``io::BASE64`` instead (:issue:`3741`)
diff --git a/ndn-cxx/detail/asio-fwd.hpp b/ndn-cxx/detail/asio-fwd.hpp
index b90d23b..a0648a1 100644
--- a/ndn-cxx/detail/asio-fwd.hpp
+++ b/ndn-cxx/detail/asio-fwd.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,8 +24,7 @@
#include <boost/version.hpp>
-namespace boost {
-namespace asio {
+namespace boost::asio {
#if BOOST_VERSION >= 106600
class io_context;
@@ -34,7 +33,6 @@
class io_service;
#endif // BOOST_VERSION >= 106600
-} // namespace asio
-} // namespace boost
+} // namespace boost::asio
#endif // NDN_CXX_DETAIL_ASIO_FWD_HPP
diff --git a/ndn-cxx/detail/cancel-handle.cpp b/ndn-cxx/detail/cancel-handle.cpp
index 4ce807c..b07ecca 100644
--- a/ndn-cxx/detail/cancel-handle.cpp
+++ b/ndn-cxx/detail/cancel-handle.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).
*
@@ -21,8 +21,7 @@
#include "ndn-cxx/detail/cancel-handle.hpp"
-namespace ndn {
-namespace detail {
+namespace ndn::detail {
void
CancelHandle::cancel() const
@@ -33,5 +32,4 @@
}
}
-} // namespace detail
-} // namespace ndn
+} // namespace ndn::detail
diff --git a/ndn-cxx/detail/cancel-handle.hpp b/ndn-cxx/detail/cancel-handle.hpp
index a7207a7..65dc110 100644
--- a/ndn-cxx/detail/cancel-handle.hpp
+++ b/ndn-cxx/detail/cancel-handle.hpp
@@ -24,10 +24,13 @@
#include "ndn-cxx/detail/common.hpp"
-namespace ndn {
-namespace detail {
+/**
+ * \brief Contains implementation details that are not part of the ndn-cxx public API.
+ */
+namespace ndn::detail {
-/** \brief Handle to cancel an operation.
+/**
+ * \brief Handle to cancel an operation.
*/
class CancelHandle
{
@@ -52,7 +55,8 @@
inline
CancelHandle::CancelHandle() noexcept = default;
-/** \brief Cancels an operation automatically upon destruction.
+/**
+ * \brief Cancels an operation automatically upon destruction.
*/
template<typename HandleT>
class ScopedCancelHandle
@@ -133,7 +137,6 @@
template<typename T>
ScopedCancelHandle<T>::ScopedCancelHandle() noexcept = default;
-} // namespace detail
-} // namespace ndn
+} // namespace ndn::detail
#endif // NDN_CXX_DETAIL_CANCEL_HANDLE_HPP
diff --git a/ndn-cxx/detail/cf-releaser-osx.hpp b/ndn-cxx/detail/cf-releaser-osx.hpp
index 156e7a4..4ff6b66 100644
--- a/ndn-cxx/detail/cf-releaser-osx.hpp
+++ b/ndn-cxx/detail/cf-releaser-osx.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -30,8 +30,7 @@
#include <CoreFoundation/CoreFoundation.h>
-namespace ndn {
-namespace detail {
+namespace ndn::detail {
/**
* @brief Helper class to wrap CoreFoundation object pointers
@@ -145,7 +144,6 @@
T m_typeRef;
};
-} // namespace detail
-} // namespace ndn
+} // namespace ndn::detail
#endif // NDN_CXX_DETAIL_CF_RELEASER_OSX_HPP
diff --git a/ndn-cxx/detail/cf-string-osx.cpp b/ndn-cxx/detail/cf-string-osx.cpp
index 5cceb33..1459f81 100644
--- a/ndn-cxx/detail/cf-string-osx.cpp
+++ b/ndn-cxx/detail/cf-string-osx.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).
*
@@ -21,9 +21,7 @@
#include "ndn-cxx/detail/cf-string-osx.hpp"
-namespace ndn {
-namespace detail {
-namespace cfstring {
+namespace ndn::detail::cfstring {
CFReleaser<CFStringRef>
fromBuffer(const uint8_t* buf, size_t buflen)
@@ -66,6 +64,4 @@
return str;
}
-} // namespace cfstring
-} // namespace detail
-} // namespace ndn
+} // namespace ndn::detail::cfstring
diff --git a/ndn-cxx/detail/cf-string-osx.hpp b/ndn-cxx/detail/cf-string-osx.hpp
index 6be2499..4cabdcb 100644
--- a/ndn-cxx/detail/cf-string-osx.hpp
+++ b/ndn-cxx/detail/cf-string-osx.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -36,9 +36,7 @@
* This file contains utilities to deal with Apple Core Foundation's CFString and related types.
*/
-namespace ndn {
-namespace detail {
-namespace cfstring {
+namespace ndn::detail::cfstring {
/**
* @brief Create a CFString by copying bytes from a raw buffer
@@ -61,8 +59,6 @@
std::string
toStdString(CFStringRef cfStr);
-} // namespace cfstring
-} // namespace detail
-} // namespace ndn
+} // namespace ndn::detail::cfstring
#endif // NDN_CXX_DETAIL_CF_STRING_OSX_HPP
diff --git a/ndn-cxx/encoding/block-helpers.cpp b/ndn-cxx/encoding/block-helpers.cpp
index a4b5e8d..bf53c86 100644
--- a/ndn-cxx/encoding/block-helpers.cpp
+++ b/ndn-cxx/encoding/block-helpers.cpp
@@ -23,8 +23,7 @@
#include <boost/endian/conversion.hpp>
-namespace ndn {
-namespace encoding {
+namespace ndn::encoding {
namespace endian = boost::endian;
@@ -220,5 +219,4 @@
template size_t
prependBlock<EncoderTag>(EncodingImpl<EncoderTag>&, const Block&);
-} // namespace encoding
-} // namespace ndn
+} // namespace ndn::encoding
diff --git a/ndn-cxx/encoding/block.hpp b/ndn-cxx/encoding/block.hpp
index c9cf885..f43d085 100644
--- a/ndn-cxx/encoding/block.hpp
+++ b/ndn-cxx/encoding/block.hpp
@@ -29,11 +29,9 @@
#include "ndn-cxx/encoding/tlv.hpp"
#include "ndn-cxx/util/span.hpp"
-namespace boost {
-namespace asio {
+namespace boost::asio {
class const_buffer;
-} // namespace asio
-} // namespace boost
+} // namespace boost::asio
namespace ndn {
diff --git a/ndn-cxx/encoding/encoder.cpp b/ndn-cxx/encoding/encoder.cpp
index bd39970..883d272 100644
--- a/ndn-cxx/encoding/encoder.cpp
+++ b/ndn-cxx/encoding/encoder.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).
*
@@ -23,8 +23,7 @@
#include <boost/endian/conversion.hpp>
-namespace ndn {
-namespace encoding {
+namespace ndn::encoding {
namespace endian = boost::endian;
@@ -200,5 +199,4 @@
}
}
-} // namespace encoding
-} // namespace ndn
+} // namespace ndn::encoding
diff --git a/ndn-cxx/encoding/encoder.hpp b/ndn-cxx/encoding/encoder.hpp
index 7b4e2d8..1d45314 100644
--- a/ndn-cxx/encoding/encoder.hpp
+++ b/ndn-cxx/encoding/encoder.hpp
@@ -26,8 +26,7 @@
#include <algorithm>
-namespace ndn {
-namespace encoding {
+namespace ndn::encoding {
/**
* @brief Helper class to perform TLV encoding.
@@ -278,7 +277,6 @@
return length;
}
-} // namespace encoding
-} // namespace ndn
+} // namespace ndn::encoding
#endif // NDN_CXX_ENCODING_ENCODER_HPP
diff --git a/ndn-cxx/encoding/encoding-buffer.hpp b/ndn-cxx/encoding/encoding-buffer.hpp
index 01471c6..20b8182 100644
--- a/ndn-cxx/encoding/encoding-buffer.hpp
+++ b/ndn-cxx/encoding/encoding-buffer.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -26,8 +26,7 @@
#include "ndn-cxx/encoding/encoder.hpp"
#include "ndn-cxx/encoding/estimator.hpp"
-namespace ndn {
-namespace encoding {
+namespace ndn::encoding {
/**
* @brief EncodingImpl specialization for actual TLV encoding
@@ -62,7 +61,6 @@
}
};
-} // namespace encoding
-} // namespace ndn
+} // namespace ndn::encoding
#endif // NDN_CXX_ENCODING_ENCODING_BUFFER_HPP
diff --git a/ndn-cxx/encoding/estimator.hpp b/ndn-cxx/encoding/estimator.hpp
index 5276a7d..56fa322 100644
--- a/ndn-cxx/encoding/estimator.hpp
+++ b/ndn-cxx/encoding/estimator.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).
*
@@ -24,8 +24,7 @@
#include "ndn-cxx/encoding/block.hpp"
-namespace ndn {
-namespace encoding {
+namespace ndn::encoding {
/**
* @brief Helper class to estimate size of TLV encoding.
@@ -112,7 +111,6 @@
}
};
-} // namespace encoding
-} // namespace ndn
+} // namespace ndn::encoding
#endif // NDN_CXX_ENCODING_ESTIMATOR_HPP
diff --git a/ndn-cxx/encoding/nfd-constants.cpp b/ndn-cxx/encoding/nfd-constants.cpp
index 28c842a..c6f5a58 100644
--- a/ndn-cxx/encoding/nfd-constants.cpp
+++ b/ndn-cxx/encoding/nfd-constants.cpp
@@ -29,8 +29,7 @@
#include <map>
#include <ostream>
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
std::ostream&
operator<<(std::ostream& os, FaceScope faceScope)
@@ -196,5 +195,4 @@
return os;
}
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
diff --git a/ndn-cxx/encoding/nfd-constants.hpp b/ndn-cxx/encoding/nfd-constants.hpp
index 55f1b7b..55e2905 100644
--- a/ndn-cxx/encoding/nfd-constants.hpp
+++ b/ndn-cxx/encoding/nfd-constants.hpp
@@ -26,8 +26,7 @@
#include <iosfwd>
#include <limits>
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
inline constexpr uint64_t INVALID_FACE_ID = 0;
@@ -131,7 +130,6 @@
std::ostream&
operator<<(std::ostream& os, RouteFlags routeFlags);
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
#endif // NDN_CXX_ENCODING_NFD_CONSTANTS_HPP
diff --git a/ndn-cxx/encoding/tlv-nfd.hpp b/ndn-cxx/encoding/tlv-nfd.hpp
index 100dd93..f22fd96 100644
--- a/ndn-cxx/encoding/tlv-nfd.hpp
+++ b/ndn-cxx/encoding/tlv-nfd.hpp
@@ -24,9 +24,7 @@
#include <cstdint>
-namespace ndn {
-namespace tlv {
-namespace nfd {
+namespace ndn::tlv::nfd {
/**
* @brief TLV-TYPE numbers defined by the NFD Management protocol.
@@ -105,8 +103,6 @@
Route = 129,
};
-} // namespace nfd
-} // namespace tlv
-} // namespace ndn
+} // namespace ndn::tlv::nfd
#endif // NDN_CXX_ENCODING_TLV_NFD_HPP
diff --git a/ndn-cxx/encoding/tlv-security.hpp b/ndn-cxx/encoding/tlv-security.hpp
index be13371..93a11cf 100644
--- a/ndn-cxx/encoding/tlv-security.hpp
+++ b/ndn-cxx/encoding/tlv-security.hpp
@@ -24,9 +24,7 @@
#include <cstdint>
-namespace ndn {
-namespace tlv {
-namespace security {
+namespace ndn::tlv::security {
/**
* @brief TLV-TYPE numbers for SafeBag and related elements.
@@ -37,8 +35,6 @@
EncryptedKey = 129,
};
-} // namespace security
-} // namespace tlv
-} // namespace ndn
+} // namespace ndn::tlv::security
#endif // NDN_CXX_ENCODING_TLV_SECURITY_HPP
diff --git a/ndn-cxx/encoding/tlv.cpp b/ndn-cxx/encoding/tlv.cpp
index a091914..0487998 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-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).
*
@@ -21,8 +21,9 @@
#include "ndn-cxx/encoding/tlv.hpp"
-namespace ndn {
-namespace tlv {
+#include <ostream>
+
+namespace ndn::tlv {
Error::Error(const char* expectedType, uint32_t actualType)
: Error("Expecting "s + expectedType + " element, but TLV has type " + to_string(actualType))
@@ -81,5 +82,55 @@
return os << static_cast<uint32_t>(ct) << ')';
}
-} // namespace tlv
-} // namespace ndn
+size_t
+writeVarNumber(std::ostream& os, uint64_t number)
+{
+ if (number < 253) {
+ os.put(static_cast<char>(number));
+ return 1;
+ }
+ else if (number <= std::numeric_limits<uint16_t>::max()) {
+ os.put(static_cast<char>(253));
+ uint16_t value = boost::endian::native_to_big(static_cast<uint16_t>(number));
+ os.write(reinterpret_cast<const char*>(&value), 2);
+ return 3;
+ }
+ else if (number <= std::numeric_limits<uint32_t>::max()) {
+ os.put(static_cast<char>(254));
+ uint32_t value = boost::endian::native_to_big(static_cast<uint32_t>(number));
+ os.write(reinterpret_cast<const char*>(&value), 4);
+ return 5;
+ }
+ else {
+ os.put(static_cast<char>(255));
+ uint64_t value = boost::endian::native_to_big(number);
+ os.write(reinterpret_cast<const char*>(&value), 8);
+ return 9;
+ }
+}
+
+size_t
+writeNonNegativeInteger(std::ostream& os, uint64_t integer)
+{
+ if (integer <= std::numeric_limits<uint8_t>::max()) {
+ os.put(static_cast<char>(integer));
+ return 1;
+ }
+ else if (integer <= std::numeric_limits<uint16_t>::max()) {
+ uint16_t value = boost::endian::native_to_big(static_cast<uint16_t>(integer));
+ os.write(reinterpret_cast<const char*>(&value), 2);
+ return 2;
+ }
+ else if (integer <= std::numeric_limits<uint32_t>::max()) {
+ uint32_t value = boost::endian::native_to_big(static_cast<uint32_t>(integer));
+ os.write(reinterpret_cast<const char*>(&value), 4);
+ return 4;
+ }
+ else {
+ uint64_t value = boost::endian::native_to_big(integer);
+ os.write(reinterpret_cast<const char*>(&value), 8);
+ return 8;
+ }
+}
+
+} // namespace ndn::tlv
diff --git a/ndn-cxx/encoding/tlv.hpp b/ndn-cxx/encoding/tlv.hpp
index 12bc854..86678ff 100644
--- a/ndn-cxx/encoding/tlv.hpp
+++ b/ndn-cxx/encoding/tlv.hpp
@@ -27,7 +27,6 @@
#include <cstring>
#include <iterator>
#include <limits>
-#include <ostream>
#include <vector>
#include <boost/endian/conversion.hpp>
@@ -411,33 +410,6 @@
number <= std::numeric_limits<uint32_t>::max() ? 5 : 9;
}
-inline size_t
-writeVarNumber(std::ostream& os, uint64_t number)
-{
- if (number < 253) {
- os.put(static_cast<char>(number));
- return 1;
- }
- else if (number <= std::numeric_limits<uint16_t>::max()) {
- os.put(static_cast<char>(253));
- uint16_t value = boost::endian::native_to_big(static_cast<uint16_t>(number));
- os.write(reinterpret_cast<const char*>(&value), 2);
- return 3;
- }
- else if (number <= std::numeric_limits<uint32_t>::max()) {
- os.put(static_cast<char>(254));
- uint32_t value = boost::endian::native_to_big(static_cast<uint32_t>(number));
- os.write(reinterpret_cast<const char*>(&value), 4);
- return 5;
- }
- else {
- os.put(static_cast<char>(255));
- uint64_t value = boost::endian::native_to_big(number);
- os.write(reinterpret_cast<const char*>(&value), 8);
- return 9;
- }
-}
-
template<typename Iterator>
constexpr uint64_t
readNonNegativeInteger(size_t len, Iterator& begin, Iterator end)
@@ -463,30 +435,6 @@
integer <= std::numeric_limits<uint32_t>::max() ? 4 : 8;
}
-inline size_t
-writeNonNegativeInteger(std::ostream& os, uint64_t integer)
-{
- if (integer <= std::numeric_limits<uint8_t>::max()) {
- os.put(static_cast<char>(integer));
- return 1;
- }
- else if (integer <= std::numeric_limits<uint16_t>::max()) {
- uint16_t value = boost::endian::native_to_big(static_cast<uint16_t>(integer));
- os.write(reinterpret_cast<const char*>(&value), 2);
- return 2;
- }
- else if (integer <= std::numeric_limits<uint32_t>::max()) {
- uint32_t value = boost::endian::native_to_big(static_cast<uint32_t>(integer));
- os.write(reinterpret_cast<const char*>(&value), 4);
- return 4;
- }
- else {
- uint64_t value = boost::endian::native_to_big(integer);
- os.write(reinterpret_cast<const char*>(&value), 8);
- return 8;
- }
-}
-
} // namespace tlv
} // namespace ndn
diff --git a/ndn-cxx/impl/face-impl.hpp b/ndn-cxx/impl/face-impl.hpp
index 750e804..54b1ffe 100644
--- a/ndn-cxx/impl/face-impl.hpp
+++ b/ndn-cxx/impl/face-impl.hpp
@@ -35,7 +35,6 @@
#include "ndn-cxx/transport/unix-transport.hpp"
#include "ndn-cxx/util/logger.hpp"
#include "ndn-cxx/util/scheduler.hpp"
-#include "ndn-cxx/util/signal.hpp"
NDN_LOG_INIT(ndn.Face);
// INFO level: prefix registration, etc.
diff --git a/ndn-cxx/impl/name-component-types.hpp b/ndn-cxx/impl/name-component-types.hpp
index 6f63031..76bb419 100644
--- a/ndn-cxx/impl/name-component-types.hpp
+++ b/ndn-cxx/impl/name-component-types.hpp
@@ -29,8 +29,7 @@
#include <array>
#include <unordered_map>
-namespace ndn {
-namespace name {
+namespace ndn::name {
namespace {
/**
@@ -398,7 +397,6 @@
}
} // namespace
-} // namespace name
-} // namespace ndn
+} // namespace ndn::name
#endif // NDN_CXX_IMPL_NAME_COMPONENT_TYPES_HPP
diff --git a/ndn-cxx/impl/record-container.hpp b/ndn-cxx/impl/record-container.hpp
index 791b0a2..be8a6ef 100644
--- a/ndn-cxx/impl/record-container.hpp
+++ b/ndn-cxx/impl/record-container.hpp
@@ -27,8 +27,7 @@
#include <atomic>
-namespace ndn {
-namespace detail {
+namespace ndn::detail {
using RecordId = uint64_t;
@@ -92,7 +91,7 @@
/**
* \brief Insert a record with given ID.
*/
- template<typename ...TArgs>
+ template<typename... TArgs>
Record&
put(RecordId id, TArgs&&... args)
{
@@ -115,7 +114,7 @@
/**
* \brief Insert a record with newly assigned ID.
*/
- template<typename ...TArgs>
+ template<typename... TArgs>
Record&
insert(TArgs&&... args)
{
@@ -189,14 +188,13 @@
public:
/** \brief Signals when container becomes empty
*/
- util::Signal<RecordContainer<T>> onEmpty;
+ signal::Signal<RecordContainer<T>> onEmpty;
private:
Container m_container;
std::atomic<RecordId> m_lastId{0};
};
-} // namespace detail
-} // namespace ndn
+} // namespace ndn::detail
#endif // NDN_CXX_IMPL_RECORD_CONTAINER_HPP
diff --git a/ndn-cxx/ims/in-memory-storage-fifo.hpp b/ndn-cxx/ims/in-memory-storage-fifo.hpp
index 50e5cf9..cc59acf 100644
--- a/ndn-cxx/ims/in-memory-storage-fifo.hpp
+++ b/ndn-cxx/ims/in-memory-storage-fifo.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -64,23 +64,20 @@
class byArrival;
class byEntity;
- typedef boost::multi_index_container<
+ using CleanupIndex = boost::multi_index_container<
InMemoryStorageEntry*,
boost::multi_index::indexed_by<
-
// by Entry itself
boost::multi_index::hashed_unique<
boost::multi_index::tag<byEntity>,
boost::multi_index::identity<InMemoryStorageEntry*>
>,
-
// by arrival (FIFO)
boost::multi_index::sequenced<
boost::multi_index::tag<byArrival>
>
-
>
- > CleanupIndex;
+ >;
CleanupIndex m_cleanupIndex;
};
diff --git a/ndn-cxx/ims/in-memory-storage-lfu.hpp b/ndn-cxx/ims/in-memory-storage-lfu.hpp
index 6c6ebfb..cc8e7dc 100644
--- a/ndn-cxx/ims/in-memory-storage-lfu.hpp
+++ b/ndn-cxx/ims/in-memory-storage-lfu.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -91,25 +91,22 @@
class byFrequency;
class byEntity;
- typedef boost::multi_index_container<
+ using CleanupIndex = boost::multi_index_container<
CleanupEntry,
boost::multi_index::indexed_by<
-
// by Entry itself
boost::multi_index::hashed_unique<
boost::multi_index::tag<byEntity>,
boost::multi_index::member<CleanupEntry, InMemoryStorageEntry*, &CleanupEntry::entry>
>,
-
// by frequency (LFU)
boost::multi_index::ordered_non_unique<
boost::multi_index::tag<byFrequency>,
boost::multi_index::member<CleanupEntry, uint64_t, &CleanupEntry::frequency>,
std::less<uint64_t>
>
-
>
- > CleanupIndex;
+ >;
CleanupIndex m_cleanupIndex;
};
diff --git a/ndn-cxx/ims/in-memory-storage-lru.hpp b/ndn-cxx/ims/in-memory-storage-lru.hpp
index b5524e5..9f0decf 100644
--- a/ndn-cxx/ims/in-memory-storage-lru.hpp
+++ b/ndn-cxx/ims/in-memory-storage-lru.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -73,23 +73,20 @@
class byUsedTime;
class byEntity;
- typedef boost::multi_index_container<
+ using CleanupIndex = boost::multi_index_container<
InMemoryStorageEntry*,
boost::multi_index::indexed_by<
-
// by Entry itself
boost::multi_index::hashed_unique<
boost::multi_index::tag<byEntity>,
boost::multi_index::identity<InMemoryStorageEntry*>
>,
-
// by last used time (LRU)
boost::multi_index::sequenced<
boost::multi_index::tag<byUsedTime>
>
-
>
- > CleanupIndex;
+ >;
CleanupIndex m_cleanupIndex;
};
diff --git a/ndn-cxx/ims/in-memory-storage.hpp b/ndn-cxx/ims/in-memory-storage.hpp
index 4694e31..2658e4e 100644
--- a/ndn-cxx/ims/in-memory-storage.hpp
+++ b/ndn-cxx/ims/in-memory-storage.hpp
@@ -45,10 +45,9 @@
// multi_index_container to implement storage
class byFullName;
- typedef boost::multi_index_container<
+ using Cache = boost::multi_index_container<
InMemoryStorageEntry*,
boost::multi_index::indexed_by<
-
// by Full Name
boost::multi_index::ordered_unique<
boost::multi_index::tag<byFullName>,
@@ -56,9 +55,8 @@
&InMemoryStorageEntry::getFullName>,
std::less<Name>
>
-
>
- > Cache;
+ >;
/** @brief Represents a self-defined const_iterator for the in-memory storage.
*
diff --git a/ndn-cxx/lp/cache-policy.cpp b/ndn-cxx/lp/cache-policy.cpp
index c64bd04..a460b13 100644
--- a/ndn-cxx/lp/cache-policy.cpp
+++ b/ndn-cxx/lp/cache-policy.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,8 +24,7 @@
#include "ndn-cxx/lp/cache-policy.hpp"
#include "ndn-cxx/encoding/block-helpers.hpp"
-namespace ndn {
-namespace lp {
+namespace ndn::lp {
std::ostream&
operator<<(std::ostream& os, CachePolicyType policy)
@@ -132,5 +131,4 @@
return *this;
}
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::lp
diff --git a/ndn-cxx/lp/cache-policy.hpp b/ndn-cxx/lp/cache-policy.hpp
index 1b2a436..738fd8e 100644
--- a/ndn-cxx/lp/cache-policy.hpp
+++ b/ndn-cxx/lp/cache-policy.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,8 +27,7 @@
#include "ndn-cxx/encoding/encoding-buffer.hpp"
#include "ndn-cxx/lp/tlv.hpp"
-namespace ndn {
-namespace lp {
+namespace ndn::lp {
/**
* \brief Indicates the cache policy applied to a Data packet.
@@ -101,7 +100,6 @@
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(CachePolicy);
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::lp
#endif // NDN_CXX_LP_CACHE_POLICY_HPP
diff --git a/ndn-cxx/lp/empty-value.hpp b/ndn-cxx/lp/empty-value.hpp
index 2733d2d..6e20df5 100644
--- a/ndn-cxx/lp/empty-value.hpp
+++ b/ndn-cxx/lp/empty-value.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).
*
@@ -24,8 +24,7 @@
#ifndef NDN_CXX_LP_TLV_EMPTY_VALUE_HPP
#define NDN_CXX_LP_TLV_EMPTY_VALUE_HPP
-namespace ndn {
-namespace lp {
+namespace ndn::lp {
/**
* \brief Represents a zero-length TLV-VALUE.
@@ -34,7 +33,6 @@
{
};
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::lp
#endif // NDN_CXX_LP_TLV_EMPTY_VALUE_HPP
diff --git a/ndn-cxx/lp/field-decl.hpp b/ndn-cxx/lp/field-decl.hpp
index 1cb1916..5fcb3fa 100644
--- a/ndn-cxx/lp/field-decl.hpp
+++ b/ndn-cxx/lp/field-decl.hpp
@@ -29,8 +29,7 @@
#include <boost/concept/requires.hpp>
#include <boost/endian/conversion.hpp>
-namespace ndn {
-namespace lp {
+namespace ndn::lp {
/**
* \brief Indicates that a `uint64_t` field shall be decoded and encoded as a non-negative integer.
@@ -206,7 +205,6 @@
}
};
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::lp
#endif // NDN_CXX_LP_FIELD_DECL_HPP
diff --git a/ndn-cxx/lp/field.hpp b/ndn-cxx/lp/field.hpp
index 3ede2b5..3d72fda 100644
--- a/ndn-cxx/lp/field.hpp
+++ b/ndn-cxx/lp/field.hpp
@@ -26,8 +26,7 @@
#include <boost/concept/usage.hpp>
-namespace ndn {
-namespace lp {
+namespace ndn::lp {
/**
* \brief Indicates where a field may occur.
@@ -67,7 +66,6 @@
}
};
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::lp
#endif // NDN_CXX_LP_FIELD_HPP
diff --git a/ndn-cxx/lp/fields.hpp b/ndn-cxx/lp/fields.hpp
index 78444ee..d30ba1f 100644
--- a/ndn-cxx/lp/fields.hpp
+++ b/ndn-cxx/lp/fields.hpp
@@ -33,8 +33,7 @@
#include <boost/mpl/set.hpp>
-namespace ndn {
-namespace lp {
+namespace ndn::lp {
/**
* \brief Declare the Fragment field.
@@ -134,7 +133,6 @@
PrefixAnnouncementField
>;
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::lp
#endif // NDN_CXX_LP_FIELDS_HPP
diff --git a/ndn-cxx/lp/nack-header.cpp b/ndn-cxx/lp/nack-header.cpp
index ab1cc86..71c76ee 100644
--- a/ndn-cxx/lp/nack-header.cpp
+++ b/ndn-cxx/lp/nack-header.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).
*
@@ -23,8 +23,7 @@
#include "ndn-cxx/lp/nack-header.hpp"
-namespace ndn {
-namespace lp {
+namespace ndn::lp {
std::ostream&
operator<<(std::ostream& os, NackReason reason)
@@ -138,5 +137,4 @@
return *this;
}
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::lp
diff --git a/ndn-cxx/lp/nack-header.hpp b/ndn-cxx/lp/nack-header.hpp
index 6284624..bc78e36 100644
--- a/ndn-cxx/lp/nack-header.hpp
+++ b/ndn-cxx/lp/nack-header.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).
*
@@ -28,8 +28,7 @@
#include "ndn-cxx/encoding/encoding-buffer.hpp"
#include "ndn-cxx/lp/tlv.hpp"
-namespace ndn {
-namespace lp {
+namespace ndn::lp {
/**
* \brief Indicates the reason type of a %Network %Nack.
@@ -95,7 +94,6 @@
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(NackHeader);
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::lp
#endif // NDN_CXX_LP_NACK_HEADER_HPP
diff --git a/ndn-cxx/lp/nack.cpp b/ndn-cxx/lp/nack.cpp
index 7e3a57f..20a0f8f 100644
--- a/ndn-cxx/lp/nack.cpp
+++ b/ndn-cxx/lp/nack.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).
*
@@ -23,8 +23,7 @@
#include "ndn-cxx/lp/nack.hpp"
-namespace ndn {
-namespace lp {
+namespace ndn::lp {
Nack::Nack() = default;
@@ -38,5 +37,4 @@
{
}
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::lp
diff --git a/ndn-cxx/lp/nack.hpp b/ndn-cxx/lp/nack.hpp
index e166971..4631130 100644
--- a/ndn-cxx/lp/nack.hpp
+++ b/ndn-cxx/lp/nack.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).
*
@@ -28,8 +28,7 @@
#include "ndn-cxx/detail/packet-base.hpp"
#include "ndn-cxx/lp/nack-header.hpp"
-namespace ndn {
-namespace lp {
+namespace ndn::lp {
/**
* \brief Represents a %Network %Nack.
@@ -105,7 +104,6 @@
NackHeader m_header;
};
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::lp
#endif // NDN_CXX_LP_NACK_HPP
diff --git a/ndn-cxx/lp/packet.cpp b/ndn-cxx/lp/packet.cpp
index e942acc..be115f9 100644
--- a/ndn-cxx/lp/packet.cpp
+++ b/ndn-cxx/lp/packet.cpp
@@ -25,8 +25,7 @@
#include <boost/mpl/for_each.hpp>
#include <boost/range/adaptor/reversed.hpp>
-namespace ndn {
-namespace lp {
+namespace ndn::lp {
namespace {
@@ -161,5 +160,4 @@
return compareFieldSortOrder(FieldInfo(first), FieldInfo(second.type()));
}
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::lp
diff --git a/ndn-cxx/lp/packet.hpp b/ndn-cxx/lp/packet.hpp
index ba38ebd..9f06555 100644
--- a/ndn-cxx/lp/packet.hpp
+++ b/ndn-cxx/lp/packet.hpp
@@ -24,11 +24,10 @@
#include "ndn-cxx/lp/fields.hpp"
-namespace ndn {
/**
* @brief Contains classes and functions related to NDNLPv2.
*/
-namespace lp {
+namespace ndn::lp {
class Packet
{
@@ -208,7 +207,6 @@
mutable Block m_wire{tlv::LpPacket};
};
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::lp
#endif // NDN_CXX_LP_PACKET_HPP
diff --git a/ndn-cxx/lp/pit-token.cpp b/ndn-cxx/lp/pit-token.cpp
index f232814..a564dab 100644
--- a/ndn-cxx/lp/pit-token.cpp
+++ b/ndn-cxx/lp/pit-token.cpp
@@ -23,8 +23,7 @@
#include "ndn-cxx/encoding/tlv.hpp"
#include "ndn-cxx/util/string-helper.hpp"
-namespace ndn {
-namespace lp {
+namespace ndn::lp {
constexpr size_t LENGTH_MIN = 1;
constexpr size_t LENGTH_MAX = 32;
@@ -45,5 +44,4 @@
return os;
}
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::lp
diff --git a/ndn-cxx/lp/pit-token.hpp b/ndn-cxx/lp/pit-token.hpp
index 9d0371d..e7e2d12 100644
--- a/ndn-cxx/lp/pit-token.hpp
+++ b/ndn-cxx/lp/pit-token.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,8 +25,7 @@
#include "ndn-cxx/encoding/buffer.hpp"
#include "ndn-cxx/tag.hpp"
-namespace ndn {
-namespace lp {
+namespace ndn::lp {
/** \brief Represent a PIT token field.
* \sa https://redmine.named-data.net/projects/nfd/wiki/NDNLPv2#PIT-Token
@@ -67,7 +66,6 @@
std::ostream&
operator<<(std::ostream& os, const PitToken& pitToken);
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::lp
#endif // NDN_CXX_LP_PIT_TOKEN_HPP
diff --git a/ndn-cxx/lp/prefix-announcement-header.cpp b/ndn-cxx/lp/prefix-announcement-header.cpp
index 3c5de4d..58ebbc2 100644
--- a/ndn-cxx/lp/prefix-announcement-header.cpp
+++ b/ndn-cxx/lp/prefix-announcement-header.cpp
@@ -22,8 +22,7 @@
#include "ndn-cxx/lp/prefix-announcement-header.hpp"
#include "ndn-cxx/lp/tlv.hpp"
-namespace ndn {
-namespace lp {
+namespace ndn::lp {
PrefixAnnouncementHeader::PrefixAnnouncementHeader() = default;
@@ -67,5 +66,4 @@
wire.parse();
m_prefixAnn.emplace(Data(wire.get(ndn::tlv::Data)));
}
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::lp
diff --git a/ndn-cxx/lp/prefix-announcement-header.hpp b/ndn-cxx/lp/prefix-announcement-header.hpp
index 59e4cc9..f236039 100644
--- a/ndn-cxx/lp/prefix-announcement-header.hpp
+++ b/ndn-cxx/lp/prefix-announcement-header.hpp
@@ -24,8 +24,7 @@
#include "ndn-cxx/prefix-announcement.hpp"
-namespace ndn {
-namespace lp {
+namespace ndn::lp {
/** \brief Represents a PrefixAnnouncement header field in NDNLP.
*/
@@ -73,7 +72,6 @@
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(PrefixAnnouncementHeader);
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::lp
#endif // NDN_CXX_LP_PREFIX_ANNOUNCEMENT_HEADER_HPP
diff --git a/ndn-cxx/lp/sequence.hpp b/ndn-cxx/lp/sequence.hpp
index 4b662dd..919db36 100644
--- a/ndn-cxx/lp/sequence.hpp
+++ b/ndn-cxx/lp/sequence.hpp
@@ -26,15 +26,13 @@
#include <cstdint>
-namespace ndn {
-namespace lp {
+namespace ndn::lp {
/**
* \brief Represents a sequence number.
*/
using Sequence = uint64_t;
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::lp
#endif // NDN_CXX_LP_SEQUENCE_HPP
diff --git a/ndn-cxx/lp/tags.hpp b/ndn-cxx/lp/tags.hpp
index b32bc60..312a39d 100644
--- a/ndn-cxx/lp/tags.hpp
+++ b/ndn-cxx/lp/tags.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,8 +27,7 @@
#include "ndn-cxx/lp/prefix-announcement-header.hpp"
#include "ndn-cxx/tag.hpp"
-namespace ndn {
-namespace lp {
+namespace ndn::lp {
/**
* \class IncomingFaceIdTag
@@ -78,7 +77,6 @@
*/
using PrefixAnnouncementTag = SimpleTag<PrefixAnnouncementHeader, 15>;
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::lp
#endif // NDN_CXX_LP_TAGS_HPP
diff --git a/ndn-cxx/lp/tlv.hpp b/ndn-cxx/lp/tlv.hpp
index fe99f34..10fe1f6 100644
--- a/ndn-cxx/lp/tlv.hpp
+++ b/ndn-cxx/lp/tlv.hpp
@@ -24,12 +24,10 @@
#include <cstdint>
-namespace ndn {
-namespace lp {
/**
* @brief Contains constants related to the NDNLPv2 packet format.
*/
-namespace tlv {
+namespace ndn::lp::tlv {
/**
* @brief TLV-TYPE numbers for NDNLPv2.
@@ -72,8 +70,6 @@
HEADER3_MAX = 959,
};
-} // namespace tlv
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::lp::tlv
#endif // NDN_CXX_LP_TLV_HPP
diff --git a/ndn-cxx/mgmt/control-parameters.hpp b/ndn-cxx/mgmt/control-parameters.hpp
index 382a7af..211ca53 100644
--- a/ndn-cxx/mgmt/control-parameters.hpp
+++ b/ndn-cxx/mgmt/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).
*
@@ -24,8 +24,7 @@
#include "ndn-cxx/encoding/block.hpp"
-namespace ndn {
-namespace mgmt {
+namespace ndn::mgmt {
/**
* \brief Base class for a struct that contains ControlCommand parameters.
@@ -43,7 +42,6 @@
wireEncode() const = 0;
};
-} // namespace mgmt
-} // namespace ndn
+} // namespace ndn::mgmt
#endif // NDN_CXX_MGMT_CONTROL_PARAMETERS_HPP
diff --git a/ndn-cxx/mgmt/control-response.cpp b/ndn-cxx/mgmt/control-response.cpp
index ce0b0da..ffff61a 100644
--- a/ndn-cxx/mgmt/control-response.cpp
+++ b/ndn-cxx/mgmt/control-response.cpp
@@ -23,8 +23,7 @@
#include "ndn-cxx/encoding/block-helpers.hpp"
#include "ndn-cxx/encoding/tlv-nfd.hpp"
-namespace ndn {
-namespace mgmt {
+namespace ndn::mgmt {
ControlResponse::ControlResponse() = default;
@@ -110,5 +109,4 @@
m_body = {};
}
-} // namespace mgmt
-} // namespace ndn
+} // namespace ndn::mgmt
diff --git a/ndn-cxx/mgmt/control-response.hpp b/ndn-cxx/mgmt/control-response.hpp
index 981384f8..11804de 100644
--- a/ndn-cxx/mgmt/control-response.hpp
+++ b/ndn-cxx/mgmt/control-response.hpp
@@ -24,8 +24,7 @@
#include "ndn-cxx/encoding/block.hpp"
-namespace ndn {
-namespace mgmt {
+namespace ndn::mgmt {
/**
* \brief ControlCommand response.
@@ -97,7 +96,6 @@
}
};
-} // namespace mgmt
-} // namespace ndn
+} // namespace ndn::mgmt
#endif // NDN_CXX_MGMT_CONTROL_RESPONSE_HPP
diff --git a/ndn-cxx/mgmt/dispatcher.cpp b/ndn-cxx/mgmt/dispatcher.cpp
index 4a2079d..a192642 100644
--- a/ndn-cxx/mgmt/dispatcher.cpp
+++ b/ndn-cxx/mgmt/dispatcher.cpp
@@ -25,10 +25,9 @@
#include <algorithm>
-NDN_LOG_INIT(ndn.mgmt.Dispatcher);
+namespace ndn::mgmt {
-namespace ndn {
-namespace mgmt {
+NDN_LOG_INIT(ndn.mgmt.Dispatcher);
Authorization
makeAcceptAllAuthorization()
@@ -343,5 +342,4 @@
sendData(streamName, notification, {}, SendDestination::FACE_AND_IMS);
}
-} // namespace mgmt
-} // namespace ndn
+} // namespace ndn::mgmt
diff --git a/ndn-cxx/mgmt/dispatcher.hpp b/ndn-cxx/mgmt/dispatcher.hpp
index 3cc9092..9c5bdde 100644
--- a/ndn-cxx/mgmt/dispatcher.hpp
+++ b/ndn-cxx/mgmt/dispatcher.hpp
@@ -32,8 +32,7 @@
#include <unordered_map>
-namespace ndn {
-namespace mgmt {
+namespace ndn::mgmt {
// ---- AUTHORIZATION ----
@@ -488,7 +487,6 @@
};
}
-} // namespace mgmt
-} // namespace ndn
+} // namespace ndn::mgmt
#endif // NDN_CXX_MGMT_DISPATCHER_HPP
diff --git a/ndn-cxx/mgmt/nfd/channel-status.cpp b/ndn-cxx/mgmt/nfd/channel-status.cpp
index f39f11a..d8882af 100644
--- a/ndn-cxx/mgmt/nfd/channel-status.cpp
+++ b/ndn-cxx/mgmt/nfd/channel-status.cpp
@@ -23,8 +23,7 @@
#include "ndn-cxx/encoding/block-helpers.hpp"
#include "ndn-cxx/encoding/tlv-nfd.hpp"
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
ChannelStatus::ChannelStatus() = default;
@@ -102,5 +101,4 @@
return os << "Channel(LocalUri: " << status.getLocalUri() << ")";
}
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
diff --git a/ndn-cxx/mgmt/nfd/channel-status.hpp b/ndn-cxx/mgmt/nfd/channel-status.hpp
index 4fbc06b..f2a896c 100644
--- a/ndn-cxx/mgmt/nfd/channel-status.hpp
+++ b/ndn-cxx/mgmt/nfd/channel-status.hpp
@@ -24,8 +24,7 @@
#include "ndn-cxx/encoding/block.hpp"
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
/**
* \ingroup management
@@ -86,7 +85,6 @@
std::ostream&
operator<<(std::ostream& os, const ChannelStatus& status);
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
#endif // NDN_CXX_MGMT_NFD_CHANNEL_STATUS_HPP
diff --git a/ndn-cxx/mgmt/nfd/command-options.cpp b/ndn-cxx/mgmt/nfd/command-options.cpp
index 36faba2..921e822 100644
--- a/ndn-cxx/mgmt/nfd/command-options.cpp
+++ b/ndn-cxx/mgmt/nfd/command-options.cpp
@@ -21,8 +21,7 @@
#include "ndn-cxx/mgmt/nfd/command-options.hpp"
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
CommandOptions&
CommandOptions::setTimeout(time::milliseconds timeout)
@@ -48,5 +47,4 @@
return *this;
}
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
diff --git a/ndn-cxx/mgmt/nfd/command-options.hpp b/ndn-cxx/mgmt/nfd/command-options.hpp
index 5a341fe..e4ad172 100644
--- a/ndn-cxx/mgmt/nfd/command-options.hpp
+++ b/ndn-cxx/mgmt/nfd/command-options.hpp
@@ -24,8 +24,7 @@
#include "ndn-cxx/security/signing-info.hpp"
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
/**
* \ingroup management
@@ -106,7 +105,6 @@
security::SigningInfo m_signingInfo;
};
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
#endif // NDN_CXX_MGMT_NFD_COMMAND_OPTIONS_HPP
diff --git a/ndn-cxx/mgmt/nfd/control-command.cpp b/ndn-cxx/mgmt/nfd/control-command.cpp
index a6daa76..352fa4c 100644
--- a/ndn-cxx/mgmt/nfd/control-command.cpp
+++ b/ndn-cxx/mgmt/nfd/control-command.cpp
@@ -21,8 +21,7 @@
#include "ndn-cxx/mgmt/nfd/control-command.hpp"
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
ControlCommand::ControlCommand(const std::string& module, const std::string& verb)
: m_module(module)
@@ -419,5 +418,4 @@
}
}
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
diff --git a/ndn-cxx/mgmt/nfd/control-command.hpp b/ndn-cxx/mgmt/nfd/control-command.hpp
index 9aa5820..a01c9a9 100644
--- a/ndn-cxx/mgmt/nfd/control-command.hpp
+++ b/ndn-cxx/mgmt/nfd/control-command.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).
*
@@ -24,8 +24,7 @@
#include "ndn-cxx/mgmt/nfd/control-parameters.hpp"
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
/**
* \ingroup management
@@ -319,7 +318,6 @@
validateResponse(const ControlParameters& parameters) const override;
};
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
#endif // NDN_CXX_MGMT_NFD_CONTROL_COMMAND_HPP
diff --git a/ndn-cxx/mgmt/nfd/control-parameters.cpp b/ndn-cxx/mgmt/nfd/control-parameters.cpp
index 9ec7234..4e8c866 100644
--- a/ndn-cxx/mgmt/nfd/control-parameters.cpp
+++ b/ndn-cxx/mgmt/nfd/control-parameters.cpp
@@ -24,8 +24,7 @@
#include "ndn-cxx/encoding/tlv-nfd.hpp"
#include "ndn-cxx/util/string-helper.hpp"
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
ControlParameters::ControlParameters()
: m_hasFields(CONTROL_PARAMETER_UBOUND)
@@ -379,5 +378,4 @@
return os;
}
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
diff --git a/ndn-cxx/mgmt/nfd/control-parameters.hpp b/ndn-cxx/mgmt/nfd/control-parameters.hpp
index 18e5534..b49ba4f 100644
--- a/ndn-cxx/mgmt/nfd/control-parameters.hpp
+++ b/ndn-cxx/mgmt/nfd/control-parameters.hpp
@@ -27,8 +27,7 @@
#include "ndn-cxx/mgmt/control-parameters.hpp"
#include "ndn-cxx/util/time.hpp"
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
/**
* \ingroup management
@@ -662,7 +661,6 @@
std::ostream&
operator<<(std::ostream& os, const ControlParameters& parameters);
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
#endif // NDN_CXX_MGMT_NFD_CONTROL_PARAMETERS_HPP
diff --git a/ndn-cxx/mgmt/nfd/control-response.hpp b/ndn-cxx/mgmt/nfd/control-response.hpp
index f02f4db..c7effc3 100644
--- a/ndn-cxx/mgmt/nfd/control-response.hpp
+++ b/ndn-cxx/mgmt/nfd/control-response.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,12 +24,10 @@
#include "ndn-cxx/mgmt/control-response.hpp"
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
using ControlResponse = mgmt::ControlResponse;
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
#endif // NDN_CXX_MGMT_NFD_CONTROL_RESPONSE_HPP
diff --git a/ndn-cxx/mgmt/nfd/controller.cpp b/ndn-cxx/mgmt/nfd/controller.cpp
index 38a0052..4cc2fa8 100644
--- a/ndn-cxx/mgmt/nfd/controller.cpp
+++ b/ndn-cxx/mgmt/nfd/controller.cpp
@@ -25,10 +25,7 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace nfd {
-
-using ndn::util::SegmentFetcher;
+namespace ndn::nfd {
Controller::Controller(Face& face, KeyChain& keyChain, security::Validator& validator)
: m_face(face)
@@ -184,5 +181,4 @@
}
}
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
diff --git a/ndn-cxx/mgmt/nfd/controller.hpp b/ndn-cxx/mgmt/nfd/controller.hpp
index d0d3f08..b9adc75 100644
--- a/ndn-cxx/mgmt/nfd/controller.hpp
+++ b/ndn-cxx/mgmt/nfd/controller.hpp
@@ -34,6 +34,9 @@
class Face;
+/**
+ * @brief Contains classes and functions related to the NFD Management protocol.
+ */
namespace nfd {
/**
@@ -178,7 +181,7 @@
security::InterestSigner m_signer;
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED:
- std::set<shared_ptr<util::SegmentFetcher>> m_fetchers;
+ std::set<shared_ptr<SegmentFetcher>> m_fetchers;
};
template<typename Dataset>
diff --git a/ndn-cxx/mgmt/nfd/cs-info.cpp b/ndn-cxx/mgmt/nfd/cs-info.cpp
index cfae566..e855d73 100644
--- a/ndn-cxx/mgmt/nfd/cs-info.cpp
+++ b/ndn-cxx/mgmt/nfd/cs-info.cpp
@@ -24,8 +24,7 @@
#include "ndn-cxx/encoding/encoding-buffer.hpp"
#include "ndn-cxx/encoding/tlv-nfd.hpp"
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
CsInfo::CsInfo() = default;
@@ -190,5 +189,4 @@
<< csi.getNMisses() << (csi.getNMisses() == 1 ? " miss" : " misses");
}
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
diff --git a/ndn-cxx/mgmt/nfd/cs-info.hpp b/ndn-cxx/mgmt/nfd/cs-info.hpp
index 541c08c..9103c8f 100644
--- a/ndn-cxx/mgmt/nfd/cs-info.hpp
+++ b/ndn-cxx/mgmt/nfd/cs-info.hpp
@@ -27,8 +27,7 @@
#include <bitset>
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
/** \ingroup management
* \brief Represents the CS Information dataset.
@@ -150,7 +149,6 @@
std::ostream&
operator<<(std::ostream& os, const CsInfo& csi);
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
#endif // NDN_CXX_MGMT_NFD_CS_INFO_HPP
diff --git a/ndn-cxx/mgmt/nfd/face-event-notification.cpp b/ndn-cxx/mgmt/nfd/face-event-notification.cpp
index de5dc40..5c19a92 100644
--- a/ndn-cxx/mgmt/nfd/face-event-notification.cpp
+++ b/ndn-cxx/mgmt/nfd/face-event-notification.cpp
@@ -25,8 +25,7 @@
#include "ndn-cxx/encoding/tlv-nfd.hpp"
#include "ndn-cxx/util/string-helper.hpp"
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
FaceEventNotification::FaceEventNotification() = default;
@@ -185,5 +184,4 @@
return os << " )";
}
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
diff --git a/ndn-cxx/mgmt/nfd/face-event-notification.hpp b/ndn-cxx/mgmt/nfd/face-event-notification.hpp
index 959cf93..8702b40 100644
--- a/ndn-cxx/mgmt/nfd/face-event-notification.hpp
+++ b/ndn-cxx/mgmt/nfd/face-event-notification.hpp
@@ -24,8 +24,7 @@
#include "ndn-cxx/mgmt/nfd/face-traits.hpp"
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
/**
* \ingroup management
@@ -84,7 +83,6 @@
std::ostream&
operator<<(std::ostream& os, const FaceEventNotification& notification);
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
#endif // NDN_CXX_MGMT_NFD_FACE_EVENT_NOTIFICATION_HPP
diff --git a/ndn-cxx/mgmt/nfd/face-monitor.hpp b/ndn-cxx/mgmt/nfd/face-monitor.hpp
index 07fefd8..3ed6579 100644
--- a/ndn-cxx/mgmt/nfd/face-monitor.hpp
+++ b/ndn-cxx/mgmt/nfd/face-monitor.hpp
@@ -31,8 +31,7 @@
#include "ndn-cxx/mgmt/nfd/face-event-notification.hpp"
#include "ndn-cxx/util/notification-subscriber.hpp"
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
/**
* \brief A subscriber for the %Face status change notification stream.
@@ -48,7 +47,6 @@
}
};
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
#endif // NDN_CXX_MGMT_NFD_FACE_MONITOR_HPP
diff --git a/ndn-cxx/mgmt/nfd/face-query-filter.cpp b/ndn-cxx/mgmt/nfd/face-query-filter.cpp
index 1cf2d5c..dbdb2f9 100644
--- a/ndn-cxx/mgmt/nfd/face-query-filter.cpp
+++ b/ndn-cxx/mgmt/nfd/face-query-filter.cpp
@@ -23,8 +23,7 @@
#include "ndn-cxx/encoding/block-helpers.hpp"
#include "ndn-cxx/encoding/tlv-nfd.hpp"
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
FaceQueryFilter::FaceQueryFilter() = default;
@@ -336,5 +335,4 @@
return os;
}
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
diff --git a/ndn-cxx/mgmt/nfd/face-query-filter.hpp b/ndn-cxx/mgmt/nfd/face-query-filter.hpp
index 65de800..a09f405 100644
--- a/ndn-cxx/mgmt/nfd/face-query-filter.hpp
+++ b/ndn-cxx/mgmt/nfd/face-query-filter.hpp
@@ -27,8 +27,7 @@
#include <optional>
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
/**
* \ingroup management
@@ -230,7 +229,6 @@
std::ostream&
operator<<(std::ostream& os, const FaceQueryFilter& filter);
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
#endif // NDN_CXX_MGMT_NFD_FACE_QUERY_FILTER_HPP
diff --git a/ndn-cxx/mgmt/nfd/face-status.cpp b/ndn-cxx/mgmt/nfd/face-status.cpp
index 04b4bdb..4ab55fe 100644
--- a/ndn-cxx/mgmt/nfd/face-status.cpp
+++ b/ndn-cxx/mgmt/nfd/face-status.cpp
@@ -25,8 +25,7 @@
#include "ndn-cxx/encoding/tlv-nfd.hpp"
#include "ndn-cxx/util/string-helper.hpp"
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
FaceStatus::FaceStatus() = default;
@@ -460,5 +459,4 @@
return os << " )";
}
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
diff --git a/ndn-cxx/mgmt/nfd/face-status.hpp b/ndn-cxx/mgmt/nfd/face-status.hpp
index 7cd9da3..fa49c8f 100644
--- a/ndn-cxx/mgmt/nfd/face-status.hpp
+++ b/ndn-cxx/mgmt/nfd/face-status.hpp
@@ -27,8 +27,7 @@
#include <optional>
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
/**
* \ingroup management
@@ -249,7 +248,6 @@
std::ostream&
operator<<(std::ostream& os, const FaceStatus& status);
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
#endif // NDN_CXX_MGMT_NFD_FACE_STATUS_HPP
diff --git a/ndn-cxx/mgmt/nfd/face-traits.hpp b/ndn-cxx/mgmt/nfd/face-traits.hpp
index d497b4d..7816665 100644
--- a/ndn-cxx/mgmt/nfd/face-traits.hpp
+++ b/ndn-cxx/mgmt/nfd/face-traits.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,8 +25,7 @@
#include "ndn-cxx/encoding/block.hpp"
#include "ndn-cxx/encoding/nfd-constants.hpp"
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
/**
* \ingroup management
@@ -191,7 +190,6 @@
mutable Block m_wire;
};
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
#endif // NDN_CXX_MGMT_NFD_FACE_TRAITS_HPP
diff --git a/ndn-cxx/mgmt/nfd/fib-entry.cpp b/ndn-cxx/mgmt/nfd/fib-entry.cpp
index d2c4f5a..c45e888 100644
--- a/ndn-cxx/mgmt/nfd/fib-entry.cpp
+++ b/ndn-cxx/mgmt/nfd/fib-entry.cpp
@@ -27,8 +27,7 @@
#include <boost/range/adaptor/reversed.hpp>
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
NextHopRecord::NextHopRecord() = default;
@@ -264,5 +263,4 @@
return os << " )";
}
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
diff --git a/ndn-cxx/mgmt/nfd/fib-entry.hpp b/ndn-cxx/mgmt/nfd/fib-entry.hpp
index b68071d..a0e5e36 100644
--- a/ndn-cxx/mgmt/nfd/fib-entry.hpp
+++ b/ndn-cxx/mgmt/nfd/fib-entry.hpp
@@ -25,8 +25,7 @@
#include "ndn-cxx/encoding/nfd-constants.hpp"
#include "ndn-cxx/name.hpp"
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
/** \ingroup management
* \sa https://redmine.named-data.net/projects/nfd/wiki/FibMgmt#FIB-Dataset
@@ -173,7 +172,6 @@
std::ostream&
operator<<(std::ostream& os, const FibEntry& entry);
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
#endif // NDN_CXX_MGMT_NFD_FIB_ENTRY_HPP
diff --git a/ndn-cxx/mgmt/nfd/forwarder-status.cpp b/ndn-cxx/mgmt/nfd/forwarder-status.cpp
index 09b3971..a92bfc2 100644
--- a/ndn-cxx/mgmt/nfd/forwarder-status.cpp
+++ b/ndn-cxx/mgmt/nfd/forwarder-status.cpp
@@ -24,8 +24,7 @@
#include "ndn-cxx/encoding/encoding-buffer.hpp"
#include "ndn-cxx/encoding/tlv-nfd.hpp"
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
ForwarderStatus::ForwarderStatus() = default;
@@ -231,7 +230,7 @@
}
ForwarderStatus&
-ForwarderStatus::setStartTimestamp(const time::system_clock::TimePoint& startTimestamp)
+ForwarderStatus::setStartTimestamp(const time::system_clock::time_point& startTimestamp)
{
m_wire.reset();
m_startTimestamp = startTimestamp;
@@ -239,7 +238,7 @@
}
ForwarderStatus&
-ForwarderStatus::setCurrentTimestamp(const time::system_clock::TimePoint& currentTimestamp)
+ForwarderStatus::setCurrentTimestamp(const time::system_clock::time_point& currentTimestamp)
{
m_wire.reset();
m_currentTimestamp = currentTimestamp;
@@ -395,5 +394,4 @@
return os;
}
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
diff --git a/ndn-cxx/mgmt/nfd/forwarder-status.hpp b/ndn-cxx/mgmt/nfd/forwarder-status.hpp
index e010732..70ea5ba 100644
--- a/ndn-cxx/mgmt/nfd/forwarder-status.hpp
+++ b/ndn-cxx/mgmt/nfd/forwarder-status.hpp
@@ -25,8 +25,7 @@
#include "ndn-cxx/encoding/block.hpp"
#include "ndn-cxx/util/time.hpp"
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
/**
* \ingroup management
@@ -249,7 +248,6 @@
std::ostream&
operator<<(std::ostream& os, const ForwarderStatus& status);
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
#endif // NDN_CXX_MGMT_NFD_FORWARDER_STATUS_HPP
diff --git a/ndn-cxx/mgmt/nfd/rib-entry.cpp b/ndn-cxx/mgmt/nfd/rib-entry.cpp
index 73e7f43..cd8e74b 100644
--- a/ndn-cxx/mgmt/nfd/rib-entry.cpp
+++ b/ndn-cxx/mgmt/nfd/rib-entry.cpp
@@ -28,8 +28,7 @@
#include <boost/range/adaptor/reversed.hpp>
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
Route::Route() = default;
@@ -341,5 +340,4 @@
return os << " )";
}
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
diff --git a/ndn-cxx/mgmt/nfd/rib-entry.hpp b/ndn-cxx/mgmt/nfd/rib-entry.hpp
index 24eb78b..4de95d7 100644
--- a/ndn-cxx/mgmt/nfd/rib-entry.hpp
+++ b/ndn-cxx/mgmt/nfd/rib-entry.hpp
@@ -27,8 +27,7 @@
#include "ndn-cxx/name.hpp"
#include "ndn-cxx/util/time.hpp"
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
/**
* \ingroup management
@@ -225,7 +224,6 @@
std::ostream&
operator<<(std::ostream& os, const RibEntry& entry);
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
#endif // NDN_CXX_MGMT_NFD_RIB_ENTRY_HPP
diff --git a/ndn-cxx/mgmt/nfd/route-flags-traits.hpp b/ndn-cxx/mgmt/nfd/route-flags-traits.hpp
index be7553e..160a266 100644
--- a/ndn-cxx/mgmt/nfd/route-flags-traits.hpp
+++ b/ndn-cxx/mgmt/nfd/route-flags-traits.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).
*
@@ -24,8 +24,7 @@
#include "ndn-cxx/encoding/nfd-constants.hpp"
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
/**
* \ingroup management
@@ -54,7 +53,6 @@
RouteFlagsTraits() = default;
};
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
#endif // NDN_CXX_MGMT_NFD_ROUTE_FLAGS_TRAITS_HPP
diff --git a/ndn-cxx/mgmt/nfd/status-dataset.cpp b/ndn-cxx/mgmt/nfd/status-dataset.cpp
index fe8b178..139ff89 100644
--- a/ndn-cxx/mgmt/nfd/status-dataset.cpp
+++ b/ndn-cxx/mgmt/nfd/status-dataset.cpp
@@ -21,8 +21,7 @@
#include "ndn-cxx/mgmt/nfd/status-dataset.hpp"
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
Name
StatusDatasetBase::getDatasetPrefix(const Name& prefix) const
@@ -158,5 +157,4 @@
return parseDatasetVector<RibEntry>(payload);
}
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
diff --git a/ndn-cxx/mgmt/nfd/status-dataset.hpp b/ndn-cxx/mgmt/nfd/status-dataset.hpp
index 93cc331..8bddf15 100644
--- a/ndn-cxx/mgmt/nfd/status-dataset.hpp
+++ b/ndn-cxx/mgmt/nfd/status-dataset.hpp
@@ -32,8 +32,7 @@
#include "ndn-cxx/mgmt/nfd/strategy-choice.hpp"
#include "ndn-cxx/mgmt/nfd/rib-entry.hpp"
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
/**
* \brief Exception raised when the fetched payload cannot be parsed as a StatusDataset.
@@ -211,7 +210,6 @@
parseResult(ConstBufferPtr payload) const;
};
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
#endif // NDN_CXX_MGMT_NFD_STATUS_DATASET_HPP
diff --git a/ndn-cxx/mgmt/nfd/strategy-choice.cpp b/ndn-cxx/mgmt/nfd/strategy-choice.cpp
index 6ef45c5..cf13c3f 100644
--- a/ndn-cxx/mgmt/nfd/strategy-choice.cpp
+++ b/ndn-cxx/mgmt/nfd/strategy-choice.cpp
@@ -24,8 +24,7 @@
#include "ndn-cxx/encoding/encoding-buffer.hpp"
#include "ndn-cxx/encoding/tlv-nfd.hpp"
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
StrategyChoice::StrategyChoice() = default;
@@ -131,5 +130,4 @@
<< ")";
}
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
diff --git a/ndn-cxx/mgmt/nfd/strategy-choice.hpp b/ndn-cxx/mgmt/nfd/strategy-choice.hpp
index 59db5ba..fba108e 100644
--- a/ndn-cxx/mgmt/nfd/strategy-choice.hpp
+++ b/ndn-cxx/mgmt/nfd/strategy-choice.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,8 +25,7 @@
#include "ndn-cxx/encoding/block.hpp"
#include "ndn-cxx/name.hpp"
-namespace ndn {
-namespace nfd {
+namespace ndn::nfd {
/**
* \ingroup management
@@ -97,7 +96,6 @@
std::ostream&
operator<<(std::ostream& os, const StrategyChoice& sc);
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::nfd
#endif // NDN_CXX_MGMT_NFD_STRATEGY_CHOICE_HPP
diff --git a/ndn-cxx/mgmt/status-dataset-context.cpp b/ndn-cxx/mgmt/status-dataset-context.cpp
index 0848a05..4e0de69 100644
--- a/ndn-cxx/mgmt/status-dataset-context.cpp
+++ b/ndn-cxx/mgmt/status-dataset-context.cpp
@@ -21,8 +21,7 @@
#include "ndn-cxx/mgmt/status-dataset-context.hpp"
-namespace ndn {
-namespace mgmt {
+namespace ndn::mgmt {
constexpr size_t MAX_PAYLOAD_LENGTH = MAX_NDN_PACKET_SIZE - 800;
@@ -106,5 +105,4 @@
m_nackSender(resp);
}
-} // namespace mgmt
-} // namespace ndn
+} // namespace ndn::mgmt
diff --git a/ndn-cxx/mgmt/status-dataset-context.hpp b/ndn-cxx/mgmt/status-dataset-context.hpp
index 7eb5dcb..643cbd1 100644
--- a/ndn-cxx/mgmt/status-dataset-context.hpp
+++ b/ndn-cxx/mgmt/status-dataset-context.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,8 +25,7 @@
#include "ndn-cxx/interest.hpp"
#include "ndn-cxx/mgmt/control-response.hpp"
-namespace ndn {
-namespace mgmt {
+namespace ndn::mgmt {
/**
* \brief Provides a context for generating the response to a StatusDataset request.
@@ -109,7 +108,6 @@
State m_state = State::INITIAL;
};
-} // namespace mgmt
-} // namespace ndn
+} // namespace ndn::mgmt
#endif // NDN_CXX_MGMT_STATUS_DATASET_CONTEXT_HPP
diff --git a/ndn-cxx/name-component.cpp b/ndn-cxx/name-component.cpp
index abedc2c..964353e 100644
--- a/ndn-cxx/name-component.cpp
+++ b/ndn-cxx/name-component.cpp
@@ -32,8 +32,7 @@
#include <boost/logic/tribool.hpp>
-namespace ndn {
-namespace name {
+namespace ndn::name {
static Convention g_conventionEncoding = Convention::TYPED;
static Convention g_conventionDecoding = Convention::EITHER;
@@ -510,5 +509,4 @@
// validity check is done within Component(const Block& wire)
}
-} // namespace name
-} // namespace ndn
+} // namespace ndn::name
diff --git a/ndn-cxx/name-component.hpp b/ndn-cxx/name-component.hpp
index 839b46e..9b245c1 100644
--- a/ndn-cxx/name-component.hpp
+++ b/ndn-cxx/name-component.hpp
@@ -26,8 +26,7 @@
#include "ndn-cxx/encoding/block-helpers.hpp"
#include "ndn-cxx/util/time.hpp"
-namespace ndn {
-namespace name {
+namespace ndn::name {
/**
* @brief Format used for the URI representation of a name.
@@ -592,7 +591,6 @@
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(Component);
-} // namespace name
-} // namespace ndn
+} // namespace ndn::name
#endif // NDN_CXX_NAME_COMPONENT_HPP
diff --git a/ndn-cxx/net/dns.cpp b/ndn-cxx/net/dns.cpp
index 9b0a9f1..5303e93 100644
--- a/ndn-cxx/net/dns.cpp
+++ b/ndn-cxx/net/dns.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,7 @@
#include <boost/asio/post.hpp>
#endif
-namespace ndn {
-namespace dns {
+namespace ndn::dns {
class Resolver : noncopyable
{
@@ -169,5 +168,4 @@
return it->endpoint().address();
}
-} // namespace dns
-} // namespace ndn
+} // namespace ndn::dns
diff --git a/ndn-cxx/net/dns.hpp b/ndn-cxx/net/dns.hpp
index a2db537..4859d98 100644
--- a/ndn-cxx/net/dns.hpp
+++ b/ndn-cxx/net/dns.hpp
@@ -27,8 +27,7 @@
#include <boost/asio/ip/address.hpp>
-namespace ndn {
-namespace dns {
+namespace ndn::dns {
using IpAddress = boost::asio::ip::address;
using AddressSelector = std::function<bool(const IpAddress&)>;
@@ -109,7 +108,6 @@
boost::asio::io_service& ioService,
const AddressSelector& addressSelector = AnyAddress());
-} // namespace dns
-} // namespace ndn
+} // namespace ndn::dns
#endif // NDN_CXX_NET_DNS_HPP
diff --git a/ndn-cxx/net/ethernet.cpp b/ndn-cxx/net/ethernet.cpp
index cced947..9848657 100644
--- a/ndn-cxx/net/ethernet.cpp
+++ b/ndn-cxx/net/ethernet.cpp
@@ -34,8 +34,7 @@
#include <cstdio>
#include <ostream>
-namespace ndn {
-namespace ethernet {
+namespace ndn::ethernet {
Address::Address()
{
@@ -130,8 +129,7 @@
return o << a.toString();
}
-} // namespace ethernet
-} // namespace ndn
+} // namespace ndn::ethernet
std::size_t
std::hash<ndn::ethernet::Address>::operator()(const ndn::ethernet::Address& a) const noexcept
diff --git a/ndn-cxx/net/ethernet.hpp b/ndn-cxx/net/ethernet.hpp
index 62b233c..9edddd8 100644
--- a/ndn-cxx/net/ethernet.hpp
+++ b/ndn-cxx/net/ethernet.hpp
@@ -33,8 +33,7 @@
#include <functional>
#include <string>
-namespace ndn {
-namespace ethernet {
+namespace ndn::ethernet {
inline constexpr uint16_t ETHERTYPE_NDN = 0x8624; ///< The NDN Ethertype
@@ -110,8 +109,7 @@
std::ostream&
operator<<(std::ostream& o, const Address& a);
-} // namespace ethernet
-} // namespace ndn
+} // namespace ndn::ethernet
namespace std {
diff --git a/ndn-cxx/net/impl/link-type-helper-osx.mm b/ndn-cxx/net/impl/link-type-helper-osx.mm
index 7512259..f752b24 100644
--- a/ndn-cxx/net/impl/link-type-helper-osx.mm
+++ b/ndn-cxx/net/impl/link-type-helper-osx.mm
@@ -31,9 +31,7 @@
#import <CoreWLAN/CWInterface.h>
#import <CoreWLAN/CWWiFiClient.h>
-namespace ndn {
-namespace net {
-namespace detail {
+namespace ndn::net::detail {
ndn::nfd::LinkType
getLinkType(const std::string& ifName)
@@ -61,6 +59,4 @@
}
}
-} // namespace detail
-} // namespace net
-} // namespace ndn
+} // namespace ndn::net::detail
diff --git a/ndn-cxx/net/impl/link-type-helper.cpp b/ndn-cxx/net/impl/link-type-helper.cpp
index 6ad4059..018af82 100644
--- a/ndn-cxx/net/impl/link-type-helper.cpp
+++ b/ndn-cxx/net/impl/link-type-helper.cpp
@@ -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).
*
@@ -26,9 +26,7 @@
// implemented in link-type-helper-osx.mm
#else
-namespace ndn {
-namespace net {
-namespace detail {
+namespace ndn::net::detail {
ndn::nfd::LinkType
getLinkType(const std::string& ifName)
@@ -36,8 +34,6 @@
return nfd::LINK_TYPE_NONE;
}
-} // namespace detail
-} // namespace net
-} // namespace ndn
+} // namespace ndn::net::detail
#endif // NDN_CXX_HAVE_OSX_FRAMEWORKS
diff --git a/ndn-cxx/net/impl/link-type-helper.hpp b/ndn-cxx/net/impl/link-type-helper.hpp
index e5bdc23..08fe96e 100644
--- a/ndn-cxx/net/impl/link-type-helper.hpp
+++ b/ndn-cxx/net/impl/link-type-helper.hpp
@@ -26,9 +26,7 @@
#include <string>
-namespace ndn {
-namespace net {
-namespace detail {
+namespace ndn::net::detail {
/**
* @brief Obtain information about WiFi link type
@@ -36,8 +34,6 @@
ndn::nfd::LinkType
getLinkType(const std::string& ifName);
-} // namespace detail
-} // namespace net
-} // namespace ndn
+} // namespace ndn::net::detail
#endif // NDN_CXX_NET_IMPL_LINK_TYPE_HELPER_HPP
diff --git a/ndn-cxx/net/impl/linux-if-constants.cpp b/ndn-cxx/net/impl/linux-if-constants.cpp
index 68bb9db..913c52c 100644
--- a/ndn-cxx/net/impl/linux-if-constants.cpp
+++ b/ndn-cxx/net/impl/linux-if-constants.cpp
@@ -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).
*
@@ -28,9 +28,7 @@
#include <sys/socket.h>
#include <linux/if.h>
-namespace ndn {
-namespace net {
-namespace linux_if {
+namespace ndn::net::linux_if {
const uint32_t FLAG_LOWER_UP = IFF_LOWER_UP;
const uint32_t FLAG_DORMANT = IFF_DORMANT;
@@ -44,8 +42,6 @@
const uint8_t OPER_STATE_DORMANT = IF_OPER_DORMANT;
const uint8_t OPER_STATE_UP = IF_OPER_UP;
-} // namespace linux_if
-} // namespace net
-} // namespace ndn
+} // namespace ndn::net::linux_if
#endif // __linux__
diff --git a/ndn-cxx/net/impl/linux-if-constants.hpp b/ndn-cxx/net/impl/linux-if-constants.hpp
index ab8a4cc..9d58dc0 100644
--- a/ndn-cxx/net/impl/linux-if-constants.hpp
+++ b/ndn-cxx/net/impl/linux-if-constants.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -27,9 +27,7 @@
#include <cstdint>
-namespace ndn {
-namespace net {
-namespace linux_if {
+namespace ndn::net::linux_if {
// linux/if.h and net/if.h cannot be (directly or indirectly) included in the
// same translation unit because they contain duplicate declarations, therefore
@@ -50,9 +48,7 @@
extern const uint8_t OPER_STATE_DORMANT;
extern const uint8_t OPER_STATE_UP;
-} // namespace linux_if
-} // namespace net
-} // namespace ndn
+} // namespace ndn::net::linux_if
#endif // __linux__
#endif // NDN_CXX_NET_LINUX_IF_CONSTANTS_HPP
diff --git a/ndn-cxx/net/impl/netlink-message.hpp b/ndn-cxx/net/impl/netlink-message.hpp
index 5eb44b8..d00b106 100644
--- a/ndn-cxx/net/impl/netlink-message.hpp
+++ b/ndn-cxx/net/impl/netlink-message.hpp
@@ -42,8 +42,7 @@
#include <boost/asio/ip/address.hpp>
-namespace ndn {
-namespace net {
+namespace ndn::net {
template<typename T>
constexpr size_t
@@ -270,7 +269,6 @@
std::map<uint16_t, const T*> m_attrs;
};
-} // namespace net
-} // namespace ndn
+} // namespace ndn::net
#endif // NDN_CXX_NET_NETLINK_MESSAGE_HPP
diff --git a/ndn-cxx/net/impl/netlink-socket.cpp b/ndn-cxx/net/impl/netlink-socket.cpp
index b12998c..b3f59f7 100644
--- a/ndn-cxx/net/impl/netlink-socket.cpp
+++ b/ndn-cxx/net/impl/netlink-socket.cpp
@@ -39,10 +39,9 @@
#define NETLINK_GET_STRICT_CHK 12
#endif
-NDN_LOG_INIT(ndn.NetworkMonitor);
+namespace ndn::net {
-namespace ndn {
-namespace net {
+NDN_LOG_INIT(ndn.NetworkMonitor);
// satisfies Asio's SettableSocketOption type requirements
template<int OptName>
@@ -607,5 +606,4 @@
return NetlinkSocket::nlmsgTypeToString(type);
}
-} // namespace net
-} // namespace ndn
+} // namespace ndn::net
diff --git a/ndn-cxx/net/impl/netlink-socket.hpp b/ndn-cxx/net/impl/netlink-socket.hpp
index af10173..34a5e9e 100644
--- a/ndn-cxx/net/impl/netlink-socket.hpp
+++ b/ndn-cxx/net/impl/netlink-socket.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -35,8 +35,7 @@
#error "This file should not be included ..."
#endif
-namespace ndn {
-namespace net {
+namespace ndn::net {
class NetlinkMessage;
@@ -110,8 +109,8 @@
public:
GenlFamilyResolver(std::string familyName, GenlSocket& socket);
- util::Signal<GenlFamilyResolver, uint16_t> onResolved;
- util::Signal<GenlFamilyResolver> onError;
+ signal::Signal<GenlFamilyResolver, uint16_t> onResolved;
+ signal::Signal<GenlFamilyResolver> onError;
private:
void
@@ -153,7 +152,6 @@
std::map<std::string, GenlFamilyResolver> m_familyResolvers; ///< family name => resolver instance
};
-} // namespace net
-} // namespace ndn
+} // namespace ndn::net
#endif // NDN_CXX_NET_NETLINK_SOCKET_HPP
diff --git a/ndn-cxx/net/impl/network-monitor-impl-netlink.cpp b/ndn-cxx/net/impl/network-monitor-impl-netlink.cpp
index 0862371..ca1d749 100644
--- a/ndn-cxx/net/impl/network-monitor-impl-netlink.cpp
+++ b/ndn-cxx/net/impl/network-monitor-impl-netlink.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).
*
@@ -39,10 +39,9 @@
#define RTEXT_FILTER_SKIP_STATS (1 << 3)
#endif
-NDN_LOG_INIT(ndn.NetworkMonitor);
+namespace ndn::net {
-namespace ndn {
-namespace net {
+NDN_LOG_INIT(ndn.NetworkMonitor);
NetworkMonitorImplNetlink::NetworkMonitorImplNetlink(boost::asio::io_service& io)
: m_rtnlSocket(io)
@@ -451,5 +450,4 @@
#endif // NDN_CXX_HAVE_NETLINK_EXT_ACK
}
-} // namespace net
-} // namespace ndn
+} // namespace ndn::net
diff --git a/ndn-cxx/net/impl/network-monitor-impl-netlink.hpp b/ndn-cxx/net/impl/network-monitor-impl-netlink.hpp
index a7c7193..78501ae 100644
--- a/ndn-cxx/net/impl/network-monitor-impl-netlink.hpp
+++ b/ndn-cxx/net/impl/network-monitor-impl-netlink.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).
*
@@ -35,8 +35,7 @@
#include <map>
-namespace ndn {
-namespace net {
+namespace ndn::net {
class NetworkMonitorImplNetlink : public NetworkMonitorImpl
{
@@ -104,7 +103,6 @@
} m_phase = ENUMERATION_NOT_STARTED;
};
-} // namespace net
-} // namespace ndn
+} // namespace ndn::net
#endif // NDN_CXX_NET_NETWORK_MONITOR_IMPL_NETLINK_HPP
diff --git a/ndn-cxx/net/impl/network-monitor-impl-noop.hpp b/ndn-cxx/net/impl/network-monitor-impl-noop.hpp
index 617f319..d0a0d08 100644
--- a/ndn-cxx/net/impl/network-monitor-impl-noop.hpp
+++ b/ndn-cxx/net/impl/network-monitor-impl-noop.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -26,8 +26,7 @@
#include "ndn-cxx/net/network-monitor.hpp"
-namespace ndn {
-namespace net {
+namespace ndn::net {
class NetworkMonitorImplNoop : public NetworkMonitorImpl
{
@@ -56,7 +55,6 @@
}
};
-} // namespace net
-} // namespace ndn
+} // namespace ndn::net
#endif // NDN_CXX_NET_NETWORK_MONITOR_IMPL_NOOP_HPP
diff --git a/ndn-cxx/net/impl/network-monitor-impl-osx.cpp b/ndn-cxx/net/impl/network-monitor-impl-osx.cpp
index b10c6eb..0b543d7 100644
--- a/ndn-cxx/net/impl/network-monitor-impl-osx.cpp
+++ b/ndn-cxx/net/impl/network-monitor-impl-osx.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).
*
@@ -68,12 +68,11 @@
#include <boost/range/adaptor/map.hpp>
#include <boost/range/algorithm_ext/push_back.hpp>
+namespace ndn::net {
+
NDN_LOG_INIT(ndn.NetworkMonitor);
-namespace ndn {
-namespace net {
-
-using detail::CFReleaser;
+using ndn::detail::CFReleaser;
class IfAddrs : noncopyable
{
@@ -461,5 +460,4 @@
}
}
-} // namespace net
-} // namespace ndn
+} // namespace ndn::net
diff --git a/ndn-cxx/net/impl/network-monitor-impl-osx.hpp b/ndn-cxx/net/impl/network-monitor-impl-osx.hpp
index 67a28f8..099ae8b 100644
--- a/ndn-cxx/net/impl/network-monitor-impl-osx.hpp
+++ b/ndn-cxx/net/impl/network-monitor-impl-osx.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -38,8 +38,7 @@
#include <boost/asio/ip/udp.hpp>
#include <map>
-namespace ndn {
-namespace net {
+namespace ndn::net {
class IfAddrs;
@@ -111,7 +110,6 @@
boost::asio::ip::udp::socket m_ioctlSocket;
};
-} // namespace net
-} // namespace ndn
+} // namespace ndn::net
#endif // NDN_CXX_NET_NETWORK_MONITOR_IMPL_OSX_HPP
diff --git a/ndn-cxx/net/network-address.cpp b/ndn-cxx/net/network-address.cpp
index f8e8a6e..40ff6fa 100644
--- a/ndn-cxx/net/network-address.cpp
+++ b/ndn-cxx/net/network-address.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).
*
@@ -27,8 +27,7 @@
#include <linux/if_addr.h>
#endif
-namespace ndn {
-namespace net {
+namespace ndn::net {
std::ostream&
operator<<(std::ostream& os, AddressScope scope)
@@ -79,5 +78,4 @@
return os << addr.getIp() << '/' << static_cast<unsigned int>(addr.getPrefixLength());
}
-} // namespace net
-} // namespace ndn
+} // namespace ndn::net
diff --git a/ndn-cxx/net/network-address.hpp b/ndn-cxx/net/network-address.hpp
index 1bb435c..d70e611 100644
--- a/ndn-cxx/net/network-address.hpp
+++ b/ndn-cxx/net/network-address.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -28,8 +28,7 @@
#include <boost/asio/ip/address.hpp>
-namespace ndn {
-namespace net {
+namespace ndn::net {
enum class AddressFamily {
UNSPECIFIED,
@@ -140,7 +139,6 @@
std::ostream&
operator<<(std::ostream& os, const NetworkAddress& address);
-} // namespace net
-} // namespace ndn
+} // namespace ndn::net
#endif // NDN_CXX_NET_NETWORK_ADDRESS_HPP
diff --git a/ndn-cxx/net/network-interface.cpp b/ndn-cxx/net/network-interface.cpp
index 2adf2ef..250e1d6 100644
--- a/ndn-cxx/net/network-interface.cpp
+++ b/ndn-cxx/net/network-interface.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,10 +28,9 @@
#include <net/if.h>
-NDN_LOG_INIT(ndn.NetworkMonitor);
+namespace ndn::net {
-namespace ndn {
-namespace net {
+NDN_LOG_INIT(ndn.NetworkMonitor);
NetworkInterface::NetworkInterface()
: m_index(0)
@@ -241,5 +240,4 @@
return os;
}
-} // namespace net
-} // namespace ndn
+} // namespace ndn::net
diff --git a/ndn-cxx/net/network-interface.hpp b/ndn-cxx/net/network-interface.hpp
index 29277c9..dca92b9 100644
--- a/ndn-cxx/net/network-interface.hpp
+++ b/ndn-cxx/net/network-interface.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -26,12 +26,11 @@
#include "ndn-cxx/net/ethernet.hpp"
#include "ndn-cxx/net/network-address.hpp"
-#include "ndn-cxx/util/signal.hpp"
+#include "ndn-cxx/util/signal/signal.hpp"
#include <set>
-namespace ndn {
-namespace net {
+namespace ndn::net {
/** @brief Indicates the hardware type of a network interface
*/
@@ -71,19 +70,19 @@
public: // signals, marked 'mutable' so they can be connected on 'const NetworkInterface'
/** @brief Fires when interface state changes
*/
- mutable util::Signal<NetworkInterface, InterfaceState /*old*/, InterfaceState /*new*/> onStateChanged;
+ mutable signal::Signal<NetworkInterface, InterfaceState /*old*/, InterfaceState /*new*/> onStateChanged;
/** @brief Fires when interface mtu changes
*/
- mutable util::Signal<NetworkInterface, uint32_t /*old*/, uint32_t /*new*/> onMtuChanged;
+ mutable signal::Signal<NetworkInterface, uint32_t /*old*/, uint32_t /*new*/> onMtuChanged;
/** @brief Fires when a network-layer address is added to the interface
*/
- mutable util::Signal<NetworkInterface, NetworkAddress> onAddressAdded;
+ mutable signal::Signal<NetworkInterface, NetworkAddress> onAddressAdded;
/** @brief Fires when a network-layer address is removed from the interface
*/
- mutable util::Signal<NetworkInterface, NetworkAddress> onAddressRemoved;
+ mutable signal::Signal<NetworkInterface, NetworkAddress> onAddressRemoved;
public: // getters
/** @brief Returns an opaque ID that uniquely identifies the interface on the system
@@ -249,7 +248,6 @@
std::ostream&
operator<<(std::ostream& os, const NetworkInterface& interface);
-} // namespace net
-} // namespace ndn
+} // namespace ndn::net
#endif // NDN_CXX_NET_NETWORK_INTERFACE_HPP
diff --git a/ndn-cxx/net/network-monitor-stub.cpp b/ndn-cxx/net/network-monitor-stub.cpp
index c84d8ae..bb8e49e 100644
--- a/ndn-cxx/net/network-monitor-stub.cpp
+++ b/ndn-cxx/net/network-monitor-stub.cpp
@@ -29,8 +29,7 @@
#include <boost/range/adaptor/map.hpp>
#include <boost/range/algorithm/copy.hpp>
-namespace ndn {
-namespace net {
+namespace ndn::net {
class NetworkMonitorImplStub : public NetworkMonitorImpl
{
@@ -134,5 +133,4 @@
this->getImpl().emitEnumerationCompleted();
}
-} // namespace net
-} // namespace ndn
+} // namespace ndn::net
diff --git a/ndn-cxx/net/network-monitor-stub.hpp b/ndn-cxx/net/network-monitor-stub.hpp
index 25f8849..b6bf852 100644
--- a/ndn-cxx/net/network-monitor-stub.hpp
+++ b/ndn-cxx/net/network-monitor-stub.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).
*
@@ -24,8 +24,7 @@
#include "ndn-cxx/net/network-monitor.hpp"
-namespace ndn {
-namespace net {
+namespace ndn::net {
class NetworkMonitorImplStub;
@@ -85,7 +84,6 @@
getImpl();
};
-} // namespace net
-} // namespace ndn
+} // namespace ndn::net
#endif // NDN_CXX_NET_NETWORK_MONITOR_STUB_HPP
diff --git a/ndn-cxx/net/network-monitor.cpp b/ndn-cxx/net/network-monitor.cpp
index 511d750..79e601f 100644
--- a/ndn-cxx/net/network-monitor.cpp
+++ b/ndn-cxx/net/network-monitor.cpp
@@ -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).
*
@@ -37,10 +37,9 @@
#define NETWORK_MONITOR_IMPL_TYPE NetworkMonitorImplNoop
#endif
-NDN_LOG_INIT(ndn.NetworkMonitor);
+namespace ndn::net {
-namespace ndn {
-namespace net {
+NDN_LOG_INIT(ndn.NetworkMonitor);
static unique_ptr<NetworkMonitorImpl>
makeNetworkMonitorImpl(boost::asio::io_service& io)
@@ -94,5 +93,4 @@
return shared_ptr<NetworkInterface>(new NetworkInterface);
}
-} // namespace net
-} // namespace ndn
+} // namespace ndn::net
diff --git a/ndn-cxx/net/network-monitor.hpp b/ndn-cxx/net/network-monitor.hpp
index 3bd8927..f45c4d5 100644
--- a/ndn-cxx/net/network-monitor.hpp
+++ b/ndn-cxx/net/network-monitor.hpp
@@ -27,11 +27,12 @@
#include "ndn-cxx/detail/asio-fwd.hpp"
#include "ndn-cxx/net/network-interface.hpp"
+#include "ndn-cxx/util/signal/emit.hpp"
+#include "ndn-cxx/util/signal/signal.hpp"
#include <vector>
-namespace ndn {
-namespace net {
+namespace ndn::net {
class NetworkMonitorImpl;
@@ -112,20 +113,20 @@
public: // signals
/// Fires when the enumeration of all network interfaces on the system is complete.
- util::Signal<NetworkMonitorImpl>& onEnumerationCompleted;
+ signal::Signal<NetworkMonitorImpl>& onEnumerationCompleted;
/// Fires whenever a new interface is detected on the system.
- util::Signal<NetworkMonitorImpl, shared_ptr<const NetworkInterface>>& onInterfaceAdded;
+ signal::Signal<NetworkMonitorImpl, shared_ptr<const NetworkInterface>>& onInterfaceAdded;
/**
* @brief Fires whenever an interface disappears from the system.
* @note The NetworkInterface object has already been removed from the list
* returned by listNetworkInterfaces() when this signal is emitted.
*/
- util::Signal<NetworkMonitorImpl, shared_ptr<const NetworkInterface>>& onInterfaceRemoved;
+ signal::Signal<NetworkMonitorImpl, shared_ptr<const NetworkInterface>>& onInterfaceRemoved;
/// @deprecated Only for backward compatibility
- util::Signal<NetworkMonitorImpl>& onNetworkStateChanged;
+ signal::Signal<NetworkMonitorImpl>& onNetworkStateChanged;
};
class NetworkMonitorImpl : noncopyable
@@ -150,10 +151,10 @@
makeNetworkInterface();
public:
- util::Signal<NetworkMonitorImpl> onEnumerationCompleted;
- util::Signal<NetworkMonitorImpl, shared_ptr<const NetworkInterface>> onInterfaceAdded;
- util::Signal<NetworkMonitorImpl, shared_ptr<const NetworkInterface>> onInterfaceRemoved;
- util::Signal<NetworkMonitorImpl> onNetworkStateChanged;
+ signal::Signal<NetworkMonitorImpl> onEnumerationCompleted;
+ signal::Signal<NetworkMonitorImpl, shared_ptr<const NetworkInterface>> onInterfaceAdded;
+ signal::Signal<NetworkMonitorImpl, shared_ptr<const NetworkInterface>> onInterfaceRemoved;
+ signal::Signal<NetworkMonitorImpl> onNetworkStateChanged;
protected:
DECLARE_SIGNAL_EMIT(onEnumerationCompleted)
@@ -162,7 +163,6 @@
DECLARE_SIGNAL_EMIT(onNetworkStateChanged)
};
-} // namespace net
-} // namespace ndn
+} // namespace ndn::net
#endif // NDN_CXX_NET_NETWORK_MONITOR_HPP
diff --git a/ndn-cxx/security/additional-description.cpp b/ndn-cxx/security/additional-description.cpp
index 727cb57..52c4650 100644
--- a/ndn-cxx/security/additional-description.cpp
+++ b/ndn-cxx/security/additional-description.cpp
@@ -23,9 +23,7 @@
#include "ndn-cxx/encoding/block-helpers.hpp"
#include "ndn-cxx/util/ostream-joiner.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
constexpr size_t KEY_OFFSET = 0;
constexpr size_t VALUE_OFFSET = 1;
@@ -168,6 +166,4 @@
return os << "]";
}
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
diff --git a/ndn-cxx/security/additional-description.hpp b/ndn-cxx/security/additional-description.hpp
index d42aca7..09fa9c6 100644
--- a/ndn-cxx/security/additional-description.hpp
+++ b/ndn-cxx/security/additional-description.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,9 +27,7 @@
#include <map>
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
/**
* @brief Represents an %AdditionalDescription TLV element.
@@ -136,9 +134,6 @@
std::ostream&
operator<<(std::ostream& os, const AdditionalDescription& desc);
-} // inline namespace v2
-
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_ADDITIONAL_DESCRIPTION_HPP
diff --git a/ndn-cxx/security/certificate-bundle-fetcher.cpp b/ndn-cxx/security/certificate-bundle-fetcher.cpp
index f360220..1179bf0 100644
--- a/ndn-cxx/security/certificate-bundle-fetcher.cpp
+++ b/ndn-cxx/security/certificate-bundle-fetcher.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).
*
@@ -27,9 +27,7 @@
#include "ndn-cxx/security/validation-state.hpp"
#include "ndn-cxx/util/logger.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
NDN_LOG_INIT(ndn.security.CertificateBundleFetcher);
@@ -230,6 +228,4 @@
return bundleName;
}
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
diff --git a/ndn-cxx/security/certificate-bundle-fetcher.hpp b/ndn-cxx/security/certificate-bundle-fetcher.hpp
index 6e9d683..1d3e4ff 100644
--- a/ndn-cxx/security/certificate-bundle-fetcher.hpp
+++ b/ndn-cxx/security/certificate-bundle-fetcher.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -26,9 +26,7 @@
#include "ndn-cxx/tag.hpp"
#include "ndn-cxx/security/certificate-fetcher-from-network.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
/**
* @brief Fetch certificate bundle from the network
@@ -144,8 +142,6 @@
time::milliseconds m_bundleInterestLifetime;
};
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_CERTIFICATE_BUNDLE_FETCHER_HPP
diff --git a/ndn-cxx/security/certificate-cache.cpp b/ndn-cxx/security/certificate-cache.cpp
index bf5cb6c..4321737 100644
--- a/ndn-cxx/security/certificate-cache.cpp
+++ b/ndn-cxx/security/certificate-cache.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).
*
@@ -22,18 +22,10 @@
#include "ndn-cxx/security/certificate-cache.hpp"
#include "ndn-cxx/util/logger.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
NDN_LOG_INIT(ndn.security.CertificateCache);
-time::nanoseconds
-CertificateCache::getDefaultLifetime()
-{
- return 1_h;
-}
-
CertificateCache::CertificateCache(const time::nanoseconds& maxLifetime)
: m_certsByTime(m_certs.get<0>())
, m_certsByName(m_certs.get<1>())
@@ -44,14 +36,14 @@
void
CertificateCache::insert(const Certificate& cert)
{
- time::system_clock::TimePoint notAfterTime = cert.getValidityPeriod().getPeriod().second;
- time::system_clock::TimePoint now = time::system_clock::now();
+ auto notAfterTime = cert.getValidityPeriod().getPeriod().second;
+ auto now = time::system_clock::now();
if (notAfterTime < now) {
NDN_LOG_DEBUG("Not adding " << cert.getName() << ": already expired at " << time::toIsoString(notAfterTime));
return;
}
- time::system_clock::TimePoint removalTime = std::min(notAfterTime, now + m_maxLifetime);
+ auto removalTime = std::min(notAfterTime, now + m_maxLifetime);
NDN_LOG_DEBUG("Adding " << cert.getName() << ", will remove in "
<< time::duration_cast<time::seconds>(removalTime - now));
m_certs.insert(Entry(cert, removalTime));
@@ -98,7 +90,7 @@
void
CertificateCache::refresh()
{
- time::system_clock::TimePoint now = time::system_clock::now();
+ auto now = time::system_clock::now();
auto cIt = m_certsByTime.begin();
while (cIt != m_certsByTime.end() && cIt->removalTime < now) {
@@ -107,6 +99,4 @@
}
}
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
diff --git a/ndn-cxx/security/certificate-cache.hpp b/ndn-cxx/security/certificate-cache.hpp
index 13e8d33..f86ca59 100644
--- a/ndn-cxx/security/certificate-cache.hpp
+++ b/ndn-cxx/security/certificate-cache.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -30,9 +30,7 @@
#include <boost/multi_index/mem_fun.hpp>
#include <boost/multi_index/member.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
/**
* @brief Represents a container for verified certificates.
@@ -92,7 +90,8 @@
class Entry
{
public:
- Entry(const Certificate& cert, const time::system_clock::TimePoint& removalTime)
+ explicit
+ Entry(const Certificate& cert, const time::system_clock::time_point& removalTime)
: cert(cert)
, removalTime(removalTime)
{
@@ -106,7 +105,7 @@
public:
Certificate cert;
- time::system_clock::TimePoint removalTime;
+ time::system_clock::time_point removalTime;
};
/**
@@ -116,33 +115,34 @@
refresh();
public:
- static time::nanoseconds
- getDefaultLifetime();
+ static constexpr time::nanoseconds
+ getDefaultLifetime() noexcept
+ {
+ return 1_h;
+ }
private:
- /// @todo Switch to InMemoryStorateTimeout after it is available (task #3917)
- typedef boost::multi_index::multi_index_container<
+ /// @todo Switch to InMemoryStorageTimeout after it is available (task #3917)
+ using CertIndex = boost::multi_index::multi_index_container<
Entry,
boost::multi_index::indexed_by<
boost::multi_index::ordered_non_unique<
- boost::multi_index::member<Entry, const time::system_clock::TimePoint, &Entry::removalTime>
+ boost::multi_index::member<Entry, const time::system_clock::time_point, &Entry::removalTime>
>,
boost::multi_index::ordered_unique<
boost::multi_index::const_mem_fun<Entry, const Name&, &Entry::getCertName>
>
>
- > CertIndex;
+ >;
+ using CertIndexByTime = CertIndex::nth_index<0>::type;
+ using CertIndexByName = CertIndex::nth_index<1>::type;
- typedef CertIndex::nth_index<0>::type CertIndexByTime;
- typedef CertIndex::nth_index<1>::type CertIndexByName;
CertIndex m_certs;
CertIndexByTime& m_certsByTime;
CertIndexByName& m_certsByName;
time::nanoseconds m_maxLifetime;
};
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_CERTIFICATE_CACHE_HPP
diff --git a/ndn-cxx/security/certificate-fetcher-direct-fetch.cpp b/ndn-cxx/security/certificate-fetcher-direct-fetch.cpp
index 06c6a57..c7df4f2 100644
--- a/ndn-cxx/security/certificate-fetcher-direct-fetch.cpp
+++ b/ndn-cxx/security/certificate-fetcher-direct-fetch.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,9 +26,7 @@
#include "ndn-cxx/security/certificate-request.hpp"
#include "ndn-cxx/security/validation-state.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
CertificateFetcherDirectFetch::CertificateFetcherDirectFetch(Face& face)
: CertificateFetcherFromNetwork(face)
@@ -94,6 +92,4 @@
}
}
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
diff --git a/ndn-cxx/security/certificate-fetcher-direct-fetch.hpp b/ndn-cxx/security/certificate-fetcher-direct-fetch.hpp
index 0ec8bb5..f11a662 100644
--- a/ndn-cxx/security/certificate-fetcher-direct-fetch.hpp
+++ b/ndn-cxx/security/certificate-fetcher-direct-fetch.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,9 +24,7 @@
#include "ndn-cxx/security/certificate-fetcher-from-network.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
/**
* @brief Extends CertificateFetcherFromNetwork to fetch certificates from the incoming face of
@@ -58,8 +56,6 @@
bool m_wantDirectInterestOnly = false;
};
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_CERTIFICATE_FETCHER_DIRECT_FETCH_HPP
diff --git a/ndn-cxx/security/certificate-fetcher-from-network.cpp b/ndn-cxx/security/certificate-fetcher-from-network.cpp
index 65c70c9..0861c0d 100644
--- a/ndn-cxx/security/certificate-fetcher-from-network.cpp
+++ b/ndn-cxx/security/certificate-fetcher-from-network.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,9 +26,7 @@
#include "ndn-cxx/security/validation-state.hpp"
#include "ndn-cxx/util/logger.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
NDN_LOG_INIT(ndn.security.CertificateFetcher);
@@ -114,6 +112,4 @@
}
}
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
diff --git a/ndn-cxx/security/certificate-fetcher-from-network.hpp b/ndn-cxx/security/certificate-fetcher-from-network.hpp
index 6074c66..fedd880 100644
--- a/ndn-cxx/security/certificate-fetcher-from-network.hpp
+++ b/ndn-cxx/security/certificate-fetcher-from-network.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -35,7 +35,6 @@
} // namespace lp
namespace security {
-inline namespace v2 {
/**
* @brief Fetch missing keys from the network
@@ -83,7 +82,6 @@
Scheduler m_scheduler;
};
-} // inline namespace v2
} // namespace security
} // namespace ndn
diff --git a/ndn-cxx/security/certificate-fetcher-offline.cpp b/ndn-cxx/security/certificate-fetcher-offline.cpp
index a613a9e..00709b4 100644
--- a/ndn-cxx/security/certificate-fetcher-offline.cpp
+++ b/ndn-cxx/security/certificate-fetcher-offline.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).
*
@@ -23,9 +23,7 @@
#include "ndn-cxx/security/certificate-request.hpp"
#include "ndn-cxx/security/validation-state.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
void
CertificateFetcherOffline::doFetch(const shared_ptr<CertificateRequest>& certRequest,
@@ -36,6 +34,4 @@
"Cannot fetch `" + certRequest->interest.getName().toUri() + "` in offline mode"});
}
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
diff --git a/ndn-cxx/security/certificate-fetcher-offline.hpp b/ndn-cxx/security/certificate-fetcher-offline.hpp
index 84412eb..55c9a86 100644
--- a/ndn-cxx/security/certificate-fetcher-offline.hpp
+++ b/ndn-cxx/security/certificate-fetcher-offline.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,9 +24,7 @@
#include "ndn-cxx/security/certificate-fetcher.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
/**
* @brief Certificate fetcher realization that does not fetch keys (always offline)
@@ -39,8 +37,6 @@
const ValidationContinuation& continueValidation) override;
};
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_CERTIFICATE_FETCHER_OFFLINE_HPP
diff --git a/ndn-cxx/security/certificate-fetcher.cpp b/ndn-cxx/security/certificate-fetcher.cpp
index 931b83e..408c61d 100644
--- a/ndn-cxx/security/certificate-fetcher.cpp
+++ b/ndn-cxx/security/certificate-fetcher.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).
*
@@ -25,9 +25,7 @@
#include "ndn-cxx/security/validation-state.hpp"
#include "ndn-cxx/util/logger.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
NDN_LOG_INIT(ndn.security.CertificateFetcher);
@@ -66,6 +64,4 @@
});
}
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
diff --git a/ndn-cxx/security/certificate-fetcher.hpp b/ndn-cxx/security/certificate-fetcher.hpp
index fa4b9eb..541342e 100644
--- a/ndn-cxx/security/certificate-fetcher.hpp
+++ b/ndn-cxx/security/certificate-fetcher.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,9 +24,7 @@
#include "ndn-cxx/detail/common.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
class Certificate;
class CertificateRequest;
@@ -84,8 +82,6 @@
CertificateStorage* m_certStorage;
};
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_CERTIFICATE_FETCHER_HPP
diff --git a/ndn-cxx/security/certificate-request.hpp b/ndn-cxx/security/certificate-request.hpp
index bb270dd..2aa9201 100644
--- a/ndn-cxx/security/certificate-request.hpp
+++ b/ndn-cxx/security/certificate-request.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).
*
@@ -24,9 +24,7 @@
#include "ndn-cxx/interest.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
/**
* @brief Request for a certificate, associated with the number of attempts.
@@ -58,8 +56,6 @@
time::milliseconds waitAfterNack = 500_ms;
};
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_CERTIFICATE_REQUEST_HPP
diff --git a/ndn-cxx/security/certificate-storage.cpp b/ndn-cxx/security/certificate-storage.cpp
index 95a2cb4..9e9a37c 100644
--- a/ndn-cxx/security/certificate-storage.cpp
+++ b/ndn-cxx/security/certificate-storage.cpp
@@ -21,9 +21,7 @@
#include "ndn-cxx/security/certificate-storage.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
CertificateStorage::CertificateStorage()
: m_verifiedCertCache(1_h)
@@ -103,6 +101,4 @@
return m_unverifiedCertCache;
}
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
diff --git a/ndn-cxx/security/certificate-storage.hpp b/ndn-cxx/security/certificate-storage.hpp
index 0f5a126..dbb72e0 100644
--- a/ndn-cxx/security/certificate-storage.hpp
+++ b/ndn-cxx/security/certificate-storage.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).
*
@@ -26,9 +26,7 @@
#include "ndn-cxx/security/certificate-cache.hpp"
#include "ndn-cxx/security/trust-anchor-container.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
/**
* @brief Storage for trusted anchors, verified certificate cache, and unverified certificate cache.
@@ -135,8 +133,6 @@
CertificateCache m_unverifiedCertCache;
};
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_CERTIFICATE_STORAGE_HPP
diff --git a/ndn-cxx/security/certificate.cpp b/ndn-cxx/security/certificate.cpp
index 67706fd..ac74913 100644
--- a/ndn-cxx/security/certificate.cpp
+++ b/ndn-cxx/security/certificate.cpp
@@ -27,9 +27,7 @@
#include "ndn-cxx/security/transform.hpp"
#include "ndn-cxx/util/indented-stream.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
Certificate::Certificate()
{
@@ -92,7 +90,7 @@
}
bool
-Certificate::isValid(const time::system_clock::TimePoint& ts) const
+Certificate::isValid(const time::system_clock::time_point& ts) const
{
return getSignatureInfo().getValidityPeriod().isValid(ts);
}
@@ -204,6 +202,4 @@
return certName.getPrefix(Certificate::KEY_ID_OFFSET + 1); // trim everything after key id
}
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
diff --git a/ndn-cxx/security/certificate.hpp b/ndn-cxx/security/certificate.hpp
index b533494..8061361 100644
--- a/ndn-cxx/security/certificate.hpp
+++ b/ndn-cxx/security/certificate.hpp
@@ -27,9 +27,7 @@
#include "ndn-cxx/data.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
/**
* @brief Represents an NDN certificate.
@@ -132,7 +130,7 @@
* @brief Check if the certificate is valid at @p ts.
*/
bool
- isValid(const time::system_clock::TimePoint& ts = time::system_clock::now()) const;
+ isValid(const time::system_clock::time_point& ts = time::system_clock::now()) const;
/**
* @brief Get extension with TLV @p type
@@ -176,8 +174,6 @@
Name
extractKeyNameFromCertName(const Name& certName);
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_CERTIFICATE_HPP
diff --git a/ndn-cxx/security/detail/certificate-bundle-decoder.cpp b/ndn-cxx/security/detail/certificate-bundle-decoder.cpp
index c66a50b..362da2e 100644
--- a/ndn-cxx/security/detail/certificate-bundle-decoder.cpp
+++ b/ndn-cxx/security/detail/certificate-bundle-decoder.cpp
@@ -22,9 +22,7 @@
#include "ndn-cxx/security/detail/certificate-bundle-decoder.hpp"
#include "ndn-cxx/util/scope.hpp"
-namespace ndn {
-namespace security {
-namespace detail {
+namespace ndn::security::detail {
void
CertificateBundleDecoder::append(const Block& segment)
@@ -60,6 +58,4 @@
}
}
-} // namespace detail
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::detail
diff --git a/ndn-cxx/security/detail/certificate-bundle-decoder.hpp b/ndn-cxx/security/detail/certificate-bundle-decoder.hpp
index 17f88ca..61ed825 100644
--- a/ndn-cxx/security/detail/certificate-bundle-decoder.hpp
+++ b/ndn-cxx/security/detail/certificate-bundle-decoder.hpp
@@ -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).
*
@@ -23,13 +23,12 @@
#define NDN_CXX_SECURITY_DETAIL_CERTIFICATE_BUNDLE_DECODER_HPP
#include "ndn-cxx/security/certificate.hpp"
-#include "ndn-cxx/util/signal.hpp"
+#include "ndn-cxx/util/signal/signal.hpp"
-namespace ndn {
-namespace security {
-namespace detail {
+namespace ndn::security::detail {
-/** @brief Helper class to decode a certificate bundle.
+/**
+ * @brief Helper class to decode a certificate bundle.
*/
class CertificateBundleDecoder
{
@@ -58,7 +57,7 @@
/**
* @brief Emitted every time a certificate is successfully decoded.
*/
- util::Signal<CertificateBundleDecoder, Certificate> onCertDecoded;
+ signal::Signal<CertificateBundleDecoder, Certificate> onCertDecoded;
private:
void
@@ -69,8 +68,6 @@
bool m_hasError = false;
};
-} // namespace detail
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::detail
#endif // NDN_CXX_SECURITY_DETAIL_CERTIFICATE_BUNDLE_DECODER_HPP
diff --git a/ndn-cxx/security/impl/openssl-helper.cpp b/ndn-cxx/security/impl/openssl-helper.cpp
index 0b14fa1..5abf6be 100644
--- a/ndn-cxx/security/impl/openssl-helper.cpp
+++ b/ndn-cxx/security/impl/openssl-helper.cpp
@@ -23,9 +23,7 @@
#include <limits>
-namespace ndn {
-namespace security {
-namespace detail {
+namespace ndn::security::detail {
const EVP_MD*
digestAlgorithmToEvpMd(DigestAlgorithm algo)
@@ -123,6 +121,4 @@
return n >= 0 && static_cast<size_t>(n) == buf.size();
}
-} // namespace detail
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::detail
diff --git a/ndn-cxx/security/impl/openssl-helper.hpp b/ndn-cxx/security/impl/openssl-helper.hpp
index e348391..2863277 100644
--- a/ndn-cxx/security/impl/openssl-helper.hpp
+++ b/ndn-cxx/security/impl/openssl-helper.hpp
@@ -27,9 +27,7 @@
#include <openssl/bio.h>
#include <openssl/evp.h>
-namespace ndn {
-namespace security {
-namespace detail {
+namespace ndn::security::detail {
[[nodiscard]] const EVP_MD*
digestAlgorithmToEvpMd(DigestAlgorithm algo);
@@ -96,8 +94,6 @@
BIO* m_bio;
};
-} // namespace detail
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::detail
#endif // NDN_CXX_SECURITY_IMPL_OPENSSL_HELPER_HPP
diff --git a/ndn-cxx/security/interest-signer.cpp b/ndn-cxx/security/interest-signer.cpp
index 5b12c83..ae6fe9d 100644
--- a/ndn-cxx/security/interest-signer.cpp
+++ b/ndn-cxx/security/interest-signer.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).
*
@@ -22,8 +22,7 @@
#include "ndn-cxx/security/interest-signer.hpp"
#include "ndn-cxx/util/random.hpp"
-namespace ndn {
-namespace security {
+namespace ndn::security {
InterestSigner::InterestSigner(KeyChain& keyChain)
: m_keyChain(keyChain)
@@ -73,7 +72,7 @@
return interest;
}
-time::system_clock::TimePoint
+time::system_clock::time_point
InterestSigner::getFreshTimestamp()
{
auto timestamp = time::system_clock::now();
@@ -87,5 +86,4 @@
return timestamp;
}
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
diff --git a/ndn-cxx/security/interest-signer.hpp b/ndn-cxx/security/interest-signer.hpp
index 76d73f5..e47e704 100644
--- a/ndn-cxx/security/interest-signer.hpp
+++ b/ndn-cxx/security/interest-signer.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,8 +24,7 @@
#include "ndn-cxx/security/key-chain.hpp"
-namespace ndn {
-namespace security {
+namespace ndn::security {
/**
* @brief Helper class to create signed Interests
@@ -78,16 +77,15 @@
/**
* @brief Get current timestamp, but ensure it is unique by increasing by 1 ms if already used
*/
- time::system_clock::TimePoint
+ time::system_clock::time_point
getFreshTimestamp();
private:
KeyChain& m_keyChain;
- time::system_clock::TimePoint m_lastUsedTimestamp;
+ time::system_clock::time_point m_lastUsedTimestamp;
uint64_t m_lastUsedSeqNum;
};
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_INTEREST_SIGNER_HPP
diff --git a/ndn-cxx/security/key-chain.cpp b/ndn-cxx/security/key-chain.cpp
index 2e27086..16f6c42 100644
--- a/ndn-cxx/security/key-chain.cpp
+++ b/ndn-cxx/security/key-chain.cpp
@@ -46,8 +46,9 @@
#include <boost/lexical_cast.hpp>
#include <cstdlib> // for std::getenv()
-namespace ndn {
-namespace security {
+namespace ndn::security {
+
+NDN_LOG_INIT(ndn.security.KeyChain);
// When static library is used, not everything is compiled into the resulting binary.
// Therefore, the following standard PIB and TPMs need to be registered here.
@@ -66,10 +67,6 @@
NDN_CXX_KEYCHAIN_REGISTER_TPM_BACKEND(BackEndMem);
} // namespace tpm
-inline namespace v2 {
-
-NDN_LOG_INIT(ndn.security.KeyChain);
-
const name::Component SELF{"self"};
KeyChain::PibFactories&
@@ -782,6 +779,4 @@
}
}
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
diff --git a/ndn-cxx/security/key-chain.hpp b/ndn-cxx/security/key-chain.hpp
index 4257cae..93787be 100644
--- a/ndn-cxx/security/key-chain.hpp
+++ b/ndn-cxx/security/key-chain.hpp
@@ -30,8 +30,10 @@
#include "ndn-cxx/security/signing-info.hpp"
#include "ndn-cxx/security/tpm/tpm.hpp"
-namespace ndn {
-namespace security {
+/**
+ * @brief Contains the ndn-cxx security framework.
+ */
+namespace ndn::security {
/**
* @brief Options to KeyChain::makeCertificate().
@@ -73,8 +75,6 @@
std::optional<ValidityPeriod> validity;
};
-inline namespace v2 {
-
/**
* @brief The main interface for signing key management.
*
@@ -515,6 +515,12 @@
static Locator s_defaultTpmLocator;
};
+} // namespace ndn::security
+
+namespace ndn {
+using security::KeyChain;
+} // namespace ndn
+
/**
* @brief Register Pib backend class in KeyChain
*
@@ -547,11 +553,4 @@
} \
} ndnCxxAuto ## TpmType ## TpmRegistrationVariable
-} // inline namespace v2
-} // namespace security
-
-using security::KeyChain;
-
-} // namespace ndn
-
#endif // NDN_CXX_SECURITY_KEY_CHAIN_HPP
diff --git a/ndn-cxx/security/pib/certificate-container.cpp b/ndn-cxx/security/pib/certificate-container.cpp
index 24f66ce..873e37d 100644
--- a/ndn-cxx/security/pib/certificate-container.cpp
+++ b/ndn-cxx/security/pib/certificate-container.cpp
@@ -23,9 +23,7 @@
#include "ndn-cxx/security/pib/pib-impl.hpp"
#include "ndn-cxx/util/logger.hpp"
-namespace ndn {
-namespace security {
-namespace pib {
+namespace ndn::security::pib {
NDN_LOG_INIT(ndn.security.CertificateContainer);
@@ -124,6 +122,4 @@
return m_certNames == m_pib->getCertificatesOfKey(m_keyName);
}
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::pib
diff --git a/ndn-cxx/security/pib/certificate-container.hpp b/ndn-cxx/security/pib/certificate-container.hpp
index 52b4520..7c98468 100644
--- a/ndn-cxx/security/pib/certificate-container.hpp
+++ b/ndn-cxx/security/pib/certificate-container.hpp
@@ -28,16 +28,10 @@
#include <set>
#include <unordered_map>
-namespace ndn {
-namespace security {
-namespace pib {
+namespace ndn::security::pib {
class PibImpl;
-namespace detail {
-class KeyImpl;
-} // namespace detail
-
/**
* @brief Container of certificates of a key.
*
@@ -181,11 +175,9 @@
const Name m_keyName;
const shared_ptr<PibImpl> m_pib;
- friend detail::KeyImpl;
+ friend class KeyImpl;
};
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::pib
#endif // NDN_CXX_SECURITY_PIB_CERTIFICATE_CONTAINER_HPP
diff --git a/ndn-cxx/security/pib/identity-container.cpp b/ndn-cxx/security/pib/identity-container.cpp
index 6afeae0..8d80b95 100644
--- a/ndn-cxx/security/pib/identity-container.cpp
+++ b/ndn-cxx/security/pib/identity-container.cpp
@@ -24,9 +24,7 @@
#include "ndn-cxx/security/pib/pib-impl.hpp"
#include "ndn-cxx/util/logger.hpp"
-namespace ndn {
-namespace security {
-namespace pib {
+namespace ndn::security::pib {
NDN_LOG_INIT(ndn.security.IdentityContainer);
@@ -79,7 +77,7 @@
NDN_LOG_DEBUG("Adding " << identityName);
m_pib->addIdentity(identityName);
auto ret = m_identities.emplace(identityName,
- std::make_shared<detail::IdentityImpl>(identityName, m_pib));
+ std::make_shared<IdentityImpl>(identityName, m_pib));
// consistency check
BOOST_ASSERT(ret.second);
@@ -112,7 +110,7 @@
NDN_THROW(Pib::Error("Identity `" + identityName.toUri() + "` does not exist"));
}
- auto id = std::make_shared<detail::IdentityImpl>(identityName, m_pib);
+ auto id = std::make_shared<IdentityImpl>(identityName, m_pib);
m_identities[identityName] = id;
return Identity(id);
}
@@ -131,6 +129,4 @@
return m_identityNames == m_pib->getIdentities();
}
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::pib
diff --git a/ndn-cxx/security/pib/identity-container.hpp b/ndn-cxx/security/pib/identity-container.hpp
index 75fe3f4..786c7ba 100644
--- a/ndn-cxx/security/pib/identity-container.hpp
+++ b/ndn-cxx/security/pib/identity-container.hpp
@@ -28,17 +28,10 @@
#include <set>
#include <unordered_map>
-namespace ndn {
-namespace security {
-namespace pib {
+namespace ndn::security::pib {
-class Pib;
class PibImpl;
-namespace detail {
-class IdentityImpl;
-} // namespace detail
-
/**
* @brief Container of identities of a PIB.
*
@@ -181,17 +174,15 @@
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE:
// cache of loaded IdentityImpl
- mutable std::unordered_map<Name, shared_ptr<detail::IdentityImpl>> m_identities;
+ mutable std::unordered_map<Name, shared_ptr<IdentityImpl>> m_identities;
private:
NameSet m_identityNames;
const shared_ptr<PibImpl> m_pib;
- friend Pib;
+ friend class Pib;
};
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::pib
#endif // NDN_CXX_SECURITY_PIB_IDENTITY_CONTAINER_HPP
diff --git a/ndn-cxx/security/pib/identity.cpp b/ndn-cxx/security/pib/identity.cpp
index 41e103b..c141aa7 100644
--- a/ndn-cxx/security/pib/identity.cpp
+++ b/ndn-cxx/security/pib/identity.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).
*
@@ -22,13 +22,11 @@
#include "ndn-cxx/security/pib/identity.hpp"
#include "ndn-cxx/security/pib/impl/identity-impl.hpp"
-namespace ndn {
-namespace security {
-namespace pib {
+namespace ndn::security::pib {
Identity::Identity() noexcept = default;
-Identity::Identity(weak_ptr<detail::IdentityImpl> impl) noexcept
+Identity::Identity(weak_ptr<IdentityImpl> impl) noexcept
: m_impl(std::move(impl))
{
}
@@ -86,7 +84,7 @@
return !m_impl.expired();
}
-shared_ptr<detail::IdentityImpl>
+shared_ptr<IdentityImpl>
Identity::lock() const
{
auto impl = m_impl.lock();
@@ -103,6 +101,4 @@
!other.m_impl.owner_before(this->m_impl);
}
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::pib
diff --git a/ndn-cxx/security/pib/identity.hpp b/ndn-cxx/security/pib/identity.hpp
index 31acd9b..b39335b 100644
--- a/ndn-cxx/security/pib/identity.hpp
+++ b/ndn-cxx/security/pib/identity.hpp
@@ -24,20 +24,14 @@
#include "ndn-cxx/security/pib/key-container.hpp"
-namespace ndn {
-namespace security {
+namespace ndn::security {
-inline namespace v2 {
class KeyChain;
-} // inline namespace v2
namespace pib {
class IdentityContainer;
-
-namespace detail {
class IdentityImpl;
-} // namespace detail
/**
* @brief Frontend handle for an identity in the PIB.
@@ -143,7 +137,7 @@
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE: // private interface for IdentityContainer
explicit
- Identity(weak_ptr<detail::IdentityImpl> impl) noexcept;
+ Identity(weak_ptr<IdentityImpl> impl) noexcept;
private:
/**
@@ -151,7 +145,7 @@
* @return a shared_ptr when the instance is valid
* @throw std::domain_error the instance is invalid
*/
- shared_ptr<detail::IdentityImpl>
+ shared_ptr<IdentityImpl>
lock() const;
bool
@@ -183,7 +177,7 @@
}
private:
- weak_ptr<detail::IdentityImpl> m_impl;
+ weak_ptr<IdentityImpl> m_impl;
friend KeyChain;
friend IdentityContainer;
@@ -193,7 +187,6 @@
using pib::Identity;
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_PIB_IDENTITY_HPP
diff --git a/ndn-cxx/security/pib/impl/identity-impl.cpp b/ndn-cxx/security/pib/impl/identity-impl.cpp
index 0256c54..8c19088 100644
--- a/ndn-cxx/security/pib/impl/identity-impl.cpp
+++ b/ndn-cxx/security/pib/impl/identity-impl.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).
*
@@ -23,10 +23,7 @@
#include "ndn-cxx/security/pib/pib-impl.hpp"
#include "ndn-cxx/util/logger.hpp"
-namespace ndn {
-namespace security {
-namespace pib {
-namespace detail {
+namespace ndn::security::pib {
NDN_LOG_INIT(ndn.security.Identity);
@@ -86,7 +83,4 @@
return m_defaultKey;
}
-} // namespace detail
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::pib
diff --git a/ndn-cxx/security/pib/impl/identity-impl.hpp b/ndn-cxx/security/pib/impl/identity-impl.hpp
index 36f7a3f..553dbad 100644
--- a/ndn-cxx/security/pib/impl/identity-impl.hpp
+++ b/ndn-cxx/security/pib/impl/identity-impl.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).
*
@@ -24,14 +24,10 @@
#include "ndn-cxx/security/pib/key-container.hpp"
-namespace ndn {
-namespace security {
-namespace pib {
+namespace ndn::security::pib {
class PibImpl;
-namespace detail {
-
/**
* @brief Backend instance of Identity.
*
@@ -109,9 +105,6 @@
mutable Key m_defaultKey;
};
-} // namespace detail
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::pib
#endif // NDN_CXX_SECURITY_PIB_IMPL_IDENTITY_IMPL_HPP
diff --git a/ndn-cxx/security/pib/impl/key-impl.cpp b/ndn-cxx/security/pib/impl/key-impl.cpp
index 23b6303..85fc322 100644
--- a/ndn-cxx/security/pib/impl/key-impl.cpp
+++ b/ndn-cxx/security/pib/impl/key-impl.cpp
@@ -24,10 +24,7 @@
#include "ndn-cxx/security/transform/public-key.hpp"
#include "ndn-cxx/util/logger.hpp"
-namespace ndn {
-namespace security {
-namespace pib {
-namespace detail {
+namespace ndn::security::pib {
NDN_LOG_INIT(ndn.security.Key);
@@ -103,7 +100,4 @@
return *m_defaultCert;
}
-} // namespace detail
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::pib
diff --git a/ndn-cxx/security/pib/impl/key-impl.hpp b/ndn-cxx/security/pib/impl/key-impl.hpp
index b6d73c6..74767e6 100644
--- a/ndn-cxx/security/pib/impl/key-impl.hpp
+++ b/ndn-cxx/security/pib/impl/key-impl.hpp
@@ -25,14 +25,10 @@
#include "ndn-cxx/security/security-common.hpp"
#include "ndn-cxx/security/pib/certificate-container.hpp"
-namespace ndn {
-namespace security {
-namespace pib {
+namespace ndn::security::pib {
class PibImpl;
-namespace detail {
-
/**
* @brief Backend instance of Key.
*
@@ -134,9 +130,6 @@
mutable std::optional<Certificate> m_defaultCert;
};
-} // namespace detail
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::pib
#endif // NDN_CXX_SECURITY_PIB_IMPL_KEY_IMPL_HPP
diff --git a/ndn-cxx/security/pib/impl/pib-memory.cpp b/ndn-cxx/security/pib/impl/pib-memory.cpp
index 973d9d6..c75ffe3 100644
--- a/ndn-cxx/security/pib/impl/pib-memory.cpp
+++ b/ndn-cxx/security/pib/impl/pib-memory.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).
*
@@ -25,9 +25,7 @@
#include <boost/range/adaptor/map.hpp>
#include <boost/range/algorithm_ext/insert.hpp>
-namespace ndn {
-namespace security {
-namespace pib {
+namespace ndn::security::pib {
PibMemory::PibMemory(const std::string&)
{
@@ -263,6 +261,4 @@
return certIt->second;
}
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::pib
diff --git a/ndn-cxx/security/pib/impl/pib-memory.hpp b/ndn-cxx/security/pib/impl/pib-memory.hpp
index a2e7abd..94fddb3 100644
--- a/ndn-cxx/security/pib/impl/pib-memory.hpp
+++ b/ndn-cxx/security/pib/impl/pib-memory.hpp
@@ -24,9 +24,7 @@
#include "ndn-cxx/security/pib/pib-impl.hpp"
-namespace ndn {
-namespace security {
-namespace pib {
+namespace ndn::security::pib {
/**
* @brief An in-memory PIB implementation.
@@ -142,8 +140,6 @@
std::map<Name, Certificate> m_certs;
};
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::pib
#endif // NDN_CXX_SECURITY_PIB_IMPL_PIB_MEMORY_HPP
diff --git a/ndn-cxx/security/pib/impl/pib-sqlite3.cpp b/ndn-cxx/security/pib/impl/pib-sqlite3.cpp
index 514f6de..938eada 100644
--- a/ndn-cxx/security/pib/impl/pib-sqlite3.cpp
+++ b/ndn-cxx/security/pib/impl/pib-sqlite3.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).
*
@@ -27,11 +27,9 @@
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
-namespace ndn {
-namespace security {
-namespace pib {
+namespace ndn::security::pib {
-using util::Sqlite3Statement;
+using ndn::util::Sqlite3Statement;
static const char DB_INIT[] = R"SQL(
CREATE TABLE IF NOT EXISTS
@@ -575,6 +573,4 @@
return statement.step() == SQLITE_ROW;
}
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::pib
diff --git a/ndn-cxx/security/pib/impl/pib-sqlite3.hpp b/ndn-cxx/security/pib/impl/pib-sqlite3.hpp
index 783a6a7..9313b26 100644
--- a/ndn-cxx/security/pib/impl/pib-sqlite3.hpp
+++ b/ndn-cxx/security/pib/impl/pib-sqlite3.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -26,9 +26,7 @@
struct sqlite3;
-namespace ndn {
-namespace security {
-namespace pib {
+namespace ndn::security::pib {
/**
* @brief Pib backend implementation based on SQLite3 database
@@ -149,8 +147,6 @@
sqlite3* m_database;
};
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::pib
#endif // NDN_CXX_SECURITTY_PIB_IMPL_PIB_SQLITE3_HPP
diff --git a/ndn-cxx/security/pib/key-container.cpp b/ndn-cxx/security/pib/key-container.cpp
index c13c133..94084ce 100644
--- a/ndn-cxx/security/pib/key-container.cpp
+++ b/ndn-cxx/security/pib/key-container.cpp
@@ -24,9 +24,7 @@
#include "ndn-cxx/security/pib/pib-impl.hpp"
#include "ndn-cxx/util/logger.hpp"
-namespace ndn {
-namespace security {
-namespace pib {
+namespace ndn::security::pib {
NDN_LOG_INIT(ndn.security.KeyContainer);
@@ -80,7 +78,7 @@
NDN_LOG_DEBUG((isNew ? "Adding " : "Replacing ") << keyName);
m_pib->addKey(m_identity, keyName, keyBits);
- auto key = std::make_shared<detail::KeyImpl>(keyName, Buffer(keyBits.begin(), keyBits.end()), m_pib);
+ auto key = std::make_shared<KeyImpl>(keyName, Buffer(keyBits.begin(), keyBits.end()), m_pib);
m_keys[keyName] = key; // use insert_or_assign in C++17
return Key(key);
}
@@ -120,7 +118,7 @@
// because getKeyBits will throw if it doesn't
auto keyBits = m_pib->getKeyBits(keyName);
- auto key = std::make_shared<detail::KeyImpl>(keyName, std::move(keyBits), m_pib);
+ auto key = std::make_shared<KeyImpl>(keyName, std::move(keyBits), m_pib);
m_keys[keyName] = key;
return Key(key);
}
@@ -131,6 +129,4 @@
return m_keyNames == m_pib->getKeysOfIdentity(m_identity);
}
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::pib
diff --git a/ndn-cxx/security/pib/key-container.hpp b/ndn-cxx/security/pib/key-container.hpp
index cb9b211..2b9b36c 100644
--- a/ndn-cxx/security/pib/key-container.hpp
+++ b/ndn-cxx/security/pib/key-container.hpp
@@ -28,17 +28,10 @@
#include <set>
#include <unordered_map>
-namespace ndn {
-namespace security {
-namespace pib {
+namespace ndn::security::pib {
class PibImpl;
-namespace detail {
-class IdentityImpl;
-class KeyImpl;
-} // namespace detail
-
/**
* @brief Container of keys of an identity.
*
@@ -178,18 +171,16 @@
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE:
// cache of loaded KeyImpl
- mutable std::unordered_map<Name, shared_ptr<detail::KeyImpl>> m_keys;
+ mutable std::unordered_map<Name, shared_ptr<KeyImpl>> m_keys;
private:
NameSet m_keyNames;
const Name m_identity;
const shared_ptr<PibImpl> m_pib;
- friend detail::IdentityImpl;
+ friend class IdentityImpl;
};
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::pib
#endif // NDN_CXX_SECURITY_PIB_KEY_CONTAINER_HPP
diff --git a/ndn-cxx/security/pib/key.cpp b/ndn-cxx/security/pib/key.cpp
index 8dbb35e..69f96d0 100644
--- a/ndn-cxx/security/pib/key.cpp
+++ b/ndn-cxx/security/pib/key.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).
*
@@ -22,13 +22,12 @@
#include "ndn-cxx/security/pib/key.hpp"
#include "ndn-cxx/security/pib/impl/key-impl.hpp"
-namespace ndn {
-namespace security {
+namespace ndn::security {
namespace pib {
Key::Key() noexcept = default;
-Key::Key(weak_ptr<detail::KeyImpl> impl) noexcept
+Key::Key(weak_ptr<KeyImpl> impl) noexcept
: m_impl(std::move(impl))
{
}
@@ -104,7 +103,7 @@
return !m_impl.expired();
}
-shared_ptr<detail::KeyImpl>
+shared_ptr<KeyImpl>
Key::lock() const
{
auto impl = m_impl.lock();
@@ -123,8 +122,6 @@
} // namespace pib
-inline namespace v2 {
-
Name
constructKeyName(const Name& identity, const name::Component& keyId)
{
@@ -151,6 +148,4 @@
return keyName.getPrefix(-Certificate::MIN_KEY_NAME_LENGTH); // trim everything after and including "KEY"
}
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
diff --git a/ndn-cxx/security/pib/key.hpp b/ndn-cxx/security/pib/key.hpp
index 124ddc5..bd548fa 100644
--- a/ndn-cxx/security/pib/key.hpp
+++ b/ndn-cxx/security/pib/key.hpp
@@ -25,20 +25,14 @@
#include "ndn-cxx/security/pib/certificate-container.hpp"
#include "ndn-cxx/security/security-common.hpp"
-namespace ndn {
-namespace security {
+namespace ndn::security {
-inline namespace v2 {
class KeyChain;
-} // inline namespace v2
namespace pib {
class KeyContainer;
-
-namespace detail {
class KeyImpl;
-} // namespace detail
/**
* @brief Frontend handle for a key in the PIB.
@@ -162,7 +156,7 @@
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE: // private interface for KeyContainer
explicit
- Key(weak_ptr<detail::KeyImpl> impl) noexcept;
+ Key(weak_ptr<KeyImpl> impl) noexcept;
private:
/**
@@ -170,7 +164,7 @@
* @return a shared_ptr when the instance is valid
* @throw std::domain_error the instance is invalid
*/
- shared_ptr<detail::KeyImpl>
+ shared_ptr<KeyImpl>
lock() const;
bool
@@ -202,7 +196,7 @@
}
private:
- weak_ptr<detail::KeyImpl> m_impl;
+ weak_ptr<KeyImpl> m_impl;
friend KeyChain;
friend KeyContainer;
@@ -212,8 +206,6 @@
using pib::Key;
-inline namespace v2 {
-
/**
* @brief Construct key name based on the appropriate naming conventions
*/
@@ -232,8 +224,6 @@
Name
extractIdentityFromKeyName(const Name& keyName);
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_PIB_KEY_HPP
diff --git a/ndn-cxx/security/pib/pib-impl.hpp b/ndn-cxx/security/pib/pib-impl.hpp
index 3cad8e4..115b24e 100644
--- a/ndn-cxx/security/pib/pib-impl.hpp
+++ b/ndn-cxx/security/pib/pib-impl.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,9 +27,7 @@
#include <set>
-namespace ndn {
-namespace security {
-namespace pib {
+namespace ndn::security::pib {
/**
* @brief PIB backend interface.
@@ -276,8 +274,6 @@
getDefaultCertificateOfKey(const Name& keyName) const = 0;
};
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::pib
#endif // NDN_CXX_SECURITY_PIB_PIB_IMPL_HPP
diff --git a/ndn-cxx/security/pib/pib.cpp b/ndn-cxx/security/pib/pib.cpp
index 8fb52cc..0810ba8 100644
--- a/ndn-cxx/security/pib/pib.cpp
+++ b/ndn-cxx/security/pib/pib.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).
*
@@ -23,9 +23,7 @@
#include "ndn-cxx/security/pib/pib-impl.hpp"
#include "ndn-cxx/util/logger.hpp"
-namespace ndn {
-namespace security {
-namespace pib {
+namespace ndn::security::pib {
NDN_LOG_INIT(ndn.security.Pib);
@@ -127,6 +125,4 @@
return m_defaultIdentity;
}
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::pib
diff --git a/ndn-cxx/security/pib/pib.hpp b/ndn-cxx/security/pib/pib.hpp
index 4ae4c8d..331bb79 100644
--- a/ndn-cxx/security/pib/pib.hpp
+++ b/ndn-cxx/security/pib/pib.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).
*
@@ -24,8 +24,7 @@
#include "ndn-cxx/security/pib/identity-container.hpp"
-namespace ndn {
-namespace security {
+namespace ndn::security {
namespace pib {
class PibImpl;
@@ -160,7 +159,6 @@
using pib::Pib;
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_PIB_PIB_HPP
diff --git a/ndn-cxx/security/safe-bag.cpp b/ndn-cxx/security/safe-bag.cpp
index b6e6997..6662980 100644
--- a/ndn-cxx/security/safe-bag.cpp
+++ b/ndn-cxx/security/safe-bag.cpp
@@ -25,8 +25,7 @@
#include "ndn-cxx/encoding/encoding-buffer.hpp"
#include "ndn-cxx/encoding/tlv-security.hpp"
-namespace ndn {
-namespace security {
+namespace ndn::security {
SafeBag::SafeBag() = default;
@@ -108,5 +107,4 @@
}
}
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
diff --git a/ndn-cxx/security/safe-bag.hpp b/ndn-cxx/security/safe-bag.hpp
index 3e580a3..0d402ca 100644
--- a/ndn-cxx/security/safe-bag.hpp
+++ b/ndn-cxx/security/safe-bag.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).
*
@@ -28,8 +28,7 @@
#include "ndn-cxx/encoding/block.hpp"
#include "ndn-cxx/encoding/buffer.hpp"
-namespace ndn {
-namespace security {
+namespace ndn::security {
/**
* @brief A secured container for sensitive information (certificate, private key)
@@ -104,7 +103,6 @@
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(SafeBag);
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_SAFE_BAG_HPP
diff --git a/ndn-cxx/security/security-common.hpp b/ndn-cxx/security/security-common.hpp
index aedee38..8100a7c 100644
--- a/ndn-cxx/security/security-common.hpp
+++ b/ndn-cxx/security/security-common.hpp
@@ -31,11 +31,15 @@
namespace signed_interest {
+/// \deprecated The old Signed %Interest format is deprecated.
inline constexpr ssize_t POS_SIG_VALUE = -1;
+/// \deprecated The old Signed %Interest format is deprecated.
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
+/**
+ * \brief Minimum number of name components for an old-style Signed %Interest.
+ * \deprecated The old Signed %Interest format is deprecated.
+ * \sa https://redmine.named-data.net/projects/ndn-cxx/wiki/SignedInterest
*/
inline constexpr size_t MIN_SIZE = 2;
@@ -43,13 +47,19 @@
namespace command_interest {
-using signed_interest::POS_SIG_VALUE;
-using signed_interest::POS_SIG_INFO;
+/// \deprecated The Command %Interest format is deprecated.
+inline constexpr ssize_t POS_SIG_VALUE = -1;
+/// \deprecated The Command %Interest format is deprecated.
+inline constexpr ssize_t POS_SIG_INFO = -2;
+/// \deprecated The Command %Interest format is deprecated.
inline constexpr ssize_t POS_RANDOM_VAL = -3;
+/// \deprecated The Command %Interest format is deprecated.
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
+/**
+ * \brief Minimum number of name components for a Command %Interest.
+ * \deprecated The Command %Interest format is deprecated.
+ * \sa https://redmine.named-data.net/projects/ndn-cxx/wiki/CommandInterest
*/
inline constexpr size_t MIN_SIZE = 4;
diff --git a/ndn-cxx/security/signing-helpers.cpp b/ndn-cxx/security/signing-helpers.cpp
index a81097f..14c184e 100644
--- a/ndn-cxx/security/signing-helpers.cpp
+++ b/ndn-cxx/security/signing-helpers.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).
*
@@ -21,8 +21,7 @@
#include "ndn-cxx/security/signing-helpers.hpp"
-namespace ndn {
-namespace security {
+namespace ndn::security {
SigningInfo
signingByIdentity(const Name& identityName)
@@ -66,5 +65,4 @@
return SigningInfo(SigningInfo::SIGNER_TYPE_SHA256);
}
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
diff --git a/ndn-cxx/security/signing-info.cpp b/ndn-cxx/security/signing-info.cpp
index 1fd152f..d587606 100644
--- a/ndn-cxx/security/signing-info.cpp
+++ b/ndn-cxx/security/signing-info.cpp
@@ -26,8 +26,7 @@
#include "ndn-cxx/security/transform/buffer-source.hpp"
#include "ndn-cxx/security/transform/stream-sink.hpp"
-namespace ndn {
-namespace security {
+namespace ndn::security {
const Name&
SigningInfo::getDigestSha256Identity()
@@ -215,5 +214,4 @@
return os << "Unknown signed Interest format " << to_underlying(format);
}
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
diff --git a/ndn-cxx/security/signing-info.hpp b/ndn-cxx/security/signing-info.hpp
index 1cf56fa..b9d45f2 100644
--- a/ndn-cxx/security/signing-info.hpp
+++ b/ndn-cxx/security/signing-info.hpp
@@ -29,8 +29,7 @@
#include "ndn-cxx/security/security-common.hpp"
#include "ndn-cxx/security/transform/private-key.hpp"
-namespace ndn {
-namespace security {
+namespace ndn::security {
/**
* @note This is a transitional API to handle the change in signed Interest format and will
@@ -320,7 +319,6 @@
std::ostream&
operator<<(std::ostream& os, const SignedInterestFormat& format);
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_SIGNING_INFO_HPP
diff --git a/ndn-cxx/security/tpm/back-end.cpp b/ndn-cxx/security/tpm/back-end.cpp
index f8f450a..d336b0b 100644
--- a/ndn-cxx/security/tpm/back-end.cpp
+++ b/ndn-cxx/security/tpm/back-end.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).
*
@@ -31,9 +31,7 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace security {
-namespace tpm {
+namespace ndn::security::tpm {
BackEnd::~BackEnd() = default;
@@ -170,6 +168,4 @@
return !isTpmLocked();
}
-} // namespace tpm
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::tpm
diff --git a/ndn-cxx/security/tpm/back-end.hpp b/ndn-cxx/security/tpm/back-end.hpp
index dfe50cd..b66d267 100644
--- a/ndn-cxx/security/tpm/back-end.hpp
+++ b/ndn-cxx/security/tpm/back-end.hpp
@@ -24,9 +24,7 @@
#include "ndn-cxx/security/tpm/tpm.hpp"
-namespace ndn {
-namespace security {
-namespace tpm {
+namespace ndn::security::tpm {
/**
* @brief Abstract interface for a TPM backend implementation.
@@ -196,8 +194,6 @@
doImportKey(const Name& keyName, shared_ptr<transform::PrivateKey> key) = 0;
};
-} // namespace tpm
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::tpm
#endif // NDN_CXX_SECURITY_TPM_BACK_END_HPP
diff --git a/ndn-cxx/security/tpm/impl/back-end-file.cpp b/ndn-cxx/security/tpm/impl/back-end-file.cpp
index 8bf11b4..4c466d1 100644
--- a/ndn-cxx/security/tpm/impl/back-end-file.cpp
+++ b/ndn-cxx/security/tpm/impl/back-end-file.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,12 +36,10 @@
#include <boost/filesystem/path.hpp>
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace security {
-namespace tpm {
+namespace ndn::security::tpm {
namespace fs = boost::filesystem;
-using transform::PrivateKey;
+using ndn::security::transform::PrivateKey;
class BackEndFile::Impl
{
@@ -226,6 +224,4 @@
::chmod(fileName.data(), 0000400);
}
-} // namespace tpm
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::tpm
diff --git a/ndn-cxx/security/tpm/impl/back-end-file.hpp b/ndn-cxx/security/tpm/impl/back-end-file.hpp
index 6841681..18657dd 100644
--- a/ndn-cxx/security/tpm/impl/back-end-file.hpp
+++ b/ndn-cxx/security/tpm/impl/back-end-file.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,8 +24,7 @@
#include "ndn-cxx/security/tpm/back-end.hpp"
-namespace ndn {
-namespace security {
+namespace ndn::security {
namespace transform {
class PrivateKey;
@@ -96,7 +95,6 @@
};
} // namespace tpm
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_TPM_IMPL_BACK_END_FILE_HPP
diff --git a/ndn-cxx/security/tpm/impl/back-end-mem.cpp b/ndn-cxx/security/tpm/impl/back-end-mem.cpp
index ec9828b..e69dd19 100644
--- a/ndn-cxx/security/tpm/impl/back-end-mem.cpp
+++ b/ndn-cxx/security/tpm/impl/back-end-mem.cpp
@@ -28,11 +28,9 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace security {
-namespace tpm {
+namespace ndn::security::tpm {
-using transform::PrivateKey;
+using ndn::security::transform::PrivateKey;
class BackEndMem::Impl
{
@@ -131,6 +129,4 @@
m_impl->keys[keyName] = std::move(key);
}
-} // namespace tpm
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::tpm
diff --git a/ndn-cxx/security/tpm/impl/back-end-mem.hpp b/ndn-cxx/security/tpm/impl/back-end-mem.hpp
index 176833b..3760308 100644
--- a/ndn-cxx/security/tpm/impl/back-end-mem.hpp
+++ b/ndn-cxx/security/tpm/impl/back-end-mem.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,9 +24,7 @@
#include "ndn-cxx/security/tpm/back-end.hpp"
-namespace ndn {
-namespace security {
-namespace tpm {
+namespace ndn::security::tpm {
/**
* @brief The back-end implementation of an in-memory TPM.
@@ -74,8 +72,6 @@
const unique_ptr<Impl> m_impl;
};
-} // namespace tpm
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::tpm
#endif // NDN_CXX_SECURITY_TPM_IMPL_BACK_END_MEM_HPP
diff --git a/ndn-cxx/security/tpm/impl/back-end-osx.cpp b/ndn-cxx/security/tpm/impl/back-end-osx.cpp
index 654d957..0567655 100644
--- a/ndn-cxx/security/tpm/impl/back-end-osx.cpp
+++ b/ndn-cxx/security/tpm/impl/back-end-osx.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,12 +33,10 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace security {
-namespace tpm {
+namespace ndn::security::tpm {
-namespace cfstring = detail::cfstring;
-using detail::CFReleaser;
+namespace cfstring = ndn::detail::cfstring;
+using ndn::detail::CFReleaser;
class BackEndOsx::Impl
{
@@ -522,6 +520,4 @@
NDN_THROW(Error("macOS-based TPM does not support importing a transform::PrivateKey"));
}
-} // namespace tpm
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::tpm
diff --git a/ndn-cxx/security/tpm/impl/back-end-osx.hpp b/ndn-cxx/security/tpm/impl/back-end-osx.hpp
index eda536e..706bca4 100644
--- a/ndn-cxx/security/tpm/impl/back-end-osx.hpp
+++ b/ndn-cxx/security/tpm/impl/back-end-osx.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -30,9 +30,7 @@
#include "ndn-cxx/security/tpm/impl/key-ref-osx.hpp"
-namespace ndn {
-namespace security {
-namespace tpm {
+namespace ndn::security::tpm {
/**
* @brief The back-end implementation of TPM based on macOS Keychain Services.
@@ -109,8 +107,6 @@
const unique_ptr<Impl> m_impl;
};
-} // namespace tpm
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::tpm
#endif // NDN_CXX_SECURITY_TPM_IMPL_BACK_END_OSX_HPP
diff --git a/ndn-cxx/security/tpm/impl/key-handle-mem.cpp b/ndn-cxx/security/tpm/impl/key-handle-mem.cpp
index 9a801e3..3455c3f 100644
--- a/ndn-cxx/security/tpm/impl/key-handle-mem.cpp
+++ b/ndn-cxx/security/tpm/impl/key-handle-mem.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,7 @@
#include "ndn-cxx/security/transform/verifier-filter.hpp"
#include "ndn-cxx/encoding/buffer-stream.hpp"
-namespace ndn {
-namespace security {
-namespace tpm {
+namespace ndn::security::tpm {
KeyHandleMem::KeyHandleMem(shared_ptr<transform::PrivateKey> key)
: m_key(std::move(key))
@@ -72,6 +70,4 @@
return m_key->derivePublicKey();
}
-} // namespace tpm
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::tpm
diff --git a/ndn-cxx/security/tpm/impl/key-handle-mem.hpp b/ndn-cxx/security/tpm/impl/key-handle-mem.hpp
index 07516da..22bcbca 100644
--- a/ndn-cxx/security/tpm/impl/key-handle-mem.hpp
+++ b/ndn-cxx/security/tpm/impl/key-handle-mem.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,8 +24,7 @@
#include "ndn-cxx/security/tpm/key-handle.hpp"
-namespace ndn {
-namespace security {
+namespace ndn::security {
namespace transform {
class PrivateKey;
@@ -60,7 +59,6 @@
};
} // namespace tpm
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_TPM_IMPL_KEY_HANDLE_MEM_HPP
diff --git a/ndn-cxx/security/tpm/impl/key-handle-osx.cpp b/ndn-cxx/security/tpm/impl/key-handle-osx.cpp
index db43fa4..623529c 100644
--- a/ndn-cxx/security/tpm/impl/key-handle-osx.cpp
+++ b/ndn-cxx/security/tpm/impl/key-handle-osx.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).
*
@@ -22,9 +22,7 @@
#include "ndn-cxx/security/tpm/impl/key-handle-osx.hpp"
#include "ndn-cxx/security/tpm/impl/back-end-osx.hpp"
-namespace ndn {
-namespace security {
-namespace tpm {
+namespace ndn::security::tpm {
KeyHandleOsx::KeyHandleOsx(const KeyRefOsx& key)
: m_key(key)
@@ -57,6 +55,4 @@
return BackEndOsx::derivePublicKey(m_key);
}
-} // namespace tpm
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::tpm
diff --git a/ndn-cxx/security/tpm/impl/key-handle-osx.hpp b/ndn-cxx/security/tpm/impl/key-handle-osx.hpp
index 49bd655..40f1762 100644
--- a/ndn-cxx/security/tpm/impl/key-handle-osx.hpp
+++ b/ndn-cxx/security/tpm/impl/key-handle-osx.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -30,9 +30,7 @@
#include "ndn-cxx/security/tpm/impl/key-ref-osx.hpp"
-namespace ndn {
-namespace security {
-namespace tpm {
+namespace ndn::security::tpm {
/**
* @brief Abstraction of TPM key handle used by the TPM based on macOS Keychain Services.
@@ -61,8 +59,6 @@
KeyRefOsx m_key;
};
-} // namespace tpm
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::tpm
#endif // NDN_CXX_SECURITY_TPM_IMPL_KEY_HANDLE_OSX_HPP
diff --git a/ndn-cxx/security/tpm/impl/key-ref-osx.hpp b/ndn-cxx/security/tpm/impl/key-ref-osx.hpp
index 88345b2..c3ad98d 100644
--- a/ndn-cxx/security/tpm/impl/key-ref-osx.hpp
+++ b/ndn-cxx/security/tpm/impl/key-ref-osx.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -32,14 +32,10 @@
#include <Security/Security.h>
-namespace ndn {
-namespace security {
-namespace tpm {
+namespace ndn::security::tpm {
using KeyRefOsx = detail::CFReleaser<SecKeyRef>;
-} // namespace tpm
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::tpm
#endif // NDN_CXX_SECURITY_TPM_IMPL_KEY_REF_OSX_HPP
diff --git a/ndn-cxx/security/tpm/key-handle.cpp b/ndn-cxx/security/tpm/key-handle.cpp
index 13af2b0..4e18fe5 100644
--- a/ndn-cxx/security/tpm/key-handle.cpp
+++ b/ndn-cxx/security/tpm/key-handle.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).
*
@@ -21,9 +21,7 @@
#include "ndn-cxx/security/tpm/key-handle.hpp"
-namespace ndn {
-namespace security {
-namespace tpm {
+namespace ndn::security::tpm {
KeyHandle::~KeyHandle() = default;
@@ -52,6 +50,4 @@
return doDerivePublicKey();
}
-} // namespace tpm
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::tpm
diff --git a/ndn-cxx/security/tpm/key-handle.hpp b/ndn-cxx/security/tpm/key-handle.hpp
index d718e54..3b3161f 100644
--- a/ndn-cxx/security/tpm/key-handle.hpp
+++ b/ndn-cxx/security/tpm/key-handle.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,9 +25,7 @@
#include "ndn-cxx/name.hpp"
#include "ndn-cxx/security/security-common.hpp"
-namespace ndn {
-namespace security {
-namespace tpm {
+namespace ndn::security::tpm {
/**
* @brief Abstraction of TPM key handle.
@@ -100,8 +98,6 @@
Name m_keyName;
};
-} // namespace tpm
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::tpm
#endif // NDN_CXX_SECURITY_TPM_KEY_HANDLE_HPP
diff --git a/ndn-cxx/security/tpm/tpm.cpp b/ndn-cxx/security/tpm/tpm.cpp
index ded3ca8..9e150de 100644
--- a/ndn-cxx/security/tpm/tpm.cpp
+++ b/ndn-cxx/security/tpm/tpm.cpp
@@ -25,9 +25,7 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace security {
-namespace tpm {
+namespace ndn::security::tpm {
Tpm::Tpm(const std::string& locator, unique_ptr<BackEnd> backEnd)
: m_locator(locator)
@@ -150,6 +148,4 @@
return key;
}
-} // namespace tpm
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::tpm
diff --git a/ndn-cxx/security/tpm/tpm.hpp b/ndn-cxx/security/tpm/tpm.hpp
index 1ffdeb1..feae793 100644
--- a/ndn-cxx/security/tpm/tpm.hpp
+++ b/ndn-cxx/security/tpm/tpm.hpp
@@ -29,16 +29,13 @@
#include <unordered_map>
#include <boost/logic/tribool.hpp>
-namespace ndn {
-namespace security {
+namespace ndn::security {
namespace transform {
class PrivateKey;
} // namespace transform
-inline namespace v2 {
class KeyChain;
-} // inline namespace v2
namespace tpm {
@@ -256,7 +253,6 @@
using tpm::Tpm;
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_TPM_TPM_HPP
diff --git a/ndn-cxx/security/transform/base64-decode.cpp b/ndn-cxx/security/transform/base64-decode.cpp
index e9a3f08..1554ccb 100644
--- a/ndn-cxx/security/transform/base64-decode.cpp
+++ b/ndn-cxx/security/transform/base64-decode.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,9 +24,7 @@
#include <openssl/bio.h>
#include <openssl/evp.h>
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
class Base64Decode::Impl : boost::noncopyable
{
@@ -128,6 +126,4 @@
return make_unique<Base64Decode>(expectNewlineEvery64Bytes);
}
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
diff --git a/ndn-cxx/security/transform/base64-decode.hpp b/ndn-cxx/security/transform/base64-decode.hpp
index 38949d3..b2aa0fb 100644
--- a/ndn-cxx/security/transform/base64-decode.hpp
+++ b/ndn-cxx/security/transform/base64-decode.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,9 +24,7 @@
#include "ndn-cxx/security/transform/transform-base.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
/**
* @brief The module to perform Base64 decoding transformation.
@@ -82,8 +80,6 @@
unique_ptr<Transform>
base64Decode(bool expectNewlineEvery64Bytes = true);
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
#endif // NDN_CXX_SECURITY_TRANSFORM_BASE64_DECODE_HPP
diff --git a/ndn-cxx/security/transform/base64-encode.cpp b/ndn-cxx/security/transform/base64-encode.cpp
index 5383a8f..af56408 100644
--- a/ndn-cxx/security/transform/base64-encode.cpp
+++ b/ndn-cxx/security/transform/base64-encode.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,9 +24,7 @@
#include <openssl/bio.h>
#include <openssl/evp.h>
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
class Base64Encode::Impl : boost::noncopyable
{
@@ -131,6 +129,4 @@
return make_unique<Base64Encode>(needBreak);
}
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
diff --git a/ndn-cxx/security/transform/base64-encode.hpp b/ndn-cxx/security/transform/base64-encode.hpp
index 1c09376..874fda0 100644
--- a/ndn-cxx/security/transform/base64-encode.hpp
+++ b/ndn-cxx/security/transform/base64-encode.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,9 +24,7 @@
#include "ndn-cxx/security/transform/transform-base.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
/**
* @brief The module to perform Base64 encoding transformation.
@@ -86,8 +84,6 @@
unique_ptr<Transform>
base64Encode(bool needBreak = true);
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
#endif // NDN_CXX_SECURITY_TRANSFORM_BASE64_ENCODE_HPP
diff --git a/ndn-cxx/security/transform/block-cipher.cpp b/ndn-cxx/security/transform/block-cipher.cpp
index bc881f1..e7cddc0 100644
--- a/ndn-cxx/security/transform/block-cipher.cpp
+++ b/ndn-cxx/security/transform/block-cipher.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,9 +26,7 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
class BlockCipher::Impl : boost::noncopyable
{
@@ -164,6 +162,4 @@
return make_unique<BlockCipher>(algo, op, key, iv);
}
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
diff --git a/ndn-cxx/security/transform/block-cipher.hpp b/ndn-cxx/security/transform/block-cipher.hpp
index ecde4e7..78d5bef 100644
--- a/ndn-cxx/security/transform/block-cipher.hpp
+++ b/ndn-cxx/security/transform/block-cipher.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,9 +25,7 @@
#include "ndn-cxx/security/transform/transform-base.hpp"
#include "ndn-cxx/security/security-common.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
/**
* @brief The module to encrypt data using block cipher.
@@ -97,8 +95,6 @@
blockCipher(BlockCipherAlgorithm algo, CipherOperator op,
span<const uint8_t> key, span<const uint8_t> iv);
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
#endif // NDN_CXX_SECURITY_TRANSFORM_BLOCK_CIPHER_HPP
diff --git a/ndn-cxx/security/transform/bool-sink.cpp b/ndn-cxx/security/transform/bool-sink.cpp
index c57cf77..3a86a0e 100644
--- a/ndn-cxx/security/transform/bool-sink.cpp
+++ b/ndn-cxx/security/transform/bool-sink.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).
*
@@ -21,9 +21,7 @@
#include "ndn-cxx/security/transform/bool-sink.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
BoolSink::BoolSink(bool& value)
: m_hasValue(false)
@@ -53,6 +51,4 @@
return make_unique<BoolSink>(value);
}
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
diff --git a/ndn-cxx/security/transform/bool-sink.hpp b/ndn-cxx/security/transform/bool-sink.hpp
index 827019a..bf4b4df 100644
--- a/ndn-cxx/security/transform/bool-sink.hpp
+++ b/ndn-cxx/security/transform/bool-sink.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,9 +24,7 @@
#include "ndn-cxx/security/transform/transform-base.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
/**
* @brief A sink which outputs only one boolean value.
@@ -66,8 +64,6 @@
unique_ptr<Sink>
boolSink(bool& value);
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
#endif // NDN_CXX_SECURITY_TRANSFORM_BOOL_SINK_HPP
diff --git a/ndn-cxx/security/transform/buffer-source.cpp b/ndn-cxx/security/transform/buffer-source.cpp
index 8333368..c345e03 100644
--- a/ndn-cxx/security/transform/buffer-source.cpp
+++ b/ndn-cxx/security/transform/buffer-source.cpp
@@ -21,9 +21,7 @@
#include "ndn-cxx/security/transform/buffer-source.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
BufferSource::BufferSource(span<const uint8_t> buffer)
: m_bufs({buffer})
@@ -55,6 +53,4 @@
m_next->end();
}
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
diff --git a/ndn-cxx/security/transform/buffer-source.hpp b/ndn-cxx/security/transform/buffer-source.hpp
index 7d87320..bd0c34a 100644
--- a/ndn-cxx/security/transform/buffer-source.hpp
+++ b/ndn-cxx/security/transform/buffer-source.hpp
@@ -25,9 +25,7 @@
#include "ndn-cxx/security/transform/transform-base.hpp"
#include "ndn-cxx/security/security-common.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
/**
* @brief A source taking one or more memory buffers as input
@@ -72,8 +70,6 @@
using bufferSource = BufferSource;
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
#endif // NDN_CXX_SECURITY_TRANSFORM_BUFFER_SOURCE_HPP
diff --git a/ndn-cxx/security/transform/digest-filter.cpp b/ndn-cxx/security/transform/digest-filter.cpp
index 6462075..89e4917 100644
--- a/ndn-cxx/security/transform/digest-filter.cpp
+++ b/ndn-cxx/security/transform/digest-filter.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).
*
@@ -24,9 +24,7 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
class DigestFilter::Impl
{
@@ -78,6 +76,4 @@
return make_unique<DigestFilter>(algo);
}
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
diff --git a/ndn-cxx/security/transform/digest-filter.hpp b/ndn-cxx/security/transform/digest-filter.hpp
index 30f96ec..26a2851 100644
--- a/ndn-cxx/security/transform/digest-filter.hpp
+++ b/ndn-cxx/security/transform/digest-filter.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,9 +25,7 @@
#include "ndn-cxx/security/transform/transform-base.hpp"
#include "ndn-cxx/security/security-common.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
/**
* @brief The module to calculate digests.
@@ -66,8 +64,6 @@
unique_ptr<Transform>
digestFilter(DigestAlgorithm algo);
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
#endif // NDN_CXX_SECURITY_TRANSFORM_DIGEST_FILTER_HPP
diff --git a/ndn-cxx/security/transform/hex-decode.cpp b/ndn-cxx/security/transform/hex-decode.cpp
index 6970a65..9cbccf7 100644
--- a/ndn-cxx/security/transform/hex-decode.cpp
+++ b/ndn-cxx/security/transform/hex-decode.cpp
@@ -21,9 +21,7 @@
#include "ndn-cxx/security/transform/hex-decode.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
// hex decoding pad
static const int8_t C2H[] = {
@@ -117,6 +115,4 @@
return make_unique<HexDecode>();
}
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
diff --git a/ndn-cxx/security/transform/hex-decode.hpp b/ndn-cxx/security/transform/hex-decode.hpp
index 43c7e71..72ffb18 100644
--- a/ndn-cxx/security/transform/hex-decode.hpp
+++ b/ndn-cxx/security/transform/hex-decode.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,9 +24,7 @@
#include "ndn-cxx/security/transform/transform-base.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
/**
* @brief The module to perform hexadecimal decoding transformation.
@@ -73,8 +71,6 @@
unique_ptr<Transform>
hexDecode();
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
#endif // NDN_CXX_SECURITY_TRANSFORM_HEX_DECODE_HPP
diff --git a/ndn-cxx/security/transform/hex-encode.cpp b/ndn-cxx/security/transform/hex-encode.cpp
index 204466f..0a9da8d 100644
--- a/ndn-cxx/security/transform/hex-encode.cpp
+++ b/ndn-cxx/security/transform/hex-encode.cpp
@@ -21,9 +21,7 @@
#include "ndn-cxx/security/transform/hex-encode.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
static const uint8_t H2CL[] = {
'0', '1', '2', '3', '4', '5', '6', '7',
@@ -72,6 +70,4 @@
return make_unique<HexEncode>(useUpperCase);
}
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
diff --git a/ndn-cxx/security/transform/hex-encode.hpp b/ndn-cxx/security/transform/hex-encode.hpp
index 71031e8..4d334b4 100644
--- a/ndn-cxx/security/transform/hex-encode.hpp
+++ b/ndn-cxx/security/transform/hex-encode.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,9 +24,7 @@
#include "ndn-cxx/security/transform/transform-base.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
/**
* @brief The module to perform hexadecimal encoding transformation.
@@ -67,8 +65,6 @@
unique_ptr<Transform>
hexEncode(bool useUpperCase = false);
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
#endif // NDN_CXX_SECURITY_TRANSFORM_HEX_ENCODE_HPP
diff --git a/ndn-cxx/security/transform/private-key.cpp b/ndn-cxx/security/transform/private-key.cpp
index 53501a9..0acb648 100644
--- a/ndn-cxx/security/transform/private-key.cpp
+++ b/ndn-cxx/security/transform/private-key.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,9 +54,7 @@
NDN_THROW(Error("Private key has already been loaded")); \
} while (false)
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
class PrivateKey::Impl : noncopyable
{
@@ -544,6 +542,4 @@
}
}
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
diff --git a/ndn-cxx/security/transform/private-key.hpp b/ndn-cxx/security/transform/private-key.hpp
index 3890a10..271ffd4 100644
--- a/ndn-cxx/security/transform/private-key.hpp
+++ b/ndn-cxx/security/transform/private-key.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).
*
@@ -29,8 +29,7 @@
class KeyParams;
-namespace security {
-namespace transform {
+namespace security::transform {
/**
* @brief Abstraction of private key in crypto transformation
@@ -290,8 +289,7 @@
unique_ptr<PrivateKey>
generatePrivateKey(const KeyParams& keyParams);
-} // namespace transform
-} // namespace security
+} // namespace security::transform
} // namespace ndn
#endif // NDN_CXX_SECURITY_TRANSFORM_PRIVATE_KEY_HPP
diff --git a/ndn-cxx/security/transform/public-key.cpp b/ndn-cxx/security/transform/public-key.cpp
index 3291628..599fcc9 100644
--- a/ndn-cxx/security/transform/public-key.cpp
+++ b/ndn-cxx/security/transform/public-key.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).
*
@@ -43,9 +43,7 @@
NDN_THROW(Error("Public key has already been loaded")); \
} while (false)
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
class PublicKey::Impl : noncopyable
{
@@ -207,6 +205,4 @@
return out;
}
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
diff --git a/ndn-cxx/security/transform/public-key.hpp b/ndn-cxx/security/transform/public-key.hpp
index bd1a0c8..b0b3104 100644
--- a/ndn-cxx/security/transform/public-key.hpp
+++ b/ndn-cxx/security/transform/public-key.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,9 +25,7 @@
#include "ndn-cxx/security/security-common.hpp"
#include "ndn-cxx/encoding/buffer.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
/**
* @brief Abstraction of public key in crypto transformation
@@ -129,8 +127,6 @@
const unique_ptr<Impl> m_impl;
};
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
#endif // NDN_CXX_SECURITY_TRANSFORM_PUBLIC_KEY_HPP
diff --git a/ndn-cxx/security/transform/signer-filter.cpp b/ndn-cxx/security/transform/signer-filter.cpp
index 036a16b..2c25f5e 100644
--- a/ndn-cxx/security/transform/signer-filter.cpp
+++ b/ndn-cxx/security/transform/signer-filter.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).
*
@@ -25,9 +25,7 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
class SignerFilter::Impl
{
@@ -85,6 +83,4 @@
return make_unique<SignerFilter>(algo, key);
}
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
diff --git a/ndn-cxx/security/transform/signer-filter.hpp b/ndn-cxx/security/transform/signer-filter.hpp
index 842ba10..e01705e 100644
--- a/ndn-cxx/security/transform/signer-filter.hpp
+++ b/ndn-cxx/security/transform/signer-filter.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,9 +25,7 @@
#include "ndn-cxx/security/transform/transform-base.hpp"
#include "ndn-cxx/security/security-common.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
class PrivateKey;
@@ -67,8 +65,6 @@
unique_ptr<Transform>
signerFilter(DigestAlgorithm algo, const PrivateKey& key);
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
#endif // NDN_CXX_SECURITY_TRANSFORM_SIGNER_FILTER_HPP
diff --git a/ndn-cxx/security/transform/step-source.cpp b/ndn-cxx/security/transform/step-source.cpp
index cfeac7a..16376e3 100644
--- a/ndn-cxx/security/transform/step-source.cpp
+++ b/ndn-cxx/security/transform/step-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).
*
@@ -21,9 +21,7 @@
#include "ndn-cxx/security/transform/step-source.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
size_t
StepSource::write(span<const uint8_t> buf)
@@ -42,6 +40,4 @@
{
}
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
diff --git a/ndn-cxx/security/transform/step-source.hpp b/ndn-cxx/security/transform/step-source.hpp
index 2c08260..40d0548 100644
--- a/ndn-cxx/security/transform/step-source.hpp
+++ b/ndn-cxx/security/transform/step-source.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).
*
@@ -24,9 +24,7 @@
#include "ndn-cxx/security/transform/transform-base.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
/**
* @brief A source that can accept input step by step, and can close input explicitly.
@@ -74,8 +72,6 @@
using stepSource = StepSource;
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
#endif // NDN_CXX_SECURITY_TRANSFORM_STEP_SOURCE_HPP
diff --git a/ndn-cxx/security/transform/stream-sink.cpp b/ndn-cxx/security/transform/stream-sink.cpp
index c35e196..496a39c 100644
--- a/ndn-cxx/security/transform/stream-sink.cpp
+++ b/ndn-cxx/security/transform/stream-sink.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).
*
@@ -23,9 +23,7 @@
#include <ostream>
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
StreamSink::StreamSink(std::ostream& os)
: m_os(os)
@@ -55,6 +53,4 @@
return make_unique<StreamSink>(os);
}
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
diff --git a/ndn-cxx/security/transform/stream-sink.hpp b/ndn-cxx/security/transform/stream-sink.hpp
index d2e6e32..3ad37bd 100644
--- a/ndn-cxx/security/transform/stream-sink.hpp
+++ b/ndn-cxx/security/transform/stream-sink.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).
*
@@ -24,9 +24,7 @@
#include "ndn-cxx/security/transform/transform-base.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
/**
* @brief A sink which directs output to an std::ostream.
@@ -59,8 +57,6 @@
unique_ptr<Sink>
streamSink(std::ostream& os);
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
#endif // NDN_CXX_SECURITY_TRANSFORM_STREAM_SINK_HPP
diff --git a/ndn-cxx/security/transform/stream-source.cpp b/ndn-cxx/security/transform/stream-source.cpp
index 10e5fa6..c9674e9 100644
--- a/ndn-cxx/security/transform/stream-source.cpp
+++ b/ndn-cxx/security/transform/stream-source.cpp
@@ -24,9 +24,7 @@
#include <istream>
#include <vector>
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
StreamSource::StreamSource(std::istream& is, size_t bufferSize)
: Source()
@@ -65,6 +63,4 @@
m_next->end();
}
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
diff --git a/ndn-cxx/security/transform/stream-source.hpp b/ndn-cxx/security/transform/stream-source.hpp
index 886066b..02a66e4 100644
--- a/ndn-cxx/security/transform/stream-source.hpp
+++ b/ndn-cxx/security/transform/stream-source.hpp
@@ -24,9 +24,7 @@
#include "ndn-cxx/security/transform/transform-base.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
/**
* @brief A source taking an std::istream as input
@@ -59,10 +57,8 @@
size_t m_bufferSize;
};
-typedef StreamSource streamSource;
+using streamSource = StreamSource;
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
#endif // NDN_CXX_SECURITY_TRANSFORM_STREAM_SOURCE_HPP
diff --git a/ndn-cxx/security/transform/strip-space.cpp b/ndn-cxx/security/transform/strip-space.cpp
index 9465400..12b43d9 100644
--- a/ndn-cxx/security/transform/strip-space.cpp
+++ b/ndn-cxx/security/transform/strip-space.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).
*
@@ -21,9 +21,7 @@
#include "ndn-cxx/security/transform/strip-space.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
const char* const StripSpace::DEFAULT_WHITESPACES = " \f\n\r\t\v";
@@ -56,6 +54,4 @@
return make_unique<StripSpace>(whitespaces);
}
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
diff --git a/ndn-cxx/security/transform/strip-space.hpp b/ndn-cxx/security/transform/strip-space.hpp
index f01e936..1c1e119 100644
--- a/ndn-cxx/security/transform/strip-space.hpp
+++ b/ndn-cxx/security/transform/strip-space.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,9 +27,7 @@
#include <bitset>
#include <climits>
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
/**
* \brief Strip whitespace characters from a stream.
@@ -60,8 +58,6 @@
unique_ptr<Transform>
stripSpace(const char* whitespaces = StripSpace::DEFAULT_WHITESPACES);
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
#endif // NDN_CXX_SECURITY_TRANSFORM_STRIP_SPACE_HPP
diff --git a/ndn-cxx/security/transform/transform-base.cpp b/ndn-cxx/security/transform/transform-base.cpp
index 731b22c..2abcfb4 100644
--- a/ndn-cxx/security/transform/transform-base.cpp
+++ b/ndn-cxx/security/transform/transform-base.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).
*
@@ -21,9 +21,7 @@
#include "ndn-cxx/security/transform/transform-base.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
Error::Error(size_t index, const std::string& what)
: std::runtime_error("Error in module " + to_string(index) + ": " + what)
@@ -157,6 +155,4 @@
pump();
}
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
diff --git a/ndn-cxx/security/transform/transform-base.hpp b/ndn-cxx/security/transform/transform-base.hpp
index faf96be..15548c7 100644
--- a/ndn-cxx/security/transform/transform-base.hpp
+++ b/ndn-cxx/security/transform/transform-base.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,9 +27,7 @@
#include <vector>
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
/**
* @file
@@ -318,8 +316,6 @@
size_t m_nModules = 1; // count of modules in the chain starting from (and including) this Source
};
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
#endif // NDN_CXX_SECURITY_TRANSFORM_BASE_HPP
diff --git a/ndn-cxx/security/transform/verifier-filter.cpp b/ndn-cxx/security/transform/verifier-filter.cpp
index 4d4c6f0..4893c4c 100644
--- a/ndn-cxx/security/transform/verifier-filter.cpp
+++ b/ndn-cxx/security/transform/verifier-filter.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,9 +26,7 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
class VerifierFilter::Impl
{
@@ -135,6 +133,4 @@
return make_unique<VerifierFilter>(algo, key, sig);
}
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
diff --git a/ndn-cxx/security/transform/verifier-filter.hpp b/ndn-cxx/security/transform/verifier-filter.hpp
index d5072f6..da2ae10 100644
--- a/ndn-cxx/security/transform/verifier-filter.hpp
+++ b/ndn-cxx/security/transform/verifier-filter.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,9 +25,7 @@
#include "ndn-cxx/security/transform/transform-base.hpp"
#include "ndn-cxx/security/security-common.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
+namespace ndn::security::transform {
class PrivateKey;
class PublicKey;
@@ -83,8 +81,6 @@
unique_ptr<Transform>
verifierFilter(DigestAlgorithm algo, const PrivateKey& key, span<const uint8_t> sig);
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::transform
#endif // NDN_CXX_SECURITY_TRANSFORM_VERIFIER_FILTER_HPP
diff --git a/ndn-cxx/security/trust-anchor-container.cpp b/ndn-cxx/security/trust-anchor-container.cpp
index ccd123a..93856bf 100644
--- a/ndn-cxx/security/trust-anchor-container.cpp
+++ b/ndn-cxx/security/trust-anchor-container.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).
*
@@ -21,9 +21,7 @@
#include "ndn-cxx/security/trust-anchor-container.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
void
TrustAnchorContainer::AnchorContainer::add(Certificate&& cert)
@@ -128,6 +126,4 @@
}
}
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
diff --git a/ndn-cxx/security/trust-anchor-container.hpp b/ndn-cxx/security/trust-anchor-container.hpp
index 18afa36..6fe208d 100644
--- a/ndn-cxx/security/trust-anchor-container.hpp
+++ b/ndn-cxx/security/trust-anchor-container.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,9 +31,7 @@
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/mem_fun.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
/**
* @brief A container for trust anchors.
@@ -172,8 +170,6 @@
AnchorContainer m_anchors;
};
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_TRUST_ANCHOR_CONTAINER_HPP
diff --git a/ndn-cxx/security/trust-anchor-group.cpp b/ndn-cxx/security/trust-anchor-group.cpp
index 565c760..d3eaf92 100644
--- a/ndn-cxx/security/trust-anchor-group.cpp
+++ b/ndn-cxx/security/trust-anchor-group.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).
*
@@ -31,9 +31,7 @@
#include <boost/range/algorithm/copy.hpp>
#include <boost/range/iterator_range.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
NDN_LOG_INIT(ndn.security.TrustAnchorGroup);
@@ -141,6 +139,4 @@
}
}
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
diff --git a/ndn-cxx/security/trust-anchor-group.hpp b/ndn-cxx/security/trust-anchor-group.hpp
index 7c7198e..afd5aa2 100644
--- a/ndn-cxx/security/trust-anchor-group.hpp
+++ b/ndn-cxx/security/trust-anchor-group.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -28,9 +28,7 @@
#include <boost/filesystem/path.hpp>
#include <set>
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
class CertContainerInterface
{
@@ -160,11 +158,9 @@
bool m_isDir;
boost::filesystem::path m_path;
time::nanoseconds m_refreshPeriod;
- time::steady_clock::TimePoint m_expireTime;
+ time::steady_clock::time_point m_expireTime;
};
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_TRUST_ANCHOR_GROUP_HPP
diff --git a/ndn-cxx/security/validation-callback.hpp b/ndn-cxx/security/validation-callback.hpp
index 8e00c33..ef7d8d2 100644
--- a/ndn-cxx/security/validation-callback.hpp
+++ b/ndn-cxx/security/validation-callback.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).
*
@@ -26,9 +26,7 @@
#include "ndn-cxx/interest.hpp"
#include "ndn-cxx/security/validation-error.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
/**
* @brief Callback to report a successful Data validation.
@@ -50,8 +48,6 @@
*/
using InterestValidationFailureCallback = std::function<void(const Interest&, const ValidationError&)>;
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_VALIDATION_CALLBACK_HPP
diff --git a/ndn-cxx/security/validation-error.cpp b/ndn-cxx/security/validation-error.cpp
index 7ab3abe..82ec2f7 100644
--- a/ndn-cxx/security/validation-error.cpp
+++ b/ndn-cxx/security/validation-error.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).
*
@@ -21,9 +21,7 @@
#include "ndn-cxx/security/validation-error.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
std::ostream&
operator<<(std::ostream& os, ValidationError::Code code)
@@ -71,6 +69,4 @@
}
}
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
diff --git a/ndn-cxx/security/validation-error.hpp b/ndn-cxx/security/validation-error.hpp
index 07a1aaa..9adac22 100644
--- a/ndn-cxx/security/validation-error.hpp
+++ b/ndn-cxx/security/validation-error.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).
*
@@ -24,9 +24,7 @@
#include "ndn-cxx/detail/common.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
/**
* @brief Validation error code and optional detailed error message
@@ -109,8 +107,6 @@
std::ostream&
operator<<(std::ostream& os, ValidationError::Code code);
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_VALIDATION_ERROR_HPP
diff --git a/ndn-cxx/security/validation-policy-accept-all.hpp b/ndn-cxx/security/validation-policy-accept-all.hpp
index 623a57f..a877ad1 100644
--- a/ndn-cxx/security/validation-policy-accept-all.hpp
+++ b/ndn-cxx/security/validation-policy-accept-all.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,9 +24,7 @@
#include "ndn-cxx/security/validation-policy.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
/**
* @brief A validator policy that accepts any signature of data and interest packets
@@ -49,8 +47,6 @@
}
};
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_VALIDATION_POLICY_ACCEPT_ALL_HPP
diff --git a/ndn-cxx/security/validation-policy-command-interest.cpp b/ndn-cxx/security/validation-policy-command-interest.cpp
index adf8bd1..ddae489 100644
--- a/ndn-cxx/security/validation-policy-command-interest.cpp
+++ b/ndn-cxx/security/validation-policy-command-interest.cpp
@@ -21,9 +21,7 @@
#include "ndn-cxx/security/validation-policy-command-interest.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
ValidationPolicyCommandInterest::ValidationPolicyCommandInterest(unique_ptr<ValidationPolicy> inner,
const Options& options)
@@ -171,6 +169,4 @@
}
}
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
diff --git a/ndn-cxx/security/validation-policy-command-interest.hpp b/ndn-cxx/security/validation-policy-command-interest.hpp
index d8fe1d0..959b80e 100644
--- a/ndn-cxx/security/validation-policy-command-interest.hpp
+++ b/ndn-cxx/security/validation-policy-command-interest.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).
*
@@ -29,9 +29,7 @@
#include <boost/multi_index/sequenced_index.hpp>
#include <boost/multi_index/key_extractors.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
/**
* @brief Validation policy for stop-and-wait command Interests.
@@ -114,7 +112,7 @@
const ValidationContinuation& continueValidation) override;
private:
- static std::tuple<bool, Name, time::system_clock::TimePoint>
+ static std::tuple<bool, Name, time::system_clock::time_point>
parseCommandInterest(const Interest& interest, const shared_ptr<ValidationState>& state);
void
@@ -122,10 +120,10 @@
bool
checkTimestamp(const shared_ptr<ValidationState>& state,
- const Name& keyName, time::system_clock::TimePoint timestamp);
+ const Name& keyName, time::system_clock::time_point timestamp);
void
- insertNewRecord(const Name& keyName, time::system_clock::TimePoint timestamp);
+ insertNewRecord(const Name& keyName, time::system_clock::time_point timestamp);
private:
Options m_options;
@@ -133,8 +131,8 @@
struct LastTimestampRecord
{
Name keyName;
- time::system_clock::TimePoint timestamp;
- time::steady_clock::TimePoint lastRefreshed;
+ time::system_clock::time_point timestamp;
+ time::steady_clock::time_point lastRefreshed;
};
using Container = boost::multi_index_container<
@@ -154,8 +152,6 @@
Queue& m_queue;
};
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_VALIDATION_POLICY_COMMAND_INTEREST_HPP
diff --git a/ndn-cxx/security/validation-policy-config.cpp b/ndn-cxx/security/validation-policy-config.cpp
index 45bc867..29d0a86 100644
--- a/ndn-cxx/security/validation-policy-config.cpp
+++ b/ndn-cxx/security/validation-policy-config.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).
*
@@ -31,10 +31,7 @@
#include <fstream>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace validator_config {
+namespace ndn::security::validator_config {
void
ValidationPolicyConfig::load(const std::string& filename)
@@ -298,7 +295,4 @@
"No rule matched for interest `" + interest.getName().toUri() + "`"});
}
-} // namespace validator_config
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::validator_config
diff --git a/ndn-cxx/security/validation-policy-config.hpp b/ndn-cxx/security/validation-policy-config.hpp
index bc4b9f5..07e73e3 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-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,9 +25,7 @@
#include "ndn-cxx/security/validation-policy.hpp"
#include "ndn-cxx/security/validator-config/rule.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
namespace validator_config {
/**
@@ -106,8 +104,6 @@
using validator_config::ValidationPolicyConfig;
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_VALIDATION_POLICY_CONFIG_HPP
diff --git a/ndn-cxx/security/validation-policy-signed-interest.cpp b/ndn-cxx/security/validation-policy-signed-interest.cpp
index 8071a3c..58f5779 100644
--- a/ndn-cxx/security/validation-policy-signed-interest.cpp
+++ b/ndn-cxx/security/validation-policy-signed-interest.cpp
@@ -21,9 +21,7 @@
#include "ndn-cxx/security/validation-policy-signed-interest.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
ValidationPolicySignedInterest::ValidationPolicySignedInterest(unique_ptr<ValidationPolicy> inner,
const Options& options)
@@ -142,7 +140,7 @@
void
ValidationPolicySignedInterest::insertRecord(const Name& keyName,
- std::optional<time::system_clock::TimePoint> timestamp,
+ std::optional<time::system_clock::time_point> timestamp,
std::optional<uint64_t> seqNum,
std::optional<SigNonce> nonce)
{
@@ -185,6 +183,4 @@
}
}
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
diff --git a/ndn-cxx/security/validation-policy-signed-interest.hpp b/ndn-cxx/security/validation-policy-signed-interest.hpp
index 92365cd..39b5cc7 100644
--- a/ndn-cxx/security/validation-policy-signed-interest.hpp
+++ b/ndn-cxx/security/validation-policy-signed-interest.hpp
@@ -30,9 +30,7 @@
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/sequenced_index.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
/**
* @brief Validation policy for signed Interests.
@@ -158,7 +156,7 @@
void
insertRecord(const Name& keyName,
- std::optional<time::system_clock::TimePoint> timestamp,
+ std::optional<time::system_clock::time_point> timestamp,
std::optional<uint64_t> seqNum,
std::optional<SigNonce> nonce);
@@ -181,7 +179,7 @@
struct LastInterestRecord
{
LastInterestRecord(const Name& keyName,
- std::optional<time::system_clock::TimePoint> timestamp,
+ std::optional<time::system_clock::time_point> timestamp,
std::optional<uint64_t> seqNum)
: keyName(keyName)
, timestamp(timestamp)
@@ -191,10 +189,10 @@
}
Name keyName;
- std::optional<time::system_clock::TimePoint> timestamp;
+ std::optional<time::system_clock::time_point> timestamp;
std::optional<uint64_t> seqNum;
NonceContainer observedNonces;
- time::steady_clock::TimePoint lastRefreshed;
+ time::steady_clock::time_point lastRefreshed;
};
using Container = boost::multi_index_container<
@@ -204,7 +202,7 @@
boost::multi_index::member<LastInterestRecord, Name, &LastInterestRecord::keyName>
>,
boost::multi_index::ordered_non_unique<
- boost::multi_index::member<LastInterestRecord, time::steady_clock::TimePoint,
+ boost::multi_index::member<LastInterestRecord, time::steady_clock::time_point,
&LastInterestRecord::lastRefreshed>
>
>
@@ -215,8 +213,6 @@
Container::nth_index<1>::type& m_byLastRefreshed;
};
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_VALIDATION_POLICY_SIGNED_INTEREST_HPP
diff --git a/ndn-cxx/security/validation-policy-simple-hierarchy.cpp b/ndn-cxx/security/validation-policy-simple-hierarchy.cpp
index 6b5937f..15c06d6 100644
--- a/ndn-cxx/security/validation-policy-simple-hierarchy.cpp
+++ b/ndn-cxx/security/validation-policy-simple-hierarchy.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).
*
@@ -21,9 +21,7 @@
#include "ndn-cxx/security/validation-policy-simple-hierarchy.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
void
ValidationPolicySimpleHierarchy::checkPolicy(const Data& data, const shared_ptr<ValidationState>& state,
@@ -83,6 +81,4 @@
continueValidation(make_shared<CertificateRequest>(klName), state);
}
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
diff --git a/ndn-cxx/security/validation-policy-simple-hierarchy.hpp b/ndn-cxx/security/validation-policy-simple-hierarchy.hpp
index aa0b593..0459ec1 100644
--- a/ndn-cxx/security/validation-policy-simple-hierarchy.hpp
+++ b/ndn-cxx/security/validation-policy-simple-hierarchy.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,9 +24,7 @@
#include "ndn-cxx/security/validation-policy.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
/**
* @brief Validation policy for a simple hierarchical trust model
@@ -43,8 +41,6 @@
const ValidationContinuation& continueValidation) override;
};
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_VALIDATION_POLICY_SIMPLE_HIERARCHY_HPP
diff --git a/ndn-cxx/security/validation-policy.cpp b/ndn-cxx/security/validation-policy.cpp
index 97a839b..d713e1e 100644
--- a/ndn-cxx/security/validation-policy.cpp
+++ b/ndn-cxx/security/validation-policy.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).
*
@@ -22,9 +22,7 @@
#include "ndn-cxx/security/validation-policy.hpp"
#include "ndn-cxx/security/signing-info.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
void
ValidationPolicy::setInnerPolicy(unique_ptr<ValidationPolicy> innerPolicy)
@@ -132,6 +130,4 @@
"` does not respect the naming conventions"));
}
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
diff --git a/ndn-cxx/security/validation-policy.hpp b/ndn-cxx/security/validation-policy.hpp
index f49670a..8025bb5 100644
--- a/ndn-cxx/security/validation-policy.hpp
+++ b/ndn-cxx/security/validation-policy.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,9 +27,7 @@
#include "ndn-cxx/security/certificate-request.hpp"
#include "ndn-cxx/security/validation-state.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
/**
* @brief Abstraction that implements a validation policy for Interest and Data packets.
@@ -179,8 +177,6 @@
Name
extractIdentityNameFromKeyLocator(const Name& keyLocator);
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_VALIDATION_POLICY_HPP
diff --git a/ndn-cxx/security/validation-state.cpp b/ndn-cxx/security/validation-state.cpp
index 6fa2c96..cbb61d6 100644
--- a/ndn-cxx/security/validation-state.cpp
+++ b/ndn-cxx/security/validation-state.cpp
@@ -24,9 +24,7 @@
#include "ndn-cxx/security/verification-helpers.hpp"
#include "ndn-cxx/util/logger.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
NDN_LOG_INIT(ndn.security.ValidationState);
@@ -176,6 +174,4 @@
m_outcome = false;
}
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
diff --git a/ndn-cxx/security/validation-state.hpp b/ndn-cxx/security/validation-state.hpp
index de16915..3ce5f57 100644
--- a/ndn-cxx/security/validation-state.hpp
+++ b/ndn-cxx/security/validation-state.hpp
@@ -26,15 +26,13 @@
#include "ndn-cxx/security/certificate.hpp"
#include "ndn-cxx/security/signing-info.hpp"
#include "ndn-cxx/security/validation-callback.hpp"
-#include "ndn-cxx/util/signal.hpp"
+#include "ndn-cxx/util/signal/signal.hpp"
#include <list>
#include <unordered_set>
#include <boost/logic/tribool.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
class Validator;
@@ -239,7 +237,7 @@
}
public:
- util::Signal<InterestValidationState, Interest> afterSuccess;
+ signal::Signal<InterestValidationState, Interest> afterSuccess;
private:
void
@@ -256,8 +254,6 @@
using SignedInterestFormatTag = SimpleTag<SignedInterestFormat, 1002>;
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_VALIDATION_STATE_HPP
diff --git a/ndn-cxx/security/validator-config.cpp b/ndn-cxx/security/validator-config.cpp
index cb19348..5cedf50 100644
--- a/ndn-cxx/security/validator-config.cpp
+++ b/ndn-cxx/security/validator-config.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).
*
@@ -22,8 +22,7 @@
#include "ndn-cxx/security/validator-config.hpp"
#include "ndn-cxx/security/certificate-fetcher-from-network.hpp"
-namespace ndn {
-namespace security {
+namespace ndn::security {
ValidatorConfig::ValidatorConfig(std::unique_ptr<CertificateFetcher> fetcher,
const CommandInterestOptions& ciOptions,
@@ -70,5 +69,4 @@
m_policyConfig.load(configSection, filename);
}
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
diff --git a/ndn-cxx/security/validator-config/checker.cpp b/ndn-cxx/security/validator-config/checker.cpp
index c11b477..11f1da9 100644
--- a/ndn-cxx/security/validator-config/checker.cpp
+++ b/ndn-cxx/security/validator-config/checker.cpp
@@ -25,10 +25,7 @@
#include <boost/algorithm/string/predicate.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace validator_config {
+namespace ndn::security::validator_config {
Checker::Checker(tlv::SignatureTypeValue sigType)
: m_sigType(sigType)
@@ -402,7 +399,4 @@
}
}
-} // namespace validator_config
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::validator_config
diff --git a/ndn-cxx/security/validator-config/checker.hpp b/ndn-cxx/security/validator-config/checker.hpp
index 1156011..5e04e5e 100644
--- a/ndn-cxx/security/validator-config/checker.hpp
+++ b/ndn-cxx/security/validator-config/checker.hpp
@@ -27,9 +27,7 @@
#include "ndn-cxx/security/validator-config/name-relation.hpp"
#include "ndn-cxx/util/regex.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
class ValidationState;
@@ -185,8 +183,6 @@
};
} // namespace validator_config
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_VALIDATOR_CONFIG_CHECKER_HPP
diff --git a/ndn-cxx/security/validator-config/common.hpp b/ndn-cxx/security/validator-config/common.hpp
index 93653ba..d4b1c9d 100644
--- a/ndn-cxx/security/validator-config/common.hpp
+++ b/ndn-cxx/security/validator-config/common.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -28,12 +28,9 @@
#include <boost/property_tree/ptree.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace validator_config {
+namespace ndn::security::validator_config {
-typedef boost::property_tree::ptree ConfigSection;
+using ConfigSection = boost::property_tree::ptree;
class Error : public std::runtime_error
{
@@ -41,9 +38,6 @@
using std::runtime_error::runtime_error;
};
-} // namespace validator_config
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::validator_config
#endif // NDN_CXX_SECURITY_VALIDATOR_CONFIG_COMMON_HPP
diff --git a/ndn-cxx/security/validator-config/filter.cpp b/ndn-cxx/security/validator-config/filter.cpp
index 7421813..ea23f5e 100644
--- a/ndn-cxx/security/validator-config/filter.cpp
+++ b/ndn-cxx/security/validator-config/filter.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).
*
@@ -29,10 +29,7 @@
#include <boost/algorithm/string/predicate.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace validator_config {
+namespace ndn::security::validator_config {
bool
Filter::match(uint32_t pktType, const Name& pktName, const shared_ptr<ValidationState>& state)
@@ -156,7 +153,4 @@
}
}
-} // namespace validator_config
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::validator_config
diff --git a/ndn-cxx/security/validator-config/filter.hpp b/ndn-cxx/security/validator-config/filter.hpp
index 41113f7..5c8286b 100644
--- a/ndn-cxx/security/validator-config/filter.hpp
+++ b/ndn-cxx/security/validator-config/filter.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -28,9 +28,7 @@
#include "ndn-cxx/security/validator-config/name-relation.hpp"
#include "ndn-cxx/util/regex.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
class ValidationState;
@@ -138,8 +136,6 @@
};
} // namespace validator_config
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_VALIDATOR_CONFIG_FILTER_HPP
diff --git a/ndn-cxx/security/validator-config/name-relation.cpp b/ndn-cxx/security/validator-config/name-relation.cpp
index 05804d1..870b44e 100644
--- a/ndn-cxx/security/validator-config/name-relation.cpp
+++ b/ndn-cxx/security/validator-config/name-relation.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).
*
@@ -23,10 +23,7 @@
#include <boost/algorithm/string/predicate.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace validator_config {
+namespace ndn::security::validator_config {
std::ostream&
operator<<(std::ostream& os, NameRelation relation)
@@ -73,7 +70,4 @@
}
}
-} // namespace validator_config
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::validator_config
diff --git a/ndn-cxx/security/validator-config/name-relation.hpp b/ndn-cxx/security/validator-config/name-relation.hpp
index 8559770..97b842a 100644
--- a/ndn-cxx/security/validator-config/name-relation.hpp
+++ b/ndn-cxx/security/validator-config/name-relation.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,10 +25,7 @@
#include "ndn-cxx/name.hpp"
#include "ndn-cxx/security/validator-config/common.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace validator_config {
+namespace ndn::security::validator_config {
enum class NameRelation {
EQUAL,
@@ -52,9 +49,6 @@
NameRelation
getNameRelationFromString(const std::string& relationString);
-} // namespace validator_config
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::validator_config
#endif // NDN_CXX_SECURITY_VALIDATOR_CONFIG_NAME_RELATION_HPP
diff --git a/ndn-cxx/security/validator-config/rule.cpp b/ndn-cxx/security/validator-config/rule.cpp
index 3382e58..b60aa10 100644
--- a/ndn-cxx/security/validator-config/rule.cpp
+++ b/ndn-cxx/security/validator-config/rule.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).
*
@@ -25,12 +25,9 @@
#include <boost/algorithm/string/predicate.hpp>
-NDN_LOG_INIT(ndn.security.validator_config.Rule);
+namespace ndn::security::validator_config {
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace validator_config {
+NDN_LOG_INIT(ndn.security.validator_config.Rule);
Rule::Rule(const std::string& id, uint32_t pktType)
: m_id(id)
@@ -171,7 +168,4 @@
return rule;
}
-} // namespace validator_config
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security::validator_config
diff --git a/ndn-cxx/security/validator-config/rule.hpp b/ndn-cxx/security/validator-config/rule.hpp
index e2d3daf..304d4d7 100644
--- a/ndn-cxx/security/validator-config/rule.hpp
+++ b/ndn-cxx/security/validator-config/rule.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,9 +25,7 @@
#include "ndn-cxx/security/validator-config/checker.hpp"
#include "ndn-cxx/security/validator-config/filter.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
class ValidationState;
@@ -110,8 +108,6 @@
};
} // namespace validator_config
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_VALIDATOR_CONFIG_RULE_HPP
diff --git a/ndn-cxx/security/validator-null.cpp b/ndn-cxx/security/validator-null.cpp
index 35c66cf..8e50065 100644
--- a/ndn-cxx/security/validator-null.cpp
+++ b/ndn-cxx/security/validator-null.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).
*
@@ -23,9 +23,7 @@
#include "ndn-cxx/security/validation-policy-accept-all.hpp"
#include "ndn-cxx/security/certificate-fetcher-offline.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
ValidatorNull::ValidatorNull()
: Validator(make_unique<ValidationPolicyAcceptAll>(), make_unique<CertificateFetcherOffline>())
@@ -39,6 +37,4 @@
return validator;
}
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
diff --git a/ndn-cxx/security/validator-null.hpp b/ndn-cxx/security/validator-null.hpp
index 58fd1f8..fc14edf 100644
--- a/ndn-cxx/security/validator-null.hpp
+++ b/ndn-cxx/security/validator-null.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,9 +24,7 @@
#include "ndn-cxx/security/validator.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
/**
* @brief Validator with "accept-all" policy and offline certificate fetcher
@@ -40,8 +38,6 @@
Validator&
getAcceptAllValidator();
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_VALIDATOR_NULL_HPP
diff --git a/ndn-cxx/security/validator.cpp b/ndn-cxx/security/validator.cpp
index fd9817f..ca829f9 100644
--- a/ndn-cxx/security/validator.cpp
+++ b/ndn-cxx/security/validator.cpp
@@ -24,9 +24,7 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
+namespace ndn::security {
NDN_LOG_INIT(ndn.security.Validator);
@@ -198,6 +196,4 @@
CertificateStorage::resetVerifiedCerts();
}
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
diff --git a/ndn-cxx/security/validator.hpp b/ndn-cxx/security/validator.hpp
index f08585d..d2f5fcb 100644
--- a/ndn-cxx/security/validator.hpp
+++ b/ndn-cxx/security/validator.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).
*
@@ -34,7 +34,6 @@
class Face;
namespace security {
-inline namespace v2 {
/**
* @brief Interface for validating data and interest packets.
@@ -204,7 +203,6 @@
size_t m_maxDepth{25};
};
-} // inline namespace v2
} // namespace security
} // namespace ndn
diff --git a/ndn-cxx/security/validity-period.cpp b/ndn-cxx/security/validity-period.cpp
index c7f5b5d..1c911a8 100644
--- a/ndn-cxx/security/validity-period.cpp
+++ b/ndn-cxx/security/validity-period.cpp
@@ -22,8 +22,7 @@
#include "ndn-cxx/security/validity-period.hpp"
#include "ndn-cxx/encoding/block-helpers.hpp"
-namespace ndn {
-namespace security {
+namespace ndn::security {
using boost::chrono::time_point_cast;
@@ -33,21 +32,21 @@
ValidityPeriod
ValidityPeriod::makeRelative(time::seconds validFrom, time::seconds validUntil,
- const time::system_clock::TimePoint& now)
+ const time::system_clock::time_point& now)
{
return ValidityPeriod(now + validFrom, now + validUntil);
}
ValidityPeriod::ValidityPeriod()
- : ValidityPeriod(time::system_clock::TimePoint() + 1_ns,
- time::system_clock::TimePoint())
+ : ValidityPeriod(time::system_clock::time_point() + 1_ns,
+ time::system_clock::time_point())
{
}
-ValidityPeriod::ValidityPeriod(const time::system_clock::TimePoint& notBefore,
- const time::system_clock::TimePoint& notAfter)
+ValidityPeriod::ValidityPeriod(const time::system_clock::time_point& notBefore,
+ const time::system_clock::time_point& notAfter)
: m_notBefore(time_point_cast<TimePoint::duration>(notBefore + TimePoint::duration(1) -
- time::system_clock::TimePoint::duration(1)))
+ time::system_clock::time_point::duration(1)))
, m_notAfter(time_point_cast<TimePoint::duration>(notAfter))
{
}
@@ -126,24 +125,24 @@
}
ValidityPeriod&
-ValidityPeriod::setPeriod(const time::system_clock::TimePoint& notBefore,
- const time::system_clock::TimePoint& notAfter)
+ValidityPeriod::setPeriod(const time::system_clock::time_point& notBefore,
+ const time::system_clock::time_point& notAfter)
{
m_wire.reset();
m_notBefore = time_point_cast<TimePoint::duration>(notBefore + TimePoint::duration(1) -
- time::system_clock::TimePoint::duration(1));
+ time::system_clock::time_point::duration(1));
m_notAfter = time_point_cast<TimePoint::duration>(notAfter);
return *this;
}
-std::pair<time::system_clock::TimePoint, time::system_clock::TimePoint>
+std::pair<time::system_clock::time_point, time::system_clock::time_point>
ValidityPeriod::getPeriod() const
{
return {m_notBefore, m_notAfter};
}
bool
-ValidityPeriod::isValid(const time::system_clock::TimePoint& now) const
+ValidityPeriod::isValid(const time::system_clock::time_point& now) const
{
return m_notBefore <= now && now <= m_notAfter;
}
@@ -156,5 +155,4 @@
return os;
}
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
diff --git a/ndn-cxx/security/validity-period.hpp b/ndn-cxx/security/validity-period.hpp
index 97bc47c..4a9f69e 100644
--- a/ndn-cxx/security/validity-period.hpp
+++ b/ndn-cxx/security/validity-period.hpp
@@ -26,8 +26,7 @@
#include "ndn-cxx/encoding/tlv.hpp"
#include "ndn-cxx/util/time.hpp"
-namespace ndn {
-namespace security {
+namespace ndn::security {
/**
* @brief Represents a %ValidityPeriod TLV element.
@@ -52,7 +51,7 @@
*/
static ValidityPeriod
makeRelative(time::seconds validFrom, time::seconds validUntil,
- const time::system_clock::TimePoint& now = time::system_clock::now());
+ const time::system_clock::time_point& now = time::system_clock::now());
/** @brief Set validity period [UNIX epoch + 1 nanosecond, UNIX epoch] that is always invalid
*/
@@ -71,15 +70,15 @@
* - @p notBefore is rounded up the next whole second
* - @p notAfter is truncated to the previous whole second
*/
- ValidityPeriod(const time::system_clock::TimePoint& notBefore,
- const time::system_clock::TimePoint& notAfter);
+ ValidityPeriod(const time::system_clock::time_point& notBefore,
+ const time::system_clock::time_point& notAfter);
/** @brief Check if @p now falls within the validity period
* @param now Time point to check if it falls within the period
* @return periodBegin <= @p now and @p now <= periodEnd
*/
bool
- isValid(const time::system_clock::TimePoint& now = time::system_clock::now()) const;
+ isValid(const time::system_clock::time_point& now = time::system_clock::now()) const;
/** @brief Set validity period [@p notBefore, @p notAfter]
* @param notBefore exclusive beginning of the validity period range
@@ -90,12 +89,12 @@
* - @p notAfter is truncated to the previous whole second
*/
ValidityPeriod&
- setPeriod(const time::system_clock::TimePoint& notBefore,
- const time::system_clock::TimePoint& notAfter);
+ setPeriod(const time::system_clock::time_point& notBefore,
+ const time::system_clock::time_point& notAfter);
/** @brief Get the stored validity period
*/
- std::pair<time::system_clock::TimePoint, time::system_clock::TimePoint>
+ std::pair<time::system_clock::time_point, time::system_clock::time_point>
getPeriod() const;
/** @brief Fast encoding or block size estimation
@@ -146,7 +145,6 @@
std::ostream&
operator<<(std::ostream& os, const ValidityPeriod& period);
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
#endif // NDN_CXX_SECURITY_VALIDITY_PERIOD_HPP
diff --git a/ndn-cxx/security/verification-helpers.cpp b/ndn-cxx/security/verification-helpers.cpp
index 0a339f3..37fe838 100644
--- a/ndn-cxx/security/verification-helpers.cpp
+++ b/ndn-cxx/security/verification-helpers.cpp
@@ -36,8 +36,7 @@
#include <openssl/crypto.h>
-namespace ndn {
-namespace security {
+namespace ndn::security {
namespace {
@@ -261,5 +260,4 @@
return verifySignature(parse(interest), tpm, keyName, digestAlgorithm);
}
-} // namespace security
-} // namespace ndn
+} // namespace ndn::security
diff --git a/ndn-cxx/security/verification-helpers.hpp b/ndn-cxx/security/verification-helpers.hpp
index ee8c9ec..83ae137 100644
--- a/ndn-cxx/security/verification-helpers.hpp
+++ b/ndn-cxx/security/verification-helpers.hpp
@@ -44,9 +44,7 @@
class PublicKey;
} // namespace transform
-inline namespace v2 {
class Certificate;
-} // inline namespace v2
/**
* @brief Verify @p blobs using @p key against @p sig.
diff --git a/ndn-cxx/transport/detail/stream-transport-impl.hpp b/ndn-cxx/transport/detail/stream-transport-impl.hpp
index 1b47f49..0ee1035 100644
--- a/ndn-cxx/transport/detail/stream-transport-impl.hpp
+++ b/ndn-cxx/transport/detail/stream-transport-impl.hpp
@@ -30,8 +30,7 @@
#include <list>
#include <queue>
-namespace ndn {
-namespace detail {
+namespace ndn::detail {
/** \brief Implementation detail of a Boost.Asio-based stream-oriented transport.
* \tparam BaseTransport a subclass of Transport
@@ -241,7 +240,6 @@
boost::asio::steady_timer m_connectTimer;
};
-} // namespace detail
-} // namespace ndn
+} // namespace ndn::detail
#endif // NDN_CXX_TRANSPORT_DETAIL_STREAM_TRANSPORT_IMPL_HPP
diff --git a/ndn-cxx/transport/detail/stream-transport-with-resolver-impl.hpp b/ndn-cxx/transport/detail/stream-transport-with-resolver-impl.hpp
index 61c7d27..8d0de0c 100644
--- a/ndn-cxx/transport/detail/stream-transport-with-resolver-impl.hpp
+++ b/ndn-cxx/transport/detail/stream-transport-with-resolver-impl.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).
*
@@ -24,8 +24,7 @@
#include "ndn-cxx/transport/detail/stream-transport-impl.hpp"
-namespace ndn {
-namespace detail {
+namespace ndn::detail {
/** \brief Implementation detail of a Boost.Asio-based stream-oriented transport
* with resolver support.
@@ -100,7 +99,6 @@
}
};
-} // namespace detail
-} // namespace ndn
+} // namespace ndn::detail
#endif // NDN_CXX_TRANSPORT_DETAIL_STREAM_TRANSPORT_WITH_RESOLVER_IMPL_HPP
diff --git a/ndn-cxx/util/dummy-client-face.cpp b/ndn-cxx/util/dummy-client-face.cpp
index 51fd77e..1f278e5 100644
--- a/ndn-cxx/util/dummy-client-face.cpp
+++ b/ndn-cxx/util/dummy-client-face.cpp
@@ -30,7 +30,6 @@
#include <boost/asio/io_service.hpp>
namespace ndn {
-namespace util {
class DummyClientFace::Transport final : public ndn::Transport
{
@@ -66,7 +65,7 @@
}
public:
- Signal<Transport, Block> onSendBlock;
+ signal::Signal<Transport, Block> onSendBlock;
};
struct DummyClientFace::BroadcastLink
@@ -324,5 +323,4 @@
}
}
-} // namespace util
} // namespace ndn
diff --git a/ndn-cxx/util/dummy-client-face.hpp b/ndn-cxx/util/dummy-client-face.hpp
index 22a80d8..62c0ba9 100644
--- a/ndn-cxx/util/dummy-client-face.hpp
+++ b/ndn-cxx/util/dummy-client-face.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).
*
@@ -23,18 +23,19 @@
#define NDN_CXX_UTIL_DUMMY_CLIENT_FACE_HPP
#include "ndn-cxx/face.hpp"
-#include "ndn-cxx/util/signal.hpp"
#include "ndn-cxx/security/key-chain.hpp"
+#include "ndn-cxx/util/signal/signal.hpp"
namespace ndn {
-namespace util {
-/** \brief A client-side face for unit testing.
+/**
+ * \brief A client-side face for unit testing.
*/
-class DummyClientFace : public ndn::Face
+class DummyClientFace : public Face
{
public:
- /** \brief %Options for DummyClientFace.
+ /**
+ * \brief %Options for DummyClientFace.
*/
class Options
{
@@ -176,19 +177,19 @@
*
* After .expressInterest, .processEvents must be called before this signal would be emitted.
*/
- Signal<DummyClientFace, Interest> onSendInterest;
+ signal::Signal<DummyClientFace, Interest> onSendInterest;
/** \brief Emits whenever a Data packet is sent.
*
* After .put, .processEvents must be called before this signal would be emitted.
*/
- Signal<DummyClientFace, Data> onSendData;
+ signal::Signal<DummyClientFace, Data> onSendData;
/** \brief Emits whenever a Nack is sent.
*
* After .put, .processEvents must be called before this signal would be emitted.
*/
- Signal<DummyClientFace, lp::Nack> onSendNack;
+ signal::Signal<DummyClientFace, lp::Nack> onSendNack;
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE:
struct BroadcastLink;
@@ -198,7 +199,11 @@
std::function<void(time::milliseconds)> m_processEventsOverride;
};
+namespace util {
+/// \deprecated Use ndn::DummyClientFace
+using DummyClientFace = ::ndn::DummyClientFace;
} // namespace util
+
} // namespace ndn
#endif // NDN_CXX_UTIL_DUMMY_CLIENT_FACE_HPP
diff --git a/ndn-cxx/util/exception.cpp b/ndn-cxx/util/exception.cpp
index d143692..684fc75 100644
--- a/ndn-cxx/util/exception.cpp
+++ b/ndn-cxx/util/exception.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).
*
@@ -23,8 +23,7 @@
#include <sstream>
-namespace ndn {
-namespace exception {
+namespace ndn::exception {
#ifdef NDN_CXX_HAVE_STACKTRACE
std::string
@@ -41,5 +40,4 @@
}
#endif
-} // namespace exception
-} // namespace ndn
+} // namespace ndn::exception
diff --git a/ndn-cxx/util/exception.hpp b/ndn-cxx/util/exception.hpp
index a8cd326..dadb697 100644
--- a/ndn-cxx/util/exception.hpp
+++ b/ndn-cxx/util/exception.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -36,8 +36,7 @@
#include <boost/stacktrace/stacktrace.hpp>
#endif
-namespace ndn {
-namespace exception {
+namespace ndn::exception {
#ifdef NDN_CXX_HAVE_STACKTRACE
using errinfo_stacktrace = boost::error_info<struct stacktrace, boost::stacktrace::stacktrace>;
@@ -46,8 +45,7 @@
to_string(const errinfo_stacktrace&);
#endif
-} // namespace exception
-} // namespace ndn
+} // namespace ndn::exception
/** \cond */
#ifdef NDN_CXX_HAVE_STACKTRACE
diff --git a/ndn-cxx/util/impl/logger-android.cpp b/ndn-cxx/util/impl/logger-android.cpp
index bcfeef5..76aef0f 100644
--- a/ndn-cxx/util/impl/logger-android.cpp
+++ b/ndn-cxx/util/impl/logger-android.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).
*
@@ -25,9 +25,7 @@
#include <android/log.h>
-namespace ndn {
-namespace util {
-namespace detail {
+namespace ndn::util::detail {
class AndroidSinkBackend : public boost::log::sinks::basic_sink_backend<boost::log::sinks::concurrent_feeding>
{
@@ -72,6 +70,4 @@
return boost::make_shared<boost::log::sinks::synchronous_sink<AndroidSinkBackend>>();
}
-} // namespace detail
-} // namespace util
-} // namespace ndn
+} // namespace ndn::util::detail
diff --git a/ndn-cxx/util/impl/logger-android.hpp b/ndn-cxx/util/impl/logger-android.hpp
index e31402d..4a94e17 100644
--- a/ndn-cxx/util/impl/logger-android.hpp
+++ b/ndn-cxx/util/impl/logger-android.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -28,15 +28,11 @@
#error "This file should not be compiled ..."
#endif
-namespace ndn {
-namespace util {
-namespace detail {
+namespace ndn::util::detail {
boost::shared_ptr<boost::log::sinks::sink>
makeAndroidLogger();
-} // namespace detail
-} // namespace util
-} // namespace ndn
+} // namespace ndn::util::detail
#endif // NDN_CXX_UTIL_IMPL_LOGGER_ANDROID_HPP
diff --git a/ndn-cxx/util/impl/steady-timer.hpp b/ndn-cxx/util/impl/steady-timer.hpp
index d4219a0..75f374e 100644
--- a/ndn-cxx/util/impl/steady-timer.hpp
+++ b/ndn-cxx/util/impl/steady-timer.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -27,8 +27,7 @@
#include <boost/asio/basic_waitable_timer.hpp>
#include <boost/asio/wait_traits.hpp>
-namespace boost {
-namespace asio {
+namespace boost::asio {
template<>
struct wait_traits<ndn::time::steady_clock>
@@ -40,12 +39,9 @@
}
};
-} // namespace asio
-} // namespace boost
+} // namespace boost::asio
-namespace ndn {
-namespace util {
-namespace detail {
+namespace ndn::detail {
class SteadyTimer : public boost::asio::basic_waitable_timer<time::steady_clock>
{
@@ -53,8 +49,6 @@
using boost::asio::basic_waitable_timer<time::steady_clock>::basic_waitable_timer;
};
-} // namespace detail
-} // namespace util
-} // namespace ndn
+} // namespace ndn::detail
#endif // NDN_CXX_UTIL_IMPL_STEADY_TIMER_HPP
diff --git a/ndn-cxx/util/indented-stream.cpp b/ndn-cxx/util/indented-stream.cpp
index e178c13..00672db 100644
--- a/ndn-cxx/util/indented-stream.cpp
+++ b/ndn-cxx/util/indented-stream.cpp
@@ -27,8 +27,7 @@
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>
-namespace ndn {
-namespace util {
+namespace ndn::util {
IndentedStream::IndentedStream(std::ostream& os, std::string_view indent)
: std::ostream(&m_buffer)
@@ -66,5 +65,4 @@
return 0; // success
}
-} // namespace util
-} // namespace ndn
+} // namespace ndn::util
diff --git a/ndn-cxx/util/indented-stream.hpp b/ndn-cxx/util/indented-stream.hpp
index b2d5059..5bb0395 100644
--- a/ndn-cxx/util/indented-stream.hpp
+++ b/ndn-cxx/util/indented-stream.hpp
@@ -26,8 +26,7 @@
#include <sstream>
#include <string>
-namespace ndn {
-namespace util {
+namespace ndn::util {
/**
* @brief Output to stream with specified indent or prefix
@@ -76,7 +75,6 @@
StreamBuf m_buffer;
};
-} // namespace util
-} // namespace ndn
+} // namespace ndn::util
#endif // NDN_CXX_UTIL_INDENTED_STREAM_HPP
diff --git a/ndn-cxx/util/io.cpp b/ndn-cxx/util/io.cpp
index 663c4e0..c40ebe9 100644
--- a/ndn-cxx/util/io.cpp
+++ b/ndn-cxx/util/io.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,7 @@
#include "ndn-cxx/security/transform/stream-source.hpp"
#include "ndn-cxx/security/transform/strip-space.hpp"
-namespace ndn {
-namespace io {
+namespace ndn::io {
shared_ptr<Buffer>
loadBuffer(std::istream& is, IoEncoding encoding)
@@ -84,5 +83,4 @@
NDN_THROW(std::invalid_argument("Unknown IoEncoding " + to_string(encoding)));
}
-} // namespace io
-} // namespace ndn
+} // namespace ndn::io
diff --git a/ndn-cxx/util/io.hpp b/ndn-cxx/util/io.hpp
index 3500507..b439986 100644
--- a/ndn-cxx/util/io.hpp
+++ b/ndn-cxx/util/io.hpp
@@ -27,8 +27,7 @@
#include <fstream>
-namespace ndn {
-namespace io {
+namespace ndn::io {
class Error : public std::runtime_error
{
@@ -201,7 +200,6 @@
save(obj, os, encoding);
}
-} // namespace io
-} // namespace ndn
+} // namespace ndn::io
#endif // NDN_CXX_UTIL_IO_HPP
diff --git a/ndn-cxx/util/logger.cpp b/ndn-cxx/util/logger.cpp
index c9bea26..f2d3d07 100644
--- a/ndn-cxx/util/logger.cpp
+++ b/ndn-cxx/util/logger.cpp
@@ -22,8 +22,7 @@
#include "ndn-cxx/util/logger.hpp"
#include "ndn-cxx/util/logging.hpp"
-namespace ndn {
-namespace util {
+namespace ndn::util {
std::ostream&
operator<<(std::ostream& os, LogLevel level)
@@ -105,5 +104,4 @@
Logging::get().registerLoggerNameImpl(name);
}
-} // namespace util
-} // namespace ndn
+} // namespace ndn::util
diff --git a/ndn-cxx/util/logger.hpp b/ndn-cxx/util/logger.hpp
index 3261b85..abee117 100644
--- a/ndn-cxx/util/logger.hpp
+++ b/ndn-cxx/util/logger.hpp
@@ -34,8 +34,7 @@
#include <atomic>
-namespace ndn {
-namespace util {
+namespace ndn::util {
/**
* \brief Indicates the severity level of a log message.
@@ -277,8 +276,7 @@
*/
#define NDN_LOG_FATAL(expression) NDN_LOG_INTERNAL(FATAL, expression)
-} // namespace util
-} // namespace ndn
+} // namespace ndn::util
#endif // HAVE_NDN_CXX_CUSTOM_LOGGER
diff --git a/ndn-cxx/util/logging.cpp b/ndn-cxx/util/logging.cpp
index b6ffe7d..0dbdf81 100644
--- a/ndn-cxx/util/logging.cpp
+++ b/ndn-cxx/util/logging.cpp
@@ -42,8 +42,7 @@
#include <iostream>
#include <sstream>
-namespace ndn {
-namespace util {
+namespace ndn::util {
namespace log {
static std::string
@@ -339,5 +338,4 @@
}
}
-} // namespace util
-} // namespace ndn
+} // namespace ndn::util
diff --git a/ndn-cxx/util/logging.hpp b/ndn-cxx/util/logging.hpp
index 644bf77..169096a 100644
--- a/ndn-cxx/util/logging.hpp
+++ b/ndn-cxx/util/logging.hpp
@@ -33,8 +33,7 @@
#include <set>
#include <unordered_map>
-namespace ndn {
-namespace util {
+namespace ndn::util {
enum class LogLevel;
class Logger;
@@ -221,8 +220,7 @@
get().flushImpl();
}
-} // namespace util
-} // namespace ndn
+} // namespace ndn::util
#endif // HAVE_NDN_CXX_CUSTOM_LOGGER
diff --git a/ndn-cxx/util/notification-stream.hpp b/ndn-cxx/util/notification-stream.hpp
index de37498..dceba06 100644
--- a/ndn-cxx/util/notification-stream.hpp
+++ b/ndn-cxx/util/notification-stream.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,8 +27,7 @@
#include "ndn-cxx/security/key-chain.hpp"
#include "ndn-cxx/util/concepts.hpp"
-namespace ndn {
-namespace util {
+namespace ndn::util {
/** \brief Provides a publisher of Notification Stream.
* \sa https://redmine.named-data.net/projects/nfd/wiki/Notification
@@ -73,7 +72,6 @@
uint64_t m_sequenceNo;
};
-} // namespace util
-} // namespace ndn
+} // namespace ndn::util
#endif // NDN_CXX_UTIL_NOTIFICATION_STREAM_HPP
diff --git a/ndn-cxx/util/notification-subscriber.cpp b/ndn-cxx/util/notification-subscriber.cpp
index deaf8be..4a13240 100644
--- a/ndn-cxx/util/notification-subscriber.cpp
+++ b/ndn-cxx/util/notification-subscriber.cpp
@@ -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,
@@ -30,8 +30,7 @@
#include <cmath>
-namespace ndn {
-namespace util {
+namespace ndn::util {
NotificationSubscriberBase::NotificationSubscriberBase(Face& face, const Name& prefix,
time::milliseconds interestLifetime)
@@ -188,5 +187,4 @@
random::generateWord32() % 100));
}
-} // namespace util
-} // namespace ndn
+} // namespace ndn::util
diff --git a/ndn-cxx/util/notification-subscriber.hpp b/ndn-cxx/util/notification-subscriber.hpp
index 3b78fdb..0191b7b 100644
--- a/ndn-cxx/util/notification-subscriber.hpp
+++ b/ndn-cxx/util/notification-subscriber.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,
@@ -31,11 +31,10 @@
#include "ndn-cxx/face.hpp"
#include "ndn-cxx/util/concepts.hpp"
#include "ndn-cxx/util/scheduler.hpp"
-#include "ndn-cxx/util/signal.hpp"
+#include "ndn-cxx/util/signal/signal.hpp"
#include "ndn-cxx/util/time.hpp"
-namespace ndn {
-namespace util {
+namespace ndn::util {
class NotificationSubscriberBase : noncopyable
{
@@ -120,15 +119,15 @@
public:
/** \brief Fires when a Nack is received.
*/
- signal::Signal<NotificationSubscriberBase, lp::Nack> onNack;
+ Signal<NotificationSubscriberBase, lp::Nack> onNack;
/** \brief Fires when no Notification is received within getInterestLifetime() period.
*/
- signal::Signal<NotificationSubscriberBase> onTimeout;
+ Signal<NotificationSubscriberBase> onTimeout;
/** \brief Fires when a Data packet in the Notification Stream cannot be decoded as Notification.
*/
- signal::Signal<NotificationSubscriberBase, Data> onDecodeError;
+ Signal<NotificationSubscriberBase, Data> onDecodeError;
private:
Face& m_face;
@@ -168,7 +167,7 @@
/** \brief Fires when a Notification is received.
* \note Removing all handlers will cause the subscriber to stop.
*/
- signal::Signal<NotificationSubscriber, Notification> onNotification;
+ Signal<NotificationSubscriber, Notification> onNotification;
private:
bool
@@ -187,13 +186,11 @@
catch (const tlv::Error&) {
return false;
}
-
onNotification(notification);
return true;
}
};
-} // namespace util
-} // namespace ndn
+} // namespace ndn::util
#endif // NDN_CXX_UTIL_NOTIFICATION_SUBSCRIBER_HPP
diff --git a/ndn-cxx/util/random.cpp b/ndn-cxx/util/random.cpp
index 0eec624..529fc69 100644
--- a/ndn-cxx/util/random.cpp
+++ b/ndn-cxx/util/random.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,8 +24,7 @@
#include <openssl/err.h>
#include <openssl/rand.h>
-namespace ndn {
-namespace random {
+namespace ndn::random {
uint32_t
generateSecureWord32()
@@ -78,5 +77,4 @@
return distribution(getRandomNumberEngine());
}
-} // namespace random
-} // namespace ndn
+} // namespace ndn::random
diff --git a/ndn-cxx/util/random.hpp b/ndn-cxx/util/random.hpp
index be32ea1..cf03cc3 100644
--- a/ndn-cxx/util/random.hpp
+++ b/ndn-cxx/util/random.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,8 +27,7 @@
#include <random>
-namespace ndn {
-namespace random {
+namespace ndn::random {
/**
* @brief Generate a cryptographically secure random integer from the range [0, 2^32)
@@ -85,7 +84,6 @@
uint64_t
generateWord64();
-} // namespace random
-} // namespace ndn
+} // namespace ndn::random
#endif // NDN_CXX_UTIL_RANDOM_HPP
diff --git a/ndn-cxx/util/rtt-estimator.cpp b/ndn-cxx/util/rtt-estimator.cpp
index 04310d2..3fb2cb5 100644
--- a/ndn-cxx/util/rtt-estimator.cpp
+++ b/ndn-cxx/util/rtt-estimator.cpp
@@ -26,8 +26,7 @@
#include "ndn-cxx/util/rtt-estimator.hpp"
-namespace ndn {
-namespace util {
+namespace ndn::util {
RttEstimator::RttEstimator(shared_ptr<const Options> options)
: m_options(options ? std::move(options) : make_shared<const Options>())
@@ -81,5 +80,4 @@
m_nRttSamples++;
}
-} // namespace util
-} // namespace ndn
+} // namespace ndn::util
diff --git a/ndn-cxx/util/rtt-estimator.hpp b/ndn-cxx/util/rtt-estimator.hpp
index ba3255c..355a314 100644
--- a/ndn-cxx/util/rtt-estimator.hpp
+++ b/ndn-cxx/util/rtt-estimator.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (C) 2016-2019, Arizona Board of Regents.
+ * Copyright (C) 2016-2023, Arizona Board of Regents.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -29,8 +29,7 @@
#include "ndn-cxx/util/time.hpp"
-namespace ndn {
-namespace util {
+namespace ndn::util {
/**
* @brief RTT/RTO estimator.
@@ -180,7 +179,6 @@
int64_t m_nRttSamples = 0;
};
-} // namespace util
-} // namespace ndn
+} // namespace ndn::util
#endif // NDN_CXX_UTIL_RTT_ESTIMATOR_HPP
diff --git a/ndn-cxx/util/scheduler.cpp b/ndn-cxx/util/scheduler.cpp
index b8a9691..ecc9c7f 100644
--- a/ndn-cxx/util/scheduler.cpp
+++ b/ndn-cxx/util/scheduler.cpp
@@ -23,8 +23,7 @@
#include "ndn-cxx/util/impl/steady-timer.hpp"
#include "ndn-cxx/util/scope.hpp"
-namespace ndn {
-namespace scheduler {
+namespace ndn::scheduler {
/** \brief Stores internal information about a scheduled event
*/
@@ -46,7 +45,7 @@
public:
EventCallback callback;
Scheduler::EventQueue::const_iterator queueIt;
- time::steady_clock::TimePoint expireTime;
+ time::steady_clock::time_point expireTime;
bool isExpired = false;
};
@@ -82,7 +81,7 @@
}
Scheduler::Scheduler(boost::asio::io_service& ioService)
- : m_timer(make_unique<util::detail::SteadyTimer>(ioService))
+ : m_timer(make_unique<detail::SteadyTimer>(ioService))
{
}
@@ -165,5 +164,4 @@
}
}
-} // namespace scheduler
-} // namespace ndn
+} // namespace ndn::scheduler
diff --git a/ndn-cxx/util/scheduler.hpp b/ndn-cxx/util/scheduler.hpp
index 547345a..b5dd908 100644
--- a/ndn-cxx/util/scheduler.hpp
+++ b/ndn-cxx/util/scheduler.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -31,11 +31,9 @@
namespace ndn {
-namespace util {
namespace detail {
class SteadyTimer;
} // namespace detail
-} // namespace util
namespace scheduler {
@@ -178,7 +176,7 @@
using EventQueue = std::multiset<shared_ptr<EventInfo>, EventQueueCompare>;
EventQueue m_queue;
- unique_ptr<util::detail::SteadyTimer> m_timer;
+ unique_ptr<detail::SteadyTimer> m_timer;
bool m_isEventExecuting = false;
friend EventId;
diff --git a/ndn-cxx/util/segment-fetcher.cpp b/ndn-cxx/util/segment-fetcher.cpp
index 727b836..b570a7b 100644
--- a/ndn-cxx/util/segment-fetcher.cpp
+++ b/ndn-cxx/util/segment-fetcher.cpp
@@ -35,7 +35,6 @@
#include <cmath>
namespace ndn {
-namespace util {
void
SegmentFetcher::Options::validate()
@@ -64,7 +63,7 @@
, m_face(face)
, m_scheduler(m_face.getIoService())
, m_validator(validator)
- , m_rttEstimator(make_shared<RttEstimator::Options>(options.rttOptions))
+ , m_rttEstimator(make_shared<util::RttEstimator::Options>(options.rttOptions))
, m_timeLastSegmentReceived(time::steady_clock::now())
, m_cwnd(options.initCwnd)
, m_ssthresh(options.initSsthresh)
@@ -520,5 +519,4 @@
time::duration_cast<time::milliseconds>(m_rttEstimator.getEstimatedRto()));
}
-} // namespace util
} // namespace ndn
diff --git a/ndn-cxx/util/segment-fetcher.hpp b/ndn-cxx/util/segment-fetcher.hpp
index 9e7476b..202afff 100644
--- a/ndn-cxx/util/segment-fetcher.hpp
+++ b/ndn-cxx/util/segment-fetcher.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -26,13 +26,12 @@
#include "ndn-cxx/security/validator.hpp"
#include "ndn-cxx/util/rtt-estimator.hpp"
#include "ndn-cxx/util/scheduler.hpp"
-#include "ndn-cxx/util/signal.hpp"
+#include "ndn-cxx/util/signal/signal.hpp"
#include <queue>
#include <set>
namespace ndn {
-namespace util {
/**
* @brief Utility class to fetch the latest version of a segmented object.
@@ -72,9 +71,9 @@
*
* Example:
* @code
- * auto fetcher = SegmentFetcher::start(face, Interest("/data/prefix"), validator);
- * fetcher->onComplete.connect([] (ConstBufferPtr data) {...});
- * fetcher->onError.connect([] (uint32_t errorCode, const std::string& errorMsg) {...});
+ * auto fetcher = SegmentFetcher::start(face, Interest("/data/prefix"), validator);
+ * fetcher->onComplete.connect([] (ConstBufferPtr data) {...});
+ * fetcher->onError.connect([] (uint32_t errorCode, const std::string& errorMsg) {...});
* @endcode
*/
class SegmentFetcher : noncopyable
@@ -119,7 +118,7 @@
double initSsthresh = std::numeric_limits<double>::max(); ///< initial slow start threshold
double aiStep = 1.0; ///< additive increase step (in segments)
double mdCoef = 0.5; ///< multiplicative decrease coefficient
- RttEstimator::Options rttOptions; ///< options for RTT estimator
+ util::RttEstimator::Options rttOptions; ///< options for RTT estimator
size_t flowControlWindow = 25000; ///< maximum number of segments stored in the reorder buffer
};
@@ -232,46 +231,46 @@
* @brief Emitted upon successful retrieval of the complete object (all segments).
* @note Emitted only if SegmentFetcher is operating in 'block' mode.
*/
- Signal<SegmentFetcher, ConstBufferPtr> onComplete;
+ signal::Signal<SegmentFetcher, ConstBufferPtr> onComplete;
/**
* @brief Emitted when the retrieval could not be completed due to an error.
*
* Handlers are provided with an error code and a string error message.
*/
- Signal<SegmentFetcher, uint32_t, std::string> onError;
+ signal::Signal<SegmentFetcher, uint32_t, std::string> onError;
/**
* @brief Emitted whenever a data segment received.
*/
- Signal<SegmentFetcher, Data> afterSegmentReceived;
+ signal::Signal<SegmentFetcher, Data> afterSegmentReceived;
/**
* @brief Emitted whenever a received data segment has been successfully validated.
*/
- Signal<SegmentFetcher, Data> afterSegmentValidated;
+ signal::Signal<SegmentFetcher, Data> afterSegmentValidated;
/**
* @brief Emitted whenever an Interest for a data segment is nacked.
*/
- Signal<SegmentFetcher> afterSegmentNacked;
+ signal::Signal<SegmentFetcher> afterSegmentNacked;
/**
* @brief Emitted whenever an Interest for a data segment times out.
*/
- Signal<SegmentFetcher> afterSegmentTimedOut;
+ signal::Signal<SegmentFetcher> afterSegmentTimedOut;
/**
* @brief Emitted after each data segment in segment order has been validated.
* @note Emitted only if SegmentFetcher is operating in 'in order' mode.
*/
- Signal<SegmentFetcher, ConstBufferPtr> onInOrderData;
+ signal::Signal<SegmentFetcher, ConstBufferPtr> onInOrderData;
/**
* @brief Emitted on successful retrieval of all segments in 'in order' mode.
* @note Emitted only if SegmentFetcher is operating in 'in order' mode.
*/
- Signal<SegmentFetcher> onInOrderComplete;
+ signal::Signal<SegmentFetcher> onInOrderComplete;
private:
enum class SegmentState {
@@ -284,7 +283,7 @@
{
public:
SegmentState state;
- time::steady_clock::TimePoint sendTime;
+ time::steady_clock::time_point sendTime;
ScopedPendingInterestHandle hdl;
scheduler::ScopedEventId timeoutEvent;
};
@@ -298,9 +297,9 @@
Face& m_face;
Scheduler m_scheduler;
security::Validator& m_validator;
- RttEstimator m_rttEstimator;
+ util::RttEstimator m_rttEstimator;
- time::steady_clock::TimePoint m_timeLastSegmentReceived;
+ time::steady_clock::time_point m_timeLastSegmentReceived;
std::queue<uint64_t> m_retxQueue;
Name m_versionedDataName;
uint64_t m_nextSegmentNum = 0;
@@ -320,7 +319,11 @@
std::set<uint64_t> m_receivedSegments;
};
+namespace util {
+/// \deprecated Use ndn::SegmentFetcher
+using SegmentFetcher = ::ndn::SegmentFetcher;
} // namespace util
+
} // namespace ndn
#endif // NDN_CXX_UTIL_SEGMENT_FETCHER_HPP
diff --git a/ndn-cxx/util/segmenter.cpp b/ndn-cxx/util/segmenter.cpp
index 75962c0..fe6263e 100644
--- a/ndn-cxx/util/segmenter.cpp
+++ b/ndn-cxx/util/segmenter.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,6 @@
#include <boost/iostreams/read.hpp>
namespace ndn {
-namespace util {
Segmenter::Segmenter(KeyChain& keyChain, const security::SigningInfo& signingInfo)
: m_keyChain(keyChain)
@@ -113,5 +112,4 @@
return segments;
}
-} // namespace util
} // namespace ndn
diff --git a/ndn-cxx/util/segmenter.hpp b/ndn-cxx/util/segmenter.hpp
index 8ebd1aa..eb70985 100644
--- a/ndn-cxx/util/segmenter.hpp
+++ b/ndn-cxx/util/segmenter.hpp
@@ -26,7 +26,6 @@
#include "ndn-cxx/util/span.hpp"
namespace ndn {
-namespace util {
/**
* @brief Utility class to segment an object into multiple Data packets.
@@ -78,7 +77,11 @@
security::SigningInfo m_signingInfo;
};
+namespace util {
+/// \deprecated Use ndn::Segmenter
+using Segmenter = ::ndn::Segmenter;
} // namespace util
+
} // namespace ndn
#endif // NDN_CXX_UTIL_SEGMENTER_HPP
diff --git a/ndn-cxx/util/sha256.cpp b/ndn-cxx/util/sha256.cpp
index 66355d6..47a02bb 100644
--- a/ndn-cxx/util/sha256.cpp
+++ b/ndn-cxx/util/sha256.cpp
@@ -27,8 +27,7 @@
#include <openssl/crypto.h>
-namespace ndn {
-namespace util {
+namespace ndn::util {
Sha256::Sha256()
{
@@ -146,5 +145,4 @@
return os;
}
-} // namespace util
-} // namespace ndn
+} // namespace ndn::util
diff --git a/ndn-cxx/util/sha256.hpp b/ndn-cxx/util/sha256.hpp
index 2e7b09c..abf6919 100644
--- a/ndn-cxx/util/sha256.hpp
+++ b/ndn-cxx/util/sha256.hpp
@@ -25,8 +25,7 @@
#include "ndn-cxx/encoding/buffer-stream.hpp"
#include "ndn-cxx/security/transform/step-source.hpp"
-namespace ndn {
-namespace util {
+namespace ndn::util {
/**
* @brief Provides stateful SHA-256 digest calculation.
@@ -169,7 +168,6 @@
std::ostream&
operator<<(std::ostream& os, Sha256& digest);
-} // namespace util
-} // namespace ndn
+} // namespace ndn::util
#endif // NDN_CXX_UTIL_SHA256_HPP
diff --git a/ndn-cxx/util/signal/connection.cpp b/ndn-cxx/util/signal/connection.cpp
index 1cc3fa5..37c11fc 100644
--- a/ndn-cxx/util/signal/connection.cpp
+++ b/ndn-cxx/util/signal/connection.cpp
@@ -21,9 +21,7 @@
#include "ndn-cxx/util/signal/connection.hpp"
-namespace ndn {
-namespace util {
-namespace signal {
+namespace ndn::signal {
Connection::Connection(weak_ptr<DisconnectFunction> disconnect) noexcept
: m_disconnect(std::move(disconnect))
@@ -39,6 +37,4 @@
}
}
-} // namespace signal
-} // namespace util
-} // namespace ndn
+} // namespace ndn::signal
diff --git a/ndn-cxx/util/signal/connection.hpp b/ndn-cxx/util/signal/connection.hpp
index 0952261..166b6cc 100644
--- a/ndn-cxx/util/signal/connection.hpp
+++ b/ndn-cxx/util/signal/connection.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).
*
@@ -24,14 +24,13 @@
#include "ndn-cxx/detail/common.hpp"
-namespace ndn {
-namespace util {
-namespace signal {
+namespace ndn::signal {
using DisconnectFunction = std::function<void()>;
-/** \brief Represents a connection to a signal.
- * \note This type is copyable. Any copy can be used to disconnect.
+/**
+ * \brief Represents a connection to a signal.
+ * \note This type is copyable. Any copy can be used to disconnect.
*/
class Connection
{
@@ -62,7 +61,7 @@
explicit
Connection(weak_ptr<DisconnectFunction> disconnect) noexcept;
- template<typename Owner, typename ...TArgs>
+ template<typename Owner, typename... TArgs>
friend class Signal;
private:
@@ -99,8 +98,11 @@
weak_ptr<DisconnectFunction> m_disconnect;
};
-} // namespace signal
-} // namespace util
-} // namespace ndn
+} // namespace ndn::signal
+
+namespace ndn::util::signal {
+/// \deprecated Use ndn::signal::Connection
+using Connection = ::ndn::signal::Connection;
+} // namespace ndn::util::signal
#endif // NDN_CXX_UTIL_SIGNAL_CONNECTION_HPP
diff --git a/ndn-cxx/util/signal/emit.hpp b/ndn-cxx/util/signal/emit.hpp
index a12aaaa..e1eb8d9 100644
--- a/ndn-cxx/util/signal/emit.hpp
+++ b/ndn-cxx/util/signal/emit.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -33,9 +33,7 @@
#ifndef NDN_CXX_UTIL_SIGNAL_EMIT_HPP
#define NDN_CXX_UTIL_SIGNAL_EMIT_HPP
-namespace ndn {
-namespace util {
-namespace signal {
+namespace ndn::signal {
/** \brief (implementation detail) a filler for extra argument
*/
@@ -43,9 +41,7 @@
{
};
-} // namespace signal
-} // namespace util
-} // namespace ndn
+} // namespace ndn::signal
/** \brief (implementation detail) declares a 'emit_signalName' method
* \note This macro should be used in 'protected' section so that it's accessible
@@ -57,7 +53,7 @@
* But only argument types that are compatible with Signal declaration will work.
*/
#define DECLARE_SIGNAL_EMIT(signalName) \
- template<typename ...TArgs> \
+ template<typename... TArgs> \
void emit_##signalName(const TArgs&... args) \
{ \
signalName(args...); \
@@ -74,6 +70,6 @@
/** \brief (implementation detail)
*/
#define emitSignal(...) \
- NDN_CXX_SIGNAL_EMIT(__VA_ARGS__, ::ndn::util::signal::DummyExtraArg())
+ NDN_CXX_SIGNAL_EMIT(__VA_ARGS__, ::ndn::signal::DummyExtraArg())
#endif // NDN_CXX_UTIL_SIGNAL_EMIT_HPP
diff --git a/ndn-cxx/util/signal/scoped-connection.cpp b/ndn-cxx/util/signal/scoped-connection.cpp
index 1a843b1..1aa59d7 100644
--- a/ndn-cxx/util/signal/scoped-connection.cpp
+++ b/ndn-cxx/util/signal/scoped-connection.cpp
@@ -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).
*
@@ -21,9 +21,7 @@
#include "ndn-cxx/util/signal/scoped-connection.hpp"
-namespace ndn {
-namespace util {
-namespace signal {
+namespace ndn::signal {
ScopedConnection::ScopedConnection(Connection connection) noexcept
: m_connection(std::move(connection))
@@ -63,6 +61,4 @@
m_connection = {};
}
-} // namespace signal
-} // namespace util
-} // namespace ndn
+} // namespace ndn::signal
diff --git a/ndn-cxx/util/signal/scoped-connection.hpp b/ndn-cxx/util/signal/scoped-connection.hpp
index 9ecf5e6..3f39e2e 100644
--- a/ndn-cxx/util/signal/scoped-connection.hpp
+++ b/ndn-cxx/util/signal/scoped-connection.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,11 +24,10 @@
#include "ndn-cxx/util/signal/connection.hpp"
-namespace ndn {
-namespace util {
-namespace signal {
+namespace ndn::signal {
-/** \brief Disconnects a Connection automatically upon destruction.
+/**
+ * \brief Disconnects a Connection automatically upon destruction.
*/
class ScopedConnection
{
@@ -95,8 +94,11 @@
inline ScopedConnection&
ScopedConnection::operator=(ScopedConnection&&) noexcept = default;
-} // namespace signal
-} // namespace util
-} // namespace ndn
+} // namespace ndn::signal
+
+namespace ndn::util::signal {
+/// \deprecated Use ndn::signal::ScopedConnection
+using ScopedConnection = ::ndn::signal::ScopedConnection;
+} // namespace ndn::util::signal
#endif // NDN_CXX_UTIL_SIGNAL_SCOPED_CONNECTION_HPP
diff --git a/ndn-cxx/util/signal/signal.hpp b/ndn-cxx/util/signal/signal.hpp
index a097f9c..79c1f27 100644
--- a/ndn-cxx/util/signal/signal.hpp
+++ b/ndn-cxx/util/signal/signal.hpp
@@ -27,9 +27,7 @@
#include <list>
-namespace ndn {
-namespace util {
-namespace signal {
+namespace ndn::signal {
class DummyExtraArg;
@@ -48,19 +46,22 @@
* \tparam TArgs types of signal arguments
* \sa signal-emit.hpp allows owner's derived classes to emit signals
*/
-template<typename Owner, typename ...TArgs>
+template<typename Owner, typename... TArgs>
class Signal : noncopyable
{
public: // API for anyone
+#ifndef BOOST_ASSERT_IS_VOID
+ ~Signal() noexcept
+ {
+ BOOST_ASSERT(!m_isExecuting);
+ }
+#endif
+
/**
* \brief Represents a function that can connect to the signal.
*/
using Handler = std::function<void(const TArgs&...)>;
- Signal();
-
- ~Signal();
-
/** \brief Connects a handler to the signal.
* \note If invoked from a handler, the new handler won't receive the current emitted signal.
* \warning The handler is permitted to disconnect itself, but it must ensure its validity.
@@ -133,7 +134,7 @@
/** \brief Is a signal handler executing?
*/
- bool m_isExecuting;
+ bool m_isExecuting = false;
/** \brief Iterator to current executing slot.
* \note This field is meaningful when isExecuting==true
@@ -146,19 +147,7 @@
disconnect(typename SlotList::iterator it);
};
-template<typename Owner, typename ...TArgs>
-Signal<Owner, TArgs...>::Signal()
- : m_isExecuting(false)
-{
-}
-
-template<typename Owner, typename ...TArgs>
-Signal<Owner, TArgs...>::~Signal()
-{
- BOOST_ASSERT(!m_isExecuting);
-}
-
-template<typename Owner, typename ...TArgs>
+template<typename Owner, typename... TArgs>
Connection
Signal<Owner, TArgs...>::connect(Handler handler)
{
@@ -168,7 +157,7 @@
return signal::Connection(it->disconnect);
}
-template<typename Owner, typename ...TArgs>
+template<typename Owner, typename... TArgs>
Connection
Signal<Owner, TArgs...>::connectSingleShot(Handler handler)
{
@@ -184,7 +173,7 @@
return conn;
}
-template<typename Owner, typename ...TArgs>
+template<typename Owner, typename... TArgs>
void
Signal<Owner, TArgs...>::disconnect(typename SlotList::iterator it)
{
@@ -204,14 +193,14 @@
}
}
-template<typename Owner, typename ...TArgs>
+template<typename Owner, typename... TArgs>
bool
Signal<Owner, TArgs...>::isEmpty() const
{
return !m_isExecuting && m_slots.empty();
}
-template<typename Owner, typename ...TArgs>
+template<typename Owner, typename... TArgs>
void
Signal<Owner, TArgs...>::operator()(const TArgs&... args)
{
@@ -240,19 +229,19 @@
}
}
-template<typename Owner, typename ...TArgs>
+template<typename Owner, typename... TArgs>
void
Signal<Owner, TArgs...>::operator()(const TArgs&... args, const DummyExtraArg&)
{
this->operator()(args...);
}
-} // namespace signal
+} // namespace ndn::signal
-// expose as ndn::util::Signal
-using signal::Signal;
-
-} // namespace util
-} // namespace ndn
+namespace ndn::util {
+/// \deprecated Use ndn::signal::Signal
+template<typename Owner, typename... TArgs>
+using Signal = ::ndn::signal::Signal<Owner, TArgs...>;
+} // namespace ndn::util
#endif // NDN_CXX_UTIL_SIGNAL_SIGNAL_HPP
diff --git a/ndn-cxx/util/sqlite3-statement.cpp b/ndn-cxx/util/sqlite3-statement.cpp
index c7f7354..9b32f4c 100644
--- a/ndn-cxx/util/sqlite3-statement.cpp
+++ b/ndn-cxx/util/sqlite3-statement.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).
*
@@ -23,8 +23,7 @@
#include <sqlite3.h>
-namespace ndn {
-namespace util {
+namespace ndn::util {
Sqlite3Statement::~Sqlite3Statement()
{
@@ -111,5 +110,4 @@
return m_stmt;
}
-} // namespace util
-} // namespace ndn
+} // namespace ndn::util
diff --git a/ndn-cxx/util/sqlite3-statement.hpp b/ndn-cxx/util/sqlite3-statement.hpp
index 4e7427a..c31909a 100644
--- a/ndn-cxx/util/sqlite3-statement.hpp
+++ b/ndn-cxx/util/sqlite3-statement.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,8 +27,7 @@
struct sqlite3;
struct sqlite3_stmt;
-namespace ndn {
-namespace util {
+namespace ndn::util {
/**
* @brief Wrap an SQLite3 prepared statement.
@@ -151,7 +150,6 @@
sqlite3_stmt* m_stmt;
};
-} // namespace util
-} // namespace ndn
+} // namespace ndn::util
#endif // NDN_CXX_UTIL_SQLITE3_STATEMENT_HPP
diff --git a/ndn-cxx/util/time-custom-clock.hpp b/ndn-cxx/util/time-custom-clock.hpp
index 99c5a61..db1e977 100644
--- a/ndn-cxx/util/time-custom-clock.hpp
+++ b/ndn-cxx/util/time-custom-clock.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,8 +24,7 @@
#include "ndn-cxx/util/time.hpp"
-namespace ndn {
-namespace time {
+namespace ndn::time {
/**
* \brief Class implementing custom system or steady clock behavior
@@ -63,7 +62,6 @@
setCustomClocks(shared_ptr<CustomSteadyClock> steadyClock = nullptr,
shared_ptr<CustomSystemClock> systemClock = nullptr);
-} // namespace time
-} // namespace ndn
+} // namespace ndn::time
#endif // NDN_CXX_UTIL_TIME_CUSTOM_CLOCK_HPP
diff --git a/ndn-cxx/util/time-unit-test-clock.cpp b/ndn-cxx/util/time-unit-test-clock.cpp
index dd08f9f..6835499 100644
--- a/ndn-cxx/util/time-unit-test-clock.cpp
+++ b/ndn-cxx/util/time-unit-test-clock.cpp
@@ -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).
*
@@ -25,8 +25,7 @@
#include <chrono>
#include <thread>
-namespace ndn {
-namespace time {
+namespace ndn::time {
template<class BaseClock, class ClockTraits>
UnitTestClock<BaseClock, ClockTraits>::UnitTestClock(nanoseconds startTime)
@@ -97,5 +96,4 @@
template
class UnitTestClock<steady_clock>;
-} // namespace time
-} // namespace ndn
+} // namespace ndn::time
diff --git a/ndn-cxx/util/time-unit-test-clock.hpp b/ndn-cxx/util/time-unit-test-clock.hpp
index b148e63..2302677 100644
--- a/ndn-cxx/util/time-unit-test-clock.hpp
+++ b/ndn-cxx/util/time-unit-test-clock.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,8 +24,7 @@
#include "ndn-cxx/util/time-custom-clock.hpp"
-namespace ndn {
-namespace time {
+namespace ndn::time {
/**
* @brief Traits for UnitTestClock, defining default behavior for different clocks
@@ -108,7 +107,6 @@
using UnitTestSystemClock = UnitTestClock<system_clock>;
using UnitTestSteadyClock = UnitTestClock<steady_clock>;
-} // namespace time
-} // namespace ndn
+} // namespace ndn::time
#endif // NDN_CXX_UTIL_TIME_UNIT_TEST_CLOCK_HPP
diff --git a/ndn-cxx/util/time.cpp b/ndn-cxx/util/time.cpp
index e233ca5..ba9960a 100644
--- a/ndn-cxx/util/time.cpp
+++ b/ndn-cxx/util/time.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).
*
@@ -25,8 +25,7 @@
#include <boost/date_time/posix_time/posix_time.hpp>
#include <sstream>
-namespace ndn {
-namespace time {
+namespace ndn::time {
static shared_ptr<CustomSystemClock> g_systemClock;
static shared_ptr<CustomSteadyClock> g_steadyClock;
@@ -71,9 +70,9 @@
#ifdef __APPLE__
// Note that on macOS platform boost::steady_clock is not truly monotonic, so we use
// system_clock instead. Refer to https://svn.boost.org/trac/boost/ticket/7719)
-typedef boost::chrono::system_clock base_steady_clock;
+using base_steady_clock = boost::chrono::system_clock;
#else
-typedef boost::chrono::steady_clock base_steady_clock;
+using base_steady_clock = boost::chrono::steady_clock;
#endif
steady_clock::time_point
@@ -207,11 +206,9 @@
return convertToTimePoint(ptime);
}
-} // namespace time
-} // namespace ndn
+} // namespace ndn::time
-namespace boost {
-namespace chrono {
+namespace boost::chrono {
template<class CharT>
std::basic_string<CharT>
@@ -242,5 +239,4 @@
template struct clock_string<ndn::time::system_clock, char>;
template struct clock_string<ndn::time::steady_clock, char>;
-} // namespace chrono
-} // namespace boost
+} // namespace boost::chrono
diff --git a/ndn-cxx/util/time.hpp b/ndn-cxx/util/time.hpp
index b4ffd53..be50c4b 100644
--- a/ndn-cxx/util/time.hpp
+++ b/ndn-cxx/util/time.hpp
@@ -33,9 +33,9 @@
namespace time {
template<typename Rep, typename Period>
-using duration = boost::chrono::duration<Rep, Period>;
+using duration = ::boost::chrono::duration<Rep, Period>;
-using boost::chrono::duration_cast;
+using ::boost::chrono::duration_cast;
// C++20
using days = duration<int_fast32_t, boost::ratio<86400>>;
@@ -44,16 +44,17 @@
using years = duration<int_fast32_t, boost::ratio<31556952>>;
// C++11
-using hours = boost::chrono::hours;
-using minutes = boost::chrono::minutes;
-using seconds = boost::chrono::seconds;
-using milliseconds = boost::chrono::milliseconds;
-using microseconds = boost::chrono::microseconds;
-using nanoseconds = boost::chrono::nanoseconds;
+using hours = ::boost::chrono::hours;
+using minutes = ::boost::chrono::minutes;
+using seconds = ::boost::chrono::seconds;
+using milliseconds = ::boost::chrono::milliseconds;
+using microseconds = ::boost::chrono::microseconds;
+using nanoseconds = ::boost::chrono::nanoseconds;
-/** \return The absolute value of the duration \p d.
- * \note The function does not participate in the overload resolution
- * unless std::numeric_limits<Rep>::is_signed is true.
+/**
+ * \brief Returns the absolute value of the duration \p d.
+ * \note This function does not participate in overload resolution
+ * unless \c std::numeric_limits<Rep>::is_signed is true.
*/
template<typename Rep, typename Period, typename = std::enable_if_t<std::numeric_limits<Rep>::is_signed>>
constexpr duration<Rep, Period>
@@ -68,97 +69,97 @@
inline namespace time_literals {
constexpr time::days
-operator "" _day(unsigned long long days)
+operator ""_day(unsigned long long days)
{
return time::days{days};
}
constexpr time::duration<long double, time::days::period>
-operator "" _day(long double days)
+operator ""_day(long double days)
{
return time::duration<long double, time::days::period>{days};
}
constexpr time::days
-operator "" _days(unsigned long long days)
+operator ""_days(unsigned long long days)
{
return time::days{days};
}
constexpr time::duration<long double, time::days::period>
-operator "" _days(long double days)
+operator ""_days(long double days)
{
return time::duration<long double, time::days::period>{days};
}
constexpr time::hours
-operator "" _h(unsigned long long hrs)
+operator ""_h(unsigned long long hrs)
{
return time::hours{hrs};
}
constexpr time::duration<long double, time::hours::period>
-operator "" _h(long double hrs)
+operator ""_h(long double hrs)
{
return time::duration<long double, time::hours::period>{hrs};
}
constexpr time::minutes
-operator "" _min(unsigned long long mins)
+operator ""_min(unsigned long long mins)
{
return time::minutes{mins};
}
constexpr time::duration<long double, time::minutes::period>
-operator "" _min(long double mins)
+operator ""_min(long double mins)
{
return time::duration<long double, time::minutes::period>{mins};
}
constexpr time::seconds
-operator "" _s(unsigned long long secs)
+operator ""_s(unsigned long long secs)
{
return time::seconds{secs};
}
constexpr time::duration<long double, time::seconds::period>
-operator "" _s(long double secs)
+operator ""_s(long double secs)
{
return time::duration<long double, time::seconds::period>{secs};
}
constexpr time::milliseconds
-operator "" _ms(unsigned long long msecs)
+operator ""_ms(unsigned long long msecs)
{
return time::milliseconds{msecs};
}
constexpr time::duration<long double, time::milliseconds::period>
-operator "" _ms(long double msecs)
+operator ""_ms(long double msecs)
{
return time::duration<long double, time::milliseconds::period>{msecs};
}
constexpr time::microseconds
-operator "" _us(unsigned long long usecs)
+operator ""_us(unsigned long long usecs)
{
return time::microseconds{usecs};
}
constexpr time::duration<long double, time::microseconds::period>
-operator "" _us(long double usecs)
+operator ""_us(long double usecs)
{
return time::duration<long double, time::microseconds::period>{usecs};
}
constexpr time::nanoseconds
-operator "" _ns(unsigned long long nsecs)
+operator ""_ns(unsigned long long nsecs)
{
return time::nanoseconds{nsecs};
}
constexpr time::duration<long double, time::nanoseconds::period>
-operator "" _ns(long double nsecs)
+operator ""_ns(long double nsecs)
{
return time::duration<long double, time::nanoseconds::period>{nsecs};
}
@@ -168,10 +169,10 @@
namespace time {
-using namespace literals::time_literals;
+using namespace ::ndn::literals::time_literals;
/**
- * \brief System clock
+ * \brief System clock.
*
* System clock represents the system-wide real time wall clock.
*
@@ -181,28 +182,30 @@
*
* To get the current time:
*
- * <code>
- * const auto now = system_clock::now();
- * </code>
+ * \code
+ * const auto now = ndn::time::system_clock::now();
+ * \endcode
*
* To convert a time_point to/from UNIX timestamp:
*
- * <code>
- * system_clock::time_point time = ...;
- * uint64_t timestampInMilliseconds = toUnixTimestamp(time).count();
- * system_clock::time_point time2 = fromUnixTimestamp(milliseconds(timestampInMilliseconds));
- * </code>
+ * \code
+ * time::system_clock::time_point t1 = ...;
+ * auto timeInMilliseconds = time::toUnixTimestamp(t1).count();
+ * time::system_clock::time_point t2 = time::fromUnixTimestamp(time::milliseconds(timeInMilliseconds));
+ * \endcode
*/
class system_clock
{
public:
- using duration = boost::chrono::system_clock::duration;
+ using duration = ::boost::chrono::system_clock::duration;
using rep = duration::rep;
using period = duration::period;
- using time_point = boost::chrono::time_point<system_clock>;
- static constexpr bool is_steady = boost::chrono::system_clock::is_steady;
+ using time_point = ::boost::chrono::time_point<system_clock>;
+ static constexpr bool is_steady = ::boost::chrono::system_clock::is_steady;
+ /// \deprecated Use time_point
using TimePoint = time_point;
+ /// \deprecated Use duration
using Duration = duration;
static time_point
@@ -216,7 +219,7 @@
};
/**
- * \brief Steady clock
+ * \brief Steady clock.
*
* Steady clock represents a monotonic clock. The time points of this
* clock cannot decrease as physical time moves forward. This clock is
@@ -226,13 +229,15 @@
class steady_clock
{
public:
- using duration = boost::chrono::steady_clock::duration;
+ using duration = ::boost::chrono::steady_clock::duration;
using rep = duration::rep;
using period = duration::period;
- using time_point = boost::chrono::time_point<steady_clock>;
+ using time_point = ::boost::chrono::time_point<steady_clock>;
static constexpr bool is_steady = true;
+ /// \deprecated Use time_point
using TimePoint = time_point;
+ /// \deprecated Use duration
using Duration = duration;
static time_point
@@ -353,8 +358,7 @@
} // namespace time
} // namespace ndn
-namespace boost {
-namespace chrono {
+namespace boost::chrono {
template<typename CharT>
struct clock_string<ndn::time::system_clock, CharT>
@@ -373,7 +377,6 @@
extern template struct clock_string<ndn::time::system_clock, char>;
extern template struct clock_string<ndn::time::steady_clock, char>;
-} // namespace chrono
-} // namespace boost
+} // namespace boost::chrono
#endif // NDN_CXX_UTIL_TIME_HPP
diff --git a/tests/benchmarks/encoding-bench.cpp b/tests/benchmarks/encoding-bench.cpp
index 1adb452..a3e0b5e 100644
--- a/tests/benchmarks/encoding-bench.cpp
+++ b/tests/benchmarks/encoding-bench.cpp
@@ -30,11 +30,7 @@
#include <iostream>
-namespace ndn {
-namespace tlv {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
template<size_t WIRE_SIZE>
struct ReadVarNumberTest;
@@ -112,7 +108,7 @@
uint64_t number = 0;
for (int i = 0; i < N_ITERATIONS; ++i) {
const uint8_t* begin2 = begin; // make a copy because readVarNumber increments the pointer
- nOks += readVarNumber(begin2, end, number);
+ nOks += tlv::readVarNumber(begin2, end, number);
nCorrects += number == Test::VALUE;
// use the number and the return value, so compiler won't optimize out their computation
}
@@ -124,6 +120,4 @@
<< " " << d << std::endl;
}
-} // namespace tests
-} // namespace tlv
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/benchmarks/scheduler-bench.cpp b/tests/benchmarks/scheduler-bench.cpp
index 8897920..46af278 100644
--- a/tests/benchmarks/scheduler-bench.cpp
+++ b/tests/benchmarks/scheduler-bench.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).
*
@@ -28,11 +28,7 @@
#include <boost/asio/io_service.hpp>
#include <iostream>
-namespace ndn {
-namespace scheduler {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
BOOST_AUTO_TEST_CASE(ScheduleCancel)
{
@@ -40,7 +36,7 @@
Scheduler sched(io);
const size_t nEvents = 1000000;
- std::vector<EventId> eventIds(nEvents);
+ std::vector<scheduler::EventId> eventIds(nEvents);
auto d1 = timedExecute([&] {
for (size_t i = 0; i < nEvents; ++i) {
@@ -67,8 +63,8 @@
size_t nExpired = 0;
// Events should expire at t1, but execution finishes at t2. The difference is the overhead.
- time::steady_clock::TimePoint t1 = time::steady_clock::now() + 5_s;
- time::steady_clock::TimePoint t2;
+ time::steady_clock::time_point t1 = time::steady_clock::now() + 5_s;
+ time::steady_clock::time_point t2;
// +1ms ensures this extra event is executed last. In case the overhead is less than 1ms,
// it will be reported as 1ms.
sched.schedule(t1 - time::steady_clock::now() + 1_ms, [&] {
@@ -86,6 +82,4 @@
std::cout << "execute " << nEvents << " events: " << (t2 - t1) << std::endl;
}
-} // namespace tests
-} // namespace scheduler
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/benchmarks/timed-execute.hpp b/tests/benchmarks/timed-execute.hpp
index b33873d..7ce5a82 100644
--- a/tests/benchmarks/timed-execute.hpp
+++ b/tests/benchmarks/timed-execute.hpp
@@ -24,8 +24,7 @@
#include "ndn-cxx/util/time.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
template<typename F>
time::nanoseconds
@@ -37,7 +36,6 @@
return after - before;
}
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_BENCHMARKS_TIMED_EXECUTE_HPP
diff --git a/tests/integration/face.cpp b/tests/integration/face.cpp
index 9357094..7bd2408 100644
--- a/tests/integration/face.cpp
+++ b/tests/integration/face.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,8 +37,7 @@
#include <boost/mpl/vector.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
static Name
makeVeryLongName(Name prefix = Name())
@@ -377,5 +376,4 @@
BOOST_AUTO_TEST_SUITE_END() // IoRoutine
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/integration/network-monitor.cpp b/tests/integration/network-monitor.cpp
index 0e7be10..cf6d8bd 100644
--- a/tests/integration/network-monitor.cpp
+++ b/tests/integration/network-monitor.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).
*
@@ -33,9 +33,9 @@
#include <boost/asio/io_service.hpp>
#include <iostream>
-namespace ndn {
-namespace net {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::net;
static std::ostream&
logEvent(const shared_ptr<const NetworkInterface>& ni = nullptr, std::ostream& os = std::cout)
@@ -66,7 +66,7 @@
monitor.onInterfaceAdded.connect([] (const shared_ptr<const NetworkInterface>& ni) {
logEvent(ni) << "onInterfaceAdded\n" << *ni;
- logEvent(ni) << "link-type: " << detail::getLinkType(ni->getName()) << std::endl;
+ logEvent(ni) << "link-type: " << net::detail::getLinkType(ni->getName()) << std::endl;
ni->onAddressAdded.connect([ni] (const NetworkAddress& address) {
logEvent(ni) << "onAddressAdded " << address << std::endl;
@@ -78,7 +78,7 @@
ni->onStateChanged.connect([ni] (InterfaceState oldState, InterfaceState newState) {
logEvent(ni) << "onStateChanged " << oldState << " -> " << newState << std::endl;
- logEvent(ni) << "link-type: " << detail::getLinkType(ni->getName()) << std::endl;
+ logEvent(ni) << "link-type: " << net::detail::getLinkType(ni->getName()) << std::endl;
});
ni->onMtuChanged.connect([ni] (uint32_t oldMtu, uint32_t newMtu) {
@@ -93,6 +93,4 @@
io.run();
}
-} // namespace tests
-} // namespace net
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/key-chain-fixture.cpp b/tests/key-chain-fixture.cpp
index 7bbcf6a..fefc7cf 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-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,8 +25,7 @@
#include <boost/filesystem/operations.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
using namespace ndn::security;
@@ -91,5 +90,4 @@
return saveIdentityCert(id, filename);
}
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/key-chain-fixture.hpp b/tests/key-chain-fixture.hpp
index ec1cac3..dc3a444 100644
--- a/tests/key-chain-fixture.hpp
+++ b/tests/key-chain-fixture.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,8 +27,7 @@
#include "tests/test-home-fixture.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
/**
* @brief A fixture providing an in-memory KeyChain.
@@ -81,7 +80,6 @@
std::vector<std::string> m_certFiles;
};
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_KEY_CHAIN_FIXTURE_HPP
diff --git a/tests/test-common.cpp b/tests/test-common.cpp
index b0d06ea..e6c726e 100644
--- a/tests/test-common.cpp
+++ b/tests/test-common.cpp
@@ -21,8 +21,7 @@
#include "tests/test-common.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
shared_ptr<Interest>
makeInterest(const Name& name, bool canBePrefix, std::optional<time::milliseconds> lifetime,
@@ -61,5 +60,4 @@
return nack;
}
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/test-common.hpp b/tests/test-common.hpp
index 7b74f35..202fb18 100644
--- a/tests/test-common.hpp
+++ b/tests/test-common.hpp
@@ -27,8 +27,7 @@
#include "ndn-cxx/lp/nack.hpp"
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
/**
* \brief Create an Interest
@@ -74,16 +73,15 @@
* \param index the index of the name component to replace
* \param args arguments to name::Component constructor
*/
-template<typename Packet, typename ...Args>
+template<typename Packet, typename... Args>
void
-setNameComponent(Packet& pkt, ssize_t index, Args&& ...args)
+setNameComponent(Packet& pkt, ssize_t index, Args&&... args)
{
Name name = pkt.getName();
name.set(index, name::Component(std::forward<Args>(args)...));
pkt.setName(name);
}
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_TEST_COMMON_HPP
diff --git a/tests/test-home-fixture.hpp b/tests/test-home-fixture.hpp
index 5778a6e..9801c92 100644
--- a/tests/test-home-fixture.hpp
+++ b/tests/test-home-fixture.hpp
@@ -32,8 +32,7 @@
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
/**
* @brief Fixture to adjust/restore NDN_CLIENT_PIB and NDN_CLIENT_TPM paths
@@ -121,7 +120,6 @@
static constexpr std::string_view PATH{"build/keys"};
};
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_TEST_HOME_FIXTURE_HPP
diff --git a/tests/unit/clock-fixture.cpp b/tests/unit/clock-fixture.cpp
index 3f543ff..0efe19c 100644
--- a/tests/unit/clock-fixture.cpp
+++ b/tests/unit/clock-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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -21,8 +21,7 @@
#include "tests/unit/clock-fixture.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
ClockFixture::ClockFixture()
: m_steadyClock(make_shared<time::UnitTestSteadyClock>())
@@ -52,5 +51,4 @@
}
}
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/clock-fixture.hpp b/tests/unit/clock-fixture.hpp
index 68dabbf..a0309ae 100644
--- a/tests/unit/clock-fixture.hpp
+++ b/tests/unit/clock-fixture.hpp
@@ -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).
*
@@ -24,8 +24,7 @@
#include "ndn-cxx/util/time-unit-test-clock.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
/** \brief A test fixture that overrides steady clock and system clock.
*/
@@ -79,7 +78,6 @@
shared_ptr<time::UnitTestSystemClock> m_systemClock;
};
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_CLOCK_FIXTURE_HPP
diff --git a/tests/unit/data.t.cpp b/tests/unit/data.t.cpp
index 5706a3e..4672a83 100644
--- a/tests/unit/data.t.cpp
+++ b/tests/unit/data.t.cpp
@@ -34,8 +34,7 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Data>));
BOOST_CONCEPT_ASSERT((WireEncodable<Data>));
@@ -668,5 +667,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestData
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/detail/cancel-handle.t.cpp b/tests/unit/detail/cancel-handle.t.cpp
index 2e951dd..e35fe55 100644
--- a/tests/unit/detail/cancel-handle.t.cpp
+++ b/tests/unit/detail/cancel-handle.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,9 +23,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace detail {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::detail::CancelHandle;
BOOST_AUTO_TEST_SUITE(Detail)
BOOST_AUTO_TEST_SUITE(TestCancelHandle)
@@ -55,7 +55,7 @@
BOOST_AUTO_TEST_SUITE(ScopedHandle)
-using ScopedTestHandle = ScopedCancelHandle<CancelHandle>;
+using ScopedTestHandle = detail::ScopedCancelHandle<CancelHandle>;
BOOST_AUTO_TEST_CASE(ManualCancel)
{
@@ -134,6 +134,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestCancelHandle
BOOST_AUTO_TEST_SUITE_END() // Detail
-} // namespace tests
-} // namespace detail
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/detail/packet-base.t.cpp b/tests/unit/detail/packet-base.t.cpp
index 41d47db..32e7e42 100644
--- a/tests/unit/detail/packet-base.t.cpp
+++ b/tests/unit/detail/packet-base.t.cpp
@@ -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).
*
@@ -25,8 +25,7 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Detail)
BOOST_AUTO_TEST_SUITE(TestPacketBase)
@@ -62,5 +61,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestPacketBase
BOOST_AUTO_TEST_SUITE_END() // Detail
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/detail/tag-host.t.cpp b/tests/unit/detail/tag-host.t.cpp
index 72caa7e..c597203 100644
--- a/tests/unit/detail/tag-host.t.cpp
+++ b/tests/unit/detail/tag-host.t.cpp
@@ -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).
*
@@ -27,8 +27,7 @@
#include <boost/mpl/vector.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Detail)
BOOST_AUTO_TEST_SUITE(TestTagHost)
@@ -53,7 +52,7 @@
}
};
-typedef boost::mpl::vector<TagHost, Interest, Data> Fixtures;
+using Fixtures = boost::mpl::vector<TagHost, Interest, Data>;
BOOST_FIXTURE_TEST_CASE_TEMPLATE(Basic, T, Fixtures, T)
{
@@ -84,5 +83,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestTagHost
BOOST_AUTO_TEST_SUITE_END() // Detail
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/dummy-validator.hpp b/tests/unit/dummy-validator.hpp
index 63b7556..903fcea 100644
--- a/tests/unit/dummy-validator.hpp
+++ b/tests/unit/dummy-validator.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).
*
@@ -26,8 +26,7 @@
#include "ndn-cxx/security/validation-policy.hpp"
#include "ndn-cxx/security/certificate-fetcher-offline.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
/**
* \brief A dummy validation policy for unit testing.
@@ -109,7 +108,6 @@
}
};
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_DUMMY_VALIDATOR_HPP
diff --git a/tests/unit/encoding/block-helpers.t.cpp b/tests/unit/encoding/block-helpers.t.cpp
index ed8641e..18fce9a 100644
--- a/tests/unit/encoding/block-helpers.t.cpp
+++ b/tests/unit/encoding/block-helpers.t.cpp
@@ -24,9 +24,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace encoding {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::encoding;
BOOST_AUTO_TEST_SUITE(Encoding)
BOOST_AUTO_TEST_SUITE(TestBlockHelpers)
@@ -181,6 +181,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestBlockHelpers
BOOST_AUTO_TEST_SUITE_END() // Encoding
-} // namespace tests
-} // namespace encoding
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/encoding/block.t.cpp b/tests/unit/encoding/block.t.cpp
index 8dd21d3..c93a307 100644
--- a/tests/unit/encoding/block.t.cpp
+++ b/tests/unit/encoding/block.t.cpp
@@ -31,8 +31,7 @@
#include <cstring>
#include <sstream>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Block>));
@@ -751,5 +750,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestBlock
BOOST_AUTO_TEST_SUITE_END() // Encoding
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/encoding/buffer-stream.t.cpp b/tests/unit/encoding/buffer-stream.t.cpp
index 3f67d50..7442299 100644
--- a/tests/unit/encoding/buffer-stream.t.cpp
+++ b/tests/unit/encoding/buffer-stream.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).
*
@@ -23,8 +23,7 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Encoding)
BOOST_AUTO_TEST_SUITE(TestBufferStream)
@@ -84,5 +83,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestBufferStream
BOOST_AUTO_TEST_SUITE_END() // Encoding
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/encoding/encoder.t.cpp b/tests/unit/encoding/encoder.t.cpp
index 0402f14..5e71e2c 100644
--- a/tests/unit/encoding/encoder.t.cpp
+++ b/tests/unit/encoding/encoder.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).
*
@@ -23,9 +23,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace encoding {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::encoding;
BOOST_AUTO_TEST_SUITE(Encoding)
BOOST_AUTO_TEST_SUITE(TestEncoder)
@@ -155,6 +155,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestEncoder
BOOST_AUTO_TEST_SUITE_END() // Encoding
-} // namespace tests
-} // namespace encoding
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/encoding/encoding-buffer.t.cpp b/tests/unit/encoding/encoding-buffer.t.cpp
index c0997b4..a5fa639 100644
--- a/tests/unit/encoding/encoding-buffer.t.cpp
+++ b/tests/unit/encoding/encoding-buffer.t.cpp
@@ -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).
*
@@ -24,15 +24,7 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace tests {
-
-class BufferEstimatorFixture
-{
-public:
- EncodingBuffer buffer;
- EncodingEstimator estimator;
-};
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Encoding)
BOOST_AUTO_TEST_SUITE(TestEncodingBuffer)
@@ -61,6 +53,13 @@
}
}
+class BufferEstimatorFixture
+{
+public:
+ EncodingBuffer buffer;
+ EncodingEstimator estimator;
+};
+
BOOST_FIXTURE_TEST_SUITE(PrependVarNumber, BufferEstimatorFixture)
BOOST_AUTO_TEST_CASE(OneByte1)
@@ -198,5 +197,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestEncodingBuffer
BOOST_AUTO_TEST_SUITE_END() // Encoding
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/encoding/estimator.t.cpp b/tests/unit/encoding/estimator.t.cpp
index cb86424..12a369b 100644
--- a/tests/unit/encoding/estimator.t.cpp
+++ b/tests/unit/encoding/estimator.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).
*
@@ -23,9 +23,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace encoding {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::encoding;
BOOST_AUTO_TEST_SUITE(Encoding)
BOOST_AUTO_TEST_SUITE(TestEstimator)
@@ -103,6 +103,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestEstimator
BOOST_AUTO_TEST_SUITE_END() // Encoding
-} // namespace tests
-} // namespace encoding
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/encoding/nfd-constants.t.cpp b/tests/unit/encoding/nfd-constants.t.cpp
index e1bc111..6821c44 100644
--- a/tests/unit/encoding/nfd-constants.t.cpp
+++ b/tests/unit/encoding/nfd-constants.t.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).
*
@@ -27,9 +27,9 @@
#include <iomanip>
#include <sstream>
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::nfd;
BOOST_AUTO_TEST_SUITE(Encoding)
BOOST_AUTO_TEST_SUITE(TestNfdConstants)
@@ -142,6 +142,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestNfdConstants
BOOST_AUTO_TEST_SUITE_END() // Encoding
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/encoding/tlv.t.cpp b/tests/unit/encoding/tlv.t.cpp
index 9cd7cc4..e38b5f2 100644
--- a/tests/unit/encoding/tlv.t.cpp
+++ b/tests/unit/encoding/tlv.t.cpp
@@ -34,9 +34,9 @@
#include <boost/iostreams/device/array.hpp>
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace tlv {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::tlv;
BOOST_AUTO_TEST_SUITE(Encoding)
BOOST_AUTO_TEST_SUITE(TestTlv)
@@ -59,9 +59,9 @@
using StreamIterator = std::istream_iterator<uint8_t>;
#define ASSERT_READ_NUMBER_IS_FAST(T) \
- static_assert(detail::IsContiguousIterator<T>, #T " is not fast")
+ static_assert(ndn::tlv::detail::IsContiguousIterator<T>, #T " is not fast")
#define ASSERT_READ_NUMBER_IS_SLOW(T) \
- static_assert(!detail::IsContiguousIterator<T>, #T " is not slow")
+ static_assert(!ndn::tlv::detail::IsContiguousIterator<T>, #T " is not slow")
ASSERT_READ_NUMBER_IS_FAST(const uint8_t*);
ASSERT_READ_NUMBER_IS_FAST(uint8_t*);
@@ -605,6 +605,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestTlv
BOOST_AUTO_TEST_SUITE_END() // Encoding
-} // namespace tests
-} // namespace tlv
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/face.t.cpp b/tests/unit/face.t.cpp
index 9d622ed..c4ae026 100644
--- a/tests/unit/face.t.cpp
+++ b/tests/unit/face.t.cpp
@@ -31,10 +31,7 @@
#include <boost/logic/tribool.hpp>
-namespace ndn {
-namespace tests {
-
-using ndn::util::DummyClientFace;
+namespace ndn::tests {
struct WantPrefixRegReply;
struct NoPrefixRegReply;
@@ -912,7 +909,7 @@
{
};
-typedef boost::mpl::vector<WithEnv, WithConfig> ConfigOptions;
+using ConfigOptions = boost::mpl::vector<WithEnv, WithConfig>;
BOOST_FIXTURE_TEST_CASE(NoConfig, WithEnvAndConfig) // fixture configures test HOME and PIB/TPM path
{
@@ -978,5 +975,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestFace
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/ims/in-memory-storage-fifo.t.cpp b/tests/unit/ims/in-memory-storage-fifo.t.cpp
index bdf86ea..632a566 100644
--- a/tests/unit/ims/in-memory-storage-fifo.t.cpp
+++ b/tests/unit/ims/in-memory-storage-fifo.t.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).
*
@@ -23,10 +23,7 @@
#include "tests/test-common.hpp"
-namespace ndn {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Ims)
BOOST_AUTO_TEST_SUITE(TestInMemoryStorageFifo)
@@ -90,5 +87,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestInMemoryStorageFifo
BOOST_AUTO_TEST_SUITE_END() // Ims
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/ims/in-memory-storage-lfu.t.cpp b/tests/unit/ims/in-memory-storage-lfu.t.cpp
index 17aa9a6..34285dc 100644
--- a/tests/unit/ims/in-memory-storage-lfu.t.cpp
+++ b/tests/unit/ims/in-memory-storage-lfu.t.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).
*
@@ -23,10 +23,7 @@
#include "tests/test-common.hpp"
-namespace ndn {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Ims)
BOOST_AUTO_TEST_SUITE(TestInMemoryStorageLfu)
@@ -130,5 +127,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestInMemoryStorageLfu
BOOST_AUTO_TEST_SUITE_END() // Ims
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/ims/in-memory-storage-lru.t.cpp b/tests/unit/ims/in-memory-storage-lru.t.cpp
index cbf2bab..5a37ca7 100644
--- a/tests/unit/ims/in-memory-storage-lru.t.cpp
+++ b/tests/unit/ims/in-memory-storage-lru.t.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).
*
@@ -23,10 +23,7 @@
#include "tests/test-common.hpp"
-namespace ndn {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Ims)
BOOST_AUTO_TEST_SUITE(TestInMemoryStorageLru)
@@ -132,5 +129,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestInMemoryStorageLru
BOOST_AUTO_TEST_SUITE_END() // Ims
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/ims/in-memory-storage-persistent.t.cpp b/tests/unit/ims/in-memory-storage-persistent.t.cpp
index d0cabf9..33a3afb 100644
--- a/tests/unit/ims/in-memory-storage-persistent.t.cpp
+++ b/tests/unit/ims/in-memory-storage-persistent.t.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).
*
@@ -23,10 +23,7 @@
#include "tests/test-common.hpp"
-namespace ndn {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Ims)
BOOST_AUTO_TEST_SUITE(TestInMemoryStoragePersistent)
@@ -78,5 +75,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestInMemoryStoragePersistent
BOOST_AUTO_TEST_SUITE_END() // Ims
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/ims/in-memory-storage.t.cpp b/tests/unit/ims/in-memory-storage.t.cpp
index 27caa34..ac1c7c2 100644
--- a/tests/unit/ims/in-memory-storage.t.cpp
+++ b/tests/unit/ims/in-memory-storage.t.cpp
@@ -31,10 +31,7 @@
#include <boost/mpl/vector.hpp>
-namespace ndn {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Ims)
BOOST_AUTO_TEST_SUITE(TestInMemoryStorage)
@@ -601,5 +598,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestInMemoryStorage
BOOST_AUTO_TEST_SUITE_END() // Ims
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/interest-filter.t.cpp b/tests/unit/interest-filter.t.cpp
index 12aba0a..f4354e7 100644
--- a/tests/unit/interest-filter.t.cpp
+++ b/tests/unit/interest-filter.t.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).
*
@@ -26,8 +26,7 @@
#include "tests/test-common.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(TestInterestFilter)
@@ -52,7 +51,7 @@
BOOST_AUTO_TEST_CASE(RegexConvertToName)
{
- util::DummyClientFace face;
+ DummyClientFace face;
face.setInterestFilter(InterestFilter("/Hello/World", "<><b><c>?"),
[] (const Name&, const Interest&) { BOOST_ERROR("unexpected Interest"); });
face.processEvents(1_ms);
@@ -69,5 +68,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestInterestFilter
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/interest.t.cpp b/tests/unit/interest.t.cpp
index 73afe60..036dc72 100644
--- a/tests/unit/interest.t.cpp
+++ b/tests/unit/interest.t.cpp
@@ -24,8 +24,7 @@
#include "tests/test-common.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_CONCEPT_ASSERT((WireEncodable<Interest>));
BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Interest>));
@@ -1172,5 +1171,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestInterest
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/io-fixture.hpp b/tests/unit/io-fixture.hpp
index 1c872c4..4934954 100644
--- a/tests/unit/io-fixture.hpp
+++ b/tests/unit/io-fixture.hpp
@@ -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).
*
@@ -26,8 +26,7 @@
#include <boost/asio/io_service.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
class IoFixture : public ClockFixture
{
@@ -49,7 +48,6 @@
boost::asio::io_service m_io;
};
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_IO_FIXTURE_HPP
diff --git a/tests/unit/io-key-chain-fixture.hpp b/tests/unit/io-key-chain-fixture.hpp
index 2df51b1..3ac2edf 100644
--- a/tests/unit/io-key-chain-fixture.hpp
+++ b/tests/unit/io-key-chain-fixture.hpp
@@ -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).
*
@@ -25,14 +25,12 @@
#include "tests/key-chain-fixture.hpp"
#include "tests/unit/io-fixture.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
class IoKeyChainFixture : public IoFixture, public KeyChainFixture
{
};
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_IO_KEY_CHAIN_FIXTURE_HPP
diff --git a/tests/unit/key-locator.t.cpp b/tests/unit/key-locator.t.cpp
index 7a8b636..50daa8c 100644
--- a/tests/unit/key-locator.t.cpp
+++ b/tests/unit/key-locator.t.cpp
@@ -26,8 +26,7 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<KeyLocator>));
BOOST_CONCEPT_ASSERT((WireEncodable<KeyLocator>));
@@ -200,5 +199,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestKeyLocator
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/link.t.cpp b/tests/unit/link.t.cpp
index 106541a..f1bbd07 100644
--- a/tests/unit/link.t.cpp
+++ b/tests/unit/link.t.cpp
@@ -23,8 +23,7 @@
#include "tests/test-common.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Link>));
BOOST_CONCEPT_ASSERT((WireEncodable<Link>));
@@ -175,5 +174,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestLink
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/lp/cache-policy.t.cpp b/tests/unit/lp/cache-policy.t.cpp
index 8b27a6c..08b9d25 100644
--- a/tests/unit/lp/cache-policy.t.cpp
+++ b/tests/unit/lp/cache-policy.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).
*
@@ -25,9 +25,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace lp {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::lp;
BOOST_AUTO_TEST_SUITE(Lp)
BOOST_AUTO_TEST_SUITE(TestCachePolicy)
@@ -92,6 +92,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestCachePolicy
BOOST_AUTO_TEST_SUITE_END() // Lp
-} // namespace tests
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/lp/fields.t.cpp b/tests/unit/lp/fields.t.cpp
index e828051..5028b2b 100644
--- a/tests/unit/lp/fields.t.cpp
+++ b/tests/unit/lp/fields.t.cpp
@@ -21,9 +21,9 @@
#include "ndn-cxx/lp/fields.hpp"
-namespace ndn {
-namespace lp {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::lp;
BOOST_CONCEPT_ASSERT((Field<FragmentField>));
BOOST_CONCEPT_ASSERT((Field<SequenceField>));
@@ -40,6 +40,4 @@
BOOST_CONCEPT_ASSERT((Field<NonDiscoveryField>));
BOOST_CONCEPT_ASSERT((Field<PrefixAnnouncementField>));
-} // namespace tests
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/lp/nack-header.t.cpp b/tests/unit/lp/nack-header.t.cpp
index c914eb0..efe31b0 100644
--- a/tests/unit/lp/nack-header.t.cpp
+++ b/tests/unit/lp/nack-header.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).
*
@@ -25,9 +25,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace lp {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::lp;
BOOST_AUTO_TEST_SUITE(Lp)
BOOST_AUTO_TEST_SUITE(TestNackHeader)
@@ -112,6 +112,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestNackHeader
BOOST_AUTO_TEST_SUITE_END() // Lp
-} // namespace tests
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/lp/nack.t.cpp b/tests/unit/lp/nack.t.cpp
index ef30de1..64835ef 100644
--- a/tests/unit/lp/nack.t.cpp
+++ b/tests/unit/lp/nack.t.cpp
@@ -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).
*
@@ -25,9 +25,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace lp {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::lp;
BOOST_AUTO_TEST_SUITE(Lp)
BOOST_AUTO_TEST_SUITE(TestNack)
@@ -60,6 +60,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestNack
BOOST_AUTO_TEST_SUITE_END() // Lp
-} // namespace tests
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/lp/packet.t.cpp b/tests/unit/lp/packet.t.cpp
index 68f55fc..01cc05b 100644
--- a/tests/unit/lp/packet.t.cpp
+++ b/tests/unit/lp/packet.t.cpp
@@ -25,9 +25,9 @@
#include "tests/key-chain-fixture.hpp"
#include "tests/test-common.hpp"
-namespace ndn {
-namespace lp {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::lp;
BOOST_AUTO_TEST_SUITE(Lp)
BOOST_AUTO_TEST_SUITE(TestPacket)
@@ -425,10 +425,10 @@
BOOST_CHECK_THROW(packet.wireDecode(wire), Packet::Error);
}
-BOOST_FIXTURE_TEST_CASE(DecodePrefixAnnouncement, ndn::tests::KeyChainFixture)
+BOOST_FIXTURE_TEST_CASE(DecodePrefixAnnouncement, KeyChainFixture)
{
// Construct Data which prefix announcement is attached to
- auto data0 = ndn::tests::makeData("/edu/ua/cs/news/index.html");
+ auto data0 = makeData("/edu/ua/cs/news/index.html");
Packet packet0;
packet0.wireDecode(data0->wireEncode());
@@ -455,6 +455,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestPacket
BOOST_AUTO_TEST_SUITE_END() // Lp
-} // namespace tests
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/lp/pit-token.t.cpp b/tests/unit/lp/pit-token.t.cpp
index 49d77c1..6f45b32 100644
--- a/tests/unit/lp/pit-token.t.cpp
+++ b/tests/unit/lp/pit-token.t.cpp
@@ -26,9 +26,9 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace lp {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::lp;
BOOST_AUTO_TEST_SUITE(Lp)
BOOST_AUTO_TEST_SUITE(TestPitToken)
@@ -76,6 +76,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestPitToken
BOOST_AUTO_TEST_SUITE_END() // Lp
-} // namespace tests
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/lp/prefix-announcement-header.t.cpp b/tests/unit/lp/prefix-announcement-header.t.cpp
index a107eb5..ef4b11f 100644
--- a/tests/unit/lp/prefix-announcement-header.t.cpp
+++ b/tests/unit/lp/prefix-announcement-header.t.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).
*
@@ -25,12 +25,12 @@
#include "tests/boost-test.hpp"
#include "tests/key-chain-fixture.hpp"
-namespace ndn {
-namespace lp {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::lp;
BOOST_AUTO_TEST_SUITE(Lp)
-BOOST_FIXTURE_TEST_SUITE(TestPrefixAnnouncementHeader, ndn::tests::KeyChainFixture)
+BOOST_FIXTURE_TEST_SUITE(TestPrefixAnnouncementHeader, KeyChainFixture)
BOOST_AUTO_TEST_CASE(EncodeDecode)
{
@@ -45,7 +45,7 @@
const Data& data = pa.toData(m_keyChain, signingWithSha256(), 1);
Block encodedData = data.wireEncode();
- Block expectedBlock(tlv::PrefixAnnouncement);
+ Block expectedBlock(ndn::lp::tlv::PrefixAnnouncement);
expectedBlock.push_back(encodedData);
expectedBlock.encode();
@@ -64,6 +64,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestPrefixAnnouncementHeader
BOOST_AUTO_TEST_SUITE_END() // Lp
-} // namespace tests
-} // namespace lp
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/meta-info.t.cpp b/tests/unit/meta-info.t.cpp
index f909565..2e37ea5 100644
--- a/tests/unit/meta-info.t.cpp
+++ b/tests/unit/meta-info.t.cpp
@@ -23,8 +23,7 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_CONCEPT_ASSERT((WireEncodable<MetaInfo>));
BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<MetaInfo>));
@@ -161,5 +160,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestMetaInfo
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/metadata-object.t.cpp b/tests/unit/metadata-object.t.cpp
index 3fd5d09..480f7d4 100644
--- a/tests/unit/metadata-object.t.cpp
+++ b/tests/unit/metadata-object.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).
*
@@ -24,8 +24,7 @@
#include "tests/boost-test.hpp"
#include "tests/key-chain-fixture.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
class MetadataObjectFixture : public KeyChainFixture
{
@@ -167,5 +166,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestMetadataObject
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/control-response.t.cpp b/tests/unit/mgmt/control-response.t.cpp
index 1dd69b1..7e72c26 100644
--- a/tests/unit/mgmt/control-response.t.cpp
+++ b/tests/unit/mgmt/control-response.t.cpp
@@ -24,9 +24,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace mgmt {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::mgmt;
BOOST_CONCEPT_ASSERT((WireEncodable<ControlResponse>));
BOOST_CONCEPT_ASSERT((WireDecodable<ControlResponse>));
@@ -62,6 +62,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestControlResponse
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace mgmt
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/dispatcher.t.cpp b/tests/unit/mgmt/dispatcher.t.cpp
index 9b01628..1e1c947 100644
--- a/tests/unit/mgmt/dispatcher.t.cpp
+++ b/tests/unit/mgmt/dispatcher.t.cpp
@@ -26,11 +26,9 @@
#include "tests/test-common.hpp"
#include "tests/unit/io-key-chain-fixture.hpp"
-namespace ndn {
-namespace mgmt {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using namespace ndn::mgmt;
class DispatcherFixture : public IoKeyChainFixture
{
@@ -43,7 +41,7 @@
}
public:
- util::DummyClientFace face;
+ DummyClientFace face;
mgmt::Dispatcher dispatcher;
InMemoryStorageFifo& storage;
};
@@ -473,6 +471,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestDispatcher
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace mgmt
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/nfd/channel-status.t.cpp b/tests/unit/mgmt/nfd/channel-status.t.cpp
index 8036d0d..b9c6455 100644
--- a/tests/unit/mgmt/nfd/channel-status.t.cpp
+++ b/tests/unit/mgmt/nfd/channel-status.t.cpp
@@ -26,9 +26,9 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::nfd;
BOOST_CONCEPT_ASSERT((StatusDatasetItem<ChannelStatus>));
@@ -85,6 +85,4 @@
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/nfd/command-options.t.cpp b/tests/unit/mgmt/nfd/command-options.t.cpp
index d41c512..f7d74b1 100644
--- a/tests/unit/mgmt/nfd/command-options.t.cpp
+++ b/tests/unit/mgmt/nfd/command-options.t.cpp
@@ -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).
*
@@ -24,9 +24,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::nfd;
BOOST_AUTO_TEST_SUITE(Mgmt)
BOOST_AUTO_TEST_SUITE(Nfd)
@@ -74,6 +74,4 @@
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/nfd/control-command.t.cpp b/tests/unit/mgmt/nfd/control-command.t.cpp
index 25371fd..2da5270 100644
--- a/tests/unit/mgmt/nfd/control-command.t.cpp
+++ b/tests/unit/mgmt/nfd/control-command.t.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).
*
@@ -23,9 +23,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::nfd;
BOOST_AUTO_TEST_SUITE(Mgmt)
BOOST_AUTO_TEST_SUITE(Nfd)
@@ -500,6 +500,4 @@
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/nfd/control-parameters.t.cpp b/tests/unit/mgmt/nfd/control-parameters.t.cpp
index 4866620..e89b4f3 100644
--- a/tests/unit/mgmt/nfd/control-parameters.t.cpp
+++ b/tests/unit/mgmt/nfd/control-parameters.t.cpp
@@ -24,9 +24,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::nfd;
BOOST_CONCEPT_ASSERT((WireEncodable<ControlParameters>));
BOOST_CONCEPT_ASSERT((WireDecodable<ControlParameters>));
@@ -248,6 +248,4 @@
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/nfd/controller-fixture.hpp b/tests/unit/mgmt/nfd/controller-fixture.hpp
index 38b44fd..d1cd401 100644
--- a/tests/unit/mgmt/nfd/controller-fixture.hpp
+++ b/tests/unit/mgmt/nfd/controller-fixture.hpp
@@ -28,11 +28,7 @@
#include "tests/unit/dummy-validator.hpp"
#include "tests/unit/io-key-chain-fixture.hpp"
-namespace ndn {
-namespace nfd {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
class ControllerFixture : public IoKeyChainFixture
{
@@ -59,16 +55,14 @@
}
protected:
- ndn::util::DummyClientFace face;
+ DummyClientFace face;
DummyValidator m_validator;
- Controller controller;
- CommandFailureCallback commandFailCallback;
- DatasetFailureCallback datasetFailCallback;
+ nfd::Controller controller;
+ nfd::CommandFailureCallback commandFailCallback;
+ nfd::DatasetFailureCallback datasetFailCallback;
std::vector<uint32_t> failCodes;
};
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_MGMT_NFD_CONTROLLER_FIXTURE_HPP
diff --git a/tests/unit/mgmt/nfd/controller.t.cpp b/tests/unit/mgmt/nfd/controller.t.cpp
index d68611f..6760d5e 100644
--- a/tests/unit/mgmt/nfd/controller.t.cpp
+++ b/tests/unit/mgmt/nfd/controller.t.cpp
@@ -25,11 +25,9 @@
#include "tests/test-common.hpp"
#include "tests/unit/mgmt/nfd/controller-fixture.hpp"
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using namespace ndn::nfd;
BOOST_AUTO_TEST_SUITE(Mgmt)
BOOST_AUTO_TEST_SUITE(Nfd)
@@ -260,6 +258,4 @@
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/nfd/cs-info.t.cpp b/tests/unit/mgmt/nfd/cs-info.t.cpp
index 70d8a20..9e4a437 100644
--- a/tests/unit/mgmt/nfd/cs-info.t.cpp
+++ b/tests/unit/mgmt/nfd/cs-info.t.cpp
@@ -26,9 +26,9 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::nfd;
BOOST_CONCEPT_ASSERT((StatusDatasetItem<CsInfo>));
@@ -126,6 +126,4 @@
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/nfd/face-event-notification.t.cpp b/tests/unit/mgmt/nfd/face-event-notification.t.cpp
index 97b3000..3686b17 100644
--- a/tests/unit/mgmt/nfd/face-event-notification.t.cpp
+++ b/tests/unit/mgmt/nfd/face-event-notification.t.cpp
@@ -26,9 +26,9 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::nfd;
BOOST_CONCEPT_ASSERT((NotificationStreamItem<FaceEventNotification>));
@@ -268,6 +268,4 @@
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/nfd/face-query-filter.t.cpp b/tests/unit/mgmt/nfd/face-query-filter.t.cpp
index 1f83f82..1234259 100644
--- a/tests/unit/mgmt/nfd/face-query-filter.t.cpp
+++ b/tests/unit/mgmt/nfd/face-query-filter.t.cpp
@@ -26,9 +26,9 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::nfd;
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<FaceQueryFilter>));
BOOST_CONCEPT_ASSERT((WireEncodable<FaceQueryFilter>));
@@ -146,6 +146,4 @@
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/nfd/face-status.t.cpp b/tests/unit/mgmt/nfd/face-status.t.cpp
index 275acf2..24be329 100644
--- a/tests/unit/mgmt/nfd/face-status.t.cpp
+++ b/tests/unit/mgmt/nfd/face-status.t.cpp
@@ -26,9 +26,9 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::nfd;
BOOST_CONCEPT_ASSERT((StatusDatasetItem<FaceStatus>));
@@ -178,6 +178,4 @@
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/nfd/fib-entry.t.cpp b/tests/unit/mgmt/nfd/fib-entry.t.cpp
index 81f94e5..d802250 100644
--- a/tests/unit/mgmt/nfd/fib-entry.t.cpp
+++ b/tests/unit/mgmt/nfd/fib-entry.t.cpp
@@ -26,9 +26,9 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::nfd;
BOOST_CONCEPT_ASSERT((StatusDatasetItem<NextHopRecord>));
BOOST_CONCEPT_ASSERT((StatusDatasetItem<FibEntry>));
@@ -212,6 +212,4 @@
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/nfd/forwarder-status.t.cpp b/tests/unit/mgmt/nfd/forwarder-status.t.cpp
index 6492e55..056917d 100644
--- a/tests/unit/mgmt/nfd/forwarder-status.t.cpp
+++ b/tests/unit/mgmt/nfd/forwarder-status.t.cpp
@@ -26,9 +26,9 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::nfd;
BOOST_CONCEPT_ASSERT((StatusDatasetItem<ForwarderStatus>));
@@ -140,6 +140,4 @@
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/nfd/rib-entry.t.cpp b/tests/unit/mgmt/nfd/rib-entry.t.cpp
index 3479c01..ae924bf 100644
--- a/tests/unit/mgmt/nfd/rib-entry.t.cpp
+++ b/tests/unit/mgmt/nfd/rib-entry.t.cpp
@@ -26,9 +26,9 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::nfd;
BOOST_CONCEPT_ASSERT((StatusDatasetItem<Route>));
BOOST_CONCEPT_ASSERT((StatusDatasetItem<RibEntry>));
@@ -240,6 +240,4 @@
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/nfd/status-dataset.t.cpp b/tests/unit/mgmt/nfd/status-dataset.t.cpp
index 511498d..bb6acad 100644
--- a/tests/unit/mgmt/nfd/status-dataset.t.cpp
+++ b/tests/unit/mgmt/nfd/status-dataset.t.cpp
@@ -25,11 +25,9 @@
#include "tests/test-common.hpp"
#include "tests/unit/mgmt/nfd/controller-fixture.hpp"
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using namespace ndn::nfd;
BOOST_AUTO_TEST_SUITE(Mgmt)
BOOST_AUTO_TEST_SUITE(Nfd)
@@ -479,6 +477,4 @@
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/nfd/strategy-choice.t.cpp b/tests/unit/mgmt/nfd/strategy-choice.t.cpp
index 92f271c..63d644b 100644
--- a/tests/unit/mgmt/nfd/strategy-choice.t.cpp
+++ b/tests/unit/mgmt/nfd/strategy-choice.t.cpp
@@ -26,9 +26,9 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::nfd;
BOOST_CONCEPT_ASSERT((StatusDatasetItem<StrategyChoice>));
@@ -95,6 +95,4 @@
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/mgmt/status-dataset-context.t.cpp b/tests/unit/mgmt/status-dataset-context.t.cpp
index 69b2694..f219729 100644
--- a/tests/unit/mgmt/status-dataset-context.t.cpp
+++ b/tests/unit/mgmt/status-dataset-context.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).
*
@@ -23,11 +23,9 @@
#include "tests/test-common.hpp"
-namespace ndn {
-namespace mgmt {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using namespace ndn::mgmt;
class StatusDatasetContextFixture
{
@@ -301,6 +299,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestStatusDatasetContext
BOOST_AUTO_TEST_SUITE_END() // Mgmt
-} // namespace tests
-} // namespace mgmt
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/name-component.t.cpp b/tests/unit/name-component.t.cpp
index a35f980..d72de0f 100644
--- a/tests/unit/name-component.t.cpp
+++ b/tests/unit/name-component.t.cpp
@@ -30,9 +30,10 @@
#include <boost/lexical_cast.hpp>
#include <boost/mpl/vector.hpp>
-namespace ndn {
-namespace name {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::name::Component;
+using ndn::name::UriFormat;
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Component>));
BOOST_CONCEPT_ASSERT((WireEncodable<Component>));
@@ -616,6 +617,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestNameComponent
-} // namespace tests
-} // namespace name
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/name.t.cpp b/tests/unit/name.t.cpp
index 2e107f5..da95aed 100644
--- a/tests/unit/name.t.cpp
+++ b/tests/unit/name.t.cpp
@@ -26,11 +26,9 @@
#include <unordered_map>
#include <boost/range/concepts.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
-using Component = name::Component;
-using UriFormat = name::UriFormat;
+using ndn::name::Component;
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Name>));
BOOST_CONCEPT_ASSERT((WireEncodable<Name>));
@@ -61,7 +59,7 @@
BOOST_CHECK_EQUAL(name[4], Component("\x1C\x9F"));
BOOST_CHECK(name[5].isImplicitSha256Digest());
- BOOST_CHECK_EQUAL(name.toUri(UriFormat::CANONICAL),
+ BOOST_CHECK_EQUAL(name.toUri(name::UriFormat::CANONICAL),
"/8=Emid/25042=P3/8=.../8=..../8=%1C%9F/"
"1=%04%15%E3bJ%15%18P%AChl%84%F1U%F2%98%08%C0%DDs%81%9A%A4%A4%C2%0B%E7%3AM%8A%87L");
@@ -349,7 +347,7 @@
BOOST_TEST(number == 25912);
const auto tp = time::system_clock::now();
- time::system_clock::TimePoint tp2;
+ time::system_clock::time_point tp2;
BOOST_CHECK_NO_THROW(tp2 = name.appendTimestamp(tp).at(-1).toTimestamp());
BOOST_TEST(time::abs(tp2 - tp) <= 1_us);
@@ -561,5 +559,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestName
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/ndebug.t.cpp b/tests/unit/ndebug.t.cpp
index 39dcd8f..4fe1347 100644
--- a/tests/unit/ndebug.t.cpp
+++ b/tests/unit/ndebug.t.cpp
@@ -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).
*
@@ -23,8 +23,7 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(TestNdebug)
@@ -51,5 +50,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestNdebug
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/net/dns.t.cpp b/tests/unit/net/dns.t.cpp
index b6a24b5..ac734dd 100644
--- a/tests/unit/net/dns.t.cpp
+++ b/tests/unit/net/dns.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,10 +26,9 @@
#include <boost/asio/io_service.hpp>
-namespace ndn {
-namespace dns {
-namespace tests {
+namespace ndn::tests {
+using namespace ndn::dns;
using boost::asio::ip::address_v4;
using boost::asio::ip::address_v6;
@@ -169,6 +168,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestDns
BOOST_AUTO_TEST_SUITE_END() // Net
-} // namespace tests
-} // namespace dns
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/net/ethernet.t.cpp b/tests/unit/net/ethernet.t.cpp
index 162170b..0fc5357 100644
--- a/tests/unit/net/ethernet.t.cpp
+++ b/tests/unit/net/ethernet.t.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-2023 Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -29,8 +29,7 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Net)
BOOST_AUTO_TEST_SUITE(TestEthernet)
@@ -113,5 +112,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestEthernet
BOOST_AUTO_TEST_SUITE_END() // Net
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/net/face-uri.t.cpp b/tests/unit/net/face-uri.t.cpp
index d21d70f..34e050e 100644
--- a/tests/unit/net/face-uri.t.cpp
+++ b/tests/unit/net/face-uri.t.cpp
@@ -34,8 +34,7 @@
#include <boost/concept_check.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<FaceUri>));
@@ -614,5 +613,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestFaceUri
BOOST_AUTO_TEST_SUITE_END() // Net
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/net/network-configuration-detector.cpp b/tests/unit/net/network-configuration-detector.cpp
index 84e1244..f8a8816 100644
--- a/tests/unit/net/network-configuration-detector.cpp
+++ b/tests/unit/net/network-configuration-detector.cpp
@@ -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).
*
@@ -27,35 +27,30 @@
#include <boost/asio/ip/udp.hpp>
#include <boost/range/iterator_range_core.hpp>
-namespace ndn {
-namespace tests {
-
-bool NetworkConfigurationDetector::m_isInitialized = false;
-bool NetworkConfigurationDetector::m_hasIpv4 = false;
-bool NetworkConfigurationDetector::m_hasIpv6 = false;
+namespace ndn::tests {
bool
NetworkConfigurationDetector::hasIpv4()
{
- if (!m_isInitialized) {
+ if (!s_isInitialized) {
detect();
}
- return m_hasIpv4;
+ return s_hasIpv4;
}
bool
NetworkConfigurationDetector::hasIpv6()
{
- if (!m_isInitialized) {
+ if (!s_isInitialized) {
detect();
}
- return m_hasIpv6;
+ return s_hasIpv6;
}
void
NetworkConfigurationDetector::detect()
{
- typedef boost::asio::ip::basic_resolver<boost::asio::ip::udp> BoostResolver;
+ using BoostResolver = boost::asio::ip::basic_resolver<boost::asio::ip::udp>;
boost::asio::io_service ioService;
BoostResolver resolver(ioService);
@@ -66,22 +61,21 @@
boost::system::error_code errorCode;
BoostResolver::iterator begin = resolver.resolve(query, errorCode);
if (errorCode) {
- m_isInitialized = true;
+ s_isInitialized = true;
return;
}
BoostResolver::iterator end;
for (const auto& i : boost::make_iterator_range(begin, end)) {
if (i.endpoint().address().is_v4()) {
- m_hasIpv4 = true;
+ s_hasIpv4 = true;
}
else if (i.endpoint().address().is_v6()) {
- m_hasIpv6 = true;
+ s_hasIpv6 = true;
}
}
- m_isInitialized = true;
+ s_isInitialized = true;
}
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/net/network-configuration-detector.hpp b/tests/unit/net/network-configuration-detector.hpp
index 5c0c34b..7264e68 100644
--- a/tests/unit/net/network-configuration-detector.hpp
+++ b/tests/unit/net/network-configuration-detector.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -47,8 +47,7 @@
} \
} while (false)
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
class NetworkConfigurationDetector
{
@@ -64,12 +63,11 @@
detect();
private:
- static bool m_isInitialized;
- static bool m_hasIpv4;
- static bool m_hasIpv6;
+ static inline bool s_isInitialized = false;
+ static inline bool s_hasIpv4 = false;
+ static inline bool s_hasIpv6 = false;
};
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_NET_NETWORK_CONFIGURATION_DETECTOR_HPP
diff --git a/tests/unit/net/network-monitor-stub.t.cpp b/tests/unit/net/network-monitor-stub.t.cpp
index 453a510..0ef8a9d 100644
--- a/tests/unit/net/network-monitor-stub.t.cpp
+++ b/tests/unit/net/network-monitor-stub.t.cpp
@@ -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).
*
@@ -23,9 +23,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace net {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::net;
BOOST_AUTO_TEST_SUITE(Net)
BOOST_AUTO_TEST_SUITE(TestNetworkMonitorStub)
@@ -120,6 +120,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestNetworkMonitorStub
BOOST_AUTO_TEST_SUITE_END() // Net
-} // namespace tests
-} // namespace net
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/net/network-monitor.t.cpp b/tests/unit/net/network-monitor.t.cpp
index 132d0db..4515258 100644
--- a/tests/unit/net/network-monitor.t.cpp
+++ b/tests/unit/net/network-monitor.t.cpp
@@ -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).
*
@@ -25,9 +25,9 @@
#include <boost/asio/io_service.hpp>
-namespace ndn {
-namespace net {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::net;
BOOST_AUTO_TEST_SUITE(Net)
BOOST_AUTO_TEST_SUITE(TestNetworkMonitor)
@@ -69,6 +69,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestNetworkMonitor
BOOST_AUTO_TEST_SUITE_END() // Net
-} // namespace tests
-} // namespace net
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/prefix-announcement.t.cpp b/tests/unit/prefix-announcement.t.cpp
index 9a3eba9..a13e9f5 100644
--- a/tests/unit/prefix-announcement.t.cpp
+++ b/tests/unit/prefix-announcement.t.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).
*
@@ -25,8 +25,7 @@
#include "tests/key-chain-fixture.hpp"
#include "tests/test-common.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(TestPrefixAnnouncement)
@@ -265,5 +264,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestPrefixAnnouncement
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/additional-description.t.cpp b/tests/unit/security/additional-description.t.cpp
index 82dd606..af71ce4 100644
--- a/tests/unit/security/additional-description.t.cpp
+++ b/tests/unit/security/additional-description.t.cpp
@@ -24,9 +24,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::security::AdditionalDescription;
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<AdditionalDescription>));
BOOST_CONCEPT_ASSERT((WireEncodable<AdditionalDescription>));
@@ -99,6 +99,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestAdditionalDescription
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/certificate-bundle-fetcher.t.cpp b/tests/unit/security/certificate-bundle-fetcher.t.cpp
index 0c300b7..1c7b8b8 100644
--- a/tests/unit/security/certificate-bundle-fetcher.t.cpp
+++ b/tests/unit/security/certificate-bundle-fetcher.t.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).
*
@@ -26,12 +26,9 @@
#include "tests/test-common.hpp"
#include "tests/unit/security/validator-fixture.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using namespace ndn::security;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(TestCertificateBundleFetcher)
@@ -45,21 +42,10 @@
}
};
-class BundleWithFinalBlockId
-{
-};
-
-class BundleWithoutFinalBlockId
-{
-};
-
-class Timeout
-{
-};
-
-class Nack
-{
-};
+struct BundleWithFinalBlockId {};
+struct BundleWithoutFinalBlockId {};
+struct Timeout {};
+struct Nack {};
template<class Response>
class CertificateBundleFetcherFixture : public HierarchicalValidatorFixture<ValidationPolicySimpleHierarchy,
@@ -198,7 +184,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestCertificateBundleFetcher
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/certificate-cache.t.cpp b/tests/unit/security/certificate-cache.t.cpp
index 51aa72b..acbdd00 100644
--- a/tests/unit/security/certificate-cache.t.cpp
+++ b/tests/unit/security/certificate-cache.t.cpp
@@ -25,12 +25,7 @@
#include "tests/key-chain-fixture.hpp"
#include "tests/unit/clock-fixture.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
class CertificateCacheFixture : public ClockFixture, public KeyChainFixture
{
@@ -60,7 +55,7 @@
}
public:
- CertificateCache certCache;
+ security::CertificateCache certCache;
Identity identity;
Certificate cert;
};
@@ -104,7 +99,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestCertificateCache
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/certificate-fetcher-direct-fetch.t.cpp b/tests/unit/security/certificate-fetcher-direct-fetch.t.cpp
index 7c9ba90..a843ca6 100644
--- a/tests/unit/security/certificate-fetcher-direct-fetch.t.cpp
+++ b/tests/unit/security/certificate-fetcher-direct-fetch.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).
*
@@ -30,27 +30,16 @@
#include <boost/range/adaptor/sliced.hpp>
#include <boost/range/adaptor/strided.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using namespace ndn::security;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(TestCertificateFetcherDirectFetch)
-class Cert
-{
-};
-
-class Timeout
-{
-};
-
-class Nack
-{
-};
+struct Cert {};
+struct Timeout {};
+struct Nack {};
template<class Response>
class CertificateFetcherDirectFetchFixture : public HierarchicalValidatorFixture<ValidationPolicySimpleHierarchy,
@@ -260,7 +249,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestCertificateFetcherDirectFetch
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/certificate-fetcher-from-network.t.cpp b/tests/unit/security/certificate-fetcher-from-network.t.cpp
index cb3e0b5..7ffc276 100644
--- a/tests/unit/security/certificate-fetcher-from-network.t.cpp
+++ b/tests/unit/security/certificate-fetcher-from-network.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).
*
@@ -27,27 +27,16 @@
#include "tests/boost-test.hpp"
#include "tests/unit/security/validator-fixture.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using namespace ndn::security;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(TestCertificateFetcherFromNetwork)
-class Cert
-{
-};
-
-class Timeout
-{
-};
-
-class Nack
-{
-};
+struct Cert {};
+struct Timeout {};
+struct Nack {};
template<class Response>
class CertificateFetcherFromNetworkFixture : public HierarchicalValidatorFixture<ValidationPolicySimpleHierarchy,
@@ -135,7 +124,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestCertificateFetcherFromNetwork
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/certificate-fetcher-offline.t.cpp b/tests/unit/security/certificate-fetcher-offline.t.cpp
index f48971f..147701f 100644
--- a/tests/unit/security/certificate-fetcher-offline.t.cpp
+++ b/tests/unit/security/certificate-fetcher-offline.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).
*
@@ -25,10 +25,9 @@
#include "tests/boost-test.hpp"
#include "tests/unit/security/validator-fixture.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security;
BOOST_AUTO_TEST_SUITE(Security)
@@ -66,7 +65,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestCertificateFetcherOffline
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/certificate.t.cpp b/tests/unit/security/certificate.t.cpp
index 44ae731..facb261 100644
--- a/tests/unit/security/certificate.t.cpp
+++ b/tests/unit/security/certificate.t.cpp
@@ -30,12 +30,10 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using ndn::security::Certificate;
+using ndn::security::ValidityPeriod;
BOOST_CONCEPT_ASSERT((WireEncodable<Certificate>));
BOOST_CONCEPT_ASSERT((WireDecodable<Certificate>));
@@ -379,6 +377,9 @@
BOOST_AUTO_TEST_CASE(Helpers)
{
+ using ndn::security::extractIdentityFromCertName;
+ using ndn::security::extractKeyNameFromCertName;
+
BOOST_CHECK_EQUAL(extractIdentityFromCertName("/KEY/hello/world/v=1"), "/");
BOOST_CHECK_EQUAL(extractIdentityFromCertName("/hello/world/KEY/!/self/v=42"), "/hello/world");
@@ -399,7 +400,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestCertificate
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/detail/certificate-bundle-decoder.t.cpp b/tests/unit/security/detail/certificate-bundle-decoder.t.cpp
index a9fe998..3cb3eb7 100644
--- a/tests/unit/security/detail/certificate-bundle-decoder.t.cpp
+++ b/tests/unit/security/detail/certificate-bundle-decoder.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).
*
@@ -24,12 +24,9 @@
#include "tests/boost-test.hpp"
#include "tests/key-chain-fixture.hpp"
-namespace ndn {
-namespace security {
-namespace detail {
-namespace tests {
+namespace ndn::tests {
-class CertificateBundleDecoderFixture : public ndn::tests::KeyChainFixture
+class CertificateBundleDecoderFixture : public KeyChainFixture
{
protected:
CertificateBundleDecoderFixture()
@@ -51,7 +48,7 @@
}
protected:
- CertificateBundleDecoder cbd;
+ security::detail::CertificateBundleDecoder cbd;
Block certBlock1;
Block certBlock2;
size_t nCertsCompleted = 0;
@@ -213,7 +210,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestCertificateBundleEncoderDecoder
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace detail
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/interest-signer.t.cpp b/tests/unit/security/interest-signer.t.cpp
index b4a3991..b44546b 100644
--- a/tests/unit/security/interest-signer.t.cpp
+++ b/tests/unit/security/interest-signer.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).
*
@@ -25,11 +25,10 @@
#include "tests/key-chain-fixture.hpp"
#include "tests/unit/clock-fixture.hpp"
-namespace ndn {
-namespace security {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using ndn::security::InterestSigner;
+using ndn::security::SigningInfo;
class InterestSignerFixture : public ClockFixture, public KeyChainFixture
{
@@ -123,6 +122,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestInterestSigner
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/key-chain.t.cpp b/tests/unit/security/key-chain.t.cpp
index be544a4..d0b717f 100644
--- a/tests/unit/security/key-chain.t.cpp
+++ b/tests/unit/security/key-chain.t.cpp
@@ -31,12 +31,9 @@
#include <openssl/opensslv.h>
#include <boost/mpl/vector.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using namespace ndn::security;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_FIXTURE_TEST_SUITE(TestKeyChain, TestHomeEnvSaver)
@@ -800,7 +797,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestKeyChain
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/key-params.t.cpp b/tests/unit/security/key-params.t.cpp
index f051b06..27f098a 100644
--- a/tests/unit/security/key-params.t.cpp
+++ b/tests/unit/security/key-params.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).
*
@@ -25,8 +25,7 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(TestKeyParams)
@@ -162,5 +161,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestKeyParams
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/pib/certificate-container.t.cpp b/tests/unit/security/pib/certificate-container.t.cpp
index b1d4343..ecfd0b9 100644
--- a/tests/unit/security/pib/certificate-container.t.cpp
+++ b/tests/unit/security/pib/certificate-container.t.cpp
@@ -26,15 +26,13 @@
#include "tests/boost-test.hpp"
#include "tests/unit/security/pib/pib-data-fixture.hpp"
-namespace ndn {
-namespace security {
-namespace pib {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::pib;
NDN_CXX_ASSERT_FORWARD_ITERATOR(CertificateContainer::const_iterator);
BOOST_AUTO_TEST_SUITE(Security)
-BOOST_AUTO_TEST_SUITE(Pib)
BOOST_FIXTURE_TEST_SUITE(TestCertificateContainer, PibDataFixture)
BOOST_AUTO_TEST_CASE(AddGetRemove)
@@ -72,7 +70,7 @@
BOOST_CHECK_EQUAL(cert1, id1Key1Cert1);
BOOST_CHECK_EQUAL(cert2, id1Key1Cert2);
Name id1Key1Cert3Name = Name(id1Key1Name).append("issuer").appendVersion(3);
- BOOST_CHECK_THROW(container.get(id1Key1Cert3Name), pib::Pib::Error);
+ BOOST_CHECK_THROW(container.get(id1Key1Cert3Name), Pib::Error);
}
{
@@ -158,10 +156,6 @@
}
BOOST_AUTO_TEST_SUITE_END() // TestCertificateContainer
-BOOST_AUTO_TEST_SUITE_END() // Pib
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/pib/identity-container.t.cpp b/tests/unit/security/pib/identity-container.t.cpp
index ea97da0..81f9ad0 100644
--- a/tests/unit/security/pib/identity-container.t.cpp
+++ b/tests/unit/security/pib/identity-container.t.cpp
@@ -26,15 +26,13 @@
#include "tests/boost-test.hpp"
#include "tests/unit/security/pib/pib-data-fixture.hpp"
-namespace ndn {
-namespace security {
-namespace pib {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::pib;
NDN_CXX_ASSERT_FORWARD_ITERATOR(IdentityContainer::const_iterator);
BOOST_AUTO_TEST_SUITE(Security)
-BOOST_AUTO_TEST_SUITE(Pib)
BOOST_FIXTURE_TEST_SUITE(TestIdentityContainer, PibDataFixture)
BOOST_AUTO_TEST_CASE(AddGetRemove)
@@ -74,7 +72,7 @@
Identity identity2 = container.get(id2);
BOOST_CHECK_EQUAL(identity1.getName(), id1);
BOOST_CHECK_EQUAL(identity2.getName(), id2);
- BOOST_CHECK_THROW(container.get(Name("/non-existing")), pib::Pib::Error);
+ BOOST_CHECK_THROW(container.get(Name("/non-existing")), Pib::Error);
}
{
@@ -150,10 +148,6 @@
}
BOOST_AUTO_TEST_SUITE_END() // TestIdentityContainer
-BOOST_AUTO_TEST_SUITE_END() // Pib
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/pib/identity.t.cpp b/tests/unit/security/pib/identity.t.cpp
index be2d03b..70252d9 100644
--- a/tests/unit/security/pib/identity.t.cpp
+++ b/tests/unit/security/pib/identity.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).
*
@@ -25,13 +25,11 @@
#include "tests/boost-test.hpp"
#include "tests/unit/security/pib/pib-data-fixture.hpp"
-namespace ndn {
-namespace security {
-namespace pib {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::pib;
BOOST_AUTO_TEST_SUITE(Security)
-BOOST_AUTO_TEST_SUITE(Pib)
BOOST_FIXTURE_TEST_SUITE(TestIdentity, PibDataFixture)
BOOST_AUTO_TEST_CASE(ValidityChecking)
@@ -41,7 +39,7 @@
BOOST_TEST(id == Identity());
BOOST_CHECK_THROW(id.getName(), std::domain_error);
- auto impl = std::make_shared<detail::IdentityImpl>(id1, makePibWithIdentity(id1));
+ auto impl = std::make_shared<IdentityImpl>(id1, makePibWithIdentity(id1));
id = Identity(impl);
BOOST_TEST(id);
BOOST_TEST(id != Identity());
@@ -52,12 +50,12 @@
BOOST_CHECK_THROW(id.getName(), std::domain_error);
}
-// pib::Identity is a wrapper of pib::detail::IdentityImpl. Since the functionality
-// of IdentityImpl is already tested in identity-impl.t.cpp, we only test the shared
-// property of pib::Identity in this test case.
+// pib::Identity is a wrapper of pib::IdentityImpl. Since the functionality
+// of IdentityImpl is already tested in identity-impl.t.cpp, we only test
+// the shared property of pib::Identity in this test case.
BOOST_AUTO_TEST_CASE(SharedImpl)
{
- auto impl = std::make_shared<detail::IdentityImpl>(id1, makePibWithIdentity(id1));
+ auto impl = std::make_shared<IdentityImpl>(id1, makePibWithIdentity(id1));
Identity identity1(impl);
Identity identity2(impl);
@@ -66,22 +64,18 @@
BOOST_TEST(Identity() != identity2);
BOOST_TEST(Identity() == Identity());
- BOOST_CHECK_THROW(identity2.getKey(id1Key1Name), pib::Pib::Error);
+ BOOST_CHECK_THROW(identity2.getKey(id1Key1Name), Pib::Error);
identity1.addKey(id1Key1, id1Key1Name);
BOOST_TEST(identity2.getKey(id1Key1Name));
identity2.removeKey(id1Key1Name);
- BOOST_CHECK_THROW(identity1.getKey(id1Key1Name), pib::Pib::Error);
+ BOOST_CHECK_THROW(identity1.getKey(id1Key1Name), Pib::Error);
identity1.setDefaultKey(id1Key1, id1Key1Name);
BOOST_TEST(identity2.getDefaultKey().getName() == id1Key1Name);
}
BOOST_AUTO_TEST_SUITE_END() // TestIdentity
-BOOST_AUTO_TEST_SUITE_END() // Pib
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/pib/impl/identity-impl.t.cpp b/tests/unit/security/pib/impl/identity-impl.t.cpp
index 3f38e0e..6b44993 100644
--- a/tests/unit/security/pib/impl/identity-impl.t.cpp
+++ b/tests/unit/security/pib/impl/identity-impl.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).
*
@@ -24,18 +24,13 @@
#include "tests/boost-test.hpp"
#include "tests/unit/security/pib/pib-data-fixture.hpp"
-namespace ndn {
-namespace security {
-namespace pib {
-namespace detail {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::pib;
BOOST_AUTO_TEST_SUITE(Security)
-BOOST_AUTO_TEST_SUITE(Pib)
-using pib::Pib;
-
-class IdentityImplFixture : public pib::tests::PibDataFixture
+class IdentityImplFixture : public PibDataFixture
{
protected:
const shared_ptr<PibImpl> pibImpl = makePibWithIdentity(id1);
@@ -136,11 +131,6 @@
}
BOOST_AUTO_TEST_SUITE_END() // TestIdentityImpl
-BOOST_AUTO_TEST_SUITE_END() // Pib
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace detail
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/pib/impl/key-impl.t.cpp b/tests/unit/security/pib/impl/key-impl.t.cpp
index 4cb960a..940974b 100644
--- a/tests/unit/security/pib/impl/key-impl.t.cpp
+++ b/tests/unit/security/pib/impl/key-impl.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).
*
@@ -25,18 +25,13 @@
#include "tests/key-chain-fixture.hpp"
#include "tests/unit/security/pib/pib-data-fixture.hpp"
-namespace ndn {
-namespace security {
-namespace pib {
-namespace detail {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::pib;
BOOST_AUTO_TEST_SUITE(Security)
-BOOST_AUTO_TEST_SUITE(Pib)
-using pib::Pib;
-
-class KeyImplFixture : public pib::tests::PibDataFixture
+class KeyImplFixture : public PibDataFixture
{
protected:
const shared_ptr<PibImpl> pibImpl = makePibWithKey(id1Key1Name, id1Key1);
@@ -114,8 +109,7 @@
BOOST_CHECK_THROW(key11.getDefaultCertificate(), Pib::Error);
}
-class ReplaceFixture : public ndn::tests::KeyChainFixture,
- public KeyImplFixture
+class ReplaceFixture : public KeyChainFixture, public KeyImplFixture
{
};
@@ -126,8 +120,8 @@
auto otherCert = id1Key1Cert1;
SignatureInfo info;
- info.setValidityPeriod(ValidityPeriod::makeRelative(-1_s, 10_s));
- m_keyChain.sign(otherCert, SigningInfo().setSignatureInfo(info));
+ info.setValidityPeriod(security::ValidityPeriod::makeRelative(-1_s, 10_s));
+ m_keyChain.sign(otherCert, security::SigningInfo().setSignatureInfo(info));
BOOST_TEST(otherCert.getName() == id1Key1Cert1.getName());
BOOST_TEST(otherCert.getContent() == id1Key1Cert1.getContent());
BOOST_TEST(otherCert != id1Key1Cert1);
@@ -162,11 +156,6 @@
}
BOOST_AUTO_TEST_SUITE_END() // TestKeyImpl
-BOOST_AUTO_TEST_SUITE_END() // Pib
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace detail
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/pib/key-container.t.cpp b/tests/unit/security/pib/key-container.t.cpp
index b126bc2..84a4d3f 100644
--- a/tests/unit/security/pib/key-container.t.cpp
+++ b/tests/unit/security/pib/key-container.t.cpp
@@ -26,15 +26,13 @@
#include "tests/boost-test.hpp"
#include "tests/unit/security/pib/pib-data-fixture.hpp"
-namespace ndn {
-namespace security {
-namespace pib {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::pib;
NDN_CXX_ASSERT_FORWARD_ITERATOR(KeyContainer::const_iterator);
BOOST_AUTO_TEST_SUITE(Security)
-BOOST_AUTO_TEST_SUITE(Pib)
BOOST_FIXTURE_TEST_SUITE(TestKeyContainer, PibDataFixture)
BOOST_AUTO_TEST_CASE(AddGetRemove)
@@ -79,8 +77,8 @@
BOOST_TEST(key1.getPublicKey() == id1Key1, boost::test_tools::per_element());
BOOST_CHECK_EQUAL(key2.getName(), id1Key2Name);
BOOST_TEST(key2.getPublicKey() == id1Key2, boost::test_tools::per_element());
- Name id1Key3Name = constructKeyName(id1, name::Component("non-existing-id"));
- BOOST_CHECK_THROW(container.get(id1Key3Name), pib::Pib::Error);
+ Name id1Key3Name = security::constructKeyName(id1, name::Component("non-existing-id"));
+ BOOST_CHECK_THROW(container.get(id1Key3Name), Pib::Error);
}
{
@@ -167,10 +165,6 @@
}
BOOST_AUTO_TEST_SUITE_END() // TestKeyContainer
-BOOST_AUTO_TEST_SUITE_END() // Pib
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/pib/key.t.cpp b/tests/unit/security/pib/key.t.cpp
index 4d1da0c..5273436 100644
--- a/tests/unit/security/pib/key.t.cpp
+++ b/tests/unit/security/pib/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).
*
@@ -25,13 +25,11 @@
#include "tests/boost-test.hpp"
#include "tests/unit/security/pib/pib-data-fixture.hpp"
-namespace ndn {
-namespace security {
-namespace pib {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::pib;
BOOST_AUTO_TEST_SUITE(Security)
-BOOST_AUTO_TEST_SUITE(Pib)
BOOST_FIXTURE_TEST_SUITE(TestKey, PibDataFixture)
BOOST_AUTO_TEST_CASE(ValidityChecking)
@@ -41,8 +39,7 @@
BOOST_TEST(key == Key());
BOOST_CHECK_THROW(key.getName(), std::domain_error);
- auto impl = std::make_shared<detail::KeyImpl>(id1Key1Name, id1Key1,
- makePibWithKey(id1Key1Name, id1Key1));
+ auto impl = std::make_shared<KeyImpl>(id1Key1Name, id1Key1, makePibWithKey(id1Key1Name, id1Key1));
key = Key(impl);
BOOST_TEST(key);
BOOST_TEST(key != Key());
@@ -53,13 +50,12 @@
BOOST_CHECK_THROW(key.getName(), std::domain_error);
}
-// pib::Key is a wrapper of pib::detail::KeyImpl. Since the functionality of KeyImpl is
-// already tested in key-impl.t.cpp, we only test the shared property of pib::Key in
-// this test case.
+// pib::Key is a wrapper of pib::KeyImpl. Since the functionality of KeyImpl is
+// already tested in key-impl.t.cpp, we only test the shared property of pib::Key
+// in this test case.
BOOST_AUTO_TEST_CASE(SharedImpl)
{
- auto keyImpl = std::make_shared<detail::KeyImpl>(id1Key1Name, id1Key1,
- makePibWithKey(id1Key1Name, id1Key1));
+ auto keyImpl = std::make_shared<KeyImpl>(id1Key1Name, id1Key1, makePibWithKey(id1Key1Name, id1Key1));
Key key1(keyImpl);
Key key2(keyImpl);
@@ -68,12 +64,12 @@
BOOST_TEST(Key() != key2);
BOOST_TEST(Key() == Key());
- BOOST_CHECK_THROW(key2.getCertificate(id1Key1Cert1.getName()), pib::Pib::Error);
+ BOOST_CHECK_THROW(key2.getCertificate(id1Key1Cert1.getName()), Pib::Error);
key1.addCertificate(id1Key1Cert1);
BOOST_TEST(key2.getCertificate(id1Key1Cert1.getName()) == id1Key1Cert1);
key2.removeCertificate(id1Key1Cert1.getName());
- BOOST_CHECK_THROW(key1.getCertificate(id1Key1Cert1.getName()), pib::Pib::Error);
+ BOOST_CHECK_THROW(key1.getCertificate(id1Key1Cert1.getName()), Pib::Error);
key1.setDefaultCertificate(id1Key1Cert1);
BOOST_TEST(key2.getDefaultCertificate() == id1Key1Cert1);
@@ -81,6 +77,10 @@
BOOST_AUTO_TEST_CASE(Helpers)
{
+ using ndn::security::constructKeyName;
+ using ndn::security::isValidKeyName;
+ using ndn::security::extractIdentityFromKeyName;
+
BOOST_CHECK_EQUAL(constructKeyName("/hello", name::Component("world")), "/hello/KEY/world");
BOOST_CHECK_EQUAL(isValidKeyName("/hello"), false);
@@ -98,10 +98,6 @@
}
BOOST_AUTO_TEST_SUITE_END() // TestKey
-BOOST_AUTO_TEST_SUITE_END() // Pib
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/pib/pib-data-fixture.cpp b/tests/unit/security/pib/pib-data-fixture.cpp
index 488d11e..dde1d8b 100644
--- a/tests/unit/security/pib/pib-data-fixture.cpp
+++ b/tests/unit/security/pib/pib-data-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).
*
@@ -30,10 +30,10 @@
// #include <iostream>
-namespace ndn {
-namespace security {
-namespace pib {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security;
+using namespace ndn::security::pib;
// class TestCertDataGenerator
// {
@@ -95,8 +95,8 @@
// }
// private:
-// pib::PibMemory pib;
-// Tpm tpm{"test", "test", make_unique<tpm::BackEndMem>()};
+// PibMemory pib;
+// Tpm tpm{"test:test", make_unique<tpm::BackEndMem>()};
// };
// // The test data can be generated using this test case
@@ -414,7 +414,4 @@
return pib;
}
-} // namespace tests
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/pib/pib-data-fixture.hpp b/tests/unit/security/pib/pib-data-fixture.hpp
index 64c8652..7fcdebb 100644
--- a/tests/unit/security/pib/pib-data-fixture.hpp
+++ b/tests/unit/security/pib/pib-data-fixture.hpp
@@ -25,20 +25,19 @@
#include "ndn-cxx/security/certificate.hpp"
#include "ndn-cxx/security/pib/pib-impl.hpp"
-namespace ndn {
-namespace security {
-namespace pib {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::security::Certificate;
class PibDataFixture
{
public:
PibDataFixture();
- [[nodiscard]] static shared_ptr<PibImpl>
+ [[nodiscard]] static shared_ptr<security::pib::PibImpl>
makePibWithIdentity(const Name& idName);
- [[nodiscard]] static shared_ptr<PibImpl>
+ [[nodiscard]] static shared_ptr<security::pib::PibImpl>
makePibWithKey(const Name& keyName, span<const uint8_t> key);
public:
@@ -65,9 +64,6 @@
Buffer id2Key2;
};
-} // namespace tests
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_SECURITY_PIB_PIB_DATA_FIXTURE_HPP
diff --git a/tests/unit/security/pib/pib-impl.t.cpp b/tests/unit/security/pib/pib-impl.t.cpp
index d88bad6..b26109d 100644
--- a/tests/unit/security/pib/pib-impl.t.cpp
+++ b/tests/unit/security/pib/pib-impl.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).
*
@@ -29,17 +29,13 @@
#include <boost/filesystem.hpp>
#include <boost/mpl/vector.hpp>
-namespace ndn {
-namespace security {
-namespace pib {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::pib;
BOOST_AUTO_TEST_SUITE(Security)
-BOOST_AUTO_TEST_SUITE(Pib)
BOOST_AUTO_TEST_SUITE(TestPibImpl)
-using pib::Pib;
-
class PibMemoryFixture : public PibDataFixture
{
public:
@@ -336,10 +332,6 @@
}
BOOST_AUTO_TEST_SUITE_END() // TestPibImpl
-BOOST_AUTO_TEST_SUITE_END() // Pib
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/pib/pib.t.cpp b/tests/unit/security/pib/pib.t.cpp
index 8d668e5..3a665c3 100644
--- a/tests/unit/security/pib/pib.t.cpp
+++ b/tests/unit/security/pib/pib.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).
*
@@ -25,17 +25,13 @@
#include "tests/boost-test.hpp"
#include "tests/unit/security/pib/pib-data-fixture.hpp"
-namespace ndn {
-namespace security {
-namespace pib {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::pib;
BOOST_AUTO_TEST_SUITE(Security)
-BOOST_AUTO_TEST_SUITE(Pib)
BOOST_FIXTURE_TEST_SUITE(TestPib, PibDataFixture)
-using pib::Pib;
-
BOOST_AUTO_TEST_CASE(TpmLocator)
{
Pib pib("pib-memory:", make_shared<PibMemory>());
@@ -116,10 +112,6 @@
}
BOOST_AUTO_TEST_SUITE_END() // TestPib
-BOOST_AUTO_TEST_SUITE_END() // Pib
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace pib
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/safe-bag.t.cpp b/tests/unit/security/safe-bag.t.cpp
index ade7f69..9f9b00d 100644
--- a/tests/unit/security/safe-bag.t.cpp
+++ b/tests/unit/security/safe-bag.t.cpp
@@ -25,9 +25,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::security::SafeBag;
BOOST_CONCEPT_ASSERT((WireEncodable<SafeBag>));
BOOST_CONCEPT_ASSERT((WireDecodable<SafeBag>));
@@ -162,6 +162,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestSafeBag
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/signing-helpers.t.cpp b/tests/unit/security/signing-helpers.t.cpp
index a515c16..c7065a2 100644
--- a/tests/unit/security/signing-helpers.t.cpp
+++ b/tests/unit/security/signing-helpers.t.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).
*
@@ -23,9 +23,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::security::SigningInfo;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(TestSigningHelpers)
@@ -64,6 +64,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestSigningHelpers
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/signing-info.t.cpp b/tests/unit/security/signing-info.t.cpp
index 87c347f..a1aee15 100644
--- a/tests/unit/security/signing-info.t.cpp
+++ b/tests/unit/security/signing-info.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).
*
@@ -27,9 +27,9 @@
#include <boost/lexical_cast.hpp>
#include <sstream>
-namespace ndn {
-namespace security {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(TestSigningInfo)
@@ -288,6 +288,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestSigningInfo
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/tpm/back-end-wrapper-file.hpp b/tests/unit/security/tpm/back-end-wrapper-file.hpp
index 2da77aa..6d8a663 100644
--- a/tests/unit/security/tpm/back-end-wrapper-file.hpp
+++ b/tests/unit/security/tpm/back-end-wrapper-file.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -26,10 +26,7 @@
#include <boost/filesystem.hpp>
-namespace ndn {
-namespace security {
-namespace tpm {
-namespace tests {
+namespace ndn::tests {
/**
* @brief A wrapper of tpm::BackEndFile for unit test template.
@@ -39,7 +36,7 @@
public:
BackEndWrapperFile()
: m_tmpPath(boost::filesystem::path(UNIT_TESTS_TMPDIR) / "TpmBackEndFile")
- , m_impl(make_unique<BackEndFile>(m_tmpPath.string()))
+ , m_impl(make_unique<security::tpm::BackEndFile>(m_tmpPath.string()))
{
}
@@ -48,7 +45,7 @@
boost::filesystem::remove_all(m_tmpPath);
}
- BackEnd&
+ security::tpm::BackEnd&
getTpm()
{
return *m_impl;
@@ -62,12 +59,9 @@
private:
const boost::filesystem::path m_tmpPath;
- const unique_ptr<BackEnd> m_impl;
+ const unique_ptr<security::tpm::BackEnd> m_impl;
};
-} // namespace tests
-} // namespace tpm
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_SECURITY_TPM_BACK_END_WRAPPER_FILE_HPP
diff --git a/tests/unit/security/tpm/back-end-wrapper-mem.hpp b/tests/unit/security/tpm/back-end-wrapper-mem.hpp
index 8de2b12..20dae82 100644
--- a/tests/unit/security/tpm/back-end-wrapper-mem.hpp
+++ b/tests/unit/security/tpm/back-end-wrapper-mem.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,10 +24,7 @@
#include "ndn-cxx/security/tpm/impl/back-end-mem.hpp"
-namespace ndn {
-namespace security {
-namespace tpm {
-namespace tests {
+namespace ndn::tests {
/**
* @brief A wrapper of tpm::BackEndMem for unit test template.
@@ -36,11 +33,11 @@
{
public:
BackEndWrapperMem()
- : m_impl(make_unique<BackEndMem>())
+ : m_impl(make_unique<security::tpm::BackEndMem>())
{
}
- BackEnd&
+ security::tpm::BackEnd&
getTpm()
{
return *m_impl;
@@ -53,12 +50,9 @@
}
private:
- const unique_ptr<BackEnd> m_impl;
+ const unique_ptr<security::tpm::BackEnd> m_impl;
};
-} // namespace tests
-} // namespace tpm
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_SECURITY_TPM_BACK_END_WRAPPER_MEM_HPP
diff --git a/tests/unit/security/tpm/back-end-wrapper-osx.hpp b/tests/unit/security/tpm/back-end-wrapper-osx.hpp
index c459c47..542c319 100644
--- a/tests/unit/security/tpm/back-end-wrapper-osx.hpp
+++ b/tests/unit/security/tpm/back-end-wrapper-osx.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -27,10 +27,7 @@
#include <cstdlib>
-namespace ndn {
-namespace security {
-namespace tpm {
-namespace tests {
+namespace ndn::tests {
/**
* @brief A wrapper of tpm::BackEndOsx for unit test template.
@@ -52,7 +49,7 @@
else
unsetenv("HOME");
- m_impl = make_unique<BackEndOsx>();
+ m_impl = make_unique<security::tpm::BackEndOsx>();
}
~BackEndWrapperOsx()
@@ -63,7 +60,7 @@
unsetenv("HOME");
}
- BackEnd&
+ security::tpm::BackEnd&
getTpm()
{
return *m_impl;
@@ -77,12 +74,9 @@
private:
std::string m_HOME;
- unique_ptr<BackEnd> m_impl;
+ unique_ptr<security::tpm::BackEnd> m_impl;
};
-} // namespace tests
-} // namespace tpm
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_SECURITY_TPM_BACK_END_WRAPPER_OSX_HPP
diff --git a/tests/unit/security/tpm/back-end.t.cpp b/tests/unit/security/tpm/back-end.t.cpp
index 78f09e3..34d79b4 100644
--- a/tests/unit/security/tpm/back-end.t.cpp
+++ b/tests/unit/security/tpm/back-end.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).
*
@@ -41,16 +41,14 @@
#include <boost/mpl/vector.hpp>
#include <set>
-namespace ndn {
-namespace security {
-namespace tpm {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security;
+using ndn::security::tpm::BackEnd;
+using ndn::security::tpm::KeyHandle;
BOOST_AUTO_TEST_SUITE(Security)
-BOOST_AUTO_TEST_SUITE(Tpm)
-BOOST_AUTO_TEST_SUITE(TestBackEnd)
-
-using tpm::Tpm;
+BOOST_AUTO_TEST_SUITE(TestTpmBackEnd)
using TestBackEnds = boost::mpl::vector<
#if defined(NDN_CXX_HAVE_OSX_FRAMEWORKS) && defined(NDN_CXX_WITH_OSX_KEYCHAIN)
@@ -354,11 +352,7 @@
}
}
-BOOST_AUTO_TEST_SUITE_END() // TestBackEnd
-BOOST_AUTO_TEST_SUITE_END() // Tpm
+BOOST_AUTO_TEST_SUITE_END() // TestTpmBackEnd
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace tpm
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform.t.cpp b/tests/unit/security/transform.t.cpp
deleted file mode 100644
index 901839b..0000000
--- a/tests/unit/security/transform.t.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2013-2019 Regents of the University of California.
- *
- * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
- *
- * ndn-cxx library is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- *
- * You should have received copies of the GNU General Public License and GNU Lesser
- * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- */
-
-#include "ndn-cxx/security/transform.hpp"
-
-#include "tests/boost-test.hpp"
-
-namespace ndn {
-namespace security {
-namespace tests {
-
-BOOST_AUTO_TEST_SUITE(Security)
-BOOST_AUTO_TEST_SUITE(TestTransform)
-
-BOOST_AUTO_TEST_CASE(SymbolVisibility)
-{
- transform::BufferSource* bufferSource = nullptr;
- BOOST_CHECK(bufferSource == nullptr);
-
- transform::StreamSource* streamSource = nullptr;
- BOOST_CHECK(streamSource == nullptr);
-
- transform::StepSource* stepSource = nullptr;
- BOOST_CHECK(stepSource == nullptr);
-
- transform::BoolSink* boolSink = nullptr;
- BOOST_CHECK(boolSink == nullptr);
-
- transform::StreamSink* streamSink = nullptr;
- BOOST_CHECK(streamSink == nullptr);
-
- transform::HexEncode* hexEncode = nullptr;
- BOOST_CHECK(hexEncode == nullptr);
-
- transform::StripSpace* stripSpace = nullptr;
- BOOST_CHECK(stripSpace == nullptr);
-
- transform::HexDecode* hexDecode = nullptr;
- BOOST_CHECK(hexDecode == nullptr);
-
- transform::Base64Encode* base64Encode = nullptr;
- BOOST_CHECK(base64Encode == nullptr);
-
- transform::Base64Decode* base64Decode = nullptr;
- BOOST_CHECK(base64Decode == nullptr);
-
- transform::DigestFilter* digestFilter = nullptr;
- BOOST_CHECK(digestFilter == nullptr);
-
- transform::BlockCipher* blockCipher = nullptr;
- BOOST_CHECK(blockCipher == nullptr);
-
- transform::SignerFilter* signerFilter = nullptr;
- BOOST_CHECK(signerFilter == nullptr);
-
- transform::VerifierFilter* verifierFilter = nullptr;
- BOOST_CHECK(verifierFilter == nullptr);
-}
-
-BOOST_AUTO_TEST_SUITE_END() // TestTransform
-BOOST_AUTO_TEST_SUITE_END() // Security
-
-} // namespace tests
-} // namespace security
-} // namespace ndn
diff --git a/tests/unit/security/transform/base64-decode.t.cpp b/tests/unit/security/transform/base64-decode.t.cpp
index 5d89fe6..f180624 100644
--- a/tests/unit/security/transform/base64-decode.t.cpp
+++ b/tests/unit/security/transform/base64-decode.t.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).
*
@@ -27,10 +27,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -173,7 +172,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/base64-encode.t.cpp b/tests/unit/security/transform/base64-encode.t.cpp
index 7b4aa47..c25ecba 100644
--- a/tests/unit/security/transform/base64-encode.t.cpp
+++ b/tests/unit/security/transform/base64-encode.t.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,10 +28,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -171,7 +170,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/block-cipher.t.cpp b/tests/unit/security/transform/block-cipher.t.cpp
index d8b3c3b..cd857c1 100644
--- a/tests/unit/security/transform/block-cipher.t.cpp
+++ b/tests/unit/security/transform/block-cipher.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).
*
@@ -27,10 +27,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -106,7 +105,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/bool-sink.t.cpp b/tests/unit/security/transform/bool-sink.t.cpp
index a7640c6..be10b13 100644
--- a/tests/unit/security/transform/bool-sink.t.cpp
+++ b/tests/unit/security/transform/bool-sink.t.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).
*
@@ -23,10 +23,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -41,7 +40,7 @@
BOOST_CHECK_EQUAL(sink1.write({in1 + 1, 1}), 1);
sink1.end();
BOOST_CHECK_EQUAL(value1, false);
- BOOST_CHECK_THROW(sink1.write({in1 + 1, 1}), transform::Error);
+ BOOST_CHECK_THROW(sink1.write({in1 + 1, 1}), Error);
const uint8_t in2[] = {0x01, 0x00};
bool value2 = false;
@@ -50,14 +49,11 @@
BOOST_CHECK_EQUAL(sink2.write({in2 + 1, 1}), 1);
sink2.end();
BOOST_CHECK_EQUAL(value2, true);
- BOOST_CHECK_THROW(sink2.write({in2 + 1, 1}), transform::Error);
+ BOOST_CHECK_THROW(sink2.write({in2 + 1, 1}), Error);
}
BOOST_AUTO_TEST_SUITE_END() // TestBoolSink
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/buffer-source.t.cpp b/tests/unit/security/transform/buffer-source.t.cpp
index f957282..aa27644 100644
--- a/tests/unit/security/transform/buffer-source.t.cpp
+++ b/tests/unit/security/transform/buffer-source.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).
*
@@ -24,10 +24,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -91,7 +90,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/digest-filter.t.cpp b/tests/unit/security/transform/digest-filter.t.cpp
index 08f85cf..c414d17 100644
--- a/tests/unit/security/transform/digest-filter.t.cpp
+++ b/tests/unit/security/transform/digest-filter.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).
*
@@ -30,10 +30,9 @@
#include <openssl/evp.h>
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -215,7 +214,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/hex-decode.t.cpp b/tests/unit/security/transform/hex-decode.t.cpp
index 23ca9aa..51a2672 100644
--- a/tests/unit/security/transform/hex-decode.t.cpp
+++ b/tests/unit/security/transform/hex-decode.t.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,10 +28,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -262,11 +261,11 @@
{
const std::string in1 = "0001020304050";
OBufferStream os1;
- BOOST_CHECK_THROW(bufferSource(in1) >> hexDecode() >> streamSink(os1), transform::Error);
+ BOOST_CHECK_THROW(bufferSource(in1) >> hexDecode() >> streamSink(os1), Error);
const std::string in2 = "0001020304xy";
OBufferStream os2;
- BOOST_CHECK_THROW(bufferSource(in2) >> hexDecode() >> streamSink(os2), transform::Error);
+ BOOST_CHECK_THROW(bufferSource(in2) >> hexDecode() >> streamSink(os2), Error);
}
BOOST_AUTO_TEST_CASE(EmptyInput)
@@ -283,7 +282,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/hex-encode.t.cpp b/tests/unit/security/transform/hex-encode.t.cpp
index 8025c37..2a81b6a 100644
--- a/tests/unit/security/transform/hex-encode.t.cpp
+++ b/tests/unit/security/transform/hex-encode.t.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).
*
@@ -27,10 +27,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -176,7 +175,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/private-key.t.cpp b/tests/unit/security/transform/private-key.t.cpp
index 077c2e3..f9a511d 100644
--- a/tests/unit/security/transform/private-key.t.cpp
+++ b/tests/unit/security/transform/private-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).
*
@@ -38,10 +38,9 @@
#include <boost/mpl/vector.hpp>
#include <sstream>
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -716,7 +715,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/public-key.t.cpp b/tests/unit/security/transform/public-key.t.cpp
index 655811c..31970c4 100644
--- a/tests/unit/security/transform/public-key.t.cpp
+++ b/tests/unit/security/transform/public-key.t.cpp
@@ -32,10 +32,9 @@
#include <sstream>
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -151,7 +150,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/signer-filter.t.cpp b/tests/unit/security/transform/signer-filter.t.cpp
index cad6f04..ad3b788 100644
--- a/tests/unit/security/transform/signer-filter.t.cpp
+++ b/tests/unit/security/transform/signer-filter.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).
*
@@ -31,10 +31,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -92,7 +91,7 @@
bufferSource(data) >> signerFilter(DigestAlgorithm::SHA256, sKey) >> streamSink(os2);
auto sig = os2.buf();
- BOOST_TEST(verifySignature({data}, *sig, *pubKey));
+ BOOST_TEST(security::verifySignature({data}, *sig, *pubKey));
}
BOOST_AUTO_TEST_CASE(Ecdsa)
@@ -130,7 +129,7 @@
bufferSource(data) >> signerFilter(DigestAlgorithm::SHA256, sKey) >> streamSink(os2);
auto sig = os2.buf();
- BOOST_TEST(verifySignature({data}, *sig, *pubKey));
+ BOOST_TEST(security::verifySignature({data}, *sig, *pubKey));
}
BOOST_AUTO_TEST_SUITE(Hmac)
@@ -244,7 +243,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/step-source.t.cpp b/tests/unit/security/transform/step-source.t.cpp
index 0179011..c950716 100644
--- a/tests/unit/security/transform/step-source.t.cpp
+++ b/tests/unit/security/transform/step-source.t.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).
*
@@ -26,10 +26,9 @@
#include <sstream>
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -69,7 +68,7 @@
BOOST_CHECK_EQUAL(ss.write({buf + 960, 320}), 320);
ss.end();
- BOOST_CHECK_THROW(ss.write({buf + 960, 320}), transform::Error);
+ BOOST_CHECK_THROW(ss.write({buf + 960, 320}), Error);
BOOST_CHECK_EQUAL(os.str(), input);
}
@@ -87,7 +86,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/stream-sink.t.cpp b/tests/unit/security/transform/stream-sink.t.cpp
index f58bece..b79012d 100644
--- a/tests/unit/security/transform/stream-sink.t.cpp
+++ b/tests/unit/security/transform/stream-sink.t.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).
*
@@ -23,10 +23,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -48,14 +47,11 @@
std::string out = os.str();
BOOST_CHECK_EQUAL_COLLECTIONS(in, in + sizeof(in), out.begin(), out.end());
- BOOST_CHECK_THROW(sink.write({in + 8, 8}), transform::Error);
+ BOOST_CHECK_THROW(sink.write({in + 8, 8}), Error);
}
BOOST_AUTO_TEST_SUITE_END() // TestStreamSink
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/stream-source.t.cpp b/tests/unit/security/transform/stream-source.t.cpp
index 1446bc9..e20ff23 100644
--- a/tests/unit/security/transform/stream-source.t.cpp
+++ b/tests/unit/security/transform/stream-source.t.cpp
@@ -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).
*
@@ -27,10 +27,9 @@
#include <boost/mpl/integral_c.hpp>
#include <boost/mpl/vector.hpp>
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -77,24 +76,21 @@
BOOST_CHECK_EQUAL(os.str(), "");
}
-typedef boost::mpl::vector<
+using BadBits = boost::mpl::vector<
boost::mpl::integral_c<std::ios_base::iostate, std::ios_base::badbit>,
boost::mpl::integral_c<std::ios_base::iostate, std::ios_base::failbit>
-> BadBits;
+>;
BOOST_AUTO_TEST_CASE_TEMPLATE(BadStream, BadBit, BadBits)
{
std::stringstream is;
is.setstate(BadBit::value);
std::stringstream os;
- BOOST_CHECK_THROW(streamSource(is) >> streamSink(os), transform::Error);
+ BOOST_CHECK_THROW(streamSource(is) >> streamSink(os), Error);
}
BOOST_AUTO_TEST_SUITE_END() // TestStreamSource
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/strip-space.t.cpp b/tests/unit/security/transform/strip-space.t.cpp
index cd73270..cbc406d 100644
--- a/tests/unit/security/transform/strip-space.t.cpp
+++ b/tests/unit/security/transform/strip-space.t.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).
*
@@ -27,10 +27,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -72,7 +71,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/verifier-filter.t.cpp b/tests/unit/security/transform/verifier-filter.t.cpp
index ef986b1..e04415c 100644
--- a/tests/unit/security/transform/verifier-filter.t.cpp
+++ b/tests/unit/security/transform/verifier-filter.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).
*
@@ -35,10 +35,9 @@
#include <openssl/opensslv.h>
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -188,7 +187,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/trust-anchor-container.t.cpp b/tests/unit/security/trust-anchor-container.t.cpp
index 09825db..0e76214 100644
--- a/tests/unit/security/trust-anchor-container.t.cpp
+++ b/tests/unit/security/trust-anchor-container.t.cpp
@@ -27,17 +27,12 @@
#include <boost/filesystem/operations.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using namespace ndn::security;
-/**
- * This fixture creates a directory and prepares two certificates.
- * cert1 is written to a file under the directory, while cert2 is not.
- */
+// This fixture creates a directory and prepares two certificates.
+// cert1 is written to a file under the directory, while cert2 is not.
class TrustAnchorContainerFixture : public ClockFixture, public KeyChainFixture
{
public:
@@ -196,7 +191,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestTrustAnchorContainer
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validation-error.t.cpp b/tests/unit/security/validation-error.t.cpp
index c4a1a08..f59d6e7 100644
--- a/tests/unit/security/validation-error.t.cpp
+++ b/tests/unit/security/validation-error.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).
*
@@ -25,10 +25,9 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::security::ValidationError;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(TestValidationError)
@@ -59,7 +58,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestValidationError
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validation-policy-accept-all.t.cpp b/tests/unit/security/validation-policy-accept-all.t.cpp
index cd94cf7..ca86c86 100644
--- a/tests/unit/security/validation-policy-accept-all.t.cpp
+++ b/tests/unit/security/validation-policy-accept-all.t.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).
*
@@ -26,16 +26,11 @@
#include <boost/mpl/vector.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Security)
-class ValidationPolicyAcceptAllFixture : public ValidatorFixture<ValidationPolicyAcceptAll>
+class ValidationPolicyAcceptAllFixture : public ValidatorFixture<security::ValidationPolicyAcceptAll>
{
public:
ValidationPolicyAcceptAllFixture()
@@ -50,7 +45,7 @@
BOOST_FIXTURE_TEST_SUITE(TestValidationPolicyAcceptAll, ValidationPolicyAcceptAllFixture)
-typedef boost::mpl::vector<Interest, Data> Packets;
+using Packets = boost::mpl::vector<Interest, Data>;
BOOST_AUTO_TEST_CASE_TEMPLATE(Validate, Packet, Packets)
{
@@ -71,7 +66,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestValidationPolicyAcceptAll
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validation-policy-command-interest.t.cpp b/tests/unit/security/validation-policy-command-interest.t.cpp
index 971b509..ac690e7 100644
--- a/tests/unit/security/validation-policy-command-interest.t.cpp
+++ b/tests/unit/security/validation-policy-command-interest.t.cpp
@@ -30,12 +30,9 @@
#include <boost/mpl/vector.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using namespace ndn::security;
BOOST_AUTO_TEST_SUITE(Security)
@@ -535,7 +532,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestValidationPolicyCommandInterest
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validation-policy-config.t.cpp b/tests/unit/security/validation-policy-config.t.cpp
index 83c6f52..07b98e9 100644
--- a/tests/unit/security/validation-policy-config.t.cpp
+++ b/tests/unit/security/validation-policy-config.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).
*
@@ -30,14 +30,9 @@
#include "tests/unit/security/validator-config/common.hpp"
#include "tests/unit/security/validator-fixture.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace validator_config {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
-using namespace ndn::security::tests;
+using ndn::security::ValidationPolicyConfig;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(TestValidationPolicyConfig)
@@ -760,6 +755,8 @@
BOOST_FIXTURE_TEST_CASE(OrphanedPolicyLoad, HierarchicalValidatorFixture<ValidationPolicyConfig>) // Bug #4758
{
+ using ndn::security::validator_config::Error;
+
ValidationPolicyConfig policy1;
BOOST_CHECK_THROW(policy1.load("trust-anchor { type any }", "test-config"), Error);
@@ -767,8 +764,7 @@
BOOST_CHECK_THROW(policy1.load("trust-anchor { type any }", "test-config"), Error);
ValidationPolicyConfig policy2;
-
- std::string config = R"CONF(
+ const std::string config = R"CONF(
trust-anchor
{
type dir
@@ -776,7 +772,6 @@
refresh 1h
}
)CONF";
-
// Inserting trust anchor would have triggered a segfault
BOOST_CHECK_THROW(policy2.load(config, "test-config"), Error);
}
@@ -784,8 +779,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestValidationPolicyConfig
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace validator_config
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validation-policy-signed-interest.t.cpp b/tests/unit/security/validation-policy-signed-interest.t.cpp
index 58f502e..ded8825 100644
--- a/tests/unit/security/validation-policy-signed-interest.t.cpp
+++ b/tests/unit/security/validation-policy-signed-interest.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).
*
@@ -30,12 +30,9 @@
#include <boost/mpl/vector.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using namespace ndn::security;
BOOST_AUTO_TEST_SUITE(Security)
@@ -525,7 +522,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestValidationPolicySignedInterest
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validation-policy-simple-hierarchy.t.cpp b/tests/unit/security/validation-policy-simple-hierarchy.t.cpp
index 788a7c9..80fc58a 100644
--- a/tests/unit/security/validation-policy-simple-hierarchy.t.cpp
+++ b/tests/unit/security/validation-policy-simple-hierarchy.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,14 +26,11 @@
#include <boost/mpl/vector.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Security)
BOOST_FIXTURE_TEST_SUITE(TestValidationPolicySimpleHierarchy,
- HierarchicalValidatorFixture<ValidationPolicySimpleHierarchy>)
+ HierarchicalValidatorFixture<security::ValidationPolicySimpleHierarchy>)
using Packets = boost::mpl::vector<InterestV03Pkt, DataPkt>;
@@ -125,7 +122,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestValidationPolicySimpleHierarchy
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validation-policy.t.cpp b/tests/unit/security/validation-policy.t.cpp
index 3d76f62..3ff9fe8 100644
--- a/tests/unit/security/validation-policy.t.cpp
+++ b/tests/unit/security/validation-policy.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).
*
@@ -24,16 +24,15 @@
#include "tests/boost-test.hpp"
#include "tests/key-chain-fixture.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Security)
-BOOST_FIXTURE_TEST_SUITE(TestValidationPolicy, ndn::tests::KeyChainFixture)
+BOOST_FIXTURE_TEST_SUITE(TestValidationPolicy, KeyChainFixture)
BOOST_AUTO_TEST_CASE(ExtractIdentityNameFromKeyLocator)
{
+ using ndn::security::extractIdentityNameFromKeyLocator;
+
auto id = m_keyChain.createIdentity("/random/identity");
auto keyName = id.getDefaultKey().getName();
auto certName = id.getDefaultKey().getDefaultCertificate().getName();
@@ -55,7 +54,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestValidationPolicy
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validator-config.t.cpp b/tests/unit/security/validator-config.t.cpp
index 391879d..7cdfa53 100644
--- a/tests/unit/security/validator-config.t.cpp
+++ b/tests/unit/security/validator-config.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).
*
@@ -29,11 +29,7 @@
#include "tests/key-chain-fixture.hpp"
#include "tests/unit/security/validator-config/common.hpp"
-namespace ndn {
-namespace security {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Security)
BOOST_FIXTURE_TEST_SUITE(TestValidatorConfig, KeyChainFixture)
@@ -42,12 +38,12 @@
BOOST_AUTO_TEST_CASE(Construct)
{
- util::DummyClientFace face;
+ DummyClientFace face;
ValidatorConfig v1(face);
BOOST_CHECK_EQUAL(v1.m_policyConfig.m_isConfigured, false);
- ValidatorConfig v2(make_unique<CertificateFetcherOffline>());
+ ValidatorConfig v2(make_unique<security::CertificateFetcherOffline>());
BOOST_CHECK_EQUAL(v2.m_policyConfig.m_isConfigured, false);
}
@@ -56,7 +52,7 @@
public:
ValidatorConfigFixture()
: path(boost::filesystem::path(UNIT_TESTS_TMPDIR) / "security" / "validator-config")
- , validator(make_unique<CertificateFetcherOffline>())
+ , validator(make_unique<security::CertificateFetcherOffline>())
{
boost::filesystem::create_directories(path);
config = R"CONF(
@@ -118,11 +114,11 @@
BOOST_AUTO_TEST_CASE(FromSection)
{
- validator.load(validator_config::tests::makeSection(config), "config-file-from-section");
+ validator.load(makeSection(config), "config-file-from-section");
BOOST_CHECK_EQUAL(validator.m_policyConfig.m_isConfigured, true);
// should reload policy
- validator.load(validator_config::tests::makeSection(config), "config-file-from-section");
+ validator.load(makeSection(config), "config-file-from-section");
BOOST_CHECK_EQUAL(validator.m_policyConfig.m_isConfigured, true);
}
@@ -133,7 +129,7 @@
{
validator.load(configFile);
- InterestSigner signer(m_keyChain);
+ security::InterestSigner signer(m_keyChain);
auto i = signer.makeCommandInterest("/hello/world/CMD", signingWithSha256());
size_t nValidated = 0, nFailed = 0;
@@ -155,7 +151,7 @@
{
validator.load(configFile);
- InterestSigner signer(m_keyChain);
+ security::InterestSigner signer(m_keyChain);
Interest i1("/hello/world");
signer.makeSignedInterest(i1);
size_t nValidated = 0, nFailed = 0;
@@ -179,7 +175,7 @@
{
validator.load(configFile);
- InterestSigner signer(m_keyChain);
+ security::InterestSigner signer(m_keyChain);
auto i1 = signer.makeCommandInterest("/hello/world");
size_t nValidated = 0, nFailed = 0;
@@ -200,6 +196,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestValidatorConfig
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validator-config/checker.t.cpp b/tests/unit/security/validator-config/checker.t.cpp
index 1170156..6c61085 100644
--- a/tests/unit/security/validator-config/checker.t.cpp
+++ b/tests/unit/security/validator-config/checker.t.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).
*
@@ -27,14 +27,9 @@
#include "tests/unit/security/validator-fixture.hpp"
#include "tests/unit/security/validator-config/common.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace validator_config {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
-using namespace ndn::security::tests;
+using namespace ndn::security::validator_config;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(ValidatorConfig)
@@ -343,8 +338,4 @@
BOOST_AUTO_TEST_SUITE_END() // ValidatorConfig
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace validator_config
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validator-config/common.hpp b/tests/unit/security/validator-config/common.hpp
index c4a4fe3..c984cf5 100644
--- a/tests/unit/security/validator-config/common.hpp
+++ b/tests/unit/security/validator-config/common.hpp
@@ -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).
*
@@ -26,11 +26,9 @@
#include <boost/property_tree/info_parser.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace validator_config {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::security::validator_config::ConfigSection;
inline ConfigSection
makeSection(const std::string& config)
@@ -41,10 +39,6 @@
return section;
}
-} // namespace tests
-} // namespace validator_config
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_SECURITY_VALIDATOR_CONFIG_COMMON_HPP
diff --git a/tests/unit/security/validator-config/filter.t.cpp b/tests/unit/security/validator-config/filter.t.cpp
index 42eeceb..a83217b 100644
--- a/tests/unit/security/validator-config/filter.t.cpp
+++ b/tests/unit/security/validator-config/filter.t.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).
*
@@ -25,14 +25,9 @@
#include "tests/unit/security/validator-config/common.hpp"
#include "tests/unit/security/validator-fixture.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace validator_config {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
-using namespace ndn::security::tests;
+using namespace ndn::security::validator_config;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(ValidatorConfig)
@@ -198,8 +193,4 @@
BOOST_AUTO_TEST_SUITE_END() // ValidatorConfig
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace validator_config
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validator-config/name-relation.t.cpp b/tests/unit/security/validator-config/name-relation.t.cpp
index 8879212..c81a092 100644
--- a/tests/unit/security/validator-config/name-relation.t.cpp
+++ b/tests/unit/security/validator-config/name-relation.t.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).
*
@@ -25,11 +25,9 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace validator_config {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::validator_config;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(ValidatorConfig)
@@ -49,7 +47,7 @@
BOOST_CHECK_EQUAL(getNameRelationFromString("equal"), NameRelation::EQUAL);
BOOST_CHECK_EQUAL(getNameRelationFromString("is-prefix-of"), NameRelation::IS_PREFIX_OF);
BOOST_CHECK_EQUAL(getNameRelationFromString("is-strict-prefix-of"), NameRelation::IS_STRICT_PREFIX_OF);
- BOOST_CHECK_THROW(getNameRelationFromString("unknown"), validator_config::Error);
+ BOOST_CHECK_THROW(getNameRelationFromString("unknown"), Error);
}
BOOST_AUTO_TEST_CASE(CheckRelation)
@@ -70,8 +68,4 @@
BOOST_AUTO_TEST_SUITE_END() // ValidatorConfig
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace validator_config
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validator-config/rule.t.cpp b/tests/unit/security/validator-config/rule.t.cpp
index 4871521..ea0b4b7 100644
--- a/tests/unit/security/validator-config/rule.t.cpp
+++ b/tests/unit/security/validator-config/rule.t.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).
*
@@ -27,14 +27,9 @@
#include <boost/mpl/vector_c.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace validator_config {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
-using namespace ndn::security::tests;
+using namespace ndn::security::validator_config;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(ValidatorConfig)
@@ -54,7 +49,7 @@
const std::string ruleId = "rule-id";
Rule rule;
Name pktName;
- shared_ptr<ValidationState> state;
+ shared_ptr<security::ValidationState> state;
};
using PktTypes = boost::mpl::vector<DataPkt, InterestV02Pkt, InterestV03Pkt>;
@@ -211,8 +206,4 @@
BOOST_AUTO_TEST_SUITE_END() // ValidatorConfig
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace validator_config
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validator-fixture.cpp b/tests/unit/security/validator-fixture.cpp
index 0e780b4..41497bf 100644
--- a/tests/unit/security/validator-fixture.cpp
+++ b/tests/unit/security/validator-fixture.cpp
@@ -22,11 +22,11 @@
#include "tests/unit/security/validator-fixture.hpp"
#include "ndn-cxx/security/additional-description.hpp"
+#include "ndn-cxx/util/signal/scoped-connection.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security;
ValidatorFixtureBase::ValidatorFixtureBase()
{
@@ -45,7 +45,7 @@
void
ValidatorFixtureBase::mockNetworkOperations()
{
- util::signal::ScopedConnection conn = face.onSendInterest.connect([this] (const Interest& interest) {
+ signal::ScopedConnection conn = face.onSendInterest.connect([this] (const Interest& interest) {
if (processInterest) {
m_io.post([=] { processInterest(interest); });
}
@@ -102,7 +102,4 @@
return interest.getName();
}
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validator-fixture.hpp b/tests/unit/security/validator-fixture.hpp
index 39e4ed3..6d69a1e 100644
--- a/tests/unit/security/validator-fixture.hpp
+++ b/tests/unit/security/validator-fixture.hpp
@@ -31,12 +31,13 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
-class ValidatorFixtureBase : public ndn::tests::IoKeyChainFixture
+using ndn::security::Certificate;
+using ndn::security::Identity;
+using ndn::security::ValidationError;
+
+class ValidatorFixtureBase : public IoKeyChainFixture
{
protected:
ValidatorFixtureBase();
@@ -63,9 +64,9 @@
addSubCertificate(const Name& subIdentityName, const Identity& issuer);
protected:
- util::DummyClientFace face{m_io, {true, true}};
+ DummyClientFace face{m_io, {true, true}};
std::function<void(const Interest&)> processInterest;
- CertificateCache cache{100_days};
+ security::CertificateCache cache{100_days};
ValidationError lastError{ValidationError::NO_ERROR};
private:
@@ -73,7 +74,7 @@
static constexpr int s_mockTimes{200};
};
-template<class ValidationPolicyT, class CertificateFetcherT = CertificateFetcherFromNetwork>
+template<class ValidationPolicyT, class CertificateFetcherT = security::CertificateFetcherFromNetwork>
class ValidatorFixture : public ValidatorFixtureBase
{
protected:
@@ -109,11 +110,11 @@
}
protected:
- Validator validator;
+ security::Validator validator;
ValidationPolicyT& policy;
};
-template<class ValidationPolicyT, class CertificateFetcherT = CertificateFetcherFromNetwork>
+template<class ValidationPolicyT, class CertificateFetcherT = security::CertificateFetcherFromNetwork>
class HierarchicalValidatorFixture : public ValidatorFixture<ValidationPolicyT, CertificateFetcherT>
{
protected:
@@ -142,7 +143,7 @@
#define VALIDATE_SUCCESS(packet, message) this->validate(packet, message, true, __LINE__)
#define VALIDATE_FAILURE(packet, message) this->validate(packet, message, false, __LINE__)
-class DummyValidationState : public ValidationState
+class DummyValidationState : public security::ValidationState
{
public:
~DummyValidationState() override
@@ -190,7 +191,7 @@
return Data(name);
}
- static shared_ptr<ValidationState>
+ static shared_ptr<security::ValidationState>
makeState()
{
return make_shared<DummyValidationState>();
@@ -214,11 +215,11 @@
return Interest(name);
}
- static shared_ptr<ValidationState>
+ static shared_ptr<security::ValidationState>
makeState()
{
auto state = make_shared<DummyValidationState>();
- state->setTag(make_shared<SignedInterestFormatTag>(SignedInterestFormat::V02));
+ state->setTag(make_shared<security::SignedInterestFormatTag>(security::SignedInterestFormat::V02));
return state;
}
};
@@ -240,18 +241,15 @@
return Interest(name);
}
- static shared_ptr<ValidationState>
+ static shared_ptr<security::ValidationState>
makeState()
{
auto state = make_shared<DummyValidationState>();
- state->setTag(make_shared<SignedInterestFormatTag>(SignedInterestFormat::V03));
+ state->setTag(make_shared<security::SignedInterestFormatTag>(security::SignedInterestFormat::V03));
return state;
}
};
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_SECURITY_VALIDATOR_FIXTURE_HPP
diff --git a/tests/unit/security/validator-null.t.cpp b/tests/unit/security/validator-null.t.cpp
index 5ad9be5..ebae900 100644
--- a/tests/unit/security/validator-null.t.cpp
+++ b/tests/unit/security/validator-null.t.cpp
@@ -24,12 +24,12 @@
#include "tests/boost-test.hpp"
#include "tests/key-chain-fixture.hpp"
-namespace ndn {
-namespace security {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::security::ValidatorNull;
BOOST_AUTO_TEST_SUITE(Security)
-BOOST_FIXTURE_TEST_SUITE(TestValidatorNull, ndn::tests::KeyChainFixture)
+BOOST_FIXTURE_TEST_SUITE(TestValidatorNull, KeyChainFixture)
BOOST_AUTO_TEST_CASE(ValidateData)
{
@@ -58,6 +58,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestValidatorNull
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validator.t.cpp b/tests/unit/security/validator.t.cpp
index d1b746b..c56db6a 100644
--- a/tests/unit/security/validator.t.cpp
+++ b/tests/unit/security/validator.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).
*
@@ -25,12 +25,9 @@
#include "tests/test-common.hpp"
#include "tests/unit/security/validator-fixture.hpp"
-namespace ndn {
-namespace security {
-inline namespace v2 {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using namespace ndn::security;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_FIXTURE_TEST_SUITE(TestValidator, HierarchicalValidatorFixture<ValidationPolicySimpleHierarchy>)
@@ -378,7 +375,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestValidator
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // inline namespace v2
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/validity-period.t.cpp b/tests/unit/security/validity-period.t.cpp
index dbcd47f..1fbd6b1 100644
--- a/tests/unit/security/validity-period.t.cpp
+++ b/tests/unit/security/validity-period.t.cpp
@@ -27,11 +27,9 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace security {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using ndn::security::ValidityPeriod;
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<ValidityPeriod>));
BOOST_CONCEPT_ASSERT((WireEncodable<ValidityPeriod>));
@@ -121,8 +119,8 @@
BOOST_AUTO_TEST_CASE(EncodingDecoding)
{
- time::system_clock::TimePoint notBefore = time::getUnixEpoch();
- time::system_clock::TimePoint notAfter = notBefore + 1_day;
+ time::system_clock::time_point notBefore = time::getUnixEpoch();
+ time::system_clock::time_point notAfter = notBefore + 1_day;
ValidityPeriod v1(notBefore, notAfter);
BOOST_CHECK_EQUAL_COLLECTIONS(v1.wireEncode().begin(), v1.wireEncode().end(),
VP1, VP1 + sizeof(VP1));
@@ -206,9 +204,9 @@
BOOST_AUTO_TEST_CASE(Comparison)
{
- time::system_clock::TimePoint notBefore = time::getUnixEpoch();
- time::system_clock::TimePoint notAfter = notBefore + 1_day;
- time::system_clock::TimePoint notAfter2 = notBefore + 2_days;
+ auto notBefore = time::getUnixEpoch();
+ auto notAfter = notBefore + 1_day;
+ auto notAfter2 = notBefore + 2_days;
ValidityPeriod validity1(notBefore, notAfter);
ValidityPeriod validity2(notBefore, notAfter);
@@ -221,6 +219,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestValidityPeriod
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/verification-helpers.t.cpp b/tests/unit/security/verification-helpers.t.cpp
index 83d37da..868333d 100644
--- a/tests/unit/security/verification-helpers.t.cpp
+++ b/tests/unit/security/verification-helpers.t.cpp
@@ -29,11 +29,9 @@
#include <openssl/opensslv.h>
#include <boost/mpl/vector.hpp>
-namespace ndn {
-namespace security {
-namespace tests {
+namespace ndn::tests {
-using namespace ndn::tests;
+using namespace ndn::security;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(TestVerificationHelpers)
@@ -680,6 +678,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestVerificationHelpers
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/signature-info.t.cpp b/tests/unit/signature-info.t.cpp
index d538217..8fc459c 100644
--- a/tests/unit/signature-info.t.cpp
+++ b/tests/unit/signature-info.t.cpp
@@ -25,8 +25,7 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<SignatureInfo>));
BOOST_CONCEPT_ASSERT((WireEncodable<SignatureInfo>));
@@ -550,5 +549,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestSignatureInfo
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/tag.t.cpp b/tests/unit/tag.t.cpp
index 0cbae22..9b4f1a6 100644
--- a/tests/unit/tag.t.cpp
+++ b/tests/unit/tag.t.cpp
@@ -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).
*
@@ -23,14 +23,13 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(TestTag)
BOOST_AUTO_TEST_CASE(SimpleTag)
{
- typedef ndn::SimpleTag<int, 3> MyTag;
+ using MyTag = ndn::SimpleTag<int, 3>;
BOOST_CHECK_EQUAL(MyTag::getTypeId(), 3);
MyTag tag(23361); // explicitly convertible from value type
@@ -41,5 +40,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestTag
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/test-home-env-saver.hpp b/tests/unit/test-home-env-saver.hpp
index 9a04605..db1c2f2 100644
--- a/tests/unit/test-home-env-saver.hpp
+++ b/tests/unit/test-home-env-saver.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,8 +25,7 @@
#include <cstdlib>
#include <string>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
class TestHomeEnvSaver
{
@@ -50,7 +49,6 @@
std::string m_HOME;
};
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_TEST_HOME_ENV_SAVER_HPP
diff --git a/tests/unit/transport/tcp-transport.t.cpp b/tests/unit/transport/tcp-transport.t.cpp
index cb577cc..5d86baa 100644
--- a/tests/unit/transport/tcp-transport.t.cpp
+++ b/tests/unit/transport/tcp-transport.t.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).
*
@@ -23,8 +23,7 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Transport)
BOOST_AUTO_TEST_SUITE(TestTcpTransport)
@@ -85,5 +84,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestTcpTransport
BOOST_AUTO_TEST_SUITE_END() // Transport
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/transport/unix-transport.t.cpp b/tests/unit/transport/unix-transport.t.cpp
index a8946f4..f7c54d6 100644
--- a/tests/unit/transport/unix-transport.t.cpp
+++ b/tests/unit/transport/unix-transport.t.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).
*
@@ -23,8 +23,7 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Transport)
BOOST_AUTO_TEST_SUITE(TestUnixTransport)
@@ -54,5 +53,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestUnixTransport
BOOST_AUTO_TEST_SUITE_END() // Transport
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/concepts.t.cpp b/tests/unit/util/concepts.t.cpp
index 997f86a..74feee7 100644
--- a/tests/unit/util/concepts.t.cpp
+++ b/tests/unit/util/concepts.t.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-2023 Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -27,8 +27,7 @@
#include "ndn-cxx/util/concepts.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
class WireEncodableType
{
@@ -57,5 +56,4 @@
};
BOOST_CONCEPT_ASSERT((WireDecodable<WireDecodableType>));
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/config-file.t.cpp b/tests/unit/util/config-file.t.cpp
index 9e098c1..ab8f212 100644
--- a/tests/unit/util/config-file.t.cpp
+++ b/tests/unit/util/config-file.t.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).
*
@@ -27,8 +27,7 @@
#include <boost/filesystem/operations.hpp>
#include <cstdlib>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Util)
BOOST_FIXTURE_TEST_SUITE(TestConfigFile, TestHomeEnvSaver)
@@ -67,5 +66,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestConfigFile
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/dummy-client-face.t.cpp b/tests/unit/util/dummy-client-face.t.cpp
index ad0c3bf..0eea2e6 100644
--- a/tests/unit/util/dummy-client-face.t.cpp
+++ b/tests/unit/util/dummy-client-face.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).
*
@@ -25,11 +25,7 @@
#include "tests/test-common.hpp"
#include "tests/unit/io-key-chain-fixture.hpp"
-namespace ndn {
-namespace util {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Util)
BOOST_FIXTURE_TEST_SUITE(TestDummyClientFace, IoKeyChainFixture)
@@ -107,13 +103,13 @@
[&] (const InterestFilter&, const Interest& interest) {
BOOST_CHECK_EQUAL(interest.getName(), "/face1/data");
nFace1Interest++;
- face1.put(ndn::tests::makeNack(interest, lp::NackReason::NO_ROUTE));
+ face1.put(makeNack(interest, lp::NackReason::NO_ROUTE));
}, nullptr, nullptr);
face2.setInterestFilter("/face2",
[&] (const InterestFilter&, const Interest& interest) {
BOOST_CHECK_EQUAL(interest.getName(), "/face2/data");
nFace2Interest++;
- face2.put(*ndn::tests::makeData("/face2/data"));
+ face2.put(*makeData("/face2/data"));
return;
}, nullptr, nullptr);
@@ -175,6 +171,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestDummyClientFace
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/exception.t.cpp b/tests/unit/util/exception.t.cpp
index 49ac2ab..d8184c5 100644
--- a/tests/unit/util/exception.t.cpp
+++ b/tests/unit/util/exception.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,9 +26,7 @@
#include <boost/exception/diagnostic_information.hpp>
#include <boost/exception/get_error_info.hpp>
-namespace ndn {
-namespace exception {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestException)
@@ -50,7 +48,7 @@
BOOST_CHECK(boost::get_error_info<boost::throw_function>(ex) != nullptr);
#ifdef NDN_CXX_HAVE_STACKTRACE
- auto stack = boost::get_error_info<errinfo_stacktrace>(ex);
+ auto stack = boost::get_error_info<ndn::exception::errinfo_stacktrace>(ex);
BOOST_REQUIRE(stack != nullptr);
auto info = boost::diagnostic_information(ex);
BOOST_TEST_MESSAGE(info);
@@ -106,6 +104,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestException
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace exception
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/indented-stream.t.cpp b/tests/unit/util/indented-stream.t.cpp
index 91da1e3..4994d0d 100644
--- a/tests/unit/util/indented-stream.t.cpp
+++ b/tests/unit/util/indented-stream.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).
*
@@ -25,11 +25,10 @@
#include <boost/test/tools/output_test_stream.hpp>
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
using boost::test_tools::output_test_stream;
+using ndn::util::IndentedStream;
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestIndentedStream)
@@ -77,6 +76,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestIndentedStream
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/io.t.cpp b/tests/unit/util/io.t.cpp
index 9658d04..934648a 100644
--- a/tests/unit/util/io.t.cpp
+++ b/tests/unit/util/io.t.cpp
@@ -27,8 +27,7 @@
#include <boost/filesystem.hpp>
#include <boost/mpl/vector.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestIo)
@@ -398,5 +397,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestIo
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/log-filter-module.cpp b/tests/unit/util/log-filter-module.cpp
index ab55728..371b7d6 100644
--- a/tests/unit/util/log-filter-module.cpp
+++ b/tests/unit/util/log-filter-module.cpp
@@ -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).
*
@@ -23,9 +23,7 @@
NDN_LOG_INIT(fm.FilterModule);
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
void
logFromFilterModule()
@@ -38,7 +36,5 @@
NDN_LOG_FATAL("fatalFM");
}
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/log-module1.cpp b/tests/unit/util/log-module1.cpp
index 4f71102..2070c58 100644
--- a/tests/unit/util/log-module1.cpp
+++ b/tests/unit/util/log-module1.cpp
@@ -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).
*
@@ -23,9 +23,7 @@
NDN_LOG_INIT(Module1);
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
void
logFromModule1()
@@ -38,6 +36,4 @@
NDN_LOG_FATAL("fatal" << 1);
}
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/log-module2.cpp b/tests/unit/util/log-module2.cpp
index 994e142..6565488 100644
--- a/tests/unit/util/log-module2.cpp
+++ b/tests/unit/util/log-module2.cpp
@@ -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).
*
@@ -23,9 +23,7 @@
NDN_LOG_INIT(Module2);
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
void
logFromModule2()
@@ -38,6 +36,4 @@
NDN_LOG_FATAL("fatal" << 2);
}
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/logger.t.cpp b/tests/unit/util/logger.t.cpp
index ad742bb..70ba72f 100644
--- a/tests/unit/util/logger.t.cpp
+++ b/tests/unit/util/logger.t.cpp
@@ -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).
*
@@ -24,9 +24,11 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::util::Logger;
+using ndn::util::Logging;
+using ndn::util::LogLevel;
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestLogger)
@@ -77,6 +79,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestLogger
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/logging.t.cpp b/tests/unit/util/logging.t.cpp
index 02da03a..937b41b 100644
--- a/tests/unit/util/logging.t.cpp
+++ b/tests/unit/util/logging.t.cpp
@@ -27,11 +27,13 @@
#include <boost/test/tools/output_test_stream.hpp>
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
-NDN_LOG_INIT(ndn.util.tests.Logging);
+using ndn::util::Logger;
+using ndn::util::Logging;
+using ndn::util::LogLevel;
+
+NDN_LOG_INIT(ndn.tests.Logging);
void
logFromModule1();
@@ -60,7 +62,7 @@
namespace ns1 {
-NDN_LOG_INIT(ndn.util.tests.ns1);
+NDN_LOG_INIT(ndn.tests.ns1);
static void
logFromNamespace1()
@@ -72,7 +74,7 @@
namespace ns2 {
-NDN_LOG_INIT(ndn.util.tests.ns2);
+NDN_LOG_INIT(ndn.tests.ns2);
static void
logFromNamespace2()
@@ -101,7 +103,7 @@
NDN_LOG_MEMBER_DECL();
};
-NDN_LOG_MEMBER_INIT(ClassWithLogger, ndn.util.tests.ClassWithLogger);
+NDN_LOG_MEMBER_INIT(ClassWithLogger, ndn.tests.ClassWithLogger);
class AbstractClassWithLogger
{
@@ -123,7 +125,7 @@
};
// Check that the macro can cope with abstract types
-NDN_LOG_MEMBER_INIT(AbstractClassWithLogger, ndn.util.tests.AbstractClassWithLogger);
+NDN_LOG_MEMBER_INIT(AbstractClassWithLogger, ndn.tests.AbstractClassWithLogger);
class DerivedClass : public AbstractClassWithLogger
{
@@ -159,13 +161,13 @@
// but we want to test that the macro expands to well-formed code
NDN_LOG_MEMBER_DECL_SPECIALIZED((ClassTemplateWithLogger<int, double>));
-NDN_LOG_MEMBER_INIT_SPECIALIZED((ClassTemplateWithLogger<int, double>), ndn.util.tests.Specialized1);
-NDN_LOG_MEMBER_INIT_SPECIALIZED((ClassTemplateWithLogger<int, std::string>), ndn.util.tests.Specialized2);
+NDN_LOG_MEMBER_INIT_SPECIALIZED((ClassTemplateWithLogger<int, double>), ndn.tests.Specialized1);
+NDN_LOG_MEMBER_INIT_SPECIALIZED((ClassTemplateWithLogger<int, std::string>), ndn.tests.Specialized2);
constexpr time::microseconds LOG_SYSTIME{1468108800311239LL};
const std::string LOG_SYSTIME_STR("1468108800.311239");
-class LoggingFixture : public ndn::tests::ClockFixture
+class LoggingFixture : public ClockFixture
{
protected:
LoggingFixture()
@@ -202,7 +204,7 @@
NDN_LOG_TRACE("GetLoggerNames");
auto names = Logging::getLoggerNames();
BOOST_CHECK_EQUAL(names.size(), n);
- BOOST_CHECK_EQUAL(names.count("ndn.util.tests.Logging"), 1);
+ BOOST_CHECK_EQUAL(names.count("ndn.tests.Logging"), 1);
}
BOOST_AUTO_TEST_SUITE(Severity)
@@ -308,48 +310,48 @@
BOOST_AUTO_TEST_CASE(NamespaceLogger)
{
- Logging::setLevel("ndn.util.tests.ns1", LogLevel::INFO);
- Logging::setLevel("ndn.util.tests.ns2", LogLevel::DEBUG);
+ Logging::setLevel("ndn.tests.ns1", LogLevel::INFO);
+ Logging::setLevel("ndn.tests.ns2", LogLevel::DEBUG);
const auto& levels = Logging::get().getLevels();
BOOST_CHECK_EQUAL(levels.size(), 2);
- BOOST_CHECK_EQUAL(levels.at("ndn.util.tests.ns1"), LogLevel::INFO);
- BOOST_CHECK_EQUAL(levels.at("ndn.util.tests.ns2"), LogLevel::DEBUG);
+ BOOST_CHECK_EQUAL(levels.at("ndn.tests.ns1"), LogLevel::INFO);
+ BOOST_CHECK_EQUAL(levels.at("ndn.tests.ns2"), LogLevel::DEBUG);
const auto& names = Logging::getLoggerNames();
- BOOST_CHECK_EQUAL(names.count("ndn.util.tests.ns1"), 1);
- BOOST_CHECK_EQUAL(names.count("ndn.util.tests.ns2"), 1);
+ BOOST_CHECK_EQUAL(names.count("ndn.tests.ns1"), 1);
+ BOOST_CHECK_EQUAL(names.count("ndn.tests.ns2"), 1);
ns1::logFromNamespace1();
ns2::logFromNamespace2();
Logging::flush();
BOOST_CHECK(os.is_equal(
- LOG_SYSTIME_STR + " INFO: [ndn.util.tests.ns1] hello world from ns1\n" +
- LOG_SYSTIME_STR + " INFO: [ndn.util.tests.ns2] hi there from ns2\n"
+ LOG_SYSTIME_STR + " INFO: [ndn.tests.ns1] hello world from ns1\n" +
+ LOG_SYSTIME_STR + " INFO: [ndn.tests.ns2] hi there from ns2\n"
));
}
BOOST_AUTO_TEST_CASE(MemberLogger)
{
- Logging::setLevel("ndn.util.tests.ClassWithLogger", LogLevel::INFO);
- Logging::setLevel("ndn.util.tests.AbstractClassWithLogger", LogLevel::INFO);
- Logging::setLevel("ndn.util.tests.Specialized1", LogLevel::INFO);
- // ndn.util.tests.Specialized2 is not enabled
+ Logging::setLevel("ndn.tests.ClassWithLogger", LogLevel::INFO);
+ Logging::setLevel("ndn.tests.AbstractClassWithLogger", LogLevel::INFO);
+ Logging::setLevel("ndn.tests.Specialized1", LogLevel::INFO);
+ // ndn.tests.Specialized2 is not enabled
const auto& names = Logging::getLoggerNames();
- BOOST_CHECK_EQUAL(names.count("ndn.util.tests.ClassWithLogger"), 1);
- BOOST_CHECK_EQUAL(names.count("ndn.util.tests.AbstractClassWithLogger"), 1);
- BOOST_CHECK_EQUAL(names.count("ndn.util.tests.Specialized1"), 1);
- BOOST_CHECK_EQUAL(names.count("ndn.util.tests.Specialized2"), 1);
+ BOOST_CHECK_EQUAL(names.count("ndn.tests.ClassWithLogger"), 1);
+ BOOST_CHECK_EQUAL(names.count("ndn.tests.AbstractClassWithLogger"), 1);
+ BOOST_CHECK_EQUAL(names.count("ndn.tests.Specialized1"), 1);
+ BOOST_CHECK_EQUAL(names.count("ndn.tests.Specialized2"), 1);
ClassWithLogger::logFromStaticMemberFunction();
ClassWithLogger{}.logFromConstMemberFunction();
Logging::flush();
BOOST_CHECK(os.is_equal(
- LOG_SYSTIME_STR + " INFO: [ndn.util.tests.ClassWithLogger] static member function\n" +
- LOG_SYSTIME_STR + " INFO: [ndn.util.tests.ClassWithLogger] const member function\n"
+ LOG_SYSTIME_STR + " INFO: [ndn.tests.ClassWithLogger] static member function\n" +
+ LOG_SYSTIME_STR + " INFO: [ndn.tests.ClassWithLogger] const member function\n"
));
DerivedClass{}.logFromConstMemberFunction();
@@ -357,8 +359,8 @@
Logging::flush();
BOOST_CHECK(os.is_equal(
- LOG_SYSTIME_STR + " INFO: [ndn.util.tests.AbstractClassWithLogger] const member function\n" +
- LOG_SYSTIME_STR + " INFO: [ndn.util.tests.AbstractClassWithLogger] overridden virtual function\n"
+ LOG_SYSTIME_STR + " INFO: [ndn.tests.AbstractClassWithLogger] const member function\n" +
+ LOG_SYSTIME_STR + " INFO: [ndn.tests.AbstractClassWithLogger] overridden virtual function\n"
));
ClassTemplateWithLogger<int, double>::logFromStaticMemberFunction();
@@ -368,8 +370,8 @@
Logging::flush();
BOOST_CHECK(os.is_equal(
- LOG_SYSTIME_STR + " INFO: [ndn.util.tests.Specialized1] class template static member function\n" +
- LOG_SYSTIME_STR + " INFO: [ndn.util.tests.Specialized1] class template non-static member function\n"
+ LOG_SYSTIME_STR + " INFO: [ndn.tests.Specialized1] class template static member function\n" +
+ LOG_SYSTIME_STR + " INFO: [ndn.tests.Specialized1] class template non-static member function\n"
));
}
@@ -702,6 +704,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestLogging
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/notification-stream.t.cpp b/tests/unit/util/notification-stream.t.cpp
index 3ff6ed9..36b9004 100644
--- a/tests/unit/util/notification-stream.t.cpp
+++ b/tests/unit/util/notification-stream.t.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-2023 Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -32,12 +32,12 @@
#include "tests/unit/io-key-chain-fixture.hpp"
#include "tests/unit/util/simple-notification.hpp"
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::util::NotificationStream;
BOOST_AUTO_TEST_SUITE(Util)
-BOOST_FIXTURE_TEST_SUITE(TestNotificationStream, ndn::tests::IoKeyChainFixture)
+BOOST_FIXTURE_TEST_SUITE(TestNotificationStream, IoKeyChainFixture)
BOOST_AUTO_TEST_CASE(Post)
{
@@ -72,6 +72,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestNotificationStream
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/notification-subscriber.t.cpp b/tests/unit/util/notification-subscriber.t.cpp
index 896f632..107784a 100644
--- a/tests/unit/util/notification-subscriber.t.cpp
+++ b/tests/unit/util/notification-subscriber.t.cpp
@@ -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,
@@ -32,11 +32,7 @@
#include "tests/unit/io-key-chain-fixture.hpp"
#include "tests/unit/util/simple-notification.hpp"
-namespace ndn {
-namespace util {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
class NotificationSubscriberFixture : public IoKeyChainFixture
{
@@ -131,8 +127,8 @@
Name streamPrefix;
DummyClientFace subscriberFace;
util::NotificationSubscriber<SimpleNotification> subscriber;
- util::signal::Connection notificationConn;
- util::signal::Connection nackConn;
+ signal::Connection notificationConn;
+ signal::Connection nackConn;
uint64_t nextSendNotificationNo;
uint64_t lastDeliveredSeqNum;
SimpleNotification lastNotification;
@@ -285,6 +281,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestNotificationSubscriber
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/ostream-joiner.t.cpp b/tests/unit/util/ostream-joiner.t.cpp
index 7e8e63f..2e7ac8f 100644
--- a/tests/unit/util/ostream-joiner.t.cpp
+++ b/tests/unit/util/ostream-joiner.t.cpp
@@ -26,8 +26,7 @@
#include <numeric>
#include <boost/test/tools/output_test_stream.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestOstreamJoiner)
@@ -69,5 +68,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestOstreamJoiner
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/random.t.cpp b/tests/unit/util/random.t.cpp
index 388bb98..b72e754 100644
--- a/tests/unit/util/random.t.cpp
+++ b/tests/unit/util/random.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).
*
@@ -28,8 +28,7 @@
#include <array>
#include <thread>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestRandom)
@@ -125,5 +124,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestRandom
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/regex.t.cpp b/tests/unit/util/regex.t.cpp
index ca15b66..d09688e 100644
--- a/tests/unit/util/regex.t.cpp
+++ b/tests/unit/util/regex.t.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).
*
@@ -32,8 +32,7 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
using std::string;
@@ -490,5 +489,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestRegex
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/rtt-estimator.t.cpp b/tests/unit/util/rtt-estimator.t.cpp
index b819c9b..7070fb0 100644
--- a/tests/unit/util/rtt-estimator.t.cpp
+++ b/tests/unit/util/rtt-estimator.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2019, Regents of the University of California,
+ * Copyright (c) 2016-2023, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -27,9 +27,10 @@
#include <cmath>
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::util::RttEstimator;
+using ndn::util::RttEstimatorWithStats;
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestRttEstimator)
@@ -168,6 +169,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestRttEstimator
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/scheduler.t.cpp b/tests/unit/util/scheduler.t.cpp
index 1040b92..e5c99e5 100644
--- a/tests/unit/util/scheduler.t.cpp
+++ b/tests/unit/util/scheduler.t.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).
*
@@ -26,11 +26,11 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace scheduler {
-namespace tests {
+namespace ndn::tests {
-class SchedulerFixture : public ndn::tests::IoFixture
+using namespace ndn::scheduler;
+
+class SchedulerFixture : public IoFixture
{
protected:
Scheduler scheduler{m_io};
@@ -383,6 +383,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestScheduler
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace scheduler
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/segment-fetcher.t.cpp b/tests/unit/util/segment-fetcher.t.cpp
index 4abe243..1166110 100644
--- a/tests/unit/util/segment-fetcher.t.cpp
+++ b/tests/unit/util/segment-fetcher.t.cpp
@@ -31,11 +31,7 @@
#include <set>
-namespace ndn {
-namespace util {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
class SegmentFetcherFixture : public IoKeyChainFixture
{
@@ -853,6 +849,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestSegmentFetcher
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/segmenter.t.cpp b/tests/unit/util/segmenter.t.cpp
index d7ab98a..f6eb2a8 100644
--- a/tests/unit/util/segmenter.t.cpp
+++ b/tests/unit/util/segmenter.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).
*
@@ -24,11 +24,7 @@
#include "tests/boost-test.hpp"
#include "tests/key-chain-fixture.hpp"
-namespace ndn {
-namespace util {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Util)
BOOST_FIXTURE_TEST_SUITE(TestSegmenter, KeyChainFixture)
@@ -144,6 +140,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestSegmenter
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/sha256.t.cpp b/tests/unit/util/sha256.t.cpp
index c5fd1fd..4a31ac7 100644
--- a/tests/unit/util/sha256.t.cpp
+++ b/tests/unit/util/sha256.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).
*
@@ -27,9 +27,9 @@
#include <boost/endian/conversion.hpp>
#include <sstream>
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::util::Sha256;
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestSha256)
@@ -201,6 +201,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestSha256
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/signal.t.cpp b/tests/unit/util/signal.t.cpp
index b3640f9..001d02a 100644
--- a/tests/unit/util/signal.t.cpp
+++ b/tests/unit/util/signal.t.cpp
@@ -25,10 +25,9 @@
#include <boost/concept_check.hpp>
-namespace ndn {
-namespace util {
-namespace signal {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::signal;
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestSignal)
@@ -477,7 +476,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestSignal
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace signal
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/simple-notification.hpp b/tests/unit/util/simple-notification.hpp
index ece2c48..239574b 100644
--- a/tests/unit/util/simple-notification.hpp
+++ b/tests/unit/util/simple-notification.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,
@@ -30,9 +30,7 @@
#include "ndn-cxx/encoding/block-helpers.hpp"
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
class SimpleNotification
{
@@ -82,8 +80,6 @@
std::string m_message;
};
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_UTIL_SIMPLE_NOTIFICATION_HPP
diff --git a/tests/unit/util/sqlite3-statement.t.cpp b/tests/unit/util/sqlite3-statement.t.cpp
index 99ea89f..b3d32d5 100644
--- a/tests/unit/util/sqlite3-statement.t.cpp
+++ b/tests/unit/util/sqlite3-statement.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).
*
@@ -27,9 +27,9 @@
#include <cstring>
#include <sqlite3.h>
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::util::Sqlite3Statement;
class Sqlite3DbFixture
{
@@ -153,6 +153,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestSqlite3Statement
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/string-helper.t.cpp b/tests/unit/util/string-helper.t.cpp
index 3816fab..9361ed6 100644
--- a/tests/unit/util/string-helper.t.cpp
+++ b/tests/unit/util/string-helper.t.cpp
@@ -28,9 +28,7 @@
#include <cstring>
#include <boost/test/tools/output_test_stream.hpp>
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
using boost::test_tools::output_test_stream;
@@ -202,6 +200,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestStringHelper
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/time-unit-test-clock.t.cpp b/tests/unit/util/time-unit-test-clock.t.cpp
index f1be623..6b34ff8 100644
--- a/tests/unit/util/time-unit-test-clock.t.cpp
+++ b/tests/unit/util/time-unit-test-clock.t.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).
*
@@ -28,8 +28,7 @@
#include <boost/lexical_cast.hpp>
#include <thread>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Util)
BOOST_FIXTURE_TEST_SUITE(TestTimeUnitTestClock, ClockFixture)
@@ -51,8 +50,7 @@
BOOST_CHECK_GT(time::system_clock::now().time_since_epoch(),
time::UnitTestClockTraits<time::system_clock>::getDefaultStartTime());
- time::system_clock::TimePoint referenceTime =
- time::fromUnixTimestamp(time::milliseconds(1390966967032LL));
+ auto referenceTime = time::fromUnixTimestamp(time::milliseconds(1390966967032LL));
BOOST_CHECK_GT(time::system_clock::now(), referenceTime);
m_systemClock->setNow(referenceTime.time_since_epoch());
@@ -134,5 +132,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestTimeUnitTestClock
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/time.t.cpp b/tests/unit/util/time.t.cpp
index 2232e12..9004700 100644
--- a/tests/unit/util/time.t.cpp
+++ b/tests/unit/util/time.t.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).
*
@@ -26,9 +26,9 @@
#include <boost/lexical_cast.hpp>
#include <thread>
-namespace ndn {
-namespace time {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::time;
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestTime)
@@ -170,6 +170,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestTime
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace time
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/version.t.cpp b/tests/unit/version.t.cpp
index ff3e32a..527bc95 100644
--- a/tests/unit/version.t.cpp
+++ b/tests/unit/version.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).
*
@@ -25,8 +25,7 @@
#include <cstdio>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(TestVersion)
@@ -58,5 +57,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestVersion
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tools/ndnsec/accumulator.hpp b/tools/ndnsec/accumulator.hpp
index a696000..eec3e09 100644
--- a/tools/ndnsec/accumulator.hpp
+++ b/tools/ndnsec/accumulator.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).
*
@@ -24,8 +24,7 @@
#include <boost/program_options/value_semantic.hpp>
-namespace ndn {
-namespace ndnsec {
+namespace ndn::ndnsec {
/**
* @brief An accumulating option value to handle multiple incrementing options.
@@ -154,7 +153,6 @@
return new AccumulatorType<T>(store);
}
-} // namespace ndnsec
-} // namespace ndn
+} // namespace ndn::ndnsec
#endif // NDN_CXX_TOOLS_NDNSEC_ACCUMULATOR_HPP
diff --git a/tools/ndnsec/cert-dump.cpp b/tools/ndnsec/cert-dump.cpp
index b5ac12f..8237f5d 100644
--- a/tools/ndnsec/cert-dump.cpp
+++ b/tools/ndnsec/cert-dump.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).
*
@@ -27,8 +27,7 @@
#include <boost/date_time/posix_time/posix_time_duration.hpp>
#endif // BOOST_VERSION < 106700
-namespace ndn {
-namespace ndnsec {
+namespace ndn::ndnsec {
int
ndnsec_cert_dump(int argc, char** argv)
@@ -142,5 +141,4 @@
return 0;
}
-} // namespace ndnsec
-} // namespace ndn
+} // namespace ndn::ndnsec
diff --git a/tools/ndnsec/cert-gen.cpp b/tools/ndnsec/cert-gen.cpp
index c151471..c382119 100644
--- a/tools/ndnsec/cert-gen.cpp
+++ b/tools/ndnsec/cert-gen.cpp
@@ -27,8 +27,7 @@
#include "ndn-cxx/security/transform/buffer-source.hpp"
#include "ndn-cxx/security/transform/stream-sink.hpp"
-namespace ndn {
-namespace ndnsec {
+namespace ndn::ndnsec {
int
ndnsec_cert_gen(int argc, char** argv)
@@ -157,5 +156,4 @@
return 0;
}
-} // namespace ndnsec
-} // namespace ndn
+} // namespace ndn::ndnsec
diff --git a/tools/ndnsec/cert-install.cpp b/tools/ndnsec/cert-install.cpp
index 9a13e33..345ee24 100644
--- a/tools/ndnsec/cert-install.cpp
+++ b/tools/ndnsec/cert-install.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).
*
@@ -27,8 +27,7 @@
#include "ndn-cxx/security/transform/stream-sink.hpp"
#include "ndn-cxx/security/transform/stream-source.hpp"
-namespace ndn {
-namespace ndnsec {
+namespace ndn::ndnsec {
int
ndnsec_cert_install(int argc, char** argv)
@@ -120,5 +119,4 @@
return 0;
}
-} // namespace ndnsec
-} // namespace ndn
+} // namespace ndn::ndnsec
diff --git a/tools/ndnsec/delete.cpp b/tools/ndnsec/delete.cpp
index 2159bb3..25de41c 100644
--- a/tools/ndnsec/delete.cpp
+++ b/tools/ndnsec/delete.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).
*
@@ -22,8 +22,7 @@
#include "ndnsec.hpp"
#include "util.hpp"
-namespace ndn {
-namespace ndnsec {
+namespace ndn::ndnsec {
int
ndnsec_delete(int argc, char** argv)
@@ -112,5 +111,4 @@
return 0;
}
-} // namespace ndnsec
-} // namespace ndn
+} // namespace ndn::ndnsec
diff --git a/tools/ndnsec/export.cpp b/tools/ndnsec/export.cpp
index 4ce0ebc..5641e08 100644
--- a/tools/ndnsec/export.cpp
+++ b/tools/ndnsec/export.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,8 +26,7 @@
#include <openssl/crypto.h>
-namespace ndn {
-namespace ndnsec {
+namespace ndn::ndnsec {
int
ndnsec_export(int argc, char** argv)
@@ -131,5 +130,4 @@
return 0;
}
-} // namespace ndnsec
-} // namespace ndn
+} // namespace ndn::ndnsec
diff --git a/tools/ndnsec/get-default.cpp b/tools/ndnsec/get-default.cpp
index 37f7425..8dba1bf 100644
--- a/tools/ndnsec/get-default.cpp
+++ b/tools/ndnsec/get-default.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).
*
@@ -22,8 +22,7 @@
#include "ndnsec.hpp"
#include "util.hpp"
-namespace ndn {
-namespace ndnsec {
+namespace ndn::ndnsec {
int
ndnsec_get_default(int argc, char** argv)
@@ -127,5 +126,4 @@
}
}
-} // namespace ndnsec
-} // namespace ndn
+} // namespace ndn::ndnsec
diff --git a/tools/ndnsec/import.cpp b/tools/ndnsec/import.cpp
index c25b0c7..9e0c830 100644
--- a/tools/ndnsec/import.cpp
+++ b/tools/ndnsec/import.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,8 +26,7 @@
#include <openssl/crypto.h>
-namespace ndn {
-namespace ndnsec {
+namespace ndn::ndnsec {
int
ndnsec_import(int argc, char** argv)
@@ -92,5 +91,4 @@
return 0;
}
-} // namespace ndnsec
-} // namespace ndn
+} // namespace ndn::ndnsec
diff --git a/tools/ndnsec/key-gen.cpp b/tools/ndnsec/key-gen.cpp
index ac85fe8..a045cd6 100644
--- a/tools/ndnsec/key-gen.cpp
+++ b/tools/ndnsec/key-gen.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).
*
@@ -22,8 +22,7 @@
#include "ndnsec.hpp"
#include "util.hpp"
-namespace ndn {
-namespace ndnsec {
+namespace ndn::ndnsec {
int
ndnsec_key_gen(int argc, char** argv)
@@ -158,5 +157,4 @@
return 0;
}
-} // namespace ndnsec
-} // namespace ndn
+} // namespace ndn::ndnsec
diff --git a/tools/ndnsec/list.cpp b/tools/ndnsec/list.cpp
index 502d909..3b02b80 100644
--- a/tools/ndnsec/list.cpp
+++ b/tools/ndnsec/list.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).
*
@@ -25,8 +25,7 @@
#include "ndn-cxx/util/indented-stream.hpp"
-namespace ndn {
-namespace ndnsec {
+namespace ndn::ndnsec {
namespace {
// https://en.wikipedia.org/wiki/Box_Drawing
@@ -247,5 +246,4 @@
return 0;
}
-} // namespace ndnsec
-} // namespace ndn
+} // namespace ndn::ndnsec
diff --git a/tools/ndnsec/main.cpp b/tools/ndnsec/main.cpp
index 436388f..7609345 100644
--- a/tools/ndnsec/main.cpp
+++ b/tools/ndnsec/main.cpp
@@ -31,7 +31,7 @@
NDN_LOG_INIT(ndnsec);
-const char NDNSEC_HELP_TEXT[] = R"STR(Usage: ndnsec COMMAND [OPTION]...
+constexpr std::string_view NDNSEC_HELP_TEXT = R"STR(Usage: ndnsec COMMAND [OPTION]...
Available commands:
help Print this help text
@@ -49,7 +49,8 @@
import Import an identity from a SafeBag
unlock-tpm Unlock the TPM
-Try 'ndnsec COMMAND --help' for more information on each command.)STR";
+Try 'ndnsec COMMAND --help' for more information on a command.
+)STR";
int
main(int argc, char* argv[])
@@ -66,7 +67,7 @@
argv++;
}
else {
- std::cerr << NDNSEC_HELP_TEXT << std::endl;
+ std::cerr << NDNSEC_HELP_TEXT;
return 2;
}
@@ -74,7 +75,7 @@
try {
using namespace ndn::ndnsec;
- if (command == "help") { std::cout << NDNSEC_HELP_TEXT << std::endl; }
+ if (command == "help") { std::cout << NDNSEC_HELP_TEXT; }
else if (command == "version") { std::cout << NDN_CXX_VERSION_BUILD_STRING << std::endl; }
else if (command == "list") { return ndnsec_list(argc, argv); }
else if (command == "get-default") { return ndnsec_get_default(argc, argv); }
@@ -89,9 +90,7 @@
else if (command == "import") { return ndnsec_import(argc, argv); }
else if (command == "unlock-tpm") { return ndnsec_unlock_tpm(argc, argv); }
else {
- std::cerr << "ERROR: Unknown command '" << command << "'\n"
- << "\n"
- << NDNSEC_HELP_TEXT << std::endl;
+ std::cerr << "ERROR: Unknown command '" << command << "'\n\n" << NDNSEC_HELP_TEXT;
return 2;
}
}
diff --git a/tools/ndnsec/ndnsec.hpp b/tools/ndnsec/ndnsec.hpp
index bb773ea..49c4de8 100644
--- a/tools/ndnsec/ndnsec.hpp
+++ b/tools/ndnsec/ndnsec.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -22,8 +22,7 @@
#ifndef NDN_CXX_TOOLS_NDNSEC_NDNSEC_HPP
#define NDN_CXX_TOOLS_NDNSEC_NDNSEC_HPP
-namespace ndn {
-namespace ndnsec {
+namespace ndn::ndnsec {
// TODO: convert to tool registry (maybe)
@@ -63,7 +62,6 @@
int
ndnsec_unlock_tpm(int argc, char** argv);
-} // namespace ndnsec
-} // namespace ndn
+} // namespace ndn::ndnsec
#endif // NDN_CXX_TOOLS_NDNSEC_NDNSEC_HPP
diff --git a/tools/ndnsec/set-default.cpp b/tools/ndnsec/set-default.cpp
index 128ae19..b0ebf09 100644
--- a/tools/ndnsec/set-default.cpp
+++ b/tools/ndnsec/set-default.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).
*
@@ -22,8 +22,7 @@
#include "ndnsec.hpp"
#include "util.hpp"
-namespace ndn {
-namespace ndnsec {
+namespace ndn::ndnsec {
int
ndnsec_set_default(int argc, char** argv)
@@ -95,5 +94,4 @@
return 0;
}
-} // namespace ndnsec
-} // namespace ndn
+} // namespace ndn::ndnsec
diff --git a/tools/ndnsec/sign-req.cpp b/tools/ndnsec/sign-req.cpp
index e202bc5..ca53819 100644
--- a/tools/ndnsec/sign-req.cpp
+++ b/tools/ndnsec/sign-req.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,8 +24,7 @@
#include "ndn-cxx/security/signing-helpers.hpp"
-namespace ndn {
-namespace ndnsec {
+namespace ndn::ndnsec {
int
ndnsec_sign_req(int argc, char** argv)
@@ -93,5 +92,4 @@
return 0;
}
-} // namespace ndnsec
-} // namespace ndn
+} // namespace ndn::ndnsec
diff --git a/tools/ndnsec/unlock-tpm.cpp b/tools/ndnsec/unlock-tpm.cpp
index 1baaa55..97cd702 100644
--- a/tools/ndnsec/unlock-tpm.cpp
+++ b/tools/ndnsec/unlock-tpm.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,8 +28,7 @@
#include <cstring>
#include <unistd.h>
-namespace ndn {
-namespace ndnsec {
+namespace ndn::ndnsec {
int
ndnsec_unlock_tpm(int argc, char** argv)
@@ -86,5 +85,4 @@
#endif // NDN_CXX_HAVE_GETPASS
}
-} // namespace ndnsec
-} // namespace ndn
+} // namespace ndn::ndnsec
diff --git a/tools/ndnsec/util.cpp b/tools/ndnsec/util.cpp
index ae407db..a85b9e3 100644
--- a/tools/ndnsec/util.cpp
+++ b/tools/ndnsec/util.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).
*
@@ -25,8 +25,7 @@
#include <unistd.h>
-namespace ndn {
-namespace ndnsec {
+namespace ndn::ndnsec {
bool
getPassword(std::string& password, const std::string& prompt, bool shouldConfirm)
@@ -89,5 +88,4 @@
NDN_CXX_UNREACHABLE;
}
-} // namespace ndnsec
-} // namespace ndn
+} // namespace ndn::ndnsec
diff --git a/tools/ndnsec/util.hpp b/tools/ndnsec/util.hpp
index 913198c..7a244d5 100644
--- a/tools/ndnsec/util.hpp
+++ b/tools/ndnsec/util.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -31,8 +31,7 @@
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/variables_map.hpp>
-namespace ndn {
-namespace ndnsec {
+namespace ndn::ndnsec {
/**
* @brief Get certificate of given name from PIB.
@@ -77,7 +76,6 @@
bool
getPassword(std::string& password, const std::string& prompt, bool shouldConfirm = true);
-} // namespace ndnsec
-} // namespace ndn
+} // namespace ndn::ndnsec
#endif // NDN_CXX_TOOLS_NDNSEC_UTIL_HPP