diff --git a/.waf-tools/websocket.py b/.waf-tools/websocket.py index 1c5fef5c..e2cba84a 100644 --- a/.waf-tools/websocket.py +++ b/.waf-tools/websocket.py @@ -53,10 +53,10 @@ def checkWebsocket(self, **kw): self.end_msg('.'.join(self.env.WEBSOCKET_VERSION)) + self.env.append_unique('DEFINES', ['_WEBSOCKETPP_CPP11_STL_']) self.env.INCLUDES_WEBSOCKET = websocketDir.parent.abspath() self.env.HAVE_WEBSOCKET = True self.define('HAVE_WEBSOCKET', 1) - self.define('_WEBSOCKETPP_CPP11_STL_', 1) except Errors.WafError as error: if isMandatory: diff --git a/core/common.hpp b/core/common.hpp index 28db4090..fe95d62f 100644 --- a/core/common.hpp +++ b/core/common.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2020, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -28,20 +28,20 @@ #include "core/config.hpp" -#ifdef WITH_TESTS -#define VIRTUAL_WITH_TESTS virtual -#define PUBLIC_WITH_TESTS_ELSE_PROTECTED public -#define PUBLIC_WITH_TESTS_ELSE_PRIVATE public -#define PROTECTED_WITH_TESTS_ELSE_PRIVATE protected -#define OVERRIDE_WITH_TESTS_ELSE_FINAL override -#define FINAL_UNLESS_WITH_TESTS +#ifdef NFD_WITH_TESTS +#define NFD_VIRTUAL_WITH_TESTS virtual +#define NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED public +#define NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE public +#define NFD_PROTECTED_WITH_TESTS_ELSE_PRIVATE protected +#define NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL override +#define NFD_FINAL_UNLESS_WITH_TESTS #else -#define VIRTUAL_WITH_TESTS -#define PUBLIC_WITH_TESTS_ELSE_PROTECTED protected -#define PUBLIC_WITH_TESTS_ELSE_PRIVATE private -#define PROTECTED_WITH_TESTS_ELSE_PRIVATE private -#define OVERRIDE_WITH_TESTS_ELSE_FINAL final -#define FINAL_UNLESS_WITH_TESTS final +#define NFD_VIRTUAL_WITH_TESTS +#define NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED protected +#define NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE private +#define NFD_PROTECTED_WITH_TESTS_ELSE_PRIVATE private +#define NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL final +#define NFD_FINAL_UNLESS_WITH_TESTS final #endif #include diff --git a/daemon/common/global.cpp b/daemon/common/global.cpp index a0fd88f7..c54f0439 100644 --- a/daemon/common/global.cpp +++ b/daemon/common/global.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2019, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -50,7 +50,7 @@ getScheduler() return *g_scheduler; } -#ifdef WITH_TESTS +#ifdef NFD_WITH_TESTS void resetGlobalIoService() { diff --git a/daemon/common/global.hpp b/daemon/common/global.hpp index 1e1fce83..ccc51607 100644 --- a/daemon/common/global.hpp +++ b/daemon/common/global.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2019 Regents of the University of California, + * Copyright (c) 2014-2021 Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -61,7 +61,7 @@ runOnMainIoService(const std::function& f); void runOnRibIoService(const std::function& f); -#ifdef WITH_TESTS +#ifdef NFD_WITH_TESTS /** \brief Destroy the global io_service instance. * * It will be recreated at the next invocation of getGlobalIoService(). diff --git a/daemon/common/privilege-helper.cpp b/daemon/common/privilege-helper.cpp index 293eb6f2..eb8e6084 100644 --- a/daemon/common/privilege-helper.cpp +++ b/daemon/common/privilege-helper.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2020, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -33,18 +33,18 @@ namespace nfd { NFD_LOG_INIT(PrivilegeHelper); -#ifdef HAVE_PRIVILEGE_DROP_AND_ELEVATE +#ifdef NFD_HAVE_PRIVILEGE_DROP_AND_ELEVATE uid_t PrivilegeHelper::s_normalUid = ::geteuid(); gid_t PrivilegeHelper::s_normalGid = ::getegid(); uid_t PrivilegeHelper::s_privilegedUid = ::geteuid(); gid_t PrivilegeHelper::s_privilegedGid = ::getegid(); -#endif // HAVE_PRIVILEGE_DROP_AND_ELEVATE +#endif // NFD_HAVE_PRIVILEGE_DROP_AND_ELEVATE void PrivilegeHelper::initialize(const std::string& userName, const std::string& groupName) { -#ifdef HAVE_PRIVILEGE_DROP_AND_ELEVATE +#ifdef NFD_HAVE_PRIVILEGE_DROP_AND_ELEVATE static const size_t MAX_GROUP_BUFFER_SIZE = 16384; // 16 KiB static const size_t MAX_PASSWD_BUFFER_SIZE = 16384; @@ -111,13 +111,13 @@ PrivilegeHelper::initialize(const std::string& userName, const std::string& grou if (!userName.empty() || !groupName.empty()) { throw Error("Dropping and raising privileges is not supported on this platform"); } -#endif // HAVE_PRIVILEGE_DROP_AND_ELEVATE +#endif // NFD_HAVE_PRIVILEGE_DROP_AND_ELEVATE } void PrivilegeHelper::drop() { -#ifdef HAVE_PRIVILEGE_DROP_AND_ELEVATE +#ifdef NFD_HAVE_PRIVILEGE_DROP_AND_ELEVATE if (::geteuid() == s_normalUid && ::getegid() == s_normalGid) return; @@ -132,13 +132,13 @@ PrivilegeHelper::drop() NFD_LOG_INFO("dropped to effective uid=" << ::geteuid() << " gid=" << ::getegid()); #else NFD_LOG_WARN("Dropping privileges is not supported on this platform"); -#endif // HAVE_PRIVILEGE_DROP_AND_ELEVATE +#endif // NFD_HAVE_PRIVILEGE_DROP_AND_ELEVATE } void PrivilegeHelper::raise() { -#ifdef HAVE_PRIVILEGE_DROP_AND_ELEVATE +#ifdef NFD_HAVE_PRIVILEGE_DROP_AND_ELEVATE if (::geteuid() == s_privilegedUid && ::getegid() == s_privilegedGid) return; @@ -153,7 +153,7 @@ PrivilegeHelper::raise() NFD_LOG_INFO("elevated to effective uid=" << ::geteuid() << " gid=" << ::getegid()); #else NFD_LOG_WARN("Elevating privileges is not supported on this platform"); -#endif // HAVE_PRIVILEGE_DROP_AND_ELEVATE +#endif // NFD_HAVE_PRIVILEGE_DROP_AND_ELEVATE } } // namespace nfd diff --git a/daemon/common/privilege-helper.hpp b/daemon/common/privilege-helper.hpp index 52daf843..f0eb3bd1 100644 --- a/daemon/common/privilege-helper.hpp +++ b/daemon/common/privilege-helper.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2019, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -71,7 +71,7 @@ public: { raise(); try { - f(); + std::forward(f)(); } catch (...) { drop(); @@ -80,18 +80,18 @@ public: drop(); } -PUBLIC_WITH_TESTS_ELSE_PRIVATE: +NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: static void raise(); -PUBLIC_WITH_TESTS_ELSE_PRIVATE: -#ifdef HAVE_PRIVILEGE_DROP_AND_ELEVATE +NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: +#ifdef NFD_HAVE_PRIVILEGE_DROP_AND_ELEVATE static uid_t s_normalUid; static gid_t s_normalGid; static uid_t s_privilegedUid; static gid_t s_privilegedGid; -#endif // HAVE_PRIVILEGE_DROP_AND_ELEVATE +#endif // NFD_HAVE_PRIVILEGE_DROP_AND_ELEVATE }; } // namespace nfd diff --git a/daemon/face/face-system.hpp b/daemon/face/face-system.hpp index 84a2dcef..3b2e3dcd 100644 --- a/daemon/face/face-system.hpp +++ b/daemon/face/face-system.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2019, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -100,7 +100,7 @@ public: bool isDryRun; }; -PUBLIC_WITH_TESTS_ELSE_PRIVATE: +NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: ProtocolFactoryCtorParams makePFCtorParams(); @@ -109,7 +109,7 @@ private: processConfig(const ConfigSection& configSection, bool isDryRun, const std::string& filename); -PUBLIC_WITH_TESTS_ELSE_PRIVATE: +NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: /** \brief config section name => protocol factory */ std::map> m_factories; diff --git a/daemon/face/face.hpp b/daemon/face/face.hpp index 82288851..0076f850 100644 --- a/daemon/face/face.hpp +++ b/daemon/face/face.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2020, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -51,7 +51,7 @@ typedef TransportState FaceState; * LinkService is the upper part, which translates between network-layer packets * and TLV blocks, and may provide additional services such as fragmentation and reassembly. */ -class Face FINAL_UNLESS_WITH_TESTS : public std::enable_shared_from_this, noncopyable +class Face NFD_FINAL_UNLESS_WITH_TESTS : public std::enable_shared_from_this, noncopyable { public: Face(unique_ptr service, unique_ptr transport); diff --git a/daemon/face/generic-link-service.hpp b/daemon/face/generic-link-service.hpp index 7a1dd4f5..7a86b09d 100644 --- a/daemon/face/generic-link-service.hpp +++ b/daemon/face/generic-link-service.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2020, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -93,8 +93,8 @@ public: /** \brief GenericLinkService is a LinkService that implements the NDNLPv2 protocol * \sa https://redmine.named-data.net/projects/nfd/wiki/NDNLPv2 */ -class GenericLinkService FINAL_UNLESS_WITH_TESTS : public LinkService - , protected virtual GenericLinkServiceCounters +class GenericLinkService NFD_FINAL_UNLESS_WITH_TESTS : public LinkService + , protected virtual GenericLinkServiceCounters { public: /** \brief Options that control the behavior of GenericLinkService @@ -184,10 +184,10 @@ public: setOptions(const Options& options); const Counters& - getCounters() const OVERRIDE_WITH_TESTS_ELSE_FINAL; + getCounters() const NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL; ssize_t - getEffectiveMtu() const OVERRIDE_WITH_TESTS_ELSE_FINAL; + getEffectiveMtu() const NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL; /** \brief Whether MTU can be overridden to the specified value * @@ -196,7 +196,7 @@ public: bool canOverrideMtuTo(ssize_t mtu) const; -PROTECTED_WITH_TESTS_ELSE_PRIVATE: // send path +NFD_PROTECTED_WITH_TESTS_ELSE_PRIVATE: // send path /** \brief request an IDLE packet to transmit pending service fields */ void @@ -208,13 +208,13 @@ PROTECTED_WITH_TESTS_ELSE_PRIVATE: // send path sendLpPacket(lp::Packet&& pkt); void - doSendInterest(const Interest& interest) OVERRIDE_WITH_TESTS_ELSE_FINAL; + doSendInterest(const Interest& interest) NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL; void - doSendData(const Data& data) OVERRIDE_WITH_TESTS_ELSE_FINAL; + doSendData(const Data& data) NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL; void - doSendNack(const ndn::lp::Nack& nack) OVERRIDE_WITH_TESTS_ELSE_FINAL; + doSendNack(const ndn::lp::Nack& nack) NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL; /** \brief assign consecutive sequence numbers to LpPackets */ @@ -245,7 +245,7 @@ private: // send path private: // receive path void - doReceivePacket(const Block& packet, const EndpointId& endpoint) OVERRIDE_WITH_TESTS_ELSE_FINAL; + doReceivePacket(const Block& packet, const EndpointId& endpoint) NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL; /** \brief decode incoming network-layer packet * \param netPkt reassembled network-layer packet @@ -297,14 +297,14 @@ private: // receive path void decodeNack(const Block& netPkt, const lp::Packet& firstPkt, const EndpointId& endpointId); -PROTECTED_WITH_TESTS_ELSE_PRIVATE: +NFD_PROTECTED_WITH_TESTS_ELSE_PRIVATE: Options m_options; LpFragmenter m_fragmenter; LpReassembler m_reassembler; LpReliability m_reliability; lp::Sequence m_lastSeqNo; -PUBLIC_WITH_TESTS_ELSE_PRIVATE: +NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: /// Time to mark next packet due to send queue congestion time::steady_clock::TimePoint m_nextMarkTime; /// number of marked packets in the current incident of congestion diff --git a/daemon/face/lp-reliability.hpp b/daemon/face/lp-reliability.hpp index 1ea2b9a6..4349fca5 100644 --- a/daemon/face/lp-reliability.hpp +++ b/daemon/face/lp-reliability.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2020, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -105,12 +105,12 @@ public: void piggyback(lp::Packet& pkt, ssize_t mtu); -PUBLIC_WITH_TESTS_ELSE_PRIVATE: +NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: class UnackedFrag; class NetPkt; using UnackedFrags = std::map; -PUBLIC_WITH_TESTS_ELSE_PRIVATE: +NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: /** \brief assign TxSequence number to a fragment * \param frag fragment to assign TxSequence to * \return assigned TxSequence number @@ -162,7 +162,7 @@ PUBLIC_WITH_TESTS_ELSE_PRIVATE: void deleteUnackedFrag(UnackedFrags::iterator fragIt); -PUBLIC_WITH_TESTS_ELSE_PRIVATE: +NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: /** \brief contains a sent fragment that has not been acknowledged and associated data */ class UnackedFrag @@ -200,7 +200,7 @@ public: tlv::sizeOfVarNumber(sizeof(lp::Sequence)) + sizeof(lp::Sequence); -PUBLIC_WITH_TESTS_ELSE_PRIVATE: +NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: Options m_options; GenericLinkService* m_linkService; UnackedFrags m_unackedFrags; diff --git a/daemon/face/multicast-udp-transport.cpp b/daemon/face/multicast-udp-transport.cpp index 0ea96874..ac66f361 100644 --- a/daemon/face/multicast-udp-transport.cpp +++ b/daemon/face/multicast-udp-transport.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2020, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -150,7 +150,7 @@ MulticastUdpTransport::openRxSocket(protocol::socket& sock, else { BOOST_ASSERT(localAddress.is_v6()); sock.set_option(boost::asio::ip::v6_only(true)); -#ifdef WITH_TESTS +#ifdef NFD_WITH_TESTS // To simplify unit tests, we bind to the "any" IPv6 address if the supplied multicast // address lacks a scope id. Calling bind() without a scope id would otherwise fail. if (multicastGroup.address().to_v6().scope_id() == 0) diff --git a/daemon/face/netdev-bound.hpp b/daemon/face/netdev-bound.hpp index 6297afdd..be4a5288 100644 --- a/daemon/face/netdev-bound.hpp +++ b/daemon/face/netdev-bound.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2019, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -61,7 +61,7 @@ public: processConfig(OptionalConfigSection configSection, FaceSystem::ConfigContext& context); -PUBLIC_WITH_TESTS_ELSE_PRIVATE: +NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: struct Rule { std::vector remotes; @@ -71,7 +71,7 @@ PUBLIC_WITH_TESTS_ELSE_PRIVATE: Rule parseRule(int index, const ConfigSection& confRule) const; -PUBLIC_WITH_TESTS_ELSE_PRIVATE: +NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: const FaceSystem& m_faceSystem; FaceCreatedCallback m_addFace; shared_ptr m_netmon; diff --git a/daemon/face/network-predicate.hpp b/daemon/face/network-predicate.hpp index 27ac8b1e..7f774867 100644 --- a/daemon/face/network-predicate.hpp +++ b/daemon/face/network-predicate.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2019, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -79,7 +79,7 @@ private: void parseList(std::set& set, std::initializer_list> list); -PUBLIC_WITH_TESTS_ELSE_PROTECTED: +NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED: std::set m_whitelist; std::set m_blacklist; }; diff --git a/daemon/face/null-transport.hpp b/daemon/face/null-transport.hpp index dc4f3b82..1c81676b 100644 --- a/daemon/face/null-transport.hpp +++ b/daemon/face/null-transport.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2020, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -33,7 +33,7 @@ namespace face { /** \brief A Transport that drops every packet. */ -class NullTransport FINAL_UNLESS_WITH_TESTS : public Transport +class NullTransport NFD_FINAL_UNLESS_WITH_TESTS : public Transport { public: explicit @@ -44,14 +44,14 @@ public: protected: void - doClose() OVERRIDE_WITH_TESTS_ELSE_FINAL + doClose() NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL { setState(TransportState::CLOSED); } private: void - doSend(const Block&) OVERRIDE_WITH_TESTS_ELSE_FINAL + doSend(const Block&) NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL { } }; diff --git a/daemon/face/pcap-helper.hpp b/daemon/face/pcap-helper.hpp index 5d239ce0..1f08d85b 100644 --- a/daemon/face/pcap-helper.hpp +++ b/daemon/face/pcap-helper.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** - * Copyright (c) 2014-2017, Regents of the University of California, +/* + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -28,7 +28,7 @@ #include "core/common.hpp" -#ifndef HAVE_LIBPCAP +#ifndef NFD_HAVE_LIBPCAP #error "Cannot include this file when libpcap is not available" #endif diff --git a/daemon/face/tcp-factory.hpp b/daemon/face/tcp-factory.hpp index 0c22738f..519d2dc6 100644 --- a/daemon/face/tcp-factory.hpp +++ b/daemon/face/tcp-factory.hpp @@ -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-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -79,7 +79,7 @@ private: bool m_wantCongestionMarking = false; std::map> m_channels; -PUBLIC_WITH_TESTS_ELSE_PRIVATE: +NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: IpAddressPredicate m_local; }; diff --git a/daemon/face/tcp-transport.hpp b/daemon/face/tcp-transport.hpp index a6a20485..c300eedf 100644 --- a/daemon/face/tcp-transport.hpp +++ b/daemon/face/tcp-transport.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2019, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -40,7 +40,7 @@ NFD_LOG_MEMBER_DECL_SPECIALIZED(StreamTransport); * state is set to DOWN, and the connection is retried periodically with exponential backoff * until it is reestablished */ -class TcpTransport FINAL_UNLESS_WITH_TESTS : public StreamTransport +class TcpTransport NFD_FINAL_UNLESS_WITH_TESTS : public StreamTransport { public: TcpTransport(protocol::socket&& socket, ndn::nfd::FacePersistency persistency, ndn::nfd::FaceScope faceScope); @@ -61,17 +61,17 @@ protected: void handleError(const boost::system::error_code& error) final; -PROTECTED_WITH_TESTS_ELSE_PRIVATE: - VIRTUAL_WITH_TESTS void +NFD_PROTECTED_WITH_TESTS_ELSE_PRIVATE: + NFD_VIRTUAL_WITH_TESTS void reconnect(); - VIRTUAL_WITH_TESTS void + NFD_VIRTUAL_WITH_TESTS void handleReconnect(const boost::system::error_code& error); - VIRTUAL_WITH_TESTS void + NFD_VIRTUAL_WITH_TESTS void handleReconnectTimeout(); -PUBLIC_WITH_TESTS_ELSE_PRIVATE: +NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: /** \brief how long to wait before the first reconnection attempt after the TCP connection has been severed */ static time::milliseconds s_initialReconnectWait; diff --git a/daemon/face/unix-stream-transport.hpp b/daemon/face/unix-stream-transport.hpp index a52567a4..1993143b 100644 --- a/daemon/face/unix-stream-transport.hpp +++ b/daemon/face/unix-stream-transport.hpp @@ -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-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -28,7 +28,7 @@ #include "stream-transport.hpp" -#ifndef HAVE_UNIX_SOCKETS +#ifndef NFD_HAVE_UNIX_SOCKETS #error "Cannot include this file when UNIX sockets are not available" #endif diff --git a/daemon/face/websocket-channel.hpp b/daemon/face/websocket-channel.hpp index c1b28055..1409289f 100644 --- a/daemon/face/websocket-channel.hpp +++ b/daemon/face/websocket-channel.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** - * Copyright (c) 2014-2017, Regents of the University of California, +/* + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -74,7 +74,7 @@ public: void listen(const FaceCreatedCallback& onFaceCreated); -PUBLIC_WITH_TESTS_ELSE_PRIVATE: +NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: /** \pre listen hasn't been invoked */ void diff --git a/daemon/face/websocketpp.hpp b/daemon/face/websocketpp.hpp index 022682b9..4815ed17 100644 --- a/daemon/face/websocketpp.hpp +++ b/daemon/face/websocketpp.hpp @@ -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-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -26,9 +26,11 @@ #ifndef NFD_DAEMON_FACE_WEBSOCKETPP_HPP #define NFD_DAEMON_FACE_WEBSOCKETPP_HPP -#ifndef HAVE_WEBSOCKET +#include "core/config.hpp" + +#ifndef NFD_HAVE_WEBSOCKET #error "Cannot include this file when WebSocket support is disabled" -#endif // HAVE_WEBSOCKET +#endif // suppress websocketpp warnings #pragma GCC system_header diff --git a/daemon/fw/best-route-strategy2.hpp b/daemon/fw/best-route-strategy2.hpp index bcb994d1..79c6c0d2 100644 --- a/daemon/fw/best-route-strategy2.hpp +++ b/daemon/fw/best-route-strategy2.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2020, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -68,7 +68,7 @@ public: afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack, const shared_ptr& pitEntry) override; -PUBLIC_WITH_TESTS_ELSE_PRIVATE: +NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: static const time::milliseconds RETX_SUPPRESSION_INITIAL; static const time::milliseconds RETX_SUPPRESSION_MAX; RetxSuppressionExponential m_retxSuppression; diff --git a/daemon/fw/forwarder.hpp b/daemon/fw/forwarder.hpp index f736e0f9..4bdd42a9 100644 --- a/daemon/fw/forwarder.hpp +++ b/daemon/fw/forwarder.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2020, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -54,7 +54,7 @@ public: explicit Forwarder(FaceTable& faceTable); - VIRTUAL_WITH_TESTS + NFD_VIRTUAL_WITH_TESTS ~Forwarder(); const ForwarderCounters& @@ -165,76 +165,76 @@ public: // forwarding entrypoints and tables return m_networkRegionTable; } -PUBLIC_WITH_TESTS_ELSE_PRIVATE: // pipelines +NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: // pipelines /** \brief incoming Interest pipeline */ - VIRTUAL_WITH_TESTS void + NFD_VIRTUAL_WITH_TESTS void onIncomingInterest(const FaceEndpoint& ingress, const Interest& interest); /** \brief Interest loop pipeline */ - VIRTUAL_WITH_TESTS void + NFD_VIRTUAL_WITH_TESTS void onInterestLoop(const FaceEndpoint& ingress, const Interest& interest); /** \brief Content Store miss pipeline */ - VIRTUAL_WITH_TESTS void + NFD_VIRTUAL_WITH_TESTS void onContentStoreMiss(const FaceEndpoint& ingress, const shared_ptr& pitEntry, const Interest& interest); /** \brief Content Store hit pipeline */ - VIRTUAL_WITH_TESTS void + NFD_VIRTUAL_WITH_TESTS void onContentStoreHit(const FaceEndpoint& ingress, const shared_ptr& pitEntry, const Interest& interest, const Data& data); /** \brief outgoing Interest pipeline * \return A pointer to the out-record created or nullptr if the Interest was dropped */ - VIRTUAL_WITH_TESTS pit::OutRecord* + NFD_VIRTUAL_WITH_TESTS pit::OutRecord* onOutgoingInterest(const shared_ptr& pitEntry, Face& egress, const Interest& interest); /** \brief Interest finalize pipeline */ - VIRTUAL_WITH_TESTS void + NFD_VIRTUAL_WITH_TESTS void onInterestFinalize(const shared_ptr& pitEntry); /** \brief incoming Data pipeline */ - VIRTUAL_WITH_TESTS void + NFD_VIRTUAL_WITH_TESTS void onIncomingData(const FaceEndpoint& ingress, const Data& data); /** \brief Data unsolicited pipeline */ - VIRTUAL_WITH_TESTS void + NFD_VIRTUAL_WITH_TESTS void onDataUnsolicited(const FaceEndpoint& ingress, const Data& data); /** \brief outgoing Data pipeline * \return Whether the Data was transmitted (true) or dropped (false) */ - VIRTUAL_WITH_TESTS bool + NFD_VIRTUAL_WITH_TESTS bool onOutgoingData(const Data& data, Face& egress); /** \brief incoming Nack pipeline */ - VIRTUAL_WITH_TESTS void + NFD_VIRTUAL_WITH_TESTS void onIncomingNack(const FaceEndpoint& ingress, const lp::Nack& nack); /** \brief outgoing Nack pipeline * \return Whether the Nack was transmitted (true) or dropped (false) */ - VIRTUAL_WITH_TESTS bool + NFD_VIRTUAL_WITH_TESTS bool onOutgoingNack(const shared_ptr& pitEntry, Face& egress, const lp::NackHeader& nack); - VIRTUAL_WITH_TESTS void + NFD_VIRTUAL_WITH_TESTS void onDroppedInterest(const Face& egress, const Interest& interest); - VIRTUAL_WITH_TESTS void + NFD_VIRTUAL_WITH_TESTS void onNewNextHop(const Name& prefix, const fib::NextHop& nextHop); -PROTECTED_WITH_TESTS_ELSE_PRIVATE: +NFD_PROTECTED_WITH_TESTS_ELSE_PRIVATE: /** \brief set a new expiry timer (now + \p duration) on a PIT entry */ void @@ -244,18 +244,18 @@ PROTECTED_WITH_TESTS_ELSE_PRIVATE: * \param upstream if null, insert Nonces from all out-records; * if not null, insert Nonce only on the out-records of this face */ - VIRTUAL_WITH_TESTS void + NFD_VIRTUAL_WITH_TESTS void insertDeadNonceList(pit::Entry& pitEntry, Face* upstream); /** \brief call trigger (method) on the effective strategy of pitEntry */ -#ifdef WITH_TESTS +#ifdef NFD_WITH_TESTS virtual void dispatchToStrategy(pit::Entry& pitEntry, std::function trigger) #else template void - dispatchToStrategy(pit::Entry& pitEntry, Function trigger) + dispatchToStrategy(pit::Entry& pitEntry, Function&& trigger) #endif { trigger(m_strategyChoice.findEffectiveStrategy(pitEntry)); diff --git a/daemon/fw/multicast-strategy.hpp b/daemon/fw/multicast-strategy.hpp index 711680a2..3dd9f6c2 100644 --- a/daemon/fw/multicast-strategy.hpp +++ b/daemon/fw/multicast-strategy.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2020, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -57,7 +57,7 @@ private: friend ProcessNackTraits; RetxSuppressionExponential m_retxSuppression; -PUBLIC_WITH_TESTS_ELSE_PRIVATE: +NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: static const time::milliseconds RETX_SUPPRESSION_INITIAL; static const time::milliseconds RETX_SUPPRESSION_MAX; }; diff --git a/daemon/fw/ncc-strategy.hpp b/daemon/fw/ncc-strategy.hpp index dadbded8..3ba5019f 100644 --- a/daemon/fw/ncc-strategy.hpp +++ b/daemon/fw/ncc-strategy.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2020, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -50,7 +50,7 @@ public: beforeSatisfyInterest(const shared_ptr& pitEntry, const FaceEndpoint& ingress, const Data& data) override; -PUBLIC_WITH_TESTS_ELSE_PROTECTED: +NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED: /// StrategyInfo on measurements::Entry class MeasurementsEntryInfo : public StrategyInfo { diff --git a/daemon/fw/strategy-info.hpp b/daemon/fw/strategy-info.hpp index aae38628..49b5b950 100644 --- a/daemon/fw/strategy-info.hpp +++ b/daemon/fw/strategy-info.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** - * Copyright (c) 2014-2016, Regents of the University of California, +/* + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -31,7 +31,7 @@ namespace nfd { namespace fw { -/** \brief contains arbitrary information forwarding strategy places on table entries +/** \brief Contains arbitrary information placed by the forwarding strategy on table entries */ class StrategyInfo { @@ -41,10 +41,7 @@ public: * \sa https://redmine.named-data.net/projects/nfd/wiki/StrategyInfoType */ static constexpr int - getTypeId() - { - return ; - } + getTypeId(); #endif virtual diff --git a/daemon/fw/strategy.hpp b/daemon/fw/strategy.hpp index 37b1553a..571d7d1d 100644 --- a/daemon/fw/strategy.hpp +++ b/daemon/fw/strategy.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2020, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -257,7 +257,7 @@ protected: // actions * \param interest the Interest packet * \return A pointer to the out-record created or nullptr if the Interest was dropped */ - VIRTUAL_WITH_TESTS pit::OutRecord* + NFD_VIRTUAL_WITH_TESTS pit::OutRecord* sendInterest(const shared_ptr& pitEntry, Face& egress, const Interest& interest); @@ -267,7 +267,7 @@ protected: // actions * \param egress face through which to send out the Data * \return Whether the Data was sent (true) or dropped (false) */ - VIRTUAL_WITH_TESTS bool + NFD_VIRTUAL_WITH_TESTS bool sendData(const shared_ptr& pitEntry, const Data& data, Face& egress); /** \brief Send a Data packet to all matched and qualified faces. @@ -278,7 +278,7 @@ protected: // actions * \param inFace face on which the Data arrived * \param data the Data packet */ - VIRTUAL_WITH_TESTS void + NFD_VIRTUAL_WITH_TESTS void sendDataToAll(const shared_ptr& pitEntry, const Face& inFace, const Data& data); /** \brief Schedule the PIT entry for immediate deletion. @@ -287,7 +287,7 @@ protected: // actions * The strategy should invoke this function when it concludes that the Interest cannot * be forwarded and it does not want to wait for responses from existing upstream nodes. */ - VIRTUAL_WITH_TESTS void + NFD_VIRTUAL_WITH_TESTS void rejectPendingInterest(const shared_ptr& pitEntry) { this->setExpiryTimer(pitEntry, 0_ms); @@ -302,7 +302,7 @@ protected: // actions * \param header the Nack header * \return Whether the Nack was sent (true) or dropped (false) */ - VIRTUAL_WITH_TESTS bool + NFD_VIRTUAL_WITH_TESTS bool sendNack(const shared_ptr& pitEntry, Face& egress, const lp::NackHeader& header) { @@ -388,7 +388,7 @@ protected: // instance name m_name = name; } -PUBLIC_WITH_TESTS_ELSE_PROTECTED: // setter +NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED: // setter /** \brief Set whether the afterNewNextHop trigger should be invoked for this strategy */ void diff --git a/daemon/main.cpp b/daemon/main.cpp index 47f73333..1b529fbd 100644 --- a/daemon/main.cpp +++ b/daemon/main.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2019, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -50,13 +50,13 @@ #include #include -#ifdef HAVE_LIBPCAP +#ifdef NFD_HAVE_LIBPCAP #include #endif -#ifdef HAVE_SYSTEMD +#ifdef NFD_HAVE_SYSTEMD #include #endif -#ifdef HAVE_WEBSOCKET +#ifdef NFD_HAVE_WEBSOCKET #include #endif @@ -180,7 +180,7 @@ public: static void systemdNotify(const char* state) { -#ifdef HAVE_SYSTEMD +#ifdef NFD_HAVE_SYSTEMD sd_notify(0, state); #endif } @@ -247,14 +247,14 @@ main(int argc, char** argv) { using namespace nfd; - std::string configFile = DEFAULT_CONFIG_FILE; + std::string configFile = NFD_DEFAULT_CONFIG_FILE; po::options_description description("Options"); description.add_options() ("help,h", "print this message and exit") ("version,V", "show version information and exit") ("config,c", po::value(&configFile), - "path to configuration file (default: " DEFAULT_CONFIG_FILE ")") + "path to configuration file (default: " NFD_DEFAULT_CONFIG_FILE ")") ("modules,m", "list available logging modules") ; @@ -292,13 +292,13 @@ main(int argc, char** argv) "." + to_string(BOOST_VERSION / 100 % 1000) + "." + to_string(BOOST_VERSION % 100); const std::string pcapBuildInfo = -#ifdef HAVE_LIBPCAP +#ifdef NFD_HAVE_LIBPCAP "with " + std::string(pcap_lib_version()); #else "without libpcap"; #endif const std::string wsBuildInfo = -#ifdef HAVE_WEBSOCKET +#ifdef NFD_HAVE_WEBSOCKET "with WebSocket++ version " + to_string(websocketpp::major_version) + "." + to_string(websocketpp::minor_version) + "." + to_string(websocketpp::patch_version); diff --git a/daemon/mgmt/face-manager.hpp b/daemon/mgmt/face-manager.hpp index 4e233cb8..c1547c52 100644 --- a/daemon/mgmt/face-manager.hpp +++ b/daemon/mgmt/face-manager.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2019, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -86,7 +86,7 @@ private: signal::ScopedConnection m_faceAddConn; signal::ScopedConnection m_faceRemoveConn; -PUBLIC_WITH_TESTS_ELSE_PRIVATE: +NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: std::map m_faceStateChangeConn; }; diff --git a/daemon/mgmt/manager-base.hpp b/daemon/mgmt/manager-base.hpp index 2c963b13..e061217b 100644 --- a/daemon/mgmt/manager-base.hpp +++ b/daemon/mgmt/manager-base.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2019, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -71,7 +71,7 @@ protected: ManagerBase(const std::string& module, Dispatcher& dispatcher, CommandAuthenticator& authenticator); -PUBLIC_WITH_TESTS_ELSE_PROTECTED: // registrations to the dispatcher +NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED: // registrations to the dispatcher // difference from mgmt::ControlCommand: accepts nfd::ControlParameters using ControlCommandHandler = std::function policy); -PUBLIC_WITH_TESTS_ELSE_PRIVATE: +NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: void dump(); diff --git a/daemon/table/dead-nonce-list.hpp b/daemon/table/dead-nonce-list.hpp index 5b491435..5322dd42 100644 --- a/daemon/table/dead-nonce-list.hpp +++ b/daemon/table/dead-nonce-list.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2020, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -146,7 +146,7 @@ private: Queue& m_queue; Hashtable& m_ht; -PUBLIC_WITH_TESTS_ELSE_PRIVATE: // actual lifetime estimation and capacity control +NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: // actual lifetime estimation and capacity control // ---- current capacity and hard limits diff --git a/docs/doxygen.conf.in b/docs/doxygen.conf.in index 06b4bd71..c931ea28 100644 --- a/docs/doxygen.conf.in +++ b/docs/doxygen.conf.in @@ -2057,12 +2057,12 @@ PREDEFINED = DOXYGEN \ NFD_LOG_MEMBER_DECL_SPECIALIZED(x)= \ NFD_LOG_MEMBER_INIT(x,y)= \ NFD_LOG_MEMBER_INIT_SPECIALIZED(x,y)= \ - VIRTUAL_WITH_TESTS= \ - PUBLIC_WITH_TESTS_ELSE_PROTECTED=protected \ - PUBLIC_WITH_TESTS_ELSE_PRIVATE=private \ - PROTECTED_WITH_TESTS_ELSE_PRIVATE=private \ - OVERRIDE_WITH_TESTS_ELSE_FINAL=final \ - FINAL_UNLESS_WITH_TESTS=final + NFD_VIRTUAL_WITH_TESTS= \ + NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED=protected \ + NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE=private \ + NFD_PROTECTED_WITH_TESTS_ELSE_PRIVATE=private \ + NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL=final \ + NFD_FINAL_UNLESS_WITH_TESTS=final # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff --git a/tests/daemon/common/privilege-helper.t.cpp b/tests/daemon/common/privilege-helper.t.cpp index dcea7cb4..c670a5fc 100644 --- a/tests/daemon/common/privilege-helper.t.cpp +++ b/tests/daemon/common/privilege-helper.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2019, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -34,7 +34,7 @@ BOOST_AUTO_TEST_SUITE(TestPrivilegeHelper) BOOST_AUTO_TEST_CASE(DropRaise) { -#ifdef HAVE_PRIVILEGE_DROP_AND_ELEVATE +#ifdef NFD_HAVE_PRIVILEGE_DROP_AND_ELEVATE SKIP_IF_NOT_SUPERUSER(); // The following assumes that daemon:daemon is present on the test system @@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE(DropRaise) #else BOOST_TEST_MESSAGE("Dropping/raising privileges not supported on this platform, skipping"); -#endif // HAVE_PRIVILEGE_DROP_AND_ELEVATE +#endif // NFD_HAVE_PRIVILEGE_DROP_AND_ELEVATE } BOOST_AUTO_TEST_SUITE_END() // TestPrivilegeHelper diff --git a/tests/daemon/mgmt/general-config-section.t.cpp b/tests/daemon/mgmt/general-config-section.t.cpp index 5dbfc41b..cad78341 100644 --- a/tests/daemon/mgmt/general-config-section.t.cpp +++ b/tests/daemon/mgmt/general-config-section.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2019, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -46,14 +46,14 @@ public: setConfigFile(configFile); } -#ifdef HAVE_PRIVILEGE_DROP_AND_ELEVATE +#ifdef NFD_HAVE_PRIVILEGE_DROP_AND_ELEVATE ~GeneralConfigSectionFixture() { // revert changes to s_normalUid/s_normalGid, if any PrivilegeHelper::s_normalUid = ::geteuid(); PrivilegeHelper::s_normalGid = ::getegid(); } -#endif // HAVE_PRIVILEGE_DROP_AND_ELEVATE +#endif // NFD_HAVE_PRIVILEGE_DROP_AND_ELEVATE protected: ConfigFile configFile; @@ -76,7 +76,7 @@ BOOST_AUTO_TEST_CASE(EmptyConfig) BOOST_CHECK_EQUAL(PrivilegeHelper::s_normalGid, PrivilegeHelper::s_privilegedGid); } -#ifdef HAVE_PRIVILEGE_DROP_AND_ELEVATE +#ifdef NFD_HAVE_PRIVILEGE_DROP_AND_ELEVATE BOOST_AUTO_TEST_CASE(UserConfig) { @@ -124,7 +124,7 @@ BOOST_AUTO_TEST_CASE(UserAndGroupConfig) BOOST_CHECK_NE(PrivilegeHelper::s_normalGid, PrivilegeHelper::s_privilegedGid); } -#endif // HAVE_PRIVILEGE_DROP_AND_ELEVATE +#endif // NFD_HAVE_PRIVILEGE_DROP_AND_ELEVATE BOOST_AUTO_TEST_CASE(InvalidUserConfig) { diff --git a/tests/other/cs-benchmark.cpp b/tests/other/cs-benchmark.cpp index e6948ed9..26f54100 100644 --- a/tests/other/cs-benchmark.cpp +++ b/tests/other/cs-benchmark.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2020, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -28,7 +28,7 @@ #include -#ifdef HAVE_VALGRIND +#ifdef NFD_HAVE_VALGRIND #include #endif @@ -50,7 +50,7 @@ protected: static time::microseconds timedRun(const std::function& f) { -#ifdef HAVE_VALGRIND +#ifdef NFD_HAVE_VALGRIND CALLGRIND_START_INSTRUMENTATION; #endif @@ -58,7 +58,7 @@ protected: f(); auto t2 = time::steady_clock::now(); -#ifdef HAVE_VALGRIND +#ifdef NFD_HAVE_VALGRIND CALLGRIND_STOP_INSTRUMENTATION; #endif diff --git a/tests/other/face-benchmark.cpp b/tests/other/face-benchmark.cpp index 3bf5a146..9ee179f6 100644 --- a/tests/other/face-benchmark.cpp +++ b/tests/other/face-benchmark.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2020, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -33,7 +33,7 @@ #include #include -#ifdef HAVE_VALGRIND +#ifdef NFD_HAVE_VALGRIND #include #endif @@ -189,7 +189,7 @@ main(int argc, char** argv) try { nfd::tests::FaceBenchmark bench{argv[1]}; -#ifdef HAVE_VALGRIND +#ifdef NFD_HAVE_VALGRIND CALLGRIND_START_INSTRUMENTATION; #endif nfd::getGlobalIoService().run(); diff --git a/tests/other/pit-fib-benchmark.cpp b/tests/other/pit-fib-benchmark.cpp index 41449c07..c6888d1a 100644 --- a/tests/other/pit-fib-benchmark.cpp +++ b/tests/other/pit-fib-benchmark.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2019, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -29,7 +29,7 @@ #include -#ifdef HAVE_VALGRIND +#ifdef NFD_HAVE_VALGRIND #include #endif @@ -118,7 +118,7 @@ BOOST_FIXTURE_TEST_CASE(SimpleExchanges, PitFibBenchmarkFixture) generatePacketsAndPopulateFib(nRoundTrip, nFibEntries, fibPrefixLength, interestNameLength, dataNameLength); -#ifdef HAVE_VALGRIND +#ifdef NFD_HAVE_VALGRIND CALLGRIND_START_INSTRUMENTATION; #endif @@ -142,7 +142,7 @@ BOOST_FIXTURE_TEST_CASE(SimpleExchanges, PitFibBenchmarkFixture) auto t2 = time::steady_clock::now(); -#ifdef HAVE_VALGRIND +#ifdef NFD_HAVE_VALGRIND CALLGRIND_STOP_INSTRUMENTATION; #endif diff --git a/tests/test-common.hpp b/tests/test-common.hpp index 9d4edbdc..e25c6c9e 100644 --- a/tests/test-common.hpp +++ b/tests/test-common.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2020, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -31,7 +31,7 @@ #include -#ifdef HAVE_PRIVILEGE_DROP_AND_ELEVATE +#ifdef NFD_HAVE_PRIVILEGE_DROP_AND_ELEVATE #include #define SKIP_IF_NOT_SUPERUSER() \ do { \ @@ -42,7 +42,7 @@ } while (false) #else #define SKIP_IF_NOT_SUPERUSER() -#endif // HAVE_PRIVILEGE_DROP_AND_ELEVATE +#endif // NFD_HAVE_PRIVILEGE_DROP_AND_ELEVATE namespace nfd { namespace tests { diff --git a/tools/ndn-autoconfig/procedure.hpp b/tools/ndn-autoconfig/procedure.hpp index 67e1209c..7c52658e 100644 --- a/tools/ndn-autoconfig/procedure.hpp +++ b/tools/ndn-autoconfig/procedure.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2017, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -27,6 +27,7 @@ #define NFD_TOOLS_NDN_AUTOCONFIG_PROCEDURE_HPP #include "stage.hpp" + #include #include #include @@ -63,7 +64,7 @@ public: } private: - VIRTUAL_WITH_TESTS void + NFD_VIRTUAL_WITH_TESTS void makeStages(const Options& options); void @@ -79,7 +80,7 @@ public: */ util::Signal onComplete; -PROTECTED_WITH_TESTS_ELSE_PRIVATE: +NFD_PROTECTED_WITH_TESTS_ELSE_PRIVATE: std::vector> m_stages; private: diff --git a/tools/nfdc/status-report.hpp b/tools/nfdc/status-report.hpp index f88b175d..ae5ecdca 100644 --- a/tools/nfdc/status-report.hpp +++ b/tools/nfdc/status-report.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2020, Regents of the University of California, + * Copyright (c) 2014-2021, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -27,6 +27,7 @@ #define NFD_TOOLS_NFDC_STATUS_REPORT_HPP #include "module.hpp" + #include #include #include @@ -55,7 +56,7 @@ operator<<(std::ostream& os, ReportFormat fmt); class StatusReport : noncopyable { public: -#ifdef WITH_TESTS +#ifdef NFD_WITH_TESTS virtual ~StatusReport() = default; #endif @@ -83,7 +84,7 @@ public: formatText(std::ostream& os) const; private: - VIRTUAL_WITH_TESTS void + NFD_VIRTUAL_WITH_TESTS void processEvents(Face& face); public: diff --git a/wscript b/wscript index 15cb62d6..aef43204 100644 --- a/wscript +++ b/wscript @@ -1,6 +1,6 @@ # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- """ -Copyright (c) 2014-2020, Regents of the University of California, +Copyright (c) 2014-2021, Regents of the University of California, Arizona Board of Regents, Colorado State University, University Pierre & Marie Curie, Sorbonne University, @@ -144,7 +144,7 @@ def configure(conf): # or conf.define_cond(). Everything that was added directly to conf.env.DEFINES # will not appear in the config header, but will instead be passed directly to the # compiler on the command line. - conf.write_config_header('core/config.hpp') + conf.write_config_header('core/config.hpp', define_prefix='NFD_') def build(bld): versionhpp(bld)