A Discrete-Event Network Simulator
API
mixed-wireless.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License version 2 as
5  * published by the Free Software Foundation;
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15  *
16  */
17 
18 //
19 // This ns-3 example demonstrates the use of helper functions to ease
20 // the construction of simulation scenarios.
21 //
22 // The simulation topology consists of a mixed wired and wireless
23 // scenario in which a hierarchical mobility model is used.
24 //
25 // The simulation layout consists of N backbone routers interconnected
26 // by an ad hoc wifi network.
27 // Each backbone router also has a local 802.11 network and is connected
28 // to a local LAN. An additional set of (K-1) nodes are connected to
29 // this backbone. Finally, a local LAN is connected to each router
30 // on the backbone, with L-1 additional hosts.
31 //
32 // The nodes are populated with TCP/IP stacks, and OLSR unicast routing
33 // on the backbone. An example UDP transfer is shown. The simulator
34 // be configured to output tcpdumps or traces from different nodes.
35 //
36 //
37 // +--------------------------------------------------------+
38 // | |
39 // | 802.11 ad hoc, ns-2 mobility |
40 // | |
41 // +--------------------------------------------------------+
42 // | o o o (N backbone routers) |
43 // +--------+ +--------+
44 // wired LAN | mobile | wired LAN | mobile |
45 // -----------| router | -----------| router |
46 // --------- ---------
47 // | |
48 // +----------------+ +----------------+
49 // | 802.11 | | 802.11 |
50 // | infra net | | infra net |
51 // | K-1 hosts | | K-1 hosts |
52 // +----------------+ +----------------+
53 //
54 // We'll send data from the first wired LAN node on the first wired LAN
55 // to the last wireless STA on the last infrastructure net, thereby
56 // causing packets to traverse CSMA to adhoc to infrastructure links
57 //
58 // Note that certain mobility patterns may cause packet forwarding
59 // to fail (if nodes become disconnected)
60 
61 #include <fstream>
62 #include <string>
63 #include "ns3/core-module.h"
64 #include "ns3/network-module.h"
65 #include "ns3/applications-module.h"
66 #include "ns3/mobility-module.h"
67 #include "ns3/config-store-module.h"
68 #include "ns3/wifi-module.h"
69 #include "ns3/csma-module.h"
70 #include "ns3/olsr-helper.h"
71 #include "ns3/internet-module.h"
72 #include "ns3/netanim-module.h"
73 
74 using namespace ns3;
75 
76 //
77 // Define logging keyword for this file
78 //
79 NS_LOG_COMPONENT_DEFINE ("MixedWireless");
80 
81 //
82 // This function will be used below as a trace sink, if the command-line
83 // argument or default value "useCourseChangeCallback" is set to true
84 //
85 static void
87 {
88  Vector position = model->GetPosition ();
89  std::cout << "CourseChange " << path << " x=" << position.x << ", y=" << position.y << ", z=" << position.z << std::endl;
90 }
91 
92 int
93 main (int argc, char *argv[])
94 {
95  //
96  // First, we declare and initialize a few local variables that control some
97  // simulation parameters.
98  //
99  uint32_t backboneNodes = 10;
100  uint32_t infraNodes = 2;
101  uint32_t lanNodes = 2;
102  uint32_t stopTime = 20;
103  bool useCourseChangeCallback = false;
104 
105  //
106  // Simulation defaults are typically set next, before command line
107  // arguments are parsed.
108  //
109  Config::SetDefault ("ns3::OnOffApplication::PacketSize", StringValue ("1472"));
110  Config::SetDefault ("ns3::OnOffApplication::DataRate", StringValue ("100kb/s"));
111 
112  //
113  // For convenience, we add the local variables to the command line argument
114  // system so that they can be overridden with flags such as
115  // "--backboneNodes=20"
116  //
118  cmd.AddValue ("backboneNodes", "number of backbone nodes", backboneNodes);
119  cmd.AddValue ("infraNodes", "number of leaf nodes", infraNodes);
120  cmd.AddValue ("lanNodes", "number of LAN nodes", lanNodes);
121  cmd.AddValue ("stopTime", "simulation stop time (seconds)", stopTime);
122  cmd.AddValue ("useCourseChangeCallback", "whether to enable course change tracing", useCourseChangeCallback);
123 
124  //
125  // The system global variables and the local values added to the argument
126  // system can be overridden by command line arguments by using this call.
127  //
128  cmd.Parse (argc, argv);
129 
130  if (stopTime < 10)
131  {
132  std::cout << "Use a simulation stop time >= 10 seconds" << std::endl;
133  exit (1);
134  }
136  // //
137  // Construct the backbone //
138  // //
140 
141  //
142  // Create a container to manage the nodes of the adhoc (backbone) network.
143  // Later we'll create the rest of the nodes we'll need.
144  //
145  NodeContainer backbone;
146  backbone.Create (backboneNodes);
147  //
148  // Create the backbone wifi net devices and install them into the nodes in
149  // our container
150  //
153  mac.SetType ("ns3::AdhocWifiMac");
154  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
155  "DataMode", StringValue ("OfdmRate54Mbps"));
158  wifiPhy.SetChannel (wifiChannel.Create ());
159  NetDeviceContainer backboneDevices = wifi.Install (wifiPhy, mac, backbone);
160 
161  // We enable OLSR (which will be consulted at a higher priority than
162  // the global routing) on the backbone ad hoc nodes
163  NS_LOG_INFO ("Enabling OLSR routing on all backbone nodes");
165  //
166  // Add the IPv4 protocol stack to the nodes in our container
167  //
168  InternetStackHelper internet;
169  internet.SetRoutingHelper (olsr); // has effect on the next Install ()
170  internet.Install (backbone);
171 
172  //
173  // Assign IPv4 addresses to the device drivers (actually to the associated
174  // IPv4 interfaces) we just created.
175  //
176  Ipv4AddressHelper ipAddrs;
177  ipAddrs.SetBase ("192.168.0.0", "255.255.255.0");
178  ipAddrs.Assign (backboneDevices);
179 
180  //
181  // The ad-hoc network nodes need a mobility model so we aggregate one to
182  // each of the nodes we just finished building.
183  //
185  mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
186  "MinX", DoubleValue (20.0),
187  "MinY", DoubleValue (20.0),
188  "DeltaX", DoubleValue (20.0),
189  "DeltaY", DoubleValue (20.0),
190  "GridWidth", UintegerValue (5),
191  "LayoutType", StringValue ("RowFirst"));
192  mobility.SetMobilityModel ("ns3::RandomDirection2dMobilityModel",
193  "Bounds", RectangleValue (Rectangle (-500, 500, -500, 500)),
194  "Speed", StringValue ("ns3::ConstantRandomVariable[Constant=2]"),
195  "Pause", StringValue ("ns3::ConstantRandomVariable[Constant=0.2]"));
196  mobility.Install (backbone);
197 
199  // //
200  // Construct the LANs //
201  // //
203 
204  // Reset the address base-- all of the CSMA networks will be in
205  // the "172.16 address space
206  ipAddrs.SetBase ("172.16.0.0", "255.255.255.0");
207 
208 
209  for (uint32_t i = 0; i < backboneNodes; ++i)
210  {
211  NS_LOG_INFO ("Configuring local area network for backbone node " << i);
212  //
213  // Create a container to manage the nodes of the LAN. We need
214  // two containers here; one with all of the new nodes, and one
215  // with all of the nodes including new and existing nodes
216  //
217  NodeContainer newLanNodes;
218  newLanNodes.Create (lanNodes - 1);
219  // Now, create the container with all nodes on this link
220  NodeContainer lan (backbone.Get (i), newLanNodes);
221  //
222  // Create the CSMA net devices and install them into the nodes in our
223  // collection.
224  //
226  csma.SetChannelAttribute ("DataRate",
227  DataRateValue (DataRate (5000000)));
228  csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2)));
229  NetDeviceContainer lanDevices = csma.Install (lan);
230  //
231  // Add the IPv4 protocol stack to the new LAN nodes
232  //
233  internet.Install (newLanNodes);
234  //
235  // Assign IPv4 addresses to the device drivers (actually to the
236  // associated IPv4 interfaces) we just created.
237  //
238  ipAddrs.Assign (lanDevices);
239  //
240  // Assign a new network prefix for the next LAN, according to the
241  // network mask initialized above
242  //
243  ipAddrs.NewNetwork ();
244  //
245  // The new LAN nodes need a mobility model so we aggregate one
246  // to each of the nodes we just finished building.
247  //
248  MobilityHelper mobilityLan;
249  Ptr<ListPositionAllocator> subnetAlloc =
250  CreateObject<ListPositionAllocator> ();
251  for (uint32_t j = 0; j < newLanNodes.GetN (); ++j)
252  {
253  subnetAlloc->Add (Vector (0.0, j*10 + 10, 0.0));
254  }
255  mobilityLan.PushReferenceMobilityModel (backbone.Get (i));
256  mobilityLan.SetPositionAllocator (subnetAlloc);
257  mobilityLan.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
258  mobilityLan.Install (newLanNodes);
259  }
260 
262  // //
263  // Construct the mobile networks //
264  // //
266 
267  // Reset the address base-- all of the 802.11 networks will be in
268  // the "10.0" address space
269  ipAddrs.SetBase ("10.0.0.0", "255.255.255.0");
270 
271  for (uint32_t i = 0; i < backboneNodes; ++i)
272  {
273  NS_LOG_INFO ("Configuring wireless network for backbone node " << i);
274  //
275  // Create a container to manage the nodes of the LAN. We need
276  // two containers here; one with all of the new nodes, and one
277  // with all of the nodes including new and existing nodes
278  //
279  NodeContainer stas;
280  stas.Create (infraNodes - 1);
281  // Now, create the container with all nodes on this link
282  NodeContainer infra (backbone.Get (i), stas);
283  //
284  // Create an infrastructure network
285  //
286  WifiHelper wifiInfra;
287  WifiMacHelper macInfra;
288  wifiPhy.SetChannel (wifiChannel.Create ());
289  // Create unique ssids for these networks
290  std::string ssidString ("wifi-infra");
291  std::stringstream ss;
292  ss << i;
293  ssidString += ss.str ();
294  Ssid ssid = Ssid (ssidString);
295  wifiInfra.SetRemoteStationManager ("ns3::ArfWifiManager");
296  // setup stas
297  macInfra.SetType ("ns3::StaWifiMac",
298  "Ssid", SsidValue (ssid));
299  NetDeviceContainer staDevices = wifiInfra.Install (wifiPhy, macInfra, stas);
300  // setup ap.
301  macInfra.SetType ("ns3::ApWifiMac",
302  "Ssid", SsidValue (ssid),
303  "BeaconGeneration", BooleanValue (true),
304  "BeaconInterval", TimeValue(Seconds(2.5)));
305  NetDeviceContainer apDevices = wifiInfra.Install (wifiPhy, macInfra, backbone.Get (i));
306  // Collect all of these new devices
307  NetDeviceContainer infraDevices (apDevices, staDevices);
308 
309  // Add the IPv4 protocol stack to the nodes in our container
310  //
311  internet.Install (stas);
312  //
313  // Assign IPv4 addresses to the device drivers (actually to the associated
314  // IPv4 interfaces) we just created.
315  //
316  ipAddrs.Assign (infraDevices);
317  //
318  // Assign a new network prefix for each mobile network, according to
319  // the network mask initialized above
320  //
321  ipAddrs.NewNetwork ();
322  //
323  // The new wireless nodes need a mobility model so we aggregate one
324  // to each of the nodes we just finished building.
325  //
326  Ptr<ListPositionAllocator> subnetAlloc =
327  CreateObject<ListPositionAllocator> ();
328  for (uint32_t j = 0; j < infra.GetN (); ++j)
329  {
330  subnetAlloc->Add (Vector (0.0, j, 0.0));
331  }
332  mobility.PushReferenceMobilityModel (backbone.Get (i));
333  mobility.SetPositionAllocator (subnetAlloc);
334  mobility.SetMobilityModel ("ns3::RandomDirection2dMobilityModel",
335  "Bounds", RectangleValue (Rectangle (-10, 10, -10, 10)),
336  "Speed", StringValue ("ns3::ConstantRandomVariable[Constant=3]"),
337  "Pause", StringValue ("ns3::ConstantRandomVariable[Constant=0.4]"));
338  mobility.Install (stas);
339  }
340 
342  // //
343  // Application configuration //
344  // //
346 
347  // Create the OnOff application to send UDP datagrams of size
348  // 210 bytes at a rate of 10 Kb/s, between two nodes
349  // We'll send data from the first wired LAN node on the first wired LAN
350  // to the last wireless STA on the last infrastructure net, thereby
351  // causing packets to traverse CSMA to adhoc to infrastructure links
352 
353  NS_LOG_INFO ("Create Applications.");
354  uint16_t port = 9; // Discard port (RFC 863)
355 
356  // Let's make sure that the user does not define too few nodes
357  // to make this example work. We need lanNodes > 1 and infraNodes > 1
358  NS_ASSERT (lanNodes > 1 && infraNodes > 1);
359  // We want the source to be the first node created outside of the backbone
360  // Conveniently, the variable "backboneNodes" holds this node index value
361  Ptr<Node> appSource = NodeList::GetNode (backboneNodes);
362  // We want the sink to be the last node created in the topology.
363  uint32_t lastNodeIndex = backboneNodes + backboneNodes*(lanNodes - 1) + backboneNodes*(infraNodes - 1) - 1;
364  Ptr<Node> appSink = NodeList::GetNode (lastNodeIndex);
365  // Let's fetch the IP address of the last node, which is on Ipv4Interface 1
366  Ipv4Address remoteAddr = appSink->GetObject<Ipv4> ()->GetAddress (1, 0).GetLocal ();
367 
368  OnOffHelper onoff ("ns3::UdpSocketFactory",
369  Address (InetSocketAddress (remoteAddr, port)));
370 
371  ApplicationContainer apps = onoff.Install (appSource);
372  apps.Start (Seconds (3));
373  apps.Stop (Seconds (stopTime - 1));
374 
375  // Create a packet sink to receive these packets
376  PacketSinkHelper sink ("ns3::UdpSocketFactory",
378  apps = sink.Install (appSink);
379  apps.Start (Seconds (3));
380 
382  // //
383  // Tracing configuration //
384  // //
386 
387  NS_LOG_INFO ("Configure Tracing.");
389 
390  //
391  // Let's set up some ns-2-like ascii traces, using another helper class
392  //
393  AsciiTraceHelper ascii;
394  Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream ("mixed-wireless.tr");
395  wifiPhy.EnableAsciiAll (stream);
396  csma.EnableAsciiAll (stream);
397  internet.EnableAsciiIpv4All (stream);
398 
399  // Csma captures in non-promiscuous mode
400  csma.EnablePcapAll ("mixed-wireless", false);
401  // pcap captures on the backbone wifi devices
402  wifiPhy.EnablePcap ("mixed-wireless", backboneDevices, false);
403  // pcap trace on the application data sink
404  wifiPhy.EnablePcap ("mixed-wireless", appSink->GetId (), 0);
405 
406  if (useCourseChangeCallback == true)
407  {
408  Config::Connect ("/NodeList/*/$ns3::MobilityModel/CourseChange", MakeCallback (&CourseChangeCallback));
409  }
410 
411  AnimationInterface anim ("mixed-wireless.xml");
412 
414  // //
415  // Run simulation //
416  // //
418 
419  NS_LOG_INFO ("Run Simulation.");
420  Simulator::Stop (Seconds (stopTime));
421  Simulator::Run ();
423 }
Ptr< PacketSink > sink
Definition: wifi-tcp.cc:47
holds a vector of ns3::Application pointers.
Manage ASCII trace files for device models.
Definition: trace-helper.h:161
an Inet address class
static Ipv4Address GetAny(void)
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
AttributeValue implementation for Boolean.
Definition: boolean.h:34
Ptr< YansWifiChannel > Create(void) const
void SetRemoteStationManager(std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
Definition: wifi-helper.cc:683
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:462
Hold variables of type string.
Definition: string.h:41
static Ptr< Node > GetNode(uint32_t n)
Definition: node-list.cc:241
Make it easy to create and manage PHY objects for the yans model.
static YansWifiChannelHelper Default(void)
Create a channel helper in a default working state.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition: assert.h:67
static void Run(void)
Run the simulation.
Definition: simulator.cc:201
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:903
aggregate IP/TCP/UDP functionality to existing Nodes.
Helper class that adds OLSR routing to nodes.
Definition: olsr-helper.h:40
Vector GetPosition(void) const
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:244
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
Ptr< OutputStreamWrapper > CreateFileStream(std::string filename, std::ios::openmode filemode=std::ios::out)
Create and initialize an output stream object we'll use to write the traced bits. ...
static YansWifiPhyHelper Default(void)
Create a phy helper in a default working state.
void PushReferenceMobilityModel(Ptr< Object > reference)
static void CourseChangeCallback(std::string path, Ptr< const MobilityModel > model)
helps to create WifiNetDevice objects
Definition: wifi-helper.h:231
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
Definition: on-off-helper.h:42
tuple cmd
Definition: second.py:35
double stopTime
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer c) const
Definition: wifi-helper.cc:712
uint16_t port
Definition: dsdv-manet.cc:44
a polymophic address class
Definition: address.h:90
uint32_t GetN(void) const
Get the number of Ptr stored in this container.
AttributeValue implementation for Rectangle.
Definition: rectangle.h:97
Class for representing data rates.
Definition: data-rate.h:88
void SetChannel(Ptr< YansWifiChannel > channel)
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
tuple mobility
Definition: third.py:101
void EnablePcapAll(std::string prefix, bool promiscuous=false)
Enable pcap output on each device (which is of the appropriate type) in the set of all nodes created ...
AttributeValue implementation for Time.
Definition: nstime.h:957
Hold an unsigned integer type.
Definition: uinteger.h:44
holds a vector of ns3::NetDevice pointers
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1489
tuple staDevices
Definition: third.py:96
tuple mac
Definition: third.py:92
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
Parse command-line arguments.
Definition: command-line.h:205
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:835
void EnableAsciiIpv4All(std::string prefix)
Enable ascii trace output on all Ipv4 and interface pairs existing in the set of all nodes created in...
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:165
Access to the IPv4 forwarding table, interfaces, and configuration.
Definition: ipv4.h:76
Every class exported by the ns3 library is enclosed in the ns3 namespace.
tuple apDevices
Definition: third.py:99
keep track of a set of node pointers.
void SetMobilityModel(std::string type, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue())
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
tuple ssid
Definition: third.py:93
manage and create wifi channel objects for the yans model.
create MAC layers for a ns3::WifiNetDevice.
Definition: olsr.py:1
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:38
build a set of CsmaNetDevice objects
Definition: csma-helper.h:46
virtual void SetType(std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue(), std::string n10="", const AttributeValue &v10=EmptyAttributeValue())
Helper class used to assign positions and mobility models to nodes.
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:40
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter...
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
uint32_t GetId(void) const
Definition: node.cc:107
AttributeValue implementation for DataRate.
Definition: data-rate.h:242
void AddValue(const std::string &name, const std::string &help, T &value)
Add a program argument, assigning to POD.
Definition: command-line.h:495
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:209
Ptr< Node > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:895
AttributeValue implementation for Ssid.
Definition: ssid.h:95
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:774
void Add(Vector v)
Add a position to the list of positions.
Interface to network animator.
Ipv4Address NewNetwork(void)
Increment the network number and reset the IP address counter to the base value provided in the SetBa...
void Parse(int argc, char *argv[])
Parse the program arguments.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
tuple wifi
Definition: third.py:89
void EnableAsciiAll(std::string prefix)
Enable ascii trace output on each device (which is of the appropriate type) in the set of all nodes c...
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void EnablePcap(std::string prefix, Ptr< NetDevice > nd, bool promiscuous=false, bool explicitFilename=false)
Enable pcap output the indicated net device.
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
This class can be used to hold variables of floating point type such as 'double' or 'float'...
Definition: double.h:41
a 2d rectangle
Definition: rectangle.h:34
void SetRoutingHelper(const Ipv4RoutingHelper &routing)
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
tuple csma
Definition: second.py:63