37 const time::milliseconds MulticastStrategy::RETX_SUPPRESSION_INITIAL(10);
38 const time::milliseconds MulticastStrategy::RETX_SUPPRESSION_MAX(250);
43 , m_retxSuppression(RETX_SUPPRESSION_INITIAL,
49 BOOST_THROW_EXCEPTION(std::invalid_argument(
"MulticastStrategy does not accept parameters"));
52 BOOST_THROW_EXCEPTION(std::invalid_argument(
53 "MulticastStrategy does not support version " + std::to_string(*parsed.
version)));
61 static Name strategyName(
"/localhost/nfd/strategy/multicast/%FD%03");
67 const shared_ptr<pit::Entry>& pitEntry)
72 int nEligibleNextHops = 0;
74 bool isSuppressed =
false;
76 for (
const auto& nexthop : nexthops) {
77 Face& outFace = nexthop.getFace();
83 <<
"to=" << outFace.getId() <<
" suppressed");
88 if ((outFace.getId() == inFace.getId() && outFace.getLinkType() != ndn::nfd::LINK_TYPE_AD_HOC) ||
95 <<
" pitEntry-to=" << outFace.getId());
103 if (nEligibleNextHops == 0 && !isSuppressed) {
104 NFD_LOG_DEBUG(interest <<
" from=" << inFace.getId() <<
" noNextHop");
106 lp::NackHeader nackHeader;
107 nackHeader.setReason(lp::NackReason::NO_ROUTE);
108 this->
sendNack(pitEntry, inFace, nackHeader);
116 const shared_ptr<pit::Entry>& pitEntry)
Interest is retransmission and should be forwarded.
void setInstanceName(const Name &name)
set strategy instance name
#define NFD_LOG_DEBUG(expression)
void incrementIntervalForOutRecord(pit::OutRecord &outRecord)
Increment the suppression interval for out record.
void sendInterest(const shared_ptr< pit::Entry > &pitEntry, Face &outFace, const Interest &interest)
send Interest to outFace
void sendNack(const shared_ptr< pit::Entry > &pitEntry, const Face &outFace, const lp::NackHeader &header)
send Nack to outFace
Interest is retransmission and should be suppressed.
static Name makeInstanceName(const Name &input, const Name &strategyName)
construct a strategy instance name
RetxSuppressionResult decidePerUpstream(pit::Entry &pitEntry, Face &outFace)
determines whether Interest is a retransmission per upstream and if so, whether it shall be forwarded...
static const Name & getStrategyName()
void afterReceiveInterest(const Face &inFace, const Interest &interest, const shared_ptr< pit::Entry > &pitEntry) override
trigger after Interest is received
#define NFD_REGISTER_STRATEGY(S)
registers a strategy
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
a retransmission suppression decision algorithm that suppresses retransmissions using exponential bac...
std::vector< fib::NextHop > NextHopList
MulticastStrategy(Forwarder &forwarder, const Name &name=getStrategyName())
PartialName parameters
parameter components
ndn::optional< uint64_t > version
whether strategyName contains a version component
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)
bool wouldViolateScope(const Face &inFace, const Interest &interest, const Face &outFace)
determine whether forwarding the Interest in pitEntry to outFace would violate scope ...
const NextHopList & getNextHops() const
void afterReceiveNack(const Face &inFace, const lp::Nack &nack, const shared_ptr< pit::Entry > &pitEntry) override
trigger after Nack is received
void rejectPendingInterest(const shared_ptr< pit::Entry > &pitEntry)
decide that a pending Interest cannot be forwarded
const fib::Entry & lookupFib(const pit::Entry &pitEntry) const
performs a FIB lookup, considering Link object if present