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

(-)a/examples/wireless/wifi-tcp.cc (-3 / +22 lines)
 Lines 60-66    Link Here 
60
{
60
{
61
  uint32_t payloadSize = 1472;                       /* Transport layer payload size in bytes. */
61
  uint32_t payloadSize = 1472;                       /* Transport layer payload size in bytes. */
62
  std::string dataRate = "100Mbps";                  /* Application layer datarate. */
62
  std::string dataRate = "100Mbps";                  /* Application layer datarate. */
63
  std::string tcpVariant = "ns3::TcpNewReno";        /* TCP variant type. */
63
  std::string tcpVariant = "TcpNewReno";             /* TCP variant type. */
64
  std::string phyRate = "HtMcs7";                    /* Physical layer bitrate. */
64
  std::string phyRate = "HtMcs7";                    /* Physical layer bitrate. */
65
  double simulationTime = 10;                        /* Simulation time in seconds. */
65
  double simulationTime = 10;                        /* Simulation time in seconds. */
66
  bool pcapTracing = false;                          /* PCAP Tracing is enabled or not. */
66
  bool pcapTracing = false;                          /* PCAP Tracing is enabled or not. */
 Lines 69-84    Link Here 
69
  CommandLine cmd;
69
  CommandLine cmd;
70
  cmd.AddValue ("payloadSize", "Payload size in bytes", payloadSize);
70
  cmd.AddValue ("payloadSize", "Payload size in bytes", payloadSize);
71
  cmd.AddValue ("dataRate", "Application data ate", dataRate);
71
  cmd.AddValue ("dataRate", "Application data ate", dataRate);
72
  cmd.AddValue ("tcpVariant", "Transport protocol to use: TcpTahoe, TcpReno, TcpNewReno, TcpWestwood, TcpWestwoodPlus ", tcpVariant);
72
  cmd.AddValue ("tcpVariant", "Transport protocol to use: TcpNewReno, "
73
                "TcpHybla, TcpHighSpeed, TcpHtcp, TcpVegas, TcpScalable, TcpVeno, "
74
                "TcpBic, TcpYeah, TcpIllinois, TcpWestwood, TcpWestwoodPlus, TcpLedbat ", tcpVariant);
73
  cmd.AddValue ("phyRate", "Physical layer bitrate", phyRate);
75
  cmd.AddValue ("phyRate", "Physical layer bitrate", phyRate);
74
  cmd.AddValue ("simulationTime", "Simulation time in seconds", simulationTime);
76
  cmd.AddValue ("simulationTime", "Simulation time in seconds", simulationTime);
75
  cmd.AddValue ("pcap", "Enable/disable PCAP Tracing", pcapTracing);
77
  cmd.AddValue ("pcap", "Enable/disable PCAP Tracing", pcapTracing);
76
  cmd.Parse (argc, argv);
78
  cmd.Parse (argc, argv);
77
79
80
  tcpVariant = std::string ("ns3::") + tcpVariant;
81
78
  /* No fragmentation and no RTS/CTS */
82
  /* No fragmentation and no RTS/CTS */
79
  Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("999999"));
83
  Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("999999"));
80
  Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("999999"));
84
  Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("999999"));
81
85
86
  // Select TCP variant
87
  if (tcpVariant.compare ("ns3::TcpWestwoodPlus") == 0)
88
    { 
89
      // TcpWestwoodPlus is not an actual TypeId name; we need TcpWestwood here
90
      Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpWestwood::GetTypeId ()));
91
      // the default protocol type in ns3::TcpWestwood is WESTWOOD
92
      Config::SetDefault ("ns3::TcpWestwood::ProtocolType", EnumValue (TcpWestwood::WESTWOODPLUS));
93
    }
94
  else
95
    {
96
      TypeId tcpTid;
97
      NS_ABORT_MSG_UNLESS (TypeId::LookupByNameFailSafe (tcpVariant, &tcpTid), "TypeId " << tcpVariant << " not found");
98
      Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TypeId::LookupByName (tcpVariant)));
99
    }
100
82
  /* Configure TCP Options */
101
  /* Configure TCP Options */
83
  Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (payloadSize));
102
  Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (payloadSize));
84
103
 Lines 189-194    Link Here 
189
      NS_LOG_ERROR ("Obtained throughput is not in the expected boundaries!");
208
      NS_LOG_ERROR ("Obtained throughput is not in the expected boundaries!");
190
      exit (1);
209
      exit (1);
191
    }
210
    }
192
  std::cout << "\nAverage throughtput: " << averageThroughput << " Mbit/s" << std::endl;
211
  std::cout << "\nAverage throughput: " << averageThroughput << " Mbit/s" << std::endl;
193
  return 0;
212
  return 0;
194
}
213
}

Return to bug 2520