NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nfd::fw::Strategy Class Referenceabstract

represents a forwarding strategy More...

#include <strategy.hpp>

Inheritance diagram for nfd::fw::Strategy:
Collaboration diagram for nfd::fw::Strategy:

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...
 

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...
 
MeasurementsAccessorgetMeasurements ()
 
shared_ptr< FacegetFace (FaceId id)
 
const FaceTablegetFaceTable ()
 

Protected Attributes

signal::Signal< FaceTable,
shared_ptr< Face > > & 
afterAddFace
 
signal::Signal< FaceTable,
shared_ptr< Face > > & 
beforeRemoveFace
 

Detailed Description

represents a forwarding strategy

Definition at line 37 of file strategy.hpp.

Constructor & Destructor Documentation

nfd::fw::Strategy::Strategy ( Forwarder forwarder,
const Name &  name 
)

construct a strategy instance

Parameters
forwardera reference to the Forwarder, used to enable actions and accessors. Strategy subclasses should pass this reference, and should not keep a reference themselves.
namethe strategy Name. It's recommended to include a version number as the last component.

Definition at line 35 of file strategy.cpp.

nfd::fw::Strategy::~Strategy ( )
virtual

Definition at line 45 of file strategy.cpp.

Member Function Documentation

virtual void nfd::fw::Strategy::afterReceiveInterest ( const Face inFace,
const Interest &  interest,
shared_ptr< fib::Entry fibEntry,
shared_ptr< pit::Entry pitEntry 
)
pure virtual

trigger after Interest is received

The Interest:

  • does not violate Scope
  • is not looped
  • cannot be satisfied by ContentStore
  • is under a namespace managed by this strategy

The strategy should decide whether and where to forward this Interest.

  • If the strategy decides to forward this Interest, invoke this->sendInterest one or more times, either now or shortly after
  • If strategy concludes that this Interest cannot be forwarded, invoke this->rejectPendingInterest so that PIT entry will be deleted shortly
Note
The strategy is permitted to store a weak reference to fibEntry. Do not store a shared reference, because PIT entry may be deleted at any moment. fibEntry is passed by value to allow obtaining a weak reference from it.
The strategy is permitted to store a shared reference to pitEntry. pitEntry is passed by value to reflect this fact.

Implemented in nfd::fw::BestRouteStrategy, nfd::fw::BestRouteStrategy2, nfd::fw::BroadcastStrategy, nfd::fw::ClientControlStrategy, and nfd::fw::NccStrategy.

void nfd::fw::Strategy::beforeExpirePendingInterest ( shared_ptr< pit::Entry pitEntry)
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.

Note
The strategy is permitted to store a shared reference to pitEntry. pitEntry is passed by value to reflect this fact.

Definition at line 58 of file strategy.cpp.

References NFD_LOG_DEBUG.

void nfd::fw::Strategy::beforeSatisfyInterest ( shared_ptr< pit::Entry pitEntry,
const Face inFace,
const Data &  data 
)
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.

Note
The strategy is permitted to store a shared reference to pitEntry. pitEntry is passed by value to reflect this fact.

Reimplemented in nfd::fw::NccStrategy.

Definition at line 50 of file strategy.cpp.

References nfd::Face::getId(), and NFD_LOG_DEBUG.

shared_ptr< Face > nfd::fw::Strategy::getFace ( FaceId  id)
inlineprotected
const FaceTable & nfd::fw::Strategy::getFaceTable ( )
inlineprotected

Definition at line 186 of file strategy.hpp.

References nfd::Forwarder::getFaceTable().

MeasurementsAccessor & nfd::fw::Strategy::getMeasurements ( )
inlineprotected
const Name & nfd::fw::Strategy::getName ( ) const
inline

a Name that represent the Strategy program

Definition at line 154 of file strategy.hpp.

Referenced by nfd::strategy_choice::Entry::getStrategyName().

void nfd::fw::Strategy::rejectPendingInterest ( shared_ptr< pit::Entry pitEntry)
inlineprotected

decide that a pending Interest cannot be forwarded

This shall not be called if the pending Interest has been forwarded earlier, and does not need to be resent now.

Definition at line 168 of file strategy.hpp.

Referenced by nfd::fw::NccStrategy::afterReceiveInterest(), nfd::fw::ClientControlStrategy::afterReceiveInterest(), nfd::fw::BroadcastStrategy::afterReceiveInterest(), nfd::fw::BestRouteStrategy2::afterReceiveInterest(), and nfd::fw::BestRouteStrategy::afterReceiveInterest().

void nfd::fw::Strategy::sendInterest ( shared_ptr< pit::Entry pitEntry,
shared_ptr< Face outFace,
bool  wantNewNonce = false 
)
inlineprotected

Member Data Documentation

signal::Signal<FaceTable, shared_ptr<Face> >& nfd::fw::Strategy::afterAddFace
protected

Definition at line 138 of file strategy.hpp.

signal::Signal<FaceTable, shared_ptr<Face> >& nfd::fw::Strategy::beforeRemoveFace
protected

Definition at line 139 of file strategy.hpp.


The documentation for this class was generated from the following files: