represents a forwarding strategy More...
#include <strategy.hpp>
Public Member Functions | |
Strategy (Forwarder &forwarder, const Name &name) | |
construct a strategy instance More... | |
virtual | ~Strategy () |
const Name & | getName () const |
a Name that represent the Strategy program More... | |
virtual void | afterReceiveInterest (const Face &inFace, const Interest &interest, shared_ptr< fib::Entry > fibEntry, shared_ptr< pit::Entry > pitEntry)=0 |
trigger after Interest is received More... | |
virtual void | beforeSatisfyInterest (shared_ptr< pit::Entry > pitEntry, const Face &inFace, const Data &data) |
trigger before PIT entry is satisfied More... | |
virtual void | beforeExpirePendingInterest (shared_ptr< pit::Entry > pitEntry) |
trigger before PIT entry expires More... | |
virtual void | afterReceiveNack (const Face &inFace, const lp::Nack &nack, shared_ptr< fib::Entry > fibEntry, shared_ptr< pit::Entry > pitEntry) |
trigger after Nack is received More... | |
Protected Member Functions | |
void | sendInterest (shared_ptr< pit::Entry > pitEntry, shared_ptr< Face > outFace, bool wantNewNonce=false) |
send Interest to outFace More... | |
void | rejectPendingInterest (shared_ptr< pit::Entry > pitEntry) |
decide that a pending Interest cannot be forwarded More... | |
void | sendNack (shared_ptr< pit::Entry > pitEntry, const Face &outFace, const lp::NackHeader &header) |
send Nack to outFace More... | |
void | sendNacks (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 More... | |
MeasurementsAccessor & | getMeasurements () |
shared_ptr< Face > | getFace (FaceId id) |
const FaceTable & | getFaceTable () |
Protected Attributes | |
signal::Signal< FaceTable, shared_ptr< Face > > & | afterAddFace |
signal::Signal< FaceTable, shared_ptr< Face > > & | beforeRemoveFace |
represents a forwarding strategy
Definition at line 38 of file strategy.hpp.
construct a strategy instance
forwarder | a reference to the Forwarder, used to enable actions and accessors. Strategy subclasses should pass this reference, and should not keep a reference themselves. |
name | the strategy Name. It's recommended to include a version number as the last component. |
Definition at line 35 of file strategy.cpp.
|
virtual |
Definition at line 45 of file strategy.cpp.
|
inline |
a Name that represent the Strategy program
Definition at line 202 of file strategy.hpp.
Referenced by nfd::clearStrategyInfo(), nfd::strategy_choice::Entry::getStrategyName(), and nfd::StrategyChoice::insert().
|
pure virtual |
trigger after Interest is received
The Interest:
The strategy should decide whether and where to forward this Interest.
Implemented in nfd::fw::AccessStrategy, nfd::fw::BestRouteStrategy2, nfd::fw::BestRouteStrategy, nfd::fw::ClientControlStrategy, nfd::fw::NccStrategy, nfd::fw::BroadcastStrategy, and nfd::fw::MulticastStrategy.
Referenced by nfd::Forwarder::startProcessNack().
|
virtual |
trigger before PIT entry is satisfied
This trigger is invoked when an incoming Data satisfies the PIT entry. It can be invoked even if the PIT entry has already been satisfied.
In this base class this method does nothing.
Reimplemented in nfd::fw::AccessStrategy, and nfd::fw::NccStrategy.
Definition at line 50 of file strategy.cpp.
References ndn::Data::getName(), and NFD_LOG_DEBUG.
Referenced by nfd::Forwarder::startProcessNack().
|
virtual |
trigger before PIT entry expires
PIT entry expires when InterestLifetime has elapsed for all InRecords, and it is not satisfied by an incoming Data.
This trigger is not invoked for PIT entry already satisfied.
In this base class this method does nothing.
Definition at line 58 of file strategy.cpp.
References NFD_LOG_DEBUG.
Referenced by nfd::Forwarder::startProcessNack().
|
virtual |
trigger after Nack is received
This trigger is invoked when an incoming Nack is received in response to an forwarded Interest. The Nack has been confirmed to be a response to the last Interest forwarded to that upstream, i.e. the PIT out-record exists and has a matching Nonce. The NackHeader has been recorded in the PIT out-record.
In this base class this method does nothing.
Reimplemented in nfd::fw::BestRouteStrategy2.
Definition at line 64 of file strategy.cpp.
References NFD_LOG_DEBUG.
Referenced by nfd::Forwarder::startProcessNack().
|
inlineprotected |
send Interest to outFace
pitEntry | PIT entry |
outFace | face through which to send out the Interest |
wantNewNonce | if true, a new Nonce will be generated, rather than reusing a Nonce from one of the PIT in-records |
Definition at line 208 of file strategy.hpp.
Referenced by nfd::fw::MulticastStrategy::afterReceiveInterest(), nfd::fw::NccStrategy::afterReceiveInterest(), nfd::fw::ClientControlStrategy::afterReceiveInterest(), nfd::fw::BestRouteStrategy::afterReceiveInterest(), nfd::fw::BestRouteStrategy2::afterReceiveInterest(), nfd::fw::AccessStrategy::afterReceiveInterest(), and nfd::fw::NccStrategy::doPropagate().
|
inlineprotected |
decide that a pending Interest cannot be forwarded
pitEntry | PIT entry |
This shall not be called if the pending Interest has been forwarded earlier, and does not need to be resent now.
Definition at line 216 of file strategy.hpp.
Referenced by nfd::fw::MulticastStrategy::afterReceiveInterest(), nfd::fw::NccStrategy::afterReceiveInterest(), nfd::fw::ClientControlStrategy::afterReceiveInterest(), nfd::fw::BestRouteStrategy::afterReceiveInterest(), and nfd::fw::BestRouteStrategy2::afterReceiveInterest().
|
inlineprotected |
send Nack to outFace
pitEntry | PIT entry |
outFace | face through which to send out the Nack |
header | Nack header |
The outFace must have a PIT in-record, otherwise this method has no effect.
Definition at line 222 of file strategy.hpp.
Referenced by nfd::fw::BestRouteStrategy2::afterReceiveInterest(), nfd::fw::BestRouteStrategy2::afterReceiveNack(), and sendNacks().
|
protected |
send Nack to every face that has an in-record, except those in exceptFaces
pitEntry | PIT entry |
header | NACK header |
exceptFaces | list of faces that should be excluded from sending Nacks |
Definition at line 72 of file strategy.cpp.
References nfd::pit::FaceRecord::getFace(), and sendNack().
Referenced by nfd::fw::BestRouteStrategy2::afterReceiveNack().
|
inlineprotected |
Definition at line 229 of file strategy.hpp.
Referenced by nfd::fw::NccStrategy::beforeSatisfyInterest(), nfd::fw::AccessStrategy::beforeSatisfyInterest(), nfd::fw::NccStrategy::getMeasurementsEntryInfo(), and nfd::fw::NccStrategy::timeoutOnBestFace().
|
inlineprotected |
Definition at line 235 of file strategy.hpp.
References nfd::Forwarder::getFace().
Referenced by nfd::fw::ClientControlStrategy::afterReceiveInterest(), and nfd::fw::AccessStrategy::afterReceiveInterest().
|
inlineprotected |
Definition at line 241 of file strategy.hpp.
References nfd::Forwarder::getFaceTable().
|
protected |
Definition at line 186 of file strategy.hpp.
|
protected |
Definition at line 187 of file strategy.hpp.