NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
notification-stream.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
28
#ifndef NDN_UTIL_NOTIFICATION_STREAM_HPP
29
#define NDN_UTIL_NOTIFICATION_STREAM_HPP
30
31
#include "../name.hpp"
32
#include "../face.hpp"
33
#include "../security/v2/key-chain.hpp"
34
35
#include "
concepts.hpp
"
36
37
namespace
ndn
{
38
namespace
util {
39
43
template
<
typename
Notification>
44
class
NotificationStream
: noncopyable
45
{
46
public
:
47
BOOST_CONCEPT_ASSERT((
WireEncodable<Notification>
));
48
49
NotificationStream
(
Face
&
face
,
const
Name
& prefix,
KeyChain
& keyChain)
50
: m_face(face)
51
, m_prefix(prefix)
52
, m_keyChain(keyChain)
53
, m_sequenceNo(0)
54
{
55
}
56
57
virtual
58
~NotificationStream
() =
default
;
59
60
void
61
postNotification
(
const
Notification& notification)
62
{
63
Name
dataName = m_prefix;
64
dataName.
appendSequenceNumber
(m_sequenceNo);
65
66
shared_ptr<Data> data = make_shared<Data>(dataName);
67
data->setContent(notification.wireEncode());
68
data->setFreshnessPeriod(time::seconds(1));
69
70
m_keyChain.sign(*data);
71
m_face.
put
(*data);
72
73
++m_sequenceNo;
74
}
75
76
private
:
77
Face
& m_face;
78
const
Name
m_prefix;
79
KeyChain
& m_keyChain;
80
uint64_t m_sequenceNo;
81
};
82
83
}
// namespace util
84
}
// namespace ndn
85
86
#endif // NDN_UTIL_NOTIFICATION_STREAM_HPP
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::util::NotificationStream
provides a publisher of Notification Stream
Definition:
notification-stream.hpp:44
ndn::util::NotificationStream::postNotification
void postNotification(const Notification ¬ification)
Definition:
notification-stream.hpp:61
ndn::util::NotificationStream::~NotificationStream
virtual ~NotificationStream()=default
ndn::Face
Provide a communication channel with local or remote NDN forwarder.
Definition:
face.hpp:95
face
ndn::util::NotificationStream::NotificationStream
NotificationStream(Face &face, const Name &prefix, KeyChain &keyChain)
Definition:
notification-stream.hpp:49
ndn::Name::appendSequenceNumber
Name & appendSequenceNumber(uint64_t seqNo)
Append a sequence number component.
Definition:
name.hpp:406
ndn::Name
Represents an absolute name.
Definition:
name.hpp:42
concepts.hpp
ndn::Face::put
void put(Data data)
Publish data packet.
Definition:
face.cpp:183
ndn::WireEncodable
a concept check for TLV abstraction with .wireEncode method
Definition:
concepts.hpp:44
ndn::security::v2::KeyChain
ndn security v2 KeyChain
Definition:
key-chain.cpp:76
ndnSIM
ndn-cxx
src
util
notification-stream.hpp
Generated on Thu Nov 2 2017 03:30:29 for ndnSIM by
1.8.11