Remove stray ^M that snuck into examples
authorCraig Dowell <craigdo@ee.washington.edu>
Tue, 09 Dec 2008 10:28:44 -0800
changeset 39946cc096bc0761
parent 3993 cac6551f95eb
child 3995 9bda1a9c0eb2
Remove stray ^M that snuck into examples
examples/second.cc
examples/third.cc
     1.1 --- a/examples/second.cc	Mon Dec 08 22:06:17 2008 -0800
     1.2 +++ b/examples/second.cc	Tue Dec 09 10:28:44 2008 -0800
     1.3 @@ -1,102 +1,102 @@
     1.4 -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
     1.5 -/*
     1.6 - * This program is free software; you can redistribute it and/or modify
     1.7 - * it under the terms of the GNU General Public License version 2 as
     1.8 - * published by the Free Software Foundation;
     1.9 - *
    1.10 - * This program is distributed in the hope that it will be useful,
    1.11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.13 - * GNU General Public License for more details.
    1.14 - *
    1.15 - * You should have received a copy of the GNU General Public License
    1.16 - * along with this program; if not, write to the Free Software
    1.17 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1.18 - */
    1.19 -
    1.20 -#include "ns3/core-module.h"
    1.21 -#include "ns3/simulator-module.h"
    1.22 -#include "ns3/node-module.h"
    1.23 -#include "ns3/helper-module.h"
    1.24 -#include "ns3/global-routing-module.h"
    1.25 -
    1.26 -// Default Network Topology
    1.27 -//
    1.28 -//       10.1.1.0
    1.29 -// n0 -------------- n1   n2   n3   n4
    1.30 -//    point-to-point  |    |    |    |
    1.31 -//                    ================
    1.32 -//                      LAN 10.1.2.0
    1.33 -
    1.34 -
    1.35 -using namespace ns3;
    1.36 -
    1.37 -NS_LOG_COMPONENT_DEFINE ("SecondScriptExample");
    1.38 -
    1.39 -int 
    1.40 -main (int argc, char *argv[])
    1.41 -{
    1.42 -  LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO);
    1.43 -  LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO);
    1.44 -
    1.45 -  uint32_t nCsma = 3;
    1.46 -  CommandLine cmd;
    1.47 -  cmd.AddValue ("nCsma", "Number of \"extra\" CSMA nodes/devices", nCsma);
    1.48 -  cmd.Parse (argc,argv);
    1.49 -
    1.50 -  NodeContainer p2pNodes;
    1.51 -  p2pNodes.Create (2);
    1.52 -
    1.53 -  NodeContainer csmaNodes;
    1.54 -  csmaNodes.Add (p2pNodes.Get (1));
    1.55 -  csmaNodes.Create (nCsma);
    1.56 -
    1.57 -  PointToPointHelper pointToPoint;
    1.58 -  pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
    1.59 -  pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms"));
    1.60 -
    1.61 -  NetDeviceContainer p2pDevices;
    1.62 -  p2pDevices = pointToPoint.Install (p2pNodes);
    1.63 -
    1.64 -  CsmaHelper csma;
    1.65 -
    1.66 -  NetDeviceContainer csmaDevices;
    1.67 -  csmaDevices = csma.Install (csmaNodes);
    1.68 -
    1.69 -  InternetStackHelper stack;
    1.70 -  stack.Install (p2pNodes.Get (0));
    1.71 -  stack.Install (csmaNodes);
    1.72 -
    1.73 -  Ipv4AddressHelper address;
    1.74 -  address.SetBase ("10.1.1.0", "255.255.255.0");
    1.75 -  Ipv4InterfaceContainer p2pInterfaces;
    1.76 -  p2pInterfaces = address.Assign (p2pDevices);
    1.77 -
    1.78 -  address.SetBase ("10.1.2.0", "255.255.255.0");
    1.79 -  Ipv4InterfaceContainer csmaInterfaces;
    1.80 -  csmaInterfaces = address.Assign (csmaDevices);
    1.81 -
    1.82 -  UdpEchoServerHelper echoServer (9);
    1.83 -
    1.84 -  ApplicationContainer serverApps = echoServer.Install (csmaNodes.Get (nCsma));
    1.85 -  serverApps.Start (Seconds (1.0));
    1.86 -  serverApps.Stop (Seconds (10.0));
    1.87 -
    1.88 -  UdpEchoClientHelper echoClient (csmaInterfaces.GetAddress (nCsma), 9);
    1.89 -  echoClient.SetAttribute ("MaxPackets", UintegerValue (1));
    1.90 -  echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.)));
    1.91 -  echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
    1.92 -
    1.93 -  ApplicationContainer clientApps = echoClient.Install (p2pNodes.Get (0));
    1.94 -  clientApps.Start (Seconds (2.0));
    1.95 -  clientApps.Stop (Seconds (10.0));
    1.96 -
    1.97 -  GlobalRouteManager::PopulateRoutingTables ();
    1.98 -
    1.99 -  PointToPointHelper::EnablePcapAll ("second");
   1.100 -  CsmaHelper::EnablePcapAll ("second");
   1.101 -
   1.102 -  Simulator::Run ();
   1.103 -  Simulator::Destroy ();
   1.104 -  return 0;
   1.105 -}
   1.106 +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
   1.107 +/*
   1.108 + * This program is free software; you can redistribute it and/or modify
   1.109 + * it under the terms of the GNU General Public License version 2 as
   1.110 + * published by the Free Software Foundation;
   1.111 + *
   1.112 + * This program is distributed in the hope that it will be useful,
   1.113 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
   1.114 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   1.115 + * GNU General Public License for more details.
   1.116 + *
   1.117 + * You should have received a copy of the GNU General Public License
   1.118 + * along with this program; if not, write to the Free Software
   1.119 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   1.120 + */
   1.121 +
   1.122 +#include "ns3/core-module.h"
   1.123 +#include "ns3/simulator-module.h"
   1.124 +#include "ns3/node-module.h"
   1.125 +#include "ns3/helper-module.h"
   1.126 +#include "ns3/global-routing-module.h"
   1.127 +
   1.128 +// Default Network Topology
   1.129 +//
   1.130 +//       10.1.1.0
   1.131 +// n0 -------------- n1   n2   n3   n4
   1.132 +//    point-to-point  |    |    |    |
   1.133 +//                    ================
   1.134 +//                      LAN 10.1.2.0
   1.135 +
   1.136 +
   1.137 +using namespace ns3;
   1.138 +
   1.139 +NS_LOG_COMPONENT_DEFINE ("SecondScriptExample");
   1.140 +
   1.141 +int 
   1.142 +main (int argc, char *argv[])
   1.143 +{
   1.144 +  LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO);
   1.145 +  LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO);
   1.146 +
   1.147 +  uint32_t nCsma = 3;
   1.148 +  CommandLine cmd;
   1.149 +  cmd.AddValue ("nCsma", "Number of \"extra\" CSMA nodes/devices", nCsma);
   1.150 +  cmd.Parse (argc,argv);
   1.151 +
   1.152 +  NodeContainer p2pNodes;
   1.153 +  p2pNodes.Create (2);
   1.154 +
   1.155 +  NodeContainer csmaNodes;
   1.156 +  csmaNodes.Add (p2pNodes.Get (1));
   1.157 +  csmaNodes.Create (nCsma);
   1.158 +
   1.159 +  PointToPointHelper pointToPoint;
   1.160 +  pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
   1.161 +  pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms"));
   1.162 +
   1.163 +  NetDeviceContainer p2pDevices;
   1.164 +  p2pDevices = pointToPoint.Install (p2pNodes);
   1.165 +
   1.166 +  CsmaHelper csma;
   1.167 +
   1.168 +  NetDeviceContainer csmaDevices;
   1.169 +  csmaDevices = csma.Install (csmaNodes);
   1.170 +
   1.171 +  InternetStackHelper stack;
   1.172 +  stack.Install (p2pNodes.Get (0));
   1.173 +  stack.Install (csmaNodes);
   1.174 +
   1.175 +  Ipv4AddressHelper address;
   1.176 +  address.SetBase ("10.1.1.0", "255.255.255.0");
   1.177 +  Ipv4InterfaceContainer p2pInterfaces;
   1.178 +  p2pInterfaces = address.Assign (p2pDevices);
   1.179 +
   1.180 +  address.SetBase ("10.1.2.0", "255.255.255.0");
   1.181 +  Ipv4InterfaceContainer csmaInterfaces;
   1.182 +  csmaInterfaces = address.Assign (csmaDevices);
   1.183 +
   1.184 +  UdpEchoServerHelper echoServer (9);
   1.185 +
   1.186 +  ApplicationContainer serverApps = echoServer.Install (csmaNodes.Get (nCsma));
   1.187 +  serverApps.Start (Seconds (1.0));
   1.188 +  serverApps.Stop (Seconds (10.0));
   1.189 +
   1.190 +  UdpEchoClientHelper echoClient (csmaInterfaces.GetAddress (nCsma), 9);
   1.191 +  echoClient.SetAttribute ("MaxPackets", UintegerValue (1));
   1.192 +  echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.)));
   1.193 +  echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
   1.194 +
   1.195 +  ApplicationContainer clientApps = echoClient.Install (p2pNodes.Get (0));
   1.196 +  clientApps.Start (Seconds (2.0));
   1.197 +  clientApps.Stop (Seconds (10.0));
   1.198 +
   1.199 +  GlobalRouteManager::PopulateRoutingTables ();
   1.200 +
   1.201 +  PointToPointHelper::EnablePcapAll ("second");
   1.202 +  CsmaHelper::EnablePcapAll ("second");
   1.203 +
   1.204 +  Simulator::Run ();
   1.205 +  Simulator::Destroy ();
   1.206 +  return 0;
   1.207 +}
     2.1 --- a/examples/third.cc	Mon Dec 08 22:06:17 2008 -0800
     2.2 +++ b/examples/third.cc	Tue Dec 09 10:28:44 2008 -0800
     2.3 @@ -1,172 +1,172 @@
     2.4 -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
     2.5 -/*
     2.6 - * This program is free software; you can redistribute it and/or modify
     2.7 - * it under the terms of the GNU General Public License version 2 as
     2.8 - * published by the Free Software Foundation;
     2.9 - *
    2.10 - * This program is distributed in the hope that it will be useful,
    2.11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    2.12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2.13 - * GNU General Public License for more details.
    2.14 - *
    2.15 - * You should have received a copy of the GNU General Public License
    2.16 - * along with this program; if not, write to the Free Software
    2.17 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    2.18 - */
    2.19 -
    2.20 -#include "ns3/core-module.h"
    2.21 -#include "ns3/simulator-module.h"
    2.22 -#include "ns3/node-module.h"
    2.23 -#include "ns3/helper-module.h"
    2.24 -#include "ns3/global-routing-module.h"
    2.25 -#include "ns3/wifi-module.h"
    2.26 -#include "ns3/mobility-module.h"
    2.27 -
    2.28 -// Default Network Topology
    2.29 -//
    2.30 -//   Wifi 10.1.3.0
    2.31 -//                 AP   
    2.32 -//  *    *    *    *
    2.33 -//  |    |    |    |    10.1.1.0
    2.34 -// n5   n6   n7   n0 -------------- n1   n2   n3   n4
    2.35 -//                   point-to-point  |    |    |    |
    2.36 -//                                   ================
    2.37 -//                                     LAN 10.1.2.0
    2.38 -
    2.39 -using namespace ns3;
    2.40 -
    2.41 -NS_LOG_COMPONENT_DEFINE ("ThirdScriptExample");
    2.42 -
    2.43 -int 
    2.44 -main (int argc, char *argv[])
    2.45 -{
    2.46 -  LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO);
    2.47 -  LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO);
    2.48 -
    2.49 -  uint32_t nCsma = 3;
    2.50 -  uint32_t nWifi = 3;
    2.51 -  CommandLine cmd;
    2.52 -  cmd.AddValue ("nCsma", "Number of \"extra\" CSMA nodes/devices", nCsma);
    2.53 -  cmd.AddValue ("nWifi", "Number of wifi STA devices", nWifi);
    2.54 -  cmd.Parse (argc,argv);
    2.55 -
    2.56 -  NodeContainer p2pNodes;
    2.57 -  p2pNodes.Create (2);
    2.58 -
    2.59 -  PointToPointHelper pointToPoint;
    2.60 -  pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
    2.61 -  pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms"));
    2.62 -
    2.63 -  NetDeviceContainer p2pDevices;
    2.64 -  p2pDevices = pointToPoint.Install (p2pNodes);
    2.65 -
    2.66 -  NodeContainer csmaNodes;
    2.67 -  csmaNodes.Add (p2pNodes.Get (1));
    2.68 -  csmaNodes.Create (nCsma);
    2.69 -
    2.70 -  CsmaHelper csma;
    2.71 -
    2.72 -  NetDeviceContainer csmaDevices;
    2.73 -  csmaDevices = csma.Install (csmaNodes);
    2.74 -
    2.75 -  NodeContainer wifiStaNodes;
    2.76 -  wifiStaNodes.Create (nWifi);
    2.77 -  NodeContainer wifiApNode = p2pNodes.Get (0);
    2.78 -
    2.79 -  Ptr<WifiChannel> channel = CreateObject<WifiChannel> ();
    2.80 -
    2.81 -  channel->SetPropagationDelayModel (
    2.82 -    CreateObject<ConstantSpeedPropagationDelayModel> ());
    2.83 -
    2.84 -  Ptr<LogDistancePropagationLossModel> log = 
    2.85 -    CreateObject<LogDistancePropagationLossModel> ();
    2.86 -
    2.87 -  log->SetReferenceModel (CreateObject<FriisPropagationLossModel> ());
    2.88 -
    2.89 -  channel->SetPropagationLossModel (log);
    2.90 -
    2.91 -  WifiHelper wifi;
    2.92 -  wifi.SetPhy ("ns3::WifiPhy");
    2.93 -  wifi.SetRemoteStationManager ("ns3::ArfWifiManager");
    2.94 -
    2.95 -  Ssid ssid = Ssid ("ns-3-ssid");
    2.96 -  wifi.SetMac ("ns3::NqstaWifiMac", 
    2.97 -    "Ssid", SsidValue (ssid),
    2.98 -    "ActiveProbing", BooleanValue (false));
    2.99 -
   2.100 -  NetDeviceContainer staDevices;
   2.101 -  staDevices = wifi.Install (wifiStaNodes, channel);
   2.102 -
   2.103 -  wifi.SetMac ("ns3::NqapWifiMac", 
   2.104 -    "Ssid", SsidValue (ssid),
   2.105 -    "BeaconGeneration", BooleanValue (true),
   2.106 -    "BeaconInterval", TimeValue (Seconds (2.5)));
   2.107 -
   2.108 -  NetDeviceContainer apDevices;
   2.109 -  apDevices = wifi.Install (wifiApNode, channel);
   2.110 -
   2.111 -  MobilityHelper mobility;
   2.112 -
   2.113 -  mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
   2.114 -    "MinX", DoubleValue (0.0),
   2.115 -    "MinY", DoubleValue (0.0),
   2.116 -    "DeltaX", DoubleValue (5.0),
   2.117 -    "DeltaY", DoubleValue (10.0),
   2.118 -    "GridWidth", UintegerValue (3),
   2.119 -    "LayoutType", StringValue ("RowFirst"));
   2.120 -
   2.121 -  mobility.SetMobilityModel ("ns3::RandomWalk2dMobilityModel",
   2.122 -    "Bounds", RectangleValue (Rectangle (-50, 50, -50, 50)));
   2.123 -  mobility.Install (wifiStaNodes);
   2.124 -
   2.125 -  mobility.SetMobilityModel ("ns3::StaticMobilityModel");
   2.126 -  mobility.Install (wifiApNode);
   2.127 -
   2.128 -  InternetStackHelper stack;
   2.129 -  stack.Install (csmaNodes);
   2.130 -  stack.Install (wifiApNode);
   2.131 -  stack.Install (wifiStaNodes);
   2.132 -
   2.133 -  Ipv4AddressHelper address;
   2.134 -
   2.135 -  address.SetBase ("10.1.1.0", "255.255.255.0");
   2.136 -  Ipv4InterfaceContainer p2pInterfaces;
   2.137 -  p2pInterfaces = address.Assign (p2pDevices);
   2.138 -
   2.139 -  address.SetBase ("10.1.2.0", "255.255.255.0");
   2.140 -  Ipv4InterfaceContainer csmaInterfaces;
   2.141 -  csmaInterfaces = address.Assign (csmaDevices);
   2.142 -
   2.143 -  address.SetBase ("10.1.3.0", "255.255.255.0");
   2.144 -  address.Assign (staDevices);
   2.145 -  address.Assign (apDevices);
   2.146 -
   2.147 -  UdpEchoServerHelper echoServer (9);
   2.148 -
   2.149 -  ApplicationContainer serverApps = echoServer.Install (csmaNodes.Get (nCsma));
   2.150 -  serverApps.Start (Seconds (1.0));
   2.151 -  serverApps.Stop (Seconds (10.0));
   2.152 -
   2.153 -  UdpEchoClientHelper echoClient (csmaInterfaces.GetAddress (nCsma), 9);
   2.154 -  echoClient.SetAttribute ("MaxPackets", UintegerValue (1));
   2.155 -  echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.)));
   2.156 -  echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
   2.157 -
   2.158 -  ApplicationContainer clientApps = 
   2.159 -    echoClient.Install (wifiStaNodes.Get (nWifi - 1));
   2.160 -  clientApps.Start (Seconds (2.0));
   2.161 -  clientApps.Stop (Seconds (10.0));
   2.162 -
   2.163 -  GlobalRouteManager::PopulateRoutingTables ();
   2.164 -
   2.165 -  Simulator::Stop (Seconds (10.0));
   2.166 -
   2.167 -  WifiHelper::EnablePcap ("third", 
   2.168 -    wifiStaNodes.Get (nWifi - 1)->GetId (), 0);
   2.169 -  CsmaHelper::EnablePcap ("third", 
   2.170 -    csmaNodes.Get (nCsma)->GetId (), 0);
   2.171 -
   2.172 -  Simulator::Run ();
   2.173 -  Simulator::Destroy ();
   2.174 -  return 0;
   2.175 -}
   2.176 +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
   2.177 +/*
   2.178 + * This program is free software; you can redistribute it and/or modify
   2.179 + * it under the terms of the GNU General Public License version 2 as
   2.180 + * published by the Free Software Foundation;
   2.181 + *
   2.182 + * This program is distributed in the hope that it will be useful,
   2.183 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
   2.184 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   2.185 + * GNU General Public License for more details.
   2.186 + *
   2.187 + * You should have received a copy of the GNU General Public License
   2.188 + * along with this program; if not, write to the Free Software
   2.189 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   2.190 + */
   2.191 +
   2.192 +#include "ns3/core-module.h"
   2.193 +#include "ns3/simulator-module.h"
   2.194 +#include "ns3/node-module.h"
   2.195 +#include "ns3/helper-module.h"
   2.196 +#include "ns3/global-routing-module.h"
   2.197 +#include "ns3/wifi-module.h"
   2.198 +#include "ns3/mobility-module.h"
   2.199 +
   2.200 +// Default Network Topology
   2.201 +//
   2.202 +//   Wifi 10.1.3.0
   2.203 +//                 AP   
   2.204 +//  *    *    *    *
   2.205 +//  |    |    |    |    10.1.1.0
   2.206 +// n5   n6   n7   n0 -------------- n1   n2   n3   n4
   2.207 +//                   point-to-point  |    |    |    |
   2.208 +//                                   ================
   2.209 +//                                     LAN 10.1.2.0
   2.210 +
   2.211 +using namespace ns3;
   2.212 +
   2.213 +NS_LOG_COMPONENT_DEFINE ("ThirdScriptExample");
   2.214 +
   2.215 +int 
   2.216 +main (int argc, char *argv[])
   2.217 +{
   2.218 +  LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO);
   2.219 +  LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO);
   2.220 +
   2.221 +  uint32_t nCsma = 3;
   2.222 +  uint32_t nWifi = 3;
   2.223 +  CommandLine cmd;
   2.224 +  cmd.AddValue ("nCsma", "Number of \"extra\" CSMA nodes/devices", nCsma);
   2.225 +  cmd.AddValue ("nWifi", "Number of wifi STA devices", nWifi);
   2.226 +  cmd.Parse (argc,argv);
   2.227 +
   2.228 +  NodeContainer p2pNodes;
   2.229 +  p2pNodes.Create (2);
   2.230 +
   2.231 +  PointToPointHelper pointToPoint;
   2.232 +  pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
   2.233 +  pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms"));
   2.234 +
   2.235 +  NetDeviceContainer p2pDevices;
   2.236 +  p2pDevices = pointToPoint.Install (p2pNodes);
   2.237 +
   2.238 +  NodeContainer csmaNodes;
   2.239 +  csmaNodes.Add (p2pNodes.Get (1));
   2.240 +  csmaNodes.Create (nCsma);
   2.241 +
   2.242 +  CsmaHelper csma;
   2.243 +
   2.244 +  NetDeviceContainer csmaDevices;
   2.245 +  csmaDevices = csma.Install (csmaNodes);
   2.246 +
   2.247 +  NodeContainer wifiStaNodes;
   2.248 +  wifiStaNodes.Create (nWifi);
   2.249 +  NodeContainer wifiApNode = p2pNodes.Get (0);
   2.250 +
   2.251 +  Ptr<WifiChannel> channel = CreateObject<WifiChannel> ();
   2.252 +
   2.253 +  channel->SetPropagationDelayModel (
   2.254 +    CreateObject<ConstantSpeedPropagationDelayModel> ());
   2.255 +
   2.256 +  Ptr<LogDistancePropagationLossModel> log = 
   2.257 +    CreateObject<LogDistancePropagationLossModel> ();
   2.258 +
   2.259 +  log->SetReferenceModel (CreateObject<FriisPropagationLossModel> ());
   2.260 +
   2.261 +  channel->SetPropagationLossModel (log);
   2.262 +
   2.263 +  WifiHelper wifi;
   2.264 +  wifi.SetPhy ("ns3::WifiPhy");
   2.265 +  wifi.SetRemoteStationManager ("ns3::ArfWifiManager");
   2.266 +
   2.267 +  Ssid ssid = Ssid ("ns-3-ssid");
   2.268 +  wifi.SetMac ("ns3::NqstaWifiMac", 
   2.269 +    "Ssid", SsidValue (ssid),
   2.270 +    "ActiveProbing", BooleanValue (false));
   2.271 +
   2.272 +  NetDeviceContainer staDevices;
   2.273 +  staDevices = wifi.Install (wifiStaNodes, channel);
   2.274 +
   2.275 +  wifi.SetMac ("ns3::NqapWifiMac", 
   2.276 +    "Ssid", SsidValue (ssid),
   2.277 +    "BeaconGeneration", BooleanValue (true),
   2.278 +    "BeaconInterval", TimeValue (Seconds (2.5)));
   2.279 +
   2.280 +  NetDeviceContainer apDevices;
   2.281 +  apDevices = wifi.Install (wifiApNode, channel);
   2.282 +
   2.283 +  MobilityHelper mobility;
   2.284 +
   2.285 +  mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
   2.286 +    "MinX", DoubleValue (0.0),
   2.287 +    "MinY", DoubleValue (0.0),
   2.288 +    "DeltaX", DoubleValue (5.0),
   2.289 +    "DeltaY", DoubleValue (10.0),
   2.290 +    "GridWidth", UintegerValue (3),
   2.291 +    "LayoutType", StringValue ("RowFirst"));
   2.292 +
   2.293 +  mobility.SetMobilityModel ("ns3::RandomWalk2dMobilityModel",
   2.294 +    "Bounds", RectangleValue (Rectangle (-50, 50, -50, 50)));
   2.295 +  mobility.Install (wifiStaNodes);
   2.296 +
   2.297 +  mobility.SetMobilityModel ("ns3::StaticMobilityModel");
   2.298 +  mobility.Install (wifiApNode);
   2.299 +
   2.300 +  InternetStackHelper stack;
   2.301 +  stack.Install (csmaNodes);
   2.302 +  stack.Install (wifiApNode);
   2.303 +  stack.Install (wifiStaNodes);
   2.304 +
   2.305 +  Ipv4AddressHelper address;
   2.306 +
   2.307 +  address.SetBase ("10.1.1.0", "255.255.255.0");
   2.308 +  Ipv4InterfaceContainer p2pInterfaces;
   2.309 +  p2pInterfaces = address.Assign (p2pDevices);
   2.310 +
   2.311 +  address.SetBase ("10.1.2.0", "255.255.255.0");
   2.312 +  Ipv4InterfaceContainer csmaInterfaces;
   2.313 +  csmaInterfaces = address.Assign (csmaDevices);
   2.314 +
   2.315 +  address.SetBase ("10.1.3.0", "255.255.255.0");
   2.316 +  address.Assign (staDevices);
   2.317 +  address.Assign (apDevices);
   2.318 +
   2.319 +  UdpEchoServerHelper echoServer (9);
   2.320 +
   2.321 +  ApplicationContainer serverApps = echoServer.Install (csmaNodes.Get (nCsma));
   2.322 +  serverApps.Start (Seconds (1.0));
   2.323 +  serverApps.Stop (Seconds (10.0));
   2.324 +
   2.325 +  UdpEchoClientHelper echoClient (csmaInterfaces.GetAddress (nCsma), 9);
   2.326 +  echoClient.SetAttribute ("MaxPackets", UintegerValue (1));
   2.327 +  echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.)));
   2.328 +  echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
   2.329 +
   2.330 +  ApplicationContainer clientApps = 
   2.331 +    echoClient.Install (wifiStaNodes.Get (nWifi - 1));
   2.332 +  clientApps.Start (Seconds (2.0));
   2.333 +  clientApps.Stop (Seconds (10.0));
   2.334 +
   2.335 +  GlobalRouteManager::PopulateRoutingTables ();
   2.336 +
   2.337 +  Simulator::Stop (Seconds (10.0));
   2.338 +
   2.339 +  WifiHelper::EnablePcap ("third", 
   2.340 +    wifiStaNodes.Get (nWifi - 1)->GetId (), 0);
   2.341 +  CsmaHelper::EnablePcap ("third", 
   2.342 +    csmaNodes.Get (nCsma)->GetId (), 0);
   2.343 +
   2.344 +  Simulator::Run ();
   2.345 +  Simulator::Destroy ();
   2.346 +  return 0;
   2.347 +}