43 NDN_THROW(std::invalid_argument(
"RandomStrategy does not accept parameters"));
55 static const auto strategyName =
Name(
"/localhost/nfd/strategy/random").appendVersion(1);
61 const shared_ptr<pit::Entry>& pitEntry)
70 NFD_LOG_DEBUG(interest <<
" from=" << ingress <<
" no nexthop");
73 nackHeader.
setReason(lp::NackReason::NO_ROUTE);
80 this->
sendInterest(interest, nhs.front().getFace(), pitEntry);
85 const shared_ptr<pit::Entry>& pitEntry)
static ParsedInstanceName parseInstanceName(const Name &input)
Parse a strategy instance name.
#define NFD_LOG_INIT(name)
std::string to_string(const T &val)
Represents a face-endpoint pair in the forwarder.
PartialName parameters
parameter components
RandomStrategy(Forwarder &forwarder, const Name &name=getStrategyName())
Main class of NFD's forwarding engine.
void setInstanceName(const Name &name)
Set strategy instance name.
Represents an Interest packet.
Represents a collection of nexthops.
NFD_VIRTUAL_WITH_TESTS void rejectPendingInterest(const shared_ptr< pit::Entry > &pitEntry)
Schedule the PIT entry for immediate deletion.
represents a Network Nack
void processNack(const lp::Nack &nack, const Face &inFace, const shared_ptr< pit::Entry > &pitEntry)
Copyright (c) 2011-2015 Regents of the University of California.
RandomNumberEngine & getRandomNumberEngine()
Returns a reference to a thread-local instance of a properly seeded PRNG.
static const Name & getStrategyName()
void afterReceiveInterest(const Interest &interest, const FaceEndpoint &ingress, const shared_ptr< pit::Entry > &pitEntry) override
Trigger after an Interest is received.
NFD_REGISTER_STRATEGY(AccessStrategy)
Represents an absolute name.
NFD_VIRTUAL_WITH_TESTS bool sendNack(const lp::NackHeader &header, Face &egress, const shared_ptr< pit::Entry > &pitEntry)
Send a Nack packet.
Represents a forwarding strategy.
void afterReceiveNack(const lp::Nack &nack, const FaceEndpoint &ingress, const shared_ptr< pit::Entry > &pitEntry) override
Trigger after a Nack is received.
optional< uint64_t > version
whether strategyName contains a version component
This file contains common algorithms used by forwarding strategies.
const fib::Entry & lookupFib(const pit::Entry &pitEntry) const
Performs a FIB lookup, considering Link object if present.
bool isNextHopEligible(const Face &inFace, const Interest &interest, const fib::NextHop &nexthop, const shared_ptr< pit::Entry > &pitEntry, bool wantUnused, time::steady_clock::time_point now)
static Name makeInstanceName(const Name &input, const Name &strategyName)
Construct a strategy instance name.
const NextHopList & getNextHops() const
NFD_VIRTUAL_WITH_TESTS pit::OutRecord * sendInterest(const Interest &interest, Face &egress, const shared_ptr< pit::Entry > &pitEntry)
Send an Interest packet.
A forwarding strategy that randomly chooses a nexthop.