From 3de7c52dee9c5eb1267d47dbc23df9de5c4d9c87 Mon Sep 17 00:00:00 2001 From: Davide Pesavento Date: Thu, 25 Jan 2024 18:50:12 -0500 Subject: [PATCH] Reduce unnecessary inclusions of `detail/common.hpp` Change-Id: I79dcd05297594ccd4489d8cddddb879655373cc0 --- ndn-cxx/detail/cancel-handle.hpp | 6 +++-- ndn-cxx/detail/cf-releaser-osx.hpp | 5 ++-- ndn-cxx/detail/cf-string-osx.cpp | 3 ++- ndn-cxx/detail/cf-string-osx.hpp | 7 ++++-- ndn-cxx/detail/tag-host.hpp | 15 ++++++------ ndn-cxx/encoding/buffer-stream.cpp | 4 ++-- ndn-cxx/encoding/buffer-stream.hpp | 6 ++--- ndn-cxx/encoding/buffer.hpp | 13 ++++++----- ndn-cxx/encoding/encoding-buffer-fwd.hpp | 4 +--- ndn-cxx/net/dns.hpp | 5 +++- ndn-cxx/net/face-uri.cpp | 27 ++++++++++++---------- ndn-cxx/net/network-address.hpp | 5 ++-- ndn-cxx/security/impl/openssl-helper.hpp | 3 ++- ndn-cxx/security/security-common.cpp | 3 ++- ndn-cxx/security/security-common.hpp | 5 ++-- ndn-cxx/security/transform/private-key.hpp | 7 +++--- ndn-cxx/security/transform/public-key.hpp | 7 +++--- ndn-cxx/security/validation-error.cpp | 5 +++- ndn-cxx/security/validation-error.hpp | 6 +++-- ndn-cxx/util/backports.hpp | 8 +++---- ndn-cxx/util/logger.hpp | 7 ++++-- ndn-cxx/util/random.cpp | 5 ++-- ndn-cxx/util/random.hpp | 24 +++++++++---------- ndn-cxx/util/rtt-estimator.cpp | 6 ++--- ndn-cxx/util/rtt-estimator.hpp | 8 ++++--- ndn-cxx/util/scheduler.hpp | 11 +++++---- ndn-cxx/util/string-helper.hpp | 9 ++++++-- ndn-cxx/util/time-custom-clock.hpp | 12 ++++++---- ndn-cxx/util/time-unit-test-clock.hpp | 14 +++++------ ndn-cxx/util/time.cpp | 10 ++++---- ndn-cxx/util/time.hpp | 8 ++++--- tests/unit/clock-fixture.cpp | 6 ++--- tests/unit/clock-fixture.hpp | 6 ++--- tests/unit/detail/cancel-handle.t.cpp | 6 ++--- tests/unit/encoding/buffer-stream.t.cpp | 10 ++++---- tests/unit/net/dns.t.cpp | 3 ++- tests/unit/util/rtt-estimator.t.cpp | 6 ++--- 37 files changed, 169 insertions(+), 126 deletions(-) diff --git a/ndn-cxx/detail/cancel-handle.hpp b/ndn-cxx/detail/cancel-handle.hpp index 65dc11079..cffa057f0 100644 --- a/ndn-cxx/detail/cancel-handle.hpp +++ b/ndn-cxx/detail/cancel-handle.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2013-2023 Regents of the University of California. + * Copyright (c) 2013-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -22,7 +22,9 @@ #ifndef NDN_CXX_DETAIL_CANCEL_HANDLE_HPP #define NDN_CXX_DETAIL_CANCEL_HANDLE_HPP -#include "ndn-cxx/detail/common.hpp" +#include +#include +#include /** * \brief Contains implementation details that are not part of the ndn-cxx public API. diff --git a/ndn-cxx/detail/cf-releaser-osx.hpp b/ndn-cxx/detail/cf-releaser-osx.hpp index 4ff6b6696..0c5b8c610 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-2023 Regents of the University of California. + * Copyright (c) 2013-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -22,13 +22,14 @@ #ifndef NDN_CXX_DETAIL_CF_RELEASER_OSX_HPP #define NDN_CXX_DETAIL_CF_RELEASER_OSX_HPP -#include "ndn-cxx/detail/common.hpp" +#include "ndn-cxx/detail/config.hpp" #ifndef NDN_CXX_HAVE_OSX_FRAMEWORKS #error "This file should not be included ..." #endif #include +#include namespace ndn::detail { diff --git a/ndn-cxx/detail/cf-string-osx.cpp b/ndn-cxx/detail/cf-string-osx.cpp index 1459f8119..45f67ec71 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-2023 Regents of the University of California. + * Copyright (c) 2013-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -20,6 +20,7 @@ */ #include "ndn-cxx/detail/cf-string-osx.hpp" +#include "ndn-cxx/detail/common.hpp" namespace ndn::detail::cfstring { diff --git a/ndn-cxx/detail/cf-string-osx.hpp b/ndn-cxx/detail/cf-string-osx.hpp index 4cabdcb53..74e96ce99 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-2023 Regents of the University of California. + * Copyright (c) 2013-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -22,7 +22,7 @@ #ifndef NDN_CXX_DETAIL_CF_STRING_OSX_HPP #define NDN_CXX_DETAIL_CF_STRING_OSX_HPP -#include "ndn-cxx/detail/common.hpp" +#include "ndn-cxx/detail/config.hpp" #ifndef NDN_CXX_HAVE_OSX_FRAMEWORKS #error "This file should not be included ..." @@ -30,6 +30,9 @@ #include "ndn-cxx/detail/cf-releaser-osx.hpp" +#include +#include + /** * @file * diff --git a/ndn-cxx/detail/tag-host.hpp b/ndn-cxx/detail/tag-host.hpp index 05b3c41aa..d4c4bc151 100644 --- a/ndn-cxx/detail/tag-host.hpp +++ b/ndn-cxx/detail/tag-host.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2013-2023 Regents of the University of California. + * Copyright (c) 2013-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -22,10 +22,11 @@ #ifndef NDN_CXX_DETAIL_TAG_HOST_HPP #define NDN_CXX_DETAIL_TAG_HOST_HPP -#include "ndn-cxx/detail/common.hpp" #include "ndn-cxx/tag.hpp" #include +#include +#include namespace ndn { @@ -41,7 +42,7 @@ class TagHost * \retval nullptr if no Tag of type T is stored */ template - shared_ptr + std::shared_ptr getTag() const; /** @@ -51,7 +52,7 @@ class TagHost */ template void - setTag(shared_ptr tag) const; + setTag(std::shared_ptr tag) const; /** * \brief Remove a tag item. @@ -63,11 +64,11 @@ class TagHost removeTag() const; private: - mutable std::map> m_tags; + mutable std::map> m_tags; }; template -shared_ptr +std::shared_ptr TagHost::getTag() const { static_assert(std::is_convertible_v, "T must inherit from ndn::Tag"); @@ -80,7 +81,7 @@ TagHost::getTag() const template void -TagHost::setTag(shared_ptr tag) const +TagHost::setTag(std::shared_ptr tag) const { static_assert(std::is_convertible_v, "T must inherit from ndn::Tag"); diff --git a/ndn-cxx/encoding/buffer-stream.cpp b/ndn-cxx/encoding/buffer-stream.cpp index 6ee415d43..2481b9fc3 100644 --- a/ndn-cxx/encoding/buffer-stream.cpp +++ b/ndn-cxx/encoding/buffer-stream.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-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -54,7 +54,7 @@ OBufferStream::~OBufferStream() noexcept } } -shared_ptr +std::shared_ptr OBufferStream::buf() { if (is_open()) { diff --git a/ndn-cxx/encoding/buffer-stream.hpp b/ndn-cxx/encoding/buffer-stream.hpp index 16e4806ad..e6f8daad0 100644 --- a/ndn-cxx/encoding/buffer-stream.hpp +++ b/ndn-cxx/encoding/buffer-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-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -76,11 +76,11 @@ class OBufferStream : public boost::iostreams::stream /** * @brief Return a shared pointer to the underlying buffer. */ - shared_ptr + std::shared_ptr buf(); private: - shared_ptr m_buffer; + std::shared_ptr m_buffer; }; } // namespace ndn diff --git a/ndn-cxx/encoding/buffer.hpp b/ndn-cxx/encoding/buffer.hpp index 591ff9b9d..a9b5ba3bd 100644 --- a/ndn-cxx/encoding/buffer.hpp +++ b/ndn-cxx/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-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -24,15 +24,16 @@ #ifndef NDN_CXX_ENCODING_BUFFER_HPP #define NDN_CXX_ENCODING_BUFFER_HPP -#include "ndn-cxx/detail/common.hpp" - +#include #include +#include +#include #include namespace ndn { /** - * @brief General-purpose automatically managed/resized buffer + * @brief General-purpose automatically managed/resized buffer. * * In most respect, the Buffer class is equivalent to a `std::vector`, and it in fact * uses the latter as a base class. In addition to that, it provides the get() helper method @@ -135,8 +136,8 @@ std::ostream& boost_test_print_type(std::ostream&, const Buffer&); /** \endcond */ -using BufferPtr = shared_ptr; -using ConstBufferPtr = shared_ptr; +using BufferPtr = std::shared_ptr; +using ConstBufferPtr = std::shared_ptr; } // namespace ndn diff --git a/ndn-cxx/encoding/encoding-buffer-fwd.hpp b/ndn-cxx/encoding/encoding-buffer-fwd.hpp index 02f40167d..dce886079 100644 --- a/ndn-cxx/encoding/encoding-buffer-fwd.hpp +++ b/ndn-cxx/encoding/encoding-buffer-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-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -22,8 +22,6 @@ #ifndef NDN_CXX_ENCODING_ENCODING_BUFFER_FWD_HPP #define NDN_CXX_ENCODING_ENCODING_BUFFER_FWD_HPP -#include "ndn-cxx/detail/common.hpp" - namespace ndn { namespace encoding { diff --git a/ndn-cxx/net/dns.hpp b/ndn-cxx/net/dns.hpp index 482484d57..011db1139 100644 --- a/ndn-cxx/net/dns.hpp +++ b/ndn-cxx/net/dns.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2013-2023 Regents of the University of California. + * Copyright (c) 2013-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -27,6 +27,9 @@ #include +#include +#include + namespace ndn::dns { using AddressSelector = std::function; diff --git a/ndn-cxx/net/face-uri.cpp b/ndn-cxx/net/face-uri.cpp index b25f17844..b3281c60c 100644 --- a/ndn-cxx/net/face-uri.cpp +++ b/ndn-cxx/net/face-uri.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2013-2023 Regents of the University of California, + * Copyright (c) 2013-2024 Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -26,6 +26,8 @@ */ #include "ndn-cxx/net/face-uri.hpp" + +#include "ndn-cxx/detail/common.hpp" #include "ndn-cxx/net/dns.hpp" #include "ndn-cxx/util/string-helper.hpp" @@ -116,7 +118,7 @@ FaceUri::FaceUri(const boost::asio::ip::udp::endpoint& endpoint) m_isV6 = endpoint.address().is_v6(); m_scheme = m_isV6 ? "udp6" : "udp4"; m_host = endpoint.address().to_string(); - m_port = to_string(endpoint.port()); + m_port = std::to_string(endpoint.port()); } FaceUri::FaceUri(const boost::asio::ip::tcp::endpoint& endpoint) @@ -124,7 +126,7 @@ FaceUri::FaceUri(const boost::asio::ip::tcp::endpoint& endpoint) m_isV6 = endpoint.address().is_v6(); m_scheme = m_isV6 ? "tcp6" : "tcp4"; m_host = endpoint.address().to_string(); - m_port = to_string(endpoint.port()); + m_port = std::to_string(endpoint.port()); } FaceUri::FaceUri(const boost::asio::ip::tcp::endpoint& endpoint, std::string_view scheme) @@ -132,7 +134,7 @@ FaceUri::FaceUri(const boost::asio::ip::tcp::endpoint& endpoint, std::string_vie m_isV6 = endpoint.address().is_v6(); m_scheme = scheme; m_host = endpoint.address().to_string(); - m_port = to_string(endpoint.port()); + m_port = std::to_string(endpoint.port()); } #ifdef BOOST_ASIO_HAS_LOCAL_SOCKETS @@ -155,7 +157,7 @@ FaceUri::fromFd(int fd) { FaceUri uri; uri.m_scheme = "fd"; - uri.m_host = to_string(fd); + uri.m_host = std::to_string(fd); return uri; } @@ -174,7 +176,7 @@ FaceUri::fromUdpDev(const boost::asio::ip::udp::endpoint& endpoint, std::string_ FaceUri uri; uri.m_scheme = endpoint.address().is_v6() ? "udp6+dev" : "udp4+dev"; uri.m_host = ifname; - uri.m_port = to_string(endpoint.port()); + uri.m_port = std::to_string(endpoint.port()); return uri; } @@ -203,7 +205,8 @@ FaceUri::print(std::ostream& os) const } -/** \brief A CanonizeProvider provides FaceUri canonization functionality for a group of schemes. +/** + * \brief A CanonizeProvider provides FaceUri canonization functionality for a group of schemes. */ class CanonizeProvider : noncopyable { @@ -296,7 +299,7 @@ class IpHostCanonizeProvider : public CanonizeProvider } // make a copy because caller may modify faceUri - auto uri = make_shared(faceUri); + auto uri = std::make_shared(faceUri); boost::system::error_code ec; auto ipAddress = boost::asio::ip::make_address(unescapeHost(faceUri.getHost()), ec); if (!ec) { @@ -343,7 +346,7 @@ class IpHostCanonizeProvider : public CanonizeProvider private: void - onDnsSuccess(const shared_ptr& faceUri, + onDnsSuccess(const std::shared_ptr& faceUri, const FaceUri::CanonizeSuccessCallback& onSuccess, const FaceUri::CanonizeFailureCallback& onFailure, const boost::asio::ip::address& ipAddress) const @@ -372,7 +375,7 @@ class IpHostCanonizeProvider : public CanonizeProvider } void - onDnsFailure(const shared_ptr&, + onDnsFailure(const std::shared_ptr&, const FaceUri::CanonizeFailureCallback& onFailure, const std::string& reason) const { @@ -558,7 +561,7 @@ using CanonizeProviders = boost::mp11::mp_list; static_assert(boost::mp11::mp_is_set()); -using CanonizeProviderTable = std::map>; +using CanonizeProviderTable = std::map>; struct CanonizeProviderTableInitializer { @@ -566,7 +569,7 @@ struct CanonizeProviderTableInitializer void operator()(boost::mp11::mp_identity) { - shared_ptr cp = make_shared(); + std::shared_ptr cp = std::make_shared(); auto schemes = cp->getSchemes(); BOOST_ASSERT(!schemes.empty()); diff --git a/ndn-cxx/net/network-address.hpp b/ndn-cxx/net/network-address.hpp index d70e611fd..de3c58d07 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-2023 Regents of the University of California. + * Copyright (c) 2013-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -24,7 +24,8 @@ #ifndef NDN_CXX_NET_NETWORK_ADDRESS_HPP #define NDN_CXX_NET_NETWORK_ADDRESS_HPP -#include "ndn-cxx/detail/common.hpp" +#include +#include #include diff --git a/ndn-cxx/security/impl/openssl-helper.hpp b/ndn-cxx/security/impl/openssl-helper.hpp index 286327721..2da7a7ee6 100644 --- a/ndn-cxx/security/impl/openssl-helper.hpp +++ b/ndn-cxx/security/impl/openssl-helper.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2013-2023 Regents of the University of California. + * Copyright (c) 2013-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -22,6 +22,7 @@ #ifndef NDN_CXX_SECURITY_IMPL_OPENSSL_HELPER_HPP #define NDN_CXX_SECURITY_IMPL_OPENSSL_HELPER_HPP +#include "ndn-cxx/detail/common.hpp" #include "ndn-cxx/security/security-common.hpp" #include diff --git a/ndn-cxx/security/security-common.cpp b/ndn-cxx/security/security-common.cpp index abf0b328c..47e205065 100644 --- a/ndn-cxx/security/security-common.cpp +++ b/ndn-cxx/security/security-common.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-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -20,6 +20,7 @@ */ #include "ndn-cxx/security/security-common.hpp" +#include "ndn-cxx/util/backports.hpp" #include diff --git a/ndn-cxx/security/security-common.hpp b/ndn-cxx/security/security-common.hpp index 8100a7c45..101a475f7 100644 --- a/ndn-cxx/security/security-common.hpp +++ b/ndn-cxx/security/security-common.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2013-2023 Regents of the University of California. + * Copyright (c) 2013-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -22,9 +22,10 @@ #ifndef NDN_CXX_SECURITY_SECURITY_COMMON_HPP #define NDN_CXX_SECURITY_SECURITY_COMMON_HPP -#include "ndn-cxx/detail/common.hpp" #include "ndn-cxx/util/span.hpp" +#include +#include #include namespace ndn { diff --git a/ndn-cxx/security/transform/private-key.hpp b/ndn-cxx/security/transform/private-key.hpp index 271ffd45d..2922eb386 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-2023 Regents of the University of California. + * Copyright (c) 2013-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -22,8 +22,9 @@ #ifndef NDN_CXX_SECURITY_TRANSFORM_PRIVATE_KEY_HPP #define NDN_CXX_SECURITY_TRANSFORM_PRIVATE_KEY_HPP -#include "ndn-cxx/security/security-common.hpp" +#include "ndn-cxx/detail/common.hpp" #include "ndn-cxx/encoding/buffer.hpp" +#include "ndn-cxx/security/security-common.hpp" namespace ndn { @@ -32,7 +33,7 @@ class KeyParams; namespace security::transform { /** - * @brief Abstraction of private key in crypto transformation + * @brief Abstraction of a private key in crypto transformations. */ class PrivateKey : noncopyable { diff --git a/ndn-cxx/security/transform/public-key.hpp b/ndn-cxx/security/transform/public-key.hpp index b0b3104d6..eaa9b4edf 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-2023 Regents of the University of California. + * Copyright (c) 2013-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -22,13 +22,14 @@ #ifndef NDN_CXX_SECURITY_TRANSFORM_PUBLIC_KEY_HPP #define NDN_CXX_SECURITY_TRANSFORM_PUBLIC_KEY_HPP -#include "ndn-cxx/security/security-common.hpp" +#include "ndn-cxx/detail/common.hpp" #include "ndn-cxx/encoding/buffer.hpp" +#include "ndn-cxx/security/security-common.hpp" namespace ndn::security::transform { /** - * @brief Abstraction of public key in crypto transformation + * @brief Abstraction of a public key in crypto transformations. */ class PublicKey : noncopyable { diff --git a/ndn-cxx/security/validation-error.cpp b/ndn-cxx/security/validation-error.cpp index 82ec2f78c..4043b26e3 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-2023 Regents of the University of California. + * Copyright (c) 2013-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -20,6 +20,9 @@ */ #include "ndn-cxx/security/validation-error.hpp" +#include "ndn-cxx/util/backports.hpp" + +#include namespace ndn::security { diff --git a/ndn-cxx/security/validation-error.hpp b/ndn-cxx/security/validation-error.hpp index 9adac226f..461e50bf4 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-2023 Regents of the University of California. + * Copyright (c) 2013-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -22,7 +22,9 @@ #ifndef NDN_CXX_SECURITY_VALIDATION_ERROR_HPP #define NDN_CXX_SECURITY_VALIDATION_ERROR_HPP -#include "ndn-cxx/detail/common.hpp" +#include +#include +#include namespace ndn::security { diff --git a/ndn-cxx/util/backports.hpp b/ndn-cxx/util/backports.hpp index 18c2c9853..b13cf399d 100644 --- a/ndn-cxx/util/backports.hpp +++ b/ndn-cxx/util/backports.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2013-2023 Regents of the University of California. + * Copyright (c) 2013-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -22,14 +22,14 @@ #ifndef NDN_CXX_UTIL_BACKPORTS_HPP #define NDN_CXX_UTIL_BACKPORTS_HPP -#include "ndn-cxx/detail/common.hpp" +#include +#include +#include #include #include #include -#include - namespace ndn { // diff --git a/ndn-cxx/util/logger.hpp b/ndn-cxx/util/logger.hpp index abee11714..cb1568d82 100644 --- a/ndn-cxx/util/logger.hpp +++ b/ndn-cxx/util/logger.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2013-2023 Regents of the University of California. + * Copyright (c) 2013-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -22,7 +22,7 @@ #ifndef NDN_CXX_UTIL_LOGGER_HPP #define NDN_CXX_UTIL_LOGGER_HPP -#include "ndn-cxx/detail/common.hpp" +#include "ndn-cxx/detail/config.hpp" #ifdef HAVE_NDN_CXX_CUSTOM_LOGGER #include "ndn-cxx/util/custom-logger.hpp" @@ -33,6 +33,9 @@ #include #include +#include +#include +#include namespace ndn::util { diff --git a/ndn-cxx/util/random.cpp b/ndn-cxx/util/random.cpp index 529fc6906..bc818a9a5 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-2023 Regents of the University of California. + * Copyright (c) 2013-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -20,6 +20,7 @@ */ #include "ndn-cxx/util/random.hpp" +#include "ndn-cxx/util/exception.hpp" #include #include @@ -47,7 +48,7 @@ generateSecureBytes(span buf) { if (RAND_bytes(buf.data(), buf.size()) != 1) { NDN_THROW(std::runtime_error("Failed to generate random bytes (error code " + - to_string(ERR_get_error()) + ")")); + std::to_string(ERR_get_error()) + ")")); } } diff --git a/ndn-cxx/util/random.hpp b/ndn-cxx/util/random.hpp index cf03cc3fc..f8261b70b 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-2023 Regents of the University of California. + * Copyright (c) 2013-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -22,15 +22,15 @@ #ifndef NDN_CXX_UTIL_RANDOM_HPP #define NDN_CXX_UTIL_RANDOM_HPP -#include "ndn-cxx/detail/common.hpp" #include "ndn-cxx/util/span.hpp" +#include #include namespace ndn::random { /** - * @brief Generate a cryptographically secure random integer from the range [0, 2^32) + * @brief Generate a cryptographically secure random integer in the range `[0, 2^32)`. * * @throw std::runtime_error if generation fails. */ @@ -38,7 +38,7 @@ uint32_t generateSecureWord32(); /** - * @brief Generate a cryptographically secure random integer from the range [0, 2^64) + * @brief Generate a cryptographically secure random integer in the range `[0, 2^64)`. * * @throw std::runtime_error if generation fails. */ @@ -46,7 +46,7 @@ uint64_t generateSecureWord64(); /** - * @brief Fill @p buffer with cryptographically secure random bytes + * @brief Fill @p buffer with cryptographically secure random bytes. * * @throw std::runtime_error if generation fails. */ @@ -56,7 +56,7 @@ generateSecureBytes(span buffer); using RandomNumberEngine = std::mt19937; /** - * @brief Returns a reference to a thread-local instance of a properly seeded PRNG + * @brief Returns a reference to a thread-local instance of a properly seeded PRNG. * * @warning The returned RandomNumberEngine MUST NOT be used when cryptographically secure * random numbers are needed. @@ -65,21 +65,21 @@ RandomNumberEngine& getRandomNumberEngine(); /** - * @brief Generate a non-cryptographically-secure random integer in the range [0, 2^32) + * @brief Generate a non-cryptographically-secure random integer in the range `[0, 2^32)`. * - * This version is faster than generateSecureWord32, but it must not be used when + * This version is faster than generateSecureWord32(), but it must not be used when * cryptographically secure random integers are needed (e.g., when creating signing or - * encryption keys) + * encryption keys). */ uint32_t generateWord32(); /** - * @brief Generate a non-cryptographically-secure random integer in the range [0, 2^64) + * @brief Generate a non-cryptographically-secure random integer in the range `[0, 2^64)`. * - * This version is faster than generateSecureWord64, but it must not be used when + * This version is faster than generateSecureWord64(), but it must not be used when * cryptographically secure random integers are needed (e.g., when creating signing or - * encryption keys) + * encryption keys). */ uint64_t generateWord64(); diff --git a/ndn-cxx/util/rtt-estimator.cpp b/ndn-cxx/util/rtt-estimator.cpp index 3fb2cb52b..dadcd2816 100644 --- a/ndn-cxx/util/rtt-estimator.cpp +++ b/ndn-cxx/util/rtt-estimator.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (C) 2016-2023, Arizona Board of Regents. + * Copyright (C) 2016-2024, Arizona Board of Regents. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -28,8 +28,8 @@ namespace ndn::util { -RttEstimator::RttEstimator(shared_ptr options) - : m_options(options ? std::move(options) : make_shared()) +RttEstimator::RttEstimator(std::shared_ptr options) + : m_options(options ? std::move(options) : std::make_shared()) , m_rto(m_options->initialRto) { BOOST_ASSERT(m_options->alpha >= 0 && m_options->alpha <= 1); diff --git a/ndn-cxx/util/rtt-estimator.hpp b/ndn-cxx/util/rtt-estimator.hpp index 355a314bf..ab3a6f9c4 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-2023, Arizona Board of Regents. + * Copyright (C) 2016-2024, Arizona Board of Regents. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -29,6 +29,8 @@ #include "ndn-cxx/util/time.hpp" +#include + namespace ndn::util { /** @@ -56,7 +58,7 @@ class RttEstimator * @param options options for the estimator; if nullptr, a default set of options is used */ explicit - RttEstimator(shared_ptr options = nullptr); + RttEstimator(std::shared_ptr options = nullptr); /** * @brief Records a new RTT measurement. @@ -111,7 +113,7 @@ class RttEstimator backoffRto(); protected: - shared_ptr m_options; + std::shared_ptr m_options; private: time::nanoseconds m_sRtt{-1}; ///< smoothed round-trip time diff --git a/ndn-cxx/util/scheduler.hpp b/ndn-cxx/util/scheduler.hpp index bdf598d0d..f83e62a0b 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-2023 Regents of the University of California. + * Copyright (c) 2013-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -24,6 +24,7 @@ #include "ndn-cxx/detail/asio-fwd.hpp" #include "ndn-cxx/detail/cancel-handle.hpp" +#include "ndn-cxx/detail/common.hpp" #include "ndn-cxx/util/time.hpp" #include @@ -141,13 +142,15 @@ class Scheduler : noncopyable ~Scheduler(); - /** \brief Schedule a one-time event after the specified delay - * \return EventId that can be used to cancel the scheduled event + /** + * \brief Schedule a one-time event after the specified delay. + * \return EventId that can be used to cancel the scheduled event. */ EventId schedule(time::nanoseconds after, EventCallback callback); - /** \brief Cancel all scheduled events + /** + * \brief Cancel all scheduled events. */ void cancelAllEvents(); diff --git a/ndn-cxx/util/string-helper.hpp b/ndn-cxx/util/string-helper.hpp index 410b83f47..4c73cbec8 100644 --- a/ndn-cxx/util/string-helper.hpp +++ b/ndn-cxx/util/string-helper.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2013-2023 Regents of the University of California. + * Copyright (c) 2013-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -25,6 +25,11 @@ #include "ndn-cxx/encoding/buffer.hpp" #include "ndn-cxx/util/span.hpp" +#include +#include +#include +#include + namespace ndn { class StringHelperError : public std::invalid_argument @@ -108,7 +113,7 @@ toHex(span buffer, bool wantUpperCase = true); * without any whitespace separators (e.g., "48656C6C6F2C20776F726C6421") * @throw StringHelperError Input string is invalid */ -shared_ptr +std::shared_ptr fromHex(std::string_view hexString); /** diff --git a/ndn-cxx/util/time-custom-clock.hpp b/ndn-cxx/util/time-custom-clock.hpp index db1e977d4..a566087e5 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-2023 Regents of the University of California. + * Copyright (c) 2013-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -24,10 +24,12 @@ #include "ndn-cxx/util/time.hpp" +#include + namespace ndn::time { /** - * \brief Class implementing custom system or steady clock behavior + * \brief Class implementing custom system or steady clock behavior. * * Instance of specialization of this class may be passed to setCustomClocks() free function * in order to change global behavior of system or steady clock. @@ -53,14 +55,14 @@ using CustomSystemClock = CustomClock; using CustomSteadyClock = CustomClock; /** - * \brief Set custom system and steady clocks + * \brief Set custom system and steady clocks. * * When \p steadyClock or \p systemClock set to nullptr, the default implementation * of the corresponding clock will be used */ void -setCustomClocks(shared_ptr steadyClock = nullptr, - shared_ptr systemClock = nullptr); +setCustomClocks(std::shared_ptr steadyClock = nullptr, + std::shared_ptr systemClock = nullptr); } // namespace ndn::time diff --git a/ndn-cxx/util/time-unit-test-clock.hpp b/ndn-cxx/util/time-unit-test-clock.hpp index 2302677bf..23f43de9d 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-2023 Regents of the University of California. + * Copyright (c) 2013-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -27,7 +27,7 @@ namespace ndn::time { /** - * @brief Traits for UnitTestClock, defining default behavior for different clocks + * @brief Traits for UnitTestClock, defining default behavior for different clocks. * * The only behavior that is currently controlled by the traits is default start * time. The generic implementation assumes start time to be zero. @@ -39,12 +39,12 @@ class UnitTestClockTraits static nanoseconds getDefaultStartTime() { - return nanoseconds::zero(); + return 0_ns; } }; /** - * @brief Specialization of UnitTestClockTraits for system_clock + * @brief Specialization of UnitTestClockTraits for system_clock. * * This specialization sets the default start time to 1415684132 seconds * (equivalent to Tue 11 Nov 2014 05:35:32 UTC, if Unix epoch is assumed). @@ -56,17 +56,17 @@ class UnitTestClockTraits static nanoseconds getDefaultStartTime() { - return seconds(1415684132); + return 1415684132_s; } }; /** - * @brief Clock that can be used in unit tests for time-dependent tests independent of wall clock + * @brief Clock that can be used in unit tests for time-dependent tests independent of wall clock. * * This clock should be explicitly advanced with UnitTestClock::advance() or set * with UnitTestClock::setNow() methods. * - * @note Default start time is determined by UnitTestClockTraits + * @note Default start time is determined by UnitTestClockTraits. */ template> class UnitTestClock : public CustomClock diff --git a/ndn-cxx/util/time.cpp b/ndn-cxx/util/time.cpp index 8ad931066..adb60e155 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-2023 Regents of the University of California. + * Copyright (c) 2013-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -27,13 +27,13 @@ namespace ndn::time { -static shared_ptr g_systemClock; -static shared_ptr g_steadyClock; +static std::shared_ptr g_systemClock; +static std::shared_ptr g_steadyClock; // this function is declared in time-custom-clock.hpp void -setCustomClocks(shared_ptr steadyClock, - shared_ptr systemClock) +setCustomClocks(std::shared_ptr steadyClock, + std::shared_ptr systemClock) { g_systemClock = std::move(systemClock); g_steadyClock = std::move(steadyClock); diff --git a/ndn-cxx/util/time.hpp b/ndn-cxx/util/time.hpp index 373bc3612..01c5b88f6 100644 --- a/ndn-cxx/util/time.hpp +++ b/ndn-cxx/util/time.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2013-2023 Regents of the University of California. + * Copyright (c) 2013-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -22,12 +22,14 @@ #ifndef NDN_CXX_UTIL_TIME_HPP #define NDN_CXX_UTIL_TIME_HPP -#include "ndn-cxx/detail/common.hpp" - #include #include +#include #include +#include +#include +#include namespace ndn { namespace time { diff --git a/tests/unit/clock-fixture.cpp b/tests/unit/clock-fixture.cpp index 0efe19c3b..07afd85c5 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-2023 Regents of the University of California. + * Copyright (c) 2013-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -24,8 +24,8 @@ namespace ndn::tests { ClockFixture::ClockFixture() - : m_steadyClock(make_shared()) - , m_systemClock(make_shared()) + : m_steadyClock(std::make_shared()) + , m_systemClock(std::make_shared()) { time::setCustomClocks(m_steadyClock, m_systemClock); } diff --git a/tests/unit/clock-fixture.hpp b/tests/unit/clock-fixture.hpp index a0309aee6..d4a2c9600 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-2023 Regents of the University of California. + * Copyright (c) 2013-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -74,8 +74,8 @@ class ClockFixture } protected: - shared_ptr m_steadyClock; - shared_ptr m_systemClock; + std::shared_ptr m_steadyClock; + std::shared_ptr m_systemClock; }; } // namespace ndn::tests diff --git a/tests/unit/detail/cancel-handle.t.cpp b/tests/unit/detail/cancel-handle.t.cpp index e35fe5525..173811c7f 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-2023 Regents of the University of California. + * Copyright (c) 2013-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -106,10 +106,10 @@ BOOST_AUTO_TEST_CASE(Release) BOOST_AUTO_TEST_CASE(MoveConstruct) { int nCancels = 0; - unique_ptr hdl1; + std::unique_ptr hdl1; { ScopedTestHandle hdl2 = makeDummyCancelHandle(nCancels); - hdl1 = make_unique(std::move(hdl2)); + hdl1 = std::make_unique(std::move(hdl2)); } // hdl2 goes out of scope BOOST_CHECK_EQUAL(nCancels, 0); hdl1.reset(); diff --git a/tests/unit/encoding/buffer-stream.t.cpp b/tests/unit/encoding/buffer-stream.t.cpp index 7442299dc..e505c3d56 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-2023 Regents of the University of California. + * Copyright (c) 2013-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -32,7 +32,7 @@ BOOST_AUTO_TEST_CASE(Empty) { OBufferStream os; - shared_ptr buf = os.buf(); + std::shared_ptr buf = os.buf(); BOOST_CHECK_EQUAL(buf->size(), 0); } @@ -42,7 +42,7 @@ BOOST_AUTO_TEST_CASE(Put) os.put(0x33); os.put(0x44); - shared_ptr buf = os.buf(); + std::shared_ptr buf = os.buf(); BOOST_REQUIRE_EQUAL(buf->size(), 2); BOOST_CHECK_EQUAL(buf->at(0), 0x33); BOOST_CHECK_EQUAL(buf->at(1), 0x44); @@ -53,7 +53,7 @@ BOOST_AUTO_TEST_CASE(Write) OBufferStream os; os.write("\x11\x22", 2); - shared_ptr buf = os.buf(); + std::shared_ptr buf = os.buf(); BOOST_REQUIRE_EQUAL(buf->size(), 2); BOOST_CHECK_EQUAL(buf->at(0), 0x11); BOOST_CHECK_EQUAL(buf->at(1), 0x22); @@ -61,7 +61,7 @@ BOOST_AUTO_TEST_CASE(Write) BOOST_AUTO_TEST_CASE(Destructor) // Bug 3727 { - auto os = make_unique(); + auto os = std::make_unique(); auto buf = os->buf(); *os << 'x'; // do NOT flush or call buf() here diff --git a/tests/unit/net/dns.t.cpp b/tests/unit/net/dns.t.cpp index 17c5438be..c1e867949 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-2023 Regents of the University of California. + * Copyright (c) 2013-2024 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * @@ -20,6 +20,7 @@ */ #include "ndn-cxx/net/dns.hpp" +#include "ndn-cxx/detail/common.hpp" #include "tests/boost-test.hpp" #include "tests/unit/net/network-configuration-detector.hpp" diff --git a/tests/unit/util/rtt-estimator.t.cpp b/tests/unit/util/rtt-estimator.t.cpp index 7070fb0be..0d3877ea3 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-2023, Regents of the University of California, + * Copyright (c) 2016-2024, Regents of the University of California, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University. * @@ -58,7 +58,7 @@ BOOST_AUTO_TEST_CASE(CopyAssign) BOOST_AUTO_TEST_CASE(EstimatedRto) { - auto opts = make_shared(); + auto opts = std::make_shared(); opts->initialRto = 400_ms; opts->maxRto = 2_s; RttEstimator rttEstimator(opts); @@ -112,7 +112,7 @@ BOOST_AUTO_TEST_CASE(EstimatedRto) BOOST_AUTO_TEST_CASE(BackoffRto) { - auto opts = make_shared(); + auto opts = std::make_shared(); opts->initialRto = 500_ms; opts->maxRto = 4_s; RttEstimator rttEstimator(opts);