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 
67 template <typename T>
68 class Array2D
69 {
70 public:
76  Array2D (const size_t x, const size_t y) :
77  p (new T*[x]), m_xMax (x)
78  {
79  for (size_t i = 0; i < m_xMax; i++)
80  p[i] = new T[y];
81  }
82 
83  ~Array2D (void)
84  {
85  for (size_t i = 0; i < m_xMax; i++)
86  delete[] p[i];
87  delete[] p;
88  p = 0;
89  }
90 
96  T* operator[] (const size_t i)
97  {
98  return p[i];
99  }
100 private:
101  T** p;
102  const size_t m_xMax;
103 };
104 
109 template <typename T>
110 class Array3D
111 {
112 public:
119  Array3D (const size_t x, const size_t y, const size_t z) : p (new Array2D<T>*[x]), m_xMax (x)
120  {
121  for (size_t i = 0; i < m_xMax; i++)
122  p[i] = new Array2D<T> (y, z);
123  }
124 
125  ~Array3D (void)
126  {
127  for (size_t i = 0; i < m_xMax; i++)
128  {
129  delete p[i];
130  p[i] = 0;
131  }
132  delete[] p;
133  p = 0;
134  }
135 
141  Array2D<T>& operator[] (const size_t i)
142  {
143  return *(p[i]);
144  }
145 private:
147  const size_t m_xMax;
148 };
149 
150 int
151 main (int argc, char *argv[])
152 {
153  TIMER_TYPE t0, t1, t2;
154  TIMER_NOW (t0);
155  std::cout << " ==== DARPA NMS CAMPUS NETWORK SIMULATION ====" << std::endl;
156  // LogComponentEnable ("OnOffApplication", LOG_LEVEL_INFO);
157 
158  int nCN = 2, nLANClients = 42;
159  bool nix = true;
160 
162  cmd.AddValue ("CN", "Number of total CNs [2]", nCN);
163  cmd.AddValue ("LAN", "Number of nodes per LAN [42]", nLANClients);
164  cmd.AddValue ("NIX", "Toggle nix-vector routing", nix);
165  cmd.Parse (argc,argv);
166 
167  if (nCN < 2)
168  {
169  std::cout << "Number of total CNs (" << nCN << ") lower than minimum of 2"
170  << std::endl;
171  return 1;
172  }
173 
174  std::cout << "Number of CNs: " << nCN << ", LAN nodes: " << nLANClients << std::endl;
175 
176  Array2D<NodeContainer> nodes_net0(nCN, 3);
177  Array2D<NodeContainer> nodes_net1(nCN, 6);
178  NodeContainer* nodes_netLR = new NodeContainer[nCN];
179  Array2D<NodeContainer> nodes_net2(nCN, 14);
180  Array3D<NodeContainer> nodes_net2LAN(nCN, 7, nLANClients);
181  Array2D<NodeContainer> nodes_net3(nCN, 9);
182  Array3D<NodeContainer> nodes_net3LAN(nCN, 5, nLANClients);
183 
184  PointToPointHelper p2p_2gb200ms, p2p_1gb5ms, p2p_100mb1ms;
187  Array2D<Ipv4InterfaceContainer> ifs0(nCN, 3);
188  Array2D<Ipv4InterfaceContainer> ifs1(nCN, 6);
189  Array2D<Ipv4InterfaceContainer> ifs2(nCN, 14);
190  Array2D<Ipv4InterfaceContainer> ifs3(nCN, 9);
191  Array3D<Ipv4InterfaceContainer> ifs2LAN(nCN, 7, nLANClients);
192  Array3D<Ipv4InterfaceContainer> ifs3LAN(nCN, 5, nLANClients);
193 
195  std::ostringstream oss;
196  p2p_1gb5ms.SetDeviceAttribute ("DataRate", StringValue ("1Gbps"));
197  p2p_1gb5ms.SetChannelAttribute ("Delay", StringValue ("5ms"));
198  p2p_2gb200ms.SetDeviceAttribute ("DataRate", StringValue ("2Gbps"));
199  p2p_2gb200ms.SetChannelAttribute ("Delay", StringValue ("200ms"));
200  p2p_100mb1ms.SetDeviceAttribute ("DataRate", StringValue ("100Mbps"));
201  p2p_100mb1ms.SetChannelAttribute ("Delay", StringValue ("1ms"));
202 
203  // Setup NixVector Routing
204  if (nix)
205  {
206  Ipv4NixVectorHelper nixRouting;
207  stack.SetRoutingHelper (nixRouting); // has effect on the next Install ()
208  }
209 
210  // Create Campus Networks
211  for (int z = 0; z < nCN; ++z)
212  {
213  std::cout << "Creating Campus Network " << z << ":" << std::endl;
214  // Create Net0
215  std::cout << " SubNet [ 0";
216  for (int i = 0; i < 3; ++i)
217  {
218  nodes_net0[z][i].Create (1);
219  stack.Install (nodes_net0[z][i]);
220  }
221  nodes_net0[z][0].Add (nodes_net0[z][1].Get (0));
222  nodes_net0[z][1].Add (nodes_net0[z][2].Get (0));
223  nodes_net0[z][2].Add (nodes_net0[z][0].Get (0));
224  NetDeviceContainer ndc0[3];
225  for (int i = 0; i < 3; ++i)
226  {
227  ndc0[i] = p2p_1gb5ms.Install (nodes_net0[z][i]);
228  }
229  // Create Net1
230  std::cout << " 1";
231  for (int i = 0; i < 6; ++i)
232  {
233  nodes_net1[z][i].Create (1);
234  stack.Install (nodes_net1[z][i]);
235  }
236  nodes_net1[z][0].Add (nodes_net1[z][1].Get (0));
237  nodes_net1[z][2].Add (nodes_net1[z][0].Get (0));
238  nodes_net1[z][3].Add (nodes_net1[z][0].Get (0));
239  nodes_net1[z][4].Add (nodes_net1[z][1].Get (0));
240  nodes_net1[z][5].Add (nodes_net1[z][1].Get (0));
241  NetDeviceContainer ndc1[6];
242  for (int i = 0; i < 6; ++i)
243  {
244  if (i == 1)
245  {
246  continue;
247  }
248  ndc1[i] = p2p_1gb5ms.Install (nodes_net1[z][i]);
249  }
250  // Connect Net0 <-> Net1
251  NodeContainer net0_1;
252  net0_1.Add (nodes_net0[z][2].Get (0));
253  net0_1.Add (nodes_net1[z][0].Get (0));
254  NetDeviceContainer ndc0_1;
255  ndc0_1 = p2p_1gb5ms.Install (net0_1);
256  oss.str ("");
257  oss << 10 + z << ".1.252.0";
258  address.SetBase (oss.str ().c_str (), "255.255.255.0");
259  ifs = address.Assign (ndc0_1);
260  // Create Net2
261  std::cout << " 2";
262  for (int i = 0; i < 14; ++i)
263  {
264  nodes_net2[z][i].Create (1);
265  stack.Install (nodes_net2[z][i]);
266  }
267  nodes_net2[z][0].Add (nodes_net2[z][1].Get (0));
268  nodes_net2[z][2].Add (nodes_net2[z][0].Get (0));
269  nodes_net2[z][1].Add (nodes_net2[z][3].Get (0));
270  nodes_net2[z][3].Add (nodes_net2[z][2].Get (0));
271  nodes_net2[z][4].Add (nodes_net2[z][2].Get (0));
272  nodes_net2[z][5].Add (nodes_net2[z][3].Get (0));
273  nodes_net2[z][6].Add (nodes_net2[z][5].Get (0));
274  nodes_net2[z][7].Add (nodes_net2[z][2].Get (0));
275  nodes_net2[z][8].Add (nodes_net2[z][3].Get (0));
276  nodes_net2[z][9].Add (nodes_net2[z][4].Get (0));
277  nodes_net2[z][10].Add (nodes_net2[z][5].Get (0));
278  nodes_net2[z][11].Add (nodes_net2[z][6].Get (0));
279  nodes_net2[z][12].Add (nodes_net2[z][6].Get (0));
280  nodes_net2[z][13].Add (nodes_net2[z][6].Get (0));
281  NetDeviceContainer ndc2[14];
282  for (int i = 0; i < 14; ++i)
283  {
284  ndc2[i] = p2p_1gb5ms.Install (nodes_net2[z][i]);
285  }
287  Array2D<NetDeviceContainer> ndc2LAN(7, nLANClients);
288  for (int i = 0; i < 7; ++i)
289  {
290  oss.str ("");
291  oss << 10 + z << ".4." << 15 + i << ".0";
292  address.SetBase (oss.str ().c_str (), "255.255.255.0");
293  for (int j = 0; j < nLANClients; ++j)
294  {
295  nodes_net2LAN[z][i][j].Create (1);
296  stack.Install (nodes_net2LAN[z][i][j]);
297  nodes_net2LAN[z][i][j].Add (nodes_net2[z][i+7].Get (0));
298  ndc2LAN[i][j] = p2p_100mb1ms.Install (nodes_net2LAN[z][i][j]);
299  ifs2LAN[z][i][j] = address.Assign (ndc2LAN[i][j]);
300  }
301  }
302  // Create Net3
303  std::cout << " 3 ]" << std::endl;
304  for (int i = 0; i < 9; ++i)
305  {
306  nodes_net3[z][i].Create (1);
307  stack.Install (nodes_net3[z][i]);
308  }
309  nodes_net3[z][0].Add (nodes_net3[z][1].Get (0));
310  nodes_net3[z][1].Add (nodes_net3[z][2].Get (0));
311  nodes_net3[z][2].Add (nodes_net3[z][3].Get (0));
312  nodes_net3[z][3].Add (nodes_net3[z][1].Get (0));
313  nodes_net3[z][4].Add (nodes_net3[z][0].Get (0));
314  nodes_net3[z][5].Add (nodes_net3[z][0].Get (0));
315  nodes_net3[z][6].Add (nodes_net3[z][2].Get (0));
316  nodes_net3[z][7].Add (nodes_net3[z][3].Get (0));
317  nodes_net3[z][8].Add (nodes_net3[z][3].Get (0));
318  NetDeviceContainer ndc3[9];
319  for (int i = 0; i < 9; ++i)
320  {
321  ndc3[i] = p2p_1gb5ms.Install (nodes_net3[z][i]);
322  }
324  Array2D<NetDeviceContainer> ndc3LAN(5, nLANClients);
325  for (int i = 0; i < 5; ++i)
326  {
327  oss.str ("");
328  oss << 10 + z << ".5." << 10 + i << ".0";
329  address.SetBase (oss.str ().c_str (), "255.255.255.255");
330  for (int j = 0; j < nLANClients; ++j)
331  {
332  nodes_net3LAN[z][i][j].Create (1);
333  stack.Install (nodes_net3LAN[z][i][j]);
334  nodes_net3LAN[z][i][j].Add (nodes_net3[z][i+4].Get (0));
335  ndc3LAN[i][j] = p2p_100mb1ms.Install (nodes_net3LAN[z][i][j]);
336  ifs3LAN[z][i][j] = address.Assign (ndc3LAN[i][j]);
337  }
338  }
339  std::cout << " Connecting Subnets..." << std::endl;
340  // Create Lone Routers (Node 4 & 5)
341  nodes_netLR[z].Create (2);
342  stack.Install (nodes_netLR[z]);
343  NetDeviceContainer ndcLR;
344  ndcLR = p2p_1gb5ms.Install (nodes_netLR[z]);
345  // Connect Net2/Net3 through Lone Routers to Net0
346  NodeContainer net0_4, net0_5, net2_4a, net2_4b, net3_5a, net3_5b;
347  net0_4.Add (nodes_netLR[z].Get (0));
348  net0_4.Add (nodes_net0[z][0].Get (0));
349  net0_5.Add (nodes_netLR[z].Get (1));
350  net0_5.Add (nodes_net0[z][1].Get (0));
351  net2_4a.Add (nodes_netLR[z].Get (0));
352  net2_4a.Add (nodes_net2[z][0].Get (0));
353  net2_4b.Add (nodes_netLR[z].Get (1));
354  net2_4b.Add (nodes_net2[z][1].Get (0));
355  net3_5a.Add (nodes_netLR[z].Get (1));
356  net3_5a.Add (nodes_net3[z][0].Get (0));
357  net3_5b.Add (nodes_netLR[z].Get (1));
358  net3_5b.Add (nodes_net3[z][1].Get (0));
359  NetDeviceContainer ndc0_4, ndc0_5, ndc2_4a, ndc2_4b, ndc3_5a, ndc3_5b;
360  ndc0_4 = p2p_1gb5ms.Install (net0_4);
361  oss.str ("");
362  oss << 10 + z << ".1.253.0";
363  address.SetBase (oss.str ().c_str (), "255.255.255.0");
364  ifs = address.Assign (ndc0_4);
365  ndc0_5 = p2p_1gb5ms.Install (net0_5);
366  oss.str ("");
367  oss << 10 + z << ".1.254.0";
368  address.SetBase (oss.str ().c_str (), "255.255.255.0");
369  ifs = address.Assign (ndc0_5);
370  ndc2_4a = p2p_1gb5ms.Install (net2_4a);
371  oss.str ("");
372  oss << 10 + z << ".4.253.0";
373  address.SetBase (oss.str ().c_str (), "255.255.255.0");
374  ifs = address.Assign (ndc2_4a);
375  ndc2_4b = p2p_1gb5ms.Install (net2_4b);
376  oss.str ("");
377  oss << 10 + z << ".4.254.0";
378  address.SetBase (oss.str ().c_str (), "255.255.255.0");
379  ifs = address.Assign (ndc2_4b);
380  ndc3_5a = p2p_1gb5ms.Install (net3_5a);
381  oss.str ("");
382  oss << 10 + z << ".5.253.0";
383  address.SetBase (oss.str ().c_str (), "255.255.255.0");
384  ifs = address.Assign (ndc3_5a);
385  ndc3_5b = p2p_1gb5ms.Install (net3_5b);
386  oss.str ("");
387  oss << 10 + z << ".5.254.0";
388  address.SetBase (oss.str ().c_str (), "255.255.255.0");
389  ifs = address.Assign (ndc3_5b);
390  // Assign IP addresses
391  std::cout << " Assigning IP addresses..." << std::endl;
392  for (int i = 0; i < 3; ++i)
393  {
394  oss.str ("");
395  oss << 10 + z << ".1." << 1 + i << ".0";
396  address.SetBase (oss.str ().c_str (), "255.255.255.0");
397  ifs0[z][i] = address.Assign (ndc0[i]);
398  }
399  for (int i = 0; i < 6; ++i)
400  {
401  if (i == 1)
402  {
403  continue;
404  }
405  oss.str ("");
406  oss << 10 + z << ".2." << 1 + i << ".0";
407  address.SetBase (oss.str ().c_str (), "255.255.255.0");
408  ifs1[z][i] = address.Assign (ndc1[i]);
409  }
410  oss.str ("");
411  oss << 10 + z << ".3.1.0";
412  address.SetBase (oss.str ().c_str (), "255.255.255.0");
413  ifs = address.Assign (ndcLR);
414  for (int i = 0; i < 14; ++i)
415  {
416  oss.str ("");
417  oss << 10 + z << ".4." << 1 + i << ".0";
418  address.SetBase (oss.str ().c_str (), "255.255.255.0");
419  ifs2[z][i] = address.Assign (ndc2[i]);
420  }
421  for (int i = 0; i < 9; ++i)
422  {
423  oss.str ("");
424  oss << 10 + z << ".5." << 1 + i << ".0";
425  address.SetBase (oss.str ().c_str (), "255.255.255.0");
426  ifs3[z][i] = address.Assign (ndc3[i]);
427  }
428  }
429  // Create Ring Links
430  if (nCN > 1)
431  {
432  std::cout << "Forming Ring Topology..." << std::endl;
433  NodeContainer* nodes_ring = new NodeContainer[nCN];
434  for (int z = 0; z < nCN-1; ++z)
435  {
436  nodes_ring[z].Add (nodes_net0[z][0].Get (0));
437  nodes_ring[z].Add (nodes_net0[z+1][0].Get (0));
438  }
439  nodes_ring[nCN-1].Add (nodes_net0[nCN-1][0].Get (0));
440  nodes_ring[nCN-1].Add (nodes_net0[0][0].Get (0));
441  NetDeviceContainer* ndc_ring = new NetDeviceContainer[nCN];
442  for (int z = 0; z < nCN; ++z)
443  {
444  ndc_ring[z] = p2p_2gb200ms.Install (nodes_ring[z]);
445  oss.str ("");
446  oss << "254.1." << z + 1 << ".0";
447  address.SetBase (oss.str ().c_str (), "255.255.255.0");
448  ifs = address.Assign (ndc_ring[z]);
449  }
450  delete[] ndc_ring;
451  delete[] nodes_ring;
452  }
453 
454  // Create Traffic Flows
455  std::cout << "Creating TCP Traffic Flows:" << std::endl;
456  Config::SetDefault ("ns3::OnOffApplication::MaxBytes", UintegerValue (500000));
457  Config::SetDefault ("ns3::OnOffApplication::OnTime",
458  StringValue ("ns3::ConstantRandomVariable[Constant=1.0]"));
459  Config::SetDefault ("ns3::OnOffApplication::OffTime",
460  StringValue ("ns3::ConstantRandomVariable[Constant=0.0]"));
461  Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (512));
462 
463  Ptr<UniformRandomVariable> urng = CreateObject<UniformRandomVariable> ();
464  int r1;
465  double r2;
466  for (int z = 0; z < nCN; ++z)
467  {
468  int x = z + 1;
469  if (z == nCN - 1)
470  {
471  x = 0;
472  }
473  // Subnet 2 LANs
474  std::cout << " Campus Network " << z << " Flows [ Net2 ";
475  for (int i = 0; i < 7; ++i)
476  {
477  for (int j = 0; j < nLANClients; ++j)
478  {
479  // Sinks
480  PacketSinkHelper sinkHelper ("ns3::TcpSocketFactory",
482  ApplicationContainer sinkApp = sinkHelper.Install (
483  nodes_net2LAN[z][i][j].Get (0));
484  sinkApp.Start (Seconds (0.0));
485  // Sources
486  r1 = 2 + (int)(4 * urng->GetValue ());
487  r2 = 10 * urng->GetValue ();
488  OnOffHelper client ("ns3::TcpSocketFactory", Address ());
489  AddressValue remoteAddress (InetSocketAddress (
490  ifs2LAN[z][i][j].GetAddress (0), 9999));
491  client.SetAttribute ("Remote", remoteAddress);
492  ApplicationContainer clientApp;
493  clientApp.Add (client.Install (nodes_net1[x][r1].Get (0)));
494  clientApp.Start (Seconds (r2));
495  }
496  }
497  // Subnet 3 LANs
498  std::cout << "Net3 ]" << std::endl;
499  for (int i = 0; i < 5; ++i)
500  {
501  for (int j = 0; j < nLANClients; ++j)
502  {
503  // Sinks
504  PacketSinkHelper sinkHelper ("ns3::TcpSocketFactory",
506  ApplicationContainer sinkApp = sinkHelper.Install (
507  nodes_net3LAN[z][i][j].Get (0));
508  sinkApp.Start (Seconds (0.0));
509  // Sources
510  r1 = 2 + (int)(4 * urng->GetValue ());
511  r2 = 10 * urng->GetValue ();
512  OnOffHelper client ("ns3::TcpSocketFactory", Address ());
513  AddressValue remoteAddress (InetSocketAddress (
514  ifs3LAN[z][i][j].GetAddress (0), 9999));
515  client.SetAttribute ("Remote", remoteAddress);
516  ApplicationContainer clientApp;
517  clientApp.Add (client.Install (nodes_net1[x][r1].Get (0)));
518  clientApp.Start (Seconds (r2));
519  }
520  }
521  }
522 
523  std::cout << "Created " << NodeList::GetNNodes () << " nodes." << std::endl;
524  TIMER_TYPE routingStart;
525  TIMER_NOW (routingStart);
526 
527  if (nix)
528  {
529  // Calculate routing tables
530  std::cout << "Using Nix-vectors..." << std::endl;
531  }
532  else
533  {
534  // Calculate routing tables
535  std::cout << "Populating Global Static Routing Tables..." << std::endl;
537  }
538 
539  TIMER_TYPE routingEnd;
540  TIMER_NOW (routingEnd);
541  std::cout << "Routing tables population took "
542  << TIMER_DIFF (routingEnd, routingStart) << std::endl;
543 
545  std::cout << "Running simulator..." << std::endl;
546  TIMER_NOW (t1);
547  Simulator::Stop (Seconds (100.0));
548  Simulator::Run ();
549  TIMER_NOW (t2);
550  std::cout << "Simulator finished." << std::endl;
552 
553  double d1 = TIMER_DIFF (t1, t0), d2 = TIMER_DIFF (t2, t1);
554  std::cout << "-----" << std::endl << "Runtime Stats:" << std::endl;
555  std::cout << "Simulator init time: " << d1 << std::endl;
556  std::cout << "Simulator run time: " << d2 << std::endl;
557  std::cout << "Total elapsed time: " << d1+d2 << std::endl;
558 
559  delete[] nodes_netLR;
560  return 0;
561 }
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<Ipv4> 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
maximum number of rows
Definition: nms-p2p-nix.cc:147
NetDeviceContainer Install(NodeContainer c)
Array2D(const size_t x, const size_t y)
Constructor.
Definition: nms-p2p-nix.cc:76
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:226
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
const size_t m_xMax
maximum number of rows
Definition: nms-p2p-nix.cc:102
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...
cmd
Definition: second.py:35
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
stack
Definition: first.py:34
a polymophic address class
Definition: address.h:90
T ** p
Stored elements.
Definition: nms-p2p-nix.cc:101
Array3D(const size_t x, const size_t y, const size_t z)
Constructor.
Definition: nms-p2p-nix.cc:119
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
Definition: simulator.h:1381
Hold an unsigned integer type.
Definition: uinteger.h:44
Array2D< T > ** p
Stored elements.
Definition: nms-p2p-nix.cc:146
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:213
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:190
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
address
Definition: first.py:37
double GetValue(double min, double max)
Get the next random value, as a double in the specified range .
static EventId ScheduleNow(MEM mem_ptr, OBJ obj)
Schedule an event to expire Now.
Definition: simulator.h:1570
2D array used in nix-vector-routing example "nms-p2p-nix.cc"
Definition: nms-p2p-nix.cc:68
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
3D array used in nix-vector-routing example "nms-p2p-nix.cc"
Definition: nms-p2p-nix.cc:110
AttributeValue implementation for Address.
Definition: address.h:278
struct timeval TIMER_TYPE
void Add(NodeContainer other)
Append the contents of another NodeContainer to the end of this container.
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:234
#define TIMER_NOW(_t)
Definition: nms-p2p-nix.cc:52
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1014
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:782
~Array3D(void)
Definition: nms-p2p-nix.cc:125
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.
~Array2D(void)
Definition: nms-p2p-nix.cc:83