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; -*- */
28 #include "face/channel.hpp"
29 
30 #include <ndn-cxx/management/nfd-channel-status.hpp>
31 
32 namespace nfd {
33 
35  AppFace& face,
36  const Name& prefix,
37  ndn::KeyChain& keyChain)
38  : SegmentPublisher(face, prefix, keyChain)
39  , m_factories(factories)
40 {
41 }
42 
44 {
45 }
46 
47 size_t
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  {
70  entry.setLocalUri((*j)->getUri().toString());
71 
72  totalLength += entry.wireEncode(outBuffer);
73  }
74  }
75 
76  return totalLength;
77 }
78 
79 } // namespace nfd
provides a publisher of Status Dataset or other segmented octet stream
virtual size_t generate(ndn::EncodingBuffer &outBuffer)
In a derived class, write the octets into outBuffer.
ChannelStatusPublisher(const FactoryMap &factories, AppFace &face, const Name &prefix, ndn::KeyChain &keyChain)
The packet signing interface.
Definition: key-chain.hpp:48
EncodingImpl< EncoderTag > EncodingBuffer
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
Name abstraction to represent an absolute name.
Definition: name.hpp:46
std::map< std::string, shared_ptr< ProtocolFactory > > FactoryMap
represents NFD Channel Status dataset
size_t wireEncode(EncodingImpl< TAG > &encoder) const
ChannelStatus & setLocalUri(const std::string localUri)