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] = [] (
auto&&... args) {
55 return make_unique<S>(std::forward<decltype(args)>(args)...);
72 static unique_ptr<Strategy>
78 areSameType(
const Name& instanceNameA,
const Name& instanceNameB);
122 return m_wantNewNextHopTrigger;
153 const shared_ptr<pit::Entry>& pitEntry) = 0;
236 const shared_ptr<pit::Entry>& pitEntry);
262 const Interest& interest);
271 sendData(
const shared_ptr<pit::Entry>& pitEntry,
const Data& data,
Face& egress);
282 sendDataToAll(
const shared_ptr<pit::Entry>& pitEntry,
const Face& inFace,
const Data& data);
307 const lp::NackHeader& header)
309 return m_forwarder.onOutgoingNack(pitEntry, egress, header);
319 sendNacks(
const shared_ptr<pit::Entry>& pitEntry,
const lp::NackHeader& header,
320 std::initializer_list<const Face*> exceptFaces = {});
325 setExpiryTimer(
const shared_ptr<pit::Entry>& pitEntry, time::milliseconds duration)
327 m_forwarder.setExpiryTimer(pitEntry, duration);
339 return m_measurements;
351 return m_forwarder.m_faceTable;
397 m_wantNewNextHopTrigger = enabled;
401 typedef std::function<unique_ptr<Strategy>(
Forwarder& forwarder,
const Name&
strategyName)> CreateFunc;
402 typedef std::map<Name, CreateFunc> Registry;
407 static Registry::const_iterator
408 find(
const Name& instanceName);
425 bool m_wantNewNextHopTrigger =
false;
435 #define NFD_REGISTER_STRATEGY(S) \ 436 static class NfdAuto ## S ## StrategyRegistrationClass \ 439 NfdAuto ## S ## StrategyRegistrationClass() \ 441 ::nfd::fw::Strategy::registerType<S>(); \ 443 } g_nfdAuto ## S ## StrategyRegistrationVariable 445 #endif // NFD_DAEMON_FW_STRATEGY_HPP virtual void afterNewNextHop(const fib::NextHop &nextHop, const shared_ptr< pit::Entry > &pitEntry)
Trigger after new nexthop is added.
Main class of NFD's forwarding engine.
void setInstanceName(const Name &name)
Set strategy instance name.
Strategy(Forwarder &forwarder)
Construct a strategy instance.
bool sendNack(const shared_ptr< pit::Entry > &pitEntry, Face &egress, const lp::NackHeader &header)
Send a Nack packet.
Contains information about an Interest toward an outgoing face.
virtual void afterReceiveInterest(const FaceEndpoint &ingress, const Interest &interest, const shared_ptr< pit::Entry > &pitEntry)=0
Trigger after Interest is received.
bool sendData(const shared_ptr< pit::Entry > &pitEntry, const Data &data, Face &egress)
Send a Data packet.
signal::Signal< FaceTable, Face > & beforeRemoveFace
#define PUBLIC_WITH_TESTS_ELSE_PROTECTED
static Name makeInstanceName(const Name &input, const Name &strategyName)
Construct a strategy instance name.
Face * get(FaceId id) const
get face by FaceId
static bool canCreate(const Name &instanceName)
const fib::Entry & lookupFib(const pit::Entry &pitEntry) const
Performs a FIB lookup, considering Link object if present.
MeasurementsAccessor & getMeasurements()
virtual void afterReceiveNack(const FaceEndpoint &ingress, const lp::Nack &nack, const shared_ptr< pit::Entry > &pitEntry)
Trigger after Nack is received.
void enableNewNextHopTrigger(bool enabled)
Set whether the afterNewNextHop trigger should be invoked for this strategy.
static bool areSameType(const Name &instanceNameA, const Name &instanceNameB)
static void registerType(const Name &strategyName=S::getStrategyName())
Register a strategy type.
Represents a face-endpoint pair in the forwarder.
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
virtual void onDroppedInterest(const Face &egress, const Interest &interest)
Trigger after Interest dropped (e.g., for exceeding allowed retransmissions)
static const Name & getStrategyName()
void sendDataToAll(const shared_ptr< pit::Entry > &pitEntry, const Face &inFace, const Data &data)
Send a Data packet to all matched and qualified faces.
allows Strategy to access portion of Measurements table under its namespace
generalization of a network interface
void setExpiryTimer(const shared_ptr< pit::Entry > &pitEntry, time::milliseconds duration)
Schedule the PIT entry to be erased after duration.
void sendNacks(const shared_ptr< pit::Entry > &pitEntry, const lp::NackHeader &header, std::initializer_list< const Face *> exceptFaces={})
Send Nack to every face that has an in-record, except those in exceptFaces.
PartialName parameters
parameter components
static unique_ptr< Strategy > create(const Name &instanceName, Forwarder &forwarder)
virtual void afterContentStoreHit(const shared_ptr< pit::Entry > &pitEntry, const FaceEndpoint &ingress, const Data &data)
Trigger after a Data is matched in CS.
const Name & getInstanceName() const
Represents a forwarding strategy.
#define VIRTUAL_WITH_TESTS
virtual void afterReceiveData(const shared_ptr< pit::Entry > &pitEntry, const FaceEndpoint &ingress, const Data &data)
Trigger after Data is received.
static ParsedInstanceName parseInstanceName(const Name &input)
Parse a strategy instance name.
const FaceTable & getFaceTable() const
static std::set< Name > listRegistered()
signal::Signal< FaceTable, Face > & afterAddFace
Represents a nexthop record in a FIB entry.
uint64_t FaceId
Identifies a face.
Face * getFace(FaceId id) const
virtual void beforeSatisfyInterest(const shared_ptr< pit::Entry > &pitEntry, const FaceEndpoint &ingress, const Data &data)
Trigger before PIT entry is satisfied.
void rejectPendingInterest(const shared_ptr< pit::Entry > &pitEntry)
Schedule the PIT entry for immediate deletion.
Name strategyName
strategy name without parameters
pit::OutRecord * sendInterest(const shared_ptr< pit::Entry > &pitEntry, Face &egress, const Interest &interest)
Send an Interest packet.
bool wantNewNextHopTrigger() const
optional< uint64_t > version
whether strategyName contains a version component