|
NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
|
API Documentation
|
Go to the documentation of this file.
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>
122 return m_wantNewNextHopTrigger;
152 const shared_ptr<pit::Entry>& pitEntry) = 0;
248 const shared_ptr<pit::Entry>& pitEntry);
318 m_forwarder.onOutgoingNack(pitEntry, egress, header);
329 std::initializer_list<FaceEndpoint> exceptFaceEndpoints = {});
334 setExpiryTimer(
const shared_ptr<pit::Entry>& pitEntry, time::milliseconds duration)
336 m_forwarder.setExpiryTimer(pitEntry, duration);
348 return m_measurements;
360 return m_forwarder.m_faceTable;
406 m_wantNewNextHopTrigger = enabled;
410 typedef std::function<unique_ptr<Strategy>(
Forwarder& forwarder,
const Name& strategyName)> CreateFunc;
411 typedef std::map<Name, CreateFunc> Registry;
416 static Registry::const_iterator
417 find(
const Name& instanceName);
434 bool m_wantNewNextHopTrigger =
false;
444 #define NFD_REGISTER_STRATEGY(S) \
445 static class NfdAuto ## S ## StrategyRegistrationClass \
448 NfdAuto ## S ## StrategyRegistrationClass() \
450 ::nfd::fw::Strategy::registerType<S>(); \
452 } g_nfdAuto ## S ## StrategyRegistrationVariable
454 #endif // NFD_DAEMON_FW_STRATEGY_HPP
static const Name & getStrategyName()
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
MeasurementsAccessor & getMeasurements()
Name strategyName
strategy name without parameters
void sendInterest(const shared_ptr< pit::Entry > &pitEntry, const FaceEndpoint &egress, const Interest &interest)
send Interest to egress
Strategy(Forwarder &forwarder)
Construct a strategy instance.
virtual void afterReceiveLoopedInterest(const FaceEndpoint &ingress, const Interest &interest, pit::Entry &pitEntry)
trigger after a looped Interest is received
Name PartialName
Represents an arbitrary sequence of name components.
#define VIRTUAL_WITH_TESTS
allows Strategy to access portion of Measurements table under its namespace
static bool canCreate(const Name &instanceName)
signal::Signal< FaceTable, Face > & beforeRemoveFace
static unique_ptr< Strategy > create(const Name &instanceName, Forwarder &forwarder)
static bool areSameType(const Name &instanceNameA, const Name &instanceNameB)
provides a lightweight signal / event system
const Name & getInstanceName() const
Represents an absolute name.
signal::Signal< FaceTable, Face > & afterAddFace
Copyright (c) 2011-2015 Regents of the University of California.
static std::set< Name > listRegistered()
uint64_t FaceId
Identifies a face.
void setInstanceName(const Name &name)
set strategy instance name
generalization of a network interface
void sendNack(const shared_ptr< pit::Entry > &pitEntry, const FaceEndpoint &egress, const lp::NackHeader &header)
send Nack to egress
bool wantNewNextHopTrigger() const
virtual void afterReceiveData(const shared_ptr< pit::Entry > &pitEntry, const FaceEndpoint &ingress, const Data &data)
trigger after Data is received
Represents a face-endpoint pair in the forwarder.
const fib::Entry & lookupFib(const pit::Entry &pitEntry) const
performs a FIB lookup, considering Link object if present
Represents an Interest packet.
static ParsedInstanceName parseInstanceName(const Name &input)
parse a strategy instance name
Represents a nexthop record in a FIB entry.
void setExpiryTimer(const shared_ptr< pit::Entry > &pitEntry, time::milliseconds duration)
Schedule the PIT entry to be erased after duration.
void rejectPendingInterest(const shared_ptr< pit::Entry > &pitEntry)
schedule the PIT entry for immediate deletion
static void registerType(const Name &strategyName=S::getStrategyName())
register a strategy type
virtual void onDroppedInterest(const FaceEndpoint &egress, const Interest &interest)
trigger after Interest dropped for exceeding allowed retransmissions
Face * getFace(FaceId id) const
Represents a Data packet.
Face * get(FaceId id) const
get face by FaceId
represents a forwarding strategy
virtual void afterReceiveNack(const FaceEndpoint &ingress, const lp::Nack &nack, const shared_ptr< pit::Entry > &pitEntry)
trigger after Nack is received
Main class of NFD's forwarding engine.
const FaceTable & getFaceTable() const
void sendDataToAll(const shared_ptr< pit::Entry > &pitEntry, const FaceEndpoint &ingress, const Data &data)
send data to all matched and qualified face-endpoint pairs
virtual void afterContentStoreHit(const shared_ptr< pit::Entry > &pitEntry, const FaceEndpoint &ingress, const Data &data)
trigger after a Data is matched in CS
represents a Network Nack
void sendData(const shared_ptr< pit::Entry > &pitEntry, const Data &data, const FaceEndpoint &egress)
send data to egress
static Name makeInstanceName(const Name &input, const Name &strategyName)
construct a strategy instance name
virtual void afterNewNextHop(const fib::NextHop &nextHop, const shared_ptr< pit::Entry > &pitEntry)
trigger after new nexthop is added
virtual void beforeSatisfyInterest(const shared_ptr< pit::Entry > &pitEntry, const FaceEndpoint &ingress, const Data &data)
trigger before PIT entry is satisfied
optional< uint64_t > version
whether strategyName contains a version component
#define PUBLIC_WITH_TESTS_ELSE_PROTECTED
void enableNewNextHopTrigger(bool enabled)
set whether the afterNewNextHop trigger should be invoked for this strategy
PartialName parameters
parameter components
virtual void afterReceiveInterest(const FaceEndpoint &ingress, const Interest &interest, const shared_ptr< pit::Entry > &pitEntry)=0
trigger after Interest is received