26 #ifndef NFD_DAEMON_FW_STRATEGY_HPP 27 #define NFD_DAEMON_FW_STRATEGY_HPP 50 BOOST_ASSERT(strategyName.size() > 1);
51 BOOST_ASSERT(strategyName.at(-1).isVersion());
52 Registry& registry = getRegistry();
53 BOOST_ASSERT(registry.count(strategyName) == 0);
54 registry[strategyName] = &make_unique<S, Forwarder&, const Name&>;
70 static unique_ptr<Strategy>
76 areSameType(
const Name& instanceNameA,
const Name& instanceNameB);
135 const shared_ptr<pit::Entry>& pitEntry) = 0;
149 const Face& inFace,
const Data& data);
182 const shared_ptr<pit::Entry>& pitEntry);
192 const Interest& interest)
194 m_forwarder.onOutgoingInterest(pitEntry, outFace, interest);
206 m_forwarder.onInterestReject(pitEntry);
217 sendNack(
const shared_ptr<pit::Entry>& pitEntry,
const Face& outFace,
218 const lp::NackHeader& header)
220 m_forwarder.onOutgoingNack(pitEntry, outFace, header);
231 sendNacks(
const shared_ptr<pit::Entry>& pitEntry,
const lp::NackHeader& header,
232 std::initializer_list<const Face*> exceptFaces = std::initializer_list<const Face*>());
240 MeasurementsAccessor&
243 return m_measurements;
249 return m_forwarder.
getFace(
id);
296 typedef std::function<unique_ptr<Strategy>(
Forwarder& forwarder,
const Name&
strategyName)> CreateFunc;
297 typedef std::map<Name, CreateFunc> Registry;
302 static Registry::const_iterator
303 find(
const Name& instanceName);
318 MeasurementsAccessor m_measurements;
328 #define NFD_REGISTER_STRATEGY(S) \ 329 static class NfdAuto ## S ## StrategyRegistrationClass \ 332 NfdAuto ## S ## StrategyRegistrationClass() \ 334 ::nfd::fw::Strategy::registerType<S>(); \ 336 } g_nfdAuto ## S ## StrategyRegistrationVariable 338 #endif // NFD_DAEMON_FW_STRATEGY_HPP
void setInstanceName(const Name &name)
set strategy instance name
Strategy(Forwarder &forwarder)
construct a strategy instance
const Name & getInstanceName() const
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
const FaceTable & getFaceTable() const
virtual void afterReceiveInterest(const Face &inFace, const Interest &interest, const shared_ptr< pit::Entry > &pitEntry)=0
trigger after Interest is received
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
virtual void beforeSatisfyInterest(const shared_ptr< pit::Entry > &pitEntry, const Face &inFace, const Data &data)
trigger before PIT entry is satisfied
static Name makeInstanceName(const Name &input, const Name &strategyName)
construct a strategy instance name
static bool canCreate(const Name &instanceName)
MeasurementsAccessor & getMeasurements()
static bool areSameType(const Name &instanceNameA, const Name &instanceNameB)
static void registerType(const Name &strategyName=S::getStrategyName())
register a strategy type
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
signal::Signal< FaceTable, Face & > & afterAddFace
virtual void afterReceiveNack(const Face &inFace, const lp::Nack &nack, const shared_ptr< pit::Entry > &pitEntry)
trigger after Nack is received
static const Name & getStrategyName()
PartialName parameters
parameter components
FaceTable & getFaceTable()
static unique_ptr< Strategy > create(const Name &instanceName, Forwarder &forwarder)
ndn::optional< uint64_t > version
whether strategyName contains a version component
represents a forwarding strategy
#define VIRTUAL_WITH_TESTS
signal::Signal< FaceTable, Face & > & beforeRemoveFace
static ParsedInstanceName parseInstanceName(const Name &input)
parse a strategy instance name
static std::set< Name > listRegistered()
virtual void beforeExpirePendingInterest(const shared_ptr< pit::Entry > &pitEntry)
trigger before PIT entry expires
uint64_t FaceId
identifies a face
Face * getFace(FaceId id) const
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
Name strategyName
strategy name without parameters
Face * getFace(FaceId id) const
get existing Face