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>
135 const shared_ptr<pit::Entry>& pitEntry) = 0;
149 const Face& inFace,
const Data& data);
182 const shared_ptr<pit::Entry>& pitEntry);
201 m_forwarder.onOutgoingInterest(pitEntry, outFace, interest);
213 m_forwarder.onInterestReject(pitEntry);
227 m_forwarder.onOutgoingNack(pitEntry, outFace, header);
239 std::initializer_list<const Face*> exceptFaces = std::initializer_list<const Face*>());
250 return m_measurements;
256 return m_forwarder.
getFace(
id);
303 typedef std::function<unique_ptr<Strategy>(
Forwarder& forwarder,
const Name& strategyName)> CreateFunc;
304 typedef std::map<Name, CreateFunc> Registry;
309 static Registry::const_iterator
310 find(
const Name& instanceName);
335 #define NFD_REGISTER_STRATEGY(S) \ 336 static class NfdAuto ## S ## StrategyRegistrationClass \ 339 NfdAuto ## S ## StrategyRegistrationClass() \ 341 ::nfd::fw::Strategy::registerType<S>(); \ 343 } g_nfdAuto ## S ## StrategyRegistrationVariable 345 #endif // NFD_DAEMON_FW_STRATEGY_HPP signal::Signal< FaceTable, Face & > & afterAddFace
static ParsedInstanceName parseInstanceName(const Name &input)
parse a strategy instance name
static std::set< Name > listRegistered()
generalization of a network interface
PartialName parameters
parameter components
void sendNack(const shared_ptr< pit::Entry > &pitEntry, const Face &outFace, const lp::NackHeader &header)
send Nack to outFace
Strategy(Forwarder &forwarder)
construct a strategy instance
Face * getFace(FaceId id) const
#define VIRTUAL_WITH_TESTS
virtual void beforeExpirePendingInterest(const shared_ptr< pit::Entry > &pitEntry)
trigger before PIT entry expires
void setInstanceName(const Name &name)
set strategy instance name
represents an Interest packet
provides a lightweight signal / event system
ndn::optional< uint64_t > version
whether strategyName contains a version component
represents a Network Nack
virtual void afterReceiveNack(const Face &inFace, const lp::Nack &nack, const shared_ptr< pit::Entry > &pitEntry)
trigger after Nack is received
FaceTable & getFaceTable()
virtual void onDroppedInterest(const Face &outFace, const Interest &interest)
trigger after Interest dropped for exceeding allowed retransmissions
Name strategyName
strategy name without parameters
Copyright (c) 2011-2015 Regents of the University of California.
MeasurementsAccessor & getMeasurements()
Name PartialName
Represents an arbitrary sequence of name components.
void rejectPendingInterest(const shared_ptr< pit::Entry > &pitEntry)
decide that a pending Interest cannot be forwarded
virtual void beforeSatisfyInterest(const shared_ptr< pit::Entry > &pitEntry, const Face &inFace, const Data &data)
trigger before PIT entry is satisfied
Represents an absolute name.
signal::Signal< FaceTable, Face & > & beforeRemoveFace
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
static const Name & getStrategyName()
allows Strategy to access portion of Measurements table under its namespace
static unique_ptr< Strategy > create(const Name &instanceName, Forwarder &forwarder)
const fib::Entry & lookupFib(const pit::Entry &pitEntry) const
performs a FIB lookup, considering Link object if present
const FaceTable & getFaceTable() const
const Name & getInstanceName() const
static Name makeInstanceName(const Name &input, const Name &strategyName)
construct a strategy instance name
virtual void afterReceiveInterest(const Face &inFace, const Interest &interest, const shared_ptr< pit::Entry > &pitEntry)=0
trigger after Interest is received
uint64_t FaceId
identifies a face
static bool canCreate(const Name &instanceName)
Represents a Data packet.
void sendInterest(const shared_ptr< pit::Entry > &pitEntry, Face &outFace, const Interest &interest)
send Interest to outFace
static bool areSameType(const Name &instanceNameA, const Name &instanceNameB)
static void registerType(const Name &strategyName=S::getStrategyName())
register a strategy type
Face * getFace(FaceId id) const
get existing Face