A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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-static-routing-helper.h"
48 #include "ns3/ipv4-list-routing-helper.h"
49 #include "ns3/ipv4-nix-vector-helper.h"
50 
51 using namespace ns3;
52 
53 typedef struct timeval TIMER_TYPE;
54 #define TIMER_NOW(_t) gettimeofday (&_t,NULL);
55 #define TIMER_SECONDS(_t) ((double)(_t).tv_sec + (_t).tv_usec*1e-6)
56 #define TIMER_DIFF(_t1, _t2) (TIMER_SECONDS (_t1)-TIMER_SECONDS (_t2))
57 
58 NS_LOG_COMPONENT_DEFINE ("CampusNetworkModel");
59 
60 void Progress ()
61 {
62  Simulator::Schedule (Seconds (0.1), Progress);
63 }
64 
65 template <typename T>
66 class Array2D
67 {
68  public:
69  Array2D (const size_t x, const size_t y) : p (new T*[x]), m_xMax (x)
70  {
71  for (size_t i = 0; i < m_xMax; i++)
72  p[i] = new T[y];
73  }
74 
75  ~Array2D (void)
76  {
77  for (size_t i = 0; i < m_xMax; i++)
78  delete[] p[i];
79  delete p;
80  p = 0;
81  }
82 
83  T* operator[] (const size_t i)
84  {
85  return p[i];
86  }
87  private:
88  T** p;
89  const size_t m_xMax;
90 };
91 
92 template <typename T>
93 class Array3D
94 {
95  public:
96  Array3D (const size_t x, const size_t y, const size_t z)
97  : p (new Array2D<T>*[x]), m_xMax (x)
98  {
99  for (size_t i = 0; i < m_xMax; i++)
100  p[i] = new Array2D<T> (y, z);
101  }
102 
103  ~Array3D (void)
104  {
105  for (size_t i = 0; i < m_xMax; i++)
106  {
107  delete p[i];
108  p[i] = 0;
109  }
110  delete[] p;
111  p = 0;
112  }
113 
114  Array2D<T>& operator[] (const size_t i)
115  {
116  return *(p[i]);
117  }
118  private:
120  const size_t m_xMax;
121 };
122 
123 int
124 main (int argc, char *argv[])
125 {
126  TIMER_TYPE t0, t1, t2;
127  TIMER_NOW (t0);
128  std::cout << " ==== DARPA NMS CAMPUS NETWORK SIMULATION ====" << std::endl;
129  LogComponentEnable ("OnOffApplication", LOG_LEVEL_INFO);
130 
131  int nCN = 2, nLANClients = 42;
132  bool nix = true;
133 
134  CommandLine cmd;
135  cmd.AddValue ("CN", "Number of total CNs [2]", nCN);
136  cmd.AddValue ("LAN", "Number of nodes per LAN [42]", nLANClients);
137  cmd.AddValue ("NIX", "Toggle nix-vector routing", nix);
138  cmd.Parse (argc,argv);
139 
140  if (nCN < 2)
141  {
142  std::cout << "Number of total CNs (" << nCN << ") lower than minimum of 2"
143  << std::endl;
144  return 1;
145  }
146 
147  std::cout << "Number of CNs: " << nCN << ", LAN nodes: " << nLANClients << std::endl;
148 
149  Array2D<NodeContainer> nodes_net0(nCN, 3);
150  Array2D<NodeContainer> nodes_net1(nCN, 6);
151  NodeContainer* nodes_netLR = new NodeContainer[nCN];
152  Array2D<NodeContainer> nodes_net2(nCN, 14);
153  Array3D<NodeContainer> nodes_net2LAN(nCN, 7, nLANClients);
154  Array2D<NodeContainer> nodes_net3(nCN, 9);
155  Array3D<NodeContainer> nodes_net3LAN(nCN, 5, nLANClients);
156 
157  PointToPointHelper p2p_2gb200ms, p2p_1gb5ms, p2p_100mb1ms;
160  Array2D<Ipv4InterfaceContainer> ifs0(nCN, 3);
161  Array2D<Ipv4InterfaceContainer> ifs1(nCN, 6);
162  Array2D<Ipv4InterfaceContainer> ifs2(nCN, 14);
163  Array2D<Ipv4InterfaceContainer> ifs3(nCN, 9);
164  Array3D<Ipv4InterfaceContainer> ifs2LAN(nCN, 7, nLANClients);
165  Array3D<Ipv4InterfaceContainer> ifs3LAN(nCN, 5, nLANClients);
166 
168  std::ostringstream oss;
169  p2p_1gb5ms.SetDeviceAttribute ("DataRate", StringValue ("1Gbps"));
170  p2p_1gb5ms.SetChannelAttribute ("Delay", StringValue ("5ms"));
171  p2p_2gb200ms.SetDeviceAttribute ("DataRate", StringValue ("2Gbps"));
172  p2p_2gb200ms.SetChannelAttribute ("Delay", StringValue ("200ms"));
173  p2p_100mb1ms.SetDeviceAttribute ("DataRate", StringValue ("100Mbps"));
174  p2p_100mb1ms.SetChannelAttribute ("Delay", StringValue ("1ms"));
175 
176  // Setup NixVector Routing
177  Ipv4NixVectorHelper nixRouting;
178  Ipv4StaticRoutingHelper staticRouting;
179 
181  list.Add (staticRouting, 0);
182  list.Add (nixRouting, 10);
183 
184  if (nix)
185  {
186  stack.SetRoutingHelper (list); // has effect on the next Install ()
187  }
188 
189  // Create Campus Networks
190  for (int z = 0; z < nCN; ++z)
191  {
192  std::cout << "Creating Campus Network " << z << ":" << std::endl;
193  // Create Net0
194  std::cout << " SubNet [ 0";
195  for (int i = 0; i < 3; ++i)
196  {
197  nodes_net0[z][i].Create (1);
198  stack.Install (nodes_net0[z][i]);
199  }
200  nodes_net0[z][0].Add (nodes_net0[z][1].Get (0));
201  nodes_net0[z][1].Add (nodes_net0[z][2].Get (0));
202  nodes_net0[z][2].Add (nodes_net0[z][0].Get (0));
203  NetDeviceContainer ndc0[3];
204  for (int i = 0; i < 3; ++i)
205  {
206  ndc0[i] = p2p_1gb5ms.Install (nodes_net0[z][i]);
207  }
208  // Create Net1
209  std::cout << " 1";
210  for (int i = 0; i < 6; ++i)
211  {
212  nodes_net1[z][i].Create (1);
213  stack.Install (nodes_net1[z][i]);
214  }
215  nodes_net1[z][0].Add (nodes_net1[z][1].Get (0));
216  nodes_net1[z][2].Add (nodes_net1[z][0].Get (0));
217  nodes_net1[z][3].Add (nodes_net1[z][0].Get (0));
218  nodes_net1[z][4].Add (nodes_net1[z][1].Get (0));
219  nodes_net1[z][5].Add (nodes_net1[z][1].Get (0));
220  NetDeviceContainer ndc1[6];
221  for (int i = 0; i < 6; ++i)
222  {
223  if (i == 1)
224  {
225  continue;
226  }
227  ndc1[i] = p2p_1gb5ms.Install (nodes_net1[z][i]);
228  }
229  // Connect Net0 <-> Net1
230  NodeContainer net0_1;
231  net0_1.Add (nodes_net0[z][2].Get (0));
232  net0_1.Add (nodes_net1[z][0].Get (0));
233  NetDeviceContainer ndc0_1;
234  ndc0_1 = p2p_1gb5ms.Install (net0_1);
235  oss.str ("");
236  oss << 10 + z << ".1.252.0";
237  address.SetBase (oss.str ().c_str (), "255.255.255.0");
238  ifs = address.Assign (ndc0_1);
239  // Create Net2
240  std::cout << " 2";
241  for (int i = 0; i < 14; ++i)
242  {
243  nodes_net2[z][i].Create (1);
244  stack.Install (nodes_net2[z][i]);
245  }
246  nodes_net2[z][0].Add (nodes_net2[z][1].Get (0));
247  nodes_net2[z][2].Add (nodes_net2[z][0].Get (0));
248  nodes_net2[z][1].Add (nodes_net2[z][3].Get (0));
249  nodes_net2[z][3].Add (nodes_net2[z][2].Get (0));
250  nodes_net2[z][4].Add (nodes_net2[z][2].Get (0));
251  nodes_net2[z][5].Add (nodes_net2[z][3].Get (0));
252  nodes_net2[z][6].Add (nodes_net2[z][5].Get (0));
253  nodes_net2[z][7].Add (nodes_net2[z][2].Get (0));
254  nodes_net2[z][8].Add (nodes_net2[z][3].Get (0));
255  nodes_net2[z][9].Add (nodes_net2[z][4].Get (0));
256  nodes_net2[z][10].Add (nodes_net2[z][5].Get (0));
257  nodes_net2[z][11].Add (nodes_net2[z][6].Get (0));
258  nodes_net2[z][12].Add (nodes_net2[z][6].Get (0));
259  nodes_net2[z][13].Add (nodes_net2[z][6].Get (0));
260  NetDeviceContainer ndc2[14];
261  for (int i = 0; i < 14; ++i)
262  {
263  ndc2[i] = p2p_1gb5ms.Install (nodes_net2[z][i]);
264  }
266  Array2D<NetDeviceContainer> ndc2LAN(7, nLANClients);
267  for (int i = 0; i < 7; ++i)
268  {
269  oss.str ("");
270  oss << 10 + z << ".4." << 15 + i << ".0";
271  address.SetBase (oss.str ().c_str (), "255.255.255.0");
272  for (int j = 0; j < nLANClients; ++j)
273  {
274  nodes_net2LAN[z][i][j].Create (1);
275  stack.Install (nodes_net2LAN[z][i][j]);
276  nodes_net2LAN[z][i][j].Add (nodes_net2[z][i+7].Get (0));
277  ndc2LAN[i][j] = p2p_100mb1ms.Install (nodes_net2LAN[z][i][j]);
278  ifs2LAN[z][i][j] = address.Assign (ndc2LAN[i][j]);
279  }
280  }
281  // Create Net3
282  std::cout << " 3 ]" << std::endl;
283  for (int i = 0; i < 9; ++i)
284  {
285  nodes_net3[z][i].Create (1);
286  stack.Install (nodes_net3[z][i]);
287  }
288  nodes_net3[z][0].Add (nodes_net3[z][1].Get (0));
289  nodes_net3[z][1].Add (nodes_net3[z][2].Get (0));
290  nodes_net3[z][2].Add (nodes_net3[z][3].Get (0));
291  nodes_net3[z][3].Add (nodes_net3[z][1].Get (0));
292  nodes_net3[z][4].Add (nodes_net3[z][0].Get (0));
293  nodes_net3[z][5].Add (nodes_net3[z][0].Get (0));
294  nodes_net3[z][6].Add (nodes_net3[z][2].Get (0));
295  nodes_net3[z][7].Add (nodes_net3[z][3].Get (0));
296  nodes_net3[z][8].Add (nodes_net3[z][3].Get (0));
297  NetDeviceContainer ndc3[9];
298  for (int i = 0; i < 9; ++i)
299  {
300  ndc3[i] = p2p_1gb5ms.Install (nodes_net3[z][i]);
301  }
303  Array2D<NetDeviceContainer> ndc3LAN(5, nLANClients);
304  for (int i = 0; i < 5; ++i)
305  {
306  oss.str ("");
307  oss << 10 + z << ".5." << 10 + i << ".0";
308  address.SetBase (oss.str ().c_str (), "255.255.255.255");
309  for (int j = 0; j < nLANClients; ++j)
310  {
311  nodes_net3LAN[z][i][j].Create (1);
312  stack.Install (nodes_net3LAN[z][i][j]);
313  nodes_net3LAN[z][i][j].Add (nodes_net3[z][i+4].Get (0));
314  ndc3LAN[i][j] = p2p_100mb1ms.Install (nodes_net3LAN[z][i][j]);
315  ifs3LAN[z][i][j] = address.Assign (ndc3LAN[i][j]);
316  }
317  }
318  std::cout << " Connecting Subnets..." << std::endl;
319  // Create Lone Routers (Node 4 & 5)
320  nodes_netLR[z].Create (2);
321  stack.Install (nodes_netLR[z]);
322  NetDeviceContainer ndcLR;
323  ndcLR = p2p_1gb5ms.Install (nodes_netLR[z]);
324  // Connect Net2/Net3 through Lone Routers to Net0
325  NodeContainer net0_4, net0_5, net2_4a, net2_4b, net3_5a, net3_5b;
326  net0_4.Add (nodes_netLR[z].Get (0));
327  net0_4.Add (nodes_net0[z][0].Get (0));
328  net0_5.Add (nodes_netLR[z].Get (1));
329  net0_5.Add (nodes_net0[z][1].Get (0));
330  net2_4a.Add (nodes_netLR[z].Get (0));
331  net2_4a.Add (nodes_net2[z][0].Get (0));
332  net2_4b.Add (nodes_netLR[z].Get (1));
333  net2_4b.Add (nodes_net2[z][1].Get (0));
334  net3_5a.Add (nodes_netLR[z].Get (1));
335  net3_5a.Add (nodes_net3[z][0].Get (0));
336  net3_5b.Add (nodes_netLR[z].Get (1));
337  net3_5b.Add (nodes_net3[z][1].Get (0));
338  NetDeviceContainer ndc0_4, ndc0_5, ndc2_4a, ndc2_4b, ndc3_5a, ndc3_5b;
339  ndc0_4 = p2p_1gb5ms.Install (net0_4);
340  oss.str ("");
341  oss << 10 + z << ".1.253.0";
342  address.SetBase (oss.str ().c_str (), "255.255.255.0");
343  ifs = address.Assign (ndc0_4);
344  ndc0_5 = p2p_1gb5ms.Install (net0_5);
345  oss.str ("");
346  oss << 10 + z << ".1.254.0";
347  address.SetBase (oss.str ().c_str (), "255.255.255.0");
348  ifs = address.Assign (ndc0_5);
349  ndc2_4a = p2p_1gb5ms.Install (net2_4a);
350  oss.str ("");
351  oss << 10 + z << ".4.253.0";
352  address.SetBase (oss.str ().c_str (), "255.255.255.0");
353  ifs = address.Assign (ndc2_4a);
354  ndc2_4b = p2p_1gb5ms.Install (net2_4b);
355  oss.str ("");
356  oss << 10 + z << ".4.254.0";
357  address.SetBase (oss.str ().c_str (), "255.255.255.0");
358  ifs = address.Assign (ndc2_4b);
359  ndc3_5a = p2p_1gb5ms.Install (net3_5a);
360  oss.str ("");
361  oss << 10 + z << ".5.253.0";
362  address.SetBase (oss.str ().c_str (), "255.255.255.0");
363  ifs = address.Assign (ndc3_5a);
364  ndc3_5b = p2p_1gb5ms.Install (net3_5b);
365  oss.str ("");
366  oss << 10 + z << ".5.254.0";
367  address.SetBase (oss.str ().c_str (), "255.255.255.0");
368  ifs = address.Assign (ndc3_5b);
369  // Assign IP addresses
370  std::cout << " Assigning IP addresses..." << std::endl;
371  for (int i = 0; i < 3; ++i)
372  {
373  oss.str ("");
374  oss << 10 + z << ".1." << 1 + i << ".0";
375  address.SetBase (oss.str ().c_str (), "255.255.255.0");
376  ifs0[z][i] = address.Assign (ndc0[i]);
377  }
378  for (int i = 0; i < 6; ++i)
379  {
380  if (i == 1)
381  {
382  continue;
383  }
384  oss.str ("");
385  oss << 10 + z << ".2." << 1 + i << ".0";
386  address.SetBase (oss.str ().c_str (), "255.255.255.0");
387  ifs1[z][i] = address.Assign (ndc1[i]);
388  }
389  oss.str ("");
390  oss << 10 + z << ".3.1.0";
391  address.SetBase (oss.str ().c_str (), "255.255.255.0");
392  ifs = address.Assign (ndcLR);
393  for (int i = 0; i < 14; ++i)
394  {
395  oss.str ("");
396  oss << 10 + z << ".4." << 1 + i << ".0";
397  address.SetBase (oss.str ().c_str (), "255.255.255.0");
398  ifs2[z][i] = address.Assign (ndc2[i]);
399  }
400  for (int i = 0; i < 9; ++i)
401  {
402  oss.str ("");
403  oss << 10 + z << ".5." << 1 + i << ".0";
404  address.SetBase (oss.str ().c_str (), "255.255.255.0");
405  ifs3[z][i] = address.Assign (ndc3[i]);
406  }
407  }
408  // Create Ring Links
409  if (nCN > 1)
410  {
411  std::cout << "Forming Ring Topology..." << std::endl;
412  NodeContainer* nodes_ring = new NodeContainer[nCN];
413  for (int z = 0; z < nCN-1; ++z)
414  {
415  nodes_ring[z].Add (nodes_net0[z][0].Get (0));
416  nodes_ring[z].Add (nodes_net0[z+1][0].Get (0));
417  }
418  nodes_ring[nCN-1].Add (nodes_net0[nCN-1][0].Get (0));
419  nodes_ring[nCN-1].Add (nodes_net0[0][0].Get (0));
420  NetDeviceContainer* ndc_ring = new NetDeviceContainer[nCN];
421  for (int z = 0; z < nCN; ++z)
422  {
423  ndc_ring[z] = p2p_2gb200ms.Install (nodes_ring[z]);
424  oss.str ("");
425  oss << "254.1." << z + 1 << ".0";
426  address.SetBase (oss.str ().c_str (), "255.255.255.0");
427  ifs = address.Assign (ndc_ring[z]);
428  }
429  delete[] ndc_ring;
430  delete[] nodes_ring;
431  }
432 
433  // Create Traffic Flows
434  std::cout << "Creating TCP Traffic Flows:" << std::endl;
435  Config::SetDefault ("ns3::OnOffApplication::MaxBytes", UintegerValue (500000));
436  Config::SetDefault ("ns3::OnOffApplication::OnTime",
437  StringValue ("ns3::ConstantRandomVariable[Constant=1.0]"));
438  Config::SetDefault ("ns3::OnOffApplication::OffTime",
439  StringValue ("ns3::ConstantRandomVariable[Constant=0.0]"));
440  Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (512));
441 
442  Ptr<UniformRandomVariable> urng = CreateObject<UniformRandomVariable> ();
443  int r1;
444  double r2;
445  for (int z = 0; z < nCN; ++z)
446  {
447  int x = z + 1;
448  if (z == nCN - 1)
449  {
450  x = 0;
451  }
452  // Subnet 2 LANs
453  std::cout << " Campus Network " << z << " Flows [ Net2 ";
454  for (int i = 0; i < 7; ++i)
455  {
456  for (int j = 0; j < nLANClients; ++j)
457  {
458  // Sinks
459  PacketSinkHelper sinkHelper ("ns3::TcpSocketFactory",
461  ApplicationContainer sinkApp = sinkHelper.Install (
462  nodes_net2LAN[z][i][j].Get (0));
463  sinkApp.Start (Seconds (0.0));
464  // Sources
465  r1 = 2 + (int)(4 * urng->GetValue ());
466  r2 = 10 * urng->GetValue ();
467  OnOffHelper client ("ns3::TcpSocketFactory", Address ());
468  AddressValue remoteAddress (InetSocketAddress (
469  ifs2LAN[z][i][j].GetAddress (0), 9999));
470  client.SetAttribute ("Remote", remoteAddress);
471  ApplicationContainer clientApp;
472  clientApp.Add (client.Install (nodes_net1[x][r1].Get (0)));
473  clientApp.Start (Seconds (r2));
474  }
475  }
476  // Subnet 3 LANs
477  std::cout << "Net3 ]" << std::endl;
478  for (int i = 0; i < 5; ++i)
479  {
480  for (int j = 0; j < nLANClients; ++j)
481  {
482  // Sinks
483  PacketSinkHelper sinkHelper ("ns3::TcpSocketFactory",
485  ApplicationContainer sinkApp = sinkHelper.Install (
486  nodes_net3LAN[z][i][j].Get (0));
487  sinkApp.Start (Seconds (0.0));
488  // Sources
489  r1 = 2 + (int)(4 * urng->GetValue ());
490  r2 = 10 * urng->GetValue ();
491  OnOffHelper client ("ns3::TcpSocketFactory", Address ());
492  AddressValue remoteAddress (InetSocketAddress (
493  ifs3LAN[z][i][j].GetAddress (0), 9999));
494  client.SetAttribute ("Remote", remoteAddress);
495  ApplicationContainer clientApp;
496  clientApp.Add (client.Install (nodes_net1[x][r1].Get (0)));
497  clientApp.Start (Seconds (r2));
498  }
499  }
500  }
501 
502  std::cout << "Created " << NodeList::GetNNodes () << " nodes." << std::endl;
503  TIMER_TYPE routingStart;
504  TIMER_NOW (routingStart);
505 
506  if (nix)
507  {
508  // Calculate routing tables
509  std::cout << "Using Nix-vectors..." << std::endl;
510  }
511  else
512  {
513  // Calculate routing tables
514  std::cout << "Populating Global Static Routing Tables..." << std::endl;
516  }
517 
518  TIMER_TYPE routingEnd;
519  TIMER_NOW (routingEnd);
520  std::cout << "Routing tables population took "
521  << TIMER_DIFF (routingEnd, routingStart) << std::endl;
522 
524  std::cout << "Running simulator..." << std::endl;
525  TIMER_NOW (t1);
526  Simulator::Stop (Seconds (100.0));
527  Simulator::Run ();
528  TIMER_NOW (t2);
529  std::cout << "Simulator finished." << std::endl;
531 
532  double d1 = TIMER_DIFF (t1, t0), d2 = TIMER_DIFF (t2, t1);
533  std::cout << "-----" << std::endl << "Runtime Stats:" << std::endl;
534  std::cout << "Simulator init time: " << d1 << std::endl;
535  std::cout << "Simulator run time: " << d2 << std::endl;
536  std::cout << "Total elapsed time: " << d1+d2 << std::endl;
537 
538  delete[] nodes_netLR;
539  return 0;
540 }
holds a vector of ns3::Application pointers.
an Inet address class
static Ipv4Address GetAny(void)
int main(int argc, char *argv[])
Definition: nms-p2p-nix.cc:124
static uint32_t GetNNodes(void)
Definition: node-list.cc:200
NS_LOG_COMPONENT_DEFINE("GrantedTimeWindowMpiInterface")
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:19
const size_t m_xMax
Definition: nms-p2p-nix.cc:120
NetDeviceContainer Install(NodeContainer c)
Array2D(const size_t x, const size_t y)
Definition: nms-p2p-nix.cc:69
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container. ...
void Progress()
Definition: nms-p2p-nix.cc:60
static void Run(void)
Run the simulation until one of:
Definition: simulator.cc:157
const size_t m_xMax
Definition: nms-p2p-nix.cc:89
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.
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
Definition: simulator.h:824
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
a polymophic address class
Definition: address.h:86
T ** p
Definition: nms-p2p-nix.cc:88
Array3D(const size_t x, const size_t y, const size_t z)
Definition: nms-p2p-nix.cc:96
Hold an unsigned integer type.
Definition: uinteger.h:46
Array2D< T > ** p
Definition: nms-p2p-nix.cc:119
holds a vector of ns3::NetDevice pointers
#define TIMER_DIFF(_t1, _t2)
Definition: nms-p2p-nix.cc:56
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:152
#define list
static void Destroy(void)
Every event scheduled by the Simulator::insertAtDestroy method is invoked.
Definition: simulator.cc:121
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:667
keep track of a set of node pointers.
double GetValue(double min, double max)
Returns a random double from the uniform distribution with 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:985
void Add(const Ipv4RoutingHelper &routing, int16_t priority)
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.
hold objects of type ns3::Address
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.
Helper class that adds ns3::Ipv4StaticRouting objects.
void AddValue(const std::string &name, const std::string &help, T &value)
Add a program argument, assigning to POD.
Definition: command-line.h:408
static void Stop(void)
If an event invokes this method, it will be the last event scheduled by the Simulator::run method bef...
Definition: simulator.cc:165
#define TIMER_NOW(_t)
Definition: nms-p2p-nix.cc:54
~Array3D(void)
Definition: nms-p2p-nix.cc:103
Helper class that adds ns3::Ipv4ListRouting objects.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::PacketSinkApplication on each node of the input container configured with all the att...
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:75
ApplicationContainer Install(NodeContainer c) const
Install an ns3::OnOffApplication on each node of the input container configured with all the attribut...
void SetRoutingHelper(const Ipv4RoutingHelper &routing)
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
void LogComponentEnable(char const *name, enum LogLevel level)
Definition: log.cc:311