36 const time::milliseconds BestRouteStrategy2::RETX_SUPPRESSION_INITIAL(10);
37 const time::milliseconds BestRouteStrategy2::RETX_SUPPRESSION_MAX(250);
42 , m_retxSuppression(RETX_SUPPRESSION_INITIAL,
48 NDN_THROW(std::invalid_argument(
"BestRouteStrategy2 does not accept parameters"));
51 NDN_THROW(std::invalid_argument(
52 "BestRouteStrategy2 does not support version " + to_string(*parsed.
version)));
60 static Name strategyName(
"/localhost/nfd/strategy/best-route/%FD%05");
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");
87 lp::NackHeader nackHeader;
88 nackHeader.setReason(lp::NackReason::NO_ROUTE);
95 Face& outFace = it->getFace();
96 NFD_LOG_DEBUG(interest <<
" from=" << ingress <<
" newPitEntry-to=" << outFace.
getId());
102 it = std::find_if(nexthops.begin(), nexthops.end(),
103 [&, now = time::steady_clock::now()] (
const auto& nexthop) {
107 if (it != nexthops.end()) {
108 Face& outFace = it->getFace();
110 NFD_LOG_DEBUG(interest <<
" from=" << ingress <<
" retransmit-unused-to=" << outFace.
getId());
116 if (it == nexthops.end()) {
117 NFD_LOG_DEBUG(interest <<
" from=" << ingress <<
" retransmitNoNextHop");
120 Face& outFace = it->getFace();
122 NFD_LOG_DEBUG(interest <<
" from=" << ingress <<
" retransmit-retry-to=" << outFace.
getId());
128 const shared_ptr<pit::Entry>& pitEntry)
Main class of NFD's forwarding engine.
void setInstanceName(const Name &name)
Set strategy instance name.
bool sendNack(const shared_ptr< pit::Entry > &pitEntry, Face &egress, const lp::NackHeader &header)
Send a Nack packet.
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
static const Name & getStrategyName()
BestRouteStrategy2(Forwarder &forwarder, const Name &name=getStrategyName())
Interest is retransmission and should be suppressed.
static Name makeInstanceName(const Name &input, const Name &strategyName)
Construct a strategy instance name.
void afterReceiveInterest(const FaceEndpoint &ingress, const Interest &interest, const shared_ptr< pit::Entry > &pitEntry) override
Trigger after Interest is received.
const fib::Entry & lookupFib(const pit::Entry &pitEntry) const
Performs a FIB lookup, considering Link object if present.
Represents a face-endpoint pair in the forwarder.
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
Interest is new (not a retransmission)
void afterReceiveNack(const FaceEndpoint &ingress, const lp::Nack &nack, const shared_ptr< pit::Entry > &pitEntry) override
Trigger after Nack is received.
bool isNextHopEligible(const Face &inFace, const Interest &interest, const fib::NextHop &nexthop, const shared_ptr< pit::Entry > &pitEntry, bool wantUnused, time::steady_clock::TimePoint now)
determines whether a NextHop is eligible i.e.
a retransmission suppression decision algorithm that suppresses retransmissions using exponential bac...
generalization of a network interface
Represents a collection of nexthops.
PartialName parameters
parameter components
RetxSuppressionResult decidePerPitEntry(pit::Entry &pitEntry)
determines whether Interest is a retransmission per pit entry and if so, whether it shall be forwarde...
Represents a forwarding strategy.
This file contains common algorithms used by forwarding strategies.
const NextHopList & getNextHops() const
#define NFD_LOG_INIT(name)
static ParsedInstanceName parseInstanceName(const Name &input)
Parse a strategy instance name.
void processNack(const Face &inFace, const lp::Nack &nack, const shared_ptr< pit::Entry > &pitEntry)
NFD_REGISTER_STRATEGY(SelfLearningStrategy)
void rejectPendingInterest(const shared_ptr< pit::Entry > &pitEntry)
Schedule the PIT entry for immediate deletion.
pit::OutRecord * sendInterest(const shared_ptr< pit::Entry > &pitEntry, Face &egress, const Interest &interest)
Send an Interest packet.
optional< uint64_t > version
whether strategyName contains a version component