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;
152 const shared_ptr<pit::Entry>& pitEntry) = 0;
235 const shared_ptr<pit::Entry>& pitEntry);
303 const FaceEndpoint& egress,
const lp::NackHeader& header)
305 m_forwarder.onOutgoingNack(pitEntry, egress, header);
315 sendNacks(
const shared_ptr<pit::Entry>& pitEntry,
const lp::NackHeader& header,
316 std::initializer_list<FaceEndpoint> exceptFaceEndpoints = {});
321 setExpiryTimer(
const shared_ptr<pit::Entry>& pitEntry, time::milliseconds duration)
323 m_forwarder.setExpiryTimer(pitEntry, duration);
335 return m_measurements;
347 return m_forwarder.m_faceTable;
393 m_wantNewNextHopTrigger = enabled;
397 typedef std::function<unique_ptr<Strategy>(
Forwarder& forwarder,
const Name&
strategyName)> CreateFunc;
398 typedef std::map<Name, CreateFunc> Registry;
403 static Registry::const_iterator
404 find(
const Name& instanceName);
421 bool m_wantNewNextHopTrigger =
false;
431 #define NFD_REGISTER_STRATEGY(S) \ 432 static class NfdAuto ## S ## StrategyRegistrationClass \ 435 NfdAuto ## S ## StrategyRegistrationClass() \ 437 ::nfd::fw::Strategy::registerType<S>(); \ 439 } g_nfdAuto ## S ## StrategyRegistrationVariable 441 #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.
virtual void afterReceiveInterest(const FaceEndpoint &ingress, const Interest &interest, const shared_ptr< pit::Entry > &pitEntry)=0
trigger after Interest is received
void sendNack(const shared_ptr< pit::Entry > &pitEntry, const FaceEndpoint &egress, const lp::NackHeader &header)
send Nack to egress
signal::Signal< FaceTable, Face > & beforeRemoveFace
#define PUBLIC_WITH_TESTS_ELSE_PROTECTED
void sendDataToAll(const shared_ptr< pit::Entry > &pitEntry, const FaceEndpoint &ingress, const Data &data)
send data to all matched and qualified face-endpoint pairs
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
void sendInterest(const shared_ptr< pit::Entry > &pitEntry, const FaceEndpoint &egress, const Interest &interest)
send Interest to egress
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...
static const Name & getStrategyName()
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.
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
void sendData(const shared_ptr< pit::Entry > &pitEntry, const Data &data, const FaceEndpoint &egress)
send data to egress
#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.
void sendNacks(const shared_ptr< pit::Entry > &pitEntry, const lp::NackHeader &header, std::initializer_list< FaceEndpoint > exceptFaceEndpoints={})
send Nack to every face-endpoint pair that has an in-record, except those in exceptFaceEndpoints ...
uint64_t FaceId
Identifies a face.
virtual void onDroppedInterest(const FaceEndpoint &egress, const Interest &interest)
trigger after Interest dropped for exceeding allowed retransmissions
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
bool wantNewNextHopTrigger() const
optional< uint64_t > version
whether strategyName contains a version component