41   , m_lastSequenceNum(std::numeric_limits<uint64_t>::max())
 
   42   , m_lastNackSequenceNum(std::numeric_limits<uint64_t>::max())
 
   44   , m_scheduler(face.getIoService())
 
   45   , m_interestLifetime(interestLifetime)
 
   58   sendInitialInterest();
 
   72 NotificationSubscriberBase::sendInitialInterest()
 
   77   auto interest = make_shared<Interest>(m_prefix);
 
   78   interest->setCanBePrefix(
true);
 
   79   interest->setMustBeFresh(
true);
 
   80   interest->setInterestLifetime(m_interestLifetime);
 
   81   sendInterest(*interest);
 
   85 NotificationSubscriberBase::sendNextInterest()
 
   90   Name nextName = m_prefix;
 
   93   auto interest = make_shared<Interest>(nextName);
 
   94   interest->setCanBePrefix(
false);
 
   95   interest->setInterestLifetime(m_interestLifetime);
 
   96   sendInterest(*interest);
 
  100 NotificationSubscriberBase::sendInterest(
const Interest& interest)
 
  103                                           [
this] (
const auto&, 
const auto& d) { this->afterReceiveData(d); },
 
  104                                           [
this] (
const auto&, 
const auto& n) { this->afterReceiveNack(n); },
 
  105                                           [
this] (
const auto&) { this->afterTimeout(); });
 
  109 NotificationSubscriberBase::shouldStop()
 
  114   if (!hasSubscriber() && 
onNack.isEmpty()) {
 
  122 NotificationSubscriberBase::afterReceiveData(
const Data& data)
 
  128     m_lastSequenceNum = data.getName().get(-1).toSequenceNumber();
 
  130   catch (
const tlv::Error&) {
 
  132     sendInitialInterest();
 
  136   if (!decodeAndDeliver(data)) {
 
  138     sendInitialInterest();
 
  146 NotificationSubscriberBase::afterReceiveNack(
const lp::Nack& nack)
 
  154   m_nackEvent = m_scheduler.
schedule(delay, [
this] { sendInitialInterest(); });
 
  158 NotificationSubscriberBase::afterTimeout()
 
  165   sendInitialInterest();
 
  169 NotificationSubscriberBase::exponentialBackoff(
lp::Nack nack)
 
  171   uint64_t nackSequenceNum;
 
  173     nackSequenceNum = nack.getInterest().getName().get(-1).toSequenceNumber();
 
  175   catch (
const tlv::Error&) {
 
  179   if (m_lastNackSequenceNum == nackSequenceNum) {
 
  186   m_lastNackSequenceNum = nackSequenceNum;
 
  188   return time::milliseconds(
static_cast<time::milliseconds::rep
>(std::pow(2, m_attempts) * 100 +
 
Provide a communication channel with local or remote NDN forwarder.
 
PendingInterestHandle expressInterest(const Interest &interest, const DataCallback &afterSatisfied, const NackCallback &afterNacked, const TimeoutCallback &afterTimeout)
Express Interest.
 
Represents an absolute name.
 
Name & appendSequenceNumber(uint64_t seqNo)
Append a sequence number component.
 
void cancel()
Cancel the operation.
 
EventId schedule(time::nanoseconds after, EventCallback callback)
Schedule a one-time event after the specified delay.
 
void start()
start or resume receiving notifications
 
signal::Signal< NotificationSubscriberBase, Data > onDecodeError
fires when a Data packet in the Notification Stream cannot be decoded as Notification
 
void stop()
stop receiving notifications
 
virtual ~NotificationSubscriberBase()
 
signal::Signal< NotificationSubscriberBase > onTimeout
fires when no Notification is received within .getInterestLifetime period
 
NotificationSubscriberBase(Face &face, const Name &prefix, time::milliseconds interestLifetime)
construct a NotificationSubscriber
 
signal::Signal< NotificationSubscriberBase, lp::Nack > onNack
fires when a NACK is received
 
uint32_t generateWord32()
Generate a non-cryptographically-secure random integer in the range [0, 2^32)
 
boost::chrono::milliseconds milliseconds