examples/wifi-wired-bridging.cc
changeset 4492 3ebeb7bf3c15
parent 4406 39f119de91ef
child 4616 a84f60b6cd12
equal deleted inserted replaced
4491:893d48fcf7f3 4492:3ebeb7bf3c15
    87   stack.Install (backboneNodes);
    87   stack.Install (backboneNodes);
    88 
    88 
    89   backboneDevices = csma.Install (backboneNodes);
    89   backboneDevices = csma.Install (backboneNodes);
    90 
    90 
    91   double wifiX = 0.0;
    91   double wifiX = 0.0;
       
    92 
       
    93   YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
       
    94   wifiPhy.SetPcapFormat(YansWifiPhyHelper::PCAP_FORMAT_80211_RADIOTAP);
       
    95 
    92   for (uint32_t i = 0; i < nWifis; ++i)
    96   for (uint32_t i = 0; i < nWifis; ++i)
    93     {
    97     {
    94       // calculate ssid for wifi subnetwork
    98       // calculate ssid for wifi subnetwork
    95       std::ostringstream oss;
    99       std::ostringstream oss;
    96       oss << "wifi-default-" << i;
   100       oss << "wifi-default-" << i;
   103       Ipv4InterfaceContainer apInterface;
   107       Ipv4InterfaceContainer apInterface;
   104       MobilityHelper mobility;
   108       MobilityHelper mobility;
   105       BridgeHelper bridge;
   109       BridgeHelper bridge;
   106       WifiHelper wifi = WifiHelper::Default ();
   110       WifiHelper wifi = WifiHelper::Default ();
   107       NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
   111       NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
   108       YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
       
   109       YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
   112       YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
   110       wifiPhy.SetChannel (wifiChannel.Create ());
   113       wifiPhy.SetChannel (wifiChannel.Create ());
   111 
   114 
   112       sta.Create (nStas);
   115       sta.Create (nStas);
   113       mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
   116       mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
   180   onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
   183   onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
   181   ApplicationContainer apps = onoff.Install (staNodes[0].Get (0));
   184   ApplicationContainer apps = onoff.Install (staNodes[0].Get (0));
   182   apps.Start (Seconds (0.5));
   185   apps.Start (Seconds (0.5));
   183   apps.Stop (Seconds (3.0));
   186   apps.Stop (Seconds (3.0));
   184   
   187   
   185   YansWifiPhyHelper::EnablePcap ("wifi-wired-bridging", apDevices[0]);
   188   wifiPhy.EnablePcap ("wifi-wired-bridging", apDevices[0]);
   186   YansWifiPhyHelper::EnablePcap ("wifi-wired-bridging", apDevices[1]);
   189   wifiPhy.EnablePcap ("wifi-wired-bridging", apDevices[1]);
   187 
   190 
   188   std::ofstream os;
   191   std::ofstream os;
   189   os.open ("wifi-wired-bridging.mob");
   192   os.open ("wifi-wired-bridging.mob");
   190   MobilityHelper::EnableAsciiAll (os);
   193   MobilityHelper::EnableAsciiAll (os);
   191 
   194