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

(-)a/examples/tcp/tcp-variants-comparison.cc (-82 / +21 lines)
 Lines 242-247    Link Here 
242
  cmd.AddValue ("queue_disc_type", "Queue disc type for gateway (e.g. ns3::CoDelQueueDisc)", queue_disc_type);
242
  cmd.AddValue ("queue_disc_type", "Queue disc type for gateway (e.g. ns3::CoDelQueueDisc)", queue_disc_type);
243
  cmd.Parse (argc, argv);
243
  cmd.Parse (argc, argv);
244
244
245
  transport_prot = std::string ("ns3::") + transport_prot;
246
245
  SeedManager::SetSeed (1);
247
  SeedManager::SetSeed (1);
246
  SeedManager::SetRun (run);
248
  SeedManager::SetRun (run);
247
249
 Lines 271-331    Link Here 
271
  Config::SetDefault ("ns3::TcpSocket::SndBufSize", UintegerValue (1 << 21));
273
  Config::SetDefault ("ns3::TcpSocket::SndBufSize", UintegerValue (1 << 21));
272
274
273
  // Select TCP variant
275
  // Select TCP variant
274
  if (transport_prot.compare ("TcpNewReno") == 0)
276
  if (transport_prot.compare ("ns3::TcpWestwoodPlus") == 0)
275
    {
277
    { 
276
      Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpNewReno::GetTypeId ()));
278
      // TcpWestwoodPlus is not an actual TypeId name; we need TcpWestwood here
277
    }
278
  else if (transport_prot.compare ("TcpHybla") == 0)
279
    {
280
      Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpHybla::GetTypeId ()));
281
    }
282
  else if (transport_prot.compare ("TcpHighSpeed") == 0)
283
    {
284
      Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpHighSpeed::GetTypeId ()));
285
    }
286
  else if (transport_prot.compare ("TcpVegas") == 0)
287
    {
288
      Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpVegas::GetTypeId ()));
289
    }
290
  else if (transport_prot.compare ("TcpScalable") == 0)
291
    {
292
      Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpScalable::GetTypeId ()));
293
    }
294
  else if (transport_prot.compare ("TcpHtcp") == 0)
295
    {
296
      Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpHtcp::GetTypeId ()));
297
    }
298
  else if (transport_prot.compare ("TcpVeno") == 0)
299
    {
300
      Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpVeno::GetTypeId ()));
301
    }
302
  else if (transport_prot.compare ("TcpBic") == 0)
303
    {
304
      Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpBic::GetTypeId ()));
305
    }
306
  else if (transport_prot.compare ("TcpYeah") == 0)
307
    {
308
      Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpYeah::GetTypeId ()));
309
    }
310
  else if (transport_prot.compare ("TcpIllinois") == 0)
311
    {
312
      Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpIllinois::GetTypeId ()));
313
    }
314
  else if (transport_prot.compare ("TcpWestwood") == 0)
315
    { // the default protocol type in ns3::TcpWestwood is WESTWOOD
316
      Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpWestwood::GetTypeId ()));
279
      Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpWestwood::GetTypeId ()));
317
      Config::SetDefault ("ns3::TcpWestwood::FilterType", EnumValue (TcpWestwood::TUSTIN));
280
      // the default protocol type in ns3::TcpWestwood is WESTWOOD
318
    }
319
  else if (transport_prot.compare ("TcpWestwoodPlus") == 0)
320
    {
321
      Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpWestwood::GetTypeId ()));
322
      Config::SetDefault ("ns3::TcpWestwood::ProtocolType", EnumValue (TcpWestwood::WESTWOODPLUS));
281
      Config::SetDefault ("ns3::TcpWestwood::ProtocolType", EnumValue (TcpWestwood::WESTWOODPLUS));
323
      Config::SetDefault ("ns3::TcpWestwood::FilterType", EnumValue (TcpWestwood::TUSTIN));
324
    }
282
    }
325
  else
283
  else
326
    {
284
    {
327
      NS_LOG_DEBUG ("Invalid TCP version");
285
      TypeId tcpTid;
328
      exit (1);
286
      NS_ABORT_MSG_UNLESS (TypeId::LookupByNameFailSafe (transport_prot, &tcpTid), "TypeId " << transport_prot << " not found");
287
      Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TypeId::LookupByName (transport_prot)));
329
    }
288
    }
330
289
331
  // Create gateways, sources, and sinks
290
  // Create gateways, sources, and sinks
 Lines 420-459    Link Here 
420
  for (uint16_t i = 0; i < sources.GetN (); i++)
379
  for (uint16_t i = 0; i < sources.GetN (); i++)
421
    {
380
    {
422
      AddressValue remoteAddress (InetSocketAddress (sink_interfaces.GetAddress (i, 0), port));
381
      AddressValue remoteAddress (InetSocketAddress (sink_interfaces.GetAddress (i, 0), port));
382
      Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (tcp_adu_size));
383
      BulkSendHelper ftp ("ns3::TcpSocketFactory", Address ());
384
      ftp.SetAttribute ("Remote", remoteAddress);
385
      ftp.SetAttribute ("SendSize", UintegerValue (tcp_adu_size));
386
      ftp.SetAttribute ("MaxBytes", UintegerValue (int(data_mbytes * 1000000)));
423
387
424
      if (transport_prot.compare ("TcpNewReno") == 0
388
      ApplicationContainer sourceApp = ftp.Install (sources.Get (i));
425
          || transport_prot.compare ("TcpWestwood") == 0
389
      sourceApp.Start (Seconds (start_time * i));
426
          || transport_prot.compare ("TcpWestwoodPlus") == 0
390
      sourceApp.Stop (Seconds (stop_time - 3));
427
          || transport_prot.compare ("TcpHybla") == 0
428
          || transport_prot.compare ("TcpHighSpeed") == 0
429
          || transport_prot.compare ("TcpHtcp") == 0
430
          || transport_prot.compare ("TcpVegas") == 0
431
          || transport_prot.compare ("TcpVeno") == 0
432
          || transport_prot.compare ("TcpBic") == 0
433
          || transport_prot.compare ("TcpScalable") == 0
434
          || transport_prot.compare ("TcpYeah") == 0
435
          || transport_prot.compare ("TcpIllinois") == 0)
436
        {
437
          Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (tcp_adu_size));
438
          BulkSendHelper ftp ("ns3::TcpSocketFactory", Address ());
439
          ftp.SetAttribute ("Remote", remoteAddress);
440
          ftp.SetAttribute ("SendSize", UintegerValue (tcp_adu_size));
441
          ftp.SetAttribute ("MaxBytes", UintegerValue (int(data_mbytes * 1000000)));
442
391
443
          ApplicationContainer sourceApp = ftp.Install (sources.Get (i));
392
      sinkHelper.SetAttribute ("Protocol", TypeIdValue (TcpSocketFactory::GetTypeId ()));
444
          sourceApp.Start (Seconds (start_time * i));
393
      ApplicationContainer sinkApp = sinkHelper.Install (sinks);
445
          sourceApp.Stop (Seconds (stop_time - 3));
394
      sinkApp.Start (Seconds (start_time * i));
446
395
      sinkApp.Stop (Seconds (stop_time));
447
          sinkHelper.SetAttribute ("Protocol", TypeIdValue (TcpSocketFactory::GetTypeId ()));
448
          ApplicationContainer sinkApp = sinkHelper.Install (sinks);
449
          sinkApp.Start (Seconds (start_time * i));
450
          sinkApp.Stop (Seconds (stop_time));
451
        }
452
      else
453
        {
454
          NS_LOG_DEBUG ("Invalid transport protocol " << transport_prot << " specified");
455
          exit (1);
456
        }
457
    }
396
    }
458
397
459
  // Set up tracing if enabled
398
  // Set up tracing if enabled

Return to bug 2568