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

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

Return to bug 2520