A Discrete-Event Network Simulator
API
wsnconstructor.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 
3 /*
4 * Copyright (c) 2020 DLTLT
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation;
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * Corresponding author: Niki Hrovatin <niki.hrovatin@famnit.upr.si>
20 */
21 
22 #include <iostream>
23 #include <string>
24 #include <time.h>
25 #include <cmath>
26 
27 #include "ns3/enums.h"
28 #include "ns3/outputmanager.h"
29 #include "ns3/onion-routing.h"
30 #include "ns3/sensornode.h"
31 #include "ns3/sensornode-helper.h"
32 #include "ns3/sink.h"
33 #include "ns3/sink-helper.h"
34 #include "ns3/outputmanager.h"
35 #include "ns3/onionvalidator.h"
36 
37 #include "ns3/internet-module.h"
38 #include "ns3/mobility-module.h"
39 #include "ns3/network-module.h"
40 #include "ns3/core-module.h"
41 #include "ns3/wifi-module.h"
42 #include "ns3/aodv-module.h"
43 #include "ns3/olsr-module.h"
44 #include "ns3/dsr-module.h"
45 #include "ns3/dsdv-module.h"
46 #include "ns3/stats-module.h"
47 #include "ns3/flow-monitor-module.h"
48 #include "ns3/config-store-module.h"
49 
50 #ifndef WSNCONSTRUCTOR_H
51 #define WSNCONSTRUCTOR_H
52 
53 using namespace ns3;
54 
69 class WsnConstructor : public Object
70 {
71 public:
77  static TypeId GetTypeId (void);
78 
84  WsnConstructor ();
85 
92  void Configure ();
93 
99  void Run ();
100 
101 private:
102  //simulation attributes
103  uint32_t
105  uint16_t m_numNodes;
106  enum Routing m_routing;
107  enum Topology m_topology;
108  enum IEEE_80211n m_mac;
109  enum Verbosity m_verbosity;
110  enum CommunicationStatistics m_stats;
111  uint16_t m_mss;
112  uint16_t m_radius;
113  uint16_t m_cellSide;
114 
115  //Classes to manage the simulation
116  Ptr<OutputManager> m_outputManager;
117  Ptr<OnionValidator>
119  std::string
121  std::string m_simulationName;
122 
123  //onion setup
124  uint16_t m_numOnionPaths = 0;
126  uint16_t m_onionRepeate;
127  std::string
129 
130  DataCollector data;
131 
139  void ProcessPathString ();
140 
147  void CaptureStatistics ();
148 
154  void CreateNodes ();
161  void CreateDevices ();
171  void BuildDiscTopology ();
172 
181  void BuildGridTopology ();
182 
188  void InstallInternetStack ();
189 
195  void InstallApplications ();
196 
202  void DSRrouting ();
208  void AODVrouting ();
214  void OLSRrouting ();
220  void DSDVrouting ();
221 
222  MobilityHelper mobility;
223  NodeContainer wifiNodes;
224  NodeContainer m_sink;
225  NodeContainer sensornodes;
226  NetDeviceContainer wifiDevices;
227  Ipv4InterfaceContainer wifiInterfaces;
228  ApplicationContainer sinkApps;
229  ApplicationContainer sensornodeApps;
230 };
231 
232 #endif // WSNCONSTRUCTOR_H
WsnConstructor::sinkApps
ApplicationContainer sinkApps
Container of sink node applications.
Definition: wsnconstructor.h:228
WsnConstructor::wifiDevices
NetDeviceContainer wifiDevices
Container of wireless devices.
Definition: wsnconstructor.h:226
ns3
Definition: sensornode-helper.cc:26
ns3::CommunicationStatistics
CommunicationStatistics
Statistics about the communication overhead in the network at MAC and Application layer.
Definition: enums.h:94
WsnConstructor::m_radius
uint16_t m_radius
Parameter for the setup of the random disc topology.
Definition: wsnconstructor.h:112
ns3::IEEE_80211n
IEEE_80211n
Enumeration defining different carrier frequencies of the standard IEEE 802.11n.
Definition: enums.h:67
WsnConstructor::m_mss
uint16_t m_mss
maximum segment size
Definition: wsnconstructor.h:111
WsnConstructor::m_sink
NodeContainer m_sink
Container of the sink node.
Definition: wsnconstructor.h:224
WsnConstructor::m_numNodes
uint16_t m_numNodes
number of sensor nodes in the WSN
Definition: wsnconstructor.h:105
WsnConstructor::wifiInterfaces
Ipv4InterfaceContainer wifiInterfaces
Container of netork interfaces.
Definition: wsnconstructor.h:227
WsnConstructor::m_onionValidator
Ptr< OnionValidator > m_onionValidator
Checks if the onion messagess transiting in the network are valid.
Definition: wsnconstructor.h:118
WsnConstructor::wifiNodes
NodeContainer wifiNodes
Container of wireless nodes.
Definition: wsnconstructor.h:223
WsnConstructor::m_pathsLengths
std::string m_pathsLengths
String of values delimited by the symbol "," each value representing the number of hops the onion wil...
Definition: wsnconstructor.h:128
WsnConstructor::m_cellSide
uint16_t m_cellSide
Parameter for the setup of the grid topology.
Definition: wsnconstructor.h:113
WsnConstructor::m_simulationDescription
std::string m_simulationDescription
String holding a description of parameters used in the simulation.
Definition: wsnconstructor.h:120
WsnConstructor::sensornodeApps
ApplicationContainer sensornodeApps
Container of sensor node applications.
Definition: wsnconstructor.h:229
WsnConstructor::m_simulationName
std::string m_simulationName
name of the simulation
Definition: wsnconstructor.h:121
WsnConstructor::mobility
MobilityHelper mobility
Topology helper.
Definition: wsnconstructor.h:222
ns3::Topology
Topology
Enumeration defining different network topologies that can be used in the simulation.
Definition: enums.h:55
WsnConstructor::sensornodes
NodeContainer sensornodes
Container of sensor nodes.
Definition: wsnconstructor.h:225
WsnConstructor::m_onionPathsLengths
uint16_t * m_onionPathsLengths
Array containing one onion path length in each cell.
Definition: wsnconstructor.h:125
ns3::Verbosity
Verbosity
Verbosity settings of the simulation.
Definition: enums.h:79
WsnConstructor::data
DataCollector data
Collect data with the stats framework.
Definition: wsnconstructor.h:130
WsnConstructor
The class that constructs the WSN, setup applications on nodes and starts the simulation.
Definition: wsnconstructor.h:69
WsnConstructor::m_simulationSeed
uint32_t m_simulationSeed
seed to use for the random generation of numbers during the simulation
Definition: wsnconstructor.h:104
ns3::Routing
Routing
Enumeration defining different routing algorithms that can be used in the simulator.
Definition: enums.h:41
WsnConstructor::m_outputManager
Ptr< OutputManager > m_outputManager
Manages the output of the simulation.
Definition: wsnconstructor.h:116
WsnConstructor::m_onionRepeate
uint16_t m_onionRepeate
Number of times to generate the onion for each value of path length.
Definition: wsnconstructor.h:126