diff --git a/daemon/common/config-file.hpp b/daemon/common/config-file.hpp index 39cc2edf..fac8da81 100644 --- a/daemon/common/config-file.hpp +++ b/daemon/common/config-file.hpp @@ -32,27 +32,32 @@ namespace nfd { -/** \brief a config file section +/** + * \brief A configuration file section. */ using ConfigSection = boost::property_tree::ptree; -/** \brief an optional config file section +/** + * \brief An optional configuration file section. */ using OptionalConfigSection = boost::optional; -/** \brief callback to process a config file section +/** + * \brief Callback to process a configuration file section. */ using ConfigSectionHandler = std::function; -/** \brief callback to process a config file section without a \p ConfigSectionHandler +/** + * \brief Callback to process a configuration file section without a #ConfigSectionHandler. */ using UnknownConfigSectionHandler = std::function; -/** \brief configuration file parsing utility +/** + * \brief Configuration file parsing utility. */ class ConfigFile : noncopyable { @@ -80,7 +85,7 @@ public: // unknown section handlers bool isDryRun); public: // parse helpers - /** \brief parse a config option that can be either "yes" or "no" + /** \brief Parse a config option that can be either "yes" or "no". * \retval true "yes" * \retval false "no" * \throw Error the value is neither "yes" nor "no" @@ -95,7 +100,7 @@ public: // parse helpers } /** - * \brief parse a numeric (integral or floating point) config option + * \brief Parse a numeric (integral or floating point) config option. * \tparam T an arithmetic type * * \return the numeric value of the parsed option @@ -125,7 +130,7 @@ public: // parse helpers } /** - * \brief check that a value is within the inclusive range [min, max] + * \brief Check that a value is within the inclusive range [min, max]. * \throw Error the value is out of the acceptable range */ template @@ -142,7 +147,7 @@ public: // parse helpers } public: // setup and parsing - /// \brief setup notification of configuration file sections + /// \brief Setup notification of configuration file sections. void addSectionHandler(const std::string& sectionName, ConfigSectionHandler subscriber); diff --git a/daemon/common/counter.hpp b/daemon/common/counter.hpp index 4619b355..805ebdf8 100644 --- a/daemon/common/counter.hpp +++ b/daemon/common/counter.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-2022, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -30,24 +30,27 @@ namespace nfd { -/** \brief represents a counter that encloses an integer value +/** + * \brief Represents a counter that encloses an integer value. * - * SimpleCounter is noncopyable, because increment should be called on the counter, - * not a copy of it; it's implicitly convertible to an integral type to be observed + * SimpleCounter is noncopyable, because increment should be called on the counter, + * not a copy of it; it's implicitly convertible to an integral type to be observed. */ class SimpleCounter : noncopyable { public: typedef uint64_t rep; - /** \brief observe the counter + /** + * \brief Observe the counter's value. */ operator rep() const noexcept { return m_value; } - /** \brief replace the counter value + /** + * \brief Replace the counter's value. */ void set(rep value) noexcept @@ -59,14 +62,14 @@ protected: rep m_value = 0; }; -/** \brief represents a counter of number of packets +/** \brief Represents a counter of number of packets. * * \warning The counter value may wrap after exceeding the range of underlying integer type. */ class PacketCounter : public SimpleCounter { public: - /** \brief increment the counter by one + /** \brief Increment the counter by one. */ PacketCounter& operator++() noexcept @@ -77,14 +80,14 @@ public: // postfix ++ operator is not provided because it's not needed }; -/** \brief represents a counter of number of bytes +/** \brief Represents a counter of number of bytes. * * \warning The counter value may wrap after exceeding the range of underlying integer type. */ class ByteCounter : public SimpleCounter { public: - /** \brief increase the counter + /** \brief Increase the counter. */ ByteCounter& operator+=(rep n) noexcept @@ -94,7 +97,7 @@ public: } }; -/** \brief provides a counter that observes the size of a table +/** \brief Provides a counter that observes the size of a table. * \tparam T a type that provides a size() const member function * * if table not specified in constructor, it can be added later by invoking observe() @@ -117,7 +120,7 @@ public: m_table = table; } - /** \brief observe the counter + /** \brief Observe the counter. */ operator Rep() const { diff --git a/daemon/common/privilege-helper.hpp b/daemon/common/privilege-helper.hpp index b26dce64..cdd4d057 100644 --- a/daemon/common/privilege-helper.hpp +++ b/daemon/common/privilege-helper.hpp @@ -35,10 +35,12 @@ namespace nfd { class PrivilegeHelper { public: - /** \brief represents a serious seteuid/gid failure + /** + * \brief Indicates a serious seteuid/setegid failure. * - * This should only be caught by main as part of a graceful program termination. - * \note This is not an std::exception and NDN_THROW should not be used. + * This should only be caught by main as part of a graceful program termination. + * + * \note This is not an std::exception and NDN_THROW should not be used. */ class Error { diff --git a/daemon/face/channel.cpp b/daemon/face/channel.cpp index fa25405a..b1b087c0 100644 --- a/daemon/face/channel.cpp +++ b/daemon/face/channel.cpp @@ -31,13 +31,13 @@ namespace nfd::face { Channel::~Channel() = default; void -Channel::setUri(const FaceUri& uri) +Channel::setUri(const FaceUri& uri) noexcept { m_uri = uri; } void -Channel::setDefaultMtu(size_t mtu) +Channel::setDefaultMtu(size_t mtu) noexcept { m_defaultMtu = mtu; } diff --git a/daemon/face/channel.hpp b/daemon/face/channel.hpp index 8d624fb8..19fcd351 100644 --- a/daemon/face/channel.hpp +++ b/daemon/face/channel.hpp @@ -44,35 +44,38 @@ public: ~Channel(); const FaceUri& - getUri() const + getUri() const noexcept { return m_uri; } - /** \brief Returns the default MTU for all faces created by this channel + /** + * \brief Returns the default MTU for all faces created by this channel. */ size_t - getDefaultMtu() const + getDefaultMtu() const noexcept { return m_defaultMtu; } - /** \brief Returns whether the channel is listening + /** + * \brief Returns whether the channel is listening. */ virtual bool isListening() const = 0; - /** \brief Returns the number of faces in the channel + /** + * \brief Returns the number of faces in the channel. */ virtual size_t size() const = 0; protected: void - setUri(const FaceUri& uri); + setUri(const FaceUri& uri) noexcept; void - setDefaultMtu(size_t mtu); + setDefaultMtu(size_t mtu) noexcept; private: FaceUri m_uri; diff --git a/daemon/face/ethernet-channel.hpp b/daemon/face/ethernet-channel.hpp index bc9b1417..8c118241 100644 --- a/daemon/face/ethernet-channel.hpp +++ b/daemon/face/ethernet-channel.hpp @@ -47,11 +47,7 @@ public: class Error : public std::runtime_error { public: - explicit - Error(const std::string& what) - : std::runtime_error(what) - { - } + using std::runtime_error::runtime_error; }; /** diff --git a/daemon/face/ethernet-factory.hpp b/daemon/face/ethernet-factory.hpp index 1d633974..607c965c 100644 --- a/daemon/face/ethernet-factory.hpp +++ b/daemon/face/ethernet-factory.hpp @@ -31,7 +31,7 @@ namespace nfd::face { -/** \brief Protocol factory for Ethernet +/** \brief Protocol factory for Ethernet. */ class EthernetFactory final : public ProtocolFactory { @@ -43,7 +43,7 @@ public: EthernetFactory(const CtorParams& params); /** - * \brief Create Ethernet-based channel on the specified network interface + * \brief Create Ethernet-based channel on the specified network interface. * * If this method is called twice with the same endpoint, only one channel * will be created. The second call will just return the existing channel. @@ -57,7 +57,7 @@ public: time::nanoseconds idleTimeout); /** - * \brief Create a face to communicate on the given Ethernet multicast group + * \brief Create a face to communicate on the given Ethernet multicast group. * * If this method is called twice with the same arguments, only one face * will be created. The second call will just return the existing face. @@ -72,8 +72,6 @@ public: const ethernet::Address& group); private: - /** \brief process face_system.ether config section - */ void doProcessConfig(OptionalConfigSection configSection, FaceSystem::ConfigContext& context) final; @@ -121,7 +119,7 @@ private: }; MulticastConfig m_mcastConfig; - /// (ifname, group) => face + // [ifname, group] => face std::map, shared_ptr> m_mcastFaces; signal::ScopedConnection m_netifAddConn; diff --git a/daemon/face/face-counters.hpp b/daemon/face/face-counters.hpp index 7d7cdc33..a3f85769 100644 --- a/daemon/face/face-counters.hpp +++ b/daemon/face/face-counters.hpp @@ -31,7 +31,7 @@ namespace nfd::face { -/** \brief gives access to counters provided by Face +/** \brief Gives access to counters provided by Face. * * This type is a facade that exposes common counters of a Face. * @@ -80,11 +80,11 @@ public: const ByteCounter& nInBytes; const ByteCounter& nOutBytes; - /** \brief count of incoming Interests dropped due to HopLimit == 0 + /** \brief Count of incoming Interests dropped due to HopLimit == 0. */ PacketCounter nInHopLimitZero; - /** \brief count of outgoing Interests dropped due to HopLimit == 0 on non-local faces + /** \brief Count of outgoing Interests dropped due to HopLimit == 0 on non-local faces. */ PacketCounter nOutHopLimitZero; diff --git a/daemon/face/face-system.hpp b/daemon/face/face-system.hpp index 3b2e3dcd..d7d534b9 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-2021, Regents of the University of California, + * Copyright (c) 2014-2022, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -43,10 +43,11 @@ class NetdevBound; class ProtocolFactory; struct ProtocolFactoryCtorParams; -/** \brief entry point of the face system +/** + * \brief Entry point of NFD's face system. * - * NFD's face system is organized as a FaceSystem-ProtocolFactory-Channel-Face hierarchy. - * FaceSystem class is the entry point of NFD's face system and owns ProtocolFactory objects. + * NFD's face system is organized as a FaceSystem-ProtocolFactory-Channel-Face hierarchy. + * The FaceSystem class is the entry point of the face system and owns all ProtocolFactory objects. */ class FaceSystem : noncopyable { @@ -55,17 +56,18 @@ public: ~FaceSystem(); - /** \return ProtocolFactory objects owned by the FaceSystem + /** + * \brief Returns all ProtocolFactory objects owned by the face system. */ - std::set + [[nodiscard]] std::set listProtocolFactories() const; - /** \return ProtocolFactory for the specified registered factory id or nullptr if not found + /** \return ProtocolFactory for the specified registered factory id or nullptr if not found. */ ProtocolFactory* getFactoryById(const std::string& id); - /** \return ProtocolFactory for the specified FaceUri scheme or nullptr if not found + /** \return ProtocolFactory for the specified FaceUri scheme or nullptr if not found. */ ProtocolFactory* getFactoryByScheme(const std::string& scheme); @@ -79,19 +81,19 @@ public: return m_faceTable; } - /** \brief register handler for face_system section of NFD configuration file + /** \brief Register handler for the `face_system` section of NFD's configuration file. */ void setConfigFile(ConfigFile& configFile); - /** \brief configuration options from "general" section + /** \brief Configuration options from `general` section. */ struct GeneralConfig { bool wantCongestionMarking = true; }; - /** \brief context for processing a config section in ProtocolFactory + /** \brief Context for processing a config section in ProtocolFactory. */ class ConfigContext : noncopyable { @@ -110,13 +112,13 @@ private: const std::string& filename); NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: - /** \brief config section name => protocol factory + /** \brief Config section name => protocol factory. */ std::map> m_factories; unique_ptr m_netdevBound; private: - /** \brief scheme => protocol factory + /** \brief Scheme => protocol factory. * * The same protocol factory may be available under multiple schemes. */ diff --git a/daemon/face/face.hpp b/daemon/face/face.hpp index 976a9599..b18b9ca2 100644 --- a/daemon/face/face.hpp +++ b/daemon/face/face.hpp @@ -41,7 +41,7 @@ class Channel; */ using FaceState = TransportState; -/** \brief generalization of a network interface +/** \brief Generalization of a network interface. * * A face generalizes a network interface. * It provides best-effort network-layer packet delivery services @@ -58,12 +58,18 @@ public: Face(unique_ptr service, unique_ptr transport); LinkService* - getLinkService() const; + getLinkService() const noexcept + { + return m_service.get(); + } Transport* - getTransport() const; + getTransport() const noexcept + { + return m_transport.get(); + } - /** \brief Request that the face be closed + /** \brief Request that the face be closed. * * This operation is effective only if face is in the UP or DOWN state; otherwise, it has no effect. * The face will change state to CLOSING, and then perform a cleanup procedure. @@ -76,115 +82,133 @@ public: close(); public: // upper interface connected to forwarding - /** \brief send Interest + /** \brief Send Interest. */ void sendInterest(const Interest& interest); - /** \brief send Data + /** \brief Send Data. */ void sendData(const Data& data); - /** \brief send Nack + /** \brief Send Nack. */ void sendNack(const lp::Nack& nack); - /** \brief signals on Interest received + /** \brief Signals on Interest received. */ signal::Signal& afterReceiveInterest; - /** \brief signals on Data received + /** \brief Signals on Data received. */ signal::Signal& afterReceiveData; - /** \brief signals on Nack received + /** \brief Signals on Nack received. */ signal::Signal& afterReceiveNack; - /** \brief signals on Interest dropped by reliability system for exceeding allowed number of retx + /** \brief Signals on Interest dropped by reliability system for exceeding allowed number of retx. */ signal::Signal& onDroppedInterest; public: // properties - /** \return face ID + /** + * \brief Returns the face ID. */ FaceId - getId() const; + getId() const noexcept + { + return m_id; + } - /** \brief sets face ID - * \note Normally, this should only be invoked by FaceTable. + /** + * \brief Sets the face ID. + * \note Normally, this should only be invoked by FaceTable. */ void - setId(FaceId id); + setId(FaceId id) noexcept + { + m_id = id; + } - /** \return a FaceUri representing local endpoint + /** + * \brief Returns a FaceUri representing the local endpoint. */ FaceUri getLocalUri() const; - /** \return a FaceUri representing remote endpoint + /** + * \brief Returns a FaceUri representing the remote endpoint. */ FaceUri getRemoteUri() const; - /** \return whether face is local or non-local for scope control purpose + /** + * \brief Returns whether the face is local or non-local for scope control purposes. */ ndn::nfd::FaceScope getScope() const; - /** \return face persistency setting + /** + * \brief Returns the current persistency setting of the face. */ ndn::nfd::FacePersistency getPersistency() const; - /** \brief changes face persistency setting + /** + * \brief Changes the face persistency setting. */ void setPersistency(ndn::nfd::FacePersistency persistency); - /** \return whether face is point-to-point or multi-access + /** + * \brief Returns the link type of the face (point-to-point, multi-access, ...). */ ndn::nfd::LinkType getLinkType() const; - /** \brief Returns face effective MTU + /** + * \brief Returns the effective MTU of the face. * - * This function is a wrapper. The effective MTU of a face is determined by the link service. + * This function is a wrapper. The effective MTU of a face is determined by the link service. */ ssize_t getMtu() const; - /** \return face state + /** + * \brief Returns the face state. */ FaceState getState() const; - /** \brief signals after face state changed + /** + * \brief Signals after face state changed. */ signal::Signal& afterStateChange; - /** \return expiration time of the face - * \retval time::steady_clock::TimePoint::max() the face has an indefinite lifetime + /** + * \brief Returns the expiration time of the face. + * \retval time::steady_clock::time_point::max() The face has an indefinite lifetime. */ - time::steady_clock::TimePoint + time::steady_clock::time_point getExpirationTime() const; const FaceCounters& - getCounters() const + getCounters() const noexcept { return m_counters; } FaceCounters& - getCounters() + getCounters() noexcept { return m_counters; } /** - * \brief Get channel on which face was created (unicast) or the associated channel (multicast) + * \brief Get channel on which face was created (unicast) or the associated channel (multicast). */ weak_ptr getChannel() const @@ -193,7 +217,7 @@ public: // properties } /** - * \brief Set channel on which face was created (unicast) or the associated channel (multicast) + * \brief Set channel on which face was created (unicast) or the associated channel (multicast). */ void setChannel(weak_ptr channel) @@ -209,18 +233,6 @@ private: weak_ptr m_channel; }; -inline LinkService* -Face::getLinkService() const -{ - return m_service.get(); -} - -inline Transport* -Face::getTransport() const -{ - return m_transport.get(); -} - inline void Face::close() { @@ -245,18 +257,6 @@ Face::sendNack(const lp::Nack& nack) m_service->sendNack(nack); } -inline FaceId -Face::getId() const -{ - return m_id; -} - -inline void -Face::setId(FaceId id) -{ - m_id = id; -} - inline FaceUri Face::getLocalUri() const { @@ -305,7 +305,7 @@ Face::getState() const return m_transport->getState(); } -inline time::steady_clock::TimePoint +inline time::steady_clock::time_point Face::getExpirationTime() const { return m_transport->getExpirationTime(); diff --git a/daemon/face/generic-link-service.hpp b/daemon/face/generic-link-service.hpp index be216a77..7b5a427f 100644 --- a/daemon/face/generic-link-service.hpp +++ b/daemon/face/generic-link-service.hpp @@ -33,70 +33,71 @@ namespace nfd::face { -/** \brief counters provided by GenericLinkService - * \note The type name 'GenericLinkServiceCounters' is implementation detail. - * Use 'GenericLinkService::Counters' in public API. +/** \brief Counters provided by GenericLinkService. + * \note The type name GenericLinkServiceCounters is an implementation detail. + * Use GenericLinkService::Counters in public API. */ class GenericLinkServiceCounters : public virtual LinkService::Counters { public: - /** \brief count of failed fragmentations + /** \brief Count of failed fragmentations. */ PacketCounter nFragmentationErrors; - /** \brief count of outgoing LpPackets dropped due to exceeding MTU limit + /** \brief Count of outgoing LpPackets dropped due to exceeding MTU limit. * * If this counter is non-zero, the operator should enable fragmentation. */ PacketCounter nOutOverMtu; - /** \brief count of invalid LpPackets dropped before reassembly + /** \brief Count of invalid LpPackets dropped before reassembly. */ PacketCounter nInLpInvalid; - /** \brief count of network-layer packets currently being reassembled + /** \brief Count of network-layer packets currently being reassembled. */ SizeCounter nReassembling; - /** \brief count of dropped partial network-layer packets due to reassembly timeout + /** \brief Count of dropped partial network-layer packets due to reassembly timeout. */ PacketCounter nReassemblyTimeouts; - /** \brief count of invalid reassembled network-layer packets dropped + /** \brief Count of invalid reassembled network-layer packets dropped. */ PacketCounter nInNetInvalid; - /** \brief count of network-layer packets that did not require retransmission of a fragment + /** \brief Count of network-layer packets that did not require retransmission of a fragment. */ PacketCounter nAcknowledged; - /** \brief count of network-layer packets that had at least one fragment retransmitted, but were - * eventually received in full + /** \brief Count of network-layer packets that had at least one fragment retransmitted, but were + * eventually received in full. */ PacketCounter nRetransmitted; - /** \brief count of network-layer packets dropped because a fragment reached the maximum number - * of retransmissions + /** \brief Count of network-layer packets dropped because a fragment reached the maximum number + * of retransmissions. */ PacketCounter nRetxExhausted; - /** \brief count of LpPackets dropped due to duplicate Sequence numbers + /** \brief Count of LpPackets dropped due to duplicate Sequence numbers. */ PacketCounter nDuplicateSequence; - /** \brief count of outgoing LpPackets that were marked with congestion marks + /** \brief Count of outgoing LpPackets that were marked with congestion marks. */ PacketCounter nCongestionMarked; }; -/** \brief GenericLinkService is a LinkService that implements the NDNLPv2 protocol - * \sa https://redmine.named-data.net/projects/nfd/wiki/NDNLPv2 +/** + * \brief GenericLinkService is a LinkService that implements the NDNLPv2 protocol. + * \sa https://redmine.named-data.net/projects/nfd/wiki/NDNLPv2 */ class GenericLinkService NFD_FINAL_UNLESS_WITH_TESTS : public LinkService , protected virtual GenericLinkServiceCounters { public: - /** \brief Options that control the behavior of GenericLinkService + /** \brief %Options that control the behavior of GenericLinkService. */ class Options { @@ -106,35 +107,35 @@ public: } public: - /** \brief enables encoding of IncomingFaceId, and decoding of NextHopFaceId and CachePolicy + /** \brief Enables encoding of IncomingFaceId, and decoding of NextHopFaceId and CachePolicy. */ bool allowLocalFields = false; - /** \brief enables fragmentation + /** \brief Enables fragmentation. */ bool allowFragmentation = false; - /** \brief options for fragmentation + /** \brief Options for fragmentation. */ LpFragmenter::Options fragmenterOptions; - /** \brief enables reassembly + /** \brief Enables reassembly. */ bool allowReassembly = false; - /** \brief options for reassembly + /** \brief Options for reassembly. */ LpReassembler::Options reassemblerOptions; - /** \brief options for reliability + /** \brief Options for reliability. */ LpReliability::Options reliabilityOptions; - /** \brief enables send queue congestion detection and marking + /** \brief Enables send queue congestion detection and marking. */ bool allowCongestionMarking = false; - /** \brief starting value for congestion marking interval + /** \brief Starting value for congestion marking interval. * * Packets are marked if the queue size stays above THRESHOLD for at least one INTERVAL. * @@ -142,7 +143,7 @@ public: */ time::nanoseconds baseCongestionMarkingInterval = 100_ms; - /** \brief default congestion threshold in bytes + /** \brief Default congestion threshold in bytes. * * Packets are marked if the queue size stays above THRESHOLD for at least one INTERVAL. * @@ -150,45 +151,51 @@ public: */ size_t defaultCongestionThreshold = 65536; - /** \brief enables self-learning forwarding support + /** \brief Enables self-learning forwarding support. */ bool allowSelfLearning = true; - /** \brief overrides MTU provided by Transport + /** \brief Overrides the MTU provided by Transport. * * This MTU value will be used instead of the MTU provided by the transport if it is less than * the transport MTU. However, it will not be utilized when the transport MTU is unlimited. * - * Acceptable values for the override MTU are values >= MIN_MTU, which can be validated before + * Acceptable values for this option are values >= #MIN_MTU, which can be validated before * being set with canOverrideMtuTo(). */ ssize_t overrideMtu = std::numeric_limits::max(); }; - /** \brief counters provided by GenericLinkService + /** \brief %Counters provided by GenericLinkService. */ using Counters = GenericLinkServiceCounters; explicit GenericLinkService(const Options& options = {}); - /** \brief get Options used by GenericLinkService + /** \brief Get the options used by GenericLinkService. */ const Options& - getOptions() const; + getOptions() const + { + return m_options; + } - /** \brief sets Options used by GenericLinkService + /** \brief Sets the options used by GenericLinkService. */ void setOptions(const Options& options); const Counters& - getCounters() const NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL; + getCounters() const NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL + { + return *this; + } ssize_t getEffectiveMtu() const NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL; - /** \brief Whether MTU can be overridden to the specified value + /** \brief Whether MTU can be overridden to the specified value. * * If the transport MTU is unlimited, then this will always return false. */ @@ -196,12 +203,12 @@ public: canOverrideMtuTo(ssize_t mtu) const; NFD_PROTECTED_WITH_TESTS_ELSE_PRIVATE: // send path - /** \brief request an IDLE packet to transmit pending service fields + /** \brief Request an IDLE packet to transmit pending service fields. */ void requestIdlePacket(); - /** \brief send an LpPacket + /** \brief Send an LpPacket. */ void sendLpPacket(lp::Packet&& pkt); @@ -215,28 +222,28 @@ NFD_PROTECTED_WITH_TESTS_ELSE_PRIVATE: // send path void doSendNack(const ndn::lp::Nack& nack) NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL; - /** \brief assign consecutive sequence numbers to LpPackets + /** \brief Assign consecutive sequence numbers to LpPackets. */ void assignSequences(std::vector& pkts); private: // send path - /** \brief encode link protocol fields from tags onto an outgoing LpPacket + /** \brief Encode link protocol fields from tags onto an outgoing LpPacket. * \param netPkt network-layer packet to extract tags from * \param lpPacket LpPacket to add link protocol fields to */ void encodeLpFields(const ndn::PacketBase& netPkt, lp::Packet& lpPacket); - /** \brief send a complete network layer packet + /** \brief Send a complete network layer packet. * \param pkt LpPacket containing a complete network layer packet * \param isInterest whether the network layer packet is an Interest */ void sendNetPacket(lp::Packet&& pkt, bool isInterest); - /** \brief if the send queue is found to be congested, add a congestion mark to the packet - * according to CoDel + /** \brief If the send queue is found to be congested, add a congestion mark to the packet + * according to CoDel. * \sa https://tools.ietf.org/html/rfc8289 */ void @@ -246,7 +253,7 @@ private: // receive path void doReceivePacket(const Block& packet, const EndpointId& endpoint) NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL; - /** \brief decode incoming network-layer packet + /** \brief Decode incoming network-layer packet. * \param netPkt reassembled network-layer packet * \param firstPkt LpPacket of first fragment * \param endpointId endpoint of peer who sent the packet @@ -257,7 +264,7 @@ private: // receive path void decodeNetPacket(const Block& netPkt, const lp::Packet& firstPkt, const EndpointId& endpointId); - /** \brief decode incoming Interest + /** \brief Decode incoming Interest. * \param netPkt reassembled network-layer packet; TLV-TYPE must be Interest * \param firstPkt LpPacket of first fragment; must not have Nack field * \param endpointId endpoint of peer who sent the Interest @@ -270,7 +277,7 @@ private: // receive path void decodeInterest(const Block& netPkt, const lp::Packet& firstPkt, const EndpointId& endpointId); - /** \brief decode incoming Interest + /** \brief Decode incoming Interest. * \param netPkt reassembled network-layer packet; TLV-TYPE must be Data * \param firstPkt LpPacket of first fragment * \param endpointId endpoint of peer who sent the Data @@ -283,7 +290,7 @@ private: // receive path void decodeData(const Block& netPkt, const lp::Packet& firstPkt, const EndpointId& endpointId); - /** \brief decode incoming Interest + /** \brief Decode incoming Interest. * \param netPkt reassembled network-layer packet; TLV-TYPE must be Interest * \param firstPkt LpPacket of first fragment; must have Nack field * \param endpointId endpoint of peer who sent the Nack @@ -305,25 +312,13 @@ NFD_PROTECTED_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; + time::steady_clock::time_point m_nextMarkTime; /// number of marked packets in the current incident of congestion size_t m_nMarkedSinceInMarkingState; friend LpReliability; }; -inline const GenericLinkService::Options& -GenericLinkService::getOptions() const -{ - return m_options; -} - -inline const GenericLinkService::Counters& -GenericLinkService::getCounters() const -{ - return *this; -} - } // namespace nfd::face #endif // NFD_DAEMON_FACE_GENERIC_LINK_SERVICE_HPP diff --git a/daemon/face/internal-face.hpp b/daemon/face/internal-face.hpp index 6b27cfa5..e0b87657 100644 --- a/daemon/face/internal-face.hpp +++ b/daemon/face/internal-face.hpp @@ -32,11 +32,11 @@ namespace nfd::face { -/** \brief make a pair of forwarder-side face and client-side face - * that are connected with each other +/** \brief Make a pair of forwarder-side face and client-side face + * that are connected to each other. * * Network-layer packets sent by one face will be received by the other face - * after io.poll(). + * after `io.poll()`. * * \param clientKeyChain A KeyChain used by client-side face to sign * prefix registration commands. diff --git a/daemon/face/link-service.cpp b/daemon/face/link-service.cpp index d7233d03..7d1445e2 100644 --- a/daemon/face/link-service.cpp +++ b/daemon/face/link-service.cpp @@ -30,18 +30,10 @@ namespace nfd::face { NFD_LOG_INIT(LinkService); -LinkService::LinkService() - : m_face(nullptr) - , m_transport(nullptr) -{ -} - -LinkService::~LinkService() -{ -} +LinkService::~LinkService() = default; void -LinkService::setFaceAndTransport(Face& face, Transport& transport) +LinkService::setFaceAndTransport(Face& face, Transport& transport) noexcept { BOOST_ASSERT(m_face == nullptr); BOOST_ASSERT(m_transport == nullptr); diff --git a/daemon/face/link-service.hpp b/daemon/face/link-service.hpp index 92645f4d..da752e62 100644 --- a/daemon/face/link-service.hpp +++ b/daemon/face/link-service.hpp @@ -32,44 +32,45 @@ namespace nfd::face { -/** \brief counters provided by LinkService - * \note The type name 'LinkServiceCounters' is implementation detail. - * Use 'LinkService::Counters' in public API. +/** \brief Counters provided by LinkService. + * \note The type name LinkServiceCounters is an implementation detail. + * Use LinkService::Counters in public API. */ class LinkServiceCounters { public: - /** \brief count of incoming Interests + /** \brief Count of incoming Interests. */ PacketCounter nInInterests; - /** \brief count of outgoing Interests + /** \brief Count of outgoing Interests. */ PacketCounter nOutInterests; - /** \brief count of Interests dropped by reliability system for exceeding allowed number of retx + /** \brief Count of Interests dropped by reliability system for exceeding allowed number of retx. */ PacketCounter nInterestsExceededRetx; - /** \brief count of incoming Data packets + /** \brief Count of incoming Data packets. */ PacketCounter nInData; - /** \brief count of outgoing Data packets + /** \brief Count of outgoing Data packets. */ PacketCounter nOutData; - /** \brief count of incoming Nacks + /** \brief Count of incoming Nacks. */ PacketCounter nInNacks; - /** \brief count of outgoing Nacks + /** \brief Count of outgoing Nacks. */ PacketCounter nOutNacks; }; -/** \brief the upper part of a Face - * \sa Face +/** + * \brief The upper half of a Face. + * \sa Face, Transport */ class LinkService : protected virtual LinkServiceCounters, noncopyable { @@ -80,97 +81,111 @@ public: using Counters = LinkServiceCounters; public: - LinkService(); - virtual ~LinkService(); - /** \brief set Face and Transport for LinkService - * \pre setFaceAndTransport has not been called + /** + * \brief Set Face and Transport for this LinkService. + * \pre setFaceAndTransport() has not been called. */ void - setFaceAndTransport(Face& face, Transport& transport); + setFaceAndTransport(Face& face, Transport& transport) noexcept; - /** \return Face to which this LinkService is attached + /** + * \brief Returns the Face to which this LinkService is attached. */ const Face* - getFace() const; + getFace() const noexcept + { + return m_face; + } - /** \return Transport to which this LinkService is attached + /** + * \brief Returns the Transport to which this LinkService is attached. */ const Transport* - getTransport() const; + getTransport() const noexcept + { + return m_transport; + } - /** \return Transport to which this LinkService is attached + /** + * \brief Returns the Transport to which this LinkService is attached. */ Transport* - getTransport(); + getTransport() noexcept + { + return m_transport; + } virtual const Counters& - getCounters() const; + getCounters() const + { + return *this; + } virtual ssize_t getEffectiveMtu() const; public: // upper interface to be used by forwarding - /** \brief Send Interest - * \pre setTransport has been called + /** \brief Send Interest. + * \pre setFaceAndTransport() has been called. */ void sendInterest(const Interest& interest); - /** \brief Send Data - * \pre setTransport has been called + /** \brief Send Data. + * \pre setFaceAndTransport() has been called. */ void sendData(const Data& data); - /** \brief Send Nack - * \pre setTransport has been called + /** \brief Send Nack. + * \pre setFaceAndTransport() has been called. */ void sendNack(const ndn::lp::Nack& nack); - /** \brief signals on Interest received + /** \brief Signals on Interest received. */ signal::Signal afterReceiveInterest; - /** \brief signals on Data received + /** \brief Signals on Data received. */ signal::Signal afterReceiveData; - /** \brief signals on Nack received + /** \brief Signals on Nack received. */ signal::Signal afterReceiveNack; - /** \brief signals on Interest dropped by reliability system for exceeding allowed number of retx + /** \brief Signals on Interest dropped by reliability system for exceeding allowed number of retx. */ signal::Signal onDroppedInterest; public: // lower interface to be invoked by Transport - /** \brief performs LinkService specific operations to receive a lower-layer packet + /** \brief Performs LinkService specific operations to receive a lower-layer packet. */ void receivePacket(const Block& packet, const EndpointId& endpoint); protected: // upper interface to be invoked in subclass (receive path termination) - /** \brief delivers received Interest to forwarding + /** \brief Delivers received Interest to forwarding. */ void receiveInterest(const Interest& interest, const EndpointId& endpoint); - /** \brief delivers received Data to forwarding + /** \brief Delivers received Data to forwarding. */ void receiveData(const Data& data, const EndpointId& endpoint); - /** \brief delivers received Nack to forwarding + /** \brief Delivers received Nack to forwarding. */ void receiveNack(const lp::Nack& nack, const EndpointId& endpoint); protected: // lower interface to be invoked in subclass (send path termination) - /** \brief send a lower-layer packet via Transport + /** \brief Send a lower-layer packet via Transport. */ void sendPacket(const Block& packet); @@ -180,17 +195,17 @@ protected: notifyDroppedInterest(const Interest& packet); private: // upper interface to be overridden in subclass (send path entrypoint) - /** \brief performs LinkService specific operations to send an Interest + /** \brief Performs LinkService specific operations to send an Interest. */ virtual void doSendInterest(const Interest& interest) = 0; - /** \brief performs LinkService specific operations to send a Data + /** \brief Performs LinkService specific operations to send a Data. */ virtual void doSendData(const Data& data) = 0; - /** \brief performs LinkService specific operations to send a Nack + /** \brief Performs LinkService specific operations to send a Nack. */ virtual void doSendNack(const lp::Nack& nack) = 0; @@ -200,34 +215,10 @@ private: // lower interface to be overridden in subclass doReceivePacket(const Block& packet, const EndpointId& endpoint) = 0; private: - Face* m_face; - Transport* m_transport; + Face* m_face = nullptr; + Transport* m_transport = nullptr; }; -inline const Face* -LinkService::getFace() const -{ - return m_face; -} - -inline const Transport* -LinkService::getTransport() const -{ - return m_transport; -} - -inline Transport* -LinkService::getTransport() -{ - return m_transport; -} - -inline const LinkService::Counters& -LinkService::getCounters() const -{ - return *this; -} - inline ssize_t LinkService::getEffectiveMtu() const { diff --git a/daemon/face/lp-fragmenter.hpp b/daemon/face/lp-fragmenter.hpp index 8d241249..40e429ba 100644 --- a/daemon/face/lp-fragmenter.hpp +++ b/daemon/face/lp-fragmenter.hpp @@ -32,17 +32,17 @@ namespace nfd::face { -/** \brief fragments network-layer packets into NDNLPv2 link-layer packets +/** \brief Fragments network-layer packets into NDNLPv2 link-layer packets. * \sa https://redmine.named-data.net/projects/nfd/wiki/NDNLPv2 */ class LpFragmenter { public: - /** \brief Options that control the behavior of LpFragmenter + /** \brief %Options that control the behavior of LpFragmenter. */ struct Options { - /** \brief maximum number of fragments in a packet + /** \brief Maximum number of fragments in a packet. */ size_t nMaxFragments = 400; }; @@ -50,7 +50,7 @@ public: explicit LpFragmenter(const Options& options, const LinkService* linkService = nullptr); - /** \brief set options for fragmenter + /** \brief Set options for fragmenter. */ void setOptions(const Options& options); @@ -62,7 +62,7 @@ public: const LinkService* getLinkService() const; - /** \brief fragments a network-layer packet into link-layer packets + /** \brief Fragments a network-layer packet into link-layer packets. * \param packet an LpPacket that contains a network-layer packet; * must have Fragment field, must not have FragIndex and FragCount fields * \param mtu maximum allowable LpPacket size after fragmentation and sequence number assignment diff --git a/daemon/face/lp-reassembler.hpp b/daemon/face/lp-reassembler.hpp index 30fec049..32b7e159 100644 --- a/daemon/face/lp-reassembler.hpp +++ b/daemon/face/lp-reassembler.hpp @@ -33,23 +33,23 @@ namespace nfd::face { /** - * \brief Reassembles fragmented network-layer packets + * \brief Reassembles fragmented network-layer packets. * \sa https://redmine.named-data.net/projects/nfd/wiki/NDNLPv2 */ class LpReassembler : noncopyable { public: - /** \brief Options that control the behavior of LpReassembler + /** \brief %Options that control the behavior of LpReassembler. */ struct Options { - /** \brief maximum number of fragments in a packet + /** \brief Maximum number of fragments in a packet. * * LpPackets with FragCount over this limit are dropped. */ size_t nMaxFragments = 400; - /** \brief timeout before a partially reassembled packet is dropped + /** \brief Timeout before a partially reassembled packet is dropped. */ time::nanoseconds reassemblyTimeout = 500_ms; }; @@ -57,7 +57,7 @@ public: explicit LpReassembler(const Options& options, const LinkService* linkService = nullptr); - /** \brief set options for reassembler + /** \brief Set options for reassembler. */ void setOptions(const Options& options); @@ -69,7 +69,7 @@ public: const LinkService* getLinkService() const; - /** \brief adds received fragment to the buffer + /** \brief Adds received fragment to the buffer. * \param remoteEndpoint endpoint that sent the packet * \param packet received fragment; must have Fragment field * \return a tuple containing: @@ -81,7 +81,7 @@ public: std::tuple receiveFragment(const EndpointId& remoteEndpoint, const lp::Packet& packet); - /** \brief count of partial packets + /** \brief Count of partial packets. */ size_t size() const; @@ -98,7 +98,7 @@ public: private: /** - * \brief Holds all fragments of packet until reassembled + * \brief Holds all fragments of a packet until reassembled. */ struct PartialPacket { @@ -109,11 +109,11 @@ private: }; /** - * \brief Index key for PartialPackets + * \brief Index key for PartialPackets. */ using Key = std::tuple< - EndpointId, // remoteEndpoint - lp::Sequence // message identifier (sequence of the first fragment) + EndpointId, // remote endpoint + lp::Sequence // message identifier (sequence number of the first fragment) >; Block diff --git a/daemon/face/lp-reliability.hpp b/daemon/face/lp-reliability.hpp index 17b2e446..415a06d4 100644 --- a/daemon/face/lp-reliability.hpp +++ b/daemon/face/lp-reliability.hpp @@ -39,7 +39,7 @@ namespace nfd::face { class GenericLinkService; /** - * \brief Provides for reliable sending and receiving of link-layer packets + * \brief Provides for reliable sending and receiving of link-layer packets. * \sa https://redmine.named-data.net/projects/nfd/wiki/NDNLPv2 */ class LpReliability : noncopyable @@ -52,31 +52,31 @@ public: struct Options { - /** \brief enables link-layer reliability + /** \brief Enables link-layer reliability. */ bool isEnabled = false; - /** \brief maximum number of retransmissions for an LpPacket + /** \brief Maximum number of retransmissions for an LpPacket. */ size_t maxRetx = 3; - /** \brief period between sending pending Acks in an IDLE packet + /** \brief Period between sending pending Acks in an IDLE packet. */ time::nanoseconds idleAckTimerPeriod = 5_ms; - /** \brief a fragment is considered lost if this number of fragments with greater sequence - * numbers are acknowledged + /** \brief A fragment is considered lost if this number of fragments with greater sequence + * numbers are acknowledged. */ size_t seqNumLossThreshold = 3; }; LpReliability(const Options& options, GenericLinkService* linkService); - /** \brief signals on Interest dropped by reliability system for exceeding allowed number of retx + /** \brief Signals on Interest dropped by reliability system for exceeding allowed number of retx. */ signal::Signal onDroppedInterest; - /** \brief set options for reliability + /** \brief Set options for reliability. */ void setOptions(const Options& options); @@ -88,7 +88,7 @@ public: const GenericLinkService* getLinkService() const; - /** \brief observe outgoing fragment(s) of a network packet and store for potential retransmission + /** \brief Observe outgoing fragment(s) of a network packet and store for potential retransmission. * \param frags fragments of network packet * \param pkt encapsulated network packet * \param isInterest whether the network packet is an Interest @@ -96,16 +96,16 @@ public: void handleOutgoing(std::vector& frags, lp::Packet&& pkt, bool isInterest); - /** \brief extract and parse all Acks and add Ack for contained Fragment (if any) to AckQueue + /** \brief Extract and parse all Acks and add Ack for contained Fragment (if any) to AckQueue. * \param pkt incoming LpPacket * \return whether incoming LpPacket is new and not a duplicate */ bool processIncomingPacket(const lp::Packet& pkt); - /** \brief called by GenericLinkService to attach Acks onto an outgoing LpPacket + /** \brief Called by GenericLinkService to attach Acks onto an outgoing LpPacket. * \param pkt outgoing LpPacket to attach Acks to - * \param mtu MTU of the Transport + * \param mtu MTU of the transport */ void piggyback(lp::Packet& pkt, ssize_t mtu); @@ -115,7 +115,7 @@ NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: class NetPkt; using UnackedFrags = std::map; - /** \brief assign TxSequence number to a fragment + /** \brief Assign TxSequence number to a fragment. * \param frag fragment to assign TxSequence to * \return assigned TxSequence number * \throw std::length_error assigned TxSequence is equal to the start of the existing window @@ -123,7 +123,7 @@ NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: lp::Sequence assignTxSequence(lp::Packet& frag); - /** \brief start the idle Ack timer + /** \brief Start the idle Ack timer. * * This timer requests an IDLE packet to acknowledge pending fragments not already piggybacked. * It is called regularly on a period configured in Options::idleAckTimerPeriod. This allows Acks @@ -132,22 +132,22 @@ NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: void startIdleAckTimer(); - /** \brief find and mark as lost fragments where a configurable number of Acks - * (\p m_options.seqNumLossThreshold) have been received for greater TxSequence numbers + /** \brief Find and mark as lost fragments where a configurable number of Acks + * (Options::seqNumLossThreshold) have been received for greater TxSequence numbers. * \param ackIt iterator pointing to acknowledged fragment * \return vector containing TxSequences of fragments marked lost by this mechanism */ std::vector findLostLpPackets(UnackedFrags::iterator ackIt); - /** \brief resend (or give up on) a lost fragment + /** \brief Resend (or give up on) a lost fragment. * \return vector of the TxSequences of fragments removed due to a network packet being removed */ std::vector onLpPacketLost(lp::Sequence txSeq, bool isTimeout); - /** \brief remove the fragment with the given sequence number from the map of unacknowledged - * fragments, as well as its associated network packet (if any) + /** \brief Remove the fragment with the given sequence number from the map of unacknowledged + * fragments, as well as its associated network packet (if any). * \param fragIt iterator to acknowledged fragment * * If the given TxSequence marks the beginning of the send window, the window will be incremented. @@ -156,7 +156,7 @@ NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: void onLpPacketAcknowledged(UnackedFrags::iterator fragIt); - /** \brief delete a fragment from UnackedFrags and advance acknowledge window if necessary + /** \brief Delete a fragment from UnackedFrags and advance acknowledge window if necessary. * \param fragIt iterator to an UnackedFrag, must be dereferencable * \post fragIt is not in m_unackedFrags * \post if was equal to m_firstUnackedFrag, @@ -168,7 +168,7 @@ NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: /** - * \brief Contains a sent fragment that has not been acknowledged and associated data + * \brief Contains a sent fragment that has not been acknowledged and associated data. */ class UnackedFrag { @@ -179,14 +179,14 @@ NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: public: lp::Packet pkt; scheduler::ScopedEventId rtoTimer; - time::steady_clock::TimePoint sendTime; + time::steady_clock::time_point sendTime; size_t retxCount; size_t nGreaterSeqAcks; //!< number of Acks received for sequences greater than this fragment shared_ptr netPkt; }; /** - * \brief Contains a network-layer packet with unacknowledged fragments + * \brief Contains a network-layer packet with unacknowledged fragments. */ class NetPkt { @@ -203,14 +203,13 @@ NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: Options m_options; GenericLinkService* m_linkService; UnackedFrags m_unackedFrags; - /** An iterator that points to the first unacknowledged fragment in the current window. The window - * can wrap around so that the beginning of the window is at a TxSequence greater than other - * fragments in the window. When the window is moved past the last item in the iterator, the - * first fragment in the map will become the start of the window. - */ + // An iterator that points to the first unacknowledged fragment in the current window. The window + // can wrap around so that the beginning of the window is at a TxSequence greater than other + // fragments in the window. When the window is moved past the last item in the iterator, the + // first fragment in the map will become the start of the window. UnackedFrags::iterator m_firstUnackedFrag; std::queue m_ackQueue; - std::map m_recentRecvSeqs; + std::map m_recentRecvSeqs; std::queue m_recentRecvSeqsQueue; lp::Sequence m_lastTxSeqNo; scheduler::ScopedEventId m_idleAckTimer; diff --git a/daemon/face/netdev-bound.hpp b/daemon/face/netdev-bound.hpp index 73283420..9c9aec3e 100644 --- a/daemon/face/netdev-bound.hpp +++ b/daemon/face/netdev-bound.hpp @@ -32,7 +32,7 @@ namespace nfd::face { class FaceSystem; -/** \brief manages netdev-bound faces +/** \brief Manages netdev-bound faces. */ class NetdevBound : noncopyable { @@ -54,7 +54,7 @@ public: NetdevBound(const ProtocolFactoryCtorParams& params, const FaceSystem& faceSystem); - /** \brief process face_system.netdev_bound config section + /** \brief Process `face_system.netdev_bound` config section. */ void processConfig(OptionalConfigSection configSection, diff --git a/daemon/face/pcap-helper.cpp b/daemon/face/pcap-helper.cpp index 054eda29..637faaf2 100644 --- a/daemon/face/pcap-helper.cpp +++ b/daemon/face/pcap-helper.cpp @@ -38,7 +38,6 @@ namespace nfd::face { PcapHelper::PcapHelper(const std::string& interfaceName) - : m_pcap(nullptr) { char errbuf[PCAP_ERRBUF_SIZE] = {}; m_pcap = pcap_create(interfaceName.data(), errbuf); @@ -56,7 +55,7 @@ PcapHelper::PcapHelper(const std::string& interfaceName) pcap_set_buffer_size(m_pcap, 4 * 1024 * 1024); } -PcapHelper::~PcapHelper() +PcapHelper::~PcapHelper() noexcept { close(); } diff --git a/daemon/face/pcap-helper.hpp b/daemon/face/pcap-helper.hpp index 41bf066b..50ab5058 100644 --- a/daemon/face/pcap-helper.hpp +++ b/daemon/face/pcap-helper.hpp @@ -47,11 +47,7 @@ public: class Error : public std::runtime_error { public: - explicit - Error(const std::string& what) - : std::runtime_error(what) - { - } + using std::runtime_error::runtime_error; }; /** @@ -62,7 +58,7 @@ public: explicit PcapHelper(const std::string& interfaceName); - ~PcapHelper(); + ~PcapHelper() noexcept; /** * @brief Start capturing packets. @@ -135,7 +131,7 @@ public: } private: - pcap_t* m_pcap; + pcap_t* m_pcap = nullptr; }; } // namespace nfd::face diff --git a/daemon/face/protocol-factory.hpp b/daemon/face/protocol-factory.hpp index 4d02d150..c490e07f 100644 --- a/daemon/face/protocol-factory.hpp +++ b/daemon/face/protocol-factory.hpp @@ -35,12 +35,14 @@ namespace nfd::face { -/** \brief Parameters to ProtocolFactory constructor +/** + * \brief Parameters to ProtocolFactory constructor. * - * Every ProtocolFactory subclass is expected to have a constructor that accepts CtorParams, - * which in turn passes it to ProtocolFactory base class constructor. Parameters are passed as a - * struct rather than individually, so that a future change in list of parameters does not - * require updates to subclass constructors. + * Every ProtocolFactory subclass is expected to have a constructor that accepts + * ProtocolFactory::CtorParams, which in turn passes it to ProtocolFactory base class + * constructor. Parameters are passed as a struct rather than individually, so that + * any future changes in the list of parameters will not require updates to all subclass + * constructors. */ struct ProtocolFactoryCtorParams { @@ -48,21 +50,24 @@ struct ProtocolFactoryCtorParams shared_ptr netmon; }; -/** \brief Provides support for an underlying protocol - * \sa FaceSystem +/** + * \brief Provides support for an underlying protocol. * - * A protocol factory provides support for an underlying protocol and owns Channel objects. - * It can process a subsection of face_system config section and create channels and multicast - * faces accordingly. + * A protocol factory provides support for an underlying protocol and owns Channel objects. + * It can process a subsection of the `face_system` configuration section and create channels + * and multicast faces accordingly. + * + * \sa FaceSystem */ class ProtocolFactory : noncopyable { public: // registry using CtorParams = ProtocolFactoryCtorParams; - /** \brief Register a protocol factory type - * \tparam PF subclass of ProtocolFactory - * \param id factory identifier + /** + * \brief Register a protocol factory type. + * \tparam PF subclass of ProtocolFactory + * \param id factory identifier */ template static void @@ -75,19 +80,22 @@ public: // registry BOOST_VERIFY(r.second); } - /** \brief Create a protocol factory instance - * \retval nullptr if a factory with the given \p id is not registered + /** + * \brief Create a protocol factory instance. + * \retval nullptr if a factory with the given \p id is not registered */ static unique_ptr create(const std::string& id, const CtorParams& params); - /** \brief Get all registered protocol factory ids + /** + * \brief Get all registered protocol factory IDs. */ - static std::set + [[nodiscard]] static std::set listRegistered(); public: - /** \brief Base class for all exceptions thrown by ProtocolFactory subclasses + /** + * \brief Base class for all exceptions thrown by ProtocolFactory subclasses. */ class Error : public std::runtime_error { @@ -102,18 +110,20 @@ public: ~ProtocolFactory() = 0; #ifdef DOXYGEN - /** \brief Get id for this protocol factory + /** + * \brief Get the ID of this protocol factory. * - * face_system.factory-id config section is processed by the protocol factory. + * `face_system.` config section is processed by the protocol factory. */ static const std::string& getId() noexcept; #endif - /** \brief Get FaceUri schemes accepted by this protocol factory + /** + * \brief Get FaceUri schemes accepted by this protocol factory. */ const std::set& - getProvidedSchemes() const + getProvidedSchemes() const noexcept { return providedSchemes; } diff --git a/daemon/face/socket-utils.hpp b/daemon/face/socket-utils.hpp index 9efb3892..2b358e98 100644 --- a/daemon/face/socket-utils.hpp +++ b/daemon/face/socket-utils.hpp @@ -30,7 +30,7 @@ namespace nfd::face { -/** \brief obtain send queue length from a specified system socket +/** \brief Obtain send queue length from a specified system socket. * \param fd file descriptor of the socket * \retval QUEUE_UNSUPPORTED this operation is unsupported on the current platform * \retval QUEUE_ERROR there was an error retrieving the send queue length diff --git a/daemon/face/tcp-factory.hpp b/daemon/face/tcp-factory.hpp index 87ffae85..23969f8f 100644 --- a/daemon/face/tcp-factory.hpp +++ b/daemon/face/tcp-factory.hpp @@ -31,7 +31,7 @@ namespace nfd::face { -/** \brief Protocol factory for TCP over IPv4 and IPv6 +/** \brief Protocol factory for TCP over IPv4 and IPv6. */ class TcpFactory final : public ProtocolFactory { @@ -42,7 +42,7 @@ public: using ProtocolFactory::ProtocolFactory; /** - * \brief Create TCP-based channel using tcp::Endpoint + * \brief Create TCP-based channel using tcp::Endpoint. * * tcp::Endpoint is really an alias for boost::asio::ip::tcp::endpoint. * @@ -56,8 +56,6 @@ public: createChannel(const tcp::Endpoint& localEndpoint); private: - /** \brief process face_system.tcp config section - */ void doProcessConfig(OptionalConfigSection configSection, FaceSystem::ConfigContext& context) final; diff --git a/daemon/face/transport.cpp b/daemon/face/transport.cpp index 44babbb9..dc3682e9 100644 --- a/daemon/face/transport.cpp +++ b/daemon/face/transport.cpp @@ -49,23 +49,12 @@ operator<<(std::ostream& os, TransportState state) } } -Transport::Transport() - : m_face(nullptr) - , m_service(nullptr) - , m_scope(ndn::nfd::FACE_SCOPE_NONE) - , m_persistency(ndn::nfd::FACE_PERSISTENCY_NONE) - , m_linkType(ndn::nfd::LINK_TYPE_NONE) - , m_mtu(MTU_INVALID) - , m_sendQueueCapacity(QUEUE_UNSUPPORTED) - , m_state(TransportState::UP) - , m_expirationTime(time::steady_clock::TimePoint::max()) -{ -} +Transport::Transport() = default; Transport::~Transport() = default; void -Transport::setFaceAndLinkService(Face& face, LinkService& service) +Transport::setFaceAndLinkService(Face& face, LinkService& service) noexcept { BOOST_ASSERT(m_face == nullptr); BOOST_ASSERT(m_service == nullptr); @@ -122,7 +111,7 @@ Transport::receive(const Block& packet, const EndpointId& endpoint) } void -Transport::setMtu(ssize_t mtu) +Transport::setMtu(ssize_t mtu) noexcept { BOOST_ASSERT(mtu == MTU_UNLIMITED || mtu >= 0); diff --git a/daemon/face/transport.hpp b/daemon/face/transport.hpp index 0350bf4e..cebc927e 100644 --- a/daemon/face/transport.hpp +++ b/daemon/face/transport.hpp @@ -53,7 +53,7 @@ operator<<(std::ostream& os, TransportState state); class TransportCounters { public: - /** \brief count of incoming packets + /** \brief Count of incoming packets. * * A 'packet' typically means a top-level TLV block. * For a datagram-based transport, an incoming packet that cannot be parsed as TLV @@ -61,14 +61,14 @@ public: */ PacketCounter nInPackets; - /** \brief count of outgoing packets + /** \brief Count of outgoing packets. * * A 'packet' typically means a top-level TLV block. * This counter is incremented only if transport is UP. */ PacketCounter nOutPackets; - /** \brief total incoming bytes + /** \brief Total incoming bytes. * * This counter includes headers imposed by NFD (such as NDNLP), * but excludes overhead of underlying protocol (such as IP header). @@ -77,7 +77,7 @@ public: */ ByteCounter nInBytes; - /** \brief total outgoing bytes + /** \brief Total outgoing bytes. * * This counter includes headers imposed by NFD (such as NDNLP), * but excludes overhead of underlying protocol (such as IP header). @@ -87,28 +87,28 @@ public: }; /** - * \brief Indicates that the transport has no limit on payload size + * \brief Indicates that the transport has no limit on payload size. */ inline constexpr ssize_t MTU_UNLIMITED = -1; /** - * \brief (for internal use) Indicates that the MTU field is unset + * \brief (for internal use) Indicates that the MTU field is unset. */ inline constexpr ssize_t MTU_INVALID = -2; /** - * \brief Indicates that the transport does not support reading the queue capacity/length + * \brief Indicates that the transport does not support reading the queue capacity/length. */ inline constexpr ssize_t QUEUE_UNSUPPORTED = -1; /** - * \brief Indicates that the transport was unable to retrieve the queue capacity/length + * \brief Indicates that the transport was unable to retrieve the queue capacity/length. */ inline constexpr ssize_t QUEUE_ERROR = -2; /** * \brief The lower half of a Face. - * \sa Face + * \sa Face, LinkService */ class Transport : protected virtual TransportCounters, noncopyable { @@ -132,32 +132,48 @@ public: ~Transport(); public: - /** \brief set Face and LinkService for Transport - * \pre setFaceAndLinkService has not been called + /** + * \brief Set Face and LinkService for this transport. + * \pre setFaceAndLinkService() has not been called. */ void - setFaceAndLinkService(Face& face, LinkService& service); + setFaceAndLinkService(Face& face, LinkService& service) noexcept; - /** \return Face to which this Transport is attached + /** + * \brief Returns the Face to which this transport is attached. */ const Face* - getFace() const; + getFace() const noexcept + { + return m_face; + } - /** \return LinkService to which this Transport is attached + /** + * \brief Returns the LinkService to which this transport is attached. */ const LinkService* - getLinkService() const; + getLinkService() const noexcept + { + return m_service; + } - /** \return LinkService to which this Transport is attached + /** + * \brief Returns the LinkService to which this transport is attached. */ LinkService* - getLinkService(); + getLinkService() noexcept + { + return m_service; + } virtual const Counters& - getCounters() const; + getCounters() const + { + return *this; + } public: // upper interface - /** \brief Request the transport to be closed + /** \brief Request the transport to be closed. * * This operation is effective only if transport is in UP or DOWN state, * otherwise it has no effect. @@ -168,7 +184,7 @@ public: // upper interface void close(); - /** \brief Send a link-layer packet + /** \brief Send a link-layer packet. * \param packet the packet to be sent, must be a valid and well-formed TLV block * \note This operation has no effect if getState() is neither UP nor DOWN * \warning Behavior is undefined if packet size exceeds the MTU limit @@ -177,85 +193,125 @@ public: // upper interface send(const Block& packet); public: // static properties - /** \return a FaceUri representing local endpoint + /** + * \brief Returns a FaceUri representing the local endpoint. */ FaceUri - getLocalUri() const; + getLocalUri() const noexcept + { + return m_localUri; + } - /** \return a FaceUri representing remote endpoint + /** + * \brief Returns a FaceUri representing the remote endpoint. */ FaceUri - getRemoteUri() const; + getRemoteUri() const noexcept + { + return m_remoteUri; + } - /** \return whether face is local or non-local for scope control purpose + /** + * \brief Returns whether the transport is local or non-local for scope control purposes. */ ndn::nfd::FaceScope - getScope() const; + getScope() const noexcept + { + return m_scope; + } - /** \return face persistency setting + /** + * \brief Returns the current persistency setting of the transport. */ ndn::nfd::FacePersistency - getPersistency() const; + getPersistency() const noexcept + { + return m_persistency; + } - /** \brief check whether the face persistency can be changed to \p newPersistency + /** + * \brief Check whether the persistency can be changed to \p newPersistency. * - * This function serves as the external API, and invokes the protected function - * canChangePersistencyToImpl to perform further checks if \p newPersistency differs - * from the current persistency. + * This function serves as the external API, and invokes the protected function + * canChangePersistencyToImpl() to perform further checks if \p newPersistency differs + * from the current persistency. * - * \return true if the change can be performed, false otherwise + * \return true if the change can be performed, false otherwise */ bool canChangePersistencyTo(ndn::nfd::FacePersistency newPersistency) const; - /** \brief changes face persistency setting + /** + * \brief Changes the persistency setting of the transport. */ void setPersistency(ndn::nfd::FacePersistency newPersistency); - /** \return the link type of the transport + /** + * \brief Returns the link type of the transport. */ ndn::nfd::LinkType - getLinkType() const; + getLinkType() const noexcept + { + return m_linkType; + } - /** \return maximum payload size - * \retval MTU_UNLIMITED transport has no limit on payload size + /** + * \brief Returns the maximum payload size. + * \retval MTU_UNLIMITED The transport has no limit on payload size. * - * This size is the maximum packet size that can be sent or received through this transport. + * This size is the maximum packet size that can be sent or received through this transport. * - * For a datagram-based transport, this is typically the Maximum Transmission Unit (MTU), - * after the overhead of headers introduced by the transport has been accounted for. - * For a stream-based transport, this is typically unlimited (MTU_UNLIMITED). + * For a datagram-based transport, this is typically the Maximum Transmission Unit (MTU), + * after the overhead of headers introduced by the transport has been accounted for. + * For a stream-based transport, this is typically unlimited (MTU_UNLIMITED). */ ssize_t - getMtu() const; + getMtu() const noexcept + { + return m_mtu; + } - /** \return capacity of the send queue (in bytes) - * \retval QUEUE_UNSUPPORTED transport does not support queue capacity retrieval - * \retval QUEUE_ERROR transport was unable to retrieve the queue capacity + /** + * \brief Returns the capacity of the send queue (in bytes). + * \retval QUEUE_UNSUPPORTED The transport does not support queue capacity retrieval. + * \retval QUEUE_ERROR The transport was unable to retrieve the queue capacity. */ ssize_t - getSendQueueCapacity() const; + getSendQueueCapacity() const noexcept + { + return m_sendQueueCapacity; + } public: // dynamic properties - /** \return transport state + /** + * \brief Returns the current transport state. */ TransportState - getState() const; + getState() const noexcept + { + return m_state; + } - /** \brief signals when transport state changes + /** + * \brief Signals when the transport state changes. */ signal::Signal afterStateChange; - /** \return expiration time of the transport - * \retval time::steady_clock::TimePoint::max() the transport has indefinite lifetime + /** + * \brief Returns the expiration time of the transport. + * \retval time::steady_clock::time_point::max() The transport has an indefinite lifetime. */ - time::steady_clock::TimePoint - getExpirationTime() const; + time::steady_clock::time_point + getExpirationTime() const noexcept + { + return m_expirationTime; + } - /** \return current send queue length of the transport (in octets) - * \retval QUEUE_UNSUPPORTED transport does not support queue length retrieval - * \retval QUEUE_ERROR transport was unable to retrieve the queue length + /** + * \brief Returns the current send queue length of the transport (in octets). + * \retval QUEUE_UNSUPPORTED The transport does not support queue length retrieval. + * \retval QUEUE_ERROR The transport was unable to retrieve the queue length. */ virtual ssize_t getSendQueueLength() @@ -275,24 +331,39 @@ protected: // upper interface to be invoked by subclass protected: // properties to be set by subclass void - setLocalUri(const FaceUri& uri); + setLocalUri(const FaceUri& uri) noexcept + { + m_localUri = uri; + } void - setRemoteUri(const FaceUri& uri); + setRemoteUri(const FaceUri& uri) noexcept + { + m_remoteUri = uri; + } void - setScope(ndn::nfd::FaceScope scope); + setScope(ndn::nfd::FaceScope scope) noexcept + { + m_scope = scope; + } void - setLinkType(ndn::nfd::LinkType linkType); + setLinkType(ndn::nfd::LinkType linkType) noexcept + { + m_linkType = linkType; + } void - setMtu(ssize_t mtu); + setMtu(ssize_t mtu) noexcept; void - setSendQueueCapacity(ssize_t sendQueueCapacity); + setSendQueueCapacity(ssize_t sendQueueCapacity) noexcept + { + m_sendQueueCapacity = sendQueueCapacity; + } - /** \brief set transport state + /** \brief Set transport state. * * Only the following transitions are valid: * UP->DOWN, DOWN->UP, UP/DOWN->CLOSING/FAILED, CLOSING/FAILED->CLOSED @@ -303,10 +374,13 @@ protected: // properties to be set by subclass setState(TransportState newState); void - setExpirationTime(const time::steady_clock::TimePoint& expirationTime); + setExpirationTime(const time::steady_clock::time_point& expirationTime) noexcept + { + m_expirationTime = expirationTime; + } protected: // to be overridden by subclass - /** \brief invoked by canChangePersistencyTo to perform the check + /** \brief Invoked by canChangePersistencyTo to perform the check. * * Base class implementation returns false. * @@ -315,7 +389,7 @@ protected: // to be overridden by subclass virtual bool canChangePersistencyToImpl(ndn::nfd::FacePersistency newPersistency) const; - /** \brief invoked after the persistency has been changed + /** \brief Invoked after the persistency has been changed. * * The base class implementation does nothing. * When overridden in a subclass, the function should update internal states @@ -324,9 +398,9 @@ protected: // to be overridden by subclass virtual void afterChangePersistency(ndn::nfd::FacePersistency oldPersistency); - /** \brief performs Transport specific operations to close the transport + /** \brief Performs Transport specific operations to close the transport. * - * This is invoked once by \p close() after changing state to CLOSING. + * This is invoked once by close() after changing state to CLOSING. * It will not be invoked by Transport class if the transport is already CLOSING or CLOSED. * * When the cleanup procedure is complete, this method should change state to CLOSED. @@ -336,7 +410,7 @@ protected: // to be overridden by subclass doClose() = 0; private: // to be overridden by subclass - /** \brief performs Transport specific operations to send a packet + /** \brief Performs Transport specific operations to send a packet. * \param packet the packet to be sent, can be assumed to be valid and well-formed * \pre transport state is either UP or DOWN */ @@ -344,133 +418,19 @@ private: // to be overridden by subclass doSend(const Block& packet) = 0; private: - Face* m_face; - LinkService* m_service; + Face* m_face = nullptr; + LinkService* m_service = nullptr; FaceUri m_localUri; FaceUri m_remoteUri; - ndn::nfd::FaceScope m_scope; - ndn::nfd::FacePersistency m_persistency; - ndn::nfd::LinkType m_linkType; - ssize_t m_mtu; - ssize_t m_sendQueueCapacity; - TransportState m_state; - time::steady_clock::TimePoint m_expirationTime; + ndn::nfd::FaceScope m_scope = ndn::nfd::FACE_SCOPE_NONE; + ndn::nfd::FacePersistency m_persistency = ndn::nfd::FACE_PERSISTENCY_NONE; + ndn::nfd::LinkType m_linkType = ndn::nfd::LINK_TYPE_NONE; + ssize_t m_mtu = MTU_INVALID; + ssize_t m_sendQueueCapacity = QUEUE_UNSUPPORTED; + TransportState m_state = TransportState::UP; + time::steady_clock::time_point m_expirationTime = time::steady_clock::time_point::max(); }; -inline const Face* -Transport::getFace() const -{ - return m_face; -} - -inline const LinkService* -Transport::getLinkService() const -{ - return m_service; -} - -inline LinkService* -Transport::getLinkService() -{ - return m_service; -} - -inline const Transport::Counters& -Transport::getCounters() const -{ - return *this; -} - -inline FaceUri -Transport::getLocalUri() const -{ - return m_localUri; -} - -inline void -Transport::setLocalUri(const FaceUri& uri) -{ - m_localUri = uri; -} - -inline FaceUri -Transport::getRemoteUri() const -{ - return m_remoteUri; -} - -inline void -Transport::setRemoteUri(const FaceUri& uri) -{ - m_remoteUri = uri; -} - -inline ndn::nfd::FaceScope -Transport::getScope() const -{ - return m_scope; -} - -inline void -Transport::setScope(ndn::nfd::FaceScope scope) -{ - m_scope = scope; -} - -inline ndn::nfd::FacePersistency -Transport::getPersistency() const -{ - return m_persistency; -} - -inline ndn::nfd::LinkType -Transport::getLinkType() const -{ - return m_linkType; -} - -inline void -Transport::setLinkType(ndn::nfd::LinkType linkType) -{ - m_linkType = linkType; -} - -inline ssize_t -Transport::getMtu() const -{ - return m_mtu; -} - -inline ssize_t -Transport::getSendQueueCapacity() const -{ - return m_sendQueueCapacity; -} - -inline void -Transport::setSendQueueCapacity(ssize_t sendQueueCapacity) -{ - m_sendQueueCapacity = sendQueueCapacity; -} - -inline TransportState -Transport::getState() const -{ - return m_state; -} - -inline time::steady_clock::TimePoint -Transport::getExpirationTime() const -{ - return m_expirationTime; -} - -inline void -Transport::setExpirationTime(const time::steady_clock::TimePoint& expirationTime) -{ - m_expirationTime = expirationTime; -} - std::ostream& operator<<(std::ostream& os, const FaceLogHelper& flh); diff --git a/daemon/face/udp-factory.hpp b/daemon/face/udp-factory.hpp index f0cd686d..9144a7a1 100644 --- a/daemon/face/udp-factory.hpp +++ b/daemon/face/udp-factory.hpp @@ -31,7 +31,7 @@ namespace nfd::face { -/** \brief Protocol factory for UDP over IPv4 and IPv6 +/** \brief Protocol factory for UDP over IPv4 and IPv6. */ class UdpFactory final : public ProtocolFactory { @@ -49,7 +49,7 @@ public: UdpFactory(const CtorParams& params); /** - * \brief Create UDP-based channel using udp::Endpoint + * \brief Create UDP-based channel using udp::Endpoint. * * udp::Endpoint is really an alias for boost::asio::ip::udp::endpoint. * @@ -68,7 +68,7 @@ public: time::nanoseconds idleTimeout); /** - * \brief Create a multicast UDP face + * \brief Create a multicast UDP face. * * udp::Endpoint is really an alias for boost::asio::ip::udp::endpoint. * @@ -95,8 +95,6 @@ public: const udp::Endpoint& multicastEndpoint); private: - /** \brief process face_system.udp config section - */ void doProcessConfig(OptionalConfigSection configSection, FaceSystem::ConfigContext& context) final; @@ -109,13 +107,13 @@ private: std::vector> doGetChannels() const final; - /** \brief Create UDP multicast faces on \p netif if needed by \p m_mcastConfig + /** \brief Create UDP multicast faces on \p netif if needed by \p m_mcastConfig. * \return list of faces (just created or already existing) on \p netif */ std::vector> applyMcastConfigToNetif(const shared_ptr& netif); - /** \brief Create and destroy UDP multicast faces according to \p m_mcastConfig + /** \brief Create and destroy UDP multicast faces according to \p m_mcastConfig. */ void applyMcastConfig(const FaceSystem::ConfigContext& context); diff --git a/daemon/face/udp-protocol.hpp b/daemon/face/udp-protocol.hpp index 1b6e3630..5f00b00a 100644 --- a/daemon/face/udp-protocol.hpp +++ b/daemon/face/udp-protocol.hpp @@ -34,12 +34,14 @@ namespace nfd::udp { using Endpoint = boost::asio::ip::udp::endpoint; -/** \brief computes maximum payload size in a UDP packet +/** + * \brief Computes the maximum payload size in a UDP packet. */ ssize_t computeMtu(const Endpoint& localEndpoint); -/** \return default IPv4 multicast group: 224.0.23.170:56363 +/** + * \brief Returns the default IPv4 multicast group: `224.0.23.170:56363` */ inline Endpoint getDefaultMulticastGroup() @@ -47,7 +49,8 @@ getDefaultMulticastGroup() return {boost::asio::ip::address_v4(0xE00017AA), 56363}; } -/** \return default IPv6 multicast group: [FF02::1234]:56363 +/** + * \brief Returns the default IPv6 multicast group: `[FF02::1234]:56363` */ inline Endpoint getDefaultMulticastGroupV6() diff --git a/daemon/face/unicast-ethernet-transport.cpp b/daemon/face/unicast-ethernet-transport.cpp index 3da06817..25864f76 100644 --- a/daemon/face/unicast-ethernet-transport.cpp +++ b/daemon/face/unicast-ethernet-transport.cpp @@ -79,7 +79,7 @@ UnicastEthernetTransport::afterChangePersistency(ndn::nfd::FacePersistency oldPe } else { m_closeIfIdleEvent.cancel(); - setExpirationTime(time::steady_clock::TimePoint::max()); + setExpirationTime(time::steady_clock::time_point::max()); } } diff --git a/daemon/face/unicast-udp-transport.cpp b/daemon/face/unicast-udp-transport.cpp index e0a05261..c8a208e2 100644 --- a/daemon/face/unicast-udp-transport.cpp +++ b/daemon/face/unicast-udp-transport.cpp @@ -94,7 +94,7 @@ UnicastUdpTransport::afterChangePersistency(ndn::nfd::FacePersistency oldPersist } else { m_closeIfIdleEvent.cancel(); - setExpirationTime(time::steady_clock::TimePoint::max()); + setExpirationTime(time::steady_clock::time_point::max()); } } diff --git a/daemon/face/unix-stream-factory.hpp b/daemon/face/unix-stream-factory.hpp index 96ea3b17..8b044d45 100644 --- a/daemon/face/unix-stream-factory.hpp +++ b/daemon/face/unix-stream-factory.hpp @@ -31,7 +31,7 @@ namespace nfd::face { -/** \brief Protocol factory for stream-oriented Unix sockets +/** \brief Protocol factory for stream-oriented Unix sockets. */ class UnixStreamFactory final : public ProtocolFactory { @@ -42,7 +42,7 @@ public: using ProtocolFactory::ProtocolFactory; /** - * \brief Create stream-oriented Unix channel using specified socket path + * \brief Create stream-oriented Unix channel using specified socket path. * * If this method is called twice with the same path, only one channel * will be created. The second call will just retrieve the existing @@ -55,8 +55,6 @@ public: createChannel(const std::string& unixSocketPath); private: - /** \brief process face_system.unix config section - */ void doProcessConfig(OptionalConfigSection configSection, FaceSystem::ConfigContext& context) final; diff --git a/daemon/face/websocket-factory.hpp b/daemon/face/websocket-factory.hpp index 1da0f98b..7804a62d 100644 --- a/daemon/face/websocket-factory.hpp +++ b/daemon/face/websocket-factory.hpp @@ -31,7 +31,7 @@ namespace nfd::face { -/** \brief Protocol factory for WebSocket +/** \brief Protocol factory for WebSocket. */ class WebSocketFactory final : public ProtocolFactory { @@ -42,7 +42,7 @@ public: using ProtocolFactory::ProtocolFactory; /** - * \brief Create WebSocket-based channel using websocket::Endpoint + * \brief Create WebSocket-based channel using websocket::Endpoint. * * websocket::Endpoint is really an alias for boost::asio::ip::tcp::endpoint. * @@ -57,8 +57,6 @@ public: createChannel(const websocket::Endpoint& localEndpoint); private: - /** \brief process face_system.websocket config section - */ void doProcessConfig(OptionalConfigSection configSection, FaceSystem::ConfigContext& context) final; diff --git a/daemon/face/websocket-transport.hpp b/daemon/face/websocket-transport.hpp index 41488724..0dcb5304 100644 --- a/daemon/face/websocket-transport.hpp +++ b/daemon/face/websocket-transport.hpp @@ -31,31 +31,31 @@ namespace nfd::face { -/** \brief counters provided by WebSocketTransport - * \note The type name 'WebSocketTransportCounters' is implementation detail. - * Use 'WebSocketTransport::Counters' in public API. +/** \brief Counters provided by WebSocketTransport. + * \note The type name WebSocketTransportCounters is an implementation detail. + * Use WebSocketTransport::Counters in public API. */ class WebSocketTransportCounters : public virtual Transport::Counters { public: - /** \brief count of outgoing Pings + /** \brief Count of outgoing pings. */ PacketCounter nOutPings; - /** \brief count of incoming Pongs + /** \brief Count of incoming pongs. */ PacketCounter nInPongs; }; -/** \brief A Transport that communicates on a WebSocket connection +/** \brief A Transport that communicates on a WebSocket connection. */ class WebSocketTransport final : public Transport , protected virtual WebSocketTransportCounters { public: - /** \brief counters provided by WebSocketTransport + /** \brief %Counters provided by WebSocketTransport. */ - typedef WebSocketTransportCounters Counters; + using Counters = WebSocketTransportCounters; WebSocketTransport(websocketpp::connection_hdl hdl, websocket::Server& server, @@ -64,8 +64,7 @@ public: const Counters& getCounters() const final; - /** \brief Translates a message into a Block - * and delivers it to the link service + /** \brief Translates a message into a Block and delivers it to the link service. */ void receiveMessage(const std::string& msg); diff --git a/daemon/fw/access-strategy.hpp b/daemon/fw/access-strategy.hpp index c33ad5c9..194c9ca7 100644 --- a/daemon/fw/access-strategy.hpp +++ b/daemon/fw/access-strategy.hpp @@ -35,16 +35,17 @@ namespace nfd::fw { -/** \brief Access Router strategy +/** + * \brief A forwarding strategy for "access" routers. * - * This strategy is designed for the last hop on the NDN testbed, - * where each nexthop connects to a laptop, links are lossy, and FIB is mostly correct. + * This strategy is designed for the last hop on the NDN testbed, + * where each nexthop connects to a laptop, links are lossy, and FIB is mostly correct. * - * 1. Multicast the first Interest to all nexthops. - * 2. When Data comes back, remember last working nexthop of the prefix; - * the granularity of this knowledge is the parent of Data Name. - * 3. Forward subsequent Interests to the last working nexthop. - * If it doesn't respond, multicast again. + * 1. Multicast the first Interest to all nexthops. + * 2. When Data comes back, remember the last working nexthop of the prefix; + * the granularity of this knowledge is the parent of Data Name. + * 3. Forward subsequent Interests to the last working nexthop. + * If there is no reply, multicast again (step 1). */ class AccessStrategy : public Strategy { @@ -67,7 +68,7 @@ public: // triggers private: // StrategyInfo using RttEstimator = ndn::util::RttEstimator; - /** \brief StrategyInfo on PIT entry + /** \brief StrategyInfo on PIT entry. */ class PitInfo final : public StrategyInfo { @@ -82,7 +83,7 @@ private: // StrategyInfo scheduler::ScopedEventId rtoTimer; }; - /** \brief StrategyInfo in measurements table + /** \brief StrategyInfo in measurements table. */ class MtInfo final : public StrategyInfo { @@ -104,18 +105,18 @@ private: // StrategyInfo RttEstimator rtt; }; - /** \brief find per-prefix measurements for Interest + /** \brief Find per-prefix measurements for Interest. */ std::tuple findPrefixMeasurements(const pit::Entry& pitEntry); - /** \brief get or create pre-prefix measurements for incoming Data + /** \brief Get or create pre-prefix measurements for incoming Data. * \note This function creates MtInfo but doesn't update it. */ MtInfo* addPrefixMeasurements(const Data& data); - /** \brief global per-face StrategyInfo + /** \brief Global per-face StrategyInfo. * \todo Currently stored inside AccessStrategy instance; should be moved * to measurements table or somewhere else. */ @@ -141,7 +142,7 @@ private: // forwarding procedures afterReceiveRetxInterest(const Interest& interest, const FaceEndpoint& ingress, const shared_ptr& pitEntry); - /** \brief send to last working nexthop + /** \brief Send to last working nexthop. * \return whether an Interest is sent */ bool @@ -153,7 +154,7 @@ private: // forwarding procedures afterRtoTimeout(const weak_ptr& pitWeak, FaceId inFaceId, FaceId firstOutFaceId); - /** \brief multicast to all nexthops + /** \brief Multicast to all nexthops. * \param exceptFace don't forward to this face; also, \p inFace is always excluded * \return number of Interests that were sent */ diff --git a/daemon/fw/algorithm.hpp b/daemon/fw/algorithm.hpp index 2ff4c2c3..3ae38808 100644 --- a/daemon/fw/algorithm.hpp +++ b/daemon/fw/algorithm.hpp @@ -35,13 +35,13 @@ namespace nfd::fw { -/** \brief determine whether forwarding the Interest in \p pitEntry to \p outFace would violate scope +/** \brief Determine whether forwarding the Interest in \p pitEntry to \p outFace would violate scope. * \sa https://redmine.named-data.net/projects/nfd/wiki/ScopeControl */ bool wouldViolateScope(const Face& inFace, const Interest& interest, const Face& outFace); -/** \brief indicates where duplicate Nonces are found +/** \brief Indicates where duplicate Nonces are found. */ enum DuplicateNonceWhere { DUPLICATE_NONCE_NONE = 0, ///< no duplicate Nonce is found @@ -51,13 +51,13 @@ enum DuplicateNonceWhere { DUPLICATE_NONCE_OUT_OTHER = (1 << 3), ///< out-record of other face }; -/** \brief determine whether \p pitEntry has duplicate Nonce \p nonce +/** \brief Determine whether \p pitEntry has duplicate Nonce \p nonce. * \return OR'ed DuplicateNonceWhere */ int findDuplicateNonce(const pit::Entry& pitEntry, Interest::Nonce nonce, const Face& face); -/** \brief determine whether \p pitEntry has any pending out-records +/** \brief Determine whether \p pitEntry has any pending out-records. * \return true if there is at least one out-record waiting for Data */ bool @@ -66,10 +66,10 @@ hasPendingOutRecords(const pit::Entry& pitEntry); /** \return last out-record time * \pre pitEntry has one or more unexpired out-records */ -time::steady_clock::TimePoint +time::steady_clock::time_point getLastOutgoing(const pit::Entry& pitEntry); -/** \brief pick an eligible NextHop with earliest out-record +/** \brief Pick an eligible NextHop with earliest out-record. * \note It is assumed that every nexthop has an out-record. */ fib::NextHopList::const_iterator @@ -77,20 +77,20 @@ findEligibleNextHopWithEarliestOutRecord(const Face& inFace, const Interest& int const fib::NextHopList& nexthops, const shared_ptr& pitEntry); -/** \brief determines whether a NextHop is eligible i.e. not the same inFace +/** \brief Determines whether a NextHop is eligible, i.e., not the same \p inFace. * \param inFace incoming face of current Interest * \param interest incoming Interest * \param nexthop next hop * \param pitEntry PIT entry * \param wantUnused if true, NextHop must not have unexpired out-record - * \param now time::steady_clock::now(), ignored if !wantUnused + * \param now the current time, ignored if `wantUnused == false` */ bool isNextHopEligible(const Face& inFace, const Interest& interest, const fib::NextHop& nexthop, const shared_ptr& pitEntry, bool wantUnused = false, - time::steady_clock::TimePoint now = time::steady_clock::TimePoint::min()); + time::steady_clock::time_point now = time::steady_clock::time_point::min()); } // namespace nfd::fw diff --git a/daemon/fw/asf-strategy.hpp b/daemon/fw/asf-strategy.hpp index 0e6f3a2d..b3d73967 100644 --- a/daemon/fw/asf-strategy.hpp +++ b/daemon/fw/asf-strategy.hpp @@ -34,12 +34,13 @@ namespace nfd::fw { namespace asf { -/** \brief Adaptive SRTT-based Forwarding Strategy +/** + * \brief Adaptive SRTT-based forwarding strategy. * - * \see Vince Lehman, Ashlesh Gawande, Rodrigo Aldecoa, Dmitri Krioukov, Beichuan Zhang, - * Lixia Zhang, and Lan Wang, "An Experimental Investigation of Hyperbolic Routing - * with a Smart Forwarding Plane in NDN", NDN Technical Report NDN-0042, 2016. - * https://named-data.net/publications/techreports/ndn-0042-1-asf/ + * \see Vince Lehman, Ashlesh Gawande, Rodrigo Aldecoa, Dmitri Krioukov, Beichuan Zhang, + * Lixia Zhang, and Lan Wang, "An Experimental Investigation of Hyperbolic Routing + * with a Smart Forwarding Plane in NDN", NDN Technical Report NDN-0042, 2016. + * https://named-data.net/publications/techreports/ndn-0042-1-asf/ */ class AsfStrategy : public Strategy { diff --git a/daemon/fw/best-route-strategy.hpp b/daemon/fw/best-route-strategy.hpp index 484ac51f..56e64a57 100644 --- a/daemon/fw/best-route-strategy.hpp +++ b/daemon/fw/best-route-strategy.hpp @@ -32,22 +32,23 @@ namespace nfd::fw { -/** \brief Best Route strategy +/** + * \brief "Best route" forwarding strategy. * - * This strategy forwards a new Interest to the lowest-cost nexthop (except downstream). - * After that, if consumer retransmits the Interest (and is not suppressed according to - * exponential backoff algorithm), the strategy forwards the Interest again to - * the lowest-cost nexthop (except downstream) that is not previously used. - * If all nexthops have been used, the strategy starts over with the first nexthop. + * This strategy forwards a new Interest to the lowest-cost nexthop (except downstream). + * After that, if consumer retransmits the Interest (and is not suppressed according to + * exponential backoff algorithm), the strategy forwards the Interest again to + * the lowest-cost nexthop (except downstream) that is not previously used. + * If all nexthops have been used, the strategy starts over with the first nexthop. * - * This strategy returns Nack to all downstreams with reason NoRoute - * if there is no usable nexthop, which may be caused by: + * This strategy returns Nack to all downstreams with reason NoRoute + * if there is no usable nexthop, which may be caused by: * (a) the FIB entry contains no nexthop; * (b) the FIB nexthop happens to be the sole downstream; * (c) the FIB nexthops violate scope. * - * This strategy returns Nack to all downstreams if all upstreams have returned Nacks. - * The reason of the sent Nack equals the least severe reason among received Nacks. + * This strategy returns Nack to all downstreams if all upstreams have returned Nacks. + * The reason of the sent Nack equals the least severe reason among received Nacks. */ class BestRouteStrategy : public Strategy , public ProcessNackTraits diff --git a/daemon/fw/face-table.cpp b/daemon/fw/face-table.cpp index 93567bf1..75b11909 100644 --- a/daemon/fw/face-table.cpp +++ b/daemon/fw/face-table.cpp @@ -36,20 +36,15 @@ NDN_CXX_ASSERT_FORWARD_ITERATOR(FaceTable::const_iterator); NFD_LOG_INIT(FaceTable); -FaceTable::FaceTable() - : m_lastFaceId(face::FACEID_RESERVED_MAX) -{ -} - Face* -FaceTable::get(FaceId id) const +FaceTable::get(FaceId id) const noexcept { auto i = m_faces.find(id); return i == m_faces.end() ? nullptr : i->second.get(); } size_t -FaceTable::size() const +FaceTable::size() const noexcept { return m_faces.size(); } diff --git a/daemon/fw/face-table.hpp b/daemon/fw/face-table.hpp index d1c51c7d..b19530df 100644 --- a/daemon/fw/face-table.hpp +++ b/daemon/fw/face-table.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-2022, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -33,14 +33,13 @@ namespace nfd { -/** \brief container of all faces +/** + * \brief Container of all faces. */ class FaceTable : noncopyable { public: - FaceTable(); - - /** \brief add a face + /** \brief Add a face. * * FaceTable obtains shared ownership of the face. * The channel or protocol factory that creates the face may retain ownership. @@ -48,29 +47,26 @@ public: void add(shared_ptr face); - /** \brief add a special face with a reserved FaceId + /** \brief Add a special face with a reserved FaceId. */ void addReserved(shared_ptr face, FaceId faceId); - /** \brief get face by FaceId - * \return a face if found, nullptr if not found; - * face->shared_from_this() can be used if shared_ptr is desired + /** \brief Get face by FaceId. + * \return A pointer to the face if found, nullptr otherwise; + * `face->shared_from_this()` can be used if a `shared_ptr` is desired. */ Face* - get(FaceId id) const; + get(FaceId id) const noexcept; - /** \return count of faces + /** \brief Return the total number of faces. */ size_t - size() const; + size() const noexcept; public: // enumeration using FaceMap = std::map>; using ForwardRange = boost::indirected_range>; - - /** \brief ForwardIterator for Face& - */ using const_iterator = boost::range_iterator::type; const_iterator @@ -101,7 +97,7 @@ private: getForwardRange() const; private: - FaceId m_lastFaceId; + FaceId m_lastFaceId = face::FACEID_RESERVED_MAX; FaceMap m_faces; }; diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp index f4f5928e..172331f7 100644 --- a/daemon/fw/forwarder.cpp +++ b/daemon/fw/forwarder.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-2022, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -86,8 +86,6 @@ Forwarder::Forwarder(FaceTable& faceTable) m_strategyChoice.setDefaultStrategy(getDefaultStrategyName()); } -Forwarder::~Forwarder() = default; - void Forwarder::onIncomingInterest(const Interest& interest, const FaceEndpoint& ingress) { diff --git a/daemon/fw/forwarder.hpp b/daemon/fw/forwarder.hpp index 373d395b..a2f2af7b 100644 --- a/daemon/fw/forwarder.hpp +++ b/daemon/fw/forwarder.hpp @@ -56,144 +56,146 @@ public: explicit Forwarder(FaceTable& faceTable); - NFD_VIRTUAL_WITH_TESTS - ~Forwarder(); +#ifdef NFD_WITH_TESTS + virtual + ~Forwarder() = default; +#endif const ForwarderCounters& - getCounters() const + getCounters() const noexcept { return m_counters; } fw::UnsolicitedDataPolicy& - getUnsolicitedDataPolicy() const + getUnsolicitedDataPolicy() const noexcept { return *m_unsolicitedDataPolicy; } void - setUnsolicitedDataPolicy(unique_ptr policy) + setUnsolicitedDataPolicy(unique_ptr policy) noexcept { BOOST_ASSERT(policy != nullptr); m_unsolicitedDataPolicy = std::move(policy); } NameTree& - getNameTree() + getNameTree() noexcept { return m_nameTree; } Fib& - getFib() + getFib() noexcept { return m_fib; } Pit& - getPit() + getPit() noexcept { return m_pit; } Cs& - getCs() + getCs() noexcept { return m_cs; } Measurements& - getMeasurements() + getMeasurements() noexcept { return m_measurements; } StrategyChoice& - getStrategyChoice() + getStrategyChoice() noexcept { return m_strategyChoice; } DeadNonceList& - getDeadNonceList() + getDeadNonceList() noexcept { return m_deadNonceList; } NetworkRegionTable& - getNetworkRegionTable() + getNetworkRegionTable() noexcept { return m_networkRegionTable; } - /** \brief register handler for forwarder section of NFD configuration file + /** \brief Register handler for forwarder section of NFD configuration file. */ void setConfigFile(ConfigFile& configFile); NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: // pipelines - /** \brief incoming Interest pipeline + /** \brief Incoming Interest pipeline. * \param interest the incoming Interest, must be well-formed and created with make_shared * \param ingress face on which \p interest was received and endpoint of the sender */ NFD_VIRTUAL_WITH_TESTS void onIncomingInterest(const Interest& interest, const FaceEndpoint& ingress); - /** \brief Interest loop pipeline + /** \brief Interest loop pipeline. */ NFD_VIRTUAL_WITH_TESTS void onInterestLoop(const Interest& interest, const FaceEndpoint& ingress); - /** \brief Content Store miss pipeline + /** \brief Content Store miss pipeline. */ NFD_VIRTUAL_WITH_TESTS void onContentStoreMiss(const Interest& interest, const FaceEndpoint& ingress, const shared_ptr& pitEntry); - /** \brief Content Store hit pipeline + /** \brief Content Store hit pipeline. */ NFD_VIRTUAL_WITH_TESTS void onContentStoreHit(const Interest& interest, const FaceEndpoint& ingress, const shared_ptr& pitEntry, const Data& data); - /** \brief outgoing Interest pipeline + /** \brief Outgoing Interest pipeline. * \return A pointer to the out-record created or nullptr if the Interest was dropped */ NFD_VIRTUAL_WITH_TESTS pit::OutRecord* onOutgoingInterest(const Interest& interest, Face& egress, const shared_ptr& pitEntry); - /** \brief Interest finalize pipeline + /** \brief Interest finalize pipeline. */ NFD_VIRTUAL_WITH_TESTS void onInterestFinalize(const shared_ptr& pitEntry); - /** \brief incoming Data pipeline + /** \brief Incoming Data pipeline. * \param data the incoming Data, must be well-formed and created with make_shared * \param ingress face on which \p data was received and endpoint of the sender */ NFD_VIRTUAL_WITH_TESTS void onIncomingData(const Data& data, const FaceEndpoint& ingress); - /** \brief Data unsolicited pipeline + /** \brief Data unsolicited pipeline. */ NFD_VIRTUAL_WITH_TESTS void onDataUnsolicited(const Data& data, const FaceEndpoint& ingress); - /** \brief outgoing Data pipeline + /** \brief Outgoing Data pipeline. * \return Whether the Data was transmitted (true) or dropped (false) */ NFD_VIRTUAL_WITH_TESTS bool onOutgoingData(const Data& data, Face& egress); - /** \brief incoming Nack pipeline + /** \brief Incoming Nack pipeline. * \param nack the incoming Nack, must be well-formed * \param ingress face on which \p nack is received and endpoint of the sender */ NFD_VIRTUAL_WITH_TESTS void onIncomingNack(const lp::Nack& nack, const FaceEndpoint& ingress); - /** \brief outgoing Nack pipeline + /** \brief Outgoing Nack pipeline. * \return Whether the Nack was transmitted (true) or dropped (false) */ NFD_VIRTUAL_WITH_TESTS bool @@ -207,12 +209,12 @@ NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: // pipelines onNewNextHop(const Name& prefix, const fib::NextHop& nextHop); private: - /** \brief set a new expiry timer (now + \p duration) on a PIT entry + /** \brief Set a new expiry timer (now + \p duration) on a PIT entry. */ void setExpiryTimer(const shared_ptr& pitEntry, time::milliseconds duration); - /** \brief insert Nonce to Dead Nonce List if necessary + /** \brief Insert Nonce to Dead Nonce List if necessary. * \param upstream if null, insert Nonces from all out-records; * if not null, insert Nonce only on the out-records of this face */ @@ -225,7 +227,7 @@ private: NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: /** - * \brief Configuration options from "forwarder" section + * \brief Configuration options from the `forwarder` section. */ struct Config { diff --git a/daemon/fw/multicast-strategy.hpp b/daemon/fw/multicast-strategy.hpp index 6abbb384..da010184 100644 --- a/daemon/fw/multicast-strategy.hpp +++ b/daemon/fw/multicast-strategy.hpp @@ -31,7 +31,8 @@ namespace nfd::fw { -/** \brief A forwarding strategy that forwards Interests to all FIB nexthops +/** + * \brief A forwarding strategy that forwards Interests to all FIB nexthops. */ class MulticastStrategy : public Strategy { diff --git a/daemon/fw/random-strategy.hpp b/daemon/fw/random-strategy.hpp index 31b1e260..4150d9fc 100644 --- a/daemon/fw/random-strategy.hpp +++ b/daemon/fw/random-strategy.hpp @@ -31,9 +31,10 @@ namespace nfd::fw { -/** \brief A forwarding strategy that randomly chooses a nexthop +/** + * \brief A forwarding strategy that randomly chooses a nexthop. * - * Sends the incoming Interest to a random outgoing face, excluding the incoming face. + * Sends the incoming Interest to a random outgoing face, excluding the incoming face. */ class RandomStrategy : public Strategy , public ProcessNackTraits diff --git a/daemon/fw/retx-suppression-exponential.cpp b/daemon/fw/retx-suppression-exponential.cpp index 6d8cdcb6..39af1f50 100644 --- a/daemon/fw/retx-suppression-exponential.cpp +++ b/daemon/fw/retx-suppression-exponential.cpp @@ -46,9 +46,7 @@ public: } public: - /** \brief if last transmission occurred within suppressionInterval, - * retransmission will be suppressed - */ + // If the last transmission occurred within this interval, retx will be suppressed RetxSuppressionExponential::Duration suppressionInterval; }; diff --git a/daemon/fw/retx-suppression-exponential.hpp b/daemon/fw/retx-suppression-exponential.hpp index fd8e2c62..82dec6c9 100644 --- a/daemon/fw/retx-suppression-exponential.hpp +++ b/daemon/fw/retx-suppression-exponential.hpp @@ -51,19 +51,19 @@ public: Duration maxInterval = DEFAULT_MAX_INTERVAL, float multiplier = DEFAULT_MULTIPLIER); - /** \brief determines whether Interest is a retransmission per pit entry - * and if so, whether it shall be forwarded or suppressed + /** \brief Determines whether Interest is a retransmission per pit entry + * and if so, whether it shall be forwarded or suppressed. */ RetxSuppressionResult decidePerPitEntry(pit::Entry& pitEntry); - /** \brief determines whether Interest is a retransmission per upstream - * and if so, whether it shall be forwarded or suppressed + /** \brief Determines whether Interest is a retransmission per upstream + * and if so, whether it shall be forwarded or suppressed. */ RetxSuppressionResult decidePerUpstream(pit::Entry& pitEntry, Face& outFace); - /** \brief Increment the suppression interval for out record + /** \brief Increment the suppression interval for out record. */ void incrementIntervalForOutRecord(pit::OutRecord& outRecord); diff --git a/daemon/fw/retx-suppression-fixed.hpp b/daemon/fw/retx-suppression-fixed.hpp index fdd11146..7090b997 100644 --- a/daemon/fw/retx-suppression-fixed.hpp +++ b/daemon/fw/retx-suppression-fixed.hpp @@ -31,8 +31,9 @@ namespace nfd::fw { -/** \brief a retransmission suppression decision algorithm that - * suppresses retransmissions within a fixed duration +/** + * \brief A retransmission suppression decision algorithm that + * suppresses retransmissions within a fixed duration. */ class RetxSuppressionFixed { @@ -40,8 +41,8 @@ public: explicit RetxSuppressionFixed(const time::milliseconds& minRetxInterval = DEFAULT_MIN_RETX_INTERVAL); - /** \brief determines whether Interest is a retransmission, - * and if so, whether it shall be forwarded or suppressed + /** \brief Determines whether Interest is a retransmission, + * and if so, whether it shall be forwarded or suppressed. */ RetxSuppressionResult decidePerPitEntry(pit::Entry& pitEntry) const; diff --git a/daemon/fw/scope-prefix.hpp b/daemon/fw/scope-prefix.hpp index 9b48b22f..cbc5d1c3 100644 --- a/daemon/fw/scope-prefix.hpp +++ b/daemon/fw/scope-prefix.hpp @@ -28,12 +28,12 @@ #include "core/common.hpp" -/** \brief contain name prefixes that affect namespace-based scope control +/** \brief Contain name prefixes that affect namespace-based scope control. * \sa https://redmine.named-data.net/projects/nfd/wiki/ScopeControl */ namespace nfd::scope_prefix { -/** \brief ndn:/localhost +/** \brief The localhost scope `ndn:/localhost`. * * The localhost scope limits propagation to the applications on the originating host. * @@ -43,7 +43,7 @@ namespace nfd::scope_prefix { */ inline const Name LOCALHOST{"/localhost"}; -/** \brief ndn:/localhop +/** \brief The localhop scope `ndn:/localhop`. * * The localhop scope limits propagation to no further than the next node. * diff --git a/daemon/fw/self-learning-strategy.hpp b/daemon/fw/self-learning-strategy.hpp index 59cf98b4..665d24e7 100644 --- a/daemon/fw/self-learning-strategy.hpp +++ b/daemon/fw/self-learning-strategy.hpp @@ -32,12 +32,13 @@ namespace nfd::fw { -/** \brief Self-learning forwarding strategy +/** + * \brief Self-learning forwarding strategy. * - * This strategy first broadcasts Interest to learn a single path towards data, - * then unicasts subsequent Interests along the learned path. + * This strategy first broadcasts Interest to learn a single path towards data, + * then unicasts subsequent Interests along the learned path. * - * \see https://redmine.named-data.net/attachments/864/Self-learning-strategy-v1.pdf + * \see https://redmine.named-data.net/attachments/864/Self-learning-strategy-v1.pdf */ class SelfLearningStrategy : public Strategy { @@ -90,7 +91,7 @@ public: // triggers const shared_ptr& pitEntry) override; private: // operations - /** \brief Send an Interest to all possible faces + /** \brief Send an Interest to all possible faces. * * This function is invoked when the forwarder has no matching FIB entries for * an incoming discovery Interest, which will be forwarded to faces that @@ -102,7 +103,7 @@ private: // operations broadcastInterest(const Interest& interest, const Face& inFace, const shared_ptr& pitEntry); - /** \brief Send an Interest to \p nexthops + /** \brief Send an Interest to \p nexthops. */ void multicastInterest(const Interest& interest, const Face& inFace, @@ -110,12 +111,12 @@ private: // operations const fib::NextHopList& nexthops); /** \brief Find a Prefix Announcement for the Data on the RIB thread, and forward - * the Data with the Prefix Announcement on the main thread + * the Data with the Prefix Announcement on the main thread. */ void asyncProcessData(const shared_ptr& pitEntry, const Face& inFace, const Data& data); - /** \brief Check whether a PrefixAnnouncement needs to be attached to an incoming Data + /** \brief Check whether a PrefixAnnouncement needs to be attached to an incoming Data. * * The conditions that a Data packet requires a PrefixAnnouncement are * - the incoming Interest was discovery and @@ -125,13 +126,13 @@ private: // operations static bool needPrefixAnn(const shared_ptr& pitEntry); - /** \brief Add a route using RibManager::slAnnounce on the RIB thread + /** \brief Add a route using RibManager::slAnnounce on the RIB thread. */ void addRoute(const shared_ptr& pitEntry, const Face& inFace, const Data& data, const ndn::PrefixAnnouncement& pa); - /** \brief renew a route using RibManager::slRenew on the RIB thread + /** \brief Renew a route using RibManager::slRenew on the RIB thread. */ void renewRoute(const Name& name, FaceId inFaceId, time::milliseconds maxLifetime); diff --git a/daemon/fw/strategy-info.hpp b/daemon/fw/strategy-info.hpp index db6e9e63..fdf457b1 100644 --- a/daemon/fw/strategy-info.hpp +++ b/daemon/fw/strategy-info.hpp @@ -30,7 +30,8 @@ namespace nfd::fw { -/** \brief Contains arbitrary information placed by the forwarding strategy on table entries +/** + * \brief Contains arbitrary information placed by the forwarding strategy on table entries. */ class StrategyInfo { diff --git a/daemon/fw/strategy.hpp b/daemon/fw/strategy.hpp index ce8ba230..285e1a80 100644 --- a/daemon/fw/strategy.hpp +++ b/daemon/fw/strategy.hpp @@ -36,16 +36,17 @@ namespace nfd::fw { class StrategyParameters; /** - * \brief Represents a forwarding strategy + * \brief Base class of all forwarding strategies. */ class Strategy : noncopyable { public: // registry - /** \brief Register a strategy type - * \tparam S subclass of Strategy - * \param strategyName strategy program name, must contain version - * \note It is permitted to register the same strategy type under multiple names, - * which is useful in tests and for creating aliases. + /** + * \brief Register a strategy type. + * \tparam S subclass of Strategy + * \param strategyName strategy program name, must contain version + * \note It is permitted to register the same strategy type under multiple names, + * which is useful in tests and for creating aliases. */ template static void @@ -59,30 +60,34 @@ public: // registry BOOST_VERIFY(r.second); } - /** \return Whether a strategy instance can be created from \p instanceName - * \param instanceName strategy instance name, may contain version and parameters - * \note This function finds a strategy type using same rules as \p create , - * but does not attempt to construct an instance. + /** + * \brief Returns whether a strategy instance can be created from \p instanceName. + * \param instanceName strategy instance name, may contain version and parameters + * \note This function finds a strategy type using the same rules as create(), + * but does not attempt to construct an instance. */ static bool canCreate(const Name& instanceName); - /** \return A strategy instance created from \p instanceName - * \retval nullptr if `canCreate(instanceName) == false` - * \throw std::invalid_argument strategy type constructor does not accept - * specified version or parameters + /** + * \brief Returns a strategy instance created from \p instanceName. + * \retval nullptr if `canCreate(instanceName) == false` + * \throw std::invalid_argument strategy type constructor does not accept the + * specified version or parameters */ static unique_ptr create(const Name& instanceName, Forwarder& forwarder); - /** \return Whether \p instanceNameA and \p instanceNameA will initiate same strategy type + /** + * \brief Returns whether two names will instantiate the same strategy type. */ static bool areSameType(const Name& instanceNameA, const Name& instanceNameB); - /** \return Registered versioned strategy names + /** + * \brief Returns all registered versioned strategy names. */ - static std::set + [[nodiscard]] static std::set listRegistered(); public: // constructor, destructor, strategy info @@ -97,22 +102,24 @@ public: // constructor, destructor, strategy info ~Strategy(); #ifdef DOXYGEN - /** \return Strategy program name + /** + * \brief Returns the strategy's program name. * - * The strategy name is defined by the strategy program. - * It must end with a version component. + * The strategy name is defined by the strategy program. + * It must end with a version component. */ static const Name& getStrategyName(); #endif - /** \return Strategy instance name + /** + * \brief Returns the strategy's instance name. * - * The instance name is assigned during instantiation. - * It contains a version component, and may have extra parameter components. + * The instance name is assigned during instantiation. + * It contains a version component and may have extra parameter components. */ const Name& - getInstanceName() const + getInstanceName() const noexcept { return m_name; } @@ -356,19 +363,19 @@ protected: // accessors lookupFib(const pit::Entry& pitEntry) const; MeasurementsAccessor& - getMeasurements() + getMeasurements() noexcept { return m_measurements; } Face* - getFace(FaceId id) const + getFace(FaceId id) const noexcept { return getFaceTable().get(id); } const FaceTable& - getFaceTable() const + getFaceTable() const noexcept { return m_forwarder.m_faceTable; } @@ -405,7 +412,7 @@ protected: // instance name * \note This must be called by strategy subclass constructor. */ void - setInstanceName(const Name& name) + setInstanceName(const Name& name) noexcept { m_name = name; } diff --git a/daemon/mgmt/command-authenticator.hpp b/daemon/mgmt/command-authenticator.hpp index 12c6c70d..0a3d4e5b 100644 --- a/daemon/mgmt/command-authenticator.hpp +++ b/daemon/mgmt/command-authenticator.hpp @@ -35,7 +35,8 @@ namespace nfd { -/** \brief Provides ControlCommand authorization according to NFD configuration file. +/** + * \brief Provides ControlCommand authorization according to NFD's configuration file. */ class CommandAuthenticator : public std::enable_shared_from_this, noncopyable { @@ -46,10 +47,10 @@ public: void setConfigFile(ConfigFile& configFile); - /** \return an Authorization function for module/verb command + /** \brief Returns an Authorization function for `module/verb` command. * \param module management module name - * \param verb command verb; currently it's ignored - * \note This must be called before parsing configuration file + * \param verb command verb; currently ignored + * \note This must be called before parsing the configuration file. */ ndn::mgmt::Authorization makeAuthorization(const std::string& module, const std::string& verb); @@ -57,14 +58,14 @@ public: private: CommandAuthenticator(); - /** \brief process "authorizations" section + /** \brief Process `authorizations` section. * \throw ConfigFile::Error on parse error */ void processConfig(const ConfigSection& section, bool isDryRun, const std::string& filename); private: - /// module => validator + // module => validator std::unordered_map> m_validators; }; diff --git a/daemon/mgmt/forwarder-status-manager.hpp b/daemon/mgmt/forwarder-status-manager.hpp index 39c52f35..f93650c6 100644 --- a/daemon/mgmt/forwarder-status-manager.hpp +++ b/daemon/mgmt/forwarder-status-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-2022, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -47,7 +47,8 @@ private: ndn::nfd::ForwarderStatus collectGeneralStatus(); - /** \brief provide general status dataset + /** + * \brief Provides the general status dataset. */ void listGeneralStatus(const Name& topPrefix, const Interest& interest, @@ -56,7 +57,7 @@ private: private: Forwarder& m_forwarder; Dispatcher& m_dispatcher; - time::system_clock::TimePoint m_startTimestamp; + time::system_clock::time_point m_startTimestamp; }; } // namespace nfd diff --git a/daemon/mgmt/manager-base.hpp b/daemon/mgmt/manager-base.hpp index 592d4fad..77022714 100644 --- a/daemon/mgmt/manager-base.hpp +++ b/daemon/mgmt/manager-base.hpp @@ -113,7 +113,7 @@ NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: * @param parameters the original ControlParameters * @return whether the original ControlParameters can be validated */ - static bool + [[nodiscard]] static bool validateParameters(const ControlCommand& command, const ndn::mgmt::ControlParameters& parameters); diff --git a/daemon/mgmt/tables-config-section.hpp b/daemon/mgmt/tables-config-section.hpp index f551b789..4dc5dd43 100644 --- a/daemon/mgmt/tables-config-section.hpp +++ b/daemon/mgmt/tables-config-section.hpp @@ -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-2022, 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 { -/** \brief handles 'tables' config section +/** \brief Handles the `tables` configuration file section. * * This class recognizes a config section that looks like * \code{.unparsed} @@ -63,7 +63,7 @@ namespace nfd { * \li strategy_choice entries are inserted, but old entries are not deleted. * \li network_region is applied; it's kept unchanged if the section is omitted. * - * It's necessary to call \p ensureConfigured() after initial configuration and + * It's necessary to call ensureConfigured() after initial configuration and * configuration reload, so that the correct defaults are applied in case * tables section is omitted. */ @@ -76,7 +76,8 @@ public: void setConfigFile(ConfigFile& configFile); - /** \brief apply default configuration, if tables section was omitted in configuration file + /** + * \brief Apply default configuration, if tables section was omitted in configuration file. */ void ensureConfigured(); diff --git a/daemon/rib/fib-updater.cpp b/daemon/rib/fib-updater.cpp index 6f82b175..3a7caff0 100644 --- a/daemon/rib/fib-updater.cpp +++ b/daemon/rib/fib-updater.cpp @@ -554,7 +554,7 @@ FibUpdater::createFibUpdatesForUpdatedRoute(const RibEntry& entry, const Route& void FibUpdater::createFibUpdatesForErasedRoute(const RibEntry& entry, const Route& route, - const bool captureWasTurnedOff) + bool captureWasTurnedOff) { addFibUpdate(FibUpdate::createRemoveUpdate(entry.getName(), route.faceId)); diff --git a/daemon/rib/fib-updater.hpp b/daemon/rib/fib-updater.hpp index e2313417..ee820f69 100644 --- a/daemon/rib/fib-updater.hpp +++ b/daemon/rib/fib-updater.hpp @@ -35,7 +35,8 @@ namespace nfd::rib { -/** \brief computes FibUpdates based on updates to the RIB and sends them to NFD +/** + * \brief Computes FibUpdates based on updates to the RIB and sends them to NFD. */ class FibUpdater : noncopyable { @@ -46,18 +47,19 @@ public: using std::runtime_error::runtime_error; }; -public: using FibUpdateList = std::list; using FibUpdateSuccessCallback = std::function; using FibUpdateFailureCallback = std::function; FibUpdater(Rib& rib, ndn::nfd::Controller& controller); - NFD_VIRTUAL_WITH_TESTS +#ifdef NFD_WITH_TESTS + virtual ~FibUpdater() = default; +#endif - /** \brief computes FibUpdates using the provided RibUpdateBatch and then sends the - * updates to NFD's FIB + /** \brief Computes FibUpdates using the provided RibUpdateBatch and then sends the + * updates to NFD's FIB. * * \note Caller must guarantee that the previous batch has either succeeded or failed * before calling this method @@ -68,56 +70,60 @@ public: const FibUpdateFailureCallback& onFailure); private: - /** \brief determines the type of action that will be performed on the RIB and calls the - * corresponding computation method - */ + /** + * \brief Determines the type of action that will be performed on the RIB and calls the + * corresponding computation method. + */ void computeUpdates(const RibUpdateBatch& batch); - /** \brief sends the passed updates to NFD - * - * onSuccess or onFailure will be called based on the results in - * onUpdateSuccess or onUpdateFailure - * - * \see FibUpdater::onUpdateSuccess - * \see FibUpdater::onUpdateFailure - */ + /** + * \brief Sends the passed updates to NFD. + * + * onSuccess or onFailure will be called based on the results in + * onUpdateSuccess or onUpdateFailure. + * + * \see FibUpdater::onUpdateSuccess + * \see FibUpdater::onUpdateFailure + */ void sendUpdates(const FibUpdateList& updates, const FibUpdateSuccessCallback& onSuccess, const FibUpdateFailureCallback& onFailure); - /** \brief sends the updates in m_updatesForBatchFaceId to NFD if any exist, - * otherwise calls FibUpdater::sendUpdatesForNonBatchFaceId. - */ + /** + * \brief Sends the updates in m_updatesForBatchFaceId to NFD if any exist, + * otherwise calls FibUpdater::sendUpdatesForNonBatchFaceId. + */ void sendUpdatesForBatchFaceId(const FibUpdateSuccessCallback& onSuccess, const FibUpdateFailureCallback& onFailure); - /** \brief sends the updates in m_updatesForNonBatchFaceId to NFD if any exist, - * otherwise calls onSuccess. - */ + /** + * \brief Sends the updates in m_updatesForNonBatchFaceId to NFD if any exist, + * otherwise calls onSuccess. + */ void sendUpdatesForNonBatchFaceId(const FibUpdateSuccessCallback& onSuccess, const FibUpdateFailureCallback& onFailure); NFD_PROTECTED_WITH_TESTS_ELSE_PRIVATE: - /** \brief sends a FibAddNextHopCommand to NFD using the parameters supplied by - * the passed update - * - * \param nTimeouts the number of times this FibUpdate has failed due to timeout - */ + /** + * \brief Sends a FibAddNextHopCommand to NFD using the parameters supplied by + * the passed update. + * \param nTimeouts the number of times this FibUpdate has failed due to timeout + */ NFD_VIRTUAL_WITH_TESTS void sendAddNextHopUpdate(const FibUpdate& update, const FibUpdateSuccessCallback& onSuccess, const FibUpdateFailureCallback& onFailure, uint32_t nTimeouts = 0); - /** \brief sends a FibRemoveNextHopCommand to NFD using the parameters supplied by - * the passed update - * - * \param nTimeouts the number of times this FibUpdate has failed due to timeout - */ + /** + * \brief Sends a FibRemoveNextHopCommand to NFD using the parameters supplied by + * the passed update. + * \param nTimeouts the number of times this FibUpdate has failed due to timeout + */ NFD_VIRTUAL_WITH_TESTS void sendRemoveNextHopUpdate(const FibUpdate& update, const FibUpdateSuccessCallback& onSuccess, @@ -125,48 +131,52 @@ NFD_PROTECTED_WITH_TESTS_ELSE_PRIVATE: uint32_t nTimeouts = 0); private: - /** \brief calculates the FibUpdates generated by a RIB registration - */ + /** + * \brief Calculates the FibUpdates generated by a RIB registration. + */ void computeUpdatesForRegistration(const RibUpdate& update); - /** \brief calculates the FibUpdates generated by a RIB unregistration - */ + /** + * \brief Calculates the FibUpdates generated by a RIB unregistration. + */ void computeUpdatesForUnregistration(const RibUpdate& update); NFD_PROTECTED_WITH_TESTS_ELSE_PRIVATE: - /** \brief callback used by NfdController when a FibAddNextHopCommand or FibRemoveNextHopCommand - * is successful. - * - * If the update has the same Face ID as the batch being processed, the update is - * removed from m_updatesForBatchFaceId. If m_updatesForBatchFaceId becomes empty, - * the updates with a different Face ID than the batch are sent to NFD. - * - * If the update has a different Face ID than the batch being processed, the update is - * removed from m_updatesForBatchNonFaceId. If m_updatesForBatchNonFaceId becomes empty, - * the FIB update process is considered a success. - */ + /** + * \brief Callback used by NfdController when a FibAddNextHopCommand or FibRemoveNextHopCommand + * is successful. + * + * If the update has the same Face ID as the batch being processed, the update is + * removed from m_updatesForBatchFaceId. If m_updatesForBatchFaceId becomes empty, + * the updates with a different Face ID than the batch are sent to NFD. + * + * If the update has a different Face ID than the batch being processed, the update is + * removed from m_updatesForBatchNonFaceId. If m_updatesForBatchNonFaceId becomes empty, + * the FIB update process is considered a success. + */ void onUpdateSuccess(const FibUpdate& update, const FibUpdateSuccessCallback& onSuccess, const FibUpdateFailureCallback& onFailure); - /** \brief callback used by NfdController when a FibAddNextHopCommand or FibRemoveNextHopCommand - * is successful. - * - * If the update has not reached the max number of timeouts allowed, the update - * is retried. - * - * If the update failed due to a non-existent face and the update has the same Face ID - * as the update batch, the FIB update process fails. - * - * If the update failed due to a non-existent face and the update has a different - * face than the update batch, the update is not retried and the error is - * ignored. - * - * Otherwise, a non-recoverable error has occurred and an exception is thrown. - */ + /** + * \brief Callback used by NfdController when a FibAddNextHopCommand or FibRemoveNextHopCommand + * is successful. + * + * If the update has not reached the max number of timeouts allowed, the update + * is retried. + * + * If the update failed due to a non-existent face and the update has the same Face ID + * as the update batch, the FIB update process fails. + * + * If the update failed due to a non-existent face and the update has a different + * face than the update batch, the update is not retried and the error is + * ignored. + * + * Otherwise, a non-recoverable error has occurred and an exception is thrown. + */ void onUpdateError(const FibUpdate& update, const FibUpdateSuccessCallback& onSuccess, @@ -174,80 +184,93 @@ NFD_PROTECTED_WITH_TESTS_ELSE_PRIVATE: const ndn::nfd::ControlResponse& response, uint32_t nTimeouts); private: - /** \brief adds the update to an update list based on its Face ID - * - * If the update has the same Face ID as the update batch, the update is added - * to m_updatesForBatchFaceId. - * - * Otherwise, the update is added to m_updatesForBatchNonFaceId. - */ + /** + * \brief Adds the update to an update list based on its Face ID. + * + * If the update has the same Face ID as the update batch, the update is added + * to m_updatesForBatchFaceId. + * + * Otherwise, the update is added to m_updatesForBatchNonFaceId. + */ void addFibUpdate(const FibUpdate& update); - /** \brief creates records of the passed routes added to the entry and creates FIB updates - */ + /** + * \brief Creates records of the passed routes added to the entry and creates FIB updates. + */ void addInheritedRoutes(const RibEntry& entry, const Rib::RouteSet& routesToAdd); - /** \brief creates records of the passed routes added to the name and creates FIB updates. - * Routes in routesToAdd with the same Face ID as ignore will be not be considered. - */ + /** + * \brief Creates records of the passed routes added to the name and creates FIB updates. + * Routes in \p routesToAdd with the same Face ID as ignore will be not be considered. + */ void addInheritedRoutes(const Name& name, const Rib::RouteSet& routesToAdd, const Route& ignore); - /** \brief creates records of the passed routes removed from the entry and creates FIB updates - */ + /** + * \brief Creates records of the passed routes removed from the entry and creates FIB updates. + */ void removeInheritedRoutes(const RibEntry& entry, const Rib::RouteSet& routesToRemove); - /** \brief calculates updates for a name that will create a new RIB entry - */ + /** + * \brief Calculates updates for a name that will create a new RIB entry. + */ void createFibUpdatesForNewRibEntry(const Name& name, const Route& route, const Rib::RibEntryList& children); - /** \brief calculates updates for a new route added to a RIB entry - */ + /** + * \brief Calculates updates for a new route added to a RIB entry. + */ void createFibUpdatesForNewRoute(const RibEntry& entry, const Route& route, - const bool captureWasTurnedOn); + bool captureWasTurnedOn); - /** \brief calculates updates for changes to an existing route for a RIB entry - */ + /** + * \brief Calculates updates for changes to an existing route for a RIB entry. + */ void createFibUpdatesForUpdatedRoute(const RibEntry& entry, const Route& route, const Route& existingRoute); - /** \brief calculates updates for a an existing route removed from a RIB entry - */ + /** + * \brief Calculates updates for a an existing route removed from a RIB entry. + */ void createFibUpdatesForErasedRoute(const RibEntry& entry, const Route& route, - const bool captureWasTurnedOff); + bool captureWasTurnedOff); - /** \brief calculates updates for an entry that will be removed from the RIB - */ + /** + * \brief Calculates updates for an entry that will be removed from the RIB. + */ void createFibUpdatesForErasedRibEntry(const RibEntry& entry); - /** \brief adds and removes passed routes to children's inherited routes - */ + /** + * \brief Adds and removes passed routes to children's inherited routes. + */ void modifyChildrensInheritedRoutes(const Rib::RibEntryList& children, const Rib::RouteSet& routesToAdd, const Rib::RouteSet& routesToRemove); - /** \brief traverses the entry's children adding and removing the passed routes - */ + /** + * \brief Traverses the entry's children adding and removing the passed routes. + */ void traverseSubTree(const RibEntry& entry, Rib::RouteSet routesToAdd, Rib::RouteSet routesToRemove); - /** \brief creates a record of a calculated inherited route that should be added to the entry - */ + /** + * \brief Creates a record of a calculated inherited route that should be added to the entry. + */ void addInheritedRoute(const Name& name, const Route& route); - /** \brief creates a record of an existing inherited route that should be removed from the entry - */ + /** + * \brief Creates a record of an existing inherited route that should be removed from the entry. + */ void removeInheritedRoute(const Name& name, const Route& route); @@ -260,8 +283,9 @@ NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: FibUpdateList m_updatesForBatchFaceId; FibUpdateList m_updatesForNonBatchFaceId; - /** \brief list of inherited routes generated during FIB update calculation; - * passed to the RIB when updates are completed successfully + /** + * \brief List of inherited routes generated during FIB update calculation; + * passed to the RIB when updates are completed successfully. */ RibUpdateList m_inheritedRoutes; }; diff --git a/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.hpp b/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.hpp index be765970..963c9c1c 100644 --- a/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.hpp +++ b/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.hpp @@ -30,12 +30,12 @@ namespace nfd::rib { -/** \brief a policy to readvertise routes registered by end hosts into NLSR +/** \brief A policy to readvertise routes registered by end hosts into NLSR. */ class ClientToNlsrReadvertisePolicy : public ReadvertisePolicy { public: - /** \brief advertise if the route's origin is client + /** \brief Advertise if the route's origin is client. * * If the route origin is "client" (typically from auto prefix propagation), readvertise it * using the default signing identity. diff --git a/daemon/rib/readvertise/host-to-gateway-readvertise-policy.hpp b/daemon/rib/readvertise/host-to-gateway-readvertise-policy.hpp index 63b4fc86..44506e5d 100644 --- a/daemon/rib/readvertise/host-to-gateway-readvertise-policy.hpp +++ b/daemon/rib/readvertise/host-to-gateway-readvertise-policy.hpp @@ -33,7 +33,7 @@ namespace nfd::rib { -/** \brief a policy to readvertise routes registered by local applications into remote gateway +/** \brief A policy to readvertise routes registered by local applications into remote gateway. */ class HostToGatewayReadvertisePolicy : public ReadvertisePolicy { diff --git a/daemon/rib/readvertise/nfd-rib-readvertise-destination.hpp b/daemon/rib/readvertise/nfd-rib-readvertise-destination.hpp index ab2f7106..5ed5f526 100644 --- a/daemon/rib/readvertise/nfd-rib-readvertise-destination.hpp +++ b/daemon/rib/readvertise/nfd-rib-readvertise-destination.hpp @@ -35,7 +35,7 @@ namespace nfd::rib { -/** \brief a readvertise destination using NFD RIB management protocol +/** \brief A readvertise destination using NFD RIB management protocol. */ class NfdRibReadvertiseDestination : public ReadvertiseDestination { @@ -46,14 +46,14 @@ public: const ndn::nfd::ControlParameters& parameters = ndn::nfd::ControlParameters().setOrigin(ndn::nfd::ROUTE_ORIGIN_CLIENT)); - /** \brief add a name prefix into NFD RIB + /** \brief Add a name prefix into NFD RIB. */ void advertise(const ReadvertisedRoute& rr, std::function successCb, std::function failureCb) override; - /** \brief remove a name prefix from NFD RIB + /** \brief Remove a name prefix from NFD RIB. */ void withdraw(const ReadvertisedRoute& rr, diff --git a/daemon/rib/readvertise/readvertise-destination.hpp b/daemon/rib/readvertise/readvertise-destination.hpp index 045483a2..95726bd2 100644 --- a/daemon/rib/readvertise/readvertise-destination.hpp +++ b/daemon/rib/readvertise/readvertise-destination.hpp @@ -30,7 +30,7 @@ namespace nfd::rib { -/** \brief a destination to readvertise into +/** \brief A destination to readvertise into. */ class ReadvertiseDestination : noncopyable { @@ -59,7 +59,7 @@ protected: setAvailability(bool isAvailable); public: - /** \brief signals when the destination becomes available or unavailable + /** \brief Signals when the destination becomes available or unavailable. */ signal::Signal afterAvailabilityChange; diff --git a/daemon/rib/readvertise/readvertise-policy.hpp b/daemon/rib/readvertise/readvertise-policy.hpp index 3e4456e4..94d178f6 100644 --- a/daemon/rib/readvertise/readvertise-policy.hpp +++ b/daemon/rib/readvertise/readvertise-policy.hpp @@ -32,7 +32,7 @@ namespace nfd::rib { -/** \brief a decision made by readvertise policy +/** \brief A decision made by readvertise policy. */ struct ReadvertiseAction { @@ -40,7 +40,7 @@ struct ReadvertiseAction ndn::security::SigningInfo signer; ///< credentials for command signing }; -/** \brief a policy to decide whether to readvertise a route, and what prefix to readvertise +/** \brief A policy to decide whether to readvertise a route, and what prefix to readvertise. */ class ReadvertisePolicy : noncopyable { @@ -48,7 +48,7 @@ public: virtual ~ReadvertisePolicy() = default; - /** \brief decide whether to readvertise a route, and what prefix to readvertise + /** \brief Decide whether to readvertise a route, and what prefix to readvertise. */ virtual std::optional handleNewRoute(const RibRouteRef& ribRoute) const = 0; diff --git a/daemon/rib/readvertise/readvertise.hpp b/daemon/rib/readvertise/readvertise.hpp index 88b11aaa..19274c93 100644 --- a/daemon/rib/readvertise/readvertise.hpp +++ b/daemon/rib/readvertise/readvertise.hpp @@ -33,7 +33,7 @@ namespace nfd::rib { -/** \brief readvertise a subset of routes to a destination according to a policy +/** \brief Readvertise a subset of routes to a destination according to a policy. * * The Readvertise class allows RIB routes to be readvertised to a destination such as a routing * protocol daemon or another NFD-RIB. It monitors the RIB for route additions and removals, @@ -72,7 +72,7 @@ private: ReadvertisedRouteContainer m_rrs; /** - * \brief maps from RIB route to readvertised route derived from RIB route(s) + * \brief Map from RIB route to readvertised route derived from RIB route(s). */ std::map m_routeToRr; diff --git a/daemon/rib/readvertise/readvertised-route.hpp b/daemon/rib/readvertise/readvertised-route.hpp index e4be12c2..a57fe703 100644 --- a/daemon/rib/readvertise/readvertised-route.hpp +++ b/daemon/rib/readvertise/readvertised-route.hpp @@ -33,7 +33,7 @@ namespace nfd::rib { -/** \brief state of a readvertised route +/** \brief State of a readvertised route. */ class ReadvertisedRoute : noncopyable { diff --git a/daemon/rib/rib-entry.hpp b/daemon/rib/rib-entry.hpp index d98d72a7..6fbd198c 100644 --- a/daemon/rib/rib-entry.hpp +++ b/daemon/rib/rib-entry.hpp @@ -66,10 +66,12 @@ public: bool hasChildren() const; - /** \brief inserts a new route into the entry's route list + /** \brief Inserts a new route into the entry's route list. + * * If another route already exists with the same faceId and origin, * the new route is not inserted. - * \return a pair, whose first element is the iterator to the newly + * + * \return A pair, whose first element is the iterator to the newly * inserted element if the insert succeeds and to the * previously-existing element otherwise, and whose second element * is true if the insert succeeds and false otherwise. @@ -77,13 +79,15 @@ public: std::pair insertRoute(const Route& route); - /** \brief erases a Route with the same faceId and origin + /** + * \brief Erases a Route with the same FaceId and origin. */ void eraseRoute(const Route& route); - /** \brief erases a Route with the passed iterator - * \return{ an iterator to the element that followed the erased iterator } + /** + * \brief Erases a Route with the passed iterator. + * \return An iterator to the element that followed the erased iterator */ iterator eraseRoute(RouteList::iterator route); @@ -112,23 +116,25 @@ public: void removeInheritedRoute(const Route& route); - /** \brief Returns the routes this namespace has inherited. - * The inherited routes returned represent inherited routes this namespace has in the FIB. - * \return{ routes inherited by this namespace } + /** + * \brief Returns the routes this namespace has inherited. + * + * The inherited routes returned represent inherited routes this namespace has in the FIB. */ const RouteList& getInheritedRoutes() const; - /** \brief Finds an inherited route with a matching face ID. - * \return{ An iterator to the matching route if one is found; - * otherwise, an iterator to the end of the entry's - * inherited route list } + /** + * \brief Finds an inherited route with a matching face ID. + * \return An iterator to the matching route if one is found; + * otherwise, an iterator to the end of the entry's + * inherited route list */ RouteList::const_iterator findInheritedRoute(const Route& route) const; /** \brief Determines if the entry has an inherited route with a matching face ID. - * \return{ True, if a matching inherited route is found; otherwise, false. } + * \return True, if a matching inherited route is found; otherwise, false. */ bool hasInheritedRoute(const Route& route) const; @@ -138,13 +144,13 @@ public: /** \brief Determines if the entry has an inherited route with the passed * face ID and its child inherit flag set. - * \return{ True, if a matching inherited route is found; otherwise, false. } + * \return True, if a matching inherited route is found; otherwise, false. */ bool hasChildInheritOnFaceId(uint64_t faceId) const; /** \brief Returns the route with the lowest cost that has the passed face ID. - * \return{ The route with the lowest cost that has the passed face ID} + * \return The route with the lowest cost that has the passed face ID */ const Route* getRouteWithLowestCostByFaceId(uint64_t faceId) const; @@ -154,8 +160,6 @@ public: /** \brief Returns the route with the lowest cost that has the passed face ID * and its child inherit flag set. - * \return{ The route with the lowest cost that has the passed face ID - * and its child inherit flag set } */ const Route* getRouteWithLowestCostAndChildInheritByFaceId(uint64_t faceId) const; @@ -170,7 +174,7 @@ public: * confined within [\p minExpiration, \p maxExpiration] range. The caller is expected to sign * this announcement. * - * \warning (minExpiration > maxExpiration) triggers undefined behavior. + * \warning `minExpiration > maxExpiration` triggers undefined behavior. */ ndn::PrefixAnnouncement getPrefixAnnouncement(time::milliseconds minExpiration = 15_s, diff --git a/daemon/rib/rib.hpp b/daemon/rib/rib.hpp index 36d5e412..ddfa5919 100644 --- a/daemon/rib/rib.hpp +++ b/daemon/rib/rib.hpp @@ -37,7 +37,7 @@ using ndn::nfd::ControlParameters; class FibUpdater; -/** \brief references a route +/** \brief References a route. */ struct RibRouteRef { @@ -48,12 +48,15 @@ struct RibRouteRef bool operator<(const RibRouteRef& lhs, const RibRouteRef& rhs); -/** \brief represents the Routing Information Base - - The Routing Information Base contains a collection of Routes, each - represents a piece of static or dynamic routing information - registered by applications, operators, or NFD itself. Routes - associated with the same namespace are collected into a RIB entry. +/** + * \brief Represents the Routing Information Base. + * + * The Routing Information Base (RIB) contains a collection of Route objects, + * each representing a piece of static or dynamic routing information registered + * by applications, operators, or NFD itself. Routes associated with the same + * namespace are collected into a RIB entry. + * + * \sa RibEntry */ class Rib : noncopyable { @@ -87,13 +90,13 @@ public: } size_t - size() const + size() const noexcept { return m_nItems; } - bool - empty() const + [[nodiscard]] bool + empty() const noexcept { return m_rib.empty(); } @@ -105,7 +108,7 @@ public: using UpdateSuccessCallback = std::function; using UpdateFailureCallback = std::function; - /** \brief passes the provided RibUpdateBatch to FibUpdater to calculate and send FibUpdates. + /** \brief Passes the provided RibUpdateBatch to FibUpdater to calculate and send FibUpdates. * * If the FIB is updated successfully, onFibUpdateSuccess() will be called, and the * RIB will be updated @@ -118,7 +121,7 @@ public: const UpdateSuccessCallback& onSuccess, const UpdateFailureCallback& onFailure); - /** \brief starts the FIB update process when a face has been destroyed + /** \brief Starts the FIB update process when a face has been destroyed. */ void beginRemoveFace(uint64_t faceId); @@ -167,13 +170,13 @@ private: using RouteComparePredicate = bool (*)(const Route&, const Route&); using RouteSet = std::set; - /** \brief find entries under \p prefix + /** \brief Find entries under \p prefix. * \pre a RIB entry exists at \p prefix */ std::list> findDescendants(const Name& prefix) const; - /** \brief find entries under \p prefix + /** \brief Find entries under \p prefix. * \pre a RIB entry does not exist at \p prefix */ std::list> @@ -185,54 +188,52 @@ private: void updateRib(const RibUpdateBatch& batch); - /** \brief returns routes inherited from the entry's ancestors - * - * \return{ a list of inherited routes } + /** \brief Returns routes inherited from the entry's ancestors. + * \return a list of inherited routes */ RouteSet getAncestorRoutes(const RibEntry& entry) const; - /** \brief returns routes inherited from the parent of the name and the parent's ancestors - * + /** \brief Returns routes inherited from the parent of the name and the parent's ancestors. * \note A parent is first found for the passed name before inherited routes are collected - * - * \return{ a list of inherited routes } + * \return a list of inherited routes */ RouteSet getAncestorRoutes(const Name& name) const; - /** \brief applies the passed inheritedRoutes and their actions to the corresponding RibEntries' - * inheritedRoutes lists + /** \brief Applies the passed \p inheritedRoutes and their actions to the corresponding + * RibEntries' inheritedRoutes lists. */ void modifyInheritedRoutes(const RibUpdateList& inheritedRoutes); public: - /** \brief signals after a RIB entry is inserted + /** \brief Signals after a RIB entry is inserted. * * A RIB entry is inserted when the first route associated with a * certain namespace is added. */ signal::Signal afterInsertEntry; - /** \brief signals after a RIB entry is erased + /** \brief Signals after a RIB entry is erased. * * A RIB entry is erased when the last route associated with a * certain namespace is removed. */ signal::Signal afterEraseEntry; - /** \brief signals after a Route is added + /** \brief Signals after a Route is added. */ signal::Signal afterAddRoute; - /** \brief signals before a route is removed + /** \brief Signals before a route is removed. */ signal::Signal beforeRemoveRoute; private: RibTable m_rib; - std::multimap> m_faceEntries; ///< FaceId => Entry with Route on this face + // FaceId => Entry with Route on this face + std::multimap> m_faceEntries; size_t m_nItems = 0; FibUpdater* m_fibUpdater = nullptr; diff --git a/daemon/rib/route.hpp b/daemon/rib/route.hpp index eea42ee5..471bdb63 100644 --- a/daemon/rib/route.hpp +++ b/daemon/rib/route.hpp @@ -37,16 +37,16 @@ namespace nfd::rib { -/** \brief represents a route for a name prefix +/** \brief Represents a route for a name prefix. */ class Route : public ndn::nfd::RouteFlagsTraits { public: - /** \brief default constructor + /** \brief Default constructor. */ Route() = default; - /** \brief construct from a prefix announcement + /** \brief Construct from a prefix announcement. * \param ann a prefix announcement that has passed verification * \param faceId the face on which \p ann arrived */ diff --git a/daemon/rib/service.hpp b/daemon/rib/service.hpp index 02e1914e..3cedde41 100644 --- a/daemon/rib/service.hpp +++ b/daemon/rib/service.hpp @@ -43,7 +43,7 @@ namespace nfd::rib { class Readvertise; /** - * \brief initializes and executes NFD-RIB service thread + * \brief Initializes and executes the NFD-RIB service thread. * * Only one instance of this class can be created at any time. * After initialization, NFD-RIB instance can be started by running the global io_service. @@ -52,7 +52,7 @@ class Service : noncopyable { public: /** - * \brief create NFD-RIB service + * \brief Create NFD-RIB service. * \param configFile absolute or relative path of configuration file * \param keyChain the KeyChain * \throw std::logic_error Instance of rib::Service has been already constructed @@ -61,7 +61,7 @@ public: Service(const std::string& configFile, ndn::KeyChain& keyChain); /** - * \brief create NFD-RIB service + * \brief Create NFD-RIB service. * \param configSection parsed configuration section * \param keyChain the KeyChain * \note This constructor overload is more appropriate for integrated environments, @@ -72,13 +72,10 @@ public: */ Service(const ConfigSection& configSection, ndn::KeyChain& keyChain); - /** - * \brief Destructor - */ ~Service(); /** - * \brief Get a reference to the only instance of this class + * \brief Get a reference to the only instance of this class. * \throw std::logic_error No instance has been constructed * \throw std::logic_error This function is invoked on a thread other than the RIB thread */ @@ -86,7 +83,7 @@ public: get(); RibManager& - getRibManager() + getRibManager() noexcept { return m_ribManager; } diff --git a/daemon/table/cleanup.hpp b/daemon/table/cleanup.hpp index 3c84482e..b1e95b10 100644 --- a/daemon/table/cleanup.hpp +++ b/daemon/table/cleanup.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-2022, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -32,10 +32,10 @@ namespace nfd { -/** \brief cleanup tables when a face is destroyed +/** \brief Cleanup tables when a face is destroyed. * - * This function enumerates the NameTree, calls Fib::removeNextHop for each FIB entry, - * calls Pit::deleteInOutRecords for each PIT entry, and finally + * This function enumerates the NameTree, calls Fib::removeNextHop() for each FIB entry, + * calls Pit::deleteInOutRecords() for each PIT entry, and finally * deletes any name tree entries that have become empty. * * \note It's a design choice to let Fib and Pit classes decide what to do with each entry. diff --git a/daemon/table/cs-entry.hpp b/daemon/table/cs-entry.hpp index a04f9f7d..89f71f13 100644 --- a/daemon/table/cs-entry.hpp +++ b/daemon/table/cs-entry.hpp @@ -30,12 +30,12 @@ namespace nfd::cs { -/** \brief a ContentStore entry +/** \brief A ContentStore entry. */ class Entry { public: // exposed through ContentStore enumeration - /** \brief return the stored Data + /** \brief Return the stored Data. */ const Data& getData() const @@ -43,7 +43,7 @@ public: // exposed through ContentStore enumeration return *m_data; } - /** \brief return stored Data name + /** \brief Return stored Data name. */ const Name& getName() const @@ -51,7 +51,7 @@ public: // exposed through ContentStore enumeration return m_data->getName(); } - /** \brief return full name (including implicit digest) of the stored Data + /** \brief Return full name (including implicit digest) of the stored Data. */ const Name& getFullName() const @@ -59,7 +59,7 @@ public: // exposed through ContentStore enumeration return m_data->getFullName(); } - /** \brief return whether the stored Data is unsolicited + /** \brief Return whether the stored Data is unsolicited. */ bool isUnsolicited() const @@ -67,12 +67,12 @@ public: // exposed through ContentStore enumeration return m_isUnsolicited; } - /** \brief check if the stored Data is fresh now + /** \brief Check if the stored Data is fresh now. */ bool isFresh() const; - /** \brief determine whether Interest can be satisified by the stored Data + /** \brief Determine whether Interest can be satisified by the stored Data. */ bool canSatisfy(const Interest& interest) const; @@ -80,12 +80,12 @@ public: // exposed through ContentStore enumeration public: // used by ContentStore implementation Entry(shared_ptr data, bool isUnsolicited); - /** \brief recalculate when the entry would become non-fresh, relative to current time + /** \brief Recalculate when the entry would become non-fresh, relative to current time. */ void updateFreshUntil(); - /** \brief clear 'unsolicited' flag + /** \brief Clear 'unsolicited' flag. */ void clearUnsolicited() @@ -96,7 +96,7 @@ public: // used by ContentStore implementation private: shared_ptr m_data; bool m_isUnsolicited; - time::steady_clock::TimePoint m_freshUntil; + time::steady_clock::time_point m_freshUntil; }; bool @@ -108,7 +108,7 @@ operator<(const Name& queryName, const Entry& entry); bool operator<(const Entry& lhs, const Entry& rhs); -/** \brief an ordered container of ContentStore entries +/** \brief An ordered container of ContentStore entries. * * This container uses std::less<> comparator to enable lookup with queryName. */ diff --git a/daemon/table/cs-policy-lru.hpp b/daemon/table/cs-policy-lru.hpp index 8d7c8148..9a62c6ce 100644 --- a/daemon/table/cs-policy-lru.hpp +++ b/daemon/table/cs-policy-lru.hpp @@ -43,7 +43,7 @@ using Queue = boost::multi_index_container< > >; -/** \brief Least-Recently-Used (LRU) replacement policy +/** \brief Least-Recently-Used (LRU) replacement policy. */ class LruPolicy final : public Policy { @@ -70,7 +70,7 @@ private: evictEntries() final; private: - /** \brief moves an entry to the end of queue + /** \brief Moves an entry to the end of queue. */ void insertToQueue(EntryRef i, bool isNewEntry); diff --git a/daemon/table/cs-policy-priority-fifo.hpp b/daemon/table/cs-policy-priority-fifo.hpp index 48d1d66a..eaa4c81e 100644 --- a/daemon/table/cs-policy-priority-fifo.hpp +++ b/daemon/table/cs-policy-priority-fifo.hpp @@ -49,7 +49,7 @@ struct EntryInfo scheduler::EventId moveStaleEventId; }; -/** \brief Priority FIFO replacement policy +/** \brief Priority First-In-First-Out (FIFO) replacement policy. * * This policy maintains a set of cleanup queues to decide the eviction order of CS entries. * The cleanup queues are three doubly linked lists that store EntryRefs. @@ -88,25 +88,25 @@ private: evictEntries() final; private: - /** \brief evicts one entry + /** \brief Evicts one entry. * \pre CS is not empty */ void evictOne(); - /** \brief attaches the entry to an appropriate queue + /** \brief Attaches the entry to an appropriate queue. * \pre the entry is not in any queue */ void attachQueue(EntryRef i); - /** \brief detaches the entry from its current queue + /** \brief Detaches the entry from its current queue. * \post the entry is not in any queue */ void detachQueue(EntryRef i); - /** \brief moves an entry from FIFO queue to STALE queue + /** \brief Moves an entry from FIFO queue to STALE queue. */ void moveToStaleQueue(EntryRef i); diff --git a/daemon/table/cs-policy.hpp b/daemon/table/cs-policy.hpp index de4c89c4..748a45b1 100644 --- a/daemon/table/cs-policy.hpp +++ b/daemon/table/cs-policy.hpp @@ -33,7 +33,7 @@ namespace nfd::cs { class Cs; /** - * \brief Represents a CS replacement policy + * \brief Represents a CS replacement policy. */ class Policy : noncopyable { @@ -47,13 +47,15 @@ public: // registry BOOST_VERIFY(r.second); } - /** \return a cs::Policy identified by \p policyName, - * or nullptr if \p policyName is unknown + /** + * \brief Returns a cs::Policy identified by \p policyName, + * or nullptr if \p policyName is unknown. */ static unique_ptr create(const std::string& policyName); - /** \return a list of available policy names + /** + * \brief Returns a list of available policy names. */ static std::set getPolicyNames(); @@ -63,36 +65,39 @@ public: ~Policy() = default; const std::string& - getName() const + getName() const noexcept { return m_policyName; } - /** \brief gets cs + /** + * \brief Returns a pointer to the associated CS instance. */ Cs* - getCs() const + getCs() const noexcept { return m_cs; } - /** \brief sets cs + /** + * \brief Sets the associated CS instance. */ void - setCs(Cs* cs) + setCs(Cs* cs) noexcept { m_cs = cs; } - /** \brief gets hard limit (in number of entries) + /** + * \brief Gets hard limit (in number of entries). */ size_t - getLimit() const + getLimit() const noexcept { return m_limit; } - /** \brief sets hard limit (in number of entries) + /** \brief Sets hard limit (in number of entries). * \post getLimit() == nMaxEntries * \post cs.size() <= getLimit() * @@ -102,19 +107,19 @@ public: setLimit(size_t nMaxEntries); public: - /** \brief a reference to an CS entry - * \note operator< of EntryRef compares the Data name enclosed in the Entry. + /** \brief A reference to a CS entry. + * \note `operator<` of EntryRef compares the Data name enclosed in the Entry. */ using EntryRef = Table::const_iterator; - /** \brief emits when an entry is being evicted + /** \brief %Signal emitted when an entry is being evicted. * * A policy implementation should emit this signal to cause CS to erase an entry from its index. * CS should connect to this signal and erase the entry upon signal emission. */ signal::Signal beforeEvict; - /** \brief invoked by CS after a new entry is inserted + /** \brief Invoked by CS after a new entry is inserted. * \post cs.size() <= getLimit() * * The policy may evict entries if necessary. @@ -123,20 +128,20 @@ public: void afterInsert(EntryRef i); - /** \brief invoked by CS after an existing entry is refreshed by same Data + /** \brief Invoked by CS after an existing entry is refreshed by same Data. * * The policy may witness this refresh to make better eviction decisions in the future. */ void afterRefresh(EntryRef i); - /** \brief invoked by CS before an entry is erased due to management command + /** \brief Invoked by CS before an entry is erased due to management command. * \warning CS must not invoke this method if an entry is erased due to eviction. */ void beforeErase(EntryRef i); - /** \brief invoked by CS before an entry is used to match a lookup + /** \brief Invoked by CS before an entry is used to match a lookup. * * The policy may witness this usage to make better eviction decisions in the future. */ @@ -144,7 +149,7 @@ public: beforeUse(EntryRef i); protected: - /** \brief invoked after a new entry is created in CS + /** \brief Invoked after a new entry is created in CS. * * When overridden in a subclass, a policy implementation should decide whether to accept \p i. * If \p i is accepted, it should be inserted into a cleanup index. @@ -155,7 +160,7 @@ protected: virtual void doAfterInsert(EntryRef i) = 0; - /** \brief invoked after an existing entry is refreshed by same Data + /** \brief Invoked after an existing entry is refreshed by same Data. * * When overridden in a subclass, a policy implementation may witness this operation * and adjust its cleanup index. @@ -163,7 +168,7 @@ protected: virtual void doAfterRefresh(EntryRef i) = 0; - /** \brief invoked before an entry is erased due to management command + /** \brief Invoked before an entry is erased due to management command. * \note This will not be invoked for an entry being evicted by policy. * * When overridden in a subclass, a policy implementation should erase \p i @@ -172,7 +177,7 @@ protected: virtual void doBeforeErase(EntryRef i) = 0; - /** \brief invoked before an entry is used to match a lookup + /** \brief Invoked before an entry is used to match a lookup. * * When overridden in a subclass, a policy implementation may witness this operation * and adjust its cleanup index. @@ -180,7 +185,7 @@ protected: virtual void doBeforeUse(EntryRef i) = 0; - /** \brief evicts zero or more entries + /** \brief Evicts zero or more entries. * \post CS size does not exceed hard limit */ virtual void @@ -207,7 +212,7 @@ private: } // namespace nfd::cs -/** \brief registers a CS policy +/** \brief Registers a CS policy. * \param P a subclass of nfd::cs::Policy */ #define NFD_REGISTER_CS_POLICY(P) \ diff --git a/daemon/table/cs.cpp b/daemon/table/cs.cpp index 18d8fe2c..3ad8bc9b 100644 --- a/daemon/table/cs.cpp +++ b/daemon/table/cs.cpp @@ -157,7 +157,7 @@ Cs::setPolicyImpl(unique_ptr policy) } void -Cs::enableAdmit(bool shouldAdmit) +Cs::enableAdmit(bool shouldAdmit) noexcept { if (m_shouldAdmit == shouldAdmit) { return; @@ -167,7 +167,7 @@ Cs::enableAdmit(bool shouldAdmit) } void -Cs::enableServe(bool shouldServe) +Cs::enableServe(bool shouldServe) noexcept { if (m_shouldServe == shouldServe) { return; diff --git a/daemon/table/cs.hpp b/daemon/table/cs.hpp index cf91e171..a0bcbf6a 100644 --- a/daemon/table/cs.hpp +++ b/daemon/table/cs.hpp @@ -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-2022, 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 cs { -/** \brief implements the Content Store +/** \brief Implements the Content Store. * * This Content Store implementation consists of a Table and a replacement policy. * @@ -47,12 +47,12 @@ public: explicit Cs(size_t nMaxPackets = 10); - /** \brief inserts a Data packet + /** \brief Inserts a Data packet. */ void insert(const Data& data, bool isUnsolicited = false); - /** \brief asynchronously erases entries under \p prefix + /** \brief Asynchronously erases entries under \p prefix. * \tparam AfterEraseCallback `void f(size_t nErased)` * \param prefix name prefix of entries * \param limit max number of entries to erase @@ -67,7 +67,7 @@ public: cb(nErased); } - /** \brief finds the best matching Data packet + /** \brief Finds the best matching Data packet. * \tparam HitCallback `void f(const Interest&, const Data&)` * \tparam MissCallback `void f(const Interest&)` * \param interest the Interest for lookup @@ -88,7 +88,7 @@ public: hit(interest, match->getData()); } - /** \brief get number of stored packets + /** \brief Get number of stored packets. */ size_t size() const @@ -97,15 +97,15 @@ public: } public: // configuration - /** \brief get capacity (in number of packets) + /** \brief Get capacity (in number of packets). */ size_t - getLimit() const + getLimit() const noexcept { return m_policy->getLimit(); } - /** \brief change capacity (in number of packets) + /** \brief Change capacity (in number of packets). */ void setLimit(size_t nMaxPackets) @@ -113,49 +113,49 @@ public: // configuration return m_policy->setLimit(nMaxPackets); } - /** \brief get replacement policy + /** \brief Get replacement policy. */ Policy* - getPolicy() const + getPolicy() const noexcept { return m_policy.get(); } - /** \brief change replacement policy + /** \brief Change replacement policy. * \pre size() == 0 */ void setPolicy(unique_ptr policy); - /** \brief get CS_ENABLE_ADMIT flag + /** \brief Get CS_ENABLE_ADMIT flag. * \sa https://redmine.named-data.net/projects/nfd/wiki/CsMgmt#Update-config */ bool - shouldAdmit() const + shouldAdmit() const noexcept { return m_shouldAdmit; } - /** \brief set CS_ENABLE_ADMIT flag + /** \brief Set CS_ENABLE_ADMIT flag. * \sa https://redmine.named-data.net/projects/nfd/wiki/CsMgmt#Update-config */ void - enableAdmit(bool shouldAdmit); + enableAdmit(bool shouldAdmit) noexcept; - /** \brief get CS_ENABLE_SERVE flag + /** \brief Get CS_ENABLE_SERVE flag. * \sa https://redmine.named-data.net/projects/nfd/wiki/CsMgmt#Update-config */ bool - shouldServe() const + shouldServe() const noexcept { return m_shouldServe; } - /** \brief set CS_ENABLE_SERVE flag + /** \brief Set CS_ENABLE_SERVE flag. * \sa https://redmine.named-data.net/projects/nfd/wiki/CsMgmt#Update-config */ void - enableServe(bool shouldServe); + enableServe(bool shouldServe) noexcept; public: // enumeration using const_iterator = Table::const_iterator; diff --git a/daemon/table/fib-entry.hpp b/daemon/table/fib-entry.hpp index c3002087..03a2c2e3 100644 --- a/daemon/table/fib-entry.hpp +++ b/daemon/table/fib-entry.hpp @@ -82,7 +82,7 @@ public: hasNextHop(const Face& face) const; private: - /** \brief adds a NextHop record to the entry + /** \brief Adds a NextHop record to the entry. * * If a NextHop record for \p face already exists in the entry, its cost is set to \p cost. * @@ -92,7 +92,7 @@ private: std::pair addOrUpdateNextHop(Face& face, uint64_t cost); - /** \brief removes a NextHop record + /** \brief Removes a NextHop record. * * If no NextHop record for face exists, do nothing. */ @@ -104,7 +104,7 @@ private: NextHopList::iterator findNextHop(const Face& face); - /** \brief sorts the nexthop list + /** \brief Sorts the nexthop list. */ void sortNextHops(); diff --git a/daemon/table/fib.hpp b/daemon/table/fib.hpp index 6073533d..bfeedf8a 100644 --- a/daemon/table/fib.hpp +++ b/daemon/table/fib.hpp @@ -43,7 +43,9 @@ class Entry; namespace fib { -/** \brief Represents the Forwarding Information Base (FIB) +/** + * \brief Represents the Forwarding Information Base (FIB). + * \sa fib::Entry */ class Fib : noncopyable { @@ -52,32 +54,32 @@ public: Fib(NameTree& nameTree); size_t - size() const + size() const noexcept { return m_nItems; } public: // lookup - /** \brief Performs a longest prefix match + /** \brief Performs a longest prefix match. */ const Entry& findLongestPrefixMatch(const Name& prefix) const; - /** \brief Performs a longest prefix match + /** \brief Performs a longest prefix match. * * This is equivalent to `findLongestPrefixMatch(pitEntry.getName())` */ const Entry& findLongestPrefixMatch(const pit::Entry& pitEntry) const; - /** \brief Performs a longest prefix match + /** \brief Performs a longest prefix match. * * This is equivalent to `findLongestPrefixMatch(measurementsEntry.getName())` */ const Entry& findLongestPrefixMatch(const measurements::Entry& measurementsEntry) const; - /** \brief Performs an exact match lookup + /** \brief Performs an exact match lookup. */ Entry* findExactMatch(const Name& prefix); @@ -91,7 +93,7 @@ public: // mutation return NameTree::getMaxDepth(); } - /** \brief Find or insert a FIB entry + /** \brief Find or insert a FIB entry. * \param prefix FIB entry name; it must not have more than \c getMaxDepth() components. * \return the entry, and true for new entry or false for existing entry */ @@ -104,7 +106,7 @@ public: // mutation void erase(const Entry& entry); - /** \brief Add a NextHop record + /** \brief Add a NextHop record. * * If a NextHop record for \p face already exists in \p entry, its cost is set to \p cost. */ @@ -117,7 +119,7 @@ public: // mutation FIB_ENTRY_REMOVED ///< the nexthop is removed and the fib entry is removed }; - /** \brief Remove the NextHop record for \p face from \p entry + /** \brief Remove the NextHop record for \p face from \p entry. */ RemoveNextHopResult removeNextHop(Entry& entry, const Face& face); @@ -147,7 +149,7 @@ public: // enumeration } public: // signal - /** \brief signals on Fib entry nexthop creation + /** \brief Signals on Fib entry nexthop creation. */ signal::Signal afterNewNextHop; diff --git a/daemon/table/measurements-accessor.hpp b/daemon/table/measurements-accessor.hpp index 244897bd..9895bebc 100644 --- a/daemon/table/measurements-accessor.hpp +++ b/daemon/table/measurements-accessor.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-2022, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -37,10 +37,11 @@ class Strategy; namespace measurements { -/** \brief allows Strategy to access portion of Measurements table under its namespace +/** + * \brief Allows fw::Strategy to access the portion of Measurements table under its namespace. * - * All public methods have the same semantics as the same method on \p Measurements, - * but would return nullptr if the entry falls out of the strategy's authority. + * All public methods have the same semantics as the corresponding methods on Measurements, + * but will return nullptr if the entry falls out of the strategy's authority. */ class MeasurementsAccessor : noncopyable { @@ -50,46 +51,44 @@ public: ~MeasurementsAccessor(); - /** \brief find or insert a Measurements entry for \p name + /** \brief Find or insert a Measurements entry for \p name. */ Entry* get(const Name& name); - /** \brief find or insert a Measurements entry for \p fibEntry->getPrefix() + /** \brief Find or insert a Measurements entry for \p fibEntry->getPrefix(). */ Entry* get(const fib::Entry& fibEntry); - /** \brief find or insert a Measurements entry for \p pitEntry->getName() + /** \brief Find or insert a Measurements entry for \p pitEntry->getName(). */ Entry* get(const pit::Entry& pitEntry); - /** \brief find or insert a Measurements entry for child's parent + /** \brief Find or insert a Measurements entry for child's parent. */ Entry* getParent(const Entry& child); - /** \brief perform a longest prefix match for \p name + /** \brief Perform a longest prefix match for \p name. */ Entry* findLongestPrefixMatch(const Name& name, - const EntryPredicate& pred = - AnyEntry()) const; + const EntryPredicate& pred = AnyEntry()) const; - /** \brief perform a longest prefix match for \p pitEntry.getName() + /** \brief Perform a longest prefix match for \p pitEntry.getName(). */ Entry* findLongestPrefixMatch(const pit::Entry& pitEntry, - const EntryPredicate& pred = - AnyEntry()) const; + const EntryPredicate& pred = AnyEntry()) const; - /** \brief perform an exact match + /** \brief Perform an exact match. */ Entry* findExactMatch(const Name& name) const; - /** \brief extend lifetime of an entry + /** \brief Extend lifetime of an entry. * * The entry will be kept until at least now()+lifetime. */ @@ -97,7 +96,7 @@ public: extendLifetime(Entry& entry, const time::nanoseconds& lifetime); private: - /** \brief perform access control to Measurements entry + /** \brief Perform access control to Measurements entry. * \return entry if strategy has access to namespace, otherwise nullptr */ Entry* diff --git a/daemon/table/measurements-entry.hpp b/daemon/table/measurements-entry.hpp index a3983aec..84624a2d 100644 --- a/daemon/table/measurements-entry.hpp +++ b/daemon/table/measurements-entry.hpp @@ -50,14 +50,14 @@ public: } const Name& - getName() const + getName() const noexcept { return m_name; } private: Name m_name; - time::steady_clock::TimePoint m_expiry = time::steady_clock::TimePoint::min(); + time::steady_clock::time_point m_expiry = time::steady_clock::time_point::min(); scheduler::EventId m_cleanup; name_tree::Entry* m_nameTreeEntry = nullptr; diff --git a/daemon/table/measurements.hpp b/daemon/table/measurements.hpp index 342d7537..1bd0eb7e 100644 --- a/daemon/table/measurements.hpp +++ b/daemon/table/measurements.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-2022, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -41,23 +41,26 @@ class Entry; namespace measurements { -/** \brief A predicate that accepts or rejects an entry +/** + * \brief A predicate that accepts or rejects an entry. */ using EntryPredicate = std::function; -/** \brief An \c EntryPredicate that accepts any entry +/** + * \brief An #EntryPredicate that accepts any entry. */ class AnyEntry { public: - bool - operator()(const Entry&) const + constexpr bool + operator()(const Entry&) const noexcept { return true; } }; -/** \brief An \c EntryPredicate that accepts an entry if it has StrategyInfo of type T +/** + * \brief An #EntryPredicate that accepts an entry if it has StrategyInfo of type T. */ template class EntryWithStrategyInfo @@ -70,11 +73,12 @@ public: } }; -/** \brief The Measurements table +/** + * \brief The %Measurements table. * - * The Measurements table is a data structure for forwarding strategies to store per name prefix - * measurements. A strategy can access this table via \c Strategy::getMeasurements(), and then - * place any object that derive from \c StrategyInfo type onto Measurements entries. + * The %Measurements table is a data structure for forwarding strategies to store per name prefix + * measurements. A strategy can access this table via fw::Strategy::getMeasurements(), and then + * place any object that derive from StrategyInfo type onto %Measurements entries. */ class Measurements : noncopyable { @@ -82,7 +86,7 @@ public: explicit Measurements(NameTree& nameTree); - /** \brief maximum depth of a Measurements entry + /** \brief Maximum depth of a %Measurements entry. */ static constexpr size_t getMaxDepth() @@ -90,44 +94,44 @@ public: return NameTree::getMaxDepth(); } - /** \brief Find or insert an entry by name + /** \brief Find or insert an entry by name. * - * An entry name can have at most \c getMaxDepth() components. If \p name exceeds this limit, - * it is truncated to the first \c getMaxDepth() components. + * An entry name can have at most getMaxDepth() components. If \p name exceeds this limit, + * it is truncated to the first getMaxDepth() components. */ Entry& get(const Name& name); - /** \brief Equivalent to `get(fibEntry.getPrefix())` + /** \brief Equivalent to `get(fibEntry.getPrefix())`. */ Entry& get(const fib::Entry& fibEntry); - /** \brief Equivalent to `get(pitEntry.getName(), std::min(pitEntry.getName().size(), getMaxDepth()))` + /** \brief Equivalent to `get(pitEntry.getName(), std::min(pitEntry.getName().size(), getMaxDepth()))`. */ Entry& get(const pit::Entry& pitEntry); - /** \brief Find or insert a parent entry + /** \brief Find or insert a parent entry. * \retval nullptr child is the root entry * \return get(child.getName().getPrefix(-1)) */ Entry* getParent(const Entry& child); - /** \brief Perform a longest prefix match for \p name + /** \brief Perform a longest prefix match for \p name. */ Entry* findLongestPrefixMatch(const Name& name, const EntryPredicate& pred = AnyEntry()) const; - /** \brief Perform a longest prefix match for `pitEntry.getName()` + /** \brief Perform a longest prefix match for `pitEntry.getName()`. */ Entry* findLongestPrefixMatch(const pit::Entry& pitEntry, const EntryPredicate& pred = AnyEntry()) const; - /** \brief Perform an exact match + /** \brief Perform an exact match. */ Entry* findExactMatch(const Name& name) const; @@ -138,7 +142,7 @@ public: return 4_s; } - /** \brief Extend lifetime of an entry + /** \brief Extend lifetime of an entry. * * The entry will be kept until at least now()+lifetime. */ @@ -158,7 +162,7 @@ private: Entry& get(name_tree::Entry& nte); - /** \tparam K a parameter acceptable to \c NameTree::findLongestPrefixMatch + /** \tparam K a parameter acceptable to NameTree::findLongestPrefixMatch() */ template Entry* diff --git a/daemon/table/name-tree-entry.hpp b/daemon/table/name-tree-entry.hpp index 644d86bc..8923d9ca 100644 --- a/daemon/table/name-tree-entry.hpp +++ b/daemon/table/name-tree-entry.hpp @@ -35,7 +35,8 @@ namespace nfd::name_tree { class Node; -/** \brief An entry in the name tree +/** + * \brief An entry in the name tree. */ class Entry : noncopyable { @@ -43,7 +44,7 @@ public: Entry(const Name& prefix, Node* node); const Name& - getName() const + getName() const noexcept { return m_name; } @@ -52,12 +53,12 @@ public: * \retval nullptr this entry is the root entry, i.e. getName() == Name() */ Entry* - getParent() const + getParent() const noexcept { return m_parent; } - /** \brief Set parent of this entry + /** \brief Set parent of this entry. * \param entry entry of getName().getPrefix(-1) * \pre getParent() == nullptr * \post getParent() == &entry @@ -66,14 +67,15 @@ public: void setParent(Entry& entry); - /** \brief Unset parent of this entry + /** \brief Unset parent of this entry. * \post getParent() == nullptr * \post parent.getChildren() does not contain this */ void unsetParent(); - /** \brief Check whether this entry has any children + /** + * \brief Check whether this entry has any children. */ bool hasChildren() const @@ -81,10 +83,11 @@ public: return !m_children.empty(); } - /** \return children of this entry + /** + * \brief Returns the children of this entry. */ const std::vector& - getChildren() const + getChildren() const noexcept { return m_children; } @@ -176,14 +179,14 @@ private: friend Node* getNode(const Entry& entry); }; -/** \brief a functor to get a table entry from a name tree entry +/** \brief A functor to get a table entry from a name tree entry. * \tparam ENTRY type of single table entry attached to name tree entry, such as fib::Entry */ template class GetTableEntry { public: - /** \brief A function pointer to the getter on Entry class that returns ENTRY + /** \brief A function pointer to the getter on Entry class that returns ENTRY. */ using Getter = ENTRY* (Entry::*)() const; diff --git a/daemon/table/name-tree-hashtable.hpp b/daemon/table/name-tree-hashtable.hpp index de96d0a0..1328c2e7 100644 --- a/daemon/table/name-tree-hashtable.hpp +++ b/daemon/table/name-tree-hashtable.hpp @@ -32,27 +32,27 @@ namespace nfd::name_tree { class Entry; -/** \brief a single hash value +/** \brief A single hash value. */ using HashValue = size_t; -/** \brief a sequence of hash values +/** \brief A sequence of hash values. * \sa computeHashes */ using HashSequence = std::vector; -/** \brief computes hash value of \p name.getPrefix(prefixLen) +/** \brief Computes hash value of \p name.getPrefix(prefixLen). */ HashValue computeHash(const Name& name, size_t prefixLen = std::numeric_limits::max()); -/** \brief computes hash values for each prefix of \p name.getPrefix(prefixLen) +/** \brief Computes hash values for each prefix of \p name.getPrefix(prefixLen). * \return a hash sequence, where the i-th hash value equals computeHash(name, i) */ HashSequence computeHashes(const Name& name, size_t prefixLen = std::numeric_limits::max()); -/** \brief a hashtable node +/** \brief A hashtable node. * * Zero or more nodes can be added to a hashtable bucket. They are organized as * a doubly linked list through prev and next pointers. @@ -83,7 +83,7 @@ public: Node* getNode(const Entry& entry); -/** \brief invoke a function for each node in a doubly linked list +/** \brief Invoke a function for each node in a doubly linked list. * \tparam N either Node or const Node * \tparam F a functor with signature void F(N*) * \note It's safe to delete the node in the function. @@ -100,50 +100,50 @@ foreachNode(N* head, const F& func) } } -/** \brief provides options for Hashtable +/** + * \brief Provides options for Hashtable. */ -class HashtableOptions +struct HashtableOptions { -public: - /** \brief constructor + /** \brief Constructor. * \post initialSize == size * \post minSize == size */ explicit HashtableOptions(size_t size = 16); -public: - /** \brief initial number of buckets + /** \brief Initial number of buckets. */ size_t initialSize; - /** \brief minimal number of buckets + /** \brief Minimal number of buckets. */ size_t minSize; - /** \brief if hashtable has more than nBuckets*expandLoadFactor nodes, it will be expanded + /** \brief If the hashtable has more than `nBuckets*expandLoadFactor` nodes, it will be expanded. */ float expandLoadFactor = 0.5f; - /** \brief when hashtable is expanded, its new size is nBuckets*expandFactor + /** \brief When the hashtable is expanded, its new size will be `nBuckets*expandFactor`. */ float expandFactor = 2.0f; - /** \brief if hashtable has less than nBuckets*shrinkLoadFactor nodes, it will be shrunk + /** \brief If the hashtable has less than `nBuckets*shrinkLoadFactor` nodes, it will be shrunk. */ float shrinkLoadFactor = 0.1f; - /** \brief when hashtable is shrunk, its new size is max(nBuckets*shrinkFactor, minSize) + /** \brief When the hashtable is shrunk, its new size will be `max(nBuckets*shrinkFactor, minSize)`. */ float shrinkFactor = 0.5f; }; -/** \brief a hashtable for fast exact name lookup +/** + * \brief A hashtable for fast exact name lookup. * - * The Hashtable contains a number of buckets. - * Each node is placed into a bucket determined by a hash value computed from its name. - * Hash collision is resolved through a doubly linked list in each bucket. - * The number of buckets is adjusted according to how many nodes are stored. + * The Hashtable contains a number of buckets. + * Each node is placed into a bucket determined by a hash value computed from its name. + * Hash collision is resolved through a doubly linked list in each bucket. + * The number of buckets is adjusted according to how many nodes are stored. */ class Hashtable { @@ -153,7 +153,7 @@ public: explicit Hashtable(const Options& options); - /** \brief deallocates all nodes + /** \brief Deallocates all nodes. */ ~Hashtable(); @@ -191,39 +191,39 @@ public: return m_buckets[bucket]; // don't use m_bucket.at() for better performance } - /** \brief find node for name.getPrefix(prefixLen) + /** \brief Find node for name.getPrefix(prefixLen). * \pre name.size() > prefixLen */ const Node* find(const Name& name, size_t prefixLen) const; - /** \brief find node for name.getPrefix(prefixLen) + /** \brief Find node for name.getPrefix(prefixLen). * \pre name.size() > prefixLen * \pre hashes == computeHashes(name) */ const Node* find(const Name& name, size_t prefixLen, const HashSequence& hashes) const; - /** \brief find or insert node for name.getPrefix(prefixLen) + /** \brief Find or insert node for name.getPrefix(prefixLen). * \pre name.size() > prefixLen * \pre hashes == computeHashes(name) */ std::pair insert(const Name& name, size_t prefixLen, const HashSequence& hashes); - /** \brief delete node + /** \brief Delete node. * \pre node exists in this hashtable */ void erase(Node* node); private: - /** \brief attach node to bucket + /** \brief Attach node to bucket. */ void attach(size_t bucket, Node* node); - /** \brief detach node from bucket + /** \brief Detach node from bucket. */ void detach(size_t bucket, Node* node); diff --git a/daemon/table/name-tree-iterator.cpp b/daemon/table/name-tree-iterator.cpp index 001bb064..ecfe40d0 100644 --- a/daemon/table/name-tree-iterator.cpp +++ b/daemon/table/name-tree-iterator.cpp @@ -37,18 +37,11 @@ BOOST_CONCEPT_ASSERT((boost::ForwardRangeConcept)); NFD_LOG_INIT(NameTreeIterator); -Iterator::Iterator() - : m_entry(nullptr) - , m_ref(nullptr) - , m_state(0) -{ -} +Iterator::Iterator() = default; Iterator::Iterator(shared_ptr impl, const Entry* ref) : m_impl(std::move(impl)) - , m_entry(nullptr) , m_ref(ref) - , m_state(0) { m_impl->advance(*this); NFD_LOG_TRACE("initialized " << *this); diff --git a/daemon/table/name-tree-iterator.hpp b/daemon/table/name-tree-iterator.hpp index 4a76a53a..4458a3ef 100644 --- a/daemon/table/name-tree-iterator.hpp +++ b/daemon/table/name-tree-iterator.hpp @@ -34,33 +34,36 @@ namespace nfd::name_tree { class NameTree; -/** \brief a predicate to accept or reject an Entry in find operations +/** + * \brief A predicate to accept or reject an Entry in find operations. */ using EntrySelector = std::function; -/** \brief an EntrySelector that accepts every Entry +/** + * \brief An #EntrySelector that accepts every Entry. */ struct AnyEntry { - bool - operator()(const Entry&) const + constexpr bool + operator()(const Entry&) const noexcept { return true; } }; -/** \brief a predicate to accept or reject an Entry and its children +/** \brief A predicate to accept or reject an Entry and its children. * \return `.first` indicates whether entry should be accepted; * `.second` indicates whether entry's children should be visited */ using EntrySubTreeSelector = std::function(const Entry&)>; -/** \brief an EntrySubTreeSelector that accepts every Entry and its children +/** + * \brief An #EntrySubTreeSelector that accepts every Entry and its children. */ struct AnyEntrySubTree { - std::pair - operator()(const Entry&) const + constexpr std::pair + operator()(const Entry&) const noexcept { return {true, true}; } @@ -68,7 +71,8 @@ struct AnyEntrySubTree class EnumerationImpl; -/** \brief NameTree iterator +/** + * \brief NameTree iterator. */ class Iterator { @@ -113,21 +117,21 @@ public: } private: - /** \brief enumeration implementation; nullptr for end iterator + /** \brief Enumeration implementation; nullptr for end iterator. */ shared_ptr m_impl; - /** \brief current entry; nullptr for uninitialized iterator + /** \brief Current entry; nullptr for uninitialized iterator. */ - const Entry* m_entry; + const Entry* m_entry = nullptr; - /** \brief reference entry used by enumeration implementation + /** \brief Reference entry used by enumeration implementation. */ - const Entry* m_ref; + const Entry* m_ref = nullptr; - /** \brief state used by enumeration implementation + /** \brief State used by enumeration implementation. */ - int m_state; + int m_state = 0; friend std::ostream& operator<<(std::ostream&, const Iterator&); friend class FullEnumerationImpl; @@ -138,7 +142,7 @@ private: std::ostream& operator<<(std::ostream& os, const Iterator& i); -/** \brief enumeration operation implementation +/** \brief Enumeration operation implementation. */ class EnumerationImpl { @@ -157,7 +161,7 @@ protected: const Hashtable& ht; }; -/** \brief full enumeration implementation +/** \brief Full enumeration implementation. */ class FullEnumerationImpl final : public EnumerationImpl { @@ -171,7 +175,7 @@ private: EntrySelector m_pred; }; -/** \brief partial enumeration implementation +/** \brief Partial enumeration implementation. * * Iterator::m_ref should be initialized to subtree root. * Iterator::m_state LSB indicates whether to visit children of m_entry. @@ -188,7 +192,7 @@ private: EntrySubTreeSelector m_pred; }; -/** \brief partial enumeration implementation +/** \brief Partial enumeration implementation. * * Iterator::m_ref should be initialized to longest prefix matched entry. */ @@ -205,7 +209,7 @@ private: EntrySelector m_pred; }; -/** \brief a Forward Range of name tree entries +/** \brief A Forward Range of name tree entries. * * This type has .begin() and .end() methods which return Iterator. * This type is usable with range-based for. diff --git a/daemon/table/network-region-table.hpp b/daemon/table/network-region-table.hpp index 96acf871..b4ee6523 100644 --- a/daemon/table/network-region-table.hpp +++ b/daemon/table/network-region-table.hpp @@ -30,7 +30,7 @@ namespace nfd { -/** \brief stores a collection of producer region names +/** \brief Stores a collection of producer region names. * * This table is used in forwarding to process Interests with Link objects. * @@ -40,7 +40,7 @@ namespace nfd { class NetworkRegionTable : public std::set { public: - /** \brief determines whether an Interest has reached a producer region + /** \brief Determines whether an Interest has reached a producer region. * \param forwardingHint forwarding hint of an Interest * \retval true the Interest has reached a producer region * \retval false the Interest has not reached a producer region diff --git a/daemon/table/pit-entry.hpp b/daemon/table/pit-entry.hpp index bc4f1d39..f6125122 100644 --- a/daemon/table/pit-entry.hpp +++ b/daemon/table/pit-entry.hpp @@ -38,12 +38,12 @@ class Entry; namespace nfd::pit { /** - * \brief An unordered collection of in-records + * \brief An unordered collection of in-records. */ using InRecordCollection = std::list; /** - * \brief An unordered collection of out-records + * \brief An unordered collection of out-records. */ using OutRecordCollection = std::list; @@ -134,24 +134,24 @@ public: // in-record return m_inRecords.end(); } - /** \brief get the in-record for \p face + /** \brief Get the in-record for \p face. * \return an iterator to the in-record, or in_end() if it does not exist */ InRecordCollection::iterator getInRecord(const Face& face); - /** \brief insert or update an in-record + /** \brief Insert or update an in-record. * \return an iterator to the new or updated in-record */ InRecordCollection::iterator insertOrUpdateInRecord(Face& face, const Interest& interest); - /** \brief delete the in-record for \p face if it exists + /** \brief Delete the in-record for \p face if it exists. */ void deleteInRecord(const Face& face); - /** \brief delete all in-records + /** \brief Delete all in-records. */ void clearInRecords(); @@ -201,35 +201,35 @@ public: // out-record return m_outRecords.end(); } - /** \brief get the out-record for \p face + /** \brief Get the out-record for \p face. * \return an iterator to the out-record, or out_end() if it does not exist */ OutRecordCollection::iterator getOutRecord(const Face& face); - /** \brief insert or update an out-record + /** \brief Insert or update an out-record. * \return an iterator to the new or updated out-record */ OutRecordCollection::iterator insertOrUpdateOutRecord(Face& face, const Interest& interest); - /** \brief delete the out-record for \p face if it exists + /** \brief Delete the out-record for \p face if it exists. */ void deleteOutRecord(const Face& face); public: - /** \brief Expiry timer + /** \brief Expiry timer. * * This timer is used in forwarding pipelines to delete the entry */ scheduler::EventId expiryTimer; - /** \brief Indicates whether this PIT entry is satisfied + /** \brief Indicates whether this PIT entry is satisfied. */ bool isSatisfied = false; - /** \brief Data freshness period + /** \brief Data freshness period. * \note This field is meaningful only if isSatisfied is true */ time::milliseconds dataFreshnessPeriod = 0_ms; diff --git a/daemon/table/pit-face-record.hpp b/daemon/table/pit-face-record.hpp index edb07838..830316ea 100644 --- a/daemon/table/pit-face-record.hpp +++ b/daemon/table/pit-face-record.hpp @@ -31,9 +31,10 @@ namespace nfd::pit { -/** \brief Contains information about an Interest on an incoming or outgoing face - * \note This is an implementation detail to extract common functionality - * of InRecord and OutRecord +/** + * \brief Contains information about an Interest on an incoming or outgoing face. + * \note This class is an implementation detail to extract common functionality + * of InRecord and OutRecord. */ class FaceRecord : public StrategyInfoHost { @@ -45,33 +46,33 @@ public: } Face& - getFace() const + getFace() const noexcept { return m_face; } Interest::Nonce - getLastNonce() const + getLastNonce() const noexcept { return m_lastNonce; } - time::steady_clock::TimePoint - getLastRenewed() const + time::steady_clock::time_point + getLastRenewed() const noexcept { return m_lastRenewed; } - /** \brief Returns the time point at which this record expires + /** \brief Returns the time point at which this record expires. * \return getLastRenewed() + InterestLifetime */ - time::steady_clock::TimePoint - getExpiry() const + time::steady_clock::time_point + getExpiry() const noexcept { return m_expiry; } - /** \brief updates lastNonce, lastRenewed, expiry fields + /** \brief Updates lastNonce, lastRenewed, expiry fields. */ void update(const Interest& interest); @@ -79,8 +80,8 @@ public: private: Face& m_face; Interest::Nonce m_lastNonce{0, 0, 0, 0}; - time::steady_clock::TimePoint m_lastRenewed = time::steady_clock::TimePoint::min(); - time::steady_clock::TimePoint m_expiry = time::steady_clock::TimePoint::min(); + time::steady_clock::time_point m_lastRenewed = time::steady_clock::time_point::min(); + time::steady_clock::time_point m_expiry = time::steady_clock::time_point::min(); }; } // namespace nfd::pit diff --git a/daemon/table/pit-in-record.hpp b/daemon/table/pit-in-record.hpp index c61f61d4..95dc7107 100644 --- a/daemon/table/pit-in-record.hpp +++ b/daemon/table/pit-in-record.hpp @@ -30,7 +30,8 @@ namespace nfd::pit { -/** \brief Contains information about an Interest from an incoming face +/** + * \brief Contains information about an Interest from an incoming face. */ class InRecord : public FaceRecord { @@ -38,7 +39,7 @@ public: using FaceRecord::FaceRecord; const Interest& - getInterest() const + getInterest() const noexcept { BOOST_ASSERT(m_interest != nullptr); return *m_interest; diff --git a/daemon/table/pit-iterator.hpp b/daemon/table/pit-iterator.hpp index 014ddc19..2138b770 100644 --- a/daemon/table/pit-iterator.hpp +++ b/daemon/table/pit-iterator.hpp @@ -31,7 +31,8 @@ namespace nfd::pit { -/** \brief PIT iterator +/** + * \brief PIT iterator. */ class Iterator { @@ -42,7 +43,7 @@ public: using pointer = value_type*; using reference = value_type&; - /** \brief constructor + /** \brief Constructor. * \param ntIt a name tree iterator that visits name tree entries with one or more PIT entries * \param iPitEntry make this iterator to dereference to the i-th PIT entry in name tree entry */ diff --git a/daemon/table/pit-out-record.hpp b/daemon/table/pit-out-record.hpp index aeb75235..f1653706 100644 --- a/daemon/table/pit-out-record.hpp +++ b/daemon/table/pit-out-record.hpp @@ -30,42 +30,43 @@ namespace nfd::pit { -/** \brief Contains information about an Interest toward an outgoing face +/** + * \brief Contains information about an Interest toward an outgoing face. */ class OutRecord : public FaceRecord { public: using FaceRecord::FaceRecord; - /** \return last NACK returned by \p getFace() + /** \brief Returns the last NACK returned by getFace(). * * A nullptr return value means the Interest is still pending or has timed out. * A non-null return value means the last outgoing Interest has been NACKed. */ const lp::NackHeader* - getIncomingNack() const + getIncomingNack() const noexcept { return m_incomingNack.get(); } - /** \brief sets a NACK received from \p getFace() + /** \brief Sets a NACK received from getFace(). * \return whether incoming NACK is accepted * * This is invoked in incoming NACK pipeline. - * An incoming NACK is accepted if its Nonce matches \p getLastNonce(). - * If accepted, \p nack.getHeader() will be copied, - * and any pointer previously returned by \p .getIncomingNack() . + * An incoming NACK is accepted if its Nonce matches getLastNonce(). + * If accepted, `nack.getHeader()` will be copied, + * and any pointer previously returned by getIncomingNack(). */ bool setIncomingNack(const lp::Nack& nack); - /** \brief clears last NACK + /** \brief Clears last NACK. * * This is invoked in outgoing Interest pipeline. - * This invalidates any pointer previously returned by \p .getIncomingNack() . + * This invalidates any pointer previously returned by getIncomingNack(). */ void - clearIncomingNack() + clearIncomingNack() noexcept { m_incomingNack.reset(); } diff --git a/tests/daemon/face/dummy-face.hpp b/tests/daemon/face/dummy-face.hpp index 15ab4454..bdca1292 100644 --- a/tests/daemon/face/dummy-face.hpp +++ b/tests/daemon/face/dummy-face.hpp @@ -51,23 +51,23 @@ public: ndn::nfd::FacePersistency persistency = ndn::nfd::FACE_PERSISTENCY_PERSISTENT, ndn::nfd::LinkType linkType = ndn::nfd::LINK_TYPE_POINT_TO_POINT); - /** \brief changes face state + /** \brief Changes face state. * \throw std::runtime_error state transition is invalid */ void setState(face::FaceState state); - /** \brief causes the face to receive an Interest + /** \brief Causes the face to receive an Interest. */ void receiveInterest(const Interest& interest, const EndpointId& endpointId = {}); - /** \brief causes the face to receive a Data + /** \brief Causes the face to receive a Data. */ void receiveData(const Data& data, const EndpointId& endpointId = {}); - /** \brief causes the face to receive a Nack + /** \brief Causes the face to receive a Nack. */ void receiveNack(const lp::Nack& nack, const EndpointId& endpointId = {}); diff --git a/tests/daemon/face/ethernet-fixture.hpp b/tests/daemon/face/ethernet-fixture.hpp index 915b2c04..dfd5615e 100644 --- a/tests/daemon/face/ethernet-fixture.hpp +++ b/tests/daemon/face/ethernet-fixture.hpp @@ -63,7 +63,7 @@ protected: } } - /** \brief returns the first running interface + /** \brief Returns the first running interface. */ shared_ptr getRunningNetif() const @@ -77,7 +77,7 @@ protected: return nullptr; } - /** \brief create a UnicastEthernetTransport + /** \brief Create a UnicastEthernetTransport. */ void initializeUnicast(shared_ptr netif = nullptr, @@ -93,7 +93,7 @@ protected: transport = make_unique(*netif, remoteEp, persistency, 2_s); } - /** \brief create a MulticastEthernetTransport + /** \brief Create a MulticastEthernetTransport. */ void initializeMulticast(shared_ptr netif = nullptr, @@ -112,7 +112,7 @@ protected: protected: LimitedIo limitedIo; - /** \brief EthernetTransport-capable network interfaces + /** \brief EthernetTransport-capable network interfaces. */ std::vector> netifs; diff --git a/tests/daemon/face/face-system-fixture.hpp b/tests/daemon/face/face-system-fixture.hpp index 1891a970..1b946466 100644 --- a/tests/daemon/face/face-system-fixture.hpp +++ b/tests/daemon/face/face-system-fixture.hpp @@ -50,7 +50,7 @@ public: faceSystem.setConfigFile(configFile); } - /** \brief Copy a snapshot of NetworkInterface information to \p netmon + /** \brief Copy a snapshot of NetworkInterface information to \p netmon. * \pre netmon contains no NetworkInterface */ void @@ -81,7 +81,7 @@ public: configFile.parse(text, isDryRun, "test-config"); } - /** \brief get ProtocolFactory from FaceSystem + /** \brief Get ProtocolFactory from FaceSystem. * \tparam F ProtocolFactory subclass * * If ProtocolFactory with \p scheme does not exist or has an incompatible type, @@ -96,7 +96,7 @@ public: return *factory; } - /** \brief get ProtocolFactory from FaceSystem + /** \brief Get ProtocolFactory from FaceSystem. * \tparam F ProtocolFactory subclass * * If ProtocolFactory with \p scheme does not exist or has an incompatible type, @@ -111,7 +111,7 @@ public: return *factory; } - /** \brief list faces of specified scheme from FaceTable + /** \brief List faces of specified scheme from FaceTable. * \param scheme local or remote FaceUri scheme * \param linkType if not NONE, filter by specified LinkType */ @@ -140,7 +140,7 @@ protected: }; /** - * \brief FaceSystemFixture with a ProtocolFactory reference + * \brief FaceSystemFixture with a ProtocolFactory reference. */ template class FaceSystemFactoryFixture : public FaceSystemFixture diff --git a/tests/daemon/face/lp-reliability.t.cpp b/tests/daemon/face/lp-reliability.t.cpp index 81c28e03..76a92db9 100644 --- a/tests/daemon/face/lp-reliability.t.cpp +++ b/tests/daemon/face/lp-reliability.t.cpp @@ -116,7 +116,7 @@ public: [txSeq] (auto fragIt) { return fragIt->first == txSeq; }); } - /** \brief make an LpPacket with fragment of specified size + /** \brief Make an LpPacket with fragment of specified size. * \param pktNum packet identifier, which can be extracted with \p getPktNum * \param payloadSize total payload size; must be >= 4 and <= 255 */ @@ -131,7 +131,7 @@ public: return pkt; } - /** \brief extract packet identifier from LpPacket made with \p makeFrag + /** \brief Extract packet identifier from LpPacket made with \p makeFrag. * \retval 0 packet identifier cannot be extracted */ static uint32_t diff --git a/tests/daemon/face/transport.t.cpp b/tests/daemon/face/transport.t.cpp index 9545b835..e3e427c2 100644 --- a/tests/daemon/face/transport.t.cpp +++ b/tests/daemon/face/transport.t.cpp @@ -68,13 +68,13 @@ BOOST_AUTO_TEST_CASE(PersistencyChange) BOOST_CHECK_EQUAL(transport->persistencyHistory.back(), ndn::nfd::FACE_PERSISTENCY_PERSISTENT); } -/** \brief a macro to declare a TransportState as a integral constant +/** \brief A macro to declare a TransportState as a integral constant. * \note we cannot use mpl::integral_c because TransportState is not an integral type */ #define TRANSPORT_STATE_C(X) mpl::int_(TransportState::X)> -/** \brief a map from every TransportState to a valid state transition sequence - * for entering this state from UP +/** \brief A map from every TransportState to a valid state transition sequence + * for entering this state from UP. */ typedef mpl::map< mpl::pair> > StateEntering; -/** \brief a sequence of all valid TransportStates +/** \brief A sequence of all valid TransportStates. */ typedef mpl::fold, mpl::push_back> >::type States; -/** \brief a set of all valid state transitions +/** \brief A set of all valid state transitions. */ typedef mpl::set< mpl::pair, @@ -118,8 +118,8 @@ typedef mpl::set< mpl::pair > ValidStateTransitions; -/** \brief a metafunction to generate a sequence of all state transitions - * from a specified state +/** \brief A metafunction to generate a sequence of all state transitions + * from a specified state. */ template struct StateTransitionsFrom : mpl::fold< @@ -129,7 +129,7 @@ struct StateTransitionsFrom : mpl::fold< { }; -/** \brief a sequence of all state transitions +/** \brief A sequence of all state transitions. */ typedef mpl::fold< States, diff --git a/tests/daemon/face/udp-factory.t.cpp b/tests/daemon/face/udp-factory.t.cpp index 41a5dfd6..259dbb35 100644 --- a/tests/daemon/face/udp-factory.t.cpp +++ b/tests/daemon/face/udp-factory.t.cpp @@ -88,7 +88,7 @@ protected: } } - /** \brief returns a non-loopback IP address suitable for the creation of a UDP multicast face + /** \brief Returns a non-loopback IP address suitable for the creation of a UDP multicast face. */ boost::asio::ip::address findNonLoopbackAddressForMulticastFace(ndn::net::AddressFamily af) const @@ -115,7 +115,7 @@ protected: return this->listFacesByScheme("udp6", linkType); } - /** \brief determine whether \p netif has at least one IP address of the given family + /** \brief Determine whether \p netif has at least one IP address of the given family. */ static bool hasAddressFamily(const NetworkInterface& netif, ndn::net::AddressFamily af) @@ -124,7 +124,7 @@ protected: [af] (const auto& a) { return a.getFamily() == af; }); } - /** \brief determine whether a UDP multicast face is created on \p netif + /** \brief Determine whether a UDP multicast face is created on \p netif. */ static bool isFaceOnNetif(const Face& face, const NetworkInterface& netif) @@ -135,17 +135,17 @@ protected: } protected: - /** \brief MulticastUdpTransport-capable network interfaces (IPv4 + IPv6) + /** \brief MulticastUdpTransport-capable network interfaces (IPv4 + IPv6). * * This should be used in test cases that do not depend on a specific address family */ std::vector> netifs; - /** \brief MulticastUdpTransport-capable network interfaces (IPv4 only) + /** \brief MulticastUdpTransport-capable network interfaces (IPv4 only). */ std::vector> netifsV4; - /** \brief MulticastUdpTransport-capable network interfaces (IPv6 only) + /** \brief MulticastUdpTransport-capable network interfaces (IPv6 only). */ std::vector> netifsV6; }; diff --git a/tests/daemon/face/websocket-transport-fixture.hpp b/tests/daemon/face/websocket-transport-fixture.hpp index eed49238..c6f25da7 100644 --- a/tests/daemon/face/websocket-transport-fixture.hpp +++ b/tests/daemon/face/websocket-transport-fixture.hpp @@ -39,12 +39,12 @@ namespace nfd::tests { namespace ip = boost::asio::ip; using face::WebSocketTransport; -/** \brief a fixture that accepts a single WebSocket connection from a client +/** \brief A fixture that accepts a single WebSocket connection from a client. */ class WebSocketTransportFixture : public GlobalIoFixture { protected: - /** \brief initialize server and start listening + /** \brief Initialize server and start listening. */ void serverListen(const ip::tcp::endpoint& ep, @@ -67,7 +67,7 @@ protected: server.start_accept(); } - /** \brief initialize client and connect to server + /** \brief Initialize client and connect to server. */ void clientConnect(const std::string& uri) @@ -88,7 +88,7 @@ protected: } /** - * \brief Initialize both server and client, and have each other connected, create Transport + * \brief Initialize both server and client, and have each other connected, create Transport. */ void initialize(const shared_ptr&, diff --git a/tests/daemon/fw/choose-strategy.hpp b/tests/daemon/fw/choose-strategy.hpp index 5416384a..8fc1951e 100644 --- a/tests/daemon/fw/choose-strategy.hpp +++ b/tests/daemon/fw/choose-strategy.hpp @@ -37,7 +37,7 @@ class Strategy; namespace nfd::tests { -/** \brief choose the strategy for a namespace +/** \brief Choose the strategy for a namespace. * \tparam S strategy type, must be a complete type * \param forwarder the forwarder * \param prefix namespace to choose the strategy for diff --git a/tests/daemon/fw/dummy-strategy.hpp b/tests/daemon/fw/dummy-strategy.hpp index 6785cc6d..a4cc4140 100644 --- a/tests/daemon/fw/dummy-strategy.hpp +++ b/tests/daemon/fw/dummy-strategy.hpp @@ -31,7 +31,7 @@ namespace nfd::tests { /** - * \brief Forwarding strategy for unit testing + * \brief Forwarding strategy for unit testing. * * Triggers are recorded but do nothing. * @@ -48,7 +48,7 @@ public: getStrategyName(uint64_t version = std::numeric_limits::max()); /** - * \brief Constructor + * \brief Constructor. * * \p name is recorded unchanged as getInstanceName(), and will not automatically * gain a version number when instantiated without a version number. @@ -57,7 +57,7 @@ public: DummyStrategy(Forwarder& forwarder, const Name& name = getStrategyName()); /** - * \brief After receive Interest trigger + * \brief After receive Interest trigger. * * If interestOutFace is not null, \p interest is forwarded to that face; * otherwise, rejectPendingInterest() is invoked. @@ -86,7 +86,7 @@ public: afterNewNextHop(const fib::NextHop& nextHop, const shared_ptr& pitEntry) override; protected: - /** \brief register an alias + /** \brief Register an alias. * \tparam S subclass of DummyStrategy */ template @@ -112,7 +112,7 @@ public: }; /** - * \brief DummyStrategy with specific version + * \brief DummyStrategy with specific version. */ template class VersionedDummyStrategy : public DummyStrategy @@ -130,7 +130,7 @@ public: return DummyStrategy::getStrategyName(VERSION); } - /** \brief constructor + /** \brief Constructor. * * The strategy instance name is taken from \p name ; if it does not contain a version component, * \p VERSION will be appended. diff --git a/tests/daemon/fw/forwarding-hint.t.cpp b/tests/daemon/fw/forwarding-hint.t.cpp index ce7c414e..46e75f07 100644 --- a/tests/daemon/fw/forwarding-hint.t.cpp +++ b/tests/daemon/fw/forwarding-hint.t.cpp @@ -102,7 +102,7 @@ public: topo.registerPrefix(nodeS, linkSQ->getFace(nodeS), "/net/ndnsim", 10); } - /** \brief express an Interest with Link object from consumerA + /** \brief Express an Interest with Link object from consumerA. */ void consumerExpressInterest(int seq) diff --git a/tests/daemon/fw/strategy-tester.hpp b/tests/daemon/fw/strategy-tester.hpp index e8e795ab..e7dcccc0 100644 --- a/tests/daemon/fw/strategy-tester.hpp +++ b/tests/daemon/fw/strategy-tester.hpp @@ -68,11 +68,11 @@ public: return name; } - /** \brief Signal emitted after each action + /** \brief Signal emitted after each action. */ signal::Signal> afterAction; - /** \brief execute f and wait for a number of strategy actions + /** \brief Execute f and wait for a number of strategy actions. * \note The actions may occur either during f() invocation or afterwards. * \return whether expected number of actions have occurred */ diff --git a/tests/daemon/fw/topology-tester.hpp b/tests/daemon/fw/topology-tester.hpp index 5d973925..35c1fd55 100644 --- a/tests/daemon/fw/topology-tester.hpp +++ b/tests/daemon/fw/topology-tester.hpp @@ -24,7 +24,7 @@ */ /** \file - * \brief allows testing forwarding in a network topology + * \brief Allows testing forwarding in a network topology. */ #ifndef NFD_TESTS_DAEMON_FW_TOPOLOGY_TESTER_HPP @@ -40,11 +40,11 @@ namespace nfd::tests { -/** \brief identifies a node (forwarder) in the topology +/** \brief Identifies a node (forwarder) in the topology. */ typedef size_t TopologyNode; -/** \brief represents a network link in the topology which connects two or more nodes +/** \brief Represents a network link in the topology which connects two or more nodes. */ class TopologyLink : noncopyable { @@ -52,7 +52,7 @@ public: explicit TopologyLink(time::nanoseconds delay); - /** \brief fail the link, cause packets to be dropped silently + /** \brief Fail the link, cause packets to be dropped silently. */ void fail() @@ -60,7 +60,7 @@ public: m_isUp = false; } - /** \brief recover the link from a failure + /** \brief Recover the link from a failure. */ void recover() @@ -68,7 +68,7 @@ public: m_isUp = true; } - /** \brief block transmission from i to j + /** \brief Block transmission from i to j. * * Packets transmitted by i would not be delivered to j. Packets from j to i are unaffected. * This can be used to simulate a wireless channel. @@ -76,18 +76,18 @@ public: void block(TopologyNode i, TopologyNode j); - /** \brief unblock transmission from i to j + /** \brief Unblock transmission from i to j. */ void unblock(TopologyNode i, TopologyNode j); - /** \brief change the link delay + /** \brief Change the link delay. * \param delay link delay, must be positive */ void setDelay(time::nanoseconds delay); - /** \brief attach a face to the link + /** \brief Attach a face to the link. * \param i forwarder index * \param face a Face with InternalForwarderTransport */ @@ -146,12 +146,12 @@ private: std::unordered_map m_transports; }; -/** \brief represents a link on a single forwarder +/** \brief Represents a link on a single forwarder. */ class TopologySingleLink : noncopyable { public: - /** \brief constructor + /** \brief Constructor. * \param forwarderFace a Face with InternalForwarderTransport */ explicit @@ -170,23 +170,23 @@ protected: face::InternalForwarderTransport* m_forwarderTransport; }; -/** \brief represents a link to a local application +/** \brief Represents a link to a local application. */ class TopologyAppLink : public TopologySingleLink { public: - /** \brief constructor + /** \brief Constructor. * \param forwarderFace a Face with InternalForwarderTransport */ explicit TopologyAppLink(shared_ptr forwarderFace); - /** \brief fail the link, cause packets to be dropped silently + /** \brief Fail the link, cause packets to be dropped silently. */ void fail(); - /** \brief recover the link from a failure + /** \brief Recover the link from a failure. */ void recover(); @@ -204,12 +204,12 @@ private: shared_ptr m_client; }; -/** \brief allows the test case to inject and observe L2 packets on a link +/** \brief Allows the test case to inject and observe L2 packets on a link. */ class TopologyBareLink : public TopologySingleLink { public: - /** \brief constructor + /** \brief Constructor. * \param forwarderFace a Face with InternalForwarderTransport */ explicit @@ -226,7 +226,7 @@ private: unique_ptr m_observer; }; -/** \brief captured packets on a face +/** \brief Captured packets on a face. */ class TopologyPcap : noncopyable { @@ -236,16 +236,16 @@ public: std::vector sentNacks; }; -/** \brief captured packet timestamp tag +/** \brief Captured packet timestamp tag. */ using TopologyPcapTimestamp = ndn::SimpleTag; -/** \brief builds a topology for forwarding tests +/** \brief Builds a topology for forwarding tests. */ class TopologyTester : noncopyable { public: - /** \brief creates a forwarder + /** \brief Creates a forwarder. * \return index of new forwarder */ TopologyNode @@ -259,7 +259,7 @@ public: return m_forwarders.at(i)->forwarder; } - /** \brief sets strategy on forwarder \p i + /** \brief Sets strategy on forwarder \p i. * \tparam S the strategy type * \note Test scenario can also access StrategyChoice table directly. */ @@ -272,38 +272,38 @@ public: choose(forwarder, prefix, instanceName); } - /** \brief makes a link that interconnects two or more forwarders - * \brief linkType desired link type; LINK_TYPE_NONE to use point-to-point for two forwarders + /** \brief Makes a link that interconnects two or more forwarders. + * \param linkType Desired link type; LINK_TYPE_NONE to use point-to-point for two forwarders * and multi-access for more than two forwarders; it's an error to specify - * point-to-point when there are more than two forwarders + * point-to-point when there are more than two forwarders. * - * A face is created on each of \p forwarders . - * When a packet is sent onto one of the faces on this link, - * this packet will be received by all other faces on this link after \p delay . + * A face is created on each of \p forwarders. + * When a packet is sent onto one of the faces on this link, the packet will be + * received by all other faces on this link after the specified delay. */ shared_ptr addLink(const std::string& label, time::nanoseconds delay, std::initializer_list forwarders, ndn::nfd::LinkType linkType = ndn::nfd::LINK_TYPE_NONE); - /** \brief makes a link to local application + /** \brief Makes a link to a local application. */ shared_ptr addAppFace(const std::string& label, TopologyNode i); - /** \brief makes a link to local application, and register a prefix + /** \brief Makes a link to a local application and registers a prefix. */ shared_ptr addAppFace(const std::string& label, TopologyNode i, const Name& prefix, uint64_t cost = 0); - /** \brief makes a link that allows the test case to inject and observe L2 packets + /** \brief Makes a link that allows the test case to inject and observe layer-2 packets. */ shared_ptr addBareLink(const std::string& label, TopologyNode i, ndn::nfd::FaceScope scope = ndn::nfd::FACE_SCOPE_LOCAL, ndn::nfd::LinkType linkType = ndn::nfd::LINK_TYPE_POINT_TO_POINT); - /** \brief enables packet capture on every forwarder face + /** \brief Enables packet capture on every forwarder face. */ void enablePcap(bool isEnabled = true) @@ -317,17 +317,17 @@ public: TopologyPcap& getPcap(const Face& face); - /** \brief registers a prefix on a forwarder face + /** \brief Registers a prefix on a forwarder face. */ void registerPrefix(TopologyNode i, const Face& face, const Name& prefix, uint64_t cost = 0); - /** \brief creates a producer application that answers every Interest with Data of same Name + /** \brief Creates a producer application that answers every Interest with Data of same Name. */ void addEchoProducer(ndn::Face& face, const Name& prefix = "/", time::nanoseconds replyDelay = 0_ns); - /** \brief creates a consumer application that sends \p n Interests under \p prefix + /** \brief Creates a consumer application that sends \p n Interests under \p prefix * at \p interval fixed rate. * \param seq if non-negative, append sequence number instead of timestamp */ diff --git a/tests/daemon/limited-io.hpp b/tests/daemon/limited-io.hpp index 68d85e24..123b3704 100644 --- a/tests/daemon/limited-io.hpp +++ b/tests/daemon/limited-io.hpp @@ -54,7 +54,7 @@ public: EXCEPTION }; - /** \brief g_io.run() with operation count and/or time limit + /** \brief `g_io.run()` with operation count and/or time limit. * \param nOpsLimit operation count limit, pass UNLIMITED_OPS for no limit * \param timeLimit time limit, pass UNLIMITED_TIME for no limit * \param tick if this LimitedIo is constructed with GlobalIoTimeFixture, @@ -68,7 +68,7 @@ public: afterOp(); /** - * \brief Defer for the specified duration + * \brief Defer for the specified duration. * * Equivalent to run(UNLIMITED_OPS, d) */ @@ -85,7 +85,7 @@ public: } private: - /** \brief an exception to stop IO operation + /** \brief An exception to stop IO operation. */ class StopException : public std::exception { diff --git a/tests/daemon/mgmt/face-manager.t.cpp b/tests/daemon/mgmt/face-manager.t.cpp index 794c363a..140b1c62 100644 --- a/tests/daemon/mgmt/face-manager.t.cpp +++ b/tests/daemon/mgmt/face-manager.t.cpp @@ -60,7 +60,7 @@ public: RANDOMIZE_COUNTERS = 1 << 3, }; - /** \brief adds a face to the FaceTable + /** \brief Adds a face to the FaceTable. * \param options bitwise OR'ed AddFaceFlags */ shared_ptr diff --git a/tests/daemon/mgmt/fib-manager.t.cpp b/tests/daemon/mgmt/fib-manager.t.cpp index 5ab310d4..09145c57 100644 --- a/tests/daemon/mgmt/fib-manager.t.cpp +++ b/tests/daemon/mgmt/fib-manager.t.cpp @@ -79,7 +79,7 @@ public: // for check }; /** - * @brief check whether the nexthop record is added / removed properly + * @brief Check whether the nexthop record is added / removed properly. * * @param expectedNNextHops use nullopt to skip this check * @param faceId use nullopt to skip NextHopRecord checks diff --git a/tests/daemon/mgmt/manager-common-fixture.hpp b/tests/daemon/mgmt/manager-common-fixture.hpp index 4741ea40..b0ddf088 100644 --- a/tests/daemon/mgmt/manager-common-fixture.hpp +++ b/tests/daemon/mgmt/manager-common-fixture.hpp @@ -47,7 +47,7 @@ protected: InterestSignerFixture(); /** - * \brief Create a ControlCommand request + * \brief Create a ControlCommand request. * \param commandName Command name including prefix, such as `/localhost/nfd/fib/add-nexthop` * \param params Command parameters * \param format Signed Interest format @@ -82,7 +82,7 @@ public: // initialize public: // test /** - * @brief cause management to receive an Interest + * @brief Cause management to receive an Interest. * * call DummyClientFace::receive to receive Interest and then call advanceClocks to ensure * the Interest dispatched @@ -109,7 +109,7 @@ public: // verify }; /** - * @brief check a specified response data with the expected ControlResponse + * @brief Check a specified response data with the expected ControlResponse. * * @param idx the index of the specified Data in m_responses * @param expectedDataName the expected name of this Data @@ -135,7 +135,7 @@ public: // verify int expectedContentType = -1); /** - * @brief concatenate specified response Data into a single block + * @brief Concatenate specified response Data into a single block. * * @param startIndex the start index in m_responses * @param nResponses the number of response to concatenate @@ -157,7 +157,7 @@ operator<<(std::ostream& os, ManagerCommonFixture::CheckResponseResult result); class ManagerFixtureWithAuthenticator : public ManagerCommonFixture { public: - /** \brief grant m_identityName privilege to sign commands for the management module + /** \brief Grant m_identityName privilege to sign commands for the management module. */ void setPrivilege(const std::string& privilege); diff --git a/tests/daemon/rib-io-fixture.hpp b/tests/daemon/rib-io-fixture.hpp index 73a43bc0..e825f7d1 100644 --- a/tests/daemon/rib-io-fixture.hpp +++ b/tests/daemon/rib-io-fixture.hpp @@ -56,15 +56,15 @@ protected: poll(); protected: - /** \brief pointer to global main io_service + /** \brief Pointer to global main io_service. */ boost::asio::io_service* g_mainIo = nullptr; - /** \brief pointer to global RIB io_service + /** \brief Pointer to global RIB io_service. */ boost::asio::io_service* g_ribIo = nullptr; - /** \brief global RIB thread + /** \brief Global RIB thread. */ std::thread g_ribThread; diff --git a/tests/daemon/table/dead-nonce-list.t.cpp b/tests/daemon/table/dead-nonce-list.t.cpp index 7df4ec8b..6c6add20 100644 --- a/tests/daemon/table/dead-nonce-list.t.cpp +++ b/tests/daemon/table/dead-nonce-list.t.cpp @@ -125,7 +125,7 @@ protected: addNonceEvent = getScheduler().schedule(ADD_INTERVAL, [this] { addNonce(); }); } - /** \brief advance clocks by LIFETIME*t + /** \brief Advance clocks by `LIFETIME*t`. */ void advanceClocksByLifetime(double t) diff --git a/tests/daemon/table/name-tree.t.cpp b/tests/daemon/table/name-tree.t.cpp index 8a7665e9..ba87cf40 100644 --- a/tests/daemon/table/name-tree.t.cpp +++ b/tests/daemon/table/name-tree.t.cpp @@ -419,7 +419,7 @@ BOOST_AUTO_TEST_CASE(Basic) BOOST_CHECK_EQUAL(nt.size(), 8); } -/** \brief verify a NameTree enumeration contains expected entries +/** \brief Verify a NameTree enumeration contains expected entries. * * Example: * \code diff --git a/tests/daemon/table/strategy-choice.t.cpp b/tests/daemon/table/strategy-choice.t.cpp index 574317d5..b2852343 100644 --- a/tests/daemon/table/strategy-choice.t.cpp +++ b/tests/daemon/table/strategy-choice.t.cpp @@ -40,7 +40,7 @@ protected: DummyStrategy::registerAs(strategyNameQ); } - /** \brief insert StrategyChoice entry at \p prefix for \p instanceName + /** \brief Insert StrategyChoice entry at \p prefix for \p instanceName. * \return constructed instance name */ Name @@ -52,7 +52,7 @@ protected: return foundName; } - /** \brief determine whether the effective strategy type at \p prefix is \p S + /** \brief Determine whether the effective strategy type at \p prefix is \p S. * \tparam S expected strategy type */ template diff --git a/tests/tools/mock-nfd-mgmt-fixture.hpp b/tests/tools/mock-nfd-mgmt-fixture.hpp index 0d5f4ba6..8f052eb7 100644 --- a/tests/tools/mock-nfd-mgmt-fixture.hpp +++ b/tests/tools/mock-nfd-mgmt-fixture.hpp @@ -58,7 +58,7 @@ protected: } protected: // ControlCommand - /** \brief check the Interest is a command with specified prefix + /** \brief Check the Interest is a command with specified prefix. * \retval nullopt last Interest is not the expected command * \return command parameters */ @@ -71,7 +71,7 @@ protected: // ControlCommand return ControlParameters(interest.getName().at(expectedPrefix.size()).blockFromValue()); } - /** \brief send successful response to a command Interest + /** \brief Send successful response to a command Interest. */ void succeedCommand(const Interest& interest, const ControlParameters& parameters) @@ -79,7 +79,7 @@ protected: // ControlCommand this->sendCommandReply(interest, 200, "OK", parameters.wireEncode()); } - /** \brief send failure response to a command Interest + /** \brief Send failure response to a command Interest. */ void failCommand(const Interest& interest, uint32_t code, const std::string& text) @@ -87,7 +87,7 @@ protected: // ControlCommand this->sendCommandReply(interest, {code, text}); } - /** \brief send failure response to a command Interest + /** \brief Send failure response to a command Interest. */ void failCommand(const Interest& interest, uint32_t code, const std::string& text, const ControlParameters& body) @@ -96,7 +96,7 @@ protected: // ControlCommand } protected: // StatusDataset - /** \brief send an empty dataset in reply to StatusDataset request + /** \brief Send an empty dataset in reply to StatusDataset request. * \param prefix dataset prefix without version and segment * \pre Interest for dataset has been expressed, sendDataset has not been invoked */ @@ -106,7 +106,7 @@ protected: // StatusDataset this->sendDatasetReply(prefix, span{}); } - /** \brief send one WireEncodable in reply to StatusDataset request + /** \brief Send one WireEncodable in reply to StatusDataset request. * \param prefix dataset prefix without version and segment * \param payload payload block * \note payload must fit in one Data @@ -121,7 +121,7 @@ protected: // StatusDataset this->sendDatasetReply(prefix, payload.wireEncode()); } - /** \brief send two WireEncodables in reply to StatusDataset request + /** \brief Send two WireEncodables in reply to StatusDataset request. * \param prefix dataset prefix without version and segment * \param payload1 first vector item * \param payload2 second vector item @@ -168,7 +168,7 @@ private: this->sendCommandReply(interest, ndn::nfd::ControlResponse(code, text).setBody(body)); } - /** \brief send a payload in reply to StatusDataset request + /** \brief Send a payload in reply to StatusDataset request. * \param name dataset prefix without version and segment * \param contentArgs passed to Data::setContent */ @@ -211,7 +211,7 @@ protected: } // namespace nfd::tests /** - * \brief Require the command in \p interest to have the expected prefix + * \brief Require the command in \p interest to have the expected prefix. * \note This must be used in the `processInterest` lambda, and the Interest must be named `interest`. * \return ControlParameters. The test case will fail if \p interest does not match \p expectedPrefix. */ diff --git a/tests/tools/ndn-autoconfig/procedure.t.cpp b/tests/tools/ndn-autoconfig/procedure.t.cpp index d8911bb4..ea5311b3 100644 --- a/tests/tools/ndn-autoconfig/procedure.t.cpp +++ b/tests/tools/ndn-autoconfig/procedure.t.cpp @@ -107,7 +107,7 @@ private: boost::asio::io_service& m_io; }; -/** \brief two-stage Procedure where the first stage succeeds and the second stage fails +/** \brief Two-stage Procedure where the first stage succeeds and the second stage fails. * * But the second stage shouldn't be invoked after the first stage succeeds. */ @@ -136,7 +136,7 @@ private: boost::asio::io_service& m_io; }; -/** \brief two-stage Procedure where the first stage fails and the second stage succeeds +/** \brief Two-stage Procedure where the first stage fails and the second stage succeeds. */ class ProcedureFailureSuccess : public Procedure { diff --git a/tests/tools/nfdc/mock-nfd-mgmt-fixture.hpp b/tests/tools/nfdc/mock-nfd-mgmt-fixture.hpp index eb197a43..ab2ec396 100644 --- a/tests/tools/nfdc/mock-nfd-mgmt-fixture.hpp +++ b/tests/tools/nfdc/mock-nfd-mgmt-fixture.hpp @@ -39,7 +39,7 @@ namespace nfd::tools::nfdc::tests { class MockNfdMgmtFixture : public nfd::tests::MockNfdMgmtFixture { protected: - /** \brief respond to FaceQuery requests + /** \brief Respond to FaceQuery requests. * \retval true the Interest matches one of the defined patterns and is responded * \retval false the Interest is not responded */ diff --git a/tests/tools/nfdc/status-fixture.hpp b/tests/tools/nfdc/status-fixture.hpp index 7616306c..c82e79ba 100644 --- a/tests/tools/nfdc/status-fixture.hpp +++ b/tests/tools/nfdc/status-fixture.hpp @@ -51,8 +51,8 @@ public: } }; -/** \brief fixture to test status fetching routines in a \p Module - * \tparam M a subclass of \p Module +/** \brief Fixture to test status fetching routines in a Module. + * \tparam M a subclass of Module * \tparam MakeValidator a callable to make a Validator for use in \p controller; * MakeValidator()(Face&, KeyChain&) should return a unique_ptr * to Validator or its subclass @@ -71,7 +71,7 @@ protected: } protected: // status fetching - /** \brief start fetching status + /** \brief Start fetching status. * * A test case should call \p fetchStatus, \p sendDataset, and \p prepareStatusOutput * in this order, and then check \p statusXml and \p statusText contain the correct outputs. @@ -90,7 +90,7 @@ protected: // status fetching this->advanceClocks(1_ms); } - /** \brief prepare status output as XML and text + /** \brief Prepare status output as XML and text. * \pre sendDataset has been invoked */ void @@ -116,7 +116,7 @@ protected: output_test_stream statusText; }; -/** \brief strips leading spaces on every line in expected XML +/** \brief Strips leading spaces on every line in expected XML. * * This allows expected XML to be written as: * \code diff --git a/tests/tools/nfdc/status-report.t.cpp b/tests/tools/nfdc/status-report.t.cpp index f978c57a..fbff27a4 100644 --- a/tests/tools/nfdc/status-report.t.cpp +++ b/tests/tools/nfdc/status-report.t.cpp @@ -53,9 +53,9 @@ public: { } - /** \brief cause fetchStatus to succeed or fail + /** \brief Cause fetchStatus() to succeed or fail. * \param res zero to succeed, non-zero to fail with specific code - * \param delay duration from fetchStatus invocation to succeed or fail; must be positive + * \param delay duration from fetchStatus() invocation to succeed or fail; must be positive */ void setResult(uint32_t res, time::nanoseconds delay) diff --git a/tools/ndn-autoconfig/multicast-discovery.hpp b/tools/ndn-autoconfig/multicast-discovery.hpp index b2a63ede..f8a86d87 100644 --- a/tools/ndn-autoconfig/multicast-discovery.hpp +++ b/tools/ndn-autoconfig/multicast-discovery.hpp @@ -33,7 +33,7 @@ namespace ndn::autoconfig { -/** \brief multicast discovery stage +/** \brief Multicast discovery stage. * * This stage locates an NDN gateway router, commonly known as a "hub", in the local network by * sending a hub discovery Interest ndn:/localhop/ndn-autoconf/hub via multicast. This class diff --git a/tools/ndn-autoconfig/ndn-fch-discovery.cpp b/tools/ndn-autoconfig/ndn-fch-discovery.cpp index c6df1b79..52521e76 100644 --- a/tools/ndn-autoconfig/ndn-fch-discovery.cpp +++ b/tools/ndn-autoconfig/ndn-fch-discovery.cpp @@ -127,11 +127,7 @@ private: class HttpException : public std::runtime_error { public: - explicit - HttpException(const std::string& what) - : std::runtime_error(what) - { - } + using std::runtime_error::runtime_error; }; NdnFchDiscovery::NdnFchDiscovery(const std::string& url) diff --git a/tools/ndn-autoconfig/ndn-fch-discovery.hpp b/tools/ndn-autoconfig/ndn-fch-discovery.hpp index 64d38992..cfdcb513 100644 --- a/tools/ndn-autoconfig/ndn-fch-discovery.hpp +++ b/tools/ndn-autoconfig/ndn-fch-discovery.hpp @@ -31,15 +31,15 @@ namespace ndn::autoconfig { /** - * @brief Discovery NDN hub using NDN-FCH protocol + * @brief Discover NDN hub using NDN-FCH protocol. * - * @see https://github.com/cawka/ndn-fch/blob/master/README.md + * @see https://github.com/named-data/ndn-fch/blob/master/README.md */ class NdnFchDiscovery : public Stage { public: /** - * @brief Create stage to discover NDN hub using NDN-FCH protocol + * @brief Create stage to discover NDN hub using NDN-FCH protocol. */ explicit NdnFchDiscovery(const std::string& url); diff --git a/tools/ndn-autoconfig/procedure.hpp b/tools/ndn-autoconfig/procedure.hpp index c5dc0bb6..0af39807 100644 --- a/tools/ndn-autoconfig/procedure.hpp +++ b/tools/ndn-autoconfig/procedure.hpp @@ -52,7 +52,7 @@ public: void initialize(const Options& options); - /** \brief run HUB discovery procedure once + /** \brief Run HUB discovery procedure once. */ void runOnce(); @@ -74,7 +74,7 @@ private: registerPrefixes(uint64_t hubFaceId, size_t index = 0); public: - /** \brief signal when procedure completes + /** \brief Signal when procedure completes. * * Argument indicates whether the procedure succeeds (true) or fails (false). */ diff --git a/tools/ndn-autoconfig/stage.hpp b/tools/ndn-autoconfig/stage.hpp index d11309b0..7c1247ce 100644 --- a/tools/ndn-autoconfig/stage.hpp +++ b/tools/ndn-autoconfig/stage.hpp @@ -33,7 +33,7 @@ namespace ndn::autoconfig { -/** \brief a discovery stage +/** \brief A discovery stage. */ class Stage : boost::noncopyable { @@ -47,20 +47,20 @@ public: virtual ~Stage() = default; - /** \brief get stage name + /** \brief Get stage name. * \return stage name as a phrase, typically starting with lower case */ virtual const std::string& getName() const = 0; - /** \brief start running this stage + /** \brief Start running this stage. * \throw Error stage is already running */ void start(); protected: - /** \brief parse HUB FaceUri from string and declare success + /** \brief Parse HUB FaceUri from string and declare success. */ void provideHubFaceUri(const std::string& s); @@ -76,13 +76,13 @@ private: doStart() = 0; public: - /** \brief signal when a HUB FaceUri is found + /** \brief Signal when a HUB FaceUri is found. * * Argument is HUB FaceUri, may not be canonical. */ util::Signal onSuccess; - /** \brief signal when discovery fails + /** \brief Signal when discovery fails. * * Argument is error message. */ diff --git a/tools/nfdc/channel-module.hpp b/tools/nfdc/channel-module.hpp index 6698ae89..02b01add 100644 --- a/tools/nfdc/channel-module.hpp +++ b/tools/nfdc/channel-module.hpp @@ -32,7 +32,7 @@ namespace nfd::tools::nfdc { using ndn::nfd::ChannelStatus; -/** \brief provides access to NFD channel dataset +/** \brief Provides access to NFD channel dataset. * \sa https://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Channel-Dataset */ class ChannelModule : public Module, noncopyable @@ -47,7 +47,7 @@ public: void formatStatusXml(std::ostream& os) const override; - /** \brief format a single status item as XML + /** \brief Format a single status item as XML. * \param os output stream * \param item status item */ @@ -57,7 +57,7 @@ public: void formatStatusText(std::ostream& os) const override; - /** \brief format a single status item as text + /** \brief Format a single status item as text. * \param os output stream * \param item status item */ diff --git a/tools/nfdc/command-arguments.hpp b/tools/nfdc/command-arguments.hpp index 6dc060a2..91d17e01 100644 --- a/tools/nfdc/command-arguments.hpp +++ b/tools/nfdc/command-arguments.hpp @@ -38,7 +38,7 @@ namespace nfd::tools::nfdc { using ndn::nfd::FacePersistency; using ndn::nfd::RouteOrigin; -/** \brief contains named command arguments +/** \brief Contains named command arguments. */ class CommandArguments : public std::map> { @@ -62,7 +62,7 @@ public: return getOptional(key).value_or(defaultValue); } - /** \brief get an optional boolean argument as tribool + /** \brief Get an optional boolean argument as tribool. * \return the argument value, or boost::logic::indeterminate if the argument is omitted on command line */ boost::logic::tribool diff --git a/tools/nfdc/command-definition.hpp b/tools/nfdc/command-definition.hpp index 26e309bf..07ecd156 100644 --- a/tools/nfdc/command-definition.hpp +++ b/tools/nfdc/command-definition.hpp @@ -30,73 +30,73 @@ namespace nfd::tools::nfdc { -/** \brief indicates argument value type +/** \brief Indicates argument value type. */ enum class ArgValueType { - /** \brief boolean argument without value + /** \brief Boolean argument without value. * * The argument appears in CommandArguments as bool value `true`. * It must not be declared as positional. */ NONE, - /** \brief any arguments + /** \brief Any arguments. * * The argument appears in CommandArguments as std::vector. * It must be declared as positional, and will consume all subsequent tokens. */ ANY, - /** \brief boolean + /** \brief Boolean. * * The argument appears in CommandArguments as bool. */ BOOLEAN, - /** \brief non-negative integer + /** \brief Non-negative integer. * * The argument appears in CommandArguments as uint64_t. * Acceptable input range is [0, std::numeric_limits::max()]. */ UNSIGNED, - /** \brief arbitrary string + /** \brief Arbitrary string. * * The argument appears in CommandArguments as std::string. */ STRING, - /** \brief report format 'xml' or 'text' + /** \brief Report format 'xml' or 'text'. * * The argument appears in CommandArguments as nfd::tools::nfdc::ReportFormat. */ REPORT_FORMAT, - /** \brief Name prefix + /** \brief Name prefix. * * The argument appears in CommandArguments as ndn::Name. */ NAME, - /** \brief FaceUri + /** \brief FaceUri. * * The argument appears in CommandArguments as ndn::FaceUri. */ FACE_URI, - /** \brief FaceId or FaceUri + /** \brief FaceId or FaceUri. * * The argument appears in CommandArguments as either uint64_t or ndn::FaceUri. */ FACE_ID_OR_URI, - /** \brief face persistency 'persistent' or 'permanent' + /** \brief Face persistency 'persistent' or 'permanent'. * * The argument appears in CommandArguments as ndn::nfd::FacePersistency. */ FACE_PERSISTENCY, - /** \brief route origin + /** \brief Route origin. * * The argument appears in CommandArguments as ndn::nfd::RouteOrigin. */ @@ -106,14 +106,14 @@ enum class ArgValueType { std::ostream& operator<<(std::ostream& os, ArgValueType vt); -/** \brief indicates whether an argument is required +/** \brief Indicates whether an argument is required. */ enum class Required { NO = false, ///< argument is optional YES = true ///< argument is required }; -/** \brief indicates whether an argument can be specified as positional +/** \brief Indicates whether an argument can be specified as positional. */ enum class Positional { NO = false, ///< argument must be named @@ -121,7 +121,7 @@ enum class Positional { }; /** - * \brief Defines a command + * \brief Defines a command. */ class CommandDefinition { @@ -157,7 +157,7 @@ public: // help return m_title; } - /** \brief set one-line description + /** \brief Set one-line description. * \param title one-line description, written in lower case */ CommandDefinition& @@ -168,7 +168,7 @@ public: // help } public: // arguments - /** \brief declare an argument + /** \brief Declare an argument. * \param name argument name, must be unique * \param valueType argument value type * \param isRequired whether the argument is required @@ -181,7 +181,7 @@ public: // arguments Positional allowPositional = Positional::NO, const std::string& metavar = ""); - /** \brief parse a command line + /** \brief Parse a command line. * \param tokens command line tokens * \param start command line start position, after noun and verb * \throw Error command line is invalid diff --git a/tools/nfdc/command-parser.hpp b/tools/nfdc/command-parser.hpp index 52ba292b..e7046e0a 100644 --- a/tools/nfdc/command-parser.hpp +++ b/tools/nfdc/command-parser.hpp @@ -33,7 +33,7 @@ namespace nfd::tools::nfdc { -/** \brief indicates which modes is a command allowed +/** \brief Indicates which modes is a command allowed. */ enum AvailableIn : uint8_t { AVAILABLE_IN_NONE = 0, @@ -46,7 +46,7 @@ enum AvailableIn : uint8_t { std::ostream& operator<<(std::ostream& os, AvailableIn modes); -/** \brief indicates which mode is the parser operated in +/** \brief Indicates which mode is the parser operated in. */ enum class ParseMode : uint8_t { ONE_SHOT = AVAILABLE_IN_ONE_SHOT, ///< one-shot mode @@ -56,7 +56,7 @@ enum class ParseMode : uint8_t { std::ostream& operator<<(std::ostream& os, ParseMode mode); -/** \brief parses a command +/** \brief Parses a command. */ class CommandParser : noncopyable { @@ -70,7 +70,7 @@ public: } }; - /** \brief add an available command + /** \brief Add an available command. * \param def command semantics definition * \param execute a function to execute the command * \param modes parse modes this command should be available in, must not be AVAILABLE_IN_NONE @@ -79,13 +79,13 @@ public: addCommand(const CommandDefinition& def, const ExecuteCommand& execute, std::underlying_type_t modes = AVAILABLE_IN_ALL); - /** \brief add an alias "noun verb2" to existing command "noun verb" + /** \brief Add an alias "noun verb2" to existing command "noun verb". * \throw std::out_of_range "noun verb" does not exist */ CommandParser& addAlias(const std::string& noun, const std::string& verb, const std::string& verb2); - /** \brief list known commands for help + /** \brief List known commands for help. * \param noun if not empty, filter results by this noun * \param mode include commands for the specified parse mode * \return commands in insertion order @@ -93,7 +93,7 @@ public: std::vector listCommands(std::string_view noun, ParseMode mode) const; - /** \brief parse a command line + /** \brief Parse a command line. * \param tokens command line * \param mode parser mode, must be ParseMode::ONE_SHOT, other modes are not implemented * \throw NoSuchCommandError command not found @@ -113,12 +113,12 @@ private: AvailableIn modes; }; - /** \brief map from command name or alias to command definition + /** \brief Map from command name or alias to command definition. */ using CommandContainer = std::map>; CommandContainer m_commands; - /** \brief commands in insertion order + /** \brief Commands in insertion order. */ std::vector m_commandOrder; }; diff --git a/tools/nfdc/cs-module.hpp b/tools/nfdc/cs-module.hpp index 3c78765a..f2cbef98 100644 --- a/tools/nfdc/cs-module.hpp +++ b/tools/nfdc/cs-module.hpp @@ -33,23 +33,23 @@ namespace nfd::tools::nfdc { using ndn::nfd::CsInfo; -/** \brief provides access to NFD CS management +/** \brief Provides access to NFD CS management. * \sa https://redmine.named-data.net/projects/nfd/wiki/CsMgmt */ class CsModule : public Module, noncopyable { public: - /** \brief register 'cs config' command + /** \brief Register 'cs config' command. */ static void registerCommands(CommandParser& parser); - /** \brief the 'cs config' command + /** \brief The 'cs config' command. */ static void config(ExecuteContext& ctx); - /** \brief the 'cs erase' command + /** \brief The 'cs erase' command. */ static void erase(ExecuteContext& ctx); diff --git a/tools/nfdc/face-helpers.hpp b/tools/nfdc/face-helpers.hpp index 5c4ea18f..1ceb9761 100644 --- a/tools/nfdc/face-helpers.hpp +++ b/tools/nfdc/face-helpers.hpp @@ -34,7 +34,7 @@ using ndn::nfd::FaceQueryFilter; using ndn::nfd::FaceStatus; /** - * \brief Procedure to find a face + * \brief Procedure to find a face. */ class FindFace : noncopyable { @@ -57,19 +57,19 @@ public: explicit FindFace(ExecuteContext& ctx); - /** \brief find face by FaceUri + /** \brief Find face by FaceUri. * \pre execute has not been invoked */ Code execute(const FaceUri& faceUri, bool allowMulti = false); - /** \brief find face by FaceId + /** \brief Find face by FaceId. * \pre execute has not been invoked */ Code execute(uint64_t faceId); - /** \brief find face by FaceId or FaceUri + /** \brief Find face by FaceId or FaceUri. * \param faceIdOrUri either a FaceId (uint64_t) or a FaceUri * \param allowMulti effective only if \p faceIdOrUri contains a FaceUri * \throw ndn::bad_any_cast faceIdOrUri is neither uint64_t nor FaceUri @@ -77,7 +77,7 @@ public: Code execute(const std::any& faceIdOrUri, bool allowMulti = false); - /** \brief find face by FaceQueryFilter + /** \brief Find face by FaceQueryFilter. * \pre execute has not been invoked */ Code @@ -114,7 +114,7 @@ public: return m_errorReason; } - /** \brief print results for disambiguation + /** \brief Print results for disambiguation. */ void printDisambiguation(std::ostream& os, DisambiguationStyle style) const; @@ -123,7 +123,7 @@ private: std::optional canonize(const std::string& fieldName, const FaceUri& uri); - /** \brief retrieve FaceStatus from filter + /** \brief Retrieve FaceStatus from filter. * \post m_res == Code::OK and m_results is populated if retrieval succeeds * \post m_res == Code::ERROR and m_errorReason is set if retrieval fails */ @@ -139,14 +139,14 @@ private: }; /** - * \brief Canonize a FaceUri + * \brief Canonize a FaceUri. * \return canonical FaceUri (nullopt on failure) and error string */ std::pair, std::string> canonize(ExecuteContext& ctx, const FaceUri& uri); /** - * \brief Helper to generate exit code and error message for face canonization failures + * \brief Helper to generate exit code and error message for face canonization failures. * \param uri The FaceUri * \param error The error string returned by the canonization process * \param field An optional field identifier to include with the message diff --git a/tools/nfdc/face-module.cpp b/tools/nfdc/face-module.cpp index 446a2810..136a4f9e 100644 --- a/tools/nfdc/face-module.cpp +++ b/tools/nfdc/face-module.cpp @@ -131,7 +131,7 @@ FaceModule::show(ExecuteContext& ctx) } } -/** \brief order persistency in NONE < ON_DEMAND < PERSISTENCY < PERMANENT +/** \brief Order persistency in NONE < ON_DEMAND < PERSISTENCY < PERMANENT. */ static bool persistencyLessThan(FacePersistency x, FacePersistency y) diff --git a/tools/nfdc/face-module.hpp b/tools/nfdc/face-module.hpp index 1d3eac8c..1f7393ae 100644 --- a/tools/nfdc/face-module.hpp +++ b/tools/nfdc/face-module.hpp @@ -34,33 +34,33 @@ namespace nfd::tools::nfdc { using ndn::nfd::FaceStatus; -/** \brief provides access to NFD face management +/** \brief Provides access to NFD face management. * \sa https://redmine.named-data.net/projects/nfd/wiki/FaceMgmt */ class FaceModule : public Module, noncopyable { public: - /** \brief register 'face list', 'face show', 'face create', 'face destroy' commands + /** \brief Register 'face list', 'face show', 'face create', 'face destroy' commands. */ static void registerCommands(CommandParser& parser); - /** \brief the 'face list' command + /** \brief The 'face list' command. */ static void list(ExecuteContext& ctx); - /** \brief the 'face show' command + /** \brief The 'face show' command. */ static void show(ExecuteContext& ctx); - /** \brief the 'face create' command + /** \brief The 'face create' command. */ static void create(ExecuteContext& ctx); - /** \brief the 'face destroy' command + /** \brief The 'face destroy' command. */ static void destroy(ExecuteContext& ctx); @@ -74,7 +74,7 @@ public: void formatStatusXml(std::ostream& os) const override; - /** \brief format a single status item as XML + /** \brief Format a single status item as XML. * \param os output stream * \param item status item */ @@ -84,7 +84,7 @@ public: void formatStatusText(std::ostream& os) const override; - /** \brief format a single status item as text + /** \brief Format a single status item as text. * \param os output stream * \param item status item * \param wantMultiLine use multi-line style @@ -92,7 +92,7 @@ public: static void formatItemText(std::ostream& os, const FaceStatus& item, bool wantMultiLine); - /** \brief print face action success message to specified ostream + /** \brief Print face action success message to specified ostream. * \param os output stream * \param actionSummary description of action taken * \param resp response control parameters to print @@ -100,7 +100,7 @@ public: static void printSuccess(std::ostream& os, const std::string& actionSummary, const ControlParameters& resp); - /** \brief print face response parameters to specified ostream + /** \brief Print face response parameters to specified ostream. * \param os output stream * \param ia ItemAttributes used to format output * \param resp response control parameters to print diff --git a/tools/nfdc/fib-module.hpp b/tools/nfdc/fib-module.hpp index e182f591..50200cb6 100644 --- a/tools/nfdc/fib-module.hpp +++ b/tools/nfdc/fib-module.hpp @@ -33,7 +33,7 @@ namespace nfd::tools::nfdc { using ndn::nfd::FibEntry; using ndn::nfd::NextHopRecord; -/** \brief provides access to NFD FIB management +/** \brief Provides access to NFD FIB management. * \sa https://redmine.named-data.net/projects/nfd/wiki/FibMgmt */ class FibModule : public Module, noncopyable @@ -48,7 +48,7 @@ public: void formatStatusXml(std::ostream& os) const override; - /** \brief format a single status item as XML + /** \brief Format a single status item as XML. * \param os output stream * \param item status item */ @@ -58,7 +58,7 @@ public: void formatStatusText(std::ostream& os) const override; - /** \brief format a single status item as text + /** \brief Format a single status item as text. * \param os output stream * \param item status item */ diff --git a/tools/nfdc/format-helpers.hpp b/tools/nfdc/format-helpers.hpp index 2ee28bab..0f04c164 100644 --- a/tools/nfdc/format-helpers.hpp +++ b/tools/nfdc/format-helpers.hpp @@ -43,12 +43,12 @@ struct Text const std::string& s; }; -/** \brief print XML text with special character represented as predefined entities +/** \brief Print XML text with special character represented as predefined entities. */ std::ostream& operator<<(std::ostream& os, const Text& text); -/** \brief print true as an empty element and false as nothing +/** \brief Print true as an empty element and false as nothing. */ struct Flag { @@ -77,7 +77,7 @@ formatTimestamp(time::system_clock::time_point t); namespace text { -/** \brief print a number of whitespaces +/** \brief Print a number of whitespaces. */ struct Spaces { @@ -87,7 +87,7 @@ struct Spaces std::ostream& operator<<(std::ostream& os, const Spaces& spaces); -/** \brief print different string on first and subsequent usage +/** \brief Print different string on first and subsequent usage. * * \code * Separator sep(","); @@ -122,7 +122,7 @@ private: std::ostream& operator<<(std::ostream& os, Separator& sep); -/** \brief print attributes of an item +/** \brief Print attributes of an item. * * \code * ItemAttributes ia(wantMultiLine, 3); @@ -141,7 +141,7 @@ operator<<(std::ostream& os, Separator& sep); class ItemAttributes : noncopyable { public: - /** \brief constructor + /** \brief Constructor. * \param wantMultiLine true to select multi-line style, false to use single-line style * \param maxAttributeWidth maximum width of attribute names, for alignment in multi-line style */ @@ -174,7 +174,7 @@ private: std::ostream& operator<<(std::ostream& os, const ItemAttributes::Attribute& attr); -/** \brief print boolean as 'on' or 'off' +/** \brief Print boolean as 'on' or 'off'. */ struct OnOff { @@ -184,7 +184,7 @@ struct OnOff std::ostream& operator<<(std::ostream& os, OnOff v); -/** \brief print boolean as 'yes' or 'no' +/** \brief Print boolean as 'yes' or 'no'. */ struct YesNo { diff --git a/tools/nfdc/forwarder-general-module.hpp b/tools/nfdc/forwarder-general-module.hpp index 239cea64..6b1b49ba 100644 --- a/tools/nfdc/forwarder-general-module.hpp +++ b/tools/nfdc/forwarder-general-module.hpp @@ -32,7 +32,7 @@ namespace nfd::tools::nfdc { using ndn::nfd::ForwarderStatus; -/** \brief provides access to NFD forwarder general status +/** \brief Provides access to NFD forwarder general status. * \sa https://redmine.named-data.net/projects/nfd/wiki/ForwarderStatus */ class ForwarderGeneralModule : public Module, noncopyable @@ -47,7 +47,7 @@ public: void formatStatusXml(std::ostream& os) const override; - /** \brief format a single status item as XML + /** \brief Format a single status item as XML. * \param os output stream * \param item status item */ @@ -57,7 +57,7 @@ public: void formatStatusText(std::ostream& os) const override; - /** \brief format a single status item as text + /** \brief Format a single status item as text. * \param os output stream * \param item status item */ diff --git a/tools/nfdc/help.hpp b/tools/nfdc/help.hpp index 19df8c16..80b37fe5 100644 --- a/tools/nfdc/help.hpp +++ b/tools/nfdc/help.hpp @@ -30,7 +30,7 @@ namespace nfd::tools::nfdc { -/** \brief writes the list of available commands to a stream +/** \brief Writes the list of available commands to a stream. * \param os the output stream to write the list to * \param parser instance of CommandParser containing the commands to list * \param mode only the commands available in this mode are listed @@ -40,7 +40,7 @@ void helpList(std::ostream& os, const CommandParser& parser, ParseMode mode = ParseMode::ONE_SHOT, std::string_view noun = ""); -/** \brief tries to help the user, if requested on the command line +/** \brief Tries to help the user, if requested on the command line. * * Depending on the provided command line arguments \p args, this function can either * open the man page for a specific command, or list all commands available in \p parser. diff --git a/tools/nfdc/module.hpp b/tools/nfdc/module.hpp index 6793b3ef..af0f6513 100644 --- a/tools/nfdc/module.hpp +++ b/tools/nfdc/module.hpp @@ -35,7 +35,7 @@ namespace nfd::tools::nfdc { using ndn::nfd::CommandOptions; using ndn::nfd::Controller; -/** \brief provides access to an NFD management module +/** \brief Provides access to an NFD management module. * \note This type is an interface. It should not have member fields. */ class Module @@ -44,7 +44,7 @@ public: virtual ~Module() = default; - /** \brief collect status from NFD + /** \brief Collect status from NFD. * \pre no other fetchStatus is in progress * \param controller a controller through which StatusDataset can be requested * \param onSuccess invoked when status has been collected into this instance @@ -57,14 +57,14 @@ public: const Controller::DatasetFailCallback& onFailure, const CommandOptions& options) = 0; - /** \brief format collected status as XML + /** \brief Format collected status as XML. * \pre fetchStatus has been successful * \param os output stream */ virtual void formatStatusXml(std::ostream& os) const = 0; - /** \brief format collected status as text + /** \brief Format collected status as text. * \pre fetchStatus has been successful * \param os output stream */ diff --git a/tools/nfdc/rib-module.hpp b/tools/nfdc/rib-module.hpp index 22d4e76f..d81f6a75 100644 --- a/tools/nfdc/rib-module.hpp +++ b/tools/nfdc/rib-module.hpp @@ -34,33 +34,33 @@ namespace nfd::tools::nfdc { using ndn::nfd::RibEntry; using ndn::nfd::Route; -/** \brief provides access to NFD RIB management +/** \brief Provides access to NFD RIB management. * \sa https://redmine.named-data.net/projects/nfd/wiki/RibMgmt */ class RibModule : public Module, noncopyable { public: - /** \brief register 'route list', 'route show', 'route add', 'route remove' commands + /** \brief Register 'route list', 'route show', 'route add', 'route remove' commands. */ static void registerCommands(CommandParser& parser); - /** \brief the 'route list' command + /** \brief The 'route list' command. */ static void list(ExecuteContext& ctx); - /** \brief the 'route show' command + /** \brief The 'route show' command. */ static void show(ExecuteContext& ctx); - /** \brief the 'route add' command + /** \brief The 'route add' command. */ static void add(ExecuteContext& ctx); - /** \brief the 'route remove' command + /** \brief The 'route remove' command. */ static void remove(ExecuteContext& ctx); @@ -83,21 +83,21 @@ private: static void listRoutesImpl(ExecuteContext& ctx, const RoutePredicate& filter); - /** \brief format a single status item as XML + /** \brief Format a single status item as XML. * \param os output stream * \param item status item */ void formatItemXml(std::ostream& os, const RibEntry& item) const; - /** \brief format a RibEntry as text + /** \brief Format a RibEntry as text. * \param os output stream * \param entry RIB entry */ static void formatEntryText(std::ostream& os, const RibEntry& entry); - /** \brief format a Route as text + /** \brief Format a Route as text. * \param os output stream * \param entry RIB entry * \param route RIB route within \p entry diff --git a/tools/nfdc/status-report.hpp b/tools/nfdc/status-report.hpp index 67ff429d..f1a84a64 100644 --- a/tools/nfdc/status-report.hpp +++ b/tools/nfdc/status-report.hpp @@ -46,7 +46,7 @@ enum class ReportFormat { std::ostream& operator<<(std::ostream& os, ReportFormat fmt); -/** \brief collects and prints NFD status report +/** \brief Collects and prints NFD status report. */ class StatusReport : noncopyable { @@ -56,7 +56,7 @@ public: ~StatusReport() = default; #endif - /** \brief collect status via chosen \p sections + /** \brief Collect status via chosen \p sections. * * This function is blocking. It has exclusive use of \p face. * @@ -66,13 +66,13 @@ public: uint32_t collect(Face& face, KeyChain& keyChain, Validator& validator, const CommandOptions& options); - /** \brief print an XML report + /** \brief Print an XML report. * \param os output stream */ void formatXml(std::ostream& os) const; - /** \brief print a text report + /** \brief Print a text report. * \param os output stream */ void @@ -83,7 +83,7 @@ private: processEvents(Face& face); public: - /** \brief modules through which status is collected + /** \brief Modules through which status is collected. */ std::vector> sections; }; diff --git a/tools/nfdc/status.cpp b/tools/nfdc/status.cpp index 081eea98..f0e4f9da 100644 --- a/tools/nfdc/status.cpp +++ b/tools/nfdc/status.cpp @@ -92,7 +92,7 @@ reportStatus(ExecuteContext& ctx, const StatusReportOptions& options) } } -/** \brief single-section status command +/** \brief Single-section status command. */ static void reportStatusSingleSection(ExecuteContext& ctx, bool StatusReportOptions::*wantSection) @@ -102,7 +102,7 @@ reportStatusSingleSection(ExecuteContext& ctx, bool StatusReportOptions::*wantSe reportStatus(ctx, options); } -/** \brief the 'status report' command +/** \brief The 'status report' command. */ static void reportStatusComprehensive(ExecuteContext& ctx) diff --git a/tools/nfdc/status.hpp b/tools/nfdc/status.hpp index c563ad79..2a1972ca 100644 --- a/tools/nfdc/status.hpp +++ b/tools/nfdc/status.hpp @@ -43,12 +43,12 @@ struct StatusReportOptions bool wantStrategyChoice = false; }; -/** \brief collect a status report and write to stdout +/** \brief Collect a status report and write to stdout. */ void reportStatus(ExecuteContext& ctx, const StatusReportOptions& options); -/** \brief registers status commands +/** \brief Registers status commands. * * Providing the following commands: * \li status report diff --git a/tools/nfdc/strategy-choice-module.hpp b/tools/nfdc/strategy-choice-module.hpp index 502d66b6..43ac78ba 100644 --- a/tools/nfdc/strategy-choice-module.hpp +++ b/tools/nfdc/strategy-choice-module.hpp @@ -33,33 +33,33 @@ namespace nfd::tools::nfdc { using ndn::nfd::StrategyChoice; -/** \brief provides access to NFD Strategy Choice management +/** \brief Provides access to NFD Strategy Choice management. * \sa https://redmine.named-data.net/projects/nfd/wiki/StrategyChoice */ class StrategyChoiceModule : public Module, noncopyable { public: - /** \brief register 'strategy list', 'strategy show', 'strategy set', 'strategy unset' commands + /** \brief Register 'strategy list', 'strategy show', 'strategy set', 'strategy unset' commands. */ static void registerCommands(CommandParser& parser); - /** \brief the 'strategy list' command + /** \brief The 'strategy list' command. */ static void list(ExecuteContext& ctx); - /** \brief the 'strategy show' command + /** \brief The 'strategy show' command. */ static void show(ExecuteContext& ctx); - /** \brief the 'strategy set' command + /** \brief The 'strategy set' command. */ static void set(ExecuteContext& ctx); - /** \brief the 'strategy unset' command + /** \brief The 'strategy unset' command. */ static void unset(ExecuteContext& ctx); @@ -73,7 +73,7 @@ public: void formatStatusXml(std::ostream& os) const override; - /** \brief format a single status item as XML + /** \brief Format a single status item as XML. * \param os output stream * \param item status item */ @@ -83,7 +83,7 @@ public: void formatStatusText(std::ostream& os) const override; - /** \brief format a single status item as text + /** \brief Format a single status item as text. * \param os output stream * \param item status item * \param wantMultiLine use multi-line style