NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn-stack-helper.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
20 #ifndef NDNSIM_HELPER_NDN_STACK_HELPER_HPP
21 #define NDNSIM_HELPER_NDN_STACK_HELPER_HPP
22 
23 #include "ns3/ndnSIM/model/ndn-common.hpp"
24 
25 #include "ns3/ptr.h"
26 #include "ns3/object-factory.h"
27 #include "ns3/node.h"
28 #include "ns3/node-container.h"
29 
30 #include "ndn-fib-helper.hpp"
32 
33 namespace nfd {
34 namespace cs {
35 class Policy;
36 } // namespace cs
37 } // namespace nfd
38 
39 namespace ns3 {
40 
41 class Node;
42 
43 namespace ndn {
44 
45 class L3Protocol;
46 
55 class StackHelper : boost::noncopyable {
56 public:
60  StackHelper();
61 
65  virtual ~StackHelper();
66 
70  void
71  SetStackAttributes(const std::string& attr1 = "", const std::string& value1 = "",
72  const std::string& attr2 = "", const std::string& value2 = "",
73  const std::string& attr3 = "", const std::string& value3 = "",
74  const std::string& attr4 = "", const std::string& value4 = "");
75 
79  void
80  setCsSize(size_t maxSize);
81 
85  void
86  setPolicy(const std::string& policy);
87 
88  typedef Callback<shared_ptr<Face>, Ptr<Node>, Ptr<L3Protocol>, Ptr<NetDevice>>
90 
100  void
101  AddFaceCreateCallback(TypeId netDeviceType, FaceCreateCallback callback);
102 
111  void
112  UpdateFaceCreateCallback(TypeId netDeviceType, FaceCreateCallback callback);
113 
118  void
119  RemoveFaceCreateCallback(TypeId netDeviceType, FaceCreateCallback callback);
120 
132  void
133  Install(const std::string& nodeName) const;
134 
146  void
147  Install(Ptr<Node> node) const;
148 
161  void
162  Install(const NodeContainer& c) const;
163 
170  void
171  InstallAll() const;
172 
176  void
177  SetDefaultRoutes(bool needSet);
178 
179  static KeyChain&
180  getKeyChain();
181 
187  void
188  Update(Ptr<Node> node);
189 
195  void
196  Update(const NodeContainer& c);
197 
203  void
204  Update(const std::string& nodeName);
205 
209  void
210  UpdateAll();
211 
215  void
217 
221  void
223 
227  static void
229 
230  static void
232 
233 private:
234  void
235  doInstall(Ptr<Node> node) const;
236 
237 private:
238  shared_ptr<Face>
239  DefaultNetDeviceCallback(Ptr<Node> node, Ptr<L3Protocol> ndn, Ptr<NetDevice> netDevice) const;
240 
241  shared_ptr<Face>
242  PointToPointNetDeviceCallback(Ptr<Node> node, Ptr<L3Protocol> ndn,
243  Ptr<NetDevice> netDevice) const;
244  shared_ptr<Face>
245  createAndRegisterFace(Ptr<Node> node, Ptr<L3Protocol> ndn, Ptr<NetDevice> device) const;
246 
247  bool m_isForwarderStatusManagerDisabled;
248  bool m_isStrategyChoiceManagerDisabled;
249 
250 public:
251  void
253 
254 private:
255  ObjectFactory m_ndnFactory;
256 
257  bool m_needSetDefaultRoutes;
258  size_t m_maxCsSize = 100;
259 
260  typedef std::function<std::unique_ptr<nfd::cs::Policy>()> PolicyCreationCallback;
261  PolicyCreationCallback m_csPolicyCreationFunc;
262 
263  std::map<std::string, PolicyCreationCallback> m_csPolicies;
264 
265  typedef std::list<std::pair<TypeId, FaceCreateCallback>> NetDeviceCallbackList;
266  NetDeviceCallbackList m_netDeviceCallbacks;
267 };
268 
269 } // namespace ndn
270 } // namespace ns3
271 
272 #endif // NDNSIM_HELPER_NDN_STACK_HELPER_HPP
ndn-strategy-choice-helper.hpp
ns3::ndn::StackHelper::setPolicy
void setPolicy(const std::string &policy)
Set the cache replacement policy for NFD's Content Store.
Definition: ndn-stack-helper.cpp:120
ns3::ndn::StackHelper::StackHelper
StackHelper()
Create a new NdnStackHelper with a default NDN_FLOODING forwarding stategy.
Definition: ndn-stack-helper.cpp:52
ns3
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-app-link-service.cpp:32
ns3::ndn::StackHelper::disableStrategyChoiceManager
void disableStrategyChoiceManager()
Disable Strategy Choice Manager.
Definition: ndn-stack-helper.cpp:375
ns3::ndn::StackHelper::disableForwarderStatusManager
void disableForwarderStatusManager()
Disable Forwarder Status Manager.
Definition: ndn-stack-helper.cpp:381
ns3::ndn::StackHelper::Install
void Install(const std::string &nodeName) const
Install Ndn stack on the node.
Definition: ndn-stack-helper.cpp:302
ns3::ndn::StackHelper::SetLinkDelayAsFaceMetric
static void SetLinkDelayAsFaceMetric()
Set face metric of all faces connected through PointToPoint channel to channel latency.
Definition: ndn-stack-helper.cpp:387
ns3::ndn::StackHelper::SetDefaultRoutes
void SetDefaultRoutes(bool needSet)
Set flag indicating necessity to install default routes in FIB.
Definition: ndn-stack-helper.cpp:91
ns3::ndn::StackHelper::InstallAll
void InstallAll() const
Install Ndn stack on all nodes in the simulation.
Definition: ndn-stack-helper.cpp:144
ns3::ndn::StackHelper::AddFaceCreateCallback
void AddFaceCreateCallback(TypeId netDeviceType, FaceCreateCallback callback)
Add callback to create and configure instance of the face, based on supplied Ptr<Node> and Ptr<NetDev...
Definition: ndn-stack-helper.cpp:194
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
ns3::ndn::StackHelper::setCsSize
void setCsSize(size_t maxSize)
Set maximum size for NFD's Content Store (in number of packets)
Definition: ndn-stack-helper.cpp:114
ns3::ndn::StackHelper::UpdateFaceCreateCallback
void UpdateFaceCreateCallback(TypeId netDeviceType, FaceCreateCallback callback)
Update callback to create and configure instance of the face, based on supplied Ptr<Node> and Ptr<Net...
Definition: ndn-stack-helper.cpp:201
ns3::ndn::StackHelper::SetStackAttributes
void SetStackAttributes(const std::string &attr1="", const std::string &value1="", const std::string &attr2="", const std::string &value2="", const std::string &attr3="", const std::string &value3="", const std::string &attr4="", const std::string &value4="")
Set parameters of NdnL3Protocol.
Definition: ndn-stack-helper.cpp:98
ndn-fib-helper.hpp
ns3::ndn::StackHelper::RemoveFaceCreateCallback
void RemoveFaceCreateCallback(TypeId netDeviceType, FaceCreateCallback callback)
Remove callback to create and configure instance of the face, based on supplied Ptr<Node> and Ptr<Net...
Definition: ndn-stack-helper.cpp:213
ns3::ndn::StackHelper::FaceCreateCallback
Callback< shared_ptr< Face >, Ptr< Node >, Ptr< L3Protocol >, Ptr< NetDevice > > FaceCreateCallback
Definition: ndn-stack-helper.hpp:89
ns3::ndn::StackHelper
Helper class to install NDN stack and configure its parameters.
Definition: ndn-stack-helper.hpp:55
ndn::security::v2::KeyChain
ndn security v2 KeyChain
Definition: key-chain.cpp:68
ns3::ndn::StackHelper::UpdateAll
void UpdateAll()
Update Ndn stack on all the nodes (Add faces for new devices)
Definition: ndn-stack-helper.cpp:344
ns3::ndn::StackHelper::ProcessWarmupEvents
static void ProcessWarmupEvents()
Definition: ndn-stack-helper.cpp:410
ns3::ndn::StackHelper::~StackHelper
virtual ~StackHelper()
Destroy the NdnStackHelper.
Definition: ndn-stack-helper.cpp:72
ns3::ndn::StackHelper::Update
void Update(Ptr< Node > node)
Update Ndn stack on a given node (Add faces for new devices)
Definition: ndn-stack-helper.cpp:309
ns3::ndn::StackHelper::getKeyChain
static KeyChain & getKeyChain()
Definition: ndn-stack-helper.cpp:77
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-strategy-choice-helper.hpp:34
L3Protocol
ndn L3Protocol
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-l3-protocol.cpp:60
ns3::ndn::StackHelper::setCustomNdnCxxClocks
void setCustomNdnCxxClocks()
Definition: ndn-stack-helper.cpp:84