move wifi examples to example directory
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Wed, 19 Mar 2008 12:42:54 -0700
changeset 2662 2ace0f6fd238
parent 2661 91a852012080
child 2663 dc5314da50aa
move wifi examples to example directory
examples/wifi-adhoc.cc
examples/wifi-ap.cc
examples/wscript
samples/main-adhoc-wifi.cc
samples/main-ap-wifi.cc
samples/wscript
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/wifi-adhoc.cc	Wed Mar 19 12:42:54 2008 -0700
@@ -0,0 +1,276 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2005,2006,2007 INRIA
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+
+#include "ns3/wifi-net-device.h"
+#include "ns3/arf-wifi-manager.h"
+#include "ns3/adhoc-wifi-mac.h"
+#include "ns3/wifi-phy.h"
+#include "ns3/wifi-channel.h"
+#include "ns3/simulator.h"
+#include "ns3/callback.h"
+#include "ns3/ptr.h"
+#include "ns3/node.h"
+#include "ns3/onoff-application.h"
+#include "ns3/static-mobility-model.h"
+#include "ns3/random-variable.h"
+#include "ns3/packet-socket-address.h"
+#include "ns3/packet.h"
+#include "ns3/socket.h"
+#include "ns3/socket-factory.h"
+#include "ns3/command-line.h"
+#include "ns3/gnuplot.h"
+#include "ns3/uinteger.h"
+#include "ns3/string.h"
+#include "ns3/config.h"
+#include "ns3/wifi-helper.h"
+#include "ns3/mobility-helper.h"
+#include "ns3/log.h"
+
+
+#include <iostream>
+
+NS_LOG_COMPONENT_DEFINE ("Main");
+
+using namespace ns3;
+
+class Experiment
+{
+public:
+  Experiment ();
+  Experiment (std::string name);
+  GnuplotDataset Run (const WifiHelper &wifi);
+private:
+  void ReceivePacket (Ptr<Socket> socket, Ptr<Packet> packet, const Address &address);
+  void SetPosition (Ptr<Node> node, Vector position);
+  Vector GetPosition (Ptr<Node> node);
+  void AdvancePosition (Ptr<Node> node);
+  Ptr<Socket> SetupPacketReceive (Ptr<Node> node);
+
+  uint32_t m_bytesTotal;
+  GnuplotDataset m_output;
+};
+
+Experiment::Experiment ()
+  : m_output ()
+{}
+
+Experiment::Experiment (std::string name)
+  : m_output (name)
+{
+  m_output.SetStyle (GnuplotDataset::LINES);
+}
+
+void
+Experiment::SetPosition (Ptr<Node> node, Vector position)
+{
+  Ptr<MobilityModel> mobility = node->GetObject<MobilityModel> ();
+  mobility->SetPosition (position);
+}
+
+Vector
+Experiment::GetPosition (Ptr<Node> node)
+{
+  Ptr<MobilityModel> mobility = node->GetObject<MobilityModel> ();
+  return mobility->GetPosition ();
+}
+
+void 
+Experiment::AdvancePosition (Ptr<Node> node) 
+{
+  Vector pos = GetPosition (node);
+  double mbs = ((m_bytesTotal * 8.0) / 1000000);
+  m_bytesTotal = 0;
+  m_output.Add (pos.x, mbs);
+  pos.x += 1.0;
+  if (pos.x >= 210.0) 
+    {
+      return;
+    }
+  SetPosition (node, pos);
+  //std::cout << "x="<<pos.x << std::endl;
+  Simulator::Schedule (Seconds (1.0), &Experiment::AdvancePosition, this, node);
+}
+
+void
+Experiment::ReceivePacket (Ptr<Socket> socket, Ptr<Packet> packet, const Address &address)
+{
+  m_bytesTotal += packet->GetSize ();
+}
+
+Ptr<Socket>
+Experiment::SetupPacketReceive (Ptr<Node> node)
+{
+  TypeId tid = TypeId::LookupByName ("ns3::PacketSocketFactory");
+  Ptr<SocketFactory> socketFactory = node->GetObject<SocketFactory> (tid);
+  Ptr<Socket> sink = socketFactory->CreateSocket ();
+  sink->Bind ();
+  sink->SetRecvCallback (MakeCallback (&Experiment::ReceivePacket, this));
+  return sink;
+}
+
+GnuplotDataset
+Experiment::Run (const WifiHelper &wifi)
+{
+  m_bytesTotal = 0;
+
+  NodeContainer c;
+  c.Create (2);
+
+  NetDeviceContainer devices = wifi.Build (c);
+
+  MobilityHelper mobility;
+  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
+  positionAlloc->Add (Vector (0.0, 0.0, 0.0));
+  positionAlloc->Add (Vector (5.0, 0.0, 0.0));
+  mobility.SetPositionAllocator (positionAlloc);
+  mobility.SetMobilityModel ("ns3::StaticMobilityModel");
+
+  mobility.Layout (c.Begin (), c.End ());
+
+  PacketSocketAddress destination = PacketSocketAddress ();
+  destination.SetProtocol (1);
+  destination.SetSingleDevice (0);
+  destination.SetPhysicalAddress (devices.Get (1)->GetAddress ());
+  Ptr<Application> app = 
+    CreateObject<OnOffApplication> ("Remote", Address (destination),
+                                    "Protocol", TypeId::LookupByName ("ns3::PacketSocketFactory"),
+                                    "OnTime", ConstantVariable (250),
+                                    "OffTime", ConstantVariable (0),
+                                    "DataRate", DataRate (60000000),
+                                    "PacketSize", Uinteger (2000));
+  c.Get (0)->AddApplication (app);
+
+  app->Start (Seconds (0.5));
+  app->Stop (Seconds (250.0));
+
+  Simulator::Schedule (Seconds (1.5), &Experiment::AdvancePosition, this, c.Get (1));
+  Ptr<Socket> recvSink = SetupPacketReceive (c.Get (1));
+
+  Simulator::Run ();
+
+  Simulator::Destroy ();
+
+  return m_output;
+}
+
+int main (int argc, char *argv[])
+{
+  // disable fragmentation
+  Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", String ("2200"));
+  Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", String ("2200"));
+
+  CommandLine cmd;
+  cmd.Parse (argc, argv);
+
+  Gnuplot gnuplot = Gnuplot ("reference-rates.png");
+
+  Experiment experiment;
+  WifiHelper wifi;
+  GnuplotDataset dataset;
+
+  wifi.SetMac ("ns3::AdhocWifiMac");
+  wifi.SetPhy ("ns3::WifiPhy");
+
+  NS_LOG_DEBUG ("54");
+  experiment = Experiment ("54mb");
+  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
+                                "DataMode", String ("wifia-54mbs"));
+  dataset = experiment.Run (wifi);
+  gnuplot.AddDataset (dataset);
+
+  NS_LOG_DEBUG ("48");
+  experiment = Experiment ("48mb");
+  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
+                                "DataMode", String ("wifia-48mbs"));
+  dataset = experiment.Run (wifi);
+  gnuplot.AddDataset (dataset);
+
+  NS_LOG_DEBUG ("36");
+  experiment = Experiment ("36mb");
+  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
+                                "DataMode", String ("wifia-36mbs"));
+  dataset = experiment.Run (wifi);
+  gnuplot.AddDataset (dataset);
+
+  NS_LOG_DEBUG ("24");
+  experiment = Experiment ("24mb");
+  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
+                                "DataMode", String ("wifia-24mbs"));
+  dataset = experiment.Run (wifi);
+  gnuplot.AddDataset (dataset);
+
+  NS_LOG_DEBUG ("18");
+  experiment = Experiment ("18mb");
+  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
+                                "DataMode", String ("wifia-18mbs"));
+  dataset = experiment.Run (wifi);
+  gnuplot.AddDataset (dataset);
+
+  NS_LOG_DEBUG ("12");
+  experiment = Experiment ("12mb");
+  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
+                                "DataMode", String ("wifia-12mbs"));
+  dataset = experiment.Run (wifi);
+  gnuplot.AddDataset (dataset);
+
+  NS_LOG_DEBUG ("9");
+  experiment = Experiment ("9mb");
+  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
+                                "DataMode", String ("wifia-9mbs"));
+  dataset = experiment.Run (wifi);
+  gnuplot.AddDataset (dataset);
+
+  NS_LOG_DEBUG ("6");
+  experiment = Experiment ("6mb");
+  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
+                                "DataMode", String ("wifia-6mbs"));
+  dataset = experiment.Run (wifi);
+  gnuplot.AddDataset (dataset);
+
+  gnuplot.GenerateOutput (std::cout);
+
+
+
+  gnuplot = Gnuplot ("rate-control.png");
+  Config::SetDefault ("WifiPhy::Standard", String ("holland"));
+
+
+  NS_LOG_DEBUG ("arf");
+  experiment = Experiment ("arf");
+  wifi.SetRemoteStationManager ("ns3::ArfWifiManager");
+  dataset = experiment.Run (wifi);
+  gnuplot.AddDataset (dataset);
+
+  NS_LOG_DEBUG ("aarf");
+  experiment = Experiment ("aarf");
+  wifi.SetRemoteStationManager ("ns3::AarfWifiManager");
+  dataset = experiment.Run (wifi);
+  gnuplot.AddDataset (dataset);
+
+  NS_LOG_DEBUG ("ideal");
+  experiment = Experiment ("ideal");
+  wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
+  dataset = experiment.Run (wifi);
+  gnuplot.AddDataset (dataset);
+
+  gnuplot.GenerateOutput (std::cout);
+
+  return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/wifi-ap.cc	Wed Mar 19 12:42:54 2008 -0700
@@ -0,0 +1,196 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2005,2006,2007 INRIA
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+
+
+#include "ns3/simulator.h"
+#include "ns3/callback.h"
+#include "ns3/ptr.h"
+#include "ns3/node.h"
+#include "ns3/onoff-application.h"
+#include "ns3/mobility-helper.h"
+#include "ns3/wifi-helper.h"
+#include "ns3/node-container.h"
+#include "ns3/random-variable.h"
+#include "ns3/packet-socket-address.h"
+#include "ns3/packet.h"
+#include "ns3/node-list.h"
+#include "ns3/ssid.h"
+#include "ns3/wifi-phy.h"
+#include "ns3/mobility-model.h"
+#include "ns3/config.h"
+#include "ns3/string.h"
+#include "ns3/wifi-channel.h"
+#include "ns3/boolean.h"
+#include "ns3/propagation-loss-model.h"
+#include "ns3/propagation-delay-model.h"
+
+
+#include <iostream>
+
+using namespace ns3;
+
+void
+DevTxTrace (std::string context, Ptr<const Packet> p, Mac48Address address)
+{
+  std::cout << " TX to=" << address << " p: " << *p << std::endl;
+}
+void
+DevRxTrace (std::string context, Ptr<const Packet> p, Mac48Address address)
+{
+  std::cout << " RX from=" << address << " p: " << *p << std::endl;
+}
+void
+PhyRxOkTrace (std::string context, Ptr<const Packet> packet, double snr, WifiMode mode, enum WifiPreamble preamble)
+{
+  std::cout << "PHYRXOK mode=" << mode << " snr=" << snr << " " << *packet << std::endl;
+}
+void
+PhyRxErrorTrace (std::string context, Ptr<const Packet> packet, double snr)
+{
+  std::cout << "PHYRXERROR snr=" << snr << " " << *packet << std::endl;
+}
+void
+PhyTxTrace (std::string context, Ptr<const Packet> packet, WifiMode mode, WifiPreamble preamble, uint8_t txPower)
+{
+  std::cout << "PHYTX mode=" << mode << " " << *packet << std::endl;
+}
+void
+PhyStateTrace (std::string context, Time start, Time duration, enum WifiPhy::State state)
+{
+  std::cout << " state=";
+  switch (state) {
+  case WifiPhy::TX:
+    std::cout << "tx      ";
+    break;
+  case WifiPhy::SYNC:
+    std::cout << "sync    ";
+    break;
+  case WifiPhy::CCA_BUSY:
+    std::cout << "cca-busy";
+    break;
+  case WifiPhy::IDLE:
+    std::cout << "idle    ";
+    break;
+  }
+  std::cout << " start="<<start<<" duration="<<duration<<std::endl;
+}
+
+static void
+SetPosition (Ptr<Node> node, Vector position)
+{
+  Ptr<MobilityModel> mobility = node->GetObject<MobilityModel> ();
+  mobility->SetPosition (position);
+}
+
+static Vector
+GetPosition (Ptr<Node> node)
+{
+  Ptr<MobilityModel> mobility = node->GetObject<MobilityModel> ();
+  return mobility->GetPosition ();
+}
+
+static void 
+AdvancePosition (Ptr<Node> node) 
+{
+  Vector pos = GetPosition (node);
+  pos.x += 5.0;
+  if (pos.x >= 210.0) 
+    {
+      return;
+    }
+  SetPosition (node, pos);
+  //std::cout << "x="<<pos.x << std::endl;
+  Simulator::Schedule (Seconds (1.0), &AdvancePosition, node);
+}
+
+
+
+
+int main (int argc, char *argv[])
+{
+  Packet::EnableMetadata ();
+
+  // enable rts cts all the time.
+  Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", String ("0"));
+  // disable fragmentation
+  Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", String ("2200"));
+
+  WifiHelper wifi;
+  MobilityHelper mobility;
+  NodeContainer stas;
+  NodeContainer ap;
+  NetDeviceContainer staDevs;
+
+  stas.Create (2);
+  ap.Create (1);
+
+  Ptr<WifiChannel> channel = CreateObject<WifiChannel> ();
+  channel->SetPropagationDelayModel (CreateObject<ConstantSpeedPropagationDelayModel> ());
+  Ptr<LogDistancePropagationLossModel> log = CreateObject<LogDistancePropagationLossModel> ();
+  log->SetReferenceModel (CreateObject<FriisPropagationLossModel> ());
+  channel->SetPropagationLossModel (log);
+
+  Ssid ssid = Ssid ("wifi-default");
+  wifi.SetPhy ("ns3::WifiPhy");
+  wifi.SetRemoteStationManager ("ns3::ArfWifiManager");
+  // setup ap.
+  wifi.SetMac ("ns3::NqstaWifiMac", "Ssid", ssid,
+               "ActiveProbing", Boolean (false));
+  staDevs = wifi.Build (stas, channel);
+  // setup stas.
+  wifi.SetMac ("ns3::NqapWifiMac", "Ssid", ssid,
+               "BeaconGeneration", Boolean (true),
+               "BeaconInterval", Seconds (2.5));
+  wifi.Build (ap, channel);
+
+  // mobility.
+  mobility.Layout (stas.Begin (), stas.End ());
+  mobility.Layout (ap.Begin (), ap.End ());
+
+  Simulator::Schedule (Seconds (1.0), &AdvancePosition, ap.Get (0));
+
+  PacketSocketAddress destination = PacketSocketAddress ();
+  destination.SetProtocol (1);
+  destination.SetSingleDevice (0);
+  destination.SetPhysicalAddress (staDevs.Get(1)->GetAddress ());
+  Ptr<Application> app = 
+    CreateObject<OnOffApplication> ("Remote", Address (destination), 
+                                    "Protocol", TypeId::LookupByName ("ns3::PacketSocketFactory"),
+                                    "OnTime", ConstantVariable (42),
+                                    "OffTime", ConstantVariable (0));
+  stas.Get (0)->AddApplication (app);
+  app->Start (Seconds (0.5));
+  app->Stop (Seconds (43.0));
+
+  Simulator::StopAt (Seconds (44.0));
+
+  Config::Connect ("/NodeList/*/DeviceList/*/Tx", MakeCallback (&DevTxTrace));
+  Config::Connect ("/NodeList/*/DeviceList/*/Rx", MakeCallback (&DevRxTrace));
+  Config::Connect ("/NodeList/*/DeviceList/*/Phy/RxOk", MakeCallback (&PhyRxOkTrace));
+  Config::Connect ("/NodeList/*/DeviceList/*/Phy/RxError", MakeCallback (&PhyRxErrorTrace));
+  Config::Connect ("/NodeList/*/DeviceList/*/Phy/Tx", MakeCallback (&PhyTxTrace));
+  Config::Connect ("/NodeList/*/DeviceList/*/Phy/State", MakeCallback (&PhyStateTrace));
+
+  Simulator::Run ();
+
+  Simulator::Destroy ();
+
+  return 0;
+}
--- a/examples/wscript	Wed Mar 19 12:41:06 2008 -0700
+++ b/examples/wscript	Wed Mar 19 12:42:54 2008 -0700
@@ -66,4 +66,11 @@
         ['point-to-point', 'internet-node'])
     obj.source = 'tcp-small-transfer-oneloss.cc'
 
+    obj = bld.create_ns3_program('wifi-adhoc',
+                                 ['core', 'simulator', 'mobility', 'wifi'])
+    obj.source = 'wifi-adhoc.cc'
 
+    obj = bld.create_ns3_program('wifi-ap',
+                                 ['core', 'simulator', 'mobility', 'wifi'])
+    obj.source = 'wifi-ap.cc'
+
--- a/samples/main-adhoc-wifi.cc	Wed Mar 19 12:41:06 2008 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,276 +0,0 @@
-/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2005,2006,2007 INRIA
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-
-#include "ns3/wifi-net-device.h"
-#include "ns3/arf-wifi-manager.h"
-#include "ns3/adhoc-wifi-mac.h"
-#include "ns3/wifi-phy.h"
-#include "ns3/wifi-channel.h"
-#include "ns3/simulator.h"
-#include "ns3/callback.h"
-#include "ns3/ptr.h"
-#include "ns3/node.h"
-#include "ns3/onoff-application.h"
-#include "ns3/static-mobility-model.h"
-#include "ns3/random-variable.h"
-#include "ns3/packet-socket-address.h"
-#include "ns3/packet.h"
-#include "ns3/socket.h"
-#include "ns3/socket-factory.h"
-#include "ns3/command-line.h"
-#include "ns3/gnuplot.h"
-#include "ns3/uinteger.h"
-#include "ns3/string.h"
-#include "ns3/config.h"
-#include "ns3/wifi-helper.h"
-#include "ns3/mobility-helper.h"
-#include "ns3/log.h"
-
-
-#include <iostream>
-
-NS_LOG_COMPONENT_DEFINE ("Main");
-
-using namespace ns3;
-
-class Experiment
-{
-public:
-  Experiment ();
-  Experiment (std::string name);
-  GnuplotDataset Run (const WifiHelper &wifi);
-private:
-  void ReceivePacket (Ptr<Socket> socket, Ptr<Packet> packet, const Address &address);
-  void SetPosition (Ptr<Node> node, Vector position);
-  Vector GetPosition (Ptr<Node> node);
-  void AdvancePosition (Ptr<Node> node);
-  Ptr<Socket> SetupPacketReceive (Ptr<Node> node);
-
-  uint32_t m_bytesTotal;
-  GnuplotDataset m_output;
-};
-
-Experiment::Experiment ()
-  : m_output ()
-{}
-
-Experiment::Experiment (std::string name)
-  : m_output (name)
-{
-  m_output.SetStyle (GnuplotDataset::LINES);
-}
-
-void
-Experiment::SetPosition (Ptr<Node> node, Vector position)
-{
-  Ptr<MobilityModel> mobility = node->GetObject<MobilityModel> ();
-  mobility->SetPosition (position);
-}
-
-Vector
-Experiment::GetPosition (Ptr<Node> node)
-{
-  Ptr<MobilityModel> mobility = node->GetObject<MobilityModel> ();
-  return mobility->GetPosition ();
-}
-
-void 
-Experiment::AdvancePosition (Ptr<Node> node) 
-{
-  Vector pos = GetPosition (node);
-  double mbs = ((m_bytesTotal * 8.0) / 1000000);
-  m_bytesTotal = 0;
-  m_output.Add (pos.x, mbs);
-  pos.x += 1.0;
-  if (pos.x >= 210.0) 
-    {
-      return;
-    }
-  SetPosition (node, pos);
-  //std::cout << "x="<<pos.x << std::endl;
-  Simulator::Schedule (Seconds (1.0), &Experiment::AdvancePosition, this, node);
-}
-
-void
-Experiment::ReceivePacket (Ptr<Socket> socket, Ptr<Packet> packet, const Address &address)
-{
-  m_bytesTotal += packet->GetSize ();
-}
-
-Ptr<Socket>
-Experiment::SetupPacketReceive (Ptr<Node> node)
-{
-  TypeId tid = TypeId::LookupByName ("ns3::PacketSocketFactory");
-  Ptr<SocketFactory> socketFactory = node->GetObject<SocketFactory> (tid);
-  Ptr<Socket> sink = socketFactory->CreateSocket ();
-  sink->Bind ();
-  sink->SetRecvCallback (MakeCallback (&Experiment::ReceivePacket, this));
-  return sink;
-}
-
-GnuplotDataset
-Experiment::Run (const WifiHelper &wifi)
-{
-  m_bytesTotal = 0;
-
-  NodeContainer c;
-  c.Create (2);
-
-  NetDeviceContainer devices = wifi.Build (c);
-
-  MobilityHelper mobility;
-  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
-  positionAlloc->Add (Vector (0.0, 0.0, 0.0));
-  positionAlloc->Add (Vector (5.0, 0.0, 0.0));
-  mobility.SetPositionAllocator (positionAlloc);
-  mobility.SetMobilityModel ("ns3::StaticMobilityModel");
-
-  mobility.Layout (c.Begin (), c.End ());
-
-  PacketSocketAddress destination = PacketSocketAddress ();
-  destination.SetProtocol (1);
-  destination.SetSingleDevice (0);
-  destination.SetPhysicalAddress (devices.Get (1)->GetAddress ());
-  Ptr<Application> app = 
-    CreateObject<OnOffApplication> ("Remote", Address (destination),
-                                    "Protocol", TypeId::LookupByName ("ns3::PacketSocketFactory"),
-                                    "OnTime", ConstantVariable (250),
-                                    "OffTime", ConstantVariable (0),
-                                    "DataRate", DataRate (60000000),
-                                    "PacketSize", Uinteger (2000));
-  c.Get (0)->AddApplication (app);
-
-  app->Start (Seconds (0.5));
-  app->Stop (Seconds (250.0));
-
-  Simulator::Schedule (Seconds (1.5), &Experiment::AdvancePosition, this, c.Get (1));
-  Ptr<Socket> recvSink = SetupPacketReceive (c.Get (1));
-
-  Simulator::Run ();
-
-  Simulator::Destroy ();
-
-  return m_output;
-}
-
-int main (int argc, char *argv[])
-{
-  // disable fragmentation
-  Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", String ("2200"));
-  Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", String ("2200"));
-
-  CommandLine cmd;
-  cmd.Parse (argc, argv);
-
-  Gnuplot gnuplot = Gnuplot ("reference-rates.png");
-
-  Experiment experiment;
-  WifiHelper wifi;
-  GnuplotDataset dataset;
-
-  wifi.SetMac ("ns3::AdhocWifiMac");
-  wifi.SetPhy ("ns3::WifiPhy");
-
-  NS_LOG_DEBUG ("54");
-  experiment = Experiment ("54mb");
-  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
-                                "DataMode", String ("wifia-54mbs"));
-  dataset = experiment.Run (wifi);
-  gnuplot.AddDataset (dataset);
-
-  NS_LOG_DEBUG ("48");
-  experiment = Experiment ("48mb");
-  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
-                                "DataMode", String ("wifia-48mbs"));
-  dataset = experiment.Run (wifi);
-  gnuplot.AddDataset (dataset);
-
-  NS_LOG_DEBUG ("36");
-  experiment = Experiment ("36mb");
-  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
-                                "DataMode", String ("wifia-36mbs"));
-  dataset = experiment.Run (wifi);
-  gnuplot.AddDataset (dataset);
-
-  NS_LOG_DEBUG ("24");
-  experiment = Experiment ("24mb");
-  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
-                                "DataMode", String ("wifia-24mbs"));
-  dataset = experiment.Run (wifi);
-  gnuplot.AddDataset (dataset);
-
-  NS_LOG_DEBUG ("18");
-  experiment = Experiment ("18mb");
-  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
-                                "DataMode", String ("wifia-18mbs"));
-  dataset = experiment.Run (wifi);
-  gnuplot.AddDataset (dataset);
-
-  NS_LOG_DEBUG ("12");
-  experiment = Experiment ("12mb");
-  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
-                                "DataMode", String ("wifia-12mbs"));
-  dataset = experiment.Run (wifi);
-  gnuplot.AddDataset (dataset);
-
-  NS_LOG_DEBUG ("9");
-  experiment = Experiment ("9mb");
-  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
-                                "DataMode", String ("wifia-9mbs"));
-  dataset = experiment.Run (wifi);
-  gnuplot.AddDataset (dataset);
-
-  NS_LOG_DEBUG ("6");
-  experiment = Experiment ("6mb");
-  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
-                                "DataMode", String ("wifia-6mbs"));
-  dataset = experiment.Run (wifi);
-  gnuplot.AddDataset (dataset);
-
-  gnuplot.GenerateOutput (std::cout);
-
-
-
-  gnuplot = Gnuplot ("rate-control.png");
-  Config::SetDefault ("WifiPhy::Standard", String ("holland"));
-
-
-  NS_LOG_DEBUG ("arf");
-  experiment = Experiment ("arf");
-  wifi.SetRemoteStationManager ("ns3::ArfWifiManager");
-  dataset = experiment.Run (wifi);
-  gnuplot.AddDataset (dataset);
-
-  NS_LOG_DEBUG ("aarf");
-  experiment = Experiment ("aarf");
-  wifi.SetRemoteStationManager ("ns3::AarfWifiManager");
-  dataset = experiment.Run (wifi);
-  gnuplot.AddDataset (dataset);
-
-  NS_LOG_DEBUG ("ideal");
-  experiment = Experiment ("ideal");
-  wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
-  dataset = experiment.Run (wifi);
-  gnuplot.AddDataset (dataset);
-
-  gnuplot.GenerateOutput (std::cout);
-
-  return 0;
-}
--- a/samples/main-ap-wifi.cc	Wed Mar 19 12:41:06 2008 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,196 +0,0 @@
-/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2005,2006,2007 INRIA
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-
-
-#include "ns3/simulator.h"
-#include "ns3/callback.h"
-#include "ns3/ptr.h"
-#include "ns3/node.h"
-#include "ns3/onoff-application.h"
-#include "ns3/mobility-helper.h"
-#include "ns3/wifi-helper.h"
-#include "ns3/node-container.h"
-#include "ns3/random-variable.h"
-#include "ns3/packet-socket-address.h"
-#include "ns3/packet.h"
-#include "ns3/node-list.h"
-#include "ns3/ssid.h"
-#include "ns3/wifi-phy.h"
-#include "ns3/mobility-model.h"
-#include "ns3/config.h"
-#include "ns3/string.h"
-#include "ns3/wifi-channel.h"
-#include "ns3/boolean.h"
-#include "ns3/propagation-loss-model.h"
-#include "ns3/propagation-delay-model.h"
-
-
-#include <iostream>
-
-using namespace ns3;
-
-void
-DevTxTrace (std::string context, Ptr<const Packet> p, Mac48Address address)
-{
-  std::cout << " TX to=" << address << " p: " << *p << std::endl;
-}
-void
-DevRxTrace (std::string context, Ptr<const Packet> p, Mac48Address address)
-{
-  std::cout << " RX from=" << address << " p: " << *p << std::endl;
-}
-void
-PhyRxOkTrace (std::string context, Ptr<const Packet> packet, double snr, WifiMode mode, enum WifiPreamble preamble)
-{
-  std::cout << "PHYRXOK mode=" << mode << " snr=" << snr << " " << *packet << std::endl;
-}
-void
-PhyRxErrorTrace (std::string context, Ptr<const Packet> packet, double snr)
-{
-  std::cout << "PHYRXERROR snr=" << snr << " " << *packet << std::endl;
-}
-void
-PhyTxTrace (std::string context, Ptr<const Packet> packet, WifiMode mode, WifiPreamble preamble, uint8_t txPower)
-{
-  std::cout << "PHYTX mode=" << mode << " " << *packet << std::endl;
-}
-void
-PhyStateTrace (std::string context, Time start, Time duration, enum WifiPhy::State state)
-{
-  std::cout << " state=";
-  switch (state) {
-  case WifiPhy::TX:
-    std::cout << "tx      ";
-    break;
-  case WifiPhy::SYNC:
-    std::cout << "sync    ";
-    break;
-  case WifiPhy::CCA_BUSY:
-    std::cout << "cca-busy";
-    break;
-  case WifiPhy::IDLE:
-    std::cout << "idle    ";
-    break;
-  }
-  std::cout << " start="<<start<<" duration="<<duration<<std::endl;
-}
-
-static void
-SetPosition (Ptr<Node> node, Vector position)
-{
-  Ptr<MobilityModel> mobility = node->GetObject<MobilityModel> ();
-  mobility->SetPosition (position);
-}
-
-static Vector
-GetPosition (Ptr<Node> node)
-{
-  Ptr<MobilityModel> mobility = node->GetObject<MobilityModel> ();
-  return mobility->GetPosition ();
-}
-
-static void 
-AdvancePosition (Ptr<Node> node) 
-{
-  Vector pos = GetPosition (node);
-  pos.x += 5.0;
-  if (pos.x >= 210.0) 
-    {
-      return;
-    }
-  SetPosition (node, pos);
-  //std::cout << "x="<<pos.x << std::endl;
-  Simulator::Schedule (Seconds (1.0), &AdvancePosition, node);
-}
-
-
-
-
-int main (int argc, char *argv[])
-{
-  Packet::EnableMetadata ();
-
-  // enable rts cts all the time.
-  Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", String ("0"));
-  // disable fragmentation
-  Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", String ("2200"));
-
-  WifiHelper wifi;
-  MobilityHelper mobility;
-  NodeContainer stas;
-  NodeContainer ap;
-  NetDeviceContainer staDevs;
-
-  stas.Create (2);
-  ap.Create (1);
-
-  Ptr<WifiChannel> channel = CreateObject<WifiChannel> ();
-  channel->SetPropagationDelayModel (CreateObject<ConstantSpeedPropagationDelayModel> ());
-  Ptr<LogDistancePropagationLossModel> log = CreateObject<LogDistancePropagationLossModel> ();
-  log->SetReferenceModel (CreateObject<FriisPropagationLossModel> ());
-  channel->SetPropagationLossModel (log);
-
-  Ssid ssid = Ssid ("wifi-default");
-  wifi.SetPhy ("ns3::WifiPhy");
-  wifi.SetRemoteStationManager ("ns3::ArfWifiManager");
-  // setup ap.
-  wifi.SetMac ("ns3::NqstaWifiMac", "Ssid", ssid,
-               "ActiveProbing", Boolean (false));
-  staDevs = wifi.Build (stas, channel);
-  // setup stas.
-  wifi.SetMac ("ns3::NqapWifiMac", "Ssid", ssid,
-               "BeaconGeneration", Boolean (true),
-               "BeaconInterval", Seconds (2.5));
-  wifi.Build (ap, channel);
-
-  // mobility.
-  mobility.Layout (stas.Begin (), stas.End ());
-  mobility.Layout (ap.Begin (), ap.End ());
-
-  Simulator::Schedule (Seconds (1.0), &AdvancePosition, ap.Get (0));
-
-  PacketSocketAddress destination = PacketSocketAddress ();
-  destination.SetProtocol (1);
-  destination.SetSingleDevice (0);
-  destination.SetPhysicalAddress (staDevs.Get(1)->GetAddress ());
-  Ptr<Application> app = 
-    CreateObject<OnOffApplication> ("Remote", Address (destination), 
-                                    "Protocol", TypeId::LookupByName ("ns3::PacketSocketFactory"),
-                                    "OnTime", ConstantVariable (42),
-                                    "OffTime", ConstantVariable (0));
-  stas.Get (0)->AddApplication (app);
-  app->Start (Seconds (0.5));
-  app->Stop (Seconds (43.0));
-
-  Simulator::StopAt (Seconds (44.0));
-
-  Config::Connect ("/NodeList/*/DeviceList/*/Tx", MakeCallback (&DevTxTrace));
-  Config::Connect ("/NodeList/*/DeviceList/*/Rx", MakeCallback (&DevRxTrace));
-  Config::Connect ("/NodeList/*/DeviceList/*/Phy/RxOk", MakeCallback (&PhyRxOkTrace));
-  Config::Connect ("/NodeList/*/DeviceList/*/Phy/RxError", MakeCallback (&PhyRxErrorTrace));
-  Config::Connect ("/NodeList/*/DeviceList/*/Phy/Tx", MakeCallback (&PhyTxTrace));
-  Config::Connect ("/NodeList/*/DeviceList/*/Phy/State", MakeCallback (&PhyStateTrace));
-
-  Simulator::Run ();
-
-  Simulator::Destroy ();
-
-  return 0;
-}
--- a/samples/wscript	Wed Mar 19 12:41:06 2008 -0700
+++ b/samples/wscript	Wed Mar 19 12:42:54 2008 -0700
@@ -27,14 +27,6 @@
     obj = bld.create_ns3_program('main-random-topology',
                                  ['core', 'simulator', 'mobility'])
     obj.source = 'main-random-topology.cc'
-
-    obj = bld.create_ns3_program('main-adhoc-wifi',
-                                 ['core', 'simulator', 'mobility', 'wifi'])
-    obj.source = 'main-adhoc-wifi.cc'
-
-    obj = bld.create_ns3_program('main-ap-wifi',
-                                 ['core', 'simulator', 'mobility', 'wifi'])
-    obj.source = 'main-ap-wifi.cc'
     
     obj = bld.create_ns3_program('main-random-walk',
                                  ['core', 'simulator', 'mobility'])