NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn::PendingInterest Class Reference

Stores a pending Interest and associated callbacks. More...

#include <pending-interest.hpp>

Inheritance diagram for ndn::PendingInterest:
Collaboration diagram for ndn::PendingInterest:

Public Member Functions

 PendingInterest (shared_ptr< const Interest > interest, const DataCallback &dataCallback, const NackCallback &nackCallback, const TimeoutCallback &timeoutCallback, Scheduler &scheduler)
 Construct a pending Interest record for an Interest from Face::expressInterest. More...
 
 PendingInterest (shared_ptr< const Interest > interest, Scheduler &scheduler)
 Construct a pending Interest record for an Interest from NFD. More...
 
shared_ptr< const InterestgetInterest () const
 Get the Interest. More...
 
PendingInterestOrigin getOrigin () const
 
void recordForwarding ()
 Record that the Interest has been forwarded to one destination. More...
 
optional< lp::NackrecordNack (const lp::Nack &nack)
 Record an incoming Nack against a forwarded Interest. More...
 
void invokeDataCallback (const Data &data)
 Invoke the Data callback. More...
 
void invokeNackCallback (const lp::Nack &nack)
 Invoke the Nack callback. More...
 
void setDeleter (const std::function< void()> &deleter)
 Set cleanup function to be invoked when Interest times out. More...
 

Detailed Description

Stores a pending Interest and associated callbacks.

Definition at line 58 of file pending-interest.hpp.

Constructor & Destructor Documentation

◆ PendingInterest() [1/2]

ndn::PendingInterest::PendingInterest ( shared_ptr< const Interest interest,
const DataCallback dataCallback,
const NackCallback nackCallback,
const TimeoutCallback timeoutCallback,
Scheduler scheduler 
)
inline

Construct a pending Interest record for an Interest from Face::expressInterest.

The timeout is set based on the current time and InterestLifetime. This class will invoke the timeout callback unless the record is deleted before timeout.

Parameters
interestthe Interest
dataCallbackinvoked when matching Data packet is received
nackCallbackinvoked when Nack matching Interest is received
timeoutCallbackinvoked when Interest times out
schedulerScheduler for scheduling the timeout event

Definition at line 73 of file pending-interest.hpp.

◆ PendingInterest() [2/2]

ndn::PendingInterest::PendingInterest ( shared_ptr< const Interest interest,
Scheduler scheduler 
)
inline

Construct a pending Interest record for an Interest from NFD.

Parameters
interestthe Interest
schedulerScheduler for scheduling the timeout event

Definition at line 94 of file pending-interest.hpp.

Member Function Documentation

◆ getInterest()

shared_ptr<const Interest> ndn::PendingInterest::getInterest ( ) const
inline

Get the Interest.

Definition at line 106 of file pending-interest.hpp.

Referenced by ndn::InterestFilterRecord::doesMatch().

◆ getOrigin()

PendingInterestOrigin ndn::PendingInterest::getOrigin ( ) const
inline

Definition at line 112 of file pending-interest.hpp.

Referenced by ndn::InterestFilterRecord::doesMatch().

◆ recordForwarding()

void ndn::PendingInterest::recordForwarding ( )
inline

Record that the Interest has been forwarded to one destination.

A "destination" could be either a local InterestFilter or the forwarder.

Definition at line 123 of file pending-interest.hpp.

Referenced by ndn::Face::Impl::dispatchInterest().

◆ recordNack()

optional<lp::Nack> ndn::PendingInterest::recordNack ( const lp::Nack nack)
inline

Record an incoming Nack against a forwarded Interest.

Returns
least severe Nack if all destinations where the Interest was forwarded have Nacked; otherwise, nullopt

Definition at line 134 of file pending-interest.hpp.

References ndn::lp::Nack::getReason(), ndn::lp::isLessSevere(), and nonstd::optional_lite::nullopt.

◆ invokeDataCallback()

void ndn::PendingInterest::invokeDataCallback ( const Data data)
inline

Invoke the Data callback.

Note
This method does nothing if the Data callback is empty

Definition at line 151 of file pending-interest.hpp.

◆ invokeNackCallback()

void ndn::PendingInterest::invokeNackCallback ( const lp::Nack nack)
inline

Invoke the Nack callback.

Note
This method does nothing if the Nack callback is empty

Definition at line 163 of file pending-interest.hpp.

◆ setDeleter()

void ndn::PendingInterest::setDeleter ( const std::function< void()> &  deleter)
inline

Set cleanup function to be invoked when Interest times out.

Definition at line 174 of file pending-interest.hpp.


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