View | Details | Raw Unified | Return to bug 929
Collapse All | Expand All

(-)a/examples/routing/nms-p2p-nix.cc (-10 / +144 lines)
 Lines 71-84    Link Here 
71
71
72
  cout << "Number of CNs: " << nCN << ", LAN nodes: " << nLANClients << endl;
72
  cout << "Number of CNs: " << nCN << ", LAN nodes: " << nLANClients << endl;
73
73
74
  NodeContainer nodes_net0[nCN][3], nodes_net1[nCN][6], nodes_netLR[nCN],
74
  NodeContainer** nodes_net0 = new NodeContainer*[nCN]; //[nCN][3]
75
                nodes_net2[nCN][14], nodes_net2LAN[nCN][7][nLANClients],
75
  for (int i = 0; i < nCN; i++)
76
                nodes_net3[nCN][9], nodes_net3LAN[nCN][5][nLANClients];
76
    nodes_net0[i] = new NodeContainer[3];
77
  NodeContainer** nodes_net1 = new NodeContainer*[nCN]; //[nCN][6]
78
  for (int i = 0; i < nCN; i++)
79
    nodes_net1[i] = new NodeContainer[6];
80
  NodeContainer* nodes_netLR = new NodeContainer[nCN]; //[nCN]
81
  NodeContainer** nodes_net2 = new NodeContainer*[nCN]; //[nCN][14]
82
  for (int i = 0; i < nCN; i++)
83
    nodes_net2[i] = new NodeContainer[14];
84
  NodeContainer*** nodes_net2LAN = new NodeContainer**[nCN]; //[nCN][7][nLANClients]
85
  for (int i = 0; i < nCN; i++)
86
    {
87
      nodes_net2LAN[i] = new NodeContainer*[7];
88
      for (int j = 0; j < 7; j++)
89
        nodes_net2LAN[i][j] = new NodeContainer[nLANClients];
90
    }
91
  NodeContainer** nodes_net3 = new NodeContainer*[nCN]; //[nCN][9]
92
  for (int i = 0; i < nCN; i++)
93
    nodes_net3[i] = new NodeContainer[9];
94
  NodeContainer*** nodes_net3LAN = new NodeContainer**[nCN]; //[nCN][5][nLANClients]
95
  for (int i = 0; i < nCN; i++)
96
    {
97
      nodes_net3LAN[i] = new NodeContainer*[5];
98
      for (int j = 0; j < 5; j++)
99
        nodes_net3LAN[i][j] = new NodeContainer[nLANClients];
100
    }
77
  PointToPointHelper p2p_2gb200ms, p2p_1gb5ms, p2p_100mb1ms;
101
  PointToPointHelper p2p_2gb200ms, p2p_1gb5ms, p2p_100mb1ms;
78
  InternetStackHelper stack;
102
  InternetStackHelper stack;
79
  Ipv4InterfaceContainer ifs, ifs0[nCN][3], ifs1[nCN][6], ifs2[nCN][14],
103
  Ipv4InterfaceContainer ifs;
80
                         ifs3[nCN][9], ifs2LAN[nCN][7][nLANClients],
104
  Ipv4InterfaceContainer** ifs0 = new Ipv4InterfaceContainer*[nCN]; //[nCN][3]
81
                         ifs3LAN[nCN][5][nLANClients];
105
  for (int i = 0; i < nCN; i++)
106
    ifs0[i] = new Ipv4InterfaceContainer[3];
107
  Ipv4InterfaceContainer** ifs1 = new Ipv4InterfaceContainer*[nCN]; //[nCN][6]
108
  for (int i = 0; i < nCN; i++)
109
    ifs1[i] = new Ipv4InterfaceContainer[6];
110
  Ipv4InterfaceContainer** ifs2 = new Ipv4InterfaceContainer*[nCN]; //[nCN][[14]
111
  for (int i = 0; i < nCN; i++)
112
    ifs2[i] = new Ipv4InterfaceContainer[14];
113
  Ipv4InterfaceContainer** ifs3 = new Ipv4InterfaceContainer*[nCN]; //[nCN][9]
114
  for (int i = 0; i < nCN; i++)
115
    ifs3[i] = new Ipv4InterfaceContainer[9];
116
  Ipv4InterfaceContainer*** ifs2LAN = new Ipv4InterfaceContainer**[nCN]; //[nCN][7][nLANClients]
117
  for (int i = 0; i < nCN; i++)
118
    {
119
      ifs2LAN[i] = new Ipv4InterfaceContainer*[7];
120
      for (int j = 0; j < 7; j++)
121
        ifs2LAN[i][j] = new Ipv4InterfaceContainer[nLANClients];
122
    }
123
  Ipv4InterfaceContainer*** ifs3LAN = new Ipv4InterfaceContainer**[nCN]; //[nCN][5][nLANClients]
124
  for (int i = 0; i < nCN; i++)
125
    {
126
      ifs3LAN[i] = new Ipv4InterfaceContainer*[5];
127
      for (int j = 0; j < 5; j++)
128
        ifs3LAN[i][j] = new Ipv4InterfaceContainer[nLANClients];
129
    }
130
82
  Ipv4AddressHelper address;
131
  Ipv4AddressHelper address;
83
  std::ostringstream oss;
132
  std::ostringstream oss;
84
  p2p_1gb5ms.SetDeviceAttribute ("DataRate", StringValue ("1Gbps"));
133
  p2p_1gb5ms.SetDeviceAttribute ("DataRate", StringValue ("1Gbps"));
 Lines 177-183    Link Here 
177
        {
226
        {
178
          ndc2[i] = p2p_1gb5ms.Install (nodes_net2[z][i]);
227
          ndc2[i] = p2p_1gb5ms.Install (nodes_net2[z][i]);
179
        }
228
        }
180
      NetDeviceContainer ndc2LAN[7][nLANClients];
229
///      NetDeviceContainer ndc2LAN[7][nLANClients];
230
      NetDeviceContainer** ndc2LAN = new NetDeviceContainer*[7];
231
      for (int i = 0; i < 7; i++)
232
        ndc2LAN[i] = new NetDeviceContainer[nLANClients];
233
181
      for (int i = 0; i < 7; ++i) 
234
      for (int i = 0; i < 7; ++i) 
182
        {
235
        {
183
          oss.str ("");
236
          oss.str ("");
 Lines 213-219    Link Here 
213
        {
266
        {
214
          ndc3[i] = p2p_1gb5ms.Install (nodes_net3[z][i]);
267
          ndc3[i] = p2p_1gb5ms.Install (nodes_net3[z][i]);
215
        }
268
        }
216
      NetDeviceContainer ndc3LAN[5][nLANClients];
269
///      NetDeviceContainer ndc3LAN[5][nLANClients];
270
      NetDeviceContainer** ndc3LAN = new NetDeviceContainer*[5];
271
      for (int i = 0; i < 5; i++)
272
        ndc3LAN[i] = new NetDeviceContainer[nLANClients];
273
217
      for (int i = 0; i < 5; ++i) 
274
      for (int i = 0; i < 5; ++i) 
218
        {
275
        {
219
          oss.str ("");
276
          oss.str ("");
 Lines 317-328    Link Here 
317
          address.SetBase (oss.str ().c_str (), "255.255.255.0");
374
          address.SetBase (oss.str ().c_str (), "255.255.255.0");
318
          ifs3[z][i] = address.Assign (ndc3[i]);
375
          ifs3[z][i] = address.Assign (ndc3[i]);
319
        }
376
        }
377
378
      for (int i = 0; i < 5; i++)
379
        delete[] ndc3LAN[i];
380
      delete[] ndc3LAN;
381
382
      for (int i = 0; i < 7; i++)
383
        delete[] ndc2LAN[i];
384
      delete[] ndc2LAN;
320
    }
385
    }
321
    // Create Ring Links
386
    // Create Ring Links
322
  if (nCN > 1) 
387
  if (nCN > 1) 
323
    {
388
    {
324
      cout << "Forming Ring Topology..." << endl;
389
      cout << "Forming Ring Topology..." << endl;
325
      NodeContainer nodes_ring[nCN];
390
      NodeContainer* const nodes_ring = new NodeContainer[nCN];
326
      for (int z = 0; z < nCN-1; ++z) 
391
      for (int z = 0; z < nCN-1; ++z) 
327
        {
392
        {
328
          nodes_ring[z].Add (nodes_net0[z][0].Get (0));
393
          nodes_ring[z].Add (nodes_net0[z][0].Get (0));
 Lines 330-336    Link Here 
330
        }
395
        }
331
      nodes_ring[nCN-1].Add (nodes_net0[nCN-1][0].Get (0));
396
      nodes_ring[nCN-1].Add (nodes_net0[nCN-1][0].Get (0));
332
      nodes_ring[nCN-1].Add (nodes_net0[0][0].Get (0));
397
      nodes_ring[nCN-1].Add (nodes_net0[0][0].Get (0));
333
      NetDeviceContainer ndc_ring[nCN];
398
      NetDeviceContainer* const ndc_ring = new NetDeviceContainer[nCN];
334
      for (int z = 0; z < nCN; ++z) 
399
      for (int z = 0; z < nCN; ++z) 
335
        {
400
        {
336
          ndc_ring[z] = p2p_2gb200ms.Install (nodes_ring[z]);
401
          ndc_ring[z] = p2p_2gb200ms.Install (nodes_ring[z]);
 Lines 339-344    Link Here 
339
          address.SetBase (oss.str ().c_str (), "255.255.255.0");
404
          address.SetBase (oss.str ().c_str (), "255.255.255.0");
340
          ifs = address.Assign (ndc_ring[z]);
405
          ifs = address.Assign (ndc_ring[z]);
341
        }
406
        }
407
      delete[] ndc_ring;
408
      delete[] nodes_ring;
342
    }
409
    }
343
410
344
  // Create Traffic Flows
411
  // Create Traffic Flows
 Lines 445-449    Link Here 
445
  cout << "Simulator init time: " << d1 << endl;
512
  cout << "Simulator init time: " << d1 << endl;
446
  cout << "Simulator run time: " << d2 << endl;
513
  cout << "Simulator run time: " << d2 << endl;
447
  cout << "Total elapsed time: " << d1+d2 << endl;
514
  cout << "Total elapsed time: " << d1+d2 << endl;
515
516
  for (int i = 0; i < nCN; i++)
517
    {
518
      for (int j = 0; j < 5; j++)
519
        delete[] ifs3LAN[i][j];
520
      delete[] ifs3LAN[i];
521
    }
522
  delete[] ifs3LAN;
523
524
  for (int i = 0; i < nCN; i++)
525
    {
526
      for (int j = 0; j < 7; j++)
527
        delete[] ifs2LAN[i][j];
528
      delete[] ifs2LAN[i];
529
    }
530
  delete[] ifs2LAN;
531
532
  for (int i = 0; i < nCN; i++)
533
    delete[] ifs3[i];
534
  delete[] ifs3;
535
536
  for (int i = 0; i < nCN; i++)
537
    delete[] ifs2[i];
538
  delete[] ifs2;
539
540
  for (int i = 0; i < nCN; i++)
541
    delete[] ifs1[i];
542
  delete[] ifs1;
543
544
  for (int i = 0; i < nCN; i++)
545
    delete[] ifs0[i];
546
  delete[] ifs0;
547
548
  for (int i = 0; i < nCN; i++)
549
    {
550
      for (int j = 0; j < 5; j++)
551
        delete[] nodes_net3LAN[i][j];
552
      delete[] nodes_net3LAN[i];
553
    }
554
  delete[] nodes_net3LAN;
555
556
  for (int i = 0; i < nCN; i++)
557
    delete[] nodes_net3[i];
558
  delete[] nodes_net3;
559
560
  for (int i = 0; i < nCN; i++)
561
    {
562
      for (int j = 0; j < 7; j++)
563
        delete[] nodes_net2LAN[i][j];
564
      delete[] nodes_net2LAN[i];
565
    }
566
  delete[] nodes_net2LAN;
567
568
  for (int i = 0; i < nCN; i++)
569
    delete[] nodes_net2[i];
570
  delete[] nodes_net2;
571
572
  delete[] nodes_netLR;
573
574
  for (int i = 0; i < nCN; i++)
575
    delete[] nodes_net1[i];
576
  delete[] nodes_net1;
577
578
  for (int i = 0; i < nCN; i++)
579
    delete[] nodes_net0[i];
580
  delete[] nodes_net0;
581
448
  return 0;
582
  return 0;
449
}
583
}

Return to bug 929