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< Entry > | 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. 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... | |
A PendingInterestTable is an internal class to hold a list of pending interests with their callbacks.
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.
pendingInterestId | The getNextEntryId() for the pending interest ID which Face got so it could return it to the caller. |
interestCopy | The Interest which was sent, which has already been copied by expressInterest. |
onData | This calls onData when a matching data packet is received. |
onTimeout | Call onTimeout if the interest times out. If onTimeout is an empty OnTimeout(), this does not use it. |
onNetworkNack | Call onNetworkNack.onNetworkNack when a network Nack packet is received. |
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.
name | The name to find the interest for (from the incoming data packet). |
entries | Add 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).
interest | The Interest to search for (typically from a Nack packet). |
entries | Add 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.
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.
pendingInterestId | The ID returned from expressInterest. |