diff --git a/docs/code-style.rst b/docs/code-style.rst index 2baac21c..738e20c3 100644 --- a/docs/code-style.rst +++ b/docs/code-style.rst @@ -3,11 +3,11 @@ ndn-cxx Code Style and Coding Guidelines Based on -* "C++ Programming Style Guidelines" by Geotechnical Software Services, Copyright © 1996 – 2011. - The original document is available at ``_ +* "C++ Programming Style Guidelines" by Geotechnical Software Services, Copyright © 1996-2011. + The original document is available at ``__ * NDN Platform "C++, C, C#, Java and JavaScript Code Guidelines". - The original document is available at ``_ + The original document is available at ``__ 1. Code layout -------------- @@ -52,11 +52,11 @@ extended it to C++. } // 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 @@ written in mixed case starting with lower case. .. 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 c48312c0..afcd3312 100644 --- a/docs/doxygen.conf.in +++ b/docs/doxygen.conf.in @@ -1739,16 +1739,6 @@ LATEX_BATCHMODE = NO 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_STYLESHEET_FILE = 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 @@ GENERATE_DOCBOOK = NO 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 @@ EXTERNAL_PAGES = YES # 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 5d804bf0..89d7c08c 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 @@ New features + 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 81083003..2ba1ec1e 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 @@ Improvements and bug fixes 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 904eb1dc..f5d77666 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 @@ Removed - 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 b90d23be..a0648a1d 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 -namespace boost { -namespace asio { +namespace boost::asio { #if BOOST_VERSION >= 106600 class io_context; @@ -34,7 +33,6 @@ using io_service = io_context; 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 4ce807c0..b07ecca3 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 @@ CancelHandle::cancel() const } } -} // namespace detail -} // namespace ndn +} // namespace ndn::detail diff --git a/ndn-cxx/detail/cancel-handle.hpp b/ndn-cxx/detail/cancel-handle.hpp index a7207a78..65dc1107 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 @@ private: inline CancelHandle::CancelHandle() noexcept = default; -/** \brief Cancels an operation automatically upon destruction. +/** + * \brief Cancels an operation automatically upon destruction. */ template class ScopedCancelHandle @@ -133,7 +137,6 @@ private: template ScopedCancelHandle::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 156e7a44..4ff6b669 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 -namespace ndn { -namespace detail { +namespace ndn::detail { /** * @brief Helper class to wrap CoreFoundation object pointers @@ -145,7 +144,6 @@ private: 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 5cceb33a..1459f811 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 fromBuffer(const uint8_t* buf, size_t buflen) @@ -66,6 +64,4 @@ toStdString(CFStringRef cfStr) 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 6be24995..4cabdcb5 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 @@ fromStdString(const std::string& str); 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 a4b5e8d1..bf53c863 100644 --- a/ndn-cxx/encoding/block-helpers.cpp +++ b/ndn-cxx/encoding/block-helpers.cpp @@ -23,8 +23,7 @@ #include -namespace ndn { -namespace encoding { +namespace ndn::encoding { namespace endian = boost::endian; @@ -220,5 +219,4 @@ prependBlock(EncodingImpl&, const Block&); template size_t prependBlock(EncodingImpl&, const Block&); -} // namespace encoding -} // namespace ndn +} // namespace ndn::encoding diff --git a/ndn-cxx/encoding/block.hpp b/ndn-cxx/encoding/block.hpp index c9cf885b..f43d085c 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 bd39970b..883d2726 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 -namespace ndn { -namespace encoding { +namespace ndn::encoding { namespace endian = boost::endian; @@ -200,5 +199,4 @@ Encoder::appendNonNegativeInteger(uint64_t varNumber) } } -} // namespace encoding -} // namespace ndn +} // namespace ndn::encoding diff --git a/ndn-cxx/encoding/encoder.hpp b/ndn-cxx/encoding/encoder.hpp index 7b4e2d8a..1d453142 100644 --- a/ndn-cxx/encoding/encoder.hpp +++ b/ndn-cxx/encoding/encoder.hpp @@ -26,8 +26,7 @@ #include -namespace ndn { -namespace encoding { +namespace ndn::encoding { /** * @brief Helper class to perform TLV encoding. @@ -278,7 +277,6 @@ Encoder::appendRange(Iterator first, Iterator last) 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 01471c66..20b8182a 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 @@ public: } }; -} // 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 5276a7d7..56fa322c 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 @@ public: // common interface between Encoder and Estimator } }; -} // 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 28c842a1..c6f5a586 100644 --- a/ndn-cxx/encoding/nfd-constants.cpp +++ b/ndn-cxx/encoding/nfd-constants.cpp @@ -29,8 +29,7 @@ #include #include -namespace ndn { -namespace nfd { +namespace ndn::nfd { std::ostream& operator<<(std::ostream& os, FaceScope faceScope) @@ -196,5 +195,4 @@ operator<<(std::ostream& os, RouteFlags routeFlags) 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 55f1b7b8..55e29055 100644 --- a/ndn-cxx/encoding/nfd-constants.hpp +++ b/ndn-cxx/encoding/nfd-constants.hpp @@ -26,8 +26,7 @@ #include #include -namespace ndn { -namespace nfd { +namespace ndn::nfd { inline constexpr uint64_t INVALID_FACE_ID = 0; @@ -131,7 +130,6 @@ enum RouteFlags : uint64_t { 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 100dd934..f22fd965 100644 --- a/ndn-cxx/encoding/tlv-nfd.hpp +++ b/ndn-cxx/encoding/tlv-nfd.hpp @@ -24,9 +24,7 @@ #include -namespace ndn { -namespace tlv { -namespace nfd { +namespace ndn::tlv::nfd { /** * @brief TLV-TYPE numbers defined by the NFD Management protocol. @@ -105,8 +103,6 @@ enum : uint32_t { 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 be13371e..93a11cfa 100644 --- a/ndn-cxx/encoding/tlv-security.hpp +++ b/ndn-cxx/encoding/tlv-security.hpp @@ -24,9 +24,7 @@ #include -namespace ndn { -namespace tlv { -namespace security { +namespace ndn::tlv::security { /** * @brief TLV-TYPE numbers for SafeBag and related elements. @@ -37,8 +35,6 @@ enum : uint32_t { 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 a0919146..04879987 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 + +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 @@ operator<<(std::ostream& os, ContentTypeValue ct) return os << static_cast(ct) << ')'; } -} // namespace tlv -} // namespace ndn +size_t +writeVarNumber(std::ostream& os, uint64_t number) +{ + if (number < 253) { + os.put(static_cast(number)); + return 1; + } + else if (number <= std::numeric_limits::max()) { + os.put(static_cast(253)); + uint16_t value = boost::endian::native_to_big(static_cast(number)); + os.write(reinterpret_cast(&value), 2); + return 3; + } + else if (number <= std::numeric_limits::max()) { + os.put(static_cast(254)); + uint32_t value = boost::endian::native_to_big(static_cast(number)); + os.write(reinterpret_cast(&value), 4); + return 5; + } + else { + os.put(static_cast(255)); + uint64_t value = boost::endian::native_to_big(number); + os.write(reinterpret_cast(&value), 8); + return 9; + } +} + +size_t +writeNonNegativeInteger(std::ostream& os, uint64_t integer) +{ + if (integer <= std::numeric_limits::max()) { + os.put(static_cast(integer)); + return 1; + } + else if (integer <= std::numeric_limits::max()) { + uint16_t value = boost::endian::native_to_big(static_cast(integer)); + os.write(reinterpret_cast(&value), 2); + return 2; + } + else if (integer <= std::numeric_limits::max()) { + uint32_t value = boost::endian::native_to_big(static_cast(integer)); + os.write(reinterpret_cast(&value), 4); + return 4; + } + else { + uint64_t value = boost::endian::native_to_big(integer); + os.write(reinterpret_cast(&value), 8); + return 8; + } +} + +} // namespace ndn::tlv diff --git a/ndn-cxx/encoding/tlv.hpp b/ndn-cxx/encoding/tlv.hpp index 12bc854e..86678ff7 100644 --- a/ndn-cxx/encoding/tlv.hpp +++ b/ndn-cxx/encoding/tlv.hpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include @@ -411,33 +410,6 @@ sizeOfVarNumber(uint64_t number) noexcept number <= std::numeric_limits::max() ? 5 : 9; } -inline size_t -writeVarNumber(std::ostream& os, uint64_t number) -{ - if (number < 253) { - os.put(static_cast(number)); - return 1; - } - else if (number <= std::numeric_limits::max()) { - os.put(static_cast(253)); - uint16_t value = boost::endian::native_to_big(static_cast(number)); - os.write(reinterpret_cast(&value), 2); - return 3; - } - else if (number <= std::numeric_limits::max()) { - os.put(static_cast(254)); - uint32_t value = boost::endian::native_to_big(static_cast(number)); - os.write(reinterpret_cast(&value), 4); - return 5; - } - else { - os.put(static_cast(255)); - uint64_t value = boost::endian::native_to_big(number); - os.write(reinterpret_cast(&value), 8); - return 9; - } -} - template constexpr uint64_t readNonNegativeInteger(size_t len, Iterator& begin, Iterator end) @@ -463,30 +435,6 @@ sizeOfNonNegativeInteger(uint64_t integer) noexcept integer <= std::numeric_limits::max() ? 4 : 8; } -inline size_t -writeNonNegativeInteger(std::ostream& os, uint64_t integer) -{ - if (integer <= std::numeric_limits::max()) { - os.put(static_cast(integer)); - return 1; - } - else if (integer <= std::numeric_limits::max()) { - uint16_t value = boost::endian::native_to_big(static_cast(integer)); - os.write(reinterpret_cast(&value), 2); - return 2; - } - else if (integer <= std::numeric_limits::max()) { - uint32_t value = boost::endian::native_to_big(static_cast(integer)); - os.write(reinterpret_cast(&value), 4); - return 4; - } - else { - uint64_t value = boost::endian::native_to_big(integer); - os.write(reinterpret_cast(&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 750e8042..54b1ffe1 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 6f630318..76bb4191 100644 --- a/ndn-cxx/impl/name-component-types.hpp +++ b/ndn-cxx/impl/name-component-types.hpp @@ -29,8 +29,7 @@ #include #include -namespace ndn { -namespace name { +namespace ndn::name { namespace { /** @@ -398,7 +397,6 @@ getComponentTypeTable() } } // 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 791b0a25..be8a6ef2 100644 --- a/ndn-cxx/impl/record-container.hpp +++ b/ndn-cxx/impl/record-container.hpp @@ -27,8 +27,7 @@ #include -namespace ndn { -namespace detail { +namespace ndn::detail { using RecordId = uint64_t; @@ -92,7 +91,7 @@ public: /** * \brief Insert a record with given ID. */ - template + template Record& put(RecordId id, TArgs&&... args) { @@ -115,7 +114,7 @@ public: /** * \brief Insert a record with newly assigned ID. */ - template + template Record& insert(TArgs&&... args) { @@ -189,14 +188,13 @@ public: public: /** \brief Signals when container becomes empty */ - util::Signal> onEmpty; + signal::Signal> onEmpty; private: Container m_container; std::atomic 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 50e5cf9a..cc59acfe 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 @@ private: 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, boost::multi_index::identity >, - // by arrival (FIFO) boost::multi_index::sequenced< boost::multi_index::tag > - > - > 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 6c6ebfb1..cc8e7dc0 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 @@ private: 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, boost::multi_index::member >, - // by frequency (LFU) boost::multi_index::ordered_non_unique< boost::multi_index::tag, boost::multi_index::member, std::less > - > - > 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 b5524e51..9f0decfa 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 @@ private: 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, boost::multi_index::identity >, - // by last used time (LRU) boost::multi_index::sequenced< boost::multi_index::tag > - > - > CleanupIndex; + >; CleanupIndex m_cleanupIndex; }; diff --git a/ndn-cxx/ims/in-memory-storage.hpp b/ndn-cxx/ims/in-memory-storage.hpp index 4694e311..2658e4ef 100644 --- a/ndn-cxx/ims/in-memory-storage.hpp +++ b/ndn-cxx/ims/in-memory-storage.hpp @@ -45,10 +45,9 @@ public: // 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, @@ -56,9 +55,8 @@ public: &InMemoryStorageEntry::getFullName>, std::less > - > - > 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 c64bd045..a460b136 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 @@ CachePolicy::setPolicy(CachePolicyType policy) 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 1b2a436e..738fd8e1 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 @@ private: 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 2733d2d0..6e20df51 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 @@ struct EmptyValue { }; -} // 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 1cb19164..5fcb3fa7 100644 --- a/ndn-cxx/lp/field-decl.hpp +++ b/ndn-cxx/lp/field-decl.hpp @@ -29,8 +29,7 @@ #include #include -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 @@ public: } }; -} // 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 3ede2b5c..3d72fdaf 100644 --- a/ndn-cxx/lp/field.hpp +++ b/ndn-cxx/lp/field.hpp @@ -26,8 +26,7 @@ #include -namespace ndn { -namespace lp { +namespace ndn::lp { /** * \brief Indicates where a field may occur. @@ -67,7 +66,6 @@ struct Field } }; -} // 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 78444ee4..d30ba1f7 100644 --- a/ndn-cxx/lp/fields.hpp +++ b/ndn-cxx/lp/fields.hpp @@ -33,8 +33,7 @@ #include -namespace ndn { -namespace lp { +namespace ndn::lp { /** * \brief Declare the Fragment field. @@ -134,7 +133,6 @@ using FieldSet = boost::mpl::set< 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 ab1cc86e..71c76ee9 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 @@ NackHeader::setReason(NackReason reason) 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 62846240..bc78e36d 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 @@ private: 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 7e3a57ff..20a0f8fc 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 @@ Nack::Nack(Interest&& interest) { } -} // namespace lp -} // namespace ndn +} // namespace ndn::lp diff --git a/ndn-cxx/lp/nack.hpp b/ndn-cxx/lp/nack.hpp index e166971d..4631130a 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 @@ private: 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 e942acca..be115f9b 100644 --- a/ndn-cxx/lp/packet.cpp +++ b/ndn-cxx/lp/packet.cpp @@ -25,8 +25,7 @@ #include #include -namespace ndn { -namespace lp { +namespace ndn::lp { namespace { @@ -161,5 +160,4 @@ Packet::comparePos(uint32_t first, const Block& second) noexcept 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 ba38ebd7..9f065551 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 @@ private: 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 f232814a..a564dabe 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 @@ operator<<(std::ostream& os, const PitToken& pitToken) 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 9d0371d8..e7e2d128 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 @@ private: 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 3c5de4d7..58ebbc28 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 @@ PrefixAnnouncementHeader::wireDecode(const Block& wire) 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 59e4cc98..f2360395 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 @@ private: 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 4b662dd1..919db36f 100644 --- a/ndn-cxx/lp/sequence.hpp +++ b/ndn-cxx/lp/sequence.hpp @@ -26,15 +26,13 @@ #include -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 b32bc60d..312a39da 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 NonDiscoveryTag = SimpleTag; */ using PrefixAnnouncementTag = SimpleTag; -} // 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 fe99f34a..10fe1f6e 100644 --- a/ndn-cxx/lp/tlv.hpp +++ b/ndn-cxx/lp/tlv.hpp @@ -24,12 +24,10 @@ #include -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 @@ enum : uint32_t { 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 382a7af0..211ca53a 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 @@ public: 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 ce0b0da3..ffff61a4 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 @@ ControlResponse::wireDecode(const Block& wire) 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..11804de7 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 @@ private: // non-member operators } }; -} // 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 4a2079d9..a1926428 100644 --- a/ndn-cxx/mgmt/dispatcher.cpp +++ b/ndn-cxx/mgmt/dispatcher.cpp @@ -25,10 +25,9 @@ #include -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 @@ Dispatcher::postNotification(const Block& notification, const PartialName& relPr 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 3cc9092d..9c5bdded 100644 --- a/ndn-cxx/mgmt/dispatcher.hpp +++ b/ndn-cxx/mgmt/dispatcher.hpp @@ -32,8 +32,7 @@ #include -namespace ndn { -namespace mgmt { +namespace ndn::mgmt { // ---- AUTHORIZATION ---- @@ -488,7 +487,6 @@ Dispatcher::addControlCommand(const PartialName& relPrefix, }; } -} // 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 f39f11a2..d8882afb 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 @@ operator<<(std::ostream& os, const ChannelStatus& status) 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 4fbc06b8..f2a896c2 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 @@ operator!=(const ChannelStatus& a, const ChannelStatus& b) 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 36faba2e..921e8223 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 @@ CommandOptions::setSigningInfo(security::SigningInfo signingInfo) 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 5a341feb..e4ad1729 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 @@ private: 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 a6daa76b..352fa4cb 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 @@ RibUnregisterCommand::validateResponse(const ControlParameters& parameters) cons } } -} // 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 9aa58203..a01c9a91 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 @@ public: 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 9ec72349..4e8c8663 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 @@ operator<<(std::ostream& os, const ControlParameters& parameters) 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 18e55345..b49ba4f1 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 @@ NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(ControlParameters); 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 f02f4db5..c7effc36 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 38a0052b..4cc2fa84 100644 --- a/ndn-cxx/mgmt/nfd/controller.cpp +++ b/ndn-cxx/mgmt/nfd/controller.cpp @@ -25,10 +25,7 @@ #include -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 @@ Controller::processDatasetFetchError(const DatasetFailureCallback& onFailure, } } -} // namespace nfd -} // namespace ndn +} // namespace ndn::nfd diff --git a/ndn-cxx/mgmt/nfd/controller.hpp b/ndn-cxx/mgmt/nfd/controller.hpp index d0d3f08d..b9adc751 100644 --- a/ndn-cxx/mgmt/nfd/controller.hpp +++ b/ndn-cxx/mgmt/nfd/controller.hpp @@ -34,6 +34,9 @@ namespace ndn { class Face; +/** + * @brief Contains classes and functions related to the NFD Management protocol. + */ namespace nfd { /** @@ -178,7 +181,7 @@ protected: security::InterestSigner m_signer; NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED: - std::set> m_fetchers; + std::set> m_fetchers; }; template diff --git a/ndn-cxx/mgmt/nfd/cs-info.cpp b/ndn-cxx/mgmt/nfd/cs-info.cpp index cfae5663..e855d73b 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 @@ operator<<(std::ostream& os, const CsInfo& csi) << 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 541c08c4..9103c8fb 100644 --- a/ndn-cxx/mgmt/nfd/cs-info.hpp +++ b/ndn-cxx/mgmt/nfd/cs-info.hpp @@ -27,8 +27,7 @@ #include -namespace ndn { -namespace nfd { +namespace ndn::nfd { /** \ingroup management * \brief Represents the CS Information dataset. @@ -150,7 +149,6 @@ operator!=(const CsInfo& a, const CsInfo& b) 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 de5dc402..5c19a926 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 @@ operator<<(std::ostream& os, const FaceEventNotification& notification) 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 959cf939..8702b404 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 @@ operator!=(const FaceEventNotification& a, const FaceEventNotification& b) 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 07fefd87..3ed65793 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 @@ public: } }; -} // 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 1cf2d5c1..dbdb2f9e 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 @@ operator<<(std::ostream& os, const FaceQueryFilter& filter) 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 65de800c..a09f4050 100644 --- a/ndn-cxx/mgmt/nfd/face-query-filter.hpp +++ b/ndn-cxx/mgmt/nfd/face-query-filter.hpp @@ -27,8 +27,7 @@ #include -namespace ndn { -namespace nfd { +namespace ndn::nfd { /** * \ingroup management @@ -230,7 +229,6 @@ operator!=(const FaceQueryFilter& a, const FaceQueryFilter& b) 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 04b4bdbb..4ab55fef 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 @@ operator<<(std::ostream& os, const FaceStatus& status) 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 7cd9da38..fa49c8fb 100644 --- a/ndn-cxx/mgmt/nfd/face-status.hpp +++ b/ndn-cxx/mgmt/nfd/face-status.hpp @@ -27,8 +27,7 @@ #include -namespace ndn { -namespace nfd { +namespace ndn::nfd { /** * \ingroup management @@ -249,7 +248,6 @@ operator!=(const FaceStatus& a, const FaceStatus& b) 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 d497b4d1..78166650 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 @@ protected: 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 d2c4f5a6..c45e8885 100644 --- a/ndn-cxx/mgmt/nfd/fib-entry.cpp +++ b/ndn-cxx/mgmt/nfd/fib-entry.cpp @@ -27,8 +27,7 @@ #include -namespace ndn { -namespace nfd { +namespace ndn::nfd { NextHopRecord::NextHopRecord() = default; @@ -264,5 +263,4 @@ operator<<(std::ostream& os, const FibEntry& entry) 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 b68071d6..a0e5e365 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 @@ operator!=(const FibEntry& a, const FibEntry& b) 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 09b3971d..a92bfc28 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::setNfdVersion(const std::string& nfdVersion) } 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::setStartTimestamp(const time::system_clock::TimePoint& startTim } 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 @@ operator<<(std::ostream& os, const ForwarderStatus& status) 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 e0107325..70ea5ba7 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 @@ operator!=(const ForwarderStatus& a, const ForwarderStatus& b) 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 73e7f434..cd8e74b8 100644 --- a/ndn-cxx/mgmt/nfd/rib-entry.cpp +++ b/ndn-cxx/mgmt/nfd/rib-entry.cpp @@ -28,8 +28,7 @@ #include -namespace ndn { -namespace nfd { +namespace ndn::nfd { Route::Route() = default; @@ -341,5 +340,4 @@ operator<<(std::ostream& os, const RibEntry& entry) 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 24eb78b0..4de95d77 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 @@ operator!=(const RibEntry& a, const RibEntry& b) 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 be7553e4..160a2668 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 @@ protected: 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 fe8b1781..139ff89f 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 @@ RibDataset::parseResult(ConstBufferPtr payload) const return parseDatasetVector(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 93cc3311..8bddf15b 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 @@ public: 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 6ef45c50..cf13c3f2 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 @@ operator<<(std::ostream& os, const StrategyChoice& sc) << ")"; } -} // 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 59db5bab..fba108ef 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 @@ operator!=(const StrategyChoice& a, const StrategyChoice& b) 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 0848a05a..4e0de691 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 @@ StatusDatasetContext::reject(const ControlResponse& resp) 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 7eb5dcbf..643cbd1d 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 @@ private: 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 abedc2c1..964353e2 100644 --- a/ndn-cxx/name-component.cpp +++ b/ndn-cxx/name-component.cpp @@ -32,8 +32,7 @@ #include -namespace ndn { -namespace name { +namespace ndn::name { static Convention g_conventionEncoding = Convention::TYPED; static Convention g_conventionDecoding = Convention::EITHER; @@ -510,5 +509,4 @@ Component::wireDecode(const Block& wire) // 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 839b46e0..9b245c1e 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 @@ private: // non-member operators 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 9b0a9f11..5303e936 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 #endif -namespace ndn { -namespace dns { +namespace ndn::dns { class Resolver : noncopyable { @@ -169,5 +168,4 @@ syncResolve(const std::string& host, 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 a2db537e..4859d98b 100644 --- a/ndn-cxx/net/dns.hpp +++ b/ndn-cxx/net/dns.hpp @@ -27,8 +27,7 @@ #include -namespace ndn { -namespace dns { +namespace ndn::dns { using IpAddress = boost::asio::ip::address; using AddressSelector = std::function; @@ -109,7 +108,6 @@ syncResolve(const std::string& host, 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 cced947e..98486571 100644 --- a/ndn-cxx/net/ethernet.cpp +++ b/ndn-cxx/net/ethernet.cpp @@ -34,8 +34,7 @@ #include #include -namespace ndn { -namespace ethernet { +namespace ndn::ethernet { Address::Address() { @@ -130,8 +129,7 @@ operator<<(std::ostream& o, const Address& a) return o << a.toString(); } -} // namespace ethernet -} // namespace ndn +} // namespace ndn::ethernet std::size_t std::hash::operator()(const ndn::ethernet::Address& a) const noexcept diff --git a/ndn-cxx/net/ethernet.hpp b/ndn-cxx/net/ethernet.hpp index 62b233cc..9edddd8e 100644 --- a/ndn-cxx/net/ethernet.hpp +++ b/ndn-cxx/net/ethernet.hpp @@ -33,8 +33,7 @@ #include #include -namespace ndn { -namespace ethernet { +namespace ndn::ethernet { inline constexpr uint16_t ETHERTYPE_NDN = 0x8624; ///< The NDN Ethertype @@ -110,8 +109,7 @@ getDefaultMulticastAddress(); 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 75122591..f752b247 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 #import -namespace ndn { -namespace net { -namespace detail { +namespace ndn::net::detail { ndn::nfd::LinkType getLinkType(const std::string& ifName) @@ -61,6 +59,4 @@ getLinkType(const std::string& ifName) } } -} // 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 6ad4059f..018af821 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 @@ getLinkType(const std::string& ifName) 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 e5bdc23b..08fe96eb 100644 --- a/ndn-cxx/net/impl/link-type-helper.hpp +++ b/ndn-cxx/net/impl/link-type-helper.hpp @@ -26,9 +26,7 @@ #include -namespace ndn { -namespace net { -namespace detail { +namespace ndn::net::detail { /** * @brief Obtain information about WiFi link type @@ -36,8 +34,6 @@ namespace detail { 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 68bb9dbd..913c52c9 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 #include -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_TESTING = IF_OPER_TESTING; 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 ab8a4cc4..9d58dc0d 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 -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_TESTING; 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 5eb44b88..d00b1063 100644 --- a/ndn-cxx/net/impl/netlink-message.hpp +++ b/ndn-cxx/net/impl/netlink-message.hpp @@ -42,8 +42,7 @@ #include -namespace ndn { -namespace net { +namespace ndn::net { template constexpr size_t @@ -270,7 +269,6 @@ private: std::map 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 b12998c7..b3f59f71 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 @@ -607,5 +606,4 @@ GenlSocket::nlmsgTypeToString(uint16_t type) const 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 af101736..34a5e9ed 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 @@ class GenlFamilyResolver : noncopyable public: GenlFamilyResolver(std::string familyName, GenlSocket& socket); - util::Signal onResolved; - util::Signal onError; + signal::Signal onResolved; + signal::Signal onError; private: void @@ -153,7 +152,6 @@ private: std::map 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 0862371d..ca1d7495 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 @@ NetworkMonitorImplNetlink::parseErrorMessage(const NetlinkMessage& nlmsg) #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 a7c71933..78501aef 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 -namespace ndn { -namespace net { +namespace ndn::net { class NetworkMonitorImplNetlink : public NetworkMonitorImpl { @@ -104,7 +103,6 @@ private: } 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 617f319a..d0a0d087 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 @@ public: } }; -} // 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 b10c6eb9..0b543d7c 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 #include +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 @@ NetworkMonitorImplOsx::onConfigChanged(CFArrayRef changedKeys) } } -} // 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 67a28f80..099ae8b0 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 #include -namespace ndn { -namespace net { +namespace ndn::net { class IfAddrs; @@ -111,7 +110,6 @@ private: 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 f8e8a6ee..40ff6fa9 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 #endif -namespace ndn { -namespace net { +namespace ndn::net { std::ostream& operator<<(std::ostream& os, AddressScope scope) @@ -79,5 +78,4 @@ operator<<(std::ostream& os, const NetworkAddress& addr) return os << addr.getIp() << '/' << static_cast(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 1bb435c2..d70e611f 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 -namespace ndn { -namespace net { +namespace ndn::net { enum class AddressFamily { UNSPECIFIED, @@ -140,7 +139,6 @@ private: 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 2adf2efd..250e1d6b 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 -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 @@ operator<<(std::ostream& os, const NetworkInterface& netif) 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 29277c91..dca92b9c 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 -namespace ndn { -namespace net { +namespace ndn::net { /** @brief Indicates the hardware type of a network interface */ @@ -71,19 +70,19 @@ class NetworkInterface public: // signals, marked 'mutable' so they can be connected on 'const NetworkInterface' /** @brief Fires when interface state changes */ - mutable util::Signal onStateChanged; + mutable signal::Signal onStateChanged; /** @brief Fires when interface mtu changes */ - mutable util::Signal onMtuChanged; + mutable signal::Signal onMtuChanged; /** @brief Fires when a network-layer address is added to the interface */ - mutable util::Signal onAddressAdded; + mutable signal::Signal onAddressAdded; /** @brief Fires when a network-layer address is removed from the interface */ - mutable util::Signal onAddressRemoved; + mutable signal::Signal onAddressRemoved; public: // getters /** @brief Returns an opaque ID that uniquely identifies the interface on the system @@ -249,7 +248,6 @@ private: 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 c84d8aec..bb8e49ec 100644 --- a/ndn-cxx/net/network-monitor-stub.cpp +++ b/ndn-cxx/net/network-monitor-stub.cpp @@ -29,8 +29,7 @@ #include #include -namespace ndn { -namespace net { +namespace ndn::net { class NetworkMonitorImplStub : public NetworkMonitorImpl { @@ -134,5 +133,4 @@ NetworkMonitorStub::emitEnumerationCompleted() 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 25f8849f..b6bf8521 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 @@ private: 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 511d750e..79e601f8 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 makeNetworkMonitorImpl(boost::asio::io_service& io) @@ -94,5 +93,4 @@ NetworkMonitorImpl::makeNetworkInterface() return shared_ptr(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 3bd8927d..f45c4d53 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 -namespace ndn { -namespace net { +namespace ndn::net { class NetworkMonitorImpl; @@ -112,20 +113,20 @@ private: public: // signals /// Fires when the enumeration of all network interfaces on the system is complete. - util::Signal& onEnumerationCompleted; + signal::Signal& onEnumerationCompleted; /// Fires whenever a new interface is detected on the system. - util::Signal>& onInterfaceAdded; + signal::Signal>& 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>& onInterfaceRemoved; + signal::Signal>& onInterfaceRemoved; /// @deprecated Only for backward compatibility - util::Signal& onNetworkStateChanged; + signal::Signal& onNetworkStateChanged; }; class NetworkMonitorImpl : noncopyable @@ -150,10 +151,10 @@ protected: makeNetworkInterface(); public: - util::Signal onEnumerationCompleted; - util::Signal> onInterfaceAdded; - util::Signal> onInterfaceRemoved; - util::Signal onNetworkStateChanged; + signal::Signal onEnumerationCompleted; + signal::Signal> onInterfaceAdded; + signal::Signal> onInterfaceRemoved; + signal::Signal onNetworkStateChanged; protected: DECLARE_SIGNAL_EMIT(onEnumerationCompleted) @@ -162,7 +163,6 @@ protected: 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 727cb57b..52c46501 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 @@ operator<<(std::ostream& os, const AdditionalDescription& desc) 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 d42aca76..09fa9c6a 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 -namespace ndn { -namespace security { -inline namespace v2 { +namespace ndn::security { /** * @brief Represents an %AdditionalDescription TLV element. @@ -136,9 +134,6 @@ NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(AdditionalDescription); 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 f3602206..1179bf04 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 @@ CertificateBundleFetcher::deriveBundleName(const Name& name) 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 6e9d683b..1d3e4ffd 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 @@ private: 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 bf5cb6cd..43217379 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 @@ CertificateCache::CertificateCache(const time::nanoseconds& maxLifetime) 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(removalTime - now)); m_certs.insert(Entry(cert, removalTime)); @@ -98,7 +90,7 @@ CertificateCache::find(const Interest& interest) const 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 @@ CertificateCache::refresh() } } -} // 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 13e8d33c..f86ca592 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 #include -namespace ndn { -namespace security { -inline namespace v2 { +namespace ndn::security { /** * @brief Represents a container for verified certificates. @@ -92,7 +90,8 @@ private: 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 @@ private: public: Certificate cert; - time::system_clock::TimePoint removalTime; + time::system_clock::time_point removalTime; }; /** @@ -116,33 +115,34 @@ private: 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 + boost::multi_index::member >, boost::multi_index::ordered_unique< boost::multi_index::const_mem_fun > > - > 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 06c6a572..c7df4f26 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 @@ CertificateFetcherDirectFetch::doFetch(const shared_ptr& key } } -} // 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 0ec8bb5b..f11a6625 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 @@ private: 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 65c70c95..0861c0d8 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 @@ CertificateFetcherFromNetwork::timeoutCallback(const shared_ptr& certRequest, @@ -36,6 +34,4 @@ CertificateFetcherOffline::doFetch(const shared_ptr& certReq "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 84412ebb..55c9a86c 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 @@ protected: 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 931b83e5..408c61d4 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 @@ CertificateFetcher::fetch(const shared_ptr& certRequest, }); } -} // 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 fa4b9eb6..541342e6 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 @@ protected: 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 bb270ddd..2aa92016 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 @@ public: 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 95a2cb4f..9e9a37c1 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 @@ CertificateStorage::getUnverifiedCertCache() const 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 0f5a1262..dbb72e04 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 @@ protected: 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 67706fd8..ac74913e 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 @@ Certificate::getValidityPeriod() const } 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 @@ extractKeyNameFromCertName(const Name& certName) 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 b533494a..80613612 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 @@ public: * @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 @@ extractIdentityFromCertName(const Name& certName); 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 c66a50b1..362da2e3 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 @@ CertificateBundleDecoder::decode() } } -} // 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 17f88ca7..61ed8259 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 @@ public: /** * @brief Emitted every time a certificate is successfully decoded. */ - util::Signal onCertDecoded; + signal::Signal onCertDecoded; private: void @@ -69,8 +68,6 @@ private: 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 0b14fa1e..5abf6bea 100644 --- a/ndn-cxx/security/impl/openssl-helper.cpp +++ b/ndn-cxx/security/impl/openssl-helper.cpp @@ -23,9 +23,7 @@ #include -namespace ndn { -namespace security { -namespace detail { +namespace ndn::security::detail { const EVP_MD* digestAlgorithmToEvpMd(DigestAlgorithm algo) @@ -123,6 +121,4 @@ Bio::write(span buf) noexcept return n >= 0 && static_cast(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 e3483919..28632772 100644 --- a/ndn-cxx/security/impl/openssl-helper.hpp +++ b/ndn-cxx/security/impl/openssl-helper.hpp @@ -27,9 +27,7 @@ #include #include -namespace ndn { -namespace security { -namespace detail { +namespace ndn::security::detail { [[nodiscard]] const EVP_MD* digestAlgorithmToEvpMd(DigestAlgorithm algo); @@ -96,8 +94,6 @@ private: 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 5b12c834..ae6fe9d6 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 @@ InterestSigner::makeCommandInterest(Name name, const SigningInfo& params) return interest; } -time::system_clock::TimePoint +time::system_clock::time_point InterestSigner::getFreshTimestamp() { auto timestamp = time::system_clock::now(); @@ -87,5 +86,4 @@ InterestSigner::getFreshTimestamp() 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 76d73f5c..e47e7049 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 @@ private: /** * @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 2e270862..16f6c421 100644 --- a/ndn-cxx/security/key-chain.cpp +++ b/ndn-cxx/security/key-chain.cpp @@ -46,8 +46,9 @@ #include #include // 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(BackEndFile); 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 @@ KeyChain::getSignatureType(KeyType keyType, DigestAlgorithm) } } -} // 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 4257cae6..93787be6 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 @@ struct MakeCertificateOptions std::optional validity; }; -inline namespace v2 { - /** * @brief The main interface for signing key management. * @@ -515,6 +515,12 @@ private: 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 @@ public: \ } \ } 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 24f66ced..873e37dd 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 @@ CertificateContainer::isConsistent() const 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 52b4520d..7c984687 100644 --- a/ndn-cxx/security/pib/certificate-container.hpp +++ b/ndn-cxx/security/pib/certificate-container.hpp @@ -28,16 +28,10 @@ #include #include -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 @@ private: const Name m_keyName; const shared_ptr 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 6afeae01..8d80b954 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 @@ IdentityContainer::add(const Name& identityName) NDN_LOG_DEBUG("Adding " << identityName); m_pib->addIdentity(identityName); auto ret = m_identities.emplace(identityName, - std::make_shared(identityName, m_pib)); + std::make_shared(identityName, m_pib)); // consistency check BOOST_ASSERT(ret.second); @@ -112,7 +110,7 @@ IdentityContainer::get(const Name& identityName) const NDN_THROW(Pib::Error("Identity `" + identityName.toUri() + "` does not exist")); } - auto id = std::make_shared(identityName, m_pib); + auto id = std::make_shared(identityName, m_pib); m_identities[identityName] = id; return Identity(id); } @@ -131,6 +129,4 @@ IdentityContainer::isConsistent() const 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 75fe3f40..786c7ba4 100644 --- a/ndn-cxx/security/pib/identity-container.hpp +++ b/ndn-cxx/security/pib/identity-container.hpp @@ -28,17 +28,10 @@ #include #include -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: // private interface for Pib NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE: // cache of loaded IdentityImpl - mutable std::unordered_map> m_identities; + mutable std::unordered_map> m_identities; private: NameSet m_identityNames; const shared_ptr 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 41e103b3..c141aa72 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 impl) noexcept +Identity::Identity(weak_ptr impl) noexcept : m_impl(std::move(impl)) { } @@ -86,7 +84,7 @@ Identity::operator bool() const noexcept return !m_impl.expired(); } -shared_ptr +shared_ptr Identity::lock() const { auto impl = m_impl.lock(); @@ -103,6 +101,4 @@ Identity::equals(const Identity& other) const noexcept !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 31acd9bd..b39335b3 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: // write operations are accessible only NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE: // private interface for IdentityContainer explicit - Identity(weak_ptr impl) noexcept; + Identity(weak_ptr impl) noexcept; private: /** @@ -151,7 +145,7 @@ private: * @return a shared_ptr when the instance is valid * @throw std::domain_error the instance is invalid */ - shared_ptr + shared_ptr lock() const; bool @@ -183,7 +177,7 @@ private: } private: - weak_ptr m_impl; + weak_ptr m_impl; friend KeyChain; friend IdentityContainer; @@ -193,7 +187,6 @@ private: 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 0256c540..8c19088b 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 @@ IdentityImpl::getDefaultKey() const 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 36f7a3f2..553dbad4 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 @@ private: 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 23b6303f..85fc3220 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 @@ KeyImpl::getDefaultCertificate() const 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 b6d73c64..74767e67 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 @@ private: mutable std::optional 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 973d9d68..c75ffe38 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 #include -namespace ndn { -namespace security { -namespace pib { +namespace ndn::security::pib { PibMemory::PibMemory(const std::string&) { @@ -263,6 +261,4 @@ PibMemory::getDefaultCertificateOfKey(const Name& keyName) const 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 a2e7abdf..94fddb34 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 @@ private: std::map 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 514f6dec..938eadad 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 #include -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 @@ PibSqlite3::hasDefaultCertificateOfKey(const Name& keyName) const 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 783a6a7b..9313b264 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 @@ private: 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 c13c1335..94084cec 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 @@ KeyContainer::add(span keyBits, const Name& keyName) NDN_LOG_DEBUG((isNew ? "Adding " : "Replacing ") << keyName); m_pib->addKey(m_identity, keyName, keyBits); - auto key = std::make_shared(keyName, Buffer(keyBits.begin(), keyBits.end()), m_pib); + auto key = std::make_shared(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 @@ KeyContainer::get(const Name& keyName) const // because getKeyBits will throw if it doesn't auto keyBits = m_pib->getKeyBits(keyName); - auto key = std::make_shared(keyName, std::move(keyBits), m_pib); + auto key = std::make_shared(keyName, std::move(keyBits), m_pib); m_keys[keyName] = key; return Key(key); } @@ -131,6 +129,4 @@ KeyContainer::isConsistent() const 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 cb9b2113..2b9b36cf 100644 --- a/ndn-cxx/security/pib/key-container.hpp +++ b/ndn-cxx/security/pib/key-container.hpp @@ -28,17 +28,10 @@ #include #include -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: // private interface for IdentityImpl NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE: // cache of loaded KeyImpl - mutable std::unordered_map> m_keys; + mutable std::unordered_map> m_keys; private: NameSet m_keyNames; const Name m_identity; const shared_ptr 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 8dbb35e6..69f96d0a 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 impl) noexcept +Key::Key(weak_ptr impl) noexcept : m_impl(std::move(impl)) { } @@ -104,7 +103,7 @@ Key::operator bool() const noexcept return !m_impl.expired(); } -shared_ptr +shared_ptr Key::lock() const { auto impl = m_impl.lock(); @@ -123,8 +122,6 @@ Key::equals(const Key& other) const noexcept } // namespace pib -inline namespace v2 { - Name constructKeyName(const Name& identity, const name::Component& keyId) { @@ -151,6 +148,4 @@ extractIdentityFromKeyName(const Name& keyName) 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 124ddc57..bd548fab 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: // write operations are accessible only NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE: // private interface for KeyContainer explicit - Key(weak_ptr impl) noexcept; + Key(weak_ptr impl) noexcept; private: /** @@ -170,7 +164,7 @@ private: * @return a shared_ptr when the instance is valid * @throw std::domain_error the instance is invalid */ - shared_ptr + shared_ptr lock() const; bool @@ -202,7 +196,7 @@ private: } private: - weak_ptr m_impl; + weak_ptr m_impl; friend KeyChain; friend KeyContainer; @@ -212,8 +206,6 @@ private: using pib::Key; -inline namespace v2 { - /** * @brief Construct key name based on the appropriate naming conventions */ @@ -232,8 +224,6 @@ isValidKeyName(const Name& keyName); 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 3cad8e43..115b24ea 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 -namespace ndn { -namespace security { -namespace pib { +namespace ndn::security::pib { /** * @brief PIB backend interface. @@ -276,8 +274,6 @@ public: // Certificate Management 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 8fb52cca..0810ba87 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 @@ Pib::getDefaultIdentity() const 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 4ae4c8d7..331bb792 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 @@ private: 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 b6e69972..6662980e 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 @@ SafeBag::wireDecode(const Block& wire) } } -} // namespace security -} // namespace ndn +} // namespace ndn::security diff --git a/ndn-cxx/security/safe-bag.hpp b/ndn-cxx/security/safe-bag.hpp index 3e580a3b..0d402ca2 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 @@ private: 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 aedee38c..8100a7c4 100644 --- a/ndn-cxx/security/security-common.hpp +++ b/ndn-cxx/security/security-common.hpp @@ -31,11 +31,15 @@ namespace ndn { 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 @@ inline constexpr size_t MIN_SIZE = 2; 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 a81097f7..14c184e2 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 @@ signingWithSha256() 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 1fd152f7..d5876061 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 @@ operator<<(std::ostream& os, const SignedInterestFormat& format) 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 1cf56fa3..b9d45f2a 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 @@ operator<<(std::ostream& os, const SigningInfo& si); 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 f8f450a8..d336b0b2 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 -namespace ndn { -namespace security { -namespace tpm { +namespace ndn::security::tpm { BackEnd::~BackEnd() = default; @@ -170,6 +168,4 @@ BackEnd::unlockTpm(const char* pw, size_t pwLen) const 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 dfe50cda..b66d267b 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 @@ private: // pure virtual methods doImportKey(const Name& keyName, shared_ptr 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 8bf11b4a..4c466d14 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 #include -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 @@ BackEndFile::saveKey(const Name& keyName, const PrivateKey& key) ::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 6841681a..18657ddb 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 @@ private: }; } // 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 ec9828b9..e69dd199 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 -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 @@ BackEndMem::doImportKey(const Name& keyName, shared_ptr k 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 176833b4..37603084 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 @@ private: const unique_ptr 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 654d957a..0567655f 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 -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 @@ BackEndOsx::doImportKey(const Name& keyName, shared_ptr k 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 eda536ea..706bca4b 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 @@ private: const unique_ptr 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 9a801e33..3455c3fd 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 key) : m_key(std::move(key)) @@ -72,6 +70,4 @@ KeyHandleMem::doDerivePublicKey() const 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 07516dab..22bcbcac 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 @@ private: }; } // 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 db43fa43..623529c2 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 @@ KeyHandleOsx::doDerivePublicKey() const 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 49bd6557..40f17628 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 @@ private: 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 88345b23..c3ad98d6 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 -namespace ndn { -namespace security { -namespace tpm { +namespace ndn::security::tpm { using KeyRefOsx = detail::CFReleaser; -} // 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 13af2b0b..4e18fe58 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 @@ KeyHandle::derivePublicKey() const 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 d718e54c..3b3161ff 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 @@ private: 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 ded3ca89..9e150dea 100644 --- a/ndn-cxx/security/tpm/tpm.cpp +++ b/ndn-cxx/security/tpm/tpm.cpp @@ -25,9 +25,7 @@ #include -namespace ndn { -namespace security { -namespace tpm { +namespace ndn::security::tpm { Tpm::Tpm(const std::string& locator, unique_ptr backEnd) : m_locator(locator) @@ -150,6 +148,4 @@ Tpm::findKey(const Name& keyName) const 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 1ffdeb1e..feae7930 100644 --- a/ndn-cxx/security/tpm/tpm.hpp +++ b/ndn-cxx/security/tpm/tpm.hpp @@ -29,16 +29,13 @@ #include #include -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 @@ private: 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 e9a3f08a..1554ccb2 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 #include -namespace ndn { -namespace security { -namespace transform { +namespace ndn::security::transform { class Base64Decode::Impl : boost::noncopyable { @@ -128,6 +126,4 @@ base64Decode(bool expectNewlineEvery64Bytes) return make_unique(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 38949d3f..b2aa0fb7 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 @@ private: unique_ptr 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 5383a8f6..af564086 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 #include -namespace ndn { -namespace security { -namespace transform { +namespace ndn::security::transform { class Base64Encode::Impl : boost::noncopyable { @@ -131,6 +129,4 @@ base64Encode(bool needBreak) return make_unique(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 1c093762..874fda0c 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 @@ private: unique_ptr 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 bc881f19..e7cddc0f 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 -namespace ndn { -namespace security { -namespace transform { +namespace ndn::security::transform { class BlockCipher::Impl : boost::noncopyable { @@ -164,6 +162,4 @@ blockCipher(BlockCipherAlgorithm algo, CipherOperator op, return make_unique(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 ecde4e75..78d5bef6 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 @@ unique_ptr blockCipher(BlockCipherAlgorithm algo, CipherOperator op, span key, span 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 c57cf77c..3a86a0e4 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 @@ boolSink(bool& value) return make_unique(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 827019aa..bf4b4df2 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 @@ private: unique_ptr 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 8333368f..c345e030 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 buffer) : m_bufs({buffer}) @@ -55,6 +53,4 @@ BufferSource::doPump() 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 7d87320e..bd0c34a0 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 @@ private: 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 64620754..89e4917b 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 -namespace ndn { -namespace security { -namespace transform { +namespace ndn::security::transform { class DigestFilter::Impl { @@ -78,6 +76,4 @@ digestFilter(DigestAlgorithm algo) return make_unique(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 30f96ece..26a2851b 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 @@ private: unique_ptr 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 6970a657..9cbccf7c 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 @@ hexDecode() return make_unique(); } -} // 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 43c7e719..72ffb18b 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 @@ private: unique_ptr 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 204466f7..0a9da8de 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 @@ hexEncode(bool useUpperCase) return make_unique(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 71031e82..4d334b48 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 @@ private: unique_ptr 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 53501a96..0acb648e 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 @@ generatePrivateKey(const KeyParams& keyParams) } } -} // 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 3890a102..271ffd45 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 @@ namespace ndn { class KeyParams; -namespace security { -namespace transform { +namespace security::transform { /** * @brief Abstraction of private key in crypto transformation @@ -290,8 +289,7 @@ private: unique_ptr 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 32916288..599fcc90 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 @@ PublicKey::rsaEncrypt(span plainText) const 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 bd1a0c86..b0b3104d 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 @@ private: const unique_ptr 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 036a16bb..2c25f5eb 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 -namespace ndn { -namespace security { -namespace transform { +namespace ndn::security::transform { class SignerFilter::Impl { @@ -85,6 +83,4 @@ signerFilter(DigestAlgorithm algo, const PrivateKey& key) return make_unique(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 842ba109..e01705e3 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 @@ private: unique_ptr 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 cfeac7a5..16376e38 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 buf) @@ -42,6 +40,4 @@ StepSource::doPump() { } -} // 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 2c082608..40d05480 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 @@ private: 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 c35e196c..496a39ce 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 -namespace ndn { -namespace security { -namespace transform { +namespace ndn::security::transform { StreamSink::StreamSink(std::ostream& os) : m_os(os) @@ -55,6 +53,4 @@ streamSink(std::ostream& os) return make_unique(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 d2e6e32e..3ad37bdf 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 @@ private: unique_ptr 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 10e5fa6b..c9674e9f 100644 --- a/ndn-cxx/security/transform/stream-source.cpp +++ b/ndn-cxx/security/transform/stream-source.cpp @@ -24,9 +24,7 @@ #include #include -namespace ndn { -namespace security { -namespace transform { +namespace ndn::security::transform { StreamSource::StreamSource(std::istream& is, size_t bufferSize) : Source() @@ -65,6 +63,4 @@ StreamSource::doPump() 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 886066bf..02a66e42 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 @@ private: 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 94654008..12b43d9c 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 @@ stripSpace(const char* whitespaces) return make_unique(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 f01e9362..1c1e119e 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 #include -namespace ndn { -namespace security { -namespace transform { +namespace ndn::security::transform { /** * \brief Strip whitespace characters from a stream. @@ -60,8 +58,6 @@ private: unique_ptr 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 731b22c5..2abcfb42 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 @@ Source::operator>>(unique_ptr sink) 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 faf96be7..15548c72 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 -namespace ndn { -namespace security { -namespace transform { +namespace ndn::security::transform { /** * @file @@ -318,8 +316,6 @@ private: 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 4d4c6f0d..4893c4c7 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 -namespace ndn { -namespace security { -namespace transform { +namespace ndn::security::transform { class VerifierFilter::Impl { @@ -135,6 +133,4 @@ verifierFilter(DigestAlgorithm algo, const PrivateKey& key, span return make_unique(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 d5072f6f..da2ae10f 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 @@ verifierFilter(DigestAlgorithm algo, const PublicKey& key, span s unique_ptr verifierFilter(DigestAlgorithm algo, const PrivateKey& key, span 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 ccd123a7..93856bf8 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 @@ TrustAnchorContainer::refresh() } } -} // 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 18afa362..6fe208dd 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 #include -namespace ndn { -namespace security { -inline namespace v2 { +namespace ndn::security { /** * @brief A container for trust anchors. @@ -172,8 +170,6 @@ private: 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 565c7608..d3eaf920 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 #include -namespace ndn { -namespace security { -inline namespace v2 { +namespace ndn::security { NDN_LOG_INIT(ndn.security.TrustAnchorGroup); @@ -141,6 +139,4 @@ DynamicTrustAnchorGroup::refresh() } } -} // 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 7c7198e3..afd5aa25 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 #include -namespace ndn { -namespace security { -inline namespace v2 { +namespace ndn::security { class CertContainerInterface { @@ -160,11 +158,9 @@ private: 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 8e00c332..ef7d8d2b 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 InterestValidationSuccessCallback = std::function; */ using InterestValidationFailureCallback = std::function; -} // 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 7ab3abe2..82ec2f78 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 @@ ValidationError::print(std::ostream& os) const } } -} // 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 07a1aaa8..9adac226 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 @@ private: 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 623a57f3..a877ad16 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 @@ public: } }; -} // 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 adf8bd10..ddae489d 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 inner, const Options& options) @@ -171,6 +169,4 @@ ValidationPolicyCommandInterest::insertNewRecord(const Name& keyName, time::syst } } -} // 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 d8fe1d00..959b80ec 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 #include -namespace ndn { -namespace security { -inline namespace v2 { +namespace ndn::security { /** * @brief Validation policy for stop-and-wait command Interests. @@ -114,7 +112,7 @@ protected: const ValidationContinuation& continueValidation) override; private: - static std::tuple + static std::tuple parseCommandInterest(const Interest& interest, const shared_ptr& state); void @@ -122,10 +120,10 @@ private: bool checkTimestamp(const shared_ptr& 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 @@ private: 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 @@ private: 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 45bc867e..29d0a86c 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 -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 @@ ValidationPolicyConfig::checkPolicy(const Interest& interest, const shared_ptr inner, const Options& options) @@ -142,7 +140,7 @@ ValidationPolicySignedInterest::checkIncomingInterest(const shared_ptr timestamp, + std::optional timestamp, std::optional seqNum, std::optional nonce) { @@ -185,6 +183,4 @@ ValidationPolicySignedInterest::insertRecord(const Name& keyName, } } -} // 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 92365cd9..39b5cc70 100644 --- a/ndn-cxx/security/validation-policy-signed-interest.hpp +++ b/ndn-cxx/security/validation-policy-signed-interest.hpp @@ -30,9 +30,7 @@ #include #include -namespace ndn { -namespace security { -inline namespace v2 { +namespace ndn::security { /** * @brief Validation policy for signed Interests. @@ -158,7 +156,7 @@ private: void insertRecord(const Name& keyName, - std::optional timestamp, + std::optional timestamp, std::optional seqNum, std::optional nonce); @@ -181,7 +179,7 @@ private: struct LastInterestRecord { LastInterestRecord(const Name& keyName, - std::optional timestamp, + std::optional timestamp, std::optional seqNum) : keyName(keyName) , timestamp(timestamp) @@ -191,10 +189,10 @@ private: } Name keyName; - std::optional timestamp; + std::optional timestamp; std::optional seqNum; NonceContainer observedNonces; - time::steady_clock::TimePoint lastRefreshed; + time::steady_clock::time_point lastRefreshed; }; using Container = boost::multi_index_container< @@ -204,7 +202,7 @@ private: boost::multi_index::member >, boost::multi_index::ordered_non_unique< - boost::multi_index::member > > @@ -215,8 +213,6 @@ private: 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 6b5937fa..15c06d6c 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& state, @@ -83,6 +81,4 @@ ValidationPolicySimpleHierarchy::checkPolicy(const Interest& interest, const sha continueValidation(make_shared(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 aa0b5938..0459ec15 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 @@ public: 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 97a839b6..d713e1e5 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 innerPolicy) @@ -132,6 +130,4 @@ extractIdentityNameFromKeyLocator(const Name& keyLocator) "` 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 f49670a7..8025bb57 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 @@ getKeyLocatorName(const SignatureInfo& sigInfo, ValidationState& state); 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 6fa2c966..cbb61d6d 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 @@ InterestValidationState::fail(const ValidationError& error) 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 de169153..3ce5f570 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 #include #include -namespace ndn { -namespace security { -inline namespace v2 { +namespace ndn::security { class Validator; @@ -239,7 +237,7 @@ public: } public: - util::Signal afterSuccess; + signal::Signal afterSuccess; private: void @@ -256,8 +254,6 @@ private: using SignedInterestFormatTag = SimpleTag; -} // 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 cb19348d..5cedf50f 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 fetcher, const CommandInterestOptions& ciOptions, @@ -70,5 +69,4 @@ ValidatorConfig::load(const validator_config::ConfigSection& configSection, 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 c11b477d..11f1da9f 100644 --- a/ndn-cxx/security/validator-config/checker.cpp +++ b/ndn-cxx/security/validator-config/checker.cpp @@ -25,10 +25,7 @@ #include -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 @@ Checker::createKeyLocatorNameChecker(tlv::SignatureTypeValue sigType, } } -} // 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 11560119..5e04e5e2 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 @@ private: }; } // 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 93653ba7..d4b1c9d3 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 -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 @@ public: 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 7421813b..ea23f5e6 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 -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& state) @@ -156,7 +153,4 @@ Filter::createNameFilter(const ConfigSection& configSection, const std::string& } } -} // 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 41113f71..5c8286bf 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 @@ private: }; } // 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 05804d12..870b44e3 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 -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 @@ getNameRelationFromString(const std::string& relationString) } } -} // 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 8559770b..97b842ac 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 @@ checkNameRelation(NameRelation relation, const Name& name1, const Name& name2); 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 3382e58b..b60aa109 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 -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 @@ Rule::create(const ConfigSection& configSection, const std::string& configFilena 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 e2d3daf1..304d4d70 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 @@ NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE: }; } // 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 35c66cf5..8e500654 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(), make_unique()) @@ -39,6 +37,4 @@ getAcceptAllValidator() 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 58fd1f8c..fc14edf4 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 @@ public: 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 fd9817f3..ca829f9e 100644 --- a/ndn-cxx/security/validator.cpp +++ b/ndn-cxx/security/validator.cpp @@ -24,9 +24,7 @@ #include -namespace ndn { -namespace security { -inline namespace v2 { +namespace ndn::security { NDN_LOG_INIT(ndn.security.Validator); @@ -198,6 +196,4 @@ Validator::resetVerifiedCertificates() 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 f08585de..d2f5fcb5 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 @@ namespace ndn { class Face; namespace security { -inline namespace v2 { /** * @brief Interface for validating data and interest packets. @@ -204,7 +203,6 @@ private: 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 c7f5b5d2..1c911a8e 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 @@ constexpr size_t NOT_AFTER_OFFSET = 1; 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(notBefore + TimePoint::duration(1) - - time::system_clock::TimePoint::duration(1))) + time::system_clock::time_point::duration(1))) , m_notAfter(time_point_cast(notAfter)) { } @@ -126,24 +125,24 @@ ValidityPeriod::wireDecode(const Block& wire) } 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(notBefore + TimePoint::duration(1) - - time::system_clock::TimePoint::duration(1)); + time::system_clock::time_point::duration(1)); m_notAfter = time_point_cast(notAfter); return *this; } -std::pair +std::pair 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 @@ operator<<(std::ostream& os, const ValidityPeriod& period) 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 97bc47c3..4a9f69ea 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 @@ public: */ 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 @@ public: * - @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 @@ public: * - @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 + std::pair getPeriod() const; /** @brief Fast encoding or block size estimation @@ -146,7 +145,6 @@ NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(ValidityPeriod); 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 0a339f38..37fe8387 100644 --- a/ndn-cxx/security/verification-helpers.cpp +++ b/ndn-cxx/security/verification-helpers.cpp @@ -36,8 +36,7 @@ #include -namespace ndn { -namespace security { +namespace ndn::security { namespace { @@ -261,5 +260,4 @@ verifySignature(const Interest& interest, const tpm::Tpm& tpm, 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 ee8c9ec8..83ae1374 100644 --- a/ndn-cxx/security/verification-helpers.hpp +++ b/ndn-cxx/security/verification-helpers.hpp @@ -44,9 +44,7 @@ namespace transform { 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 1b47f491..0ee10359 100644 --- a/ndn-cxx/transport/detail/stream-transport-impl.hpp +++ b/ndn-cxx/transport/detail/stream-transport-impl.hpp @@ -30,8 +30,7 @@ #include #include -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 @@ protected: 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 61c7d279..8d0de0c9 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 @@ private: } }; -} // 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 51fd77e9..1f278e59 100644 --- a/ndn-cxx/util/dummy-client-face.cpp +++ b/ndn-cxx/util/dummy-client-face.cpp @@ -30,7 +30,6 @@ #include namespace ndn { -namespace util { class DummyClientFace::Transport final : public ndn::Transport { @@ -66,7 +65,7 @@ public: } public: - Signal onSendBlock; + signal::Signal onSendBlock; }; struct DummyClientFace::BroadcastLink @@ -324,5 +323,4 @@ DummyClientFace::doProcessEvents(time::milliseconds timeout, bool keepThread) } } -} // namespace util } // namespace ndn diff --git a/ndn-cxx/util/dummy-client-face.hpp b/ndn-cxx/util/dummy-client-face.hpp index 22a80d87..62c0ba91 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 @@ public: * * After .expressInterest, .processEvents must be called before this signal would be emitted. */ - Signal onSendInterest; + signal::Signal onSendInterest; /** \brief Emits whenever a Data packet is sent. * * After .put, .processEvents must be called before this signal would be emitted. */ - Signal onSendData; + signal::Signal onSendData; /** \brief Emits whenever a Nack is sent. * * After .put, .processEvents must be called before this signal would be emitted. */ - Signal onSendNack; + signal::Signal onSendNack; NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE: struct BroadcastLink; @@ -198,7 +199,11 @@ NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE: std::function 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 d1436920..684fc751 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 -namespace ndn { -namespace exception { +namespace ndn::exception { #ifdef NDN_CXX_HAVE_STACKTRACE std::string @@ -41,5 +40,4 @@ to_string(const errinfo_stacktrace& x) } #endif -} // namespace exception -} // namespace ndn +} // namespace ndn::exception diff --git a/ndn-cxx/util/exception.hpp b/ndn-cxx/util/exception.hpp index a8cd3266..dadb6973 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 #endif -namespace ndn { -namespace exception { +namespace ndn::exception { #ifdef NDN_CXX_HAVE_STACKTRACE using errinfo_stacktrace = boost::error_info; @@ -46,8 +45,7 @@ std::string 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 bcfeef5e..76aef0fa 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 -namespace ndn { -namespace util { -namespace detail { +namespace ndn::util::detail { class AndroidSinkBackend : public boost::log::sinks::basic_sink_backend { @@ -72,6 +70,4 @@ makeAndroidLogger() return boost::make_shared>(); } -} // 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 e31402da..4a94e17c 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 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 d4219a0a..75f374e6 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 #include -namespace boost { -namespace asio { +namespace boost::asio { template<> struct wait_traits @@ -40,12 +39,9 @@ struct wait_traits } }; -} // namespace asio -} // namespace boost +} // namespace boost::asio -namespace ndn { -namespace util { -namespace detail { +namespace ndn::detail { class SteadyTimer : public boost::asio::basic_waitable_timer { @@ -53,8 +49,6 @@ public: using boost::asio::basic_waitable_timer::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 e178c13a..00672dbb 100644 --- a/ndn-cxx/util/indented-stream.cpp +++ b/ndn-cxx/util/indented-stream.cpp @@ -27,8 +27,7 @@ #include #include -namespace ndn { -namespace util { +namespace ndn::util { IndentedStream::IndentedStream(std::ostream& os, std::string_view indent) : std::ostream(&m_buffer) @@ -66,5 +65,4 @@ IndentedStream::StreamBuf::sync() 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 b2d5059a..5bb0395d 100644 --- a/ndn-cxx/util/indented-stream.hpp +++ b/ndn-cxx/util/indented-stream.hpp @@ -26,8 +26,7 @@ #include #include -namespace ndn { -namespace util { +namespace ndn::util { /** * @brief Output to stream with specified indent or prefix @@ -76,7 +75,6 @@ private: 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 663c4e00..c40ebe92 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 loadBuffer(std::istream& is, IoEncoding encoding) @@ -84,5 +83,4 @@ saveBuffer(span buf, std::ostream& os, IoEncoding encoding) 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 3500507d..b4399862 100644 --- a/ndn-cxx/util/io.hpp +++ b/ndn-cxx/util/io.hpp @@ -27,8 +27,7 @@ #include -namespace ndn { -namespace io { +namespace ndn::io { class Error : public std::runtime_error { @@ -201,7 +200,6 @@ save(const T& obj, const std::string& filename, IoEncoding encoding = BASE64) 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 c9bea26b..f2d3d07c 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 @@ Logger::registerModuleName(const char* name) 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 3261b856..abee1171 100644 --- a/ndn-cxx/util/logger.hpp +++ b/ndn-cxx/util/logger.hpp @@ -34,8 +34,7 @@ #include -namespace ndn { -namespace util { +namespace ndn::util { /** * \brief Indicates the severity level of a log message. @@ -277,8 +276,7 @@ using ArgumentType = typename ExtractArgument::type; */ #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 b6ffe7db..0dbdf81f 100644 --- a/ndn-cxx/util/logging.cpp +++ b/ndn-cxx/util/logging.cpp @@ -42,8 +42,7 @@ #include #include -namespace ndn { -namespace util { +namespace ndn::util { namespace log { static std::string @@ -339,5 +338,4 @@ Logging::flushImpl() } } -} // namespace util -} // namespace ndn +} // namespace ndn::util diff --git a/ndn-cxx/util/logging.hpp b/ndn-cxx/util/logging.hpp index 644bf774..169096a1 100644 --- a/ndn-cxx/util/logging.hpp +++ b/ndn-cxx/util/logging.hpp @@ -33,8 +33,7 @@ #include #include -namespace ndn { -namespace util { +namespace ndn::util { enum class LogLevel; class Logger; @@ -221,8 +220,7 @@ Logging::flush() 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 de374982..dceba069 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 @@ private: 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 deaf8bef..4a13240c 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 -namespace ndn { -namespace util { +namespace ndn::util { NotificationSubscriberBase::NotificationSubscriberBase(Face& face, const Name& prefix, time::milliseconds interestLifetime) @@ -188,5 +187,4 @@ NotificationSubscriberBase::exponentialBackoff(lp::Nack nack) 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 3b78fdb9..0191b7b7 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 @@ private: public: /** \brief Fires when a Nack is received. */ - signal::Signal onNack; + Signal onNack; /** \brief Fires when no Notification is received within getInterestLifetime() period. */ - signal::Signal onTimeout; + Signal onTimeout; /** \brief Fires when a Data packet in the Notification Stream cannot be decoded as Notification. */ - signal::Signal onDecodeError; + Signal onDecodeError; private: Face& m_face; @@ -168,7 +167,7 @@ public: /** \brief Fires when a Notification is received. * \note Removing all handlers will cause the subscriber to stop. */ - signal::Signal onNotification; + Signal onNotification; private: bool @@ -187,13 +186,11 @@ private: 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 0eec6248..529fc690 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 #include -namespace ndn { -namespace random { +namespace ndn::random { uint32_t generateSecureWord32() @@ -78,5 +77,4 @@ generateWord64() 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 be32ea15..cf03cc3f 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 -namespace ndn { -namespace random { +namespace ndn::random { /** * @brief Generate a cryptographically secure random integer from the range [0, 2^32) @@ -85,7 +84,6 @@ generateWord32(); 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 04310d2f..3fb2cb52 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 options) : m_options(options ? std::move(options) : make_shared()) @@ -81,5 +80,4 @@ RttEstimatorWithStats::addMeasurement(time::nanoseconds rtt, size_t nExpectedSam 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 ba3255c7..355a314b 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 @@ private: 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 b8a96911..ecc9c7f6 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: 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::EventQueueCompare::operator()(const shared_ptr& a, } Scheduler::Scheduler(boost::asio::io_service& ioService) - : m_timer(make_unique(ioService)) + : m_timer(make_unique(ioService)) { } @@ -165,5 +164,4 @@ Scheduler::executeEvent(const boost::system::error_code& error) } } -} // namespace scheduler -} // namespace ndn +} // namespace ndn::scheduler diff --git a/ndn-cxx/util/scheduler.hpp b/ndn-cxx/util/scheduler.hpp index 547345a9..b5dd9087 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 @@ private: using EventQueue = std::multiset, EventQueueCompare>; EventQueue m_queue; - unique_ptr m_timer; + unique_ptr 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 727b8364..b570a7b1 100644 --- a/ndn-cxx/util/segment-fetcher.cpp +++ b/ndn-cxx/util/segment-fetcher.cpp @@ -35,7 +35,6 @@ #include namespace ndn { -namespace util { void SegmentFetcher::Options::validate() @@ -64,7 +63,7 @@ SegmentFetcher::SegmentFetcher(Face& face, , m_face(face) , m_scheduler(m_face.getIoService()) , m_validator(validator) - , m_rttEstimator(make_shared(options.rttOptions)) + , m_rttEstimator(make_shared(options.rttOptions)) , m_timeLastSegmentReceived(time::steady_clock::now()) , m_cwnd(options.initCwnd) , m_ssthresh(options.initSsthresh) @@ -520,5 +519,4 @@ SegmentFetcher::getEstimatedRto() time::duration_cast(m_rttEstimator.getEstimatedRto())); } -} // namespace util } // namespace ndn diff --git a/ndn-cxx/util/segment-fetcher.hpp b/ndn-cxx/util/segment-fetcher.hpp index 9e7476b5..202afffe 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 #include namespace ndn { -namespace util { /** * @brief Utility class to fetch the latest version of a segmented object. @@ -72,9 +71,9 @@ namespace util { * * 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 @@ public: double initSsthresh = std::numeric_limits::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 @@ public: * @brief Emitted upon successful retrieval of the complete object (all segments). * @note Emitted only if SegmentFetcher is operating in 'block' mode. */ - Signal onComplete; + signal::Signal 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 onError; + signal::Signal onError; /** * @brief Emitted whenever a data segment received. */ - Signal afterSegmentReceived; + signal::Signal afterSegmentReceived; /** * @brief Emitted whenever a received data segment has been successfully validated. */ - Signal afterSegmentValidated; + signal::Signal afterSegmentValidated; /** * @brief Emitted whenever an Interest for a data segment is nacked. */ - Signal afterSegmentNacked; + signal::Signal afterSegmentNacked; /** * @brief Emitted whenever an Interest for a data segment times out. */ - Signal afterSegmentTimedOut; + signal::Signal 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 onInOrderData; + signal::Signal 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 onInOrderComplete; + signal::Signal onInOrderComplete; private: enum class SegmentState { @@ -284,7 +283,7 @@ private: { public: SegmentState state; - time::steady_clock::TimePoint sendTime; + time::steady_clock::time_point sendTime; ScopedPendingInterestHandle hdl; scheduler::ScopedEventId timeoutEvent; }; @@ -298,9 +297,9 @@ NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE: 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 m_retxQueue; Name m_versionedDataName; uint64_t m_nextSegmentNum = 0; @@ -320,7 +319,11 @@ NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE: std::set 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 75962c03..fe6263e2 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 namespace ndn { -namespace util { Segmenter::Segmenter(KeyChain& keyChain, const security::SigningInfo& signingInfo) : m_keyChain(keyChain) @@ -113,5 +112,4 @@ Segmenter::segment(std::istream& input, const Name& dataName, size_t maxSegmentS return segments; } -} // namespace util } // namespace ndn diff --git a/ndn-cxx/util/segmenter.hpp b/ndn-cxx/util/segmenter.hpp index 8ebd1aa8..eb709858 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 @@ private: 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 66355d67..47a02bb4 100644 --- a/ndn-cxx/util/sha256.cpp +++ b/ndn-cxx/util/sha256.cpp @@ -27,8 +27,7 @@ #include -namespace ndn { -namespace util { +namespace ndn::util { Sha256::Sha256() { @@ -146,5 +145,4 @@ operator<<(std::ostream& os, Sha256& digest) return os; } -} // namespace util -} // namespace ndn +} // namespace ndn::util diff --git a/ndn-cxx/util/sha256.hpp b/ndn-cxx/util/sha256.hpp index 2e7b09cf..abf69199 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 @@ private: 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 1cc3fa57..37c11fc4 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 disconnect) noexcept : m_disconnect(std::move(disconnect)) @@ -39,6 +37,4 @@ Connection::disconnect() } } -} // 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 09522611..166b6cc4 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; -/** \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 @@ private: explicit Connection(weak_ptr disconnect) noexcept; - template + template friend class Signal; private: @@ -99,8 +98,11 @@ private: weak_ptr 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 a12aaaab..e1eb8d9b 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 @@ class DummyExtraArg { }; -} // 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 @@ class DummyExtraArg * But only argument types that are compatible with Signal declaration will work. */ #define DECLARE_SIGNAL_EMIT(signalName) \ - template \ + template \ void emit_##signalName(const TArgs&... args) \ { \ signalName(args...); \ @@ -74,6 +70,6 @@ class DummyExtraArg /** \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 1a843b17..1aa59d7f 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 @@ ScopedConnection::release() noexcept 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 9ecf5e6a..3f39e2ea 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 @@ ScopedConnection::ScopedConnection(ScopedConnection&&) noexcept = default; 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 a097f9cf..79c1f27c 100644 --- a/ndn-cxx/util/signal/signal.hpp +++ b/ndn-cxx/util/signal/signal.hpp @@ -27,9 +27,7 @@ #include -namespace ndn { -namespace util { -namespace signal { +namespace ndn::signal { class DummyExtraArg; @@ -48,19 +46,22 @@ class DummyExtraArg; * \tparam TArgs types of signal arguments * \sa signal-emit.hpp allows owner's derived classes to emit signals */ -template +template 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; - 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 @@ private: // internal implementation /** \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 @@ private: // internal implementation disconnect(typename SlotList::iterator it); }; -template -Signal::Signal() - : m_isExecuting(false) -{ -} - -template -Signal::~Signal() -{ - BOOST_ASSERT(!m_isExecuting); -} - -template +template Connection Signal::connect(Handler handler) { @@ -168,7 +157,7 @@ Signal::connect(Handler handler) return signal::Connection(it->disconnect); } -template +template Connection Signal::connectSingleShot(Handler handler) { @@ -184,7 +173,7 @@ Signal::connectSingleShot(Handler handler) return conn; } -template +template void Signal::disconnect(typename SlotList::iterator it) { @@ -204,14 +193,14 @@ Signal::disconnect(typename SlotList::iterator it) } } -template +template bool Signal::isEmpty() const { return !m_isExecuting && m_slots.empty(); } -template +template void Signal::operator()(const TArgs&... args) { @@ -240,19 +229,19 @@ Signal::operator()(const TArgs&... args) } } -template +template void Signal::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 +using Signal = ::ndn::signal::Signal; +} // 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 c7f7354c..9b32f4c0 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 -namespace ndn { -namespace util { +namespace ndn::util { Sqlite3Statement::~Sqlite3Statement() { @@ -111,5 +110,4 @@ Sqlite3Statement::operator sqlite3_stmt*() 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 4e7427a8..c31909ae 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 @@ private: 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 99c5a619..db1e977d 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 @@ void setCustomClocks(shared_ptr steadyClock = nullptr, shared_ptr 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 dd08f9fc..68354995 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 #include -namespace ndn { -namespace time { +namespace ndn::time { template UnitTestClock::UnitTestClock(nanoseconds startTime) @@ -97,5 +96,4 @@ class UnitTestClock; template class UnitTestClock; -} // 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 b148e633..2302677b 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 @@ extern template class UnitTestClock; using UnitTestSystemClock = UnitTestClock; using UnitTestSteadyClock = UnitTestClock; -} // 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 e233ca56..ba9960aa 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 #include -namespace ndn { -namespace time { +namespace ndn::time { static shared_ptr g_systemClock; static shared_ptr g_steadyClock; @@ -71,9 +70,9 @@ system_clock::from_time_t(std::time_t t) noexcept #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 @@ fromString(const std::string& timePointStr, return convertToTimePoint(ptime); } -} // namespace time -} // namespace ndn +} // namespace ndn::time -namespace boost { -namespace chrono { +namespace boost::chrono { template std::basic_string @@ -242,5 +239,4 @@ clock_string::since() template struct clock_string; template struct clock_string; -} // namespace chrono -} // namespace boost +} // namespace boost::chrono diff --git a/ndn-cxx/util/time.hpp b/ndn-cxx/util/time.hpp index b4ffd531..be50c4b8 100644 --- a/ndn-cxx/util/time.hpp +++ b/ndn-cxx/util/time.hpp @@ -33,9 +33,9 @@ namespace ndn { namespace time { template -using duration = boost::chrono::duration; +using duration = ::boost::chrono::duration; -using boost::chrono::duration_cast; +using ::boost::chrono::duration_cast; // C++20 using days = duration>; @@ -44,16 +44,17 @@ using months = duration>; using years = duration>; // 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::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::is_signed is true. */ template::is_signed>> constexpr duration @@ -68,97 +69,97 @@ inline namespace literals { 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 -operator "" _day(long double days) +operator ""_day(long double days) { return time::duration{days}; } constexpr time::days -operator "" _days(unsigned long long days) +operator ""_days(unsigned long long days) { return time::days{days}; } constexpr time::duration -operator "" _days(long double days) +operator ""_days(long double days) { return time::duration{days}; } constexpr time::hours -operator "" _h(unsigned long long hrs) +operator ""_h(unsigned long long hrs) { return time::hours{hrs}; } constexpr time::duration -operator "" _h(long double hrs) +operator ""_h(long double hrs) { return time::duration{hrs}; } constexpr time::minutes -operator "" _min(unsigned long long mins) +operator ""_min(unsigned long long mins) { return time::minutes{mins}; } constexpr time::duration -operator "" _min(long double mins) +operator ""_min(long double mins) { return time::duration{mins}; } constexpr time::seconds -operator "" _s(unsigned long long secs) +operator ""_s(unsigned long long secs) { return time::seconds{secs}; } constexpr time::duration -operator "" _s(long double secs) +operator ""_s(long double secs) { return time::duration{secs}; } constexpr time::milliseconds -operator "" _ms(unsigned long long msecs) +operator ""_ms(unsigned long long msecs) { return time::milliseconds{msecs}; } constexpr time::duration -operator "" _ms(long double msecs) +operator ""_ms(long double msecs) { return time::duration{msecs}; } constexpr time::microseconds -operator "" _us(unsigned long long usecs) +operator ""_us(unsigned long long usecs) { return time::microseconds{usecs}; } constexpr time::duration -operator "" _us(long double usecs) +operator ""_us(long double usecs) { return time::duration{usecs}; } constexpr time::nanoseconds -operator "" _ns(unsigned long long nsecs) +operator ""_ns(unsigned long long nsecs) { return time::nanoseconds{nsecs}; } constexpr time::duration -operator "" _ns(long double nsecs) +operator ""_ns(long double nsecs) { return time::duration{nsecs}; } @@ -168,10 +169,10 @@ operator "" _ns(long double nsecs) 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 @@ using namespace literals::time_literals; * * To get the current time: * - * - * const auto now = system_clock::now(); - * + * \code + * const auto now = ndn::time::system_clock::now(); + * \endcode * * To convert a time_point to/from UNIX timestamp: * - * - * system_clock::time_point time = ...; - * uint64_t timestampInMilliseconds = toUnixTimestamp(time).count(); - * system_clock::time_point time2 = fromUnixTimestamp(milliseconds(timestampInMilliseconds)); - * + * \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; - static constexpr bool is_steady = boost::chrono::system_clock::is_steady; + using time_point = ::boost::chrono::time_point; + 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 @@ public: }; /** - * \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 @@ public: 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; + using time_point = ::boost::chrono::time_point; 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 @@ fromString(const std::string& timePointStr, } // namespace time } // namespace ndn -namespace boost { -namespace chrono { +namespace boost::chrono { template struct clock_string @@ -373,7 +377,6 @@ struct clock_string extern template struct clock_string; extern template struct clock_string; -} // 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 1adb452d..a3e0b5e5 100644 --- a/tests/benchmarks/encoding-bench.cpp +++ b/tests/benchmarks/encoding-bench.cpp @@ -30,11 +30,7 @@ #include -namespace ndn { -namespace tlv { -namespace tests { - -using namespace ndn::tests; +namespace ndn::tests { template struct ReadVarNumberTest; @@ -112,7 +108,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(ReadVarNumber, Test, ReadVarNumberTests) 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 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(ReadVarNumber, Test, ReadVarNumberTests) << " " << 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 8897920b..46af278b 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 #include -namespace ndn { -namespace scheduler { -namespace tests { - -using namespace ndn::tests; +namespace ndn::tests { BOOST_AUTO_TEST_CASE(ScheduleCancel) { @@ -40,7 +36,7 @@ BOOST_AUTO_TEST_CASE(ScheduleCancel) Scheduler sched(io); const size_t nEvents = 1000000; - std::vector eventIds(nEvents); + std::vector eventIds(nEvents); auto d1 = timedExecute([&] { for (size_t i = 0; i < nEvents; ++i) { @@ -67,8 +63,8 @@ BOOST_AUTO_TEST_CASE(Execute) 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 @@ BOOST_AUTO_TEST_CASE(Execute) 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 b33873d5..7ce5a820 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 time::nanoseconds @@ -37,7 +36,6 @@ timedExecute(F&& f) 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 9357094c..7bd24085 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 -namespace ndn { -namespace tests { +namespace ndn::tests { static Name makeVeryLongName(Name prefix = Name()) @@ -377,5 +376,4 @@ BOOST_AUTO_TEST_CASE(ProcessEventsBlocksForeverWhenNothingScheduled) // Bug #395 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 0e7be109..cf6d8bdf 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 #include -namespace ndn { -namespace net { -namespace tests { +namespace ndn::tests { + +using namespace ndn::net; static std::ostream& logEvent(const shared_ptr& ni = nullptr, std::ostream& os = std::cout) @@ -66,7 +66,7 @@ BOOST_AUTO_TEST_CASE(Signals) monitor.onInterfaceAdded.connect([] (const shared_ptr& 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 @@ BOOST_AUTO_TEST_CASE(Signals) 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 @@ BOOST_AUTO_TEST_CASE(Signals) 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 7bbcf6ae..fefc7cf0 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 -namespace ndn { -namespace tests { +namespace ndn::tests { using namespace ndn::security; @@ -91,5 +90,4 @@ KeyChainFixture::saveIdentityCert(const Name& identityName, const std::string& f 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 ec1cac35..dc3a444f 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 @@ private: std::vector 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 b0d06ea0..e6c726ef 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 makeInterest(const Name& name, bool canBePrefix, std::optional lifetime, @@ -61,5 +60,4 @@ makeNack(Interest interest, lp::NackReason reason) return nack; } -} // namespace tests -} // namespace ndn +} // namespace ndn::tests diff --git a/tests/test-common.hpp b/tests/test-common.hpp index 7b74f35a..202fb188 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 @@ makeNack(Interest interest, lp::NackReason reason); * \param index the index of the name component to replace * \param args arguments to name::Component constructor */ -template +template 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)...)); 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 5778a6e6..9801c921 100644 --- a/tests/test-home-fixture.hpp +++ b/tests/test-home-fixture.hpp @@ -32,8 +32,7 @@ #include #include -namespace ndn { -namespace tests { +namespace ndn::tests { /** * @brief Fixture to adjust/restore NDN_CLIENT_PIB and NDN_CLIENT_TPM paths @@ -121,7 +120,6 @@ struct DefaultPibDir 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 3f543ff2..0efe19c3 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()) @@ -52,5 +51,4 @@ ClockFixture::advanceClocks(time::nanoseconds tick, time::nanoseconds total) } } -} // namespace tests -} // namespace ndn +} // namespace ndn::tests diff --git a/tests/unit/clock-fixture.hpp b/tests/unit/clock-fixture.hpp index 68dabbfe..a0309aee 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 @@ protected: shared_ptr 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 5706a3ee..4672a83a 100644 --- a/tests/unit/data.t.cpp +++ b/tests/unit/data.t.cpp @@ -34,8 +34,7 @@ #include -namespace ndn { -namespace tests { +namespace ndn::tests { BOOST_CONCEPT_ASSERT((boost::EqualityComparable)); BOOST_CONCEPT_ASSERT((WireEncodable)); @@ -668,5 +667,4 @@ BOOST_AUTO_TEST_CASE(Print) 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 2e951dde..e35fe552 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_END() // PlainHandle BOOST_AUTO_TEST_SUITE(ScopedHandle) -using ScopedTestHandle = ScopedCancelHandle; +using ScopedTestHandle = detail::ScopedCancelHandle; BOOST_AUTO_TEST_CASE(ManualCancel) { @@ -134,6 +134,4 @@ BOOST_AUTO_TEST_SUITE_END() // ScopedHandle 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 41d47db6..32e7e42f 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_CASE(CongestionMark) 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 72caa7e8..c5972030 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 -namespace ndn { -namespace tests { +namespace ndn::tests { BOOST_AUTO_TEST_SUITE(Detail) BOOST_AUTO_TEST_SUITE(TestTagHost) @@ -53,7 +52,7 @@ public: } }; -typedef boost::mpl::vector Fixtures; +using Fixtures = boost::mpl::vector; BOOST_FIXTURE_TEST_CASE_TEMPLATE(Basic, T, Fixtures, T) { @@ -84,5 +83,4 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(Basic, T, Fixtures, T) 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 63b75561..903fcea0 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 @@ public: } }; -} // 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 ed8641e6..18fce9a5 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_CASE(NestedSequence) 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 8dd21d35..c93a3076 100644 --- a/tests/unit/encoding/block.t.cpp +++ b/tests/unit/encoding/block.t.cpp @@ -31,8 +31,7 @@ #include #include -namespace ndn { -namespace tests { +namespace ndn::tests { BOOST_CONCEPT_ASSERT((boost::EqualityComparable)); @@ -751,5 +750,4 @@ BOOST_AUTO_TEST_SUITE_END() // BlockLiteral 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 3f67d50b..7442299d 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_CASE(Close) // Bug 5240 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 0402f14c..5e71e2cb 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_CASE(Reserve) 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 c0997b42..a5fa6391 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 @@ BOOST_AUTO_TEST_CASE(ConstructFromBlock) } } +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() // PrependNonNegativeNumber 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 cb864241..12a369b6 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_CASE(Tlv) 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 e1bc1116..6821c442 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 #include -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_CASE(PrintRouteFlags) 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 9cd7cc4b..e38b5f29 100644 --- a/tests/unit/encoding/tlv.t.cpp +++ b/tests/unit/encoding/tlv.t.cpp @@ -34,9 +34,9 @@ #include #include -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 ArrayStream = boost::iostreams::stream; using StreamIterator = std::istream_iterator; #define ASSERT_READ_NUMBER_IS_FAST(T) \ - static_assert(detail::IsContiguousIterator, #T " is not fast") + static_assert(ndn::tlv::detail::IsContiguousIterator, #T " is not fast") #define ASSERT_READ_NUMBER_IS_SLOW(T) \ - static_assert(!detail::IsContiguousIterator, #T " is not slow") + static_assert(!ndn::tlv::detail::IsContiguousIterator, #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() // OutputOperators 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 9d622ed3..c4ae0260 100644 --- a/tests/unit/face.t.cpp +++ b/tests/unit/face.t.cpp @@ -31,10 +31,7 @@ #include -namespace ndn { -namespace tests { - -using ndn::util::DummyClientFace; +namespace ndn::tests { struct WantPrefixRegReply; struct NoPrefixRegReply; @@ -912,7 +909,7 @@ class WithEnvAndConfig : public WithEnv, public WithConfig { }; -typedef boost::mpl::vector ConfigOptions; +using ConfigOptions = boost::mpl::vector; BOOST_FIXTURE_TEST_CASE(NoConfig, WithEnvAndConfig) // fixture configures test HOME and PIB/TPM path { @@ -978,5 +975,4 @@ BOOST_AUTO_TEST_SUITE_END() // Transport 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 bdf86ea3..632a566a 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_CASE(MemoryPoolSizeZeroBug) // Bug #4769 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 17aa9a6a..34285dc6 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_CASE(FrequencyQueue2) 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 cbf2bab0..5a37ca73 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_CASE(UsedTimeQueue2) 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 d0cabf9d..33a3afb8 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_CASE(EraseAndShrink) 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 27caa342..ac1c7c21 100644 --- a/tests/unit/ims/in-memory-storage.t.cpp +++ b/tests/unit/ims/in-memory-storage.t.cpp @@ -31,10 +31,7 @@ #include -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() // Find 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 12aba0a9..f4354e7f 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(Matching) BOOST_AUTO_TEST_CASE(RegexConvertToName) { - util::DummyClientFace face; + DummyClientFace face; face.setInterestFilter(InterestFilter("/Hello/World", "<>?"), [] (const Name&, const Interest&) { BOOST_ERROR("unexpected Interest"); }); face.processEvents(1_ms); @@ -69,5 +68,4 @@ BOOST_AUTO_TEST_CASE(AllowLoopback) 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 73afe60b..036dc72c 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)); BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer)); @@ -1172,5 +1171,4 @@ BOOST_AUTO_TEST_CASE(ToUri) 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 1c872c4d..49349545 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 -namespace ndn { -namespace tests { +namespace ndn::tests { class IoFixture : public ClockFixture { @@ -49,7 +48,6 @@ protected: 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 2df51b10..3ac2edfa 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 7a8b6362..50daa8c4 100644 --- a/tests/unit/key-locator.t.cpp +++ b/tests/unit/key-locator.t.cpp @@ -26,8 +26,7 @@ #include -namespace ndn { -namespace tests { +namespace ndn::tests { BOOST_CONCEPT_ASSERT((boost::EqualityComparable)); BOOST_CONCEPT_ASSERT((WireEncodable)); @@ -200,5 +199,4 @@ BOOST_AUTO_TEST_CASE(Equality) 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 106541af..f1bbd079 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)); BOOST_CONCEPT_ASSERT((WireEncodable)); @@ -175,5 +174,4 @@ BOOST_AUTO_TEST_SUITE_END() // Modify 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 8b27a6c4..08b9d259 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_CASE(Policy) 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 e828051e..5028b2bc 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)); BOOST_CONCEPT_ASSERT((Field)); @@ -40,6 +40,4 @@ BOOST_CONCEPT_ASSERT((Field)); BOOST_CONCEPT_ASSERT((Field)); BOOST_CONCEPT_ASSERT((Field)); -} // 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 c914eb04..efe31b0e 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_CASE(Reason) 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 ef30de11..64835efa 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_CASE(Members) 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 68f55fc0..01cc05b7 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_AUTO_TEST_CASE(DecodeUnrecognizedTlvType) 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_FIXTURE_TEST_CASE(DecodePrefixAnnouncement, ndn::tests::KeyChainFixture) 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 49d77c16..6f45b324 100644 --- a/tests/unit/lp/pit-token.t.cpp +++ b/tests/unit/lp/pit-token.t.cpp @@ -26,9 +26,9 @@ #include -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_CASE(Decode) 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 a107eb5e..ef4b11f7 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 @@ BOOST_AUTO_TEST_CASE(EncodeDecode) 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_CASE(EncodeDecode) 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 f909565e..2e37ea5b 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)); BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer)); @@ -161,5 +160,4 @@ BOOST_AUTO_TEST_CASE(AppMetaInfoTypeRange) 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 3fd5d098..480f7d40 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_CASE(MakeDiscoveryInterest) 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 1dd69b10..7e72c266 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)); BOOST_CONCEPT_ASSERT((WireDecodable)); @@ -62,6 +62,4 @@ BOOST_AUTO_TEST_CASE(Decode) 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 9b01628d..1e1c947f 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: } public: - util::DummyClientFace face; + DummyClientFace face; mgmt::Dispatcher dispatcher; InMemoryStorageFifo& storage; }; @@ -473,6 +471,4 @@ BOOST_AUTO_TEST_CASE(NotificationStream) 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 8036d0d1..b9c64551 100644 --- a/tests/unit/mgmt/nfd/channel-status.t.cpp +++ b/tests/unit/mgmt/nfd/channel-status.t.cpp @@ -26,9 +26,9 @@ #include -namespace ndn { -namespace nfd { -namespace tests { +namespace ndn::tests { + +using namespace ndn::nfd; BOOST_CONCEPT_ASSERT((StatusDatasetItem)); @@ -85,6 +85,4 @@ BOOST_AUTO_TEST_SUITE_END() // TestChannelStatus 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 d41c512e..f7d74b18 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() // TestCommandOptions 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 25371fd3..2da52702 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() // TestControlCommand 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 48666203..e89b4f35 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)); BOOST_CONCEPT_ASSERT((WireDecodable)); @@ -248,6 +248,4 @@ BOOST_AUTO_TEST_SUITE_END() // TestControlParameters 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 38b44fde..d1cd4019 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: } 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 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 d68611f1..6760d5e2 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() // TestController 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 70d8a20a..9e4a437f 100644 --- a/tests/unit/mgmt/nfd/cs-info.t.cpp +++ b/tests/unit/mgmt/nfd/cs-info.t.cpp @@ -26,9 +26,9 @@ #include -namespace ndn { -namespace nfd { -namespace tests { +namespace ndn::tests { + +using namespace ndn::nfd; BOOST_CONCEPT_ASSERT((StatusDatasetItem)); @@ -126,6 +126,4 @@ BOOST_AUTO_TEST_SUITE_END() // TestCsInfo 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 97b30005..3686b178 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 -namespace ndn { -namespace nfd { -namespace tests { +namespace ndn::tests { + +using namespace ndn::nfd; BOOST_CONCEPT_ASSERT((NotificationStreamItem)); @@ -268,6 +268,4 @@ BOOST_AUTO_TEST_SUITE_END() // TestFaceEventNotification 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 1f83f82b..12342598 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 -namespace ndn { -namespace nfd { -namespace tests { +namespace ndn::tests { + +using namespace ndn::nfd; BOOST_CONCEPT_ASSERT((boost::EqualityComparable)); BOOST_CONCEPT_ASSERT((WireEncodable)); @@ -146,6 +146,4 @@ BOOST_AUTO_TEST_SUITE_END() // TestFaceQueryFilter 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 275acf25..24be329c 100644 --- a/tests/unit/mgmt/nfd/face-status.t.cpp +++ b/tests/unit/mgmt/nfd/face-status.t.cpp @@ -26,9 +26,9 @@ #include -namespace ndn { -namespace nfd { -namespace tests { +namespace ndn::tests { + +using namespace ndn::nfd; BOOST_CONCEPT_ASSERT((StatusDatasetItem)); @@ -178,6 +178,4 @@ BOOST_AUTO_TEST_SUITE_END() // TestFaceStatus 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 81f94e51..d802250e 100644 --- a/tests/unit/mgmt/nfd/fib-entry.t.cpp +++ b/tests/unit/mgmt/nfd/fib-entry.t.cpp @@ -26,9 +26,9 @@ #include -namespace ndn { -namespace nfd { -namespace tests { +namespace ndn::tests { + +using namespace ndn::nfd; BOOST_CONCEPT_ASSERT((StatusDatasetItem)); BOOST_CONCEPT_ASSERT((StatusDatasetItem)); @@ -212,6 +212,4 @@ BOOST_AUTO_TEST_SUITE_END() // TestFibEntry 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 6492e554..056917d7 100644 --- a/tests/unit/mgmt/nfd/forwarder-status.t.cpp +++ b/tests/unit/mgmt/nfd/forwarder-status.t.cpp @@ -26,9 +26,9 @@ #include -namespace ndn { -namespace nfd { -namespace tests { +namespace ndn::tests { + +using namespace ndn::nfd; BOOST_CONCEPT_ASSERT((StatusDatasetItem)); @@ -140,6 +140,4 @@ BOOST_AUTO_TEST_SUITE_END() // TestForwarderStatus 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 3479c01b..ae924bfd 100644 --- a/tests/unit/mgmt/nfd/rib-entry.t.cpp +++ b/tests/unit/mgmt/nfd/rib-entry.t.cpp @@ -26,9 +26,9 @@ #include -namespace ndn { -namespace nfd { -namespace tests { +namespace ndn::tests { + +using namespace ndn::nfd; BOOST_CONCEPT_ASSERT((StatusDatasetItem)); BOOST_CONCEPT_ASSERT((StatusDatasetItem)); @@ -240,6 +240,4 @@ BOOST_AUTO_TEST_SUITE_END() // TestRibEntry 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 511498dc..bb6acad6 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() // TestStatusDataset 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 92f271ce..63d644b5 100644 --- a/tests/unit/mgmt/nfd/strategy-choice.t.cpp +++ b/tests/unit/mgmt/nfd/strategy-choice.t.cpp @@ -26,9 +26,9 @@ #include -namespace ndn { -namespace nfd { -namespace tests { +namespace ndn::tests { + +using namespace ndn::nfd; BOOST_CONCEPT_ASSERT((StatusDatasetItem)); @@ -95,6 +95,4 @@ BOOST_AUTO_TEST_SUITE_END() // TestStrategyChoice 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 69b2694e..f219729d 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() // AbnormalState 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 a35f9804..d72de0f5 100644 --- a/tests/unit/name-component.t.cpp +++ b/tests/unit/name-component.t.cpp @@ -30,9 +30,10 @@ #include #include -namespace ndn { -namespace name { -namespace tests { +namespace ndn::tests { + +using ndn::name::Component; +using ndn::name::UriFormat; BOOST_CONCEPT_ASSERT((boost::EqualityComparable)); BOOST_CONCEPT_ASSERT((WireEncodable)); @@ -616,6 +617,4 @@ BOOST_AUTO_TEST_CASE(Compare) 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 2e107f5a..da95aedf 100644 --- a/tests/unit/name.t.cpp +++ b/tests/unit/name.t.cpp @@ -26,11 +26,9 @@ #include #include -namespace ndn { -namespace tests { +namespace ndn::tests { -using Component = name::Component; -using UriFormat = name::UriFormat; +using ndn::name::Component; BOOST_CONCEPT_ASSERT((boost::EqualityComparable)); BOOST_CONCEPT_ASSERT((WireEncodable)); @@ -61,7 +59,7 @@ BOOST_AUTO_TEST_CASE(EncodeDecode) 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_AUTO_TEST_CASE(AppendTypedComponent) 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_CASE(UnorderedMap) 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 39dcd8ff..4fe1347f 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_CASE(SideEffect) 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 b6a24b5e..ac734dd1 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 -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_CASE(Synchronous) 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 162170b4..0fc5357b 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_CASE(StdHash) 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 d21d70fc..34e050ed 100644 --- a/tests/unit/net/face-uri.t.cpp +++ b/tests/unit/net/face-uri.t.cpp @@ -34,8 +34,7 @@ #include -namespace ndn { -namespace tests { +namespace ndn::tests { BOOST_CONCEPT_ASSERT((boost::EqualityComparable)); @@ -614,5 +613,4 @@ BOOST_AUTO_TEST_CASE(Bug1635) 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 84e12444..f8a88164 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 #include -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 BoostResolver; + using BoostResolver = boost::asio::ip::basic_resolver; boost::asio::io_service ioService; BoostResolver resolver(ioService); @@ -66,22 +61,21 @@ NetworkConfigurationDetector::detect() 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 5c0c34b4..7264e681 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 @@ private: 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 453a510f..0ef8a9da 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_FIXTURE_TEST_CASE(RemoveInterface, StubFixture) 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 132d0db9..45152585 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 -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_CASE(DestructWhileEnumerating) 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 9a3eba92..a13e9f53 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_CASE(KeywordComponent) 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 82dd6061..af71ce4c 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)); BOOST_CONCEPT_ASSERT((WireEncodable)); @@ -99,6 +99,4 @@ BOOST_AUTO_TEST_CASE(Basic) 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 0c300b74..1c7b8b8f 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 @@ public: } }; -class BundleWithFinalBlockId -{ -}; - -class BundleWithoutFinalBlockId -{ -}; - -class Timeout -{ -}; - -class Nack -{ -}; +struct BundleWithFinalBlockId {}; +struct BundleWithoutFinalBlockId {}; +struct Timeout {}; +struct Nack {}; template class CertificateBundleFetcherFixture : public HierarchicalValidatorFixture #include -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 CertificateFetcherDirectFetchFixture : public HierarchicalValidatorFixture class CertificateFetcherFromNetworkFixture : public HierarchicalValidatorFixture -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)); BOOST_CONCEPT_ASSERT((WireDecodable)); @@ -379,6 +377,9 @@ Signature Information: 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_CASE(Helpers) 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 a9fe998a..3cb3eb76 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: } protected: - CertificateBundleDecoder cbd; + security::detail::CertificateBundleDecoder cbd; Block certBlock1; Block certBlock2; size_t nCertsCompleted = 0; @@ -213,7 +210,4 @@ BOOST_AUTO_TEST_CASE(UnrecognizedNonCritical) 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 b4a39915..b44546ba 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_CASE(V03) 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 be544a48..d0b717fd 100644 --- a/tests/unit/security/key-chain.t.cpp +++ b/tests/unit/security/key-chain.t.cpp @@ -31,12 +31,9 @@ #include #include -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_FIXTURE_TEST_CASE(SelfSignedCertValidity, KeyChainFixture) 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 f051b06f..27f098a1 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 -namespace ndn { -namespace tests { +namespace ndn::tests { BOOST_AUTO_TEST_SUITE(Security) BOOST_AUTO_TEST_SUITE(TestKeyParams) @@ -162,5 +161,4 @@ BOOST_AUTO_TEST_CASE(KeyIdTypeToString) 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 b1d43438..ecfd0b93 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_AUTO_TEST_CASE(AddGetRemove) 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_CASE(Iterator) } 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 ea97da0b..81f9ad04 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 @@ BOOST_AUTO_TEST_CASE(AddGetRemove) 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_CASE(Iterator) } 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 be2d03b5..70252d9b 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_AUTO_TEST_CASE(ValidityChecking) BOOST_TEST(id == Identity()); BOOST_CHECK_THROW(id.getName(), std::domain_error); - auto impl = std::make_shared(id1, makePibWithIdentity(id1)); + auto impl = std::make_shared(id1, makePibWithIdentity(id1)); id = Identity(impl); BOOST_TEST(id); BOOST_TEST(id != Identity()); @@ -52,12 +50,12 @@ BOOST_AUTO_TEST_CASE(ValidityChecking) 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(id1, makePibWithIdentity(id1)); + auto impl = std::make_shared(id1, makePibWithIdentity(id1)); Identity identity1(impl); Identity identity2(impl); @@ -66,22 +64,18 @@ BOOST_AUTO_TEST_CASE(SharedImpl) 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 3f38e0e7..6b449931 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 = makePibWithIdentity(id1); @@ -136,11 +131,6 @@ BOOST_AUTO_TEST_CASE(Errors) } 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 4cb960a5..940974b9 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 = makePibWithKey(id1Key1Name, id1Key1); @@ -114,8 +109,7 @@ BOOST_AUTO_TEST_CASE(CertificateOperations) 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 @@ BOOST_FIXTURE_TEST_CASE(ReplaceCertificate, ReplaceFixture) 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_CASE(UnknownKeyType) } 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 b126bc20..84a4d3f0 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_AUTO_TEST_CASE(AddGetRemove) 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_CASE(Iterator) } 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 4d1da0ce..5273436c 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_AUTO_TEST_CASE(ValidityChecking) BOOST_TEST(key == Key()); BOOST_CHECK_THROW(key.getName(), std::domain_error); - auto impl = std::make_shared(id1Key1Name, id1Key1, - makePibWithKey(id1Key1Name, id1Key1)); + auto impl = std::make_shared(id1Key1Name, id1Key1, makePibWithKey(id1Key1Name, id1Key1)); key = Key(impl); BOOST_TEST(key); BOOST_TEST(key != Key()); @@ -53,13 +50,12 @@ BOOST_AUTO_TEST_CASE(ValidityChecking) 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(id1Key1Name, id1Key1, - makePibWithKey(id1Key1Name, id1Key1)); + auto keyImpl = std::make_shared(id1Key1Name, id1Key1, makePibWithKey(id1Key1Name, id1Key1)); Key key1(keyImpl); Key key2(keyImpl); @@ -68,12 +64,12 @@ BOOST_AUTO_TEST_CASE(SharedImpl) 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(SharedImpl) 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_CASE(Helpers) } 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 488d11e1..dde1d8b5 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 -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 @@ namespace tests { // } // private: -// pib::PibMemory pib; -// Tpm tpm{"test", "test", make_unique()}; +// PibMemory pib; +// Tpm tpm{"test:test", make_unique()}; // }; // // The test data can be generated using this test case @@ -414,7 +414,4 @@ PibDataFixture::makePibWithKey(const Name& keyName, span key) 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 64c86528..7fcdebbf 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 + [[nodiscard]] static shared_ptr makePibWithIdentity(const Name& idName); - [[nodiscard]] static shared_ptr + [[nodiscard]] static shared_ptr makePibWithKey(const Name& keyName, span key); public: @@ -65,9 +64,6 @@ public: 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 d88bad6c..b26109d4 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 #include -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_FIXTURE_TEST_CASE_TEMPLATE(Overwrite, T, PibImpls, T) } 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 8d668e5f..3a665c3c 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()); @@ -116,10 +112,6 @@ BOOST_AUTO_TEST_CASE(IdentityOperations) } 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 ade7f694..9f9b00dc 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)); BOOST_CONCEPT_ASSERT((WireDecodable)); @@ -162,6 +162,4 @@ BOOST_AUTO_TEST_CASE(EncoderAndDecoder) 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 a515c168..c7065a2a 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_CASE(Sha256) 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 87c347f5..a1aee158 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 #include -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_CASE(OperatorEqualsDifferentTypes) 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 2da77aa8..6d8a6636 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 -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 @@ class BackEndWrapperFile public: BackEndWrapperFile() : m_tmpPath(boost::filesystem::path(UNIT_TESTS_TMPDIR) / "TpmBackEndFile") - , m_impl(make_unique(m_tmpPath.string())) + , m_impl(make_unique(m_tmpPath.string())) { } @@ -48,7 +45,7 @@ public: boost::filesystem::remove_all(m_tmpPath); } - BackEnd& + security::tpm::BackEnd& getTpm() { return *m_impl; @@ -62,12 +59,9 @@ public: private: const boost::filesystem::path m_tmpPath; - const unique_ptr m_impl; + const unique_ptr 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 8de2b124..20dae82e 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 @@ class BackEndWrapperMem { public: BackEndWrapperMem() - : m_impl(make_unique()) + : m_impl(make_unique()) { } - BackEnd& + security::tpm::BackEnd& getTpm() { return *m_impl; @@ -53,12 +50,9 @@ public: } private: - const unique_ptr m_impl; + const unique_ptr 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 c459c472..542c319d 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 -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 @@ public: else unsetenv("HOME"); - m_impl = make_unique(); + m_impl = make_unique(); } ~BackEndWrapperOsx() @@ -63,7 +60,7 @@ public: unsetenv("HOME"); } - BackEnd& + security::tpm::BackEnd& getTpm() { return *m_impl; @@ -77,12 +74,9 @@ public: private: std::string m_HOME; - unique_ptr m_impl; + unique_ptr 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 78f09e30..34d79b46 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 #include -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_CASE(RandomKeyId) } } -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 901839bb..00000000 --- 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 - * . - * - * 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 5d89fe6f..f1806245 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() // TestBase64Decode 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 7b4aa47c..c25ecba0 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() // TestBase64Encode 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 d8b3c3b8..cd857c1b 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() // TestBlockCipher 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 a7640c66..be10b13a 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_AUTO_TEST_CASE(Basic) 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_AUTO_TEST_CASE(Basic) 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 f957282d..aa276446 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() // TestBufferSource 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 08f85cf0..c414d173 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 -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() // TestDigestFilter 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 23ca9aaf..51a2672e 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 @@ BOOST_AUTO_TEST_CASE(OddByte) { 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() // TestHexDecode 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 8025c37d..2a81b6aa 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() // TestHexEncode 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 077c2e3d..f9a511d6 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 #include -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() // TestPrivateKey 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 655811ca..31970c4f 100644 --- a/tests/unit/security/transform/public-key.t.cpp +++ b/tests/unit/security/transform/public-key.t.cpp @@ -32,10 +32,9 @@ #include -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() // TestPublicKey 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 cad6f045..ad3b788c 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 @@ BOOST_AUTO_TEST_CASE(Rsa) 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 @@ BOOST_AUTO_TEST_CASE(Ecdsa) 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() // TestSignerFilter 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 01790115..c950716e 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 -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_AUTO_TEST_CASE(Basic) 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() // TestStepSource 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 f58bece4..b79012dc 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 @@ BOOST_AUTO_TEST_CASE(Basic) 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 1446bc94..e20ff23f 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 #include -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_AUTO_TEST_CASE(EmptyStream) BOOST_CHECK_EQUAL(os.str(), ""); } -typedef boost::mpl::vector< +using BadBits = boost::mpl::vector< boost::mpl::integral_c, boost::mpl::integral_c -> 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 cd73270c..cbc406de 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() // TestStripSpace 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 ef986b12..e04415cb 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 -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() // TestVerifierFilter 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 09825db2..0e762148 100644 --- a/tests/unit/security/trust-anchor-container.t.cpp +++ b/tests/unit/security/trust-anchor-container.t.cpp @@ -27,17 +27,12 @@ #include -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_CASE(FindByInterest) 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 c4a1a082..f59d6e7d 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 -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_CASE(Basic) 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 cd94cf70..ca86c86c 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 -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 +class ValidationPolicyAcceptAllFixture : public ValidatorFixture { public: ValidationPolicyAcceptAllFixture() @@ -50,7 +45,7 @@ public: BOOST_FIXTURE_TEST_SUITE(TestValidationPolicyAcceptAll, ValidationPolicyAcceptAllFixture) -typedef boost::mpl::vector Packets; +using Packets = boost::mpl::vector; BOOST_AUTO_TEST_CASE_TEMPLATE(Validate, Packet, Packets) { @@ -71,7 +66,4 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(Validate, Packet, Packets) 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 971b5091..ac690e7a 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 -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() // Options 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 83c6f525..07b98e90 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_TEMPLATE(ValidateRefresh, Refresh, RefreshPolicies, Refr BOOST_FIXTURE_TEST_CASE(OrphanedPolicyLoad, HierarchicalValidatorFixture) // 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_FIXTURE_TEST_CASE(OrphanedPolicyLoad, HierarchicalValidatorFixture -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() // NonceValidation 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 788a7c93..80fc58a3 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 -namespace ndn { -namespace security { -inline namespace v2 { -namespace tests { +namespace ndn::tests { BOOST_AUTO_TEST_SUITE(Security) BOOST_FIXTURE_TEST_SUITE(TestValidationPolicySimpleHierarchy, - HierarchicalValidatorFixture) + HierarchicalValidatorFixture) using Packets = boost::mpl::vector; @@ -125,7 +122,4 @@ BOOST_AUTO_TEST_CASE(CertNameInKeyLocator) 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 3d76f623..3ff9fe8e 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_CASE(ExtractIdentityNameFromKeyLocator) 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 391879d0..7cdfa537 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_FIXTURE_TEST_SUITE(TestValidatorConfig, KeyChainFixture) 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()); + ValidatorConfig v2(make_unique()); BOOST_CHECK_EQUAL(v2.m_policyConfig.m_isConfigured, false); } @@ -56,7 +52,7 @@ class ValidatorConfigFixture : public KeyChainFixture public: ValidatorConfigFixture() : path(boost::filesystem::path(UNIT_TESTS_TMPDIR) / "security" / "validator-config") - , validator(make_unique()) + , validator(make_unique()) { boost::filesystem::create_directories(path); config = R"CONF( @@ -118,11 +114,11 @@ BOOST_AUTO_TEST_CASE(FromIstream) 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 @@ BOOST_FIXTURE_TEST_CASE(ValidateCommandInterestWithDigestSha256, ValidatorConfig { 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 @@ BOOST_FIXTURE_TEST_CASE(ValidateSignedInterest, ValidatorConfigFixture) { 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 @@ BOOST_FIXTURE_TEST_CASE(ValidateCommandInterest, ValidatorConfigFixture) { 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_FIXTURE_TEST_CASE(ValidateCommandInterest, ValidatorConfigFixture) 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 1170156f..6c610857 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() // TestChecker 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 c4a4fe3b..c984cf51 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 -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 @@ makeSection(const std::string& config) 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 42eeceb6..a83217bc 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() // TestFilter 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 88792121..c81a0926 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 -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_AUTO_TEST_CASE(FromString) 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() // TestNameRelation 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 4871521e..ea0b4b7e 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 -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 @@ public: const std::string ruleId = "rule-id"; Rule rule; Name pktName; - shared_ptr state; + shared_ptr state; }; using PktTypes = boost::mpl::vector; @@ -211,8 +206,4 @@ BOOST_AUTO_TEST_SUITE_END() // TestRule 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 0e780b49..41497bfc 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 @@ ValidatorFixtureBase::ValidatorFixtureBase() 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 @@ InterestV03Pkt::makeName(Name name, KeyChain& keyChain) 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 39e4ed36..6d69a1e0 100644 --- a/tests/unit/security/validator-fixture.hpp +++ b/tests/unit/security/validator-fixture.hpp @@ -31,12 +31,13 @@ #include -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 @@ protected: addSubCertificate(const Name& subIdentityName, const Identity& issuer); protected: - util::DummyClientFace face{m_io, {true, true}}; + DummyClientFace face{m_io, {true, true}}; std::function processInterest; - CertificateCache cache{100_days}; + security::CertificateCache cache{100_days}; ValidationError lastError{ValidationError::NO_ERROR}; private: @@ -73,7 +74,7 @@ private: static constexpr int s_mockTimes{200}; }; -template +template class ValidatorFixture : public ValidatorFixtureBase { protected: @@ -109,11 +110,11 @@ protected: } protected: - Validator validator; + security::Validator validator; ValidationPolicyT& policy; }; -template +template class HierarchicalValidatorFixture : public ValidatorFixture { protected: @@ -142,7 +143,7 @@ protected: #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 @@ struct DataPkt return Data(name); } - static shared_ptr + static shared_ptr makeState() { return make_shared(); @@ -214,11 +215,11 @@ struct InterestV02Pkt return Interest(name); } - static shared_ptr + static shared_ptr makeState() { auto state = make_shared(); - state->setTag(make_shared(SignedInterestFormat::V02)); + state->setTag(make_shared(security::SignedInterestFormat::V02)); return state; } }; @@ -240,18 +241,15 @@ struct InterestV03Pkt return Interest(name); } - static shared_ptr + static shared_ptr makeState() { auto state = make_shared(); - state->setTag(make_shared(SignedInterestFormat::V03)); + state->setTag(make_shared(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 5ad9be5f..ebae9004 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_CASE(ValidateInterest) 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 d1b746b5..c56db6af 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) @@ -378,7 +375,4 @@ BOOST_AUTO_TEST_CASE(LoopedCertChain) 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 dbcd47f8..1fbd6b19 100644 --- a/tests/unit/security/validity-period.t.cpp +++ b/tests/unit/security/validity-period.t.cpp @@ -27,11 +27,9 @@ #include -namespace ndn { -namespace security { -namespace tests { +namespace ndn::tests { -using namespace ndn::tests; +using ndn::security::ValidityPeriod; BOOST_CONCEPT_ASSERT((boost::EqualityComparable)); BOOST_CONCEPT_ASSERT((WireEncodable)); @@ -121,8 +119,8 @@ const uint8_t VP1[] = { 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(DecodingError) 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_CASE(Comparison) 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 83d37da7..868333df 100644 --- a/tests/unit/security/verification-helpers.t.cpp +++ b/tests/unit/security/verification-helpers.t.cpp @@ -29,11 +29,9 @@ #include #include -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_CASE(VerifyWithUnrecognizedElements) // Bug #4583 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 d5382173..8fc459c0 100644 --- a/tests/unit/signature-info.t.cpp +++ b/tests/unit/signature-info.t.cpp @@ -25,8 +25,7 @@ #include -namespace ndn { -namespace tests { +namespace ndn::tests { BOOST_CONCEPT_ASSERT((boost::EqualityComparable)); BOOST_CONCEPT_ASSERT((WireEncodable)); @@ -550,5 +549,4 @@ BOOST_AUTO_TEST_CASE(OutputStream) 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 0cbae229..9b4f1a61 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 MyTag; + using MyTag = ndn::SimpleTag; BOOST_CHECK_EQUAL(MyTag::getTypeId(), 3); MyTag tag(23361); // explicitly convertible from value type @@ -41,5 +40,4 @@ BOOST_AUTO_TEST_CASE(SimpleTag) 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 9a04605d..db1c2f28 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 #include -namespace ndn { -namespace tests { +namespace ndn::tests { class TestHomeEnvSaver { @@ -50,7 +49,6 @@ private: 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 cb577cc6..5d86baa2 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_CASE(GetDefaultSocketHostAndPortBadMalformedUri) 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 a8946f4b..f7c54d6b 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_CASE(GetSocketNameFromUri) 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 997f86a7..74feee7d 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 @@ public: }; BOOST_CONCEPT_ASSERT((WireDecodable)); -} // 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 9e098c1f..ab8f212c 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 #include -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_CASE(ParseMalformed) 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 ad0c3bfa..0eea2e6b 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 @@ BOOST_AUTO_TEST_CASE(BroadcastLink) [&] (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_CASE(AlreadyLinkException) 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 49ac2ab6..d8184c59 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 #include -namespace ndn { -namespace exception { -namespace tests { +namespace ndn::tests { BOOST_AUTO_TEST_SUITE(Util) BOOST_AUTO_TEST_SUITE(TestException) @@ -50,7 +48,7 @@ BOOST_AUTO_TEST_CASE(Throw) BOOST_CHECK(boost::get_error_info(ex) != nullptr); #ifdef NDN_CXX_HAVE_STACKTRACE - auto stack = boost::get_error_info(ex); + auto stack = boost::get_error_info(ex); BOOST_REQUIRE(stack != nullptr); auto info = boost::diagnostic_information(ex); BOOST_TEST_MESSAGE(info); @@ -106,6 +104,4 @@ BOOST_AUTO_TEST_CASE(ThrowNested) 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 91da1e3f..4994d0d2 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 -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_CASE(BasicWithFlushes) // Bug #2723 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 9658d049..934648aa 100644 --- a/tests/unit/util/io.t.cpp +++ b/tests/unit/util/io.t.cpp @@ -27,8 +27,7 @@ #include #include -namespace ndn { -namespace tests { +namespace ndn::tests { BOOST_AUTO_TEST_SUITE(Util) BOOST_AUTO_TEST_SUITE(TestIo) @@ -398,5 +397,4 @@ BOOST_FIXTURE_TEST_CASE(IdCert, IdCertFixture) 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 ab557284..371b7d62 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 @@ logFromFilterModule() 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 4f71102c..2070c588 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 @@ logFromModule1() 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 994e1429..65654889 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 @@ logFromModule2() 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 ad742bb5..70ba72fd 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_CASE(ConsecutivePeriods) 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 02da03ad..937b41bf 100644 --- a/tests/unit/util/logging.t.cpp +++ b/tests/unit/util/logging.t.cpp @@ -27,11 +27,13 @@ #include -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 @@ logFromNewLogger(const char* moduleName) namespace ns1 { -NDN_LOG_INIT(ndn.util.tests.ns1); +NDN_LOG_INIT(ndn.tests.ns1); static void logFromNamespace1() @@ -72,7 +74,7 @@ logFromNamespace1() namespace ns2 { -NDN_LOG_INIT(ndn.util.tests.ns2); +NDN_LOG_INIT(ndn.tests.ns2); static void logFromNamespace2() @@ -101,7 +103,7 @@ private: 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 @@ protected: }; // 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 @@ private: // but we want to test that the macro expands to well-formed code NDN_LOG_MEMBER_DECL_SPECIALIZED((ClassTemplateWithLogger)); -NDN_LOG_MEMBER_INIT_SPECIALIZED((ClassTemplateWithLogger), ndn.util.tests.Specialized1); -NDN_LOG_MEMBER_INIT_SPECIALIZED((ClassTemplateWithLogger), ndn.util.tests.Specialized2); +NDN_LOG_MEMBER_INIT_SPECIALIZED((ClassTemplateWithLogger), ndn.tests.Specialized1); +NDN_LOG_MEMBER_INIT_SPECIALIZED((ClassTemplateWithLogger), 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 @@ BOOST_AUTO_TEST_CASE(GetLoggerNames) 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_SUITE_END() // Severity 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 @@ BOOST_AUTO_TEST_CASE(MemberLogger) 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::logFromStaticMemberFunction(); @@ -368,8 +370,8 @@ BOOST_AUTO_TEST_CASE(MemberLogger) 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_CASE(NullDestination) 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 3ff6ed97..36b90047 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_CASE(Post) 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 896f6324..107784ae 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 @@ protected: Name streamPrefix; DummyClientFace subscriberFace; util::NotificationSubscriber 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_CASE(PayloadError) 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 7e8e63f5..2e7ac8f3 100644 --- a/tests/unit/util/ostream-joiner.t.cpp +++ b/tests/unit/util/ostream-joiner.t.cpp @@ -26,8 +26,7 @@ #include #include -namespace ndn { -namespace tests { +namespace ndn::tests { BOOST_AUTO_TEST_SUITE(Util) BOOST_AUTO_TEST_SUITE(TestOstreamJoiner) @@ -69,5 +68,4 @@ BOOST_AUTO_TEST_CASE(Basic) 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 388bb989..b72e7546 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 #include -namespace ndn { -namespace tests { +namespace ndn::tests { BOOST_AUTO_TEST_SUITE(Util) BOOST_AUTO_TEST_SUITE(TestRandom) @@ -125,5 +124,4 @@ BOOST_FIXTURE_TEST_CASE(Error, FailRandMethodFixture) 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 ca15b668..d09688e2 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_CASE(RegexBackrefManagerMemoryLeak) 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 b819c9b6..7070fb0b 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 -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_CASE(Stats) 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 1040b92b..e5c99e57 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 -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() // ScopedEventId 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 4abe2437..1166110f 100644 --- a/tests/unit/util/segment-fetcher.t.cpp +++ b/tests/unit/util/segment-fetcher.t.cpp @@ -31,11 +31,7 @@ #include -namespace ndn { -namespace util { -namespace tests { - -using namespace ndn::tests; +namespace ndn::tests { class SegmentFetcherFixture : public IoKeyChainFixture { @@ -853,6 +849,4 @@ BOOST_AUTO_TEST_CASE(UncanceledPendingInterestBug) // Bug #4770 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 d7ab98a2..f6eb2a8d 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_CASE(MultipleSegments) 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 c5fd1fd2..4a31ac74 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 #include -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_CASE(Print) 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 b3640f90..001d02ac 100644 --- a/tests/unit/util/signal.t.cpp +++ b/tests/unit/util/signal.t.cpp @@ -25,10 +25,9 @@ #include -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_CASE(ConnectionEquality) 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 ece2c485..239574bf 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 @@ private: 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 99ea89f8..b3d32d5b 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 #include -namespace ndn { -namespace util { -namespace tests { +namespace ndn::tests { + +using ndn::util::Sqlite3Statement; class Sqlite3DbFixture { @@ -153,6 +153,4 @@ BOOST_AUTO_TEST_CASE(Basic) 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 3816fabc..9361ed60 100644 --- a/tests/unit/util/string-helper.t.cpp +++ b/tests/unit/util/string-helper.t.cpp @@ -28,9 +28,7 @@ #include #include -namespace ndn { -namespace util { -namespace tests { +namespace ndn::tests { using boost::test_tools::output_test_stream; @@ -202,6 +200,4 @@ BOOST_AUTO_TEST_CASE(Unescape) 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 f1be6233..6b34ff8b 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 #include -namespace ndn { -namespace tests { +namespace ndn::tests { BOOST_AUTO_TEST_SUITE(Util) BOOST_FIXTURE_TEST_SUITE(TestTimeUnitTestClock, ClockFixture) @@ -51,8 +50,7 @@ BOOST_AUTO_TEST_CASE(SystemClock) BOOST_CHECK_GT(time::system_clock::now().time_since_epoch(), time::UnitTestClockTraits::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_FIXTURE_TEST_CASE(Scheduler, IoFixture) 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 2232e122..90047007 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 #include -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_CASE(Year2038) 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 ff3e32a3..527bc957 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 -namespace ndn { -namespace tests { +namespace ndn::tests { BOOST_AUTO_TEST_SUITE(TestVersion) @@ -58,5 +57,4 @@ BOOST_AUTO_TEST_CASE(VersionString) 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 a696000a..eec3e09f 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 -namespace ndn { -namespace ndnsec { +namespace ndn::ndnsec { /** * @brief An accumulating option value to handle multiple incrementing options. @@ -154,7 +153,6 @@ accumulator(T* store) return new AccumulatorType(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 b5ac12fe..8237f5dc 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 #endif // BOOST_VERSION < 106700 -namespace ndn { -namespace ndnsec { +namespace ndn::ndnsec { int ndnsec_cert_dump(int argc, char** argv) @@ -142,5 +141,4 @@ ndnsec_cert_dump(int argc, char** argv) return 0; } -} // namespace ndnsec -} // namespace ndn +} // namespace ndn::ndnsec diff --git a/tools/ndnsec/cert-gen.cpp b/tools/ndnsec/cert-gen.cpp index c1514716..c3821191 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 @@ ndnsec_cert_gen(int argc, char** argv) return 0; } -} // namespace ndnsec -} // namespace ndn +} // namespace ndn::ndnsec diff --git a/tools/ndnsec/cert-install.cpp b/tools/ndnsec/cert-install.cpp index 9a13e330..345ee246 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 @@ ndnsec_cert_install(int argc, char** argv) return 0; } -} // namespace ndnsec -} // namespace ndn +} // namespace ndn::ndnsec diff --git a/tools/ndnsec/delete.cpp b/tools/ndnsec/delete.cpp index 2159bb3d..25de41cb 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 @@ ndnsec_delete(int argc, char** argv) return 0; } -} // namespace ndnsec -} // namespace ndn +} // namespace ndn::ndnsec diff --git a/tools/ndnsec/export.cpp b/tools/ndnsec/export.cpp index 4ce0ebca..5641e088 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 -namespace ndn { -namespace ndnsec { +namespace ndn::ndnsec { int ndnsec_export(int argc, char** argv) @@ -131,5 +130,4 @@ ndnsec_export(int argc, char** argv) return 0; } -} // namespace ndnsec -} // namespace ndn +} // namespace ndn::ndnsec diff --git a/tools/ndnsec/get-default.cpp b/tools/ndnsec/get-default.cpp index 37f74257..8dba1bfa 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 @@ ndnsec_get_default(int argc, char** argv) } } -} // namespace ndnsec -} // namespace ndn +} // namespace ndn::ndnsec diff --git a/tools/ndnsec/import.cpp b/tools/ndnsec/import.cpp index c25b0c7c..9e0c830f 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 -namespace ndn { -namespace ndnsec { +namespace ndn::ndnsec { int ndnsec_import(int argc, char** argv) @@ -92,5 +91,4 @@ ndnsec_import(int argc, char** argv) return 0; } -} // namespace ndnsec -} // namespace ndn +} // namespace ndn::ndnsec diff --git a/tools/ndnsec/key-gen.cpp b/tools/ndnsec/key-gen.cpp index ac85fe8b..a045cd6e 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 @@ ndnsec_key_gen(int argc, char** argv) return 0; } -} // namespace ndnsec -} // namespace ndn +} // namespace ndn::ndnsec diff --git a/tools/ndnsec/list.cpp b/tools/ndnsec/list.cpp index 502d9095..3b02b807 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 @@ ndnsec_list(int argc, char** argv) return 0; } -} // namespace ndnsec -} // namespace ndn +} // namespace ndn::ndnsec diff --git a/tools/ndnsec/main.cpp b/tools/ndnsec/main.cpp index 436388f3..76093451 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 @@ Available commands: 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 @@ main(int argc, char* argv[]) argv++; } else { - std::cerr << NDNSEC_HELP_TEXT << std::endl; + std::cerr << NDNSEC_HELP_TEXT; return 2; } @@ -74,7 +75,7 @@ main(int argc, char* argv[]) 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 @@ main(int argc, char* argv[]) 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 bb773eae..49c4de88 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 @@ ndnsec_import(int argc, char** argv); 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 128ae190..b0ebf09f 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 @@ ndnsec_set_default(int argc, char** argv) return 0; } -} // namespace ndnsec -} // namespace ndn +} // namespace ndn::ndnsec diff --git a/tools/ndnsec/sign-req.cpp b/tools/ndnsec/sign-req.cpp index e202bc5a..ca538199 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 @@ ndnsec_sign_req(int argc, char** argv) return 0; } -} // namespace ndnsec -} // namespace ndn +} // namespace ndn::ndnsec diff --git a/tools/ndnsec/unlock-tpm.cpp b/tools/ndnsec/unlock-tpm.cpp index 1baaa554..97cd7021 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 #include -namespace ndn { -namespace ndnsec { +namespace ndn::ndnsec { int ndnsec_unlock_tpm(int argc, char** argv) @@ -86,5 +85,4 @@ ndnsec_unlock_tpm(int argc, char** argv) #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 ae407dbf..a85b9e35 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 -namespace ndn { -namespace ndnsec { +namespace ndn::ndnsec { bool getPassword(std::string& password, const std::string& prompt, bool shouldConfirm) @@ -89,5 +88,4 @@ getCertificateFromPib(const security::pib::Pib& pib, const Name& name, NDN_CXX_UNREACHABLE; } -} // namespace ndnsec -} // namespace ndn +} // namespace ndn::ndnsec diff --git a/tools/ndnsec/util.hpp b/tools/ndnsec/util.hpp index 913198cf..7a244d5f 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 #include -namespace ndn { -namespace ndnsec { +namespace ndn::ndnsec { /** * @brief Get certificate of given name from PIB. @@ -77,7 +76,6 @@ loadFromFile(const std::string& filename) 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