37 const time::milliseconds BestRouteStrategy2::RETX_SUPPRESSION_INITIAL(10);
38 const time::milliseconds BestRouteStrategy2::RETX_SUPPRESSION_MAX(250);
42 , m_retxSuppression(RETX_SUPPRESSION_INITIAL,
58 bool wantUnused =
false,
61 shared_ptr<Face> upstream = nexthop.
getFace();
64 if (upstream->getId() == currentDownstream)
68 if (pitEntry->violatesScope(*upstream))
73 pit::OutRecordCollection::const_iterator outRecord = pitEntry->getOutRecord(*upstream);
74 if (outRecord != pitEntry->getOutRecords().end() &&
75 outRecord->getExpiry() > now) {
86 static inline fib::NextHopList::const_iterator
91 fib::NextHopList::const_iterator found = nexthops.end();
93 for (fib::NextHopList::const_iterator it = nexthops.begin(); it != nexthops.end(); ++it) {
96 pit::OutRecordCollection::const_iterator outRecord = pitEntry->getOutRecord(*it->getFace());
97 BOOST_ASSERT(outRecord != pitEntry->getOutRecords().end());
98 if (outRecord->getLastRenewed() < earliestRenewed) {
100 earliestRenewed = outRecord->getLastRenewed();
109 shared_ptr<fib::Entry> fibEntry,
110 shared_ptr<pit::Entry> pitEntry)
113 fib::NextHopList::const_iterator it = nexthops.end();
118 it = std::find_if(nexthops.begin(), nexthops.end(),
120 false, time::steady_clock::TimePoint::min()));
122 if (it == nexthops.end()) {
123 NFD_LOG_DEBUG(interest <<
" from=" << inFace.getId() <<
" noNextHop");
126 nackHeader.
setReason(lp::NackReason::NO_ROUTE);
127 this->
sendNack(pitEntry, inFace, nackHeader);
133 shared_ptr<Face> outFace = it->getFace();
136 <<
" newPitEntry-to=" << outFace->getId());
147 it = std::find_if(nexthops.begin(), nexthops.end(),
150 if (it != nexthops.end()) {
151 shared_ptr<Face> outFace = it->getFace();
154 <<
" retransmit-unused-to=" << outFace->getId());
160 if (it == nexthops.end()) {
161 NFD_LOG_DEBUG(interest <<
" from=" << inFace.getId() <<
" retransmitNoNextHop");
164 shared_ptr<Face> outFace = it->getFace();
167 <<
" retransmit-retry-to=" << outFace->getId());
184 return static_cast<lp::NackReason>(std::min(static_cast<int>(x), static_cast<int>(y)));
189 shared_ptr<fib::Entry> fibEntry,
190 shared_ptr<pit::Entry> pitEntry)
192 int nOutRecordsNotNacked = 0;
193 Face* lastFaceNotNacked =
nullptr;
197 if (inNack ==
nullptr) {
198 ++nOutRecordsNotNacked;
199 lastFaceNotNacked = outR.getFace().get();
209 if (nOutRecordsNotNacked == 1) {
210 BOOST_ASSERT(lastFaceNotNacked !=
nullptr);
211 pit::InRecordCollection::const_iterator inR = pitEntry->getInRecord(*lastFaceNotNacked);
212 if (inR != pitEntry->getInRecords().end()) {
216 " nack-to(bidirectional)=" << lastFaceNotNacked->getId() <<
217 " out-nack=" << outNack.getReason());
218 this->
sendNack(pitEntry, *lastFaceNotNacked, outNack);
223 if (nOutRecordsNotNacked > 0) {
226 " waiting=" << nOutRecordsNotNacked);
234 " nack-to=all out-nack=" << outNack.getReason());
virtual void afterReceiveInterest(const Face &inFace, const Interest &interest, shared_ptr< fib::Entry > fibEntry, shared_ptr< pit::Entry > pitEntry) 1
trigger after Interest is received
#define NFD_LOG_DEBUG(expression)
virtual void afterReceiveNack(const Face &inFace, const lp::Nack &nack, shared_ptr< fib::Entry > fibEntry, shared_ptr< pit::Entry > pitEntry) 1
trigger after Nack is received
static time_point now() noexcept
Best Route strategy version 4.
Interest is retransmission and should be suppressed.
represents an Interest packet
NackReason
indicates the reason type of a network NACK
Interest is new (not a retransmission)
represents a Network Nack
NackReason getReason() const
void sendNacks(shared_ptr< pit::Entry > pitEntry, const lp::NackHeader &header, std::initializer_list< const Face *> exceptFaces=std::initializer_list< const Face *>())
send Nack to every face that has an in-record, except those in exceptFaces
Copyright (c) 2011-2015 Regents of the University of California.
lp::NackReason compareLessSevere(lp::NackReason x, lp::NackReason y)
NFD_REGISTER_STRATEGY(AccessStrategy)
std::vector< fib::NextHop > NextHopList
Name abstraction to represent an absolute name.
const shared_ptr< Face > & getFace() const
void rejectPendingInterest(shared_ptr< pit::Entry > pitEntry)
decide that a pending Interest cannot be forwarded
static const Name STRATEGY_NAME
represents a forwarding strategy
virtual Result decide(const Face &inFace, const Interest &interest, pit::Entry &pitEntry) const 1
determines whether Interest is a retransmission, and if so, whether it shall be forwarded or suppress...
static bool predicate_NextHop_eligible(const shared_ptr< pit::Entry > &pitEntry, const fib::NextHop &nexthop, FaceId currentDownstream, bool wantUnused=false, time::steady_clock::TimePoint now=time::steady_clock::TimePoint::min())
determines whether a NextHop is eligible
#define NFD_LOG_INIT(name)
contains information about an Interest toward an outgoing face
void sendInterest(shared_ptr< pit::Entry > pitEntry, shared_ptr< Face > outFace, bool wantNewNonce=false)
send Interest to outFace
BestRouteStrategy2(Forwarder &forwarder, const Name &name=STRATEGY_NAME)
void sendNack(shared_ptr< pit::Entry > pitEntry, const Face &outFace, const lp::NackHeader &header)
send Nack to outFace
uint64_t FaceId
identifies a face
a retransmission suppression decision algorithm that suppresses retransmissions using exponential bac...
static fib::NextHopList::const_iterator findEligibleNextHopWithEarliestOutRecord(const shared_ptr< pit::Entry > &pitEntry, const fib::NextHopList &nexthops, FaceId currentDownstream)
pick an eligible NextHop with earliest OutRecord
const Interest & getInterest() const
represents a nexthop record in FIB entry