42 , m_retxSuppression(RETX_SUPPRESSION_INITIAL,
48 NDN_THROW(std::invalid_argument(
"BestRouteStrategy does not accept parameters"));
52 "BestRouteStrategy does not support version " +
to_string(*parsed.
version)));
60 static const auto strategyName =
Name(
"/localhost/nfd/strategy/best-route").appendVersion(5);
66 const shared_ptr<pit::Entry>& pitEntry)
70 NFD_LOG_DEBUG(interest <<
" from=" << ingress <<
" suppressed");
76 auto it = nexthops.end();
80 it = std::find_if(nexthops.begin(), nexthops.end(), [&] (
const auto& nexthop) {
84 if (it == nexthops.end()) {
85 NFD_LOG_DEBUG(interest <<
" from=" << ingress <<
" noNextHop");
88 nackHeader.
setReason(lp::NackReason::NO_ROUTE);
94 Face& outFace = it->getFace();
95 NFD_LOG_DEBUG(interest <<
" from=" << ingress <<
" newPitEntry-to=" << outFace.getId());
101 it = std::find_if(nexthops.begin(), nexthops.end(),
106 if (it != nexthops.end()) {
107 Face& outFace = it->getFace();
109 NFD_LOG_DEBUG(interest <<
" from=" << ingress <<
" retransmit-unused-to=" << outFace.getId());
115 if (it == nexthops.end()) {
116 NFD_LOG_DEBUG(interest <<
" from=" << ingress <<
" retransmitNoNextHop");
119 Face& outFace = it->getFace();
121 NFD_LOG_DEBUG(interest <<
" from=" << ingress <<
" retransmit-retry-to=" << outFace.getId());
127 const shared_ptr<pit::Entry>& pitEntry)
static const time::milliseconds RETX_SUPPRESSION_MAX
static ParsedInstanceName parseInstanceName(const Name &input)
Parse a strategy instance name.
#define NFD_LOG_INIT(name)
std::string to_string(const T &val)
Represents a face-endpoint pair in the forwarder.
PartialName parameters
parameter components
static time_point now() noexcept
fib::NextHopList::const_iterator findEligibleNextHopWithEarliestOutRecord(const Face &inFace, const Interest &interest, const fib::NextHopList &nexthops, const shared_ptr< pit::Entry > &pitEntry)
pick an eligible NextHop with earliest out-record
Main class of NFD's forwarding engine.
Interest is retransmission and should be suppressed.
void setInstanceName(const Name &name)
Set strategy instance name.
Represents an Interest packet.
BestRouteStrategy(Forwarder &forwarder, const Name &name=getStrategyName())
Represents a collection of nexthops.
NFD_VIRTUAL_WITH_TESTS void rejectPendingInterest(const shared_ptr< pit::Entry > &pitEntry)
Schedule the PIT entry for immediate deletion.
represents a Network Nack
static const Name & getStrategyName()
void afterReceiveInterest(const Interest &interest, const FaceEndpoint &ingress, const shared_ptr< pit::Entry > &pitEntry) override
Trigger after an Interest is received.
void processNack(const lp::Nack &nack, const Face &inFace, const shared_ptr< pit::Entry > &pitEntry)
Copyright (c) 2011-2015 Regents of the University of California.
Interest is new (not a retransmission)
RetxSuppressionExponential m_retxSuppression
NFD_REGISTER_STRATEGY(AccessStrategy)
Represents an absolute name.
NFD_VIRTUAL_WITH_TESTS bool sendNack(const lp::NackHeader &header, Face &egress, const shared_ptr< pit::Entry > &pitEntry)
Send a Nack packet.
Represents a forwarding strategy.
optional< uint64_t > version
whether strategyName contains a version component
This file contains common algorithms used by forwarding strategies.
void afterReceiveNack(const lp::Nack &nack, const FaceEndpoint &ingress, const shared_ptr< pit::Entry > &pitEntry) override
Trigger after a Nack is received.
const fib::Entry & lookupFib(const pit::Entry &pitEntry) const
Performs a FIB lookup, considering Link object if present.
bool isNextHopEligible(const Face &inFace, const Interest &interest, const fib::NextHop &nexthop, const shared_ptr< pit::Entry > &pitEntry, bool wantUnused, time::steady_clock::time_point now)
static Name makeInstanceName(const Name &input, const Name &strategyName)
Construct a strategy instance name.
const NextHopList & getNextHops() const
NFD_VIRTUAL_WITH_TESTS pit::OutRecord * sendInterest(const Interest &interest, Face &egress, const shared_ptr< pit::Entry > &pitEntry)
Send an Interest packet.
a retransmission suppression decision algorithm that suppresses retransmissions using exponential bac...
RetxSuppressionResult decidePerPitEntry(pit::Entry &pitEntry)
determines whether Interest is a retransmission per pit entry and if so, whether it shall be forwarde...
boost::chrono::milliseconds milliseconds