|
Lines 166-172
main (int argc, char *argv[])
|
Link Here
|
|---|
|
| 166 |
"Bounds", Rectangle (0, 1000, 0, 1000), |
166 |
"Bounds", Rectangle (0, 1000, 0, 1000), |
| 167 |
"Speed", ConstantVariable (2000), |
167 |
"Speed", ConstantVariable (2000), |
| 168 |
"Pause", ConstantVariable (0.2)); |
168 |
"Pause", ConstantVariable (0.2)); |
| 169 |
mobility.Layout (backbone); |
169 |
mobility.Install (backbone); |
| 170 |
|
170 |
|
| 171 |
/////////////////////////////////////////////////////////////////////////// |
171 |
/////////////////////////////////////////////////////////////////////////// |
| 172 |
// // |
172 |
// // |
|
Lines 178-194
main (int argc, char *argv[])
|
Link Here
|
|---|
|
| 178 |
// the "172.16 address space |
178 |
// the "172.16 address space |
| 179 |
ipAddrs.SetBase ("172.16.0.0", "255.255.255.0"); |
179 |
ipAddrs.SetBase ("172.16.0.0", "255.255.255.0"); |
| 180 |
|
180 |
|
|
|
181 |
|
| 181 |
for (uint32_t i = 0; i < backboneNodes; ++i) |
182 |
for (uint32_t i = 0; i < backboneNodes; ++i) |
| 182 |
{ |
183 |
{ |
| 183 |
NS_LOG_INFO ("Configuring local area network for backbone node " << i); |
184 |
NS_LOG_INFO ("Configuring local area network for backbone node " << i); |
| 184 |
// |
185 |
// |
| 185 |
// Create a container to manage the nodes of the LAN. Pick one of |
186 |
// Create a container to manage the nodes of the LAN. We need |
| 186 |
// the backbone nodes to be part of the LAN and first add it to |
187 |
// two containers here; one with all of the new nodes, and one |
| 187 |
// the container. Then create the rest of the nodes we'll need. |
188 |
// with all of the nodes including new and existing nodes |
| 188 |
// |
189 |
// |
| 189 |
NodeContainer lan; |
190 |
NodeContainer newLanNodes; |
| 190 |
lan.Add (backbone.Get (i)); |
191 |
newLanNodes.Create (lanNodes - 1); |
| 191 |
lan.Create (lanNodes - 1); |
192 |
// Now, create the container with all nodes on this link |
|
|
193 |
NodeContainer lan (backbone.Get (i), newLanNodes); |
| 192 |
// |
194 |
// |
| 193 |
// Create the CSMA net devices and install them into the nodes in our |
195 |
// Create the CSMA net devices and install them into the nodes in our |
| 194 |
// collection. |
196 |
// collection. |
|
Lines 198-206
main (int argc, char *argv[])
|
Link Here
|
|---|
|
| 198 |
csma.SetChannelParameter ("Delay", MilliSeconds (2)); |
200 |
csma.SetChannelParameter ("Delay", MilliSeconds (2)); |
| 199 |
NetDeviceContainer lanDevices = csma.Install (lan); |
201 |
NetDeviceContainer lanDevices = csma.Install (lan); |
| 200 |
// |
202 |
// |
| 201 |
// Add the IPv4 protocol stack to the nodes in our container |
203 |
// Add the IPv4 protocol stack to the new LAN nodes |
| 202 |
// |
204 |
// |
| 203 |
internet.Install (lan); |
205 |
internet.Install (newLanNodes); |
| 204 |
// |
206 |
// |
| 205 |
// Assign IPv4 addresses to the device drivers (actually to the |
207 |
// Assign IPv4 addresses to the device drivers (actually to the |
| 206 |
// associated IPv4 interfaces) we just created. |
208 |
// associated IPv4 interfaces) we just created. |
|
Lines 227-239
main (int argc, char *argv[])
|
Link Here
|
|---|
|
| 227 |
{ |
229 |
{ |
| 228 |
NS_LOG_INFO ("Configuring wireless network for backbone node " << i); |
230 |
NS_LOG_INFO ("Configuring wireless network for backbone node " << i); |
| 229 |
// |
231 |
// |
| 230 |
// Create a container to manage the nodes of the network. Pick one of |
232 |
// Create a container to manage the nodes of the LAN. We need |
| 231 |
// the backbone nodes to be part of the network and first add it to |
233 |
// two containers here; one with all of the new nodes, and one |
| 232 |
// the container. Then create the rest of the nodes we'll need. |
234 |
// with all of the nodes including new and existing nodes |
| 233 |
// |
235 |
// |
| 234 |
NodeContainer infra; |
236 |
NodeContainer newInfraNodes; |
| 235 |
infra.Add (backbone.Get (i)); |
237 |
newInfraNodes.Create (infraNodes - 1); |
| 236 |
infra.Create (infraNodes - 1); |
238 |
// Now, create the container with all nodes on this link |
|
|
239 |
NodeContainer infra (backbone.Get (i), newInfraNodes); |
| 237 |
// |
240 |
// |
| 238 |
// Create another ad hoc network and devices |
241 |
// Create another ad hoc network and devices |
| 239 |
// |
242 |
// |
|
Lines 244-250
main (int argc, char *argv[])
|
Link Here
|
|---|
|
| 244 |
|
247 |
|
| 245 |
// Add the IPv4 protocol stack to the nodes in our container |
248 |
// Add the IPv4 protocol stack to the nodes in our container |
| 246 |
// |
249 |
// |
| 247 |
internet.Install (infra); |
250 |
internet.Install (newInfraNodes); |
| 248 |
// |
251 |
// |
| 249 |
// Assign IPv4 addresses to the device drivers (actually to the associated |
252 |
// Assign IPv4 addresses to the device drivers (actually to the associated |
| 250 |
// IPv4 interfaces) we just created. |
253 |
// IPv4 interfaces) we just created. |
|
Lines 272-278
main (int argc, char *argv[])
|
Link Here
|
|---|
|
| 272 |
"Bounds", Rectangle (-25, 25, -25, 25), |
275 |
"Bounds", Rectangle (-25, 25, -25, 25), |
| 273 |
"Speed", ConstantVariable (30), |
276 |
"Speed", ConstantVariable (30), |
| 274 |
"Pause", ConstantVariable (0.4)); |
277 |
"Pause", ConstantVariable (0.4)); |
| 275 |
mobility.Layout (infra); |
278 |
mobility.Install (infra); |
| 276 |
} |
279 |
} |
| 277 |
/////////////////////////////////////////////////////////////////////////// |
280 |
/////////////////////////////////////////////////////////////////////////// |
| 278 |
// // |
281 |
// // |
|
Lines 282-288
main (int argc, char *argv[])
|
Link Here
|
|---|
|
| 282 |
|
285 |
|
| 283 |
NS_LOG_INFO ("Enabling OLSR routing on all backbone nodes"); |
286 |
NS_LOG_INFO ("Enabling OLSR routing on all backbone nodes"); |
| 284 |
OlsrHelper olsr; |
287 |
OlsrHelper olsr; |
| 285 |
olsr.Enable (backbone); |
288 |
olsr.Install (backbone); |
| 286 |
|
289 |
|
| 287 |
/////////////////////////////////////////////////////////////////////////// |
290 |
/////////////////////////////////////////////////////////////////////////// |
| 288 |
// // |
291 |
// // |