48 #ifndef NDN_UTIL_NOTIFICATION_SUBSCRIBER_HPP
49 #define NDN_UTIL_NOTIFICATION_SUBSCRIBER_HPP
51 #include "../face.hpp"
57 #include <boost/concept_check.hpp>
76 return m_interestLifetime;
103 time::milliseconds interestLifetime);
107 sendInitialInterest();
113 hasSubscriber()
const = 0;
122 afterReceiveData(
const Data& data);
128 decodeAndDeliver(
const Data& data) = 0;
131 afterReceiveNack(
const lp::Nack& nack);
156 uint64_t m_lastSequenceNo;
157 uint64_t m_lastNackSequenceNo;
161 const PendingInterestId* m_lastInterestId;
162 time::milliseconds m_interestLifetime;
169 template<
typename Notification>
173 BOOST_CONCEPT_ASSERT((boost::DefaultConstructible<Notification>));
181 time::milliseconds interestLifetime = time::seconds(60))
194 hasSubscriber()
const override
196 return !onNotification.isEmpty();
200 decodeAndDeliver(
const Data& data)
override
202 Notification notification;
218 #endif // NDN_UTIL_NOTIFICATION_SUBSCRIBER_HPP
void start()
start or resume receiving notifications
Copyright (c) 2013-2016 Regents of the University of California.
virtual ~NotificationSubscriberBase()
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
Name abstraction to represent an absolute name.
Event that is automatically cancelled upon destruction.
const Block & getContent() const
Get content Block.
signal::Signal< NotificationSubscriberBase, Data > onDecodeError
fires when a Data packet in the Notification Stream cannot be decoded as Notification ...
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