author | Mitch Watrous |
Mon, 20 Aug 2012 14:25:35 -0700 | |
changeset 8996 | d0e0a162a990 |
parent 7415 | a26626a4f5bf |
child 8997 | 9222fc5291ca |
permissions | -rw-r--r-- |
6841
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
2 |
/* |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
3 |
* This program is free software; you can redistribute it and/or modify |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
4 |
* it under the terms of the GNU General Public License version 2 as |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
5 |
* published by the Free Software Foundation; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
6 |
* |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
7 |
* This program is distributed in the hope that it will be useful, |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
8 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
9 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
10 |
* GNU General Public License for more details. |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
11 |
* |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
12 |
* You should have received a copy of the GNU General Public License |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
13 |
* along with this program; if not, write to the Free Software |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
14 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
15 |
* |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
16 |
* (c) 2009, GTech Systems, Inc. - Alfred Park <park@gtech-systems.com> |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
17 |
* |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
18 |
* DARPA NMS Campus Network Model |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
19 |
* |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
20 |
* This topology replicates the original NMS Campus Network model |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
21 |
* with the exception of chord links (which were never utilized in the |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
22 |
* original model) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
23 |
* Link Bandwidths and Delays may not be the same as the original |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
24 |
* specifications |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
25 |
* |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
26 |
* The fundamental unit of the NMS model consists of a campus network. The |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
27 |
* campus network topology can been seen here: |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
28 |
* http://www.nsnam.org/~jpelkey3/nms.png |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
29 |
* The number of hosts (default 42) is variable. Finally, an arbitrary |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
30 |
* number of these campus networks can be connected together (default 2) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
31 |
* to make very large simulations. |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
32 |
*/ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
33 |
|
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
34 |
// for timing functions |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
35 |
#include <cstdlib> |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
36 |
#include <sys/time.h> |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
37 |
#include <fstream> |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
38 |
|
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
39 |
#include "ns3/core-module.h" |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
40 |
#include "ns3/internet-module.h" |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
41 |
#include "ns3/network-module.h" |
6848
1f453ad50ef3
Converts csma, emu, tap-bridge, point-to-point, wifi and wimax modules into modular format
Lalith Suresh <suresh.lalith@gmail.com>
parents:
6847
diff
changeset
|
42 |
#include "ns3/point-to-point-module.h" |
6847
138f00c56381
Move applications to a single module
Mitch Watrous <watrous@u.washington.edu>
parents:
6841
diff
changeset
|
43 |
#include "ns3/applications-module.h" |
6841
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
44 |
#include "ns3/onoff-application.h" |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
45 |
#include "ns3/packet-sink.h" |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
46 |
#include "ns3/simulator.h" |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
47 |
#include "ns3/ipv4-static-routing-helper.h" |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
48 |
#include "ns3/ipv4-list-routing-helper.h" |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
49 |
#include "ns3/ipv4-nix-vector-helper.h" |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
50 |
|
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
51 |
using namespace std; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
52 |
using namespace ns3; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
53 |
|
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
54 |
typedef struct timeval TIMER_TYPE; |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7183
diff
changeset
|
55 |
#define TIMER_NOW(_t) gettimeofday (&_t,NULL); |
6841
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
56 |
#define TIMER_SECONDS(_t) ((double)(_t).tv_sec + (_t).tv_usec*1e-6) |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7183
diff
changeset
|
57 |
#define TIMER_DIFF(_t1, _t2) (TIMER_SECONDS (_t1)-TIMER_SECONDS (_t2)) |
6841
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
58 |
|
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
59 |
NS_LOG_COMPONENT_DEFINE ("CampusNetworkModel"); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
60 |
|
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
61 |
void Progress () |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
62 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
63 |
Simulator::Schedule (Seconds (0.1), Progress); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
64 |
} |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
65 |
|
7415
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
66 |
template <typename T> |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
67 |
class Array2D |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
68 |
{ |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
69 |
public: |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
70 |
Array2D (const size_t x, const size_t y) : p (new T*[x]), m_xMax (x) |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
71 |
{ |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
72 |
for (size_t i = 0; i < m_xMax; i++) |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
73 |
p[i] = new T[y]; |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
74 |
} |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
75 |
|
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
76 |
~Array2D (void) |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
77 |
{ |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
78 |
for (size_t i = 0; i < m_xMax; i++) |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
79 |
delete[] p[i]; |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
80 |
delete p; |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
81 |
p = 0; |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
82 |
} |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
83 |
|
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
84 |
T* operator[] (const size_t i) |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
85 |
{ |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
86 |
return p[i]; |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
87 |
} |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
88 |
private: |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
89 |
T** p; |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
90 |
const size_t m_xMax; |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
91 |
}; |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
92 |
|
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
93 |
template <typename T> |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
94 |
class Array3D |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
95 |
{ |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
96 |
public: |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
97 |
Array3D (const size_t x, const size_t y, const size_t z) |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
98 |
: p (new Array2D<T>*[x]), m_xMax (x) |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
99 |
{ |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
100 |
for (size_t i = 0; i < m_xMax; i++) |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
101 |
p[i] = new Array2D<T> (y, z); |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
102 |
} |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
103 |
|
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
104 |
~Array3D (void) |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
105 |
{ |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
106 |
for (size_t i = 0; i < m_xMax; i++) |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
107 |
{ |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
108 |
delete p[i]; |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
109 |
p[i] = 0; |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
110 |
} |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
111 |
delete[] p; |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
112 |
p = 0; |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
113 |
} |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
114 |
|
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
115 |
Array2D<T>& operator[] (const size_t i) |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
116 |
{ |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
117 |
return *(p[i]); |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
118 |
} |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
119 |
private: |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
120 |
Array2D<T>** p; |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
121 |
const size_t m_xMax; |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
122 |
}; |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
123 |
|
6841
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
124 |
int |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
125 |
main (int argc, char *argv[]) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
126 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
127 |
TIMER_TYPE t0, t1, t2; |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7183
diff
changeset
|
128 |
TIMER_NOW (t0); |
6841
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
129 |
cout << " ==== DARPA NMS CAMPUS NETWORK SIMULATION ====" << endl; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
130 |
LogComponentEnable ("OnOffApplication", LOG_LEVEL_INFO); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
131 |
|
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
132 |
int nCN = 2, nLANClients = 42; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
133 |
bool nix = true; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
134 |
|
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
135 |
CommandLine cmd; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
136 |
cmd.AddValue ("CN", "Number of total CNs [2]", nCN); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
137 |
cmd.AddValue ("LAN", "Number of nodes per LAN [42]", nLANClients); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
138 |
cmd.AddValue ("NIX", "Toggle nix-vector routing", nix); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
139 |
cmd.Parse (argc,argv); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
140 |
|
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
141 |
if (nCN < 2) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
142 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
143 |
cout << "Number of total CNs (" << nCN << ") lower than minimum of 2" |
7183
13fae068d099
nix-vector coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7157
diff
changeset
|
144 |
<< endl; |
6841
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
145 |
return 1; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
146 |
} |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
147 |
|
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
148 |
cout << "Number of CNs: " << nCN << ", LAN nodes: " << nLANClients << endl; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
149 |
|
7415
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
150 |
Array2D<NodeContainer> nodes_net0(nCN, 3); |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
151 |
Array2D<NodeContainer> nodes_net1(nCN, 6); |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
152 |
NodeContainer* nodes_netLR = new NodeContainer[nCN]; |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
153 |
Array2D<NodeContainer> nodes_net2(nCN, 14); |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
154 |
Array3D<NodeContainer> nodes_net2LAN(nCN, 7, nLANClients); |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
155 |
Array2D<NodeContainer> nodes_net3(nCN, 9); |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
156 |
Array3D<NodeContainer> nodes_net3LAN(nCN, 5, nLANClients); |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
157 |
|
6841
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
158 |
PointToPointHelper p2p_2gb200ms, p2p_1gb5ms, p2p_100mb1ms; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
159 |
InternetStackHelper stack; |
7415
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
160 |
Ipv4InterfaceContainer ifs; |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
161 |
Array2D<Ipv4InterfaceContainer> ifs0(nCN, 3); |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
162 |
Array2D<Ipv4InterfaceContainer> ifs1(nCN, 6); |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
163 |
Array2D<Ipv4InterfaceContainer> ifs2(nCN, 14); |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
164 |
Array2D<Ipv4InterfaceContainer> ifs3(nCN, 9); |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
165 |
Array3D<Ipv4InterfaceContainer> ifs2LAN(nCN, 7, nLANClients); |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
166 |
Array3D<Ipv4InterfaceContainer> ifs3LAN(nCN, 5, nLANClients); |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
167 |
|
6841
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
168 |
Ipv4AddressHelper address; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
169 |
std::ostringstream oss; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
170 |
p2p_1gb5ms.SetDeviceAttribute ("DataRate", StringValue ("1Gbps")); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
171 |
p2p_1gb5ms.SetChannelAttribute ("Delay", StringValue ("5ms")); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
172 |
p2p_2gb200ms.SetDeviceAttribute ("DataRate", StringValue ("2Gbps")); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
173 |
p2p_2gb200ms.SetChannelAttribute ("Delay", StringValue ("200ms")); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
174 |
p2p_100mb1ms.SetDeviceAttribute ("DataRate", StringValue ("100Mbps")); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
175 |
p2p_100mb1ms.SetChannelAttribute ("Delay", StringValue ("1ms")); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
176 |
|
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
177 |
// Setup NixVector Routing |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
178 |
Ipv4NixVectorHelper nixRouting; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
179 |
Ipv4StaticRoutingHelper staticRouting; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
180 |
|
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
181 |
Ipv4ListRoutingHelper list; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
182 |
list.Add (staticRouting, 0); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
183 |
list.Add (nixRouting, 10); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
184 |
|
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
185 |
if (nix) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
186 |
{ |
7157
43d2fb5bfb12
bug 1058: InternetStackHelper pitfall: calling Install before adding routing protocols
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7061
diff
changeset
|
187 |
stack.SetRoutingHelper (list); // has effect on the next Install () |
6841
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
188 |
} |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
189 |
|
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
190 |
// Create Campus Networks |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
191 |
for (int z = 0; z < nCN; ++z) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
192 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
193 |
cout << "Creating Campus Network " << z << ":" << endl; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
194 |
// Create Net0 |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
195 |
cout << " SubNet [ 0"; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
196 |
for (int i = 0; i < 3; ++i) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
197 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
198 |
nodes_net0[z][i].Create (1); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
199 |
stack.Install (nodes_net0[z][i]); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
200 |
} |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
201 |
nodes_net0[z][0].Add (nodes_net0[z][1].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
202 |
nodes_net0[z][1].Add (nodes_net0[z][2].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
203 |
nodes_net0[z][2].Add (nodes_net0[z][0].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
204 |
NetDeviceContainer ndc0[3]; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
205 |
for (int i = 0; i < 3; ++i) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
206 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
207 |
ndc0[i] = p2p_1gb5ms.Install (nodes_net0[z][i]); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
208 |
} |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
209 |
// Create Net1 |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
210 |
cout << " 1"; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
211 |
for (int i = 0; i < 6; ++i) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
212 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
213 |
nodes_net1[z][i].Create (1); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
214 |
stack.Install (nodes_net1[z][i]); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
215 |
} |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
216 |
nodes_net1[z][0].Add (nodes_net1[z][1].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
217 |
nodes_net1[z][2].Add (nodes_net1[z][0].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
218 |
nodes_net1[z][3].Add (nodes_net1[z][0].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
219 |
nodes_net1[z][4].Add (nodes_net1[z][1].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
220 |
nodes_net1[z][5].Add (nodes_net1[z][1].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
221 |
NetDeviceContainer ndc1[6]; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
222 |
for (int i = 0; i < 6; ++i) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
223 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
224 |
if (i == 1) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
225 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
226 |
continue; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
227 |
} |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
228 |
ndc1[i] = p2p_1gb5ms.Install (nodes_net1[z][i]); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
229 |
} |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
230 |
// Connect Net0 <-> Net1 |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
231 |
NodeContainer net0_1; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
232 |
net0_1.Add (nodes_net0[z][2].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
233 |
net0_1.Add (nodes_net1[z][0].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
234 |
NetDeviceContainer ndc0_1; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
235 |
ndc0_1 = p2p_1gb5ms.Install (net0_1); |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7183
diff
changeset
|
236 |
oss.str (""); |
6841
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
237 |
oss << 10 + z << ".1.252.0"; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
238 |
address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
239 |
ifs = address.Assign (ndc0_1); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
240 |
// Create Net2 |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
241 |
cout << " 2"; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
242 |
for (int i = 0; i < 14; ++i) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
243 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
244 |
nodes_net2[z][i].Create (1); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
245 |
stack.Install (nodes_net2[z][i]); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
246 |
} |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
247 |
nodes_net2[z][0].Add (nodes_net2[z][1].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
248 |
nodes_net2[z][2].Add (nodes_net2[z][0].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
249 |
nodes_net2[z][1].Add (nodes_net2[z][3].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
250 |
nodes_net2[z][3].Add (nodes_net2[z][2].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
251 |
nodes_net2[z][4].Add (nodes_net2[z][2].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
252 |
nodes_net2[z][5].Add (nodes_net2[z][3].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
253 |
nodes_net2[z][6].Add (nodes_net2[z][5].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
254 |
nodes_net2[z][7].Add (nodes_net2[z][2].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
255 |
nodes_net2[z][8].Add (nodes_net2[z][3].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
256 |
nodes_net2[z][9].Add (nodes_net2[z][4].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
257 |
nodes_net2[z][10].Add (nodes_net2[z][5].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
258 |
nodes_net2[z][11].Add (nodes_net2[z][6].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
259 |
nodes_net2[z][12].Add (nodes_net2[z][6].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
260 |
nodes_net2[z][13].Add (nodes_net2[z][6].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
261 |
NetDeviceContainer ndc2[14]; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
262 |
for (int i = 0; i < 14; ++i) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
263 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
264 |
ndc2[i] = p2p_1gb5ms.Install (nodes_net2[z][i]); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
265 |
} |
7415
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
266 |
/// NetDeviceContainer ndc2LAN[7][nLANClients]; |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
267 |
Array2D<NetDeviceContainer> ndc2LAN(7, nLANClients); |
6841
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
268 |
for (int i = 0; i < 7; ++i) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
269 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
270 |
oss.str (""); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
271 |
oss << 10 + z << ".4." << 15 + i << ".0"; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
272 |
address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
273 |
for (int j = 0; j < nLANClients; ++j) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
274 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
275 |
nodes_net2LAN[z][i][j].Create (1); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
276 |
stack.Install (nodes_net2LAN[z][i][j]); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
277 |
nodes_net2LAN[z][i][j].Add (nodes_net2[z][i+7].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
278 |
ndc2LAN[i][j] = p2p_100mb1ms.Install (nodes_net2LAN[z][i][j]); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
279 |
ifs2LAN[z][i][j] = address.Assign (ndc2LAN[i][j]); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
280 |
} |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
281 |
} |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
282 |
// Create Net3 |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
283 |
cout << " 3 ]" << endl; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
284 |
for (int i = 0; i < 9; ++i) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
285 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
286 |
nodes_net3[z][i].Create (1); |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7183
diff
changeset
|
287 |
stack.Install (nodes_net3[z][i]); |
6841
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
288 |
} |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
289 |
nodes_net3[z][0].Add (nodes_net3[z][1].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
290 |
nodes_net3[z][1].Add (nodes_net3[z][2].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
291 |
nodes_net3[z][2].Add (nodes_net3[z][3].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
292 |
nodes_net3[z][3].Add (nodes_net3[z][1].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
293 |
nodes_net3[z][4].Add (nodes_net3[z][0].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
294 |
nodes_net3[z][5].Add (nodes_net3[z][0].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
295 |
nodes_net3[z][6].Add (nodes_net3[z][2].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
296 |
nodes_net3[z][7].Add (nodes_net3[z][3].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
297 |
nodes_net3[z][8].Add (nodes_net3[z][3].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
298 |
NetDeviceContainer ndc3[9]; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
299 |
for (int i = 0; i < 9; ++i) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
300 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
301 |
ndc3[i] = p2p_1gb5ms.Install (nodes_net3[z][i]); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
302 |
} |
7415
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
303 |
/// NetDeviceContainer ndc3LAN[5][nLANClients]; |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
304 |
Array2D<NetDeviceContainer> ndc3LAN(5, nLANClients); |
6841
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
305 |
for (int i = 0; i < 5; ++i) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
306 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
307 |
oss.str (""); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
308 |
oss << 10 + z << ".5." << 10 + i << ".0"; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
309 |
address.SetBase (oss.str ().c_str (), "255.255.255.255"); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
310 |
for (int j = 0; j < nLANClients; ++j) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
311 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
312 |
nodes_net3LAN[z][i][j].Create (1); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
313 |
stack.Install (nodes_net3LAN[z][i][j]); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
314 |
nodes_net3LAN[z][i][j].Add (nodes_net3[z][i+4].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
315 |
ndc3LAN[i][j] = p2p_100mb1ms.Install (nodes_net3LAN[z][i][j]); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
316 |
ifs3LAN[z][i][j] = address.Assign (ndc3LAN[i][j]); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
317 |
} |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
318 |
} |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
319 |
cout << " Connecting Subnets..." << endl; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
320 |
// Create Lone Routers (Node 4 & 5) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
321 |
nodes_netLR[z].Create (2); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
322 |
stack.Install (nodes_netLR[z]); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
323 |
NetDeviceContainer ndcLR; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
324 |
ndcLR = p2p_1gb5ms.Install (nodes_netLR[z]); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
325 |
// Connect Net2/Net3 through Lone Routers to Net0 |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
326 |
NodeContainer net0_4, net0_5, net2_4a, net2_4b, net3_5a, net3_5b; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
327 |
net0_4.Add (nodes_netLR[z].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
328 |
net0_4.Add (nodes_net0[z][0].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
329 |
net0_5.Add (nodes_netLR[z].Get (1)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
330 |
net0_5.Add (nodes_net0[z][1].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
331 |
net2_4a.Add (nodes_netLR[z].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
332 |
net2_4a.Add (nodes_net2[z][0].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
333 |
net2_4b.Add (nodes_netLR[z].Get (1)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
334 |
net2_4b.Add (nodes_net2[z][1].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
335 |
net3_5a.Add (nodes_netLR[z].Get (1)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
336 |
net3_5a.Add (nodes_net3[z][0].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
337 |
net3_5b.Add (nodes_netLR[z].Get (1)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
338 |
net3_5b.Add (nodes_net3[z][1].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
339 |
NetDeviceContainer ndc0_4, ndc0_5, ndc2_4a, ndc2_4b, ndc3_5a, ndc3_5b; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
340 |
ndc0_4 = p2p_1gb5ms.Install (net0_4); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
341 |
oss.str (""); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
342 |
oss << 10 + z << ".1.253.0"; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
343 |
address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
344 |
ifs = address.Assign (ndc0_4); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
345 |
ndc0_5 = p2p_1gb5ms.Install (net0_5); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
346 |
oss.str (""); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
347 |
oss << 10 + z << ".1.254.0"; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
348 |
address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
349 |
ifs = address.Assign (ndc0_5); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
350 |
ndc2_4a = p2p_1gb5ms.Install (net2_4a); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
351 |
oss.str (""); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
352 |
oss << 10 + z << ".4.253.0"; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
353 |
address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
354 |
ifs = address.Assign (ndc2_4a); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
355 |
ndc2_4b = p2p_1gb5ms.Install (net2_4b); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
356 |
oss.str (""); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
357 |
oss << 10 + z << ".4.254.0"; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
358 |
address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
359 |
ifs = address.Assign (ndc2_4b); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
360 |
ndc3_5a = p2p_1gb5ms.Install (net3_5a); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
361 |
oss.str (""); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
362 |
oss << 10 + z << ".5.253.0"; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
363 |
address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
364 |
ifs = address.Assign (ndc3_5a); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
365 |
ndc3_5b = p2p_1gb5ms.Install (net3_5b); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
366 |
oss.str (""); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
367 |
oss << 10 + z << ".5.254.0"; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
368 |
address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
369 |
ifs = address.Assign (ndc3_5b); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
370 |
// Assign IP addresses |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
371 |
cout << " Assigning IP addresses..." << endl; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
372 |
for (int i = 0; i < 3; ++i) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
373 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
374 |
oss.str (""); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
375 |
oss << 10 + z << ".1." << 1 + i << ".0"; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
376 |
address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
377 |
ifs0[z][i] = address.Assign (ndc0[i]); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
378 |
} |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
379 |
for (int i = 0; i < 6; ++i) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
380 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
381 |
if (i == 1) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
382 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
383 |
continue; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
384 |
} |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
385 |
oss.str (""); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
386 |
oss << 10 + z << ".2." << 1 + i << ".0"; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
387 |
address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
388 |
ifs1[z][i] = address.Assign (ndc1[i]); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
389 |
} |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
390 |
oss.str (""); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
391 |
oss << 10 + z << ".3.1.0"; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
392 |
address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
393 |
ifs = address.Assign (ndcLR); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
394 |
for (int i = 0; i < 14; ++i) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
395 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
396 |
oss.str (""); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
397 |
oss << 10 + z << ".4." << 1 + i << ".0"; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
398 |
address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
399 |
ifs2[z][i] = address.Assign (ndc2[i]); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
400 |
} |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
401 |
for (int i = 0; i < 9; ++i) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
402 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
403 |
oss.str (""); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
404 |
oss << 10 + z << ".5." << 1 + i << ".0"; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
405 |
address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
406 |
ifs3[z][i] = address.Assign (ndc3[i]); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
407 |
} |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
408 |
} |
7183
13fae068d099
nix-vector coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7157
diff
changeset
|
409 |
// Create Ring Links |
6841
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
410 |
if (nCN > 1) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
411 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
412 |
cout << "Forming Ring Topology..." << endl; |
7415
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
413 |
NodeContainer* nodes_ring = new NodeContainer[nCN]; |
6841
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
414 |
for (int z = 0; z < nCN-1; ++z) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
415 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
416 |
nodes_ring[z].Add (nodes_net0[z][0].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
417 |
nodes_ring[z].Add (nodes_net0[z+1][0].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
418 |
} |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
419 |
nodes_ring[nCN-1].Add (nodes_net0[nCN-1][0].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
420 |
nodes_ring[nCN-1].Add (nodes_net0[0][0].Get (0)); |
7415
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
421 |
NetDeviceContainer* ndc_ring = new NetDeviceContainer[nCN]; |
6841
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
422 |
for (int z = 0; z < nCN; ++z) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
423 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
424 |
ndc_ring[z] = p2p_2gb200ms.Install (nodes_ring[z]); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
425 |
oss.str (""); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
426 |
oss << "254.1." << z + 1 << ".0"; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
427 |
address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
428 |
ifs = address.Assign (ndc_ring[z]); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
429 |
} |
7415
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
430 |
delete[] ndc_ring; |
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
431 |
delete[] nodes_ring; |
6841
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
432 |
} |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
433 |
|
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
434 |
// Create Traffic Flows |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
435 |
cout << "Creating TCP Traffic Flows:" << endl; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
436 |
Config::SetDefault ("ns3::OnOffApplication::MaxBytes", UintegerValue (500000)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
437 |
Config::SetDefault ("ns3::OnOffApplication::OnTime", |
8996
d0e0a162a990
Replace various instances of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7415
diff
changeset
|
438 |
StringValue ("ns3::ConstantRandomVariable[Constant=1.0]")); |
6841
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
439 |
Config::SetDefault ("ns3::OnOffApplication::OffTime", |
8996
d0e0a162a990
Replace various instances of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7415
diff
changeset
|
440 |
StringValue ("ns3::ConstantRandomVariable[Constant=0.0]")); |
6841
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
441 |
Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (512)); |
7183
13fae068d099
nix-vector coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7157
diff
changeset
|
442 |
|
6841
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
443 |
UniformVariable urng; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
444 |
int r1; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
445 |
double r2; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
446 |
for (int z = 0; z < nCN; ++z) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
447 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
448 |
int x = z + 1; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
449 |
if (z == nCN - 1) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
450 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
451 |
x = 0; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
452 |
} |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
453 |
// Subnet 2 LANs |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
454 |
cout << " Campus Network " << z << " Flows [ Net2 "; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
455 |
for (int i = 0; i < 7; ++i) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
456 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
457 |
for (int j = 0; j < nLANClients; ++j) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
458 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
459 |
// Sinks |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
460 |
PacketSinkHelper sinkHelper ("ns3::TcpSocketFactory", |
7183
13fae068d099
nix-vector coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7157
diff
changeset
|
461 |
InetSocketAddress (Ipv4Address::GetAny (), 9999)); |
6841
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
462 |
ApplicationContainer sinkApp = sinkHelper.Install ( |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
463 |
nodes_net2LAN[z][i][j].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
464 |
sinkApp.Start (Seconds (0.0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
465 |
// Sources |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
466 |
r1 = 2 + (int)(4 * urng.GetValue ()); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
467 |
r2 = 10 * urng.GetValue (); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
468 |
OnOffHelper client ("ns3::TcpSocketFactory", Address ()); |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7183
diff
changeset
|
469 |
AddressValue remoteAddress (InetSocketAddress ( |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7183
diff
changeset
|
470 |
ifs2LAN[z][i][j].GetAddress (0), 9999)); |
7183
13fae068d099
nix-vector coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7157
diff
changeset
|
471 |
client.SetAttribute ("Remote", remoteAddress); |
13fae068d099
nix-vector coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7157
diff
changeset
|
472 |
ApplicationContainer clientApp; |
13fae068d099
nix-vector coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7157
diff
changeset
|
473 |
clientApp.Add (client.Install (nodes_net1[x][r1].Get (0))); |
13fae068d099
nix-vector coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7157
diff
changeset
|
474 |
clientApp.Start (Seconds (r2)); |
13fae068d099
nix-vector coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7157
diff
changeset
|
475 |
} |
6841
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
476 |
} |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
477 |
// Subnet 3 LANs |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
478 |
cout << "Net3 ]" << endl; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
479 |
for (int i = 0; i < 5; ++i) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
480 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
481 |
for (int j = 0; j < nLANClients; ++j) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
482 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
483 |
// Sinks |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
484 |
PacketSinkHelper sinkHelper ("ns3::TcpSocketFactory", |
7183
13fae068d099
nix-vector coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7157
diff
changeset
|
485 |
InetSocketAddress (Ipv4Address::GetAny (), 9999)); |
6841
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
486 |
ApplicationContainer sinkApp = sinkHelper.Install ( |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
487 |
nodes_net3LAN[z][i][j].Get (0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
488 |
sinkApp.Start (Seconds (0.0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
489 |
// Sources |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
490 |
r1 = 2 + (int)(4 * urng.GetValue ()); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
491 |
r2 = 10 * urng.GetValue (); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
492 |
OnOffHelper client ("ns3::TcpSocketFactory", Address ()); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
493 |
AddressValue remoteAddress (InetSocketAddress ( |
7183
13fae068d099
nix-vector coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7157
diff
changeset
|
494 |
ifs3LAN[z][i][j].GetAddress (0), 9999)); |
6841
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
495 |
client.SetAttribute ("Remote", remoteAddress); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
496 |
ApplicationContainer clientApp; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
497 |
clientApp.Add (client.Install (nodes_net1[x][r1].Get (0))); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
498 |
clientApp.Start (Seconds (r2)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
499 |
} |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
500 |
} |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
501 |
} |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
502 |
|
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
503 |
cout << "Created " << NodeList::GetNNodes () << " nodes." << endl; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
504 |
TIMER_TYPE routingStart; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
505 |
TIMER_NOW (routingStart); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
506 |
|
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
507 |
if (nix) |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
508 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
509 |
// Calculate routing tables |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
510 |
cout << "Using Nix-vectors..." << endl; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
511 |
} |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
512 |
else |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
513 |
{ |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
514 |
// Calculate routing tables |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
515 |
cout << "Populating Global Static Routing Tables..." << endl; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
516 |
Ipv4GlobalRoutingHelper::PopulateRoutingTables (); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
517 |
} |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
518 |
|
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
519 |
TIMER_TYPE routingEnd; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
520 |
TIMER_NOW (routingEnd); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
521 |
cout << "Routing tables population took " |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
522 |
<< TIMER_DIFF (routingEnd, routingStart) << endl; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
523 |
|
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
524 |
Simulator::ScheduleNow (Progress); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
525 |
cout << "Running simulator..." << endl; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
526 |
TIMER_NOW (t1); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
527 |
Simulator::Stop (Seconds (100.0)); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
528 |
Simulator::Run (); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
529 |
TIMER_NOW (t2); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
530 |
cout << "Simulator finished." << endl; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
531 |
Simulator::Destroy (); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
532 |
|
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
533 |
double d1 = TIMER_DIFF (t1, t0), d2 = TIMER_DIFF (t2, t1); |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
534 |
cout << "-----" << endl << "Runtime Stats:" << endl; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
535 |
cout << "Simulator init time: " << d1 << endl; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
536 |
cout << "Simulator run time: " << d2 << endl; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
537 |
cout << "Total elapsed time: " << d1+d2 << endl; |
7415
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
538 |
|
a26626a4f5bf
bug 929: nms-p2p-nix.cc uses variable length array
Quincy Tse <quincy.tse@gmail.com>
parents:
7256
diff
changeset
|
539 |
delete[] nodes_netLR; |
6841
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
540 |
return 0; |
174e599d1003
modularize nix and aodv, thanks lalith
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
541 |
} |