28 #ifndef NDN_UTIL_NOTIFICATION_SUBSCRIBER_HPP 29 #define NDN_UTIL_NOTIFICATION_SUBSCRIBER_HPP 31 #include "../face.hpp" 55 return m_interestLifetime;
82 time::milliseconds interestLifetime);
86 sendInitialInterest();
92 hasSubscriber()
const = 0;
101 afterReceiveData(
const Data& data);
107 decodeAndDeliver(
const Data& data) = 0;
110 afterReceiveNack(
const lp::Nack& nack);
135 uint64_t m_lastSequenceNo;
136 uint64_t m_lastNackSequenceNo;
140 const PendingInterestId* m_lastInterestId;
141 time::milliseconds m_interestLifetime;
148 template<
typename Notification>
160 time::milliseconds interestLifetime = time::seconds(60))
173 hasSubscriber()
const override 175 return !onNotification.isEmpty();
179 decodeAndDeliver(
const Data& data)
override 181 Notification notification;
189 onNotification(notification);
197 #endif // NDN_UTIL_NOTIFICATION_SUBSCRIBER_HPP void start()
start or resume receiving notifications
Copyright (c) 2013-2017 Regents of the University of California.
virtual ~NotificationSubscriberBase()
BOOST_CONCEPT_ASSERT((boost::EqualityComparable< Data >))
time::milliseconds getInterestLifetime() const
provides a lightweight signal / event system
signal::Signal< NotificationSubscriber, Notification > onNotification
fires when a Notification is received
represents a Network Nack
signal::Signal< NotificationSubscriberBase, lp::Nack > onNack
fires when a NACK is received
Block blockFromValue() const
signal::Signal< NotificationSubscriberBase > onTimeout
fires when no Notification is received within .getInterestLifetime period
Provide a communication channel with local or remote NDN forwarder.
provides a subscriber of Notification Stream
NotificationSubscriber(Face &face, const Name &prefix, time::milliseconds interestLifetime=time::seconds(60))
construct a NotificationSubscriber
Represents an absolute name.
Event that is automatically cancelled upon destruction.
const Block & getContent() const
Get Content.
signal::Signal< NotificationSubscriberBase, Data > onDecodeError
fires when a Data packet in the Notification Stream cannot be decoded as Notification ...
Represents a Data packet.
a concept check for TLV abstraction with .wireDecode method and constructible from Block ...
represents an error in TLV encoding or decoding
NotificationSubscriberBase(Face &face, const Name &prefix, time::milliseconds interestLifetime)
construct a NotificationSubscriber
void stop()
stop receiving notifications