NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn-scenario-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_SCENARIO_HELPER_HPP
21 #define NDNSIM_HELPER_NDN_SCENARIO_HELPER_HPP
22 
23 #include "ndn-stack-helper.hpp"
24 
25 #include "ns3/net-device.h"
26 #include "ns3/node.h"
27 
28 #include <ndn-cxx/name.hpp>
29 #include <map>
30 
31 namespace ns3 {
32 namespace ndn {
33 
64 {
65 public:
72  struct RouteInfo
73  {
74  std::string node1;
75  std::string node2;
77  int32_t metric;
78  };
79 
80  /*
81  * @brief Application information for addApps method
82  *
83  * It is preferred to use initializer list to indirectly pass AppInfo's to addApps
84  * method.
85  */
86  struct AppInfo
87  {
88  std::string node;
89  std::string name;
90  std::initializer_list<std::pair<std::string, std::string>> params;
91  std::string start;
92  std::string end;
93  };
94 
95 public:
97 
110  void
111  createTopology(std::initializer_list<std::initializer_list<std::string>/*node clique*/> topology,
112  bool shouldInstallNdnStack = true);
113 
125  void
126  addRoutes(std::initializer_list<RouteInfo> routes);
127 
143  void
144  addApps(std::initializer_list<AppInfo> apps);
145 
146 public: // topology accessors
151  Ptr<Node>
152  getNode(const std::string& nodeName);
153 
158  shared_ptr<Face>
159  getFace(const std::string& node1, const std::string& node2);
160 
165  Ptr<NetDevice>
166  getNetDevice(const std::string& node1, const std::string& node2);
167 
171  void
173 
177  void
179 
183  StackHelper&
184  getStackHelper();
185 
186 private:
187  Ptr<Node>
188  getOrCreateNode(const std::string& nodeName);
189 
190 private:
191  bool m_isTopologyInitialized;
192  StackHelper ndnHelper;
193  std::map<std::string, std::map<std::string, Ptr<NetDevice>>> links;
194  std::map<std::string, Ptr<Node>> nodes;
195 };
196 
197 } // namespace ndn
198 } // namespace ns3
199 
200 #endif // NDNSIM_HELPER_NDN_SCENARIO_HELPER_HPP
Copyright (c) 2011-2015 Regents of the University of California.
Ptr< Node > getNode(const std::string &nodeName)
Get node.
void disableForwarderStatusManager()
Disable Forwarder Status Manager.
void createTopology(std::initializer_list< std::initializer_list< std::string >> topology, bool shouldInstallNdnStack=true)
Create topology.
Ptr< NetDevice > getNetDevice(const std::string &node1, const std::string &node2)
Get NetDevice on the node1 pointing towards node2.
shared_ptr< Face > getFace(const std::string &node1, const std::string &node2)
Get face on the node1 pointing towards node2.
StackHelper & getStackHelper()
Get NDN stack helper, e.g., to adjust its parameters.
Helper class to install NDN stack and configure its parameters.
Copyright (c) 2011-2015 Regents of the University of California.
std::initializer_list< std::pair< std::string, std::string > > params
void addRoutes(std::initializer_list< RouteInfo > routes)
Create routes between topology nodes.
Helper class to simplify writing basic simulation scenarios.
void disableStrategyChoiceManager()
Disable Strategy Choice Manager.
void addApps(std::initializer_list< AppInfo > apps)
Create and install application on nodes.
Route information for addRoutes method.