NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
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
28
#include "
core/logger.hpp
"
29
#include "
face/protocol-factory.hpp
"
30
#include "
face/channel.hpp
"
31
32
#include <ndn-cxx/management/nfd-channel-status.hpp>
33
34
namespace
nfd {
35
36
NFD_LOG_INIT
(
"ChannelStatusPublisher"
);
37
38
39
ChannelStatusPublisher::ChannelStatusPublisher
(
const
FactoryMap
& factories,
40
AppFace
& face,
41
const
Name
& prefix,
42
ndn::KeyChain& keyChain)
43
:
SegmentPublisher
(face, prefix, keyChain)
44
, m_factories(factories)
45
{
46
47
}
48
49
50
ChannelStatusPublisher::~ChannelStatusPublisher
()
51
{
52
53
}
54
55
size_t
56
ChannelStatusPublisher::generate
(ndn::EncodingBuffer& outBuffer)
57
{
58
size_t
totalLength = 0;
59
std::set<shared_ptr<ProtocolFactory> > seenFactories;
60
61
for
(FactoryMap::const_iterator i = m_factories.begin();
62
i != m_factories.end(); ++i)
63
{
64
const
shared_ptr<ProtocolFactory>& factory = i->second;
65
66
if
(seenFactories.find(factory) != seenFactories.end())
67
{
68
continue
;
69
}
70
seenFactories.insert(factory);
71
72
std::list<shared_ptr<const Channel> > channels = factory->getChannels();
73
74
for
(std::list<shared_ptr<const Channel> >::const_iterator j = channels.begin();
75
j != channels.end(); ++j)
76
{
77
ndn::nfd::ChannelStatus entry;
78
entry.setLocalUri((*j)->getUri().toString());
79
80
totalLength += entry.wireEncode(outBuffer);
81
}
82
}
83
84
return
totalLength;
85
}
86
87
}
// 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:56
channel-status-publisher.hpp
nfd::ChannelStatusPublisher::ChannelStatusPublisher
ChannelStatusPublisher(const FactoryMap &factories, AppFace &face, const Name &prefix, ndn::KeyChain &keyChain)
Definition:
channel-status-publisher.cpp:39
protocol-factory.hpp
channel.hpp
logger.hpp
nfd::ChannelStatusPublisher::~ChannelStatusPublisher
virtual ~ChannelStatusPublisher()
Definition:
channel-status-publisher.cpp:50
ns3::ndn::Name
Name
Definition:
ndn-common.cpp:25
nfd::ChannelStatusPublisher::FactoryMap
std::map< std::string, shared_ptr< ProtocolFactory > > FactoryMap
Definition:
channel-status-publisher.hpp:39
NFD_LOG_INIT
#define NFD_LOG_INIT(name)
Definition:
logger.hpp:33
ndnSIM
NFD
daemon
mgmt
channel-status-publisher.cpp
Generated on Wed Feb 18 2015 16:31:16 for ndnSIM by
1.8.7