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);
89 this->
sendNack(pitEntry, ingress, nackHeader);
96 NFD_LOG_DEBUG(interest <<
" from=" << ingress <<
" newPitEntry-to=" << egress);
102 it = std::find_if(nexthops.begin(), nexthops.end(), [&] (
const auto& nexthop) {
103 return isNextHopEligible(ingress.
face, interest, nexthop, pitEntry,
true, time::steady_clock::now());
106 if (it != nexthops.end()) {
109 NFD_LOG_DEBUG(interest <<
" from=" << ingress <<
" retransmit-unused-to=" << egress);
115 if (it == nexthops.end()) {
116 NFD_LOG_DEBUG(interest <<
" from=" << ingress <<
" retransmitNoNextHop");
121 NFD_LOG_DEBUG(interest <<
" from=" << ingress <<
" retransmit-retry-to=" << egress);
127 const shared_ptr<pit::Entry>& pitEntry)
Main class of NFD forwarding engine.
void setInstanceName(const Name &name)
set strategy instance name
void sendNack(const shared_ptr< pit::Entry > &pitEntry, const FaceEndpoint &egress, const lp::NackHeader &header)
send Nack to egress
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
void sendInterest(const shared_ptr< pit::Entry > &pitEntry, const FaceEndpoint &egress, const Interest &interest)
send Interest to egress
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...
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.
#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)
const NextHopList & getNextHops() const
void rejectPendingInterest(const shared_ptr< pit::Entry > &pitEntry)
schedule the PIT entry for immediate deletion
const fib::Entry & lookupFib(const pit::Entry &pitEntry) const
performs a FIB lookup, considering Link object if present
optional< uint64_t > version
whether strategyName contains a version component