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
216  disableStrategyChoiceManager();
217 
221  void
222  disableForwarderStatusManager();
223 
227  static void
228  SetLinkDelayAsFaceMetric();
229 
230  static void
231  ProcessWarmupEvents();
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
252  setCustomNdnCxxClocks();
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
Copyright (c) 2011-2015 Regents of the University of California.
ndn security KeyChain
Definition: key-chain.cpp:70
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:39
Callback< shared_ptr< Face >, Ptr< Node >, Ptr< L3Protocol >, Ptr< NetDevice > > FaceCreateCallback
Helper class to install NDN stack and configure its parameters.
Copyright (c) 2011-2015 Regents of the University of California.
ndn L3Protocol
Copyright (c) 2011-2015 Regents of the University of California.
ndn StackHelper
Copyright (c) 2011-2015 Regents of the University of California.