Classes | Public Member Functions | List of all members
ndn::PendingInterestTable Class Reference

A PendingInterestTable is an internal class to hold a list of pending interests with their callbacks. More...

#include <pending-interest-table.hpp>

Classes

class  Entry
 Entry holds the callbacks and other fields for an entry in the pending interest table. More...
 

Public Member Functions

ptr_lib::shared_ptr< Entryadd (uint64_t pendingInterestId, const ptr_lib::shared_ptr< const Interest > &interestCopy, const OnData &onData, const OnTimeout &onTimeout, const OnNetworkNack &onNetworkNack)
 Add a new entry to the pending interest table. More...
 
void extractEntriesForExpressedInterest (const Name &name, std::vector< ptr_lib::shared_ptr< Entry > > &entries)
 Find all entries from the pending interest table where the name conforms to the entry's interest selectors, remove the entries from the table, set each entry's isRemoved flag, and add to the entries list. More...
 
void extractEntriesForNackInterest (const Interest &interest, std::vector< ptr_lib::shared_ptr< Entry > > &entries)
 Find all entries from the pending interest table where the OnNetworkNack callback is not an empty OnNetworkNack() and the entry's interest is the same as the given interest, remove the entries from the table, set each entry's isRemoved flag, and add to the entries list. More...
 
void removePendingInterest (uint64_t pendingInterestId)
 Remove the pending interest entry with the pendingInterestId from the pending interest table and set its isRemoved flag. More...
 
bool removeEntry (const ptr_lib::shared_ptr< Entry > &pendingInterest)
 Remove the specific pendingInterest entry from the table and set its isRemoved flag. More...
 

Detailed Description

A PendingInterestTable is an internal class to hold a list of pending interests with their callbacks.

Member Function Documentation

ptr_lib::shared_ptr< PendingInterestTable::Entry > ndn::PendingInterestTable::add ( uint64_t  pendingInterestId,
const ptr_lib::shared_ptr< const Interest > &  interestCopy,
const OnData onData,
const OnTimeout onTimeout,
const OnNetworkNack onNetworkNack 
)

Add a new entry to the pending interest table.

However, if removePendingInterest was already called with the pendingInterestId, don't add an entry and return null.

Parameters
pendingInterestIdThe getNextEntryId() for the pending interest ID which Face got so it could return it to the caller.
interestCopyThe Interest which was sent, which has already been copied by expressInterest.
onDataThis calls onData when a matching data packet is received.
onTimeoutCall onTimeout if the interest times out. If onTimeout is an empty OnTimeout(), this does not use it.
onNetworkNackCall onNetworkNack.onNetworkNack when a network Nack packet is received.
Returns
The new PendingInterestTable::Entry, or null if removePendingInterest was already called with the pendingInterestId.
void ndn::PendingInterestTable::extractEntriesForExpressedInterest ( const Name name,
std::vector< ptr_lib::shared_ptr< Entry > > &  entries 
)

Find all entries from the pending interest table where the name conforms to the entry's interest selectors, remove the entries from the table, set each entry's isRemoved flag, and add to the entries list.

Parameters
nameThe name to find the interest for (from the incoming data packet).
entriesAdd matching PendingInterestTable::Entry from the pending interest table. The caller should pass in a reference to an empty vector.
void ndn::PendingInterestTable::extractEntriesForNackInterest ( const Interest interest,
std::vector< ptr_lib::shared_ptr< Entry > > &  entries 
)

Find all entries from the pending interest table where the OnNetworkNack callback is not an empty OnNetworkNack() and the entry's interest is the same as the given interest, remove the entries from the table, set each entry's isRemoved flag, and add to the entries list.

(We don't remove the entry if the OnNetworkNack callback is an empty OnNetworkNack() so that OnTimeout will be called later.) The interests are the same if their default wire encoding is the same (which has everything including the name, nonce, link object and selectors).

Parameters
interestThe Interest to search for (typically from a Nack packet).
entriesAdd matching PendingInterestTable::Entry from the pending interest table. The caller should pass in a reference to an empty vector.
bool ndn::PendingInterestTable::removeEntry ( const ptr_lib::shared_ptr< Entry > &  pendingInterest)

Remove the specific pendingInterest entry from the table and set its isRemoved flag.

However, if the pendingInterest isRemoved flag is already true or the entry is not in the pending interest table then do nothing.

Returns
void ndn::PendingInterestTable::removePendingInterest ( uint64_t  pendingInterestId)

Remove the pending interest entry with the pendingInterestId from the pending interest table and set its isRemoved flag.

This does not affect another pending interest with a different pendingInterestId, even if it has the same interest name. If there is no entry with the pendingInterestId, do nothing.

Parameters
pendingInterestIdThe ID returned from expressInterest.

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