42 , m_retxSuppression(RETX_SUPPRESSION_INITIAL,
48 BOOST_THROW_EXCEPTION(std::invalid_argument(
"BestRouteStrategy2 does not accept parameters"));
51 BOOST_THROW_EXCEPTION(std::invalid_argument(
60 static Name strategyName(
"/localhost/nfd/strategy/best-route/%FD%05");
75 const shared_ptr<pit::Entry>& pitEntry,
76 bool wantUnused =
false,
92 if (outRecord != pitEntry->out_end() && outRecord->getExpiry() > now) {
103 static inline fib::NextHopList::const_iterator
106 const shared_ptr<pit::Entry>& pitEntry)
108 fib::NextHopList::const_iterator
found = nexthops.end();
110 for (fib::NextHopList::const_iterator it = nexthops.begin(); it != nexthops.end(); ++it) {
114 BOOST_ASSERT(outRecord != pitEntry->out_end());
115 if (outRecord->getLastRenewed() < earliestRenewed) {
117 earliestRenewed = outRecord->getLastRenewed();
125 const shared_ptr<pit::Entry>& pitEntry)
136 fib::NextHopList::const_iterator it = nexthops.end();
140 it = std::find_if(nexthops.begin(), nexthops.end(),
142 false, time::steady_clock::TimePoint::min()));
144 if (it == nexthops.end()) {
145 NFD_LOG_DEBUG(interest <<
" from=" << inFace.getId() <<
" noNextHop");
148 nackHeader.
setReason(lp::NackReason::NO_ROUTE);
149 this->
sendNack(pitEntry, inFace, nackHeader);
155 Face& outFace = it->getFace();
158 <<
" newPitEntry-to=" << outFace.getId());
163 it = std::find_if(nexthops.begin(), nexthops.end(),
166 if (it != nexthops.end()) {
167 Face& outFace = it->getFace();
170 <<
" retransmit-unused-to=" << outFace.getId());
176 if (it == nexthops.end()) {
177 NFD_LOG_DEBUG(interest <<
" from=" << inFace.getId() <<
" retransmitNoNextHop");
180 Face& outFace = it->getFace();
183 <<
" retransmit-retry-to=" << outFace.getId());
189 const shared_ptr<pit::Entry>& pitEntry)
static ParsedInstanceName parseInstanceName(const Name &input)
parse a strategy instance name
PartialName parameters
parameter components
void afterReceiveNack(const Face &inFace, const lp::Nack &nack, const shared_ptr< pit::Entry > &pitEntry) override
trigger after Nack is received
static time_point now() noexcept
void sendNack(const shared_ptr< pit::Entry > &pitEntry, const Face &outFace, const lp::NackHeader &header)
send Nack to outFace
boost::posix_time::time_duration milliseconds(long duration)
Best Route strategy version 4.
static 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())
determines whether a NextHop is eligible
Interest is retransmission and should be suppressed.
void setInstanceName(const Name &name)
set strategy instance name
represents an Interest packet
#define NFD_LOG_DEBUG(expression)
void processNack(const Face &inFace, const lp::Nack &nack, const shared_ptr< pit::Entry > &pitEntry)
BestRouteStrategy2(Forwarder &forwarder, const Name &name=getStrategyName())
ndn::optional< uint64_t > version
whether strategyName contains a version component
represents a Network Nack
Table::const_iterator iterator
Copyright (c) 2011-2015 Regents of the University of California.
Interest is new (not a retransmission)
NFD_REGISTER_STRATEGY(AccessStrategy)
std::vector< fib::NextHop > NextHopList
const fib::Entry & lookupFib(const pit::Entry &pitEntry) const
performs a FIB lookup, considering Link object if present
void afterReceiveInterest(const Face &inFace, const Interest &interest, const shared_ptr< pit::Entry > &pitEntry) override
trigger after Interest is received
void rejectPendingInterest(const shared_ptr< pit::Entry > &pitEntry)
decide that a pending Interest cannot be forwarded
Represents an absolute name.
const NextHopList & getNextHops() const
represents a forwarding strategy
static const Name & getStrategyName()
This file contains common algorithms used by forwarding strategies.
static 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 Name makeInstanceName(const Name &input, const Name &strategyName)
construct a strategy instance name
std::string to_string(const V &v)
#define NFD_LOG_INIT(name)
a retransmission suppression decision algorithm that suppresses retransmissions using exponential bac...
void sendInterest(const shared_ptr< pit::Entry > &pitEntry, Face &outFace, const Interest &interest)
send Interest to outFace
bool wouldViolateScope(const Face &inFace, const Interest &interest, const Face &outFace)
determine whether forwarding the Interest in pitEntry to outFace would violate scope ...
RetxSuppressionResult decidePerPitEntry(pit::Entry &pitEntry)
determines whether Interest is a retransmission per pit entry and if so, whether it shall be forwarde...
represents a nexthop record in FIB entry