LEFT | RIGHT |
(no file at all) | |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2013 ResiliNets, ITTC, University of Kansas | 3 * Copyright (c) 2013 ResiliNets, ITTC, University of Kansas |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 std::string rto_tr_file_name = ""; | 170 std::string rto_tr_file_name = ""; |
171 double data_mbytes = 0; | 171 double data_mbytes = 0; |
172 uint32_t mtu_bytes = 400; | 172 uint32_t mtu_bytes = 400; |
173 uint16_t num_flows = 1; | 173 uint16_t num_flows = 1; |
174 float duration = 100; | 174 float duration = 100; |
175 uint32_t run = 0; | 175 uint32_t run = 0; |
176 bool flow_monitor = true; | 176 bool flow_monitor = true; |
177 | 177 |
178 | 178 |
179 CommandLine cmd; | 179 CommandLine cmd; |
180 cmd.AddValue ("transport_prot", "Transport protocol to use: TcpTahoe, TcpReno,
TcpNewReno, TcpWestwood, TcpWestwoodPlus ", transport_prot); | 180 cmd.AddValue ("transport_prot", "Transport protocol to use: TcpTahoe, TcpReno,
TcpNewReno, "\ |
| 181 "TcpWestwood, TcpWestwoodPlus, TcpCubic, TcpHi
ghSpeed, "\ |
| 182 "TcpHybla, TcpBic", transport_prot); |
181 cmd.AddValue ("error_p", "Packet error rate", error_p); | 183 cmd.AddValue ("error_p", "Packet error rate", error_p); |
182 cmd.AddValue ("bandwidth", "Bottleneck bandwidth", bandwidth); | 184 cmd.AddValue ("bandwidth", "Bottleneck bandwidth", bandwidth); |
183 cmd.AddValue ("access_bandwidth", "Access link bandwidth", access_bandwidth); | 185 cmd.AddValue ("access_bandwidth", "Access link bandwidth", access_bandwidth); |
184 cmd.AddValue ("delay", "Access link delay", access_delay); | 186 cmd.AddValue ("delay", "Access link delay", access_delay); |
185 cmd.AddValue ("tracing", "Flag to enable/disable tracing", tracing); | 187 cmd.AddValue ("tracing", "Flag to enable/disable tracing", tracing); |
186 cmd.AddValue ("tr_name", "Name of output trace file", tr_file_name); | 188 cmd.AddValue ("tr_name", "Name of output trace file", tr_file_name); |
187 cmd.AddValue ("cwnd_tr_name", "Name of output trace file", cwnd_tr_file_name); | 189 cmd.AddValue ("cwnd_tr_name", "Name of output trace file", cwnd_tr_file_name); |
188 cmd.AddValue ("ssthresh_tr_name", "Name of output trace file", ssthresh_tr_fil
e_name); | 190 cmd.AddValue ("ssthresh_tr_name", "Name of output trace file", ssthresh_tr_fil
e_name); |
189 cmd.AddValue ("rtt_tr_name", "Name of output trace file", rtt_tr_file_name); | 191 cmd.AddValue ("rtt_tr_name", "Name of output trace file", rtt_tr_file_name); |
190 cmd.AddValue ("rto_tr_name", "Name of output trace file", rto_tr_file_name); | 192 cmd.AddValue ("rto_tr_name", "Name of output trace file", rto_tr_file_name); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 { // the default protocol type in ns3::TcpWestwood is WESTWOOD | 239 { // the default protocol type in ns3::TcpWestwood is WESTWOOD |
238 Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpWest
wood::GetTypeId ())); | 240 Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpWest
wood::GetTypeId ())); |
239 Config::SetDefault ("ns3::TcpWestwood::FilterType", EnumValue (TcpWestwood
::TUSTIN)); | 241 Config::SetDefault ("ns3::TcpWestwood::FilterType", EnumValue (TcpWestwood
::TUSTIN)); |
240 } | 242 } |
241 else if (transport_prot.compare ("TcpWestwoodPlus") == 0) | 243 else if (transport_prot.compare ("TcpWestwoodPlus") == 0) |
242 { | 244 { |
243 Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpWest
wood::GetTypeId ())); | 245 Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpWest
wood::GetTypeId ())); |
244 Config::SetDefault ("ns3::TcpWestwood::ProtocolType", EnumValue (TcpWestwo
od::WESTWOODPLUS)); | 246 Config::SetDefault ("ns3::TcpWestwood::ProtocolType", EnumValue (TcpWestwo
od::WESTWOODPLUS)); |
245 Config::SetDefault ("ns3::TcpWestwood::FilterType", EnumValue (TcpWestwood
::TUSTIN)); | 247 Config::SetDefault ("ns3::TcpWestwood::FilterType", EnumValue (TcpWestwood
::TUSTIN)); |
246 } | 248 } |
| 249 else if (transport_prot.compare ("TcpBic") == 0) |
| 250 { |
| 251 Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpBic:
:GetTypeId ())); |
| 252 } |
| 253 else if (transport_prot.compare ("TcpCubic") == 0) |
| 254 { |
| 255 Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpCubi
c::GetTypeId ())); |
| 256 } |
| 257 else if (transport_prot.compare ("TcpHybla") == 0) |
| 258 { |
| 259 Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpHybl
a::GetTypeId ())); |
| 260 } |
| 261 else if (transport_prot.compare ("TcpHighSpeed") == 0) |
| 262 { |
| 263 Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpHigh
Speed::GetTypeId ())); |
| 264 } |
247 else | 265 else |
248 { | 266 { |
249 NS_LOG_DEBUG ("Invalid TCP version"); | 267 NS_LOG_DEBUG ("Invalid TCP version"); |
250 exit (1); | 268 exit (1); |
251 } | 269 } |
252 | 270 |
253 // Create gateways, sources, and sinks | 271 // Create gateways, sources, and sinks |
254 NodeContainer gateways; | 272 NodeContainer gateways; |
255 gateways.Create (1); | 273 gateways.Create (1); |
256 NodeContainer sources; | 274 NodeContainer sources; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 Ipv4GlobalRoutingHelper::PopulateRoutingTables (); | 319 Ipv4GlobalRoutingHelper::PopulateRoutingTables (); |
302 | 320 |
303 uint16_t port = 50000; | 321 uint16_t port = 50000; |
304 Address sinkLocalAddress (InetSocketAddress (Ipv4Address::GetAny (), port)); | 322 Address sinkLocalAddress (InetSocketAddress (Ipv4Address::GetAny (), port)); |
305 PacketSinkHelper sinkHelper ("ns3::TcpSocketFactory", sinkLocalAddress); | 323 PacketSinkHelper sinkHelper ("ns3::TcpSocketFactory", sinkLocalAddress); |
306 | 324 |
307 for (uint16_t i = 0; i < sources.GetN (); i++) | 325 for (uint16_t i = 0; i < sources.GetN (); i++) |
308 { | 326 { |
309 AddressValue remoteAddress (InetSocketAddress (sink_interfaces.GetAddress
(i, 0), port)); | 327 AddressValue remoteAddress (InetSocketAddress (sink_interfaces.GetAddress
(i, 0), port)); |
310 | 328 |
311 if (transport_prot.compare ("TcpTahoe") == 0 | 329 Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (tcp_adu_
size)); |
312 || transport_prot.compare ("TcpReno") == 0 | 330 BulkSendHelper ftp ("ns3::TcpSocketFactory", Address ()); |
313 || transport_prot.compare ("TcpNewReno") == 0 | 331 ftp.SetAttribute ("Remote", remoteAddress); |
314 || transport_prot.compare ("TcpWestwood") == 0 | 332 ftp.SetAttribute ("SendSize", UintegerValue (tcp_adu_size)); |
315 || transport_prot.compare ("TcpWestwoodPlus") == 0) | 333 ftp.SetAttribute ("MaxBytes", UintegerValue (int(data_mbytes * 1000000))); |
316 { | 334 |
317 Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (tcp_
adu_size)); | 335 ApplicationContainer sourceApp = ftp.Install (sources.Get (i)); |
318 BulkSendHelper ftp ("ns3::TcpSocketFactory", Address ()); | 336 sourceApp.Start (Seconds (start_time * i)); |
319 ftp.SetAttribute ("Remote", remoteAddress); | 337 sourceApp.Stop (Seconds (stop_time - 3)); |
320 ftp.SetAttribute ("SendSize", UintegerValue (tcp_adu_size)); | 338 |
321 ftp.SetAttribute ("MaxBytes", UintegerValue (int(data_mbytes * 1000000
))); | 339 sinkHelper.SetAttribute ("Protocol", TypeIdValue (TcpSocketFactory::GetTyp
eId ())); |
322 | 340 ApplicationContainer sinkApp = sinkHelper.Install (sinks); |
323 ApplicationContainer sourceApp = ftp.Install (sources.Get (i)); | 341 sinkApp.Start (Seconds (start_time * i)); |
324 sourceApp.Start (Seconds (start_time * i)); | 342 sinkApp.Stop (Seconds (stop_time)); |
325 sourceApp.Stop (Seconds (stop_time - 3)); | |
326 | |
327 sinkHelper.SetAttribute ("Protocol", TypeIdValue (TcpSocketFactory::Ge
tTypeId ())); | |
328 ApplicationContainer sinkApp = sinkHelper.Install (sinks); | |
329 sinkApp.Start (Seconds (start_time * i)); | |
330 sinkApp.Stop (Seconds (stop_time)); | |
331 } | |
332 else | |
333 { | |
334 NS_LOG_DEBUG ("Invalid transport protocol " << transport_prot << " spe
cified"); | |
335 exit (1); | |
336 } | |
337 } | 343 } |
338 | 344 |
339 // Set up tracing if enabled | 345 // Set up tracing if enabled |
340 if (tracing) | 346 if (tracing) |
341 { | 347 { |
342 if (tr_file_name.compare ("") != 0) | 348 if (tr_file_name.compare ("") != 0) |
343 { | 349 { |
344 std::ofstream ascii; | 350 std::ofstream ascii; |
345 Ptr<OutputStreamWrapper> ascii_wrap; | 351 Ptr<OutputStreamWrapper> ascii_wrap; |
346 ascii.open (tr_file_name.c_str ()); | 352 ascii.open (tr_file_name.c_str ()); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 Simulator::Run (); | 390 Simulator::Run (); |
385 | 391 |
386 if (flow_monitor) | 392 if (flow_monitor) |
387 { | 393 { |
388 flowHelper.SerializeToXmlFile ("TcpVariantsComparison.flowmonitor", true,
true); | 394 flowHelper.SerializeToXmlFile ("TcpVariantsComparison.flowmonitor", true,
true); |
389 } | 395 } |
390 | 396 |
391 Simulator::Destroy (); | 397 Simulator::Destroy (); |
392 return 0; | 398 return 0; |
393 } | 399 } |
LEFT | RIGHT |