NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
notification-stream.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
48
#ifndef NDN_UTIL_NOTIFICATION_STREAM_HPP
49
#define NDN_UTIL_NOTIFICATION_STREAM_HPP
50
51
#include "../name.hpp"
52
#include "../face.hpp"
53
#include "../security/key-chain.hpp"
54
55
#include "
concepts.hpp
"
56
57
namespace
ndn
{
58
59
namespace
util {
60
64
template
<
typename
Notification>
65
class
NotificationStream
: noncopyable
66
{
67
public
:
68
BOOST_CONCEPT_ASSERT((
WireEncodable<Notification>
));
69
70
NotificationStream
(
Face
&
face
,
const
Name
& prefix,
KeyChain
& keyChain)
71
: m_face(face)
72
, m_prefix(prefix)
73
, m_keyChain(keyChain)
74
, m_sequenceNo(0)
75
{
76
}
77
78
virtual
79
~NotificationStream
()
80
{
81
}
82
83
void
84
postNotification
(
const
Notification& notification)
85
{
86
Name
dataName = m_prefix;
87
dataName.
appendSequenceNumber
(m_sequenceNo);
88
89
shared_ptr<Data> data = make_shared<Data>(dataName);
90
data->setContent(notification.wireEncode());
91
data->setFreshnessPeriod(time::seconds(1));
92
93
m_keyChain.
sign
(*data);
94
m_face.
put
(*data);
95
96
++m_sequenceNo;
97
}
98
99
private
:
100
Face
& m_face;
101
const
Name
m_prefix;
102
KeyChain
& m_keyChain;
103
uint64_t m_sequenceNo;
104
};
105
106
}
// namespace util
107
}
// namespace ndn
108
109
#endif // NDN_UTIL_NOTIFICATION_STREAM_HPP
ndn::util::NotificationStream::~NotificationStream
virtual ~NotificationStream()
Definition:
notification-stream.hpp:79
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:65
ndn::security::KeyChain
The packet signing interface.
Definition:
key-chain.hpp:48
ndn::security::KeyChain::sign
void sign(Data &data, const SigningInfo ¶ms=DEFAULT_SIGNING_INFO)
Sign data according to the supplied signing information.
Definition:
key-chain.cpp:501
ndn::Name::appendSequenceNumber
Name & appendSequenceNumber(uint64_t seqNo)
Append sequence number using NDN naming conventions.
Definition:
name.cpp:253
ndn::util::NotificationStream::postNotification
void postNotification(const Notification ¬ification)
Definition:
notification-stream.hpp:84
ndn::Face
Abstraction to communicate with local or remote NDN forwarder.
Definition:
face.hpp:119
face
ndn::util::NotificationStream::NotificationStream
NotificationStream(Face &face, const Name &prefix, KeyChain &keyChain)
Definition:
notification-stream.hpp:70
ndn::Name
Name abstraction to represent an absolute name.
Definition:
name.hpp:46
concepts.hpp
ndn::WireEncodable
a concept check for TLV abstraction with .wireEncode method
Definition:
concepts.hpp:34
ndn::Face::put
void put(const Data &data)
Publish data packet.
Definition:
face.cpp:171
ndnSIM
ndn-cxx
src
util
notification-stream.hpp
Generated on Sat Nov 12 2016 16:02:53 for ndnSIM by
1.8.12