NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
channel-status-publisher.cpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26
#include "
channel-status-publisher.hpp
"
27
#include "
face/protocol-factory.hpp
"
28
#include "
face/channel.hpp
"
29
30
#include <ndn-cxx/management/nfd-channel-status.hpp>
31
32
namespace
nfd
{
33
34
ChannelStatusPublisher::ChannelStatusPublisher
(
const
FactoryMap
& factories,
35
AppFace
& face,
36
const
Name
& prefix,
37
ndn::KeyChain
& keyChain)
38
:
SegmentPublisher
(face, prefix, keyChain)
39
, m_factories(factories)
40
{
41
}
42
43
ChannelStatusPublisher::~ChannelStatusPublisher
()
44
{
45
}
46
47
size_t
48
ChannelStatusPublisher::generate
(
ndn::EncodingBuffer
& outBuffer)
49
{
50
size_t
totalLength = 0;
51
std::set<shared_ptr<ProtocolFactory> > seenFactories;
52
53
for
(FactoryMap::const_iterator i = m_factories.begin();
54
i != m_factories.end(); ++i)
55
{
56
const
shared_ptr<ProtocolFactory>& factory = i->second;
57
58
if
(seenFactories.find(factory) != seenFactories.end())
59
{
60
continue
;
61
}
62
seenFactories.insert(factory);
63
64
std::list<shared_ptr<const Channel> > channels = factory->getChannels();
65
66
for
(std::list<shared_ptr<const Channel> >::const_iterator j = channels.begin();
67
j != channels.end(); ++j)
68
{
69
ndn::nfd::ChannelStatus
entry;
70
entry.
setLocalUri
((*j)->getUri().toString());
71
72
totalLength += entry.
wireEncode
(outBuffer);
73
}
74
}
75
76
return
totalLength;
77
}
78
79
}
// namespace nfd
nfd::SegmentPublisher
provides a publisher of Status Dataset or other segmented octet stream
Definition:
segment-publisher.hpp:40
nfd::AppFace
Definition:
app-face.hpp:37
nfd::ChannelStatusPublisher::generate
virtual size_t generate(ndn::EncodingBuffer &outBuffer)
In a derived class, write the octets into outBuffer.
Definition:
channel-status-publisher.cpp:48
channel-status-publisher.hpp
nfd::ChannelStatusPublisher::ChannelStatusPublisher
ChannelStatusPublisher(const FactoryMap &factories, AppFace &face, const Name &prefix, ndn::KeyChain &keyChain)
Definition:
channel-status-publisher.cpp:34
ndn::security::KeyChain
The packet signing interface.
Definition:
key-chain.hpp:48
protocol-factory.hpp
channel.hpp
nfd::ChannelStatusPublisher::~ChannelStatusPublisher
virtual ~ChannelStatusPublisher()
Definition:
channel-status-publisher.cpp:43
ndn::encoding::EncodingBuffer
EncodingImpl< EncoderTag > EncodingBuffer
Definition:
encoding-buffer-fwd.hpp:45
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
ndn::Name
Name abstraction to represent an absolute name.
Definition:
name.hpp:46
nfd::ChannelStatusPublisher::FactoryMap
std::map< std::string, shared_ptr< ProtocolFactory > > FactoryMap
Definition:
channel-status-publisher.hpp:39
ndn::nfd::ChannelStatus
represents NFD Channel Status dataset
Definition:
nfd-channel-status.hpp:35
ndn::nfd::ChannelStatus::wireEncode
size_t wireEncode(EncodingImpl< TAG > &encoder) const
Definition:
nfd-channel-status.cpp:47
ndn::nfd::ChannelStatus::setLocalUri
ChannelStatus & setLocalUri(const std::string localUri)
Definition:
nfd-channel-status.cpp:101
ndnSIM
NFD
daemon
mgmt
channel-status-publisher.cpp
Generated on Fri Feb 23 2018 12:30:55 for ndnSIM by
1.8.14