A Discrete-Event Network Simulator
API
nms-p2p-nix.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  * (c) 2009, GTech Systems, Inc. - Alfred Park <park@gtech-systems.com>
17  *
18  * DARPA NMS Campus Network Model
19  *
20  * This topology replicates the original NMS Campus Network model
21  * with the exception of chord links (which were never utilized in the
22  * original model)
23  * Link Bandwidths and Delays may not be the same as the original
24  * specifications
25  *
26  * The fundamental unit of the NMS model consists of a campus network. The
27  * campus network topology can been seen here:
28  * http://www.nsnam.org/~jpelkey3/nms.png
29  * The number of hosts (default 42) is variable. Finally, an arbitrary
30  * number of these campus networks can be connected together (default 2)
31  * to make very large simulations.
32  */
33 
34 // for timing functions
35 #include <cstdlib>
36 #include <sys/time.h>
37 #include <fstream>
38 
39 #include "ns3/core-module.h"
40 #include "ns3/internet-module.h"
41 #include "ns3/network-module.h"
42 #include "ns3/point-to-point-module.h"
43 #include "ns3/applications-module.h"
44 #include "ns3/onoff-application.h"
45 #include "ns3/packet-sink.h"
46 #include "ns3/simulator.h"
47 #include "ns3/ipv4-nix-vector-helper.h"
48 
49 using namespace ns3;
50 
51 typedef struct timeval TIMER_TYPE;
52 #define TIMER_NOW(_t) gettimeofday (&_t,NULL);
53 #define TIMER_SECONDS(_t) ((double)(_t).tv_sec + (_t).tv_usec*1e-6)
54 #define TIMER_DIFF(_t1, _t2) (TIMER_SECONDS (_t1)-TIMER_SECONDS (_t2))
55 
56 NS_LOG_COMPONENT_DEFINE ("CampusNetworkModel");
57 
58 void Progress ()
59 {
61 }
62 
63 template <typename T>
64 class Array2D
65 {
66  public:
67  Array2D (const size_t x, const size_t y) : p (new T*[x]), m_xMax (x)
68  {
69  for (size_t i = 0; i < m_xMax; i++)
70  p[i] = new T[y];
71  }
72 
73  ~Array2D (void)
74  {
75  for (size_t i = 0; i < m_xMax; i++)
76  delete[] p[i];
77  delete[] p;
78  p = 0;
79  }
80 
81  T* operator[] (const size_t i)
82  {
83  return p[i];
84  }
85  private:
86  T** p;
87  const size_t m_xMax;
88 };
89 
90 template <typename T>
91 class Array3D
92 {
93  public:
94  Array3D (const size_t x, const size_t y, const size_t z)
95  : p (new Array2D<T>*[x]), m_xMax (x)
96  {
97  for (size_t i = 0; i < m_xMax; i++)
98  p[i] = new Array2D<T> (y, z);
99  }
100 
101  ~Array3D (void)
102  {
103  for (size_t i = 0; i < m_xMax; i++)
104  {
105  delete p[i];
106  p[i] = 0;
107  }
108  delete[] p;
109  p = 0;
110  }
111 
112  Array2D<T>& operator[] (const size_t i)
113  {
114  return *(p[i]);
115  }
116  private:
118  const size_t m_xMax;
119 };
120 
121 int
122 main (int argc, char *argv[])
123 {
124  TIMER_TYPE t0, t1, t2;
125  TIMER_NOW (t0);
126  std::cout << " ==== DARPA NMS CAMPUS NETWORK SIMULATION ====" << std::endl;
127  // LogComponentEnable ("OnOffApplication", LOG_LEVEL_INFO);
128 
129  int nCN = 2, nLANClients = 42;
130  bool nix = true;
131 
133  cmd.AddValue ("CN", "Number of total CNs [2]", nCN);
134  cmd.AddValue ("LAN", "Number of nodes per LAN [42]", nLANClients);
135  cmd.AddValue ("NIX", "Toggle nix-vector routing", nix);
136  cmd.Parse (argc,argv);
137 
138  if (nCN < 2)
139  {
140  std::cout << "Number of total CNs (" << nCN << ") lower than minimum of 2"
141  << std::endl;
142  return 1;
143  }
144 
145  std::cout << "Number of CNs: " << nCN << ", LAN nodes: " << nLANClients << std::endl;
146 
147  Array2D<NodeContainer> nodes_net0(nCN, 3);
148  Array2D<NodeContainer> nodes_net1(nCN, 6);
149  NodeContainer* nodes_netLR = new NodeContainer[nCN];
150  Array2D<NodeContainer> nodes_net2(nCN, 14);
151  Array3D<NodeContainer> nodes_net2LAN(nCN, 7, nLANClients);
152  Array2D<NodeContainer> nodes_net3(nCN, 9);
153  Array3D<NodeContainer> nodes_net3LAN(nCN, 5, nLANClients);
154 
155  PointToPointHelper p2p_2gb200ms, p2p_1gb5ms, p2p_100mb1ms;
158  Array2D<Ipv4InterfaceContainer> ifs0(nCN, 3);
159  Array2D<Ipv4InterfaceContainer> ifs1(nCN, 6);
160  Array2D<Ipv4InterfaceContainer> ifs2(nCN, 14);
161  Array2D<Ipv4InterfaceContainer> ifs3(nCN, 9);
162  Array3D<Ipv4InterfaceContainer> ifs2LAN(nCN, 7, nLANClients);
163  Array3D<Ipv4InterfaceContainer> ifs3LAN(nCN, 5, nLANClients);
164 
166  std::ostringstream oss;
167  p2p_1gb5ms.SetDeviceAttribute ("DataRate", StringValue ("1Gbps"));
168  p2p_1gb5ms.SetChannelAttribute ("Delay", StringValue ("5ms"));
169  p2p_2gb200ms.SetDeviceAttribute ("DataRate", StringValue ("2Gbps"));
170  p2p_2gb200ms.SetChannelAttribute ("Delay", StringValue ("200ms"));
171  p2p_100mb1ms.SetDeviceAttribute ("DataRate", StringValue ("100Mbps"));
172  p2p_100mb1ms.SetChannelAttribute ("Delay", StringValue ("1ms"));
173 
174  // Setup NixVector Routing
175  if (nix)
176  {
177  Ipv4NixVectorHelper nixRouting;
178  stack.SetRoutingHelper (nixRouting); // has effect on the next Install ()
179  }
180 
181  // Create Campus Networks
182  for (int z = 0; z < nCN; ++z)
183  {
184  std::cout << "Creating Campus Network " << z << ":" << std::endl;
185  // Create Net0
186  std::cout << " SubNet [ 0";
187  for (int i = 0; i < 3; ++i)
188  {
189  nodes_net0[z][i].Create (1);
190  stack.Install (nodes_net0[z][i]);
191  }
192  nodes_net0[z][0].Add (nodes_net0[z][1].Get (0));
193  nodes_net0[z][1].Add (nodes_net0[z][2].Get (0));
194  nodes_net0[z][2].Add (nodes_net0[z][0].Get (0));
195  NetDeviceContainer ndc0[3];
196  for (int i = 0; i < 3; ++i)
197  {
198  ndc0[i] = p2p_1gb5ms.Install (nodes_net0[z][i]);
199  }
200  // Create Net1
201  std::cout << " 1";
202  for (int i = 0; i < 6; ++i)
203  {
204  nodes_net1[z][i].Create (1);
205  stack.Install (nodes_net1[z][i]);
206  }
207  nodes_net1[z][0].Add (nodes_net1[z][1].Get (0));
208  nodes_net1[z][2].Add (nodes_net1[z][0].Get (0));
209  nodes_net1[z][3].Add (nodes_net1[z][0].Get (0));
210  nodes_net1[z][4].Add (nodes_net1[z][1].Get (0));
211  nodes_net1[z][5].Add (nodes_net1[z][1].Get (0));
212  NetDeviceContainer ndc1[6];
213  for (int i = 0; i < 6; ++i)
214  {
215  if (i == 1)
216  {
217  continue;
218  }
219  ndc1[i] = p2p_1gb5ms.Install (nodes_net1[z][i]);
220  }
221  // Connect Net0 <-> Net1
222  NodeContainer net0_1;
223  net0_1.Add (nodes_net0[z][2].Get (0));
224  net0_1.Add (nodes_net1[z][0].Get (0));
225  NetDeviceContainer ndc0_1;
226  ndc0_1 = p2p_1gb5ms.Install (net0_1);
227  oss.str ("");
228  oss << 10 + z << ".1.252.0";
229  address.SetBase (oss.str ().c_str (), "255.255.255.0");
230  ifs = address.Assign (ndc0_1);
231  // Create Net2
232  std::cout << " 2";
233  for (int i = 0; i < 14; ++i)
234  {
235  nodes_net2[z][i].Create (1);
236  stack.Install (nodes_net2[z][i]);
237  }
238  nodes_net2[z][0].Add (nodes_net2[z][1].Get (0));
239  nodes_net2[z][2].Add (nodes_net2[z][0].Get (0));
240  nodes_net2[z][1].Add (nodes_net2[z][3].Get (0));
241  nodes_net2[z][3].Add (nodes_net2[z][2].Get (0));
242  nodes_net2[z][4].Add (nodes_net2[z][2].Get (0));
243  nodes_net2[z][5].Add (nodes_net2[z][3].Get (0));
244  nodes_net2[z][6].Add (nodes_net2[z][5].Get (0));
245  nodes_net2[z][7].Add (nodes_net2[z][2].Get (0));
246  nodes_net2[z][8].Add (nodes_net2[z][3].Get (0));
247  nodes_net2[z][9].Add (nodes_net2[z][4].Get (0));
248  nodes_net2[z][10].Add (nodes_net2[z][5].Get (0));
249  nodes_net2[z][11].Add (nodes_net2[z][6].Get (0));
250  nodes_net2[z][12].Add (nodes_net2[z][6].Get (0));
251  nodes_net2[z][13].Add (nodes_net2[z][6].Get (0));
252  NetDeviceContainer ndc2[14];
253  for (int i = 0; i < 14; ++i)
254  {
255  ndc2[i] = p2p_1gb5ms.Install (nodes_net2[z][i]);
256  }
258  Array2D<NetDeviceContainer> ndc2LAN(7, nLANClients);
259  for (int i = 0; i < 7; ++i)
260  {
261  oss.str ("");
262  oss << 10 + z << ".4." << 15 + i << ".0";
263  address.SetBase (oss.str ().c_str (), "255.255.255.0");
264  for (int j = 0; j < nLANClients; ++j)
265  {
266  nodes_net2LAN[z][i][j].Create (1);
267  stack.Install (nodes_net2LAN[z][i][j]);
268  nodes_net2LAN[z][i][j].Add (nodes_net2[z][i+7].Get (0));
269  ndc2LAN[i][j] = p2p_100mb1ms.Install (nodes_net2LAN[z][i][j]);
270  ifs2LAN[z][i][j] = address.Assign (ndc2LAN[i][j]);
271  }
272  }
273  // Create Net3
274  std::cout << " 3 ]" << std::endl;
275  for (int i = 0; i < 9; ++i)
276  {
277  nodes_net3[z][i].Create (1);
278  stack.Install (nodes_net3[z][i]);
279  }
280  nodes_net3[z][0].Add (nodes_net3[z][1].Get (0));
281  nodes_net3[z][1].Add (nodes_net3[z][2].Get (0));
282  nodes_net3[z][2].Add (nodes_net3[z][3].Get (0));
283  nodes_net3[z][3].Add (nodes_net3[z][1].Get (0));
284  nodes_net3[z][4].Add (nodes_net3[z][0].Get (0));
285  nodes_net3[z][5].Add (nodes_net3[z][0].Get (0));
286  nodes_net3[z][6].Add (nodes_net3[z][2].Get (0));
287  nodes_net3[z][7].Add (nodes_net3[z][3].Get (0));
288  nodes_net3[z][8].Add (nodes_net3[z][3].Get (0));
289  NetDeviceContainer ndc3[9];
290  for (int i = 0; i < 9; ++i)
291  {
292  ndc3[i] = p2p_1gb5ms.Install (nodes_net3[z][i]);
293  }
295  Array2D<NetDeviceContainer> ndc3LAN(5, nLANClients);
296  for (int i = 0; i < 5; ++i)
297  {
298  oss.str ("");
299  oss << 10 + z << ".5." << 10 + i << ".0";
300  address.SetBase (oss.str ().c_str (), "255.255.255.255");
301  for (int j = 0; j < nLANClients; ++j)
302  {
303  nodes_net3LAN[z][i][j].Create (1);
304  stack.Install (nodes_net3LAN[z][i][j]);
305  nodes_net3LAN[z][i][j].Add (nodes_net3[z][i+4].Get (0));
306  ndc3LAN[i][j] = p2p_100mb1ms.Install (nodes_net3LAN[z][i][j]);
307  ifs3LAN[z][i][j] = address.Assign (ndc3LAN[i][j]);
308  }
309  }
310  std::cout << " Connecting Subnets..." << std::endl;
311  // Create Lone Routers (Node 4 & 5)
312  nodes_netLR[z].Create (2);
313  stack.Install (nodes_netLR[z]);
314  NetDeviceContainer ndcLR;
315  ndcLR = p2p_1gb5ms.Install (nodes_netLR[z]);
316  // Connect Net2/Net3 through Lone Routers to Net0
317  NodeContainer net0_4, net0_5, net2_4a, net2_4b, net3_5a, net3_5b;
318  net0_4.Add (nodes_netLR[z].Get (0));
319  net0_4.Add (nodes_net0[z][0].Get (0));
320  net0_5.Add (nodes_netLR[z].Get (1));
321  net0_5.Add (nodes_net0[z][1].Get (0));
322  net2_4a.Add (nodes_netLR[z].Get (0));
323  net2_4a.Add (nodes_net2[z][0].Get (0));
324  net2_4b.Add (nodes_netLR[z].Get (1));
325  net2_4b.Add (nodes_net2[z][1].Get (0));
326  net3_5a.Add (nodes_netLR[z].Get (1));
327  net3_5a.Add (nodes_net3[z][0].Get (0));
328  net3_5b.Add (nodes_netLR[z].Get (1));
329  net3_5b.Add (nodes_net3[z][1].Get (0));
330  NetDeviceContainer ndc0_4, ndc0_5, ndc2_4a, ndc2_4b, ndc3_5a, ndc3_5b;
331  ndc0_4 = p2p_1gb5ms.Install (net0_4);
332  oss.str ("");
333  oss << 10 + z << ".1.253.0";
334  address.SetBase (oss.str ().c_str (), "255.255.255.0");
335  ifs = address.Assign (ndc0_4);
336  ndc0_5 = p2p_1gb5ms.Install (net0_5);
337  oss.str ("");
338  oss << 10 + z << ".1.254.0";
339  address.SetBase (oss.str ().c_str (), "255.255.255.0");
340  ifs = address.Assign (ndc0_5);
341  ndc2_4a = p2p_1gb5ms.Install (net2_4a);
342  oss.str ("");
343  oss << 10 + z << ".4.253.0";
344  address.SetBase (oss.str ().c_str (), "255.255.255.0");
345  ifs = address.Assign (ndc2_4a);
346  ndc2_4b = p2p_1gb5ms.Install (net2_4b);
347  oss.str ("");
348  oss << 10 + z << ".4.254.0";
349  address.SetBase (oss.str ().c_str (), "255.255.255.0");
350  ifs = address.Assign (ndc2_4b);
351  ndc3_5a = p2p_1gb5ms.Install (net3_5a);
352  oss.str ("");
353  oss << 10 + z << ".5.253.0";
354  address.SetBase (oss.str ().c_str (), "255.255.255.0");
355  ifs = address.Assign (ndc3_5a);
356  ndc3_5b = p2p_1gb5ms.Install (net3_5b);
357  oss.str ("");
358  oss << 10 + z << ".5.254.0";
359  address.SetBase (oss.str ().c_str (), "255.255.255.0");
360  ifs = address.Assign (ndc3_5b);
361  // Assign IP addresses
362  std::cout << " Assigning IP addresses..." << std::endl;
363  for (int i = 0; i < 3; ++i)
364  {
365  oss.str ("");
366  oss << 10 + z << ".1." << 1 + i << ".0";
367  address.SetBase (oss.str ().c_str (), "255.255.255.0");
368  ifs0[z][i] = address.Assign (ndc0[i]);
369  }
370  for (int i = 0; i < 6; ++i)
371  {
372  if (i == 1)
373  {
374  continue;
375  }
376  oss.str ("");
377  oss << 10 + z << ".2." << 1 + i << ".0";
378  address.SetBase (oss.str ().c_str (), "255.255.255.0");
379  ifs1[z][i] = address.Assign (ndc1[i]);
380  }
381  oss.str ("");
382  oss << 10 + z << ".3.1.0";
383  address.SetBase (oss.str ().c_str (), "255.255.255.0");
384  ifs = address.Assign (ndcLR);
385  for (int i = 0; i < 14; ++i)
386  {
387  oss.str ("");
388  oss << 10 + z << ".4." << 1 + i << ".0";
389  address.SetBase (oss.str ().c_str (), "255.255.255.0");
390  ifs2[z][i] = address.Assign (ndc2[i]);
391  }
392  for (int i = 0; i < 9; ++i)
393  {
394  oss.str ("");
395  oss << 10 + z << ".5." << 1 + i << ".0";
396  address.SetBase (oss.str ().c_str (), "255.255.255.0");
397  ifs3[z][i] = address.Assign (ndc3[i]);
398  }
399  }
400  // Create Ring Links
401  if (nCN > 1)
402  {
403  std::cout << "Forming Ring Topology..." << std::endl;
404  NodeContainer* nodes_ring = new NodeContainer[nCN];
405  for (int z = 0; z < nCN-1; ++z)
406  {
407  nodes_ring[z].Add (nodes_net0[z][0].Get (0));
408  nodes_ring[z].Add (nodes_net0[z+1][0].Get (0));
409  }
410  nodes_ring[nCN-1].Add (nodes_net0[nCN-1][0].Get (0));
411  nodes_ring[nCN-1].Add (nodes_net0[0][0].Get (0));
412  NetDeviceContainer* ndc_ring = new NetDeviceContainer[nCN];
413  for (int z = 0; z < nCN; ++z)
414  {
415  ndc_ring[z] = p2p_2gb200ms.Install (nodes_ring[z]);
416  oss.str ("");
417  oss << "254.1." << z + 1 << ".0";
418  address.SetBase (oss.str ().c_str (), "255.255.255.0");
419  ifs = address.Assign (ndc_ring[z]);
420  }
421  delete[] ndc_ring;
422  delete[] nodes_ring;
423  }
424 
425  // Create Traffic Flows
426  std::cout << "Creating TCP Traffic Flows:" << std::endl;
427  Config::SetDefault ("ns3::OnOffApplication::MaxBytes", UintegerValue (500000));
428  Config::SetDefault ("ns3::OnOffApplication::OnTime",
429  StringValue ("ns3::ConstantRandomVariable[Constant=1.0]"));
430  Config::SetDefault ("ns3::OnOffApplication::OffTime",
431  StringValue ("ns3::ConstantRandomVariable[Constant=0.0]"));
432  Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (512));
433 
434  Ptr<UniformRandomVariable> urng = CreateObject<UniformRandomVariable> ();
435  int r1;
436  double r2;
437  for (int z = 0; z < nCN; ++z)
438  {
439  int x = z + 1;
440  if (z == nCN - 1)
441  {
442  x = 0;
443  }
444  // Subnet 2 LANs
445  std::cout << " Campus Network " << z << " Flows [ Net2 ";
446  for (int i = 0; i < 7; ++i)
447  {
448  for (int j = 0; j < nLANClients; ++j)
449  {
450  // Sinks
451  PacketSinkHelper sinkHelper ("ns3::TcpSocketFactory",
453  ApplicationContainer sinkApp = sinkHelper.Install (
454  nodes_net2LAN[z][i][j].Get (0));
455  sinkApp.Start (Seconds (0.0));
456  // Sources
457  r1 = 2 + (int)(4 * urng->GetValue ());
458  r2 = 10 * urng->GetValue ();
459  OnOffHelper client ("ns3::TcpSocketFactory", Address ());
460  AddressValue remoteAddress (InetSocketAddress (
461  ifs2LAN[z][i][j].GetAddress (0), 9999));
462  client.SetAttribute ("Remote", remoteAddress);
463  ApplicationContainer clientApp;
464  clientApp.Add (client.Install (nodes_net1[x][r1].Get (0)));
465  clientApp.Start (Seconds (r2));
466  }
467  }
468  // Subnet 3 LANs
469  std::cout << "Net3 ]" << std::endl;
470  for (int i = 0; i < 5; ++i)
471  {
472  for (int j = 0; j < nLANClients; ++j)
473  {
474  // Sinks
475  PacketSinkHelper sinkHelper ("ns3::TcpSocketFactory",
477  ApplicationContainer sinkApp = sinkHelper.Install (
478  nodes_net3LAN[z][i][j].Get (0));
479  sinkApp.Start (Seconds (0.0));
480  // Sources
481  r1 = 2 + (int)(4 * urng->GetValue ());
482  r2 = 10 * urng->GetValue ();
483  OnOffHelper client ("ns3::TcpSocketFactory", Address ());
484  AddressValue remoteAddress (InetSocketAddress (
485  ifs3LAN[z][i][j].GetAddress (0), 9999));
486  client.SetAttribute ("Remote", remoteAddress);
487  ApplicationContainer clientApp;
488  clientApp.Add (client.Install (nodes_net1[x][r1].Get (0)));
489  clientApp.Start (Seconds (r2));
490  }
491  }
492  }
493 
494  std::cout << "Created " << NodeList::GetNNodes () << " nodes." << std::endl;
495  TIMER_TYPE routingStart;
496  TIMER_NOW (routingStart);
497 
498  if (nix)
499  {
500  // Calculate routing tables
501  std::cout << "Using Nix-vectors..." << std::endl;
502  }
503  else
504  {
505  // Calculate routing tables
506  std::cout << "Populating Global Static Routing Tables..." << std::endl;
508  }
509 
510  TIMER_TYPE routingEnd;
511  TIMER_NOW (routingEnd);
512  std::cout << "Routing tables population took "
513  << TIMER_DIFF (routingEnd, routingStart) << std::endl;
514 
516  std::cout << "Running simulator..." << std::endl;
517  TIMER_NOW (t1);
518  Simulator::Stop (Seconds (100.0));
519  Simulator::Run ();
520  TIMER_NOW (t2);
521  std::cout << "Simulator finished." << std::endl;
523 
524  double d1 = TIMER_DIFF (t1, t0), d2 = TIMER_DIFF (t2, t1);
525  std::cout << "-----" << std::endl << "Runtime Stats:" << std::endl;
526  std::cout << "Simulator init time: " << d1 << std::endl;
527  std::cout << "Simulator run time: " << d2 << std::endl;
528  std::cout << "Total elapsed time: " << d1+d2 << std::endl;
529 
530  delete[] nodes_netLR;
531  return 0;
532 }
holds a vector of ns3::Application pointers.
an Inet address class
static Ipv4Address GetAny(void)
static uint32_t GetNNodes(void)
Definition: node-list.cc:247
holds a vector of std::pair of Ptr and interface index.
static void PopulateRoutingTables(void)
Build a routing database and initialize the routing tables of the nodes in the simulation.
Hold variables of type string.
Definition: string.h:41
const size_t m_xMax
Definition: nms-p2p-nix.cc:118
NetDeviceContainer Install(NodeContainer c)
Array2D(const size_t x, const size_t y)
Definition: nms-p2p-nix.cc:67
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container. ...
void Progress()
Definition: nms-p2p-nix.cc:58
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
const size_t m_xMax
Definition: nms-p2p-nix.cc:87
Helper class that adds Nix-vector routing to nodes.
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
Build a set of PointToPointNetDevice objects.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
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
a polymophic address class
Definition: address.h:90
T ** p
Definition: nms-p2p-nix.cc:86
Array3D(const size_t x, const size_t y, const size_t z)
Definition: nms-p2p-nix.cc:94
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
Definition: simulator.h:1238
Hold an unsigned integer type.
Definition: uinteger.h:44
Array2D< T > ** p
Definition: nms-p2p-nix.cc:117
holds a vector of ns3::NetDevice pointers
#define TIMER_DIFF(_t1, _t2)
Definition: nms-p2p-nix.cc:54
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
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:165
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
double GetValue(double min, double max)
Get the next random value, as a double in the specified range .
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
static EventId ScheduleNow(MEM mem_ptr, OBJ obj)
Schedule an event to expire Now.
Definition: simulator.h:1401
tuple stack
Definition: first.py:34
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
AttributeValue implementation for Address.
Definition: address.h:278
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
struct timeval TIMER_TYPE
void Add(NodeContainer other)
Append the contents of another NodeContainer to the end of this container.
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
#define TIMER_NOW(_t)
Definition: nms-p2p-nix.cc:52
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:895
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:774
~Array3D(void)
Definition: nms-p2p-nix.cc:101
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.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
tuple address
Definition: first.py:37
~Array2D(void)
Definition: nms-p2p-nix.cc:73
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.