NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: 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 NDN_STACK_HELPER_H
21 #define NDN_STACK_HELPER_H
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-face-container.hpp"
31 #include "ndn-fib-helper.hpp"
33 
34 namespace ns3 {
35 
36 class Node;
37 
38 namespace ndn {
39 
40 class NetDeviceFace;
41 class L3Protocol;
42 
51 class StackHelper : boost::noncopyable {
52 public:
56  StackHelper();
57 
61  virtual ~StackHelper();
62 
66  void
67  SetStackAttributes(const std::string& attr1 = "", const std::string& value1 = "",
68  const std::string& attr2 = "", const std::string& value2 = "",
69  const std::string& attr3 = "", const std::string& value3 = "",
70  const std::string& attr4 = "", const std::string& value4 = "");
71 
75  void
76  setCsSize(size_t maxSize);
77 
84  void
85  SetOldContentStore(const std::string& contentStoreClass, const std::string& attr1 = "",
86  const std::string& value1 = "", const std::string& attr2 = "",
87  const std::string& value2 = "", const std::string& attr3 = "",
88  const std::string& value3 = "", const std::string& attr4 = "",
89  const std::string& value4 = "");
90 
91  typedef Callback<shared_ptr<NetDeviceFace>, Ptr<Node>, Ptr<L3Protocol>, Ptr<NetDevice>>
93 
103  void
104  AddNetDeviceFaceCreateCallback(TypeId netDeviceType, NetDeviceFaceCreateCallback callback);
105 
114  void
115  UpdateNetDeviceFaceCreateCallback(TypeId netDeviceType, NetDeviceFaceCreateCallback callback);
116 
121  void
122  RemoveNetDeviceFaceCreateCallback(TypeId netDeviceType, NetDeviceFaceCreateCallback callback);
123 
135  Ptr<FaceContainer>
136  Install(const std::string& nodeName) const;
137 
149  Ptr<FaceContainer>
150  Install(Ptr<Node> node) const;
151 
164  Ptr<FaceContainer>
165  Install(const NodeContainer& c) const;
166 
173  Ptr<FaceContainer>
174  InstallAll() const;
175 
179  void
180  SetDefaultRoutes(bool needSet);
181 
182  static KeyChain&
183  getKeyChain();
184 
190  void
191  Update(Ptr<Node> node);
192 
198  void
199  Update(const NodeContainer& c);
200 
206  void
207  Update(const std::string& nodeName);
208 
212  void
213  UpdateAll();
214 
218  void
220 
224  void
226 
230  void
232 
236  void
238 
239 private:
240  shared_ptr<NetDeviceFace>
241  DefaultNetDeviceCallback(Ptr<Node> node, Ptr<L3Protocol> ndn, Ptr<NetDevice> netDevice) const;
242 
243  shared_ptr<NetDeviceFace>
244  PointToPointNetDeviceCallback(Ptr<Node> node, Ptr<L3Protocol> ndn,
245  Ptr<NetDevice> netDevice) const;
246  shared_ptr<NetDeviceFace>
247  createAndRegisterFace(Ptr<Node> node, Ptr<L3Protocol> ndn, Ptr<NetDevice> device) const;
248 
249  bool m_isRibManagerDisabled;
250  bool m_isFaceManagerDisabled;
251  bool m_isStatusServerDisabled;
252  bool m_isStrategyChoiceManagerDisabled;
253 
254 public:
255  void
257 
258 private:
259  ObjectFactory m_ndnFactory;
260  ObjectFactory m_contentStoreFactory;
261 
262  bool m_needSetDefaultRoutes;
263  size_t m_maxCsSize;
264 
265  typedef std::list<std::pair<TypeId, NetDeviceFaceCreateCallback>> NetDeviceCallbackList;
266  NetDeviceCallbackList m_netDeviceCallbacks;
267 };
268 
269 } // namespace ndn
270 } // namespace ns3
271 
272 #endif /* NDN_STACK_HELPER_H */
void AddNetDeviceFaceCreateCallback(TypeId netDeviceType, NetDeviceFaceCreateCallback callback)
Add callback to create and configure instance of the face, based on supplied Ptr<Node> and Ptr<NetDev...
void UpdateNetDeviceFaceCreateCallback(TypeId netDeviceType, NetDeviceFaceCreateCallback callback)
Update callback to create and configure instance of the face, based on supplied Ptr<Node> and Ptr<Net...
virtual ~StackHelper()
Destroy the NdnStackHelper.
Copyright (c) 2011-2015 Regents of the University of California.
Ptr< FaceContainer > Install(const std::string &nodeName) const
Install Ndn stack on the node.
StackHelper()
Create a new NdnStackHelper with a default NDN_FLOODING forwarding stategy.
ndn NetDeviceFace
Copyright (c) 2011-2015 Regents of the University of California.
void setCsSize(size_t maxSize)
Set maximum size for NFD&#39;s Content Store (in number of packets)
void SetDefaultRoutes(bool needSet)
Set flag indicating necessity to install default routes in FIB.
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.
void RemoveNetDeviceFaceCreateCallback(TypeId netDeviceType, NetDeviceFaceCreateCallback callback)
Remove callback to create and configure instance of the face, based on supplied Ptr<Node> and Ptr<Net...
Callback< shared_ptr< NetDeviceFace >, Ptr< Node >, Ptr< L3Protocol >, Ptr< NetDevice > > NetDeviceFaceCreateCallback
void disableFaceManager()
Disable Face Manager.
Ptr< FaceContainer > InstallAll() const
Install Ndn stack on all nodes in the simulation.
Helper class to install NDN stack and configure its parameters.
Copyright (c) 2011-2015 Regents of the University of California.
void disableRibManager()
Disable the RIB manager of NFD.
ndn L3Protocol
Copyright (c) 2011-2015 Regents of the University of California.
void SetOldContentStore(const std::string &contentStoreClass, 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 ndnSIM 1.0 content store implementation and its attributes.
void disableStatusServer()
Disable Status Server.
void UpdateAll()
Update Ndn stack on all the nodes (Add faces for new devices)
static KeyChain & getKeyChain()
void Update(Ptr< Node > node)
Update Ndn stack on a given node (Add faces for new devices)
void disableStrategyChoiceManager()
Disable Strategy Choice Manager.