NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: 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; -*- */
26
#ifndef NFD_CORE_NOTIFICATION_STREAM_HPP
27
#define NFD_CORE_NOTIFICATION_STREAM_HPP
28
29
#include "common.hpp"
30
31
#include <ndn-cxx/encoding/encoding-buffer.hpp>
32
#include <ndn-cxx/security/key-chain.hpp>
33
34
namespace
nfd
{
35
39
template
<
class
FaceBase>
40
class
NotificationStream
: noncopyable
41
{
42
public
:
43
NotificationStream
(FaceBase& face,
const
Name
& prefix,
ndn::KeyChain
& keyChain)
44
: m_face(face)
45
, m_prefix(prefix)
46
, m_keyChain(keyChain)
47
, m_sequenceNo(0)
48
{
49
}
50
51
virtual
52
~NotificationStream
()
53
{
54
}
55
56
template
<
typename
T>
void
57
postNotification
(
const
T& notification)
58
{
59
Name
dataName = m_prefix;
60
dataName.
appendSequenceNumber
(m_sequenceNo);
61
62
shared_ptr<Data> data = make_shared<Data>(dataName);
63
data->setContent(notification.wireEncode());
64
data->setFreshnessPeriod(time::seconds(1));
65
66
m_keyChain.
sign
(*data);
67
m_face.put(*data);
68
69
++m_sequenceNo;
70
}
71
72
private
:
73
FaceBase& m_face;
74
const
Name
m_prefix;
75
ndn::KeyChain
& m_keyChain;
76
uint64_t m_sequenceNo;
77
};
78
79
}
// namespace nfd
80
81
#endif // NFD_CORE_NOTIFICATION_STREAM_HPP
ndn::security::KeyChain
The packet signing interface.
Definition:
key-chain.hpp:48
nfd::NotificationStream
provides a publisher of Notification Stream
Definition:
notification-stream.hpp:40
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:517
ndn::Name::appendSequenceNumber
Name & appendSequenceNumber(uint64_t seqNo)
Append sequence number using NDN naming conventions.
Definition:
name.cpp:253
nfd::NotificationStream::NotificationStream
NotificationStream(FaceBase &face, const Name &prefix, ndn::KeyChain &keyChain)
Definition:
notification-stream.hpp:43
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
nfd::NotificationStream::postNotification
void postNotification(const T ¬ification)
Definition:
notification-stream.hpp:57
ndn::Name
Name abstraction to represent an absolute name.
Definition:
name.hpp:46
nfd::NotificationStream::~NotificationStream
virtual ~NotificationStream()
Definition:
notification-stream.hpp:52
ndnSIM
NFD
core
notification-stream.hpp
Generated on Fri Feb 23 2018 12:30:55 for ndnSIM by
1.8.14