26 #ifndef NFD_DAEMON_FW_STRATEGY_HPP 27 #define NFD_DAEMON_FW_STRATEGY_HPP 51 BOOST_ASSERT(strategyName.size() > 1);
52 BOOST_ASSERT(strategyName.at(-1).isVersion());
53 Registry& registry = getRegistry();
54 BOOST_ASSERT(registry.count(strategyName) == 0);
55 registry[strategyName] = [] (
auto&&... args) {
56 return make_unique<S>(std::forward<decltype(args)>(args)...);
73 static unique_ptr<Strategy>
148 const shared_ptr<pit::Entry>& pitEntry) = 0;
184 const shared_ptr<pit::Entry>& pitEntry);
190 std::set<std::pair<Face*, EndpointId>>& satisfiedDownstreams,
191 std::set<std::pair<Face*, EndpointId>>& unsatisfiedDownstreams);
199 const shared_ptr<pit::Entry>& pitEntry);
230 const shared_ptr<pit::Entry>& pitEntry);
258 const shared_ptr<pit::Entry>& pitEntry);
297 sendData(
const Data& data,
Face& egress,
const shared_ptr<pit::Entry>& pitEntry);
349 std::initializer_list<const Face*> exceptFaces = {});
357 m_forwarder.setExpiryTimer(pitEntry, duration);
370 return m_measurements;
382 return m_forwarder.m_faceTable;
423 using CreateFunc = std::function<unique_ptr<Strategy>(
Forwarder&,
const Name& )>;
424 using Registry = std::map<Name, CreateFunc>;
429 static Registry::const_iterator
430 find(
const Name& instanceName);
438 Forwarder& m_forwarder;
449 #define NFD_REGISTER_STRATEGY(S) \ 450 static class NfdAuto ## S ## StrategyRegistrationClass \ 453 NfdAuto ## S ## StrategyRegistrationClass() \ 455 ::nfd::fw::Strategy::registerType<S>(); \ 457 } g_nfdAuto ## S ## StrategyRegistrationVariable 459 #endif // NFD_DAEMON_FW_STRATEGY_HPP #define NFD_VIRTUAL_WITH_TESTS
virtual void satisfyInterest(const shared_ptr< pit::Entry > &pitEntry, const FaceEndpoint &ingress, const Data &data, std::set< std::pair< Face *, EndpointId >> &satisfiedDownstreams, std::set< std::pair< Face *, EndpointId >> &unsatisfiedDownstreams)
virtual void afterNewNextHop(const fib::NextHop &nextHop, const shared_ptr< pit::Entry > &pitEntry)
Trigger after a new nexthop is added.
signal::Signal< FaceTable, Face > & beforeRemoveFace
static ParsedInstanceName parseInstanceName(const Name &input)
Parse a strategy instance name.
static std::set< Name > listRegistered()
void sendNacks(const lp::NackHeader &header, const shared_ptr< pit::Entry > &pitEntry, std::initializer_list< const Face *> exceptFaces={})
Send Nack to every face that has an in-record, except those in exceptFaces.
Represents a face-endpoint pair in the forwarder.
PartialName parameters
parameter components
Strategy(Forwarder &forwarder)
Construct a strategy instance.
Face * getFace(FaceId id) const
Main class of NFD's forwarding engine.
boost::chrono::duration< Rep, Period > duration
void setInstanceName(const Name &name)
Set strategy instance name.
Represents an Interest packet.
NFD_VIRTUAL_WITH_TESTS bool sendData(const Data &data, Face &egress, const shared_ptr< pit::Entry > &pitEntry)
Send a Data packet.
provides a lightweight signal / event system
virtual void afterContentStoreHit(const Data &data, const FaceEndpoint &ingress, const shared_ptr< pit::Entry > &pitEntry)
trigger after a Data is matched in CS
NFD_VIRTUAL_WITH_TESTS bool onOutgoingNack(const lp::NackHeader &nack, Face &egress, const shared_ptr< pit::Entry > &pitEntry)
outgoing Nack pipeline
NFD_VIRTUAL_WITH_TESTS void rejectPendingInterest(const shared_ptr< pit::Entry > &pitEntry)
Schedule the PIT entry for immediate deletion.
Face * get(FaceId id) const
get face by FaceId
represents a Network Nack
virtual void afterReceiveLoopedInterest(const FaceEndpoint &ingress, const Interest &interest, pit::Entry &pitEntry)
trigger after a looped Interest is received
virtual void afterReceiveInterest(const Interest &interest, const FaceEndpoint &ingress, const shared_ptr< pit::Entry > &pitEntry)=0
Trigger after an Interest is received.
Name strategyName
strategy name without parameters
NFD_VIRTUAL_WITH_TESTS void sendDataToAll(const Data &data, const shared_ptr< pit::Entry > &pitEntry, const Face &inFace)
Send a Data packet to all matched and qualified faces.
Copyright (c) 2011-2015 Regents of the University of California.
MeasurementsAccessor & getMeasurements()
Name PartialName
Represents an arbitrary sequence of name components.
virtual void afterReceiveNack(const lp::Nack &nack, const FaceEndpoint &ingress, const shared_ptr< pit::Entry > &pitEntry)
Trigger after a Nack is received.
Represents an absolute name.
NFD_VIRTUAL_WITH_TESTS bool sendNack(const lp::NackHeader &header, Face &egress, const shared_ptr< pit::Entry > &pitEntry)
Send a Nack packet.
Represents a forwarding strategy.
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.
signal::Signal< FaceTable, Face > & afterAddFace
const FaceTable & getFaceTable() const
const Name & getInstanceName() const
Contains information about an Interest toward an outgoing face.
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.
static bool canCreate(const Name &instanceName)
NFD_VIRTUAL_WITH_TESTS pit::OutRecord * sendInterest(const Interest &interest, Face &egress, const shared_ptr< pit::Entry > &pitEntry)
Send an Interest packet.
Represents a Data packet.
uint64_t FaceId
Identifies a face.
virtual void onDroppedInterest(const Interest &interest, Face &egress)
Trigger after an Interest is dropped (e.g., for exceeding allowed retransmissions).
virtual void beforeSatisfyInterest(const Data &data, const FaceEndpoint &ingress, const shared_ptr< pit::Entry > &pitEntry)
trigger before PIT entry is satisfied
static bool areSameType(const Name &instanceNameA, const Name &instanceNameB)
virtual void afterReceiveData(const Data &data, const FaceEndpoint &ingress, const shared_ptr< pit::Entry > &pitEntry)
trigger after Data is received
static void registerType(const Name &strategyName=S::getStrategyName())
Register a strategy type.
Represents a nexthop record in a FIB entry.
boost::chrono::milliseconds milliseconds