22 #ifndef NDN_PENDING_INTEREST_TABLE_HPP
23 #define NDN_PENDING_INTEREST_TABLE_HPP
25 #include <ndn-cpp/face.hpp>
46 (uint64_t pendingInterestId,
47 const ptr_lib::shared_ptr<const Interest>& interest,
const OnData& onData,
49 : pendingInterestId_(pendingInterestId), interest_(interest), onData_(onData),
50 onTimeout_(onTimeout), onNetworkNack_(onNetworkNack), isRemoved_(
false)
66 const ptr_lib::shared_ptr<const Interest>&
104 ptr_lib::shared_ptr<const Interest> interest_;
105 uint64_t pendingInterestId_;
128 ptr_lib::shared_ptr<Entry>
129 add(uint64_t pendingInterestId,
130 const ptr_lib::shared_ptr<const Interest>& interestCopy,
144 (
const Name& name, std::vector<ptr_lib::shared_ptr<Entry> > &entries);
161 (
const Interest& interest, std::vector<ptr_lib::shared_ptr<Entry> > &entries);
181 removeEntry(
const ptr_lib::shared_ptr<Entry>& pendingInterest);
184 std::vector<ptr_lib::shared_ptr<Entry> > table_;
185 std::vector<uint64_t> removeRequests_;
func_lib::function< void(const ptr_lib::shared_ptr< const Interest > &)> OnTimeout
An OnTimeout function object is used to pass a callback to expressInterest.
Definition: face.hpp:46
Copyright (C) 2013-2016 Regents of the University of California.
Definition: common.hpp:35
Entry holds the callbacks and other fields for an entry in the pending interest table.
Definition: pending-interest-table.hpp:39
bool getIsRemoved()
Check if setIsRemoved() was called.
Definition: pending-interest-table.hpp:94
const ptr_lib::shared_ptr< const Interest > & getInterest()
Get the interest given to the constructor (from Face.expressInterest).
Definition: pending-interest-table.hpp:67
const OnData & getOnData()
Get the OnData callback given to the constructor.
Definition: pending-interest-table.hpp:74
void setIsRemoved()
Set the isRemoved flag which is returned by getIsRemoved().
Definition: pending-interest-table.hpp:87
void callTimeout()
Call onTimeout_ (if defined).
Definition: pending-interest-table.cpp:33
Entry(uint64_t pendingInterestId, const ptr_lib::shared_ptr< const Interest > &interest, const OnData &onData, const OnTimeout &onTimeout, const OnNetworkNack &onNetworkNack)
Create a new Entry with the given fields.
Definition: pending-interest-table.hpp:46
A PendingInterestTable is an internal class to hold a list of pending interests with their callbacks...
Definition: pending-interest-table.hpp:33
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 OnN...
Definition: pending-interest-table.cpp:87
A Name holds an array of Name::Component and represents an NDN name.
Definition: name.hpp:40
An Interest holds a Name and other fields for an interest.
Definition: interest.hpp:41
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 sele...
Definition: pending-interest-table.cpp:70
bool removeEntry(const ptr_lib::shared_ptr< Entry > &pendingInterest)
Remove the specific pendingInterest entry from the table and set its isRemoved flag.
Definition: pending-interest-table.cpp:141
uint64_t getPendingInterestId()
Get the pendingInterestId given to the constructor.
Definition: pending-interest-table.hpp:59
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.
Definition: pending-interest-table.cpp:49
void removePendingInterest(uint64_t pendingInterestId)
Remove the pending interest entry with the pendingInterestId from the pending interest table and set ...
Definition: pending-interest-table.cpp:110
const OnNetworkNack & getOnNetworkNack()
Get the OnNetworkNack callback given to the constructor.
Definition: pending-interest-table.hpp:81
func_lib::function< void(const ptr_lib::shared_ptr< const Interest > &, const ptr_lib::shared_ptr< Data > &)> OnData
An OnData function object is used to pass a callback to expressInterest.
Definition: face.hpp:35
func_lib::function< void(const ptr_lib::shared_ptr< const Interest > &, const ptr_lib::shared_ptr< NetworkNack > &)> OnNetworkNack
An OnNetworkNack function object is used to pass a callback to expressInterest.
Definition: face.hpp:52