NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
185 private:
186  shared_ptr<NetDeviceFace>
187  DefaultNetDeviceCallback(Ptr<Node> node, Ptr<L3Protocol> ndn, Ptr<NetDevice> netDevice) const;
188 
189  shared_ptr<NetDeviceFace>
190  PointToPointNetDeviceCallback(Ptr<Node> node, Ptr<L3Protocol> ndn,
191  Ptr<NetDevice> netDevice) const;
192 
193 public:
194  void
196 
197 private:
198  ObjectFactory m_ndnFactory;
199  ObjectFactory m_contentStoreFactory;
200 
201  bool m_needSetDefaultRoutes;
202  size_t m_maxCsSize;
203 
204  typedef std::list<std::pair<TypeId, NetDeviceFaceCreateCallback>> NetDeviceCallbackList;
205  NetDeviceCallbackList m_netDeviceCallbacks;
206 };
207 
208 } // namespace ndn
209 } // namespace ns3
210 
211 #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 and Ptr
void UpdateNetDeviceFaceCreateCallback(TypeId netDeviceType, NetDeviceFaceCreateCallback callback)
Update callback to create and configure instance of the face, based on supplied Ptr and Ptr
virtual ~StackHelper()
Destroy the NdnStackHelper.
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'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 and Ptr
Callback< shared_ptr< NetDeviceFace >, Ptr< Node >, Ptr< L3Protocol >, Ptr< NetDevice > > NetDeviceFaceCreateCallback
Ptr< FaceContainer > InstallAll() const
Install Ndn stack on all nodes in the simulation.
Helper class to install NDN stack and configure its parameters.
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.
static KeyChain & getKeyChain()