equal
deleted
inserted
replaced
73 #include "ns3/mobility-module.h" |
73 #include "ns3/mobility-module.h" |
74 #include "ns3/wifi-module.h" |
74 #include "ns3/wifi-module.h" |
75 #include "ns3/aodv-module.h" |
75 #include "ns3/aodv-module.h" |
76 #include "ns3/olsr-module.h" |
76 #include "ns3/olsr-module.h" |
77 #include "ns3/dsdv-module.h" |
77 #include "ns3/dsdv-module.h" |
|
78 #include "ns3/dsr-module.h" |
78 #include "ns3/applications-module.h" |
79 #include "ns3/applications-module.h" |
79 |
80 |
80 using namespace ns3; |
81 using namespace ns3; |
|
82 using namespace dsr; |
81 |
83 |
82 NS_LOG_COMPONENT_DEFINE ("manet-routing-compare"); |
84 NS_LOG_COMPONENT_DEFINE ("manet-routing-compare"); |
83 |
85 |
84 class RoutingExperiment |
86 class RoutingExperiment |
85 { |
87 { |
188 RoutingExperiment::CommandSetup (int argc, char **argv) |
190 RoutingExperiment::CommandSetup (int argc, char **argv) |
189 { |
191 { |
190 CommandLine cmd; |
192 CommandLine cmd; |
191 cmd.AddValue ("CSVfileName", "The name of the CSV output file name", m_CSVfileName); |
193 cmd.AddValue ("CSVfileName", "The name of the CSV output file name", m_CSVfileName); |
192 cmd.AddValue ("traceMobility", "Enable mobility tracing", m_traceMobility); |
194 cmd.AddValue ("traceMobility", "Enable mobility tracing", m_traceMobility); |
193 cmd.AddValue ("protocol", "1=OLSR;2=AODV;3=DSDV", m_protocol); |
195 cmd.AddValue ("protocol", "1=OLSR;2=AODV;3=DSDV;4=DSR", m_protocol); |
194 cmd.Parse (argc, argv); |
196 cmd.Parse (argc, argv); |
195 return m_CSVfileName; |
197 return m_CSVfileName; |
196 } |
198 } |
197 |
199 |
198 int |
200 int |
268 NetDeviceContainer adhocDevices = wifi.Install (wifiPhy, wifiMac, adhocNodes); |
270 NetDeviceContainer adhocDevices = wifi.Install (wifiPhy, wifiMac, adhocNodes); |
269 |
271 |
270 AodvHelper aodv; |
272 AodvHelper aodv; |
271 OlsrHelper olsr; |
273 OlsrHelper olsr; |
272 DsdvHelper dsdv; |
274 DsdvHelper dsdv; |
|
275 DsrHelper dsr; |
|
276 DsrMainHelper dsrMain; |
273 Ipv4ListRoutingHelper list; |
277 Ipv4ListRoutingHelper list; |
|
278 InternetStackHelper internet; |
274 |
279 |
275 switch (m_protocol) |
280 switch (m_protocol) |
276 { |
281 { |
277 case 1: |
282 case 1: |
278 list.Add (olsr, 100); |
283 list.Add (olsr, 100); |
284 break; |
289 break; |
285 case 3: |
290 case 3: |
286 list.Add (dsdv, 100); |
291 list.Add (dsdv, 100); |
287 m_protocolName = "DSDV"; |
292 m_protocolName = "DSDV"; |
288 break; |
293 break; |
|
294 case 4: |
|
295 m_protocolName = "DSR"; |
|
296 break; |
289 default: |
297 default: |
290 NS_FATAL_ERROR ("No such protocol:" << m_protocol); |
298 NS_FATAL_ERROR ("No such protocol:" << m_protocol); |
291 } |
299 } |
292 |
300 |
293 InternetStackHelper internet; |
301 if (m_protocol < 4) |
294 internet.SetRoutingHelper (list); |
302 { |
295 internet.Install (adhocNodes); |
303 internet.SetRoutingHelper (list); |
|
304 internet.Install (adhocNodes); |
|
305 } |
|
306 else if (m_protocol == 4) |
|
307 { |
|
308 internet.Install (adhocNodes); |
|
309 dsrMain.Install (dsr, adhocNodes); |
|
310 } |
296 |
311 |
297 NS_LOG_INFO ("assigning ip address"); |
312 NS_LOG_INFO ("assigning ip address"); |
298 |
313 |
299 Ipv4AddressHelper addressAdhoc; |
314 Ipv4AddressHelper addressAdhoc; |
300 addressAdhoc.SetBase ("10.1.1.0", "255.255.255.0"); |
315 addressAdhoc.SetBase ("10.1.1.0", "255.255.255.0"); |
354 |
369 |
355 //AsciiTraceHelper ascii; |
370 //AsciiTraceHelper ascii; |
356 //Ptr<OutputStreamWrapper> osw = ascii.CreateFileStream ( (tr_name + ".tr").c_str()); |
371 //Ptr<OutputStreamWrapper> osw = ascii.CreateFileStream ( (tr_name + ".tr").c_str()); |
357 //wifiPhy.EnableAsciiAll (osw); |
372 //wifiPhy.EnableAsciiAll (osw); |
358 std::ofstream os; |
373 std::ofstream os; |
359 os.open ((tr_name + ".mob").c_str()); |
374 os.open ((tr_name + ".mob").c_str ()); |
360 MobilityHelper::EnableAsciiAll (os); |
375 MobilityHelper::EnableAsciiAll (os); |
361 |
376 |
362 //Ptr<FlowMonitor> flowmon; |
377 //Ptr<FlowMonitor> flowmon; |
363 //FlowMonitorHelper flowmonHelper; |
378 //FlowMonitorHelper flowmonHelper; |
364 //flowmon = flowmonHelper.InstallAll (); |
379 //flowmon = flowmonHelper.InstallAll (); |