docs: fix capitalization in doxygen comments

Change-Id: Ibf5ee5119d12d60d382b0acef8dfd08277c18fcb
This commit is contained in:
Davide Pesavento committed 2022-10-29 21:45:24 -04:00
1 parent b83d3df256
commit aa9e3b2148
136 files changed
+1359 -1382

No files matched your search

+14 -9
View File
@@ -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<const ConfigSection&>;
/** \brief callback to process a config file section
/**
* \brief Callback to process a configuration file section.
*/
using ConfigSectionHandler = std::function<void(const ConfigSection& section, bool isDryRun,
const std::string& filename)>;
/** \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<void(const std::string& filename,
const std::string& sectionName,
const ConfigSection& section,
bool isDryRun)>;
/** \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<typename T>
@@ -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);
+15 -12
View File
@@ -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
{
+5 -3
View File
@@ -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
{
+2 -2
View File
@@ -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;
}
+10 -7
View File
@@ -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;
+1 -5
View File
@@ -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;
};
/**
+4 -6
View File
@@ -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<std::pair<std::string, ethernet::Address>, shared_ptr<Face>> m_mcastFaces;
signal::ScopedConnection m_netifAddConn;
+3 -3
View File
@@ -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;
+15 -13
View File
@@ -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<const ProtocolFactory*>
[[nodiscard]] std::set<const ProtocolFactory*>
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<std::string, unique_ptr<ProtocolFactory>> m_factories;
unique_ptr<NetdevBound> m_netdevBound;
private:
/** \brief scheme => protocol factory
/** \brief Scheme => protocol factory.
*
* The same protocol factory may be available under multiple schemes.
*/
+58 -58
View File
@@ -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<LinkService> service, unique_ptr<Transport> 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<LinkService, Interest, EndpointId>& afterReceiveInterest;
/** \brief signals on Data received
/** \brief Signals on Data received.
*/
signal::Signal<LinkService, Data, EndpointId>& afterReceiveData;
/** \brief signals on Nack received
/** \brief Signals on Nack received.
*/
signal::Signal<LinkService, lp::Nack, EndpointId>& 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<LinkService, Interest>& 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<Transport, FaceState/*old*/, FaceState/*new*/>& 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<Channel>
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> channel)
@@ -209,18 +233,6 @@ private:
weak_ptr<Channel> 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();
+56 -61
View File
@@ -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<LpReassembler> 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<ssize_t>::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<lp::Packet>& 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
+3 -3
View File
@@ -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.
+2 -10
View File
@@ -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);
+59 -68
View File
@@ -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<LinkService, Interest, EndpointId> afterReceiveInterest;
/** \brief signals on Data received
/** \brief Signals on Data received.
*/
signal::Signal<LinkService, Data, EndpointId> afterReceiveData;
/** \brief signals on Nack received
/** \brief Signals on Nack received.
*/
signal::Signal<LinkService, lp::Nack, EndpointId> 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<LinkService, Interest> 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
{
+5 -5
View File
@@ -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
+11 -11
View File
@@ -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<bool, Block, lp::Packet>
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
+28 -29
View File
@@ -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<LpReliability, Interest> 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<lp::Packet>& 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<lp::Sequence, UnackedFrag>;
/** \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<lp::Sequence>
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<lp::Sequence>
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> 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<lp::Sequence> m_ackQueue;
std::map<lp::Sequence, time::steady_clock::TimePoint> m_recentRecvSeqs;
std::map<lp::Sequence, time::steady_clock::time_point> m_recentRecvSeqs;
std::queue<lp::Sequence> m_recentRecvSeqsQueue;
lp::Sequence m_lastTxSeqNo;
scheduler::ScopedEventId m_idleAckTimer;
+2 -2
View File
@@ -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,
+1 -2
View File
@@ -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();
}
+3 -7
View File
@@ -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
+32 -22
View File
@@ -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<ndn::net::NetworkMonitor> 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<typename PF>
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<ProtocolFactory>
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<std::string>
[[nodiscard]] static std::set<std::string>
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.<factory-id>` 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<std::string>&
getProvidedSchemes() const
getProvidedSchemes() const noexcept
{
return providedSchemes;
}
+1 -1
View File
@@ -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
+2 -4
View File
@@ -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;
+3 -14
View File
@@ -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);
+154 -194
View File
@@ -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<Transport, TransportState/*old*/, TransportState/*new*/> 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<Transport>& flh);
+5 -7
View File
@@ -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<shared_ptr<const Channel>>
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<shared_ptr<Face>>
applyMcastConfigToNetif(const shared_ptr<const ndn::net::NetworkInterface>& 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);
+6 -3
View File
@@ -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()
+1 -1
View File
@@ -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());
}
}
+1 -1
View File
@@ -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());
}
}
+2 -4
View File
@@ -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;
+2 -4
View File
@@ -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;
+9 -10
View File
@@ -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);
+16 -15
View File
@@ -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<Name, MtInfo*>
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<pit::Entry>& 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<pit::Entry>& 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
*/
+9 -9
View File
@@ -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<pit::Entry>& 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<pit::Entry>& 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
+6 -5
View File
@@ -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
{
+11 -10
View File
@@ -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<BestRouteStrategy>
+2 -7
View File
@@ -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();
}
+12 -16
View File
@@ -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> face);
/** \brief add a special face with a reserved FaceId
/** \brief Add a special face with a reserved FaceId.
*/
void
addReserved(shared_ptr<Face> 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<Face> 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<FaceId, shared_ptr<Face>>;
using ForwardRange = boost::indirected_range<const boost::select_second_const_range<FaceMap>>;
/** \brief ForwardIterator for Face&
*/
using const_iterator = boost::range_iterator<ForwardRange>::type;
const_iterator
@@ -101,7 +97,7 @@ private:
getForwardRange() const;
private:
FaceId m_lastFaceId;
FaceId m_lastFaceId = face::FACEID_RESERVED_MAX;
FaceMap m_faces;
};
+1 -3
View File
@@ -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)
{
+30 -28
View File
@@ -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<fw::UnsolicitedDataPolicy> policy)
setUnsolicitedDataPolicy(unique_ptr<fw::UnsolicitedDataPolicy> 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<pit::Entry>& 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<pit::Entry>& 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<pit::Entry>& pitEntry);
/** \brief Interest finalize pipeline
/** \brief Interest finalize pipeline.
*/
NFD_VIRTUAL_WITH_TESTS void
onInterestFinalize(const shared_ptr<pit::Entry>& 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<pit::Entry>& 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
{
+2 -1
View File
@@ -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
{
+3 -2
View File
@@ -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<RandomStrategy>
+1 -3
View File
@@ -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;
};
+5 -5
View File
@@ -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);
+5 -4
View File
@@ -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;
+3 -3
View File
@@ -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.
*
+11 -10
View File
@@ -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<pit::Entry>& 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<pit::Entry>& 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<pit::Entry>& 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<pit::Entry>& 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<pit::Entry>& 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);
+2 -1
View File
@@ -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
{
+35 -28
View File
@@ -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<typename S>
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<Strategy>
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<Name>
[[nodiscard]] static std::set<Name>
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;
}
+7 -6
View File
@@ -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<CommandAuthenticator>, 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<std::string, shared_ptr<ndn::security::Validator>> m_validators;
};
+4 -3
View File
@@ -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
+1 -1
View File
@@ -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);
+5 -4
View File
@@ -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();
+1 -1
View File
@@ -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));
+122 -98
View File
@@ -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<FibUpdate>;
using FibUpdateSuccessCallback = std::function<void(RibUpdateList inheritedRoutes)>;
using FibUpdateFailureCallback = std::function<void(uint32_t code, const std::string& error)>;
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;
};
@@ -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.
@@ -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
{
@@ -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<void()> successCb,
std::function<void(const std::string&)> failureCb) override;
/** \brief remove a name prefix from NFD RIB
/** \brief Remove a name prefix from NFD RIB.
*/
void
withdraw(const ReadvertisedRoute& rr,
@@ -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<ReadvertiseDestination, bool> afterAvailabilityChange;
@@ -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<ReadvertiseAction>
handleNewRoute(const RibRouteRef& ribRoute) const = 0;
+2 -2
View File
@@ -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<RibRouteRef, ReadvertisedRouteContainer::iterator> m_routeToRr;
@@ -33,7 +33,7 @@
namespace nfd::rib {
/** \brief state of a readvertised route
/** \brief State of a readvertised route.
*/
class ReadvertisedRoute : noncopyable
{
+22 -18
View File
@@ -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<RibEntry::iterator, bool>
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,
+29 -28
View File
@@ -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<void()>;
using UpdateFailureCallback = std::function<void(uint32_t code, const std::string& error)>;
/** \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<Route, RouteComparePredicate>;
/** \brief find entries under \p prefix
/** \brief Find entries under \p prefix.
* \pre a RIB entry exists at \p prefix
*/
std::list<shared_ptr<RibEntry>>
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<shared_ptr<RibEntry>>
@@ -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<Rib, Name> 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<Rib, Name> afterEraseEntry;
/** \brief signals after a Route is added
/** \brief Signals after a Route is added.
*/
signal::Signal<Rib, RibRouteRef> afterAddRoute;
/** \brief signals before a route is removed
/** \brief Signals before a route is removed.
*/
signal::Signal<Rib, RibRouteRef> beforeRemoveRoute;
private:
RibTable m_rib;
std::multimap<uint64_t, shared_ptr<RibEntry>> m_faceEntries; ///< FaceId => Entry with Route on this face
// FaceId => Entry with Route on this face
std::multimap<uint64_t, shared_ptr<RibEntry>> m_faceEntries;
size_t m_nItems = 0;
FibUpdater* m_fibUpdater = nullptr;
+3 -3
View File
@@ -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<Route>
{
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
*/
+5 -8
View File
@@ -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;
}
+5 -5
View File
@@ -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.
+11 -11
View File
@@ -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<const Data> 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<const Data> 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.
*/
+2 -2
View File
@@ -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);
+5 -5
View File
@@ -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);
+30 -25
View File
@@ -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<Policy>
create(const std::string& policyName);
/** \return a list of available policy names
/**
* \brief Returns a list of available policy names.
*/
static std::set<std::string>
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<Policy, EntryRef> 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) \
+2 -2
View File
@@ -157,7 +157,7 @@ Cs::setPolicyImpl(unique_ptr<Policy> 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;
+20 -20
View File
@@ -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> 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;
+3 -3
View File
@@ -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<NextHopList::iterator, bool>
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();
+12 -10
View File
@@ -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<Fib, Name, NextHop> afterNewNextHop;
+17 -18
View File
@@ -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*
+2 -2
View File
@@ -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;
+26 -22
View File
@@ -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<bool(const Entry&)>;
/** \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<typename T>
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<typename K>
Entry*
+13 -10
View File
@@ -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<Entry*>&
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<typename ENTRY>
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;
+29 -29
View File
@@ -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<HashValue>;
/** \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<size_t>::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<size_t>::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<const Node*, bool>
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);
+1 -8
View File
@@ -37,18 +37,11 @@ BOOST_CONCEPT_ASSERT((boost::ForwardRangeConcept<Range>));
NFD_LOG_INIT(NameTreeIterator);
Iterator::Iterator()
: m_entry(nullptr)
, m_ref(nullptr)
, m_state(0)
{
}
Iterator::Iterator() = default;
Iterator::Iterator(shared_ptr<EnumerationImpl> 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);
+25 -21
View File
@@ -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<bool(const Entry&)>;
/** \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<std::pair<bool, bool>(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<bool, bool>
operator()(const Entry&) const
constexpr std::pair<bool, bool>
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<EnumerationImpl> 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.
+2 -2
View File
@@ -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<Name>
{
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
+12 -12
View File
@@ -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<InRecord>;
/**
* \brief An unordered collection of out-records
* \brief An unordered collection of out-records.
*/
using OutRecordCollection = std::list<OutRecord>;
@@ -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;
+14 -13
View File
@@ -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
+3 -2
View File
@@ -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;
+3 -2
View File
@@ -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
*/
+11 -10
View File
@@ -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();
}
+4 -4
View File
@@ -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 = {});
+4 -4
View File
@@ -63,7 +63,7 @@ protected:
}
}
/** \brief returns the first running interface
/** \brief Returns the first running interface.
*/
shared_ptr<ndn::net::NetworkInterface>
getRunningNetif() const
@@ -77,7 +77,7 @@ protected:
return nullptr;
}
/** \brief create a UnicastEthernetTransport
/** \brief Create a UnicastEthernetTransport.
*/
void
initializeUnicast(shared_ptr<ndn::net::NetworkInterface> netif = nullptr,
@@ -93,7 +93,7 @@ protected:
transport = make_unique<UnicastEthernetTransport>(*netif, remoteEp, persistency, 2_s);
}
/** \brief create a MulticastEthernetTransport
/** \brief Create a MulticastEthernetTransport.
*/
void
initializeMulticast(shared_ptr<ndn::net::NetworkInterface> netif = nullptr,
@@ -112,7 +112,7 @@ protected:
protected:
LimitedIo limitedIo;
/** \brief EthernetTransport-capable network interfaces
/** \brief EthernetTransport-capable network interfaces.
*/
std::vector<shared_ptr<const ndn::net::NetworkInterface>> netifs;
+5 -5
View File
@@ -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<typename FactoryType>
class FaceSystemFactoryFixture : public FaceSystemFixture
+2 -2
View File
@@ -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
+8 -8
View File
@@ -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_<static_cast<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<TRANSPORT_STATE_C(UP),
@@ -98,14 +98,14 @@ typedef mpl::map<
>>
> StateEntering;
/** \brief a sequence of all valid TransportStates
/** \brief A sequence of all valid TransportStates.
*/
typedef mpl::fold<StateEntering,
mpl::vector<>,
mpl::push_back<mpl::_1, mpl::first<mpl::_2>>
>::type States;
/** \brief a set of all valid state transitions
/** \brief A set of all valid state transitions.
*/
typedef mpl::set<
mpl::pair<TRANSPORT_STATE_C(UP), TRANSPORT_STATE_C(DOWN)>,
@@ -118,8 +118,8 @@ typedef mpl::set<
mpl::pair<TRANSPORT_STATE_C(FAILED), TRANSPORT_STATE_C(CLOSED)>
> 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<typename FromState, typename Result>
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,
+6 -6
View File
@@ -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<shared_ptr<const NetworkInterface>> netifs;
/** \brief MulticastUdpTransport-capable network interfaces (IPv4 only)
/** \brief MulticastUdpTransport-capable network interfaces (IPv4 only).
*/
std::vector<shared_ptr<const NetworkInterface>> netifsV4;
/** \brief MulticastUdpTransport-capable network interfaces (IPv6 only)
/** \brief MulticastUdpTransport-capable network interfaces (IPv6 only).
*/
std::vector<shared_ptr<const NetworkInterface>> netifsV6;
};
@@ -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<const ndn::net::NetworkInterface>&,
+1 -1
View File
@@ -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
+6 -6
View File
@@ -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<uint64_t>::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<pit::Entry>& pitEntry) override;
protected:
/** \brief register an alias
/** \brief Register an alias.
* \tparam S subclass of DummyStrategy
*/
template<typename S>
@@ -112,7 +112,7 @@ public:
};
/**
* \brief DummyStrategy with specific version
* \brief DummyStrategy with specific version.
*/
template<uint64_t VERSION>
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.
+1 -1
View File
@@ -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)
+2 -2
View File
@@ -68,11 +68,11 @@ public:
return name;
}
/** \brief Signal emitted after each action
/** \brief Signal emitted after each action.
*/
signal::Signal<StrategyTester<S>> 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
*/
+35 -35
View File
@@ -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<TopologyNode, NodeTransport> 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<Face> 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<ndn::Face> 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<Observer> m_observer;
};
/** \brief captured packets on a face
/** \brief Captured packets on a face.
*/
class TopologyPcap : noncopyable
{
@@ -236,16 +236,16 @@ public:
std::vector<lp::Nack> sentNacks;
};
/** \brief captured packet timestamp tag
/** \brief Captured packet timestamp tag.
*/
using TopologyPcapTimestamp = ndn::SimpleTag<time::steady_clock::time_point, 0>;
/** \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<S>(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<TopologyLink>
addLink(const std::string& label, time::nanoseconds delay,
std::initializer_list<TopologyNode> 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<TopologyAppLink>
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<TopologyAppLink>
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<TopologyBareLink>
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
*/
Loaded 100 of 136 files, more files were not shown because too many files have changed in this diff. Show more