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
ns3::ndn::FactoryCallbackApp::StartApplication
virtual void StartApplication()
Definition: ndn-app-helper.cpp:123
ns3::ndn::AppHelper::SetAttribute
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
Definition: ndn-app-helper.cpp:49
ns3::ndn::AppHelper::SetPrefix
void SetPrefix(const std::string &prefix)
Set the prefix consumer will be requesting.
Definition: ndn-app-helper.cpp:43
ns3
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-app-link-service.cpp:32
ns3::ndn::FactoryCallbackApp
An application that can be created using the supplied callback.
Definition: ndn-app-helper.hpp:126
ns3::ndn::AppHelper
A helper to make it easier to instantiate an ns3::ndn::App applications on a set of nodes.
Definition: ndn-app-helper.hpp:39
ns3::ndn::AppHelper::Install
ApplicationContainer Install(NodeContainer c)
Install an ns3::NdnConsumer on each node of the input container configured with all the attributes se...
Definition: ndn-app-helper.cpp:73
ndn::name
Definition: name-component-types.hpp:33
ns3::ndn::AppHelper::AppHelper
AppHelper(const std::string &prefix)
Create an NdnAppHelper to make it easier to work with Ndn apps.
Definition: ndn-app-helper.cpp:37
ns3::ndn::FactoryCallbackApp::FactoryCallback
std::function< shared_ptr< void >)> FactoryCallback
Definition: ndn-app-helper.hpp:128
ns3::ndn::FactoryCallbackApp::FactoryCallbackApp
FactoryCallbackApp(const FactoryCallback &factory)
Definition: ndn-app-helper.cpp:107
ns3::ndn::FactoryCallbackApp::Install
static ApplicationContainer Install(Ptr< Node > node, const FactoryCallback &factory)
Definition: ndn-app-helper.cpp:113
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-strategy-choice-helper.hpp:34
ns3::ndn::FactoryCallbackApp::StopApplication
virtual void StopApplication()
Definition: ndn-app-helper.cpp:129