|
NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
|
API Documentation
|
Go to the documentation of this file.
22 #ifndef NDN_IMPL_PENDING_INTEREST_HPP
23 #define NDN_IMPL_PENDING_INTEREST_HPP
37 class PendingInterestId;
39 static_assert(
sizeof(
const PendingInterestId*) ==
sizeof(
RecordId),
"");
57 return os <<
"forwarder";
77 : m_interest(std::
move(interest))
79 , m_dataCallback(dataCallback)
80 , m_nackCallback(nackCallback)
81 , m_timeoutCallback(timeoutCallback)
91 : m_interest(std::
move(interest))
98 shared_ptr<const Interest>
130 BOOST_ASSERT(m_nNotNacked >= 0);
133 m_leastSevereNack = nack;
136 return m_nNotNacked > 0 ?
nullopt : m_leastSevereNack;
146 if (m_dataCallback !=
nullptr) {
147 m_dataCallback(*m_interest, data);
158 if (m_nackCallback !=
nullptr) {
159 m_nackCallback(*m_interest, nack);
167 m_timeoutEvent =
scheduler.schedule(m_interest->getInterestLifetime(),
168 [=] { this->invokeTimeoutCallback(); });
175 invokeTimeoutCallback()
177 if (m_timeoutCallback) {
178 m_timeoutCallback(*m_interest);
185 shared_ptr<const Interest> m_interest;
192 optional<lp::Nack> m_leastSevereNack;
193 std::function<void()> m_deleter;
198 #endif // NDN_IMPL_PENDING_INTEREST_HPP
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.
@ FORWARDER
Interest was received from the forwarder via Transport.
@ APP
Interest was received from this app via Face::expressInterest API.
void recordForwarding()
Record that the Interest has been forwarded to one destination.
void invokeDataCallback(const Data &data)
Invoke the Data callback.
void invokeNackCallback(const lp::Nack &nack)
Invoke the Nack callback.
#define NDN_CXX_UNREACHABLE
PendingInterestOrigin getOrigin() const
PendingInterestOrigin
Indicates where a pending Interest came from.
Stores a pending Interest and associated callbacks.
NackReason getReason() const
bool isLessSevere(lp::NackReason x, lp::NackReason y)
compare NackReason for severity
optional< lp::Nack > recordNack(const lp::Nack &nack)
Record an incoming Nack against a forwarded Interest.
function< void(const Interest &, const Data &)> DataCallback
Callback invoked when expressed Interest gets satisfied with a Data packet.
PendingInterest(shared_ptr< const Interest > interest, Scheduler &scheduler)
Construct a pending Interest record for an Interest from NFD.
const nullopt_t nullopt((nullopt_t::init()))
Represents a Data packet.
function< void(const Interest &, const lp::Nack &)> NackCallback
Callback invoked when Nack is sent in response to expressed Interest.
represents a Network Nack
Generic time-based scheduler.
shared_ptr< const Interest > getInterest() const
std::ostream & operator<<(std::ostream &os, const Data &data)
function< void(const Interest &)> TimeoutCallback
Callback invoked when expressed Interest times out.
Template of PendingInterest, RegisteredPrefix, and InterestFilterRecord.
void deleteSelf()
Delete this record from the container.
Copyright (c) 2011-2015 Regents of the University of California.