28 #ifndef NDN_CXX_UTIL_NOTIFICATION_SUBSCRIBER_HPP
29 #define NDN_CXX_UTIL_NOTIFICATION_SUBSCRIBER_HPP
53 return m_interestLifetime;
91 sendInitialInterest();
97 sendInterest(
const Interest& interest);
100 hasSubscriber()
const = 0;
103 afterReceiveData(
const Data& data);
109 decodeAndDeliver(
const Data& data) = 0;
112 afterReceiveNack(
const lp::Nack& nack);
118 exponentialBackoff(
const lp::Nack& nack);
133 uint64_t m_lastSequenceNum = std::numeric_limits<uint64_t>::max();
134 uint64_t m_lastNackSequenceNum = std::numeric_limits<uint64_t>::max();
135 uint64_t m_attempts = 1;
140 bool m_isRunning =
false;
148 template<
typename Notification>
152 BOOST_CONCEPT_ASSERT((boost::DefaultConstructible<Notification>));
174 hasSubscriber()
const override
180 decodeAndDeliver(
const Data& data)
override
182 Notification notification;
Block blockFromValue() const
Return a new Block constructed from the TLV-VALUE of this Block.
Represents a Data packet.
const Block & getContent() const noexcept
Get the Content element.
Provide a communication channel with local or remote NDN forwarder.
Represents an Interest packet.
Represents an absolute name.
A concept check for TLV abstraction with a wireDecode(Block) method and constructible from Block.
Represents a Network Nack.
Generic time-based event scheduler.
Provides a lightweight signal / event system.
Represents an error in TLV encoding or decoding.
void start()
Start or resume receiving notifications.
void stop()
Stop receiving notifications.
ndn::signal::Signal< NotificationSubscriberBase > onTimeout
Fires when no Notification is received within getInterestLifetime() period.
virtual ~NotificationSubscriberBase()
time::milliseconds getInterestLifetime() const
NotificationSubscriberBase(Face &face, const Name &prefix, time::milliseconds interestLifetime)
Construct a NotificationSubscriber.
ndn::signal::Signal< NotificationSubscriberBase, lp::Nack > onNack
Fires when a Nack is received.
ndn::signal::Signal< NotificationSubscriberBase, Data > onDecodeError
Fires when a Data packet in the notification stream cannot be decoded as a Notification.
Provides the subscriber side of a Notification Stream.
NotificationSubscriber(Face &face, const Name &prefix, time::milliseconds interestLifetime=1_min)
Construct a NotificationSubscriber.
ndn::signal::Signal< NotificationSubscriber, Notification > onNotification
Fires when a Notification is received.
::boost::chrono::milliseconds milliseconds