38 const time::milliseconds BestRouteStrategy2::RETX_SUPPRESSION_INITIAL(10);
39 const time::milliseconds BestRouteStrategy2::RETX_SUPPRESSION_MAX(250);
43 , m_retxSuppression(RETX_SUPPRESSION_INITIAL,
60 const shared_ptr<pit::Entry>& pitEntry,
61 bool wantUnused =
false,
67 if (&outFace == &inFace)
77 if (outRecord != pitEntry->out_end() && outRecord->getExpiry() > now) {
88 static inline fib::NextHopList::const_iterator
91 const shared_ptr<pit::Entry>& pitEntry)
93 fib::NextHopList::const_iterator found = nexthops.end();
95 for (fib::NextHopList::const_iterator it = nexthops.begin(); it != nexthops.end(); ++it) {
99 BOOST_ASSERT(outRecord != pitEntry->out_end());
100 if (outRecord->getLastRenewed() < earliestRenewed) {
102 earliestRenewed = outRecord->getLastRenewed();
110 const shared_ptr<pit::Entry>& pitEntry)
121 fib::NextHopList::const_iterator it = nexthops.end();
125 it = std::find_if(nexthops.begin(), nexthops.end(),
127 false, time::steady_clock::TimePoint::min()));
129 if (it == nexthops.end()) {
133 nackHeader.
setReason(lp::NackReason::NO_ROUTE);
134 this->
sendNack(pitEntry, inFace, nackHeader);
140 Face& outFace = it->getFace();
143 <<
" newPitEntry-to=" << outFace.
getId());
148 it = std::find_if(nexthops.begin(), nexthops.end(),
151 if (it != nexthops.end()) {
152 Face& outFace = it->getFace();
155 <<
" retransmit-unused-to=" << outFace.
getId());
161 if (it == nexthops.end()) {
165 Face& outFace = it->getFace();
168 <<
" retransmit-retry-to=" << outFace.
getId());
185 return static_cast<lp::NackReason>(std::min(static_cast<int>(x), static_cast<int>(y)));
190 const shared_ptr<pit::Entry>& pitEntry)
192 int nOutRecordsNotNacked = 0;
193 Face* lastFaceNotNacked =
nullptr;
197 if (inNack ==
nullptr) {
198 ++nOutRecordsNotNacked;
199 lastFaceNotNacked = &outR.getFace();
209 if (nOutRecordsNotNacked == 1) {
210 BOOST_ASSERT(lastFaceNotNacked !=
nullptr);
212 if (inR != pitEntry->in_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);
233 " nack-to=all out-nack=" << outNack.getReason());
generalization of a network interface
virtual 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
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.
represents an Interest packet
#define NFD_LOG_DEBUG(expression)
NackReason
indicates the reason type of a network NACK
Interest is new (not a retransmission)
represents a Network Nack
NackReason getReason() const
Table::const_iterator iterator
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
virtual 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
virtual Result decide(const Face &inFace, const Interest &interest, pit::Entry &pitEntry) const override
determines whether Interest is a retransmission, and if so, whether it shall be forwarded or suppress...
Name abstraction to represent an absolute name.
static const Name STRATEGY_NAME
represents a forwarding strategy
void sendNacks(const 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) 2014-2016, Regents of the University of California, Arizona Board of Regents...
const fib::Entry & lookupFib(const pit::Entry &pitEntry) const
performs a FIB lookup, considering Link object if present
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
contains information about an Interest toward an outgoing face
BestRouteStrategy2(Forwarder &forwarder, const Name &name=STRATEGY_NAME)
const NextHopList & getNextHops() const
#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 ...
const Interest & getInterest() const
represents a nexthop record in FIB entry