NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn-app-helper.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
20 #ifndef NDN_APP_HELPER_H
21 #define NDN_APP_HELPER_H
22 
23 #include "ns3/ndnSIM/model/ndn-common.hpp"
24 
25 #include "ns3/object-factory.h"
26 #include "ns3/attribute.h"
27 #include "ns3/node-container.h"
28 #include "ns3/application-container.h"
29 #include "ns3/ptr.h"
30 
31 namespace ns3 {
32 namespace ndn {
33 
39 class AppHelper {
40 public:
46  AppHelper(const std::string& prefix);
47 
51  void
52  SetPrefix(const std::string& prefix);
53 
60  void
61  SetAttribute(std::string name, const AttributeValue& value);
62 
71  ApplicationContainer
72  Install(NodeContainer c);
73 
81  ApplicationContainer
82  Install(Ptr<Node> node);
83 
91  ApplicationContainer
92  Install(std::string nodeName);
93 
94 private:
103  Ptr<Application>
104  InstallPriv(Ptr<Node> node);
105  ObjectFactory m_factory;
106 };
107 
125 class FactoryCallbackApp : public Application
126 {
127 public:
128  typedef std::function<shared_ptr<void>()> FactoryCallback;
129 
130  FactoryCallbackApp(const FactoryCallback& factory);
131 
132 public:
133  static ApplicationContainer
134  Install(Ptr<Node> node, const FactoryCallback& factory);
135 
136 protected:
137  // inherited from Application base class.
138  virtual void
140 
141  virtual void
142  StopApplication();
143 
144 private:
145  FactoryCallback m_factory;
146  std::shared_ptr<void> m_impl;
147 };
148 
149 } // namespace ndn
150 } // namespace ns3
151 
152 #endif // NDN_APP_HELPER_H
FactoryCallbackApp(const FactoryCallback &factory)
Copyright (c) 2011-2015 Regents of the University of California.
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
AppHelper(const std::string &prefix)
Create an NdnAppHelper to make it easier to work with Ndn apps.
ApplicationContainer Install(NodeContainer c)
Install an ns3::NdnConsumer on each node of the input container configured with all the attributes se...
Copyright (c) 2011-2015 Regents of the University of California.
static ApplicationContainer Install(Ptr< Node > node, const FactoryCallback &factory)
An application that can be created using the supplied callback.
void SetPrefix(const std::string &prefix)
Set the prefix consumer will be requesting.
A helper to make it easier to instantiate an ns3::ndn::App applications on a set of nodes.
std::function< shared_ptr< void >)> FactoryCallback