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);
194 m_forwarder.onOutgoingInterest(pitEntry, outFace, interest);
206 m_forwarder.onInterestReject(pitEntry);
220 m_forwarder.onOutgoingNack(pitEntry, outFace, 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);
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 signal::Signal< FaceTable, Face & > & afterAddFace
Face * getFace(FaceId id) const
get existing Face
static ParsedInstanceName parseInstanceName(const Name &input)
parse a strategy instance name
static std::set< Name > listRegistered()
PartialName parameters
parameter components
void sendNack(const shared_ptr< pit::Entry > &pitEntry, const Face &outFace, const lp::NackHeader &header)
send Nack to outFace
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
Strategy(Forwarder &forwarder)
construct a strategy instance
#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
const Name & getInstanceName() const
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()
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.
const fib::Entry & lookupFib(const pit::Entry &pitEntry) const
performs a FIB lookup, considering Link object if present
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
static const Name & getStrategyName()
static unique_ptr< Strategy > create(const Name &instanceName, Forwarder &forwarder)
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