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>
142 const shared_ptr<pit::Entry>& pitEntry) = 0;
165 const Face& inFace,
const Data& data);
173 const Face& inFace,
const Data& data);
200 const Face& inFace,
const Data& data);
225 const shared_ptr<pit::Entry>& pitEntry);
244 m_forwarder.onOutgoingInterest(pitEntry, outFace, interest);
253 sendData(
const shared_ptr<pit::Entry>& pitEntry,
const Data& data,
const Face& outFace);
289 m_forwarder.onOutgoingNack(pitEntry, outFace, header);
301 std::initializer_list<const Face*> exceptFaces = std::initializer_list<const Face*>());
306 setExpiryTimer(
const shared_ptr<pit::Entry>& pitEntry, time::milliseconds duration)
308 m_forwarder.setExpiryTimer(pitEntry, duration);
320 return m_measurements;
326 return m_forwarder.
getFace(
id);
373 typedef std::function<unique_ptr<Strategy>(
Forwarder& forwarder,
const Name& strategyName)> CreateFunc;
374 typedef std::map<Name, CreateFunc> Registry;
379 static Registry::const_iterator
380 find(
const Name& instanceName);
405 #define NFD_REGISTER_STRATEGY(S) \ 406 static class NfdAuto ## S ## StrategyRegistrationClass \ 409 NfdAuto ## S ## StrategyRegistrationClass() \ 411 ::nfd::fw::Strategy::registerType<S>(); \ 413 } g_nfdAuto ## S ## StrategyRegistrationVariable 415 #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
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
virtual void afterContentStoreHit(const shared_ptr< pit::Entry > &pitEntry, const Face &inFace, const Data &data)
trigger after a Data is matched in CS
Strategy(Forwarder &forwarder)
construct a strategy instance
Face * getFace(FaceId id) const
#define VIRTUAL_WITH_TESTS
void setInstanceName(const Name &name)
set strategy instance name
Represents an Interest packet.
provides a lightweight signal / event system
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()
virtual void afterReceiveData(const shared_ptr< pit::Entry > &pitEntry, const Face &inFace, const Data &data)
trigger after Data is received
Name PartialName
Represents an arbitrary sequence of name components.
void rejectPendingInterest(const shared_ptr< pit::Entry > &pitEntry)
schedule the PIT entry for immediate deletion
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 sendData(const shared_ptr< pit::Entry > &pitEntry, const Data &data, const Face &outFace)
send data to outFace
static const Name & getStrategyName()
optional< uint64_t > version
whether strategyName contains a version component
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
void setExpiryTimer(const shared_ptr< pit::Entry > &pitEntry, time::milliseconds duration)
Schedule the PIT entry to be erased after duration.
void sendDataToAll(const shared_ptr< pit::Entry > &pitEntry, const Face &inFace, const Data &data)
send data to all matched and qualified faces
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