examples/mesh.cc
changeset 4855 0b5980b04249
parent 4852 123dc54d734e
child 4858 78437693dcc7
equal deleted inserted replaced
4854:3885ae41abf3 4855:0b5980b04249
    61   wifiPhy.SetChannel (wifiChannel.Create ());
    61   wifiPhy.SetChannel (wifiChannel.Create ());
    62   // Setting Wifi:
    62   // Setting Wifi:
    63   //wifi.SetPhy ("ns3::WifiPhy");
    63   //wifi.SetPhy ("ns3::WifiPhy");
    64   wifi.SetRemoteStationManager ("ns3::AarfWifiManager");
    64   wifi.SetRemoteStationManager ("ns3::AarfWifiManager");
    65   Ssid ssid = Ssid ("MyMeSH");
    65   Ssid ssid = Ssid ("MyMeSH");
    66   wifi.SetMac ("ns3::MeshWifiMac",
    66   wifi.SetMac ("ns3::MeshWifiInterfaceMac",
    67                "Ssid", SsidValue (ssid),
    67                "Ssid", SsidValue (ssid),
    68                "RandomStart", TimeValue (Seconds (randomStart))
    68                "RandomStart", TimeValue (Seconds (randomStart))
    69               );
    69               );
    70   wifi.SetPeerLinkManager ("ns3::WifiPeerManager");
       
    71   wifi.SetL2RoutingProtocol ("ns3::Hwmp");
       
    72   wifi.SetL2RoutingNetDevice ("ns3::MeshPointDevice");
    70   wifi.SetL2RoutingNetDevice ("ns3::MeshPointDevice");
    73   meshDevices = wifi.Install (wifiPhy,nodes,1);
    71   meshDevices = wifi.Install (wifiPhy,nodes);
    74   // Installing Mobility.
    72   // Installing Mobility.
    75   mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
    73   mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
    76                                  "MinX", DoubleValue (0.0),
    74                                  "MinX", DoubleValue (0.0),
    77                                  "MinY", DoubleValue (0.0),
    75                                  "MinY", DoubleValue (0.0),
    78                                  "DeltaX", DoubleValue (step),
    76                                  "DeltaX", DoubleValue (step),
    79                                  "DeltaY", DoubleValue (step),
    77                                  "DeltaY", DoubleValue (step),
    80                                  "GridWidth", UintegerValue (xSize),
    78                                  "GridWidth", UintegerValue (xSize),
    81                                  "LayoutType", StringValue ("RowFirst"));
    79                                  "LayoutType", StringValue ("RowFirst"));
    82   mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
    80   mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
    83   mobility.Install (nodes);
    81   mobility.Install (nodes);
       
    82 #if 0
    84   // Setting Internet Stack:
    83   // Setting Internet Stack:
    85   InternetStackHelper stack;
    84   InternetStackHelper stack;
    86   stack.Install (nodes);
    85   stack.Install (nodes);
    87   Ipv4AddressHelper address;
    86   Ipv4AddressHelper address;
    88   address.SetBase ("10.1.1.0", "255.255.255.0");
    87   address.SetBase ("10.1.1.0", "255.255.255.0");
    97   echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
    96   echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
    98   ApplicationContainer clientApps = echoClient.Install (nodes.Get (1));
    97   ApplicationContainer clientApps = echoClient.Install (nodes.Get (1));
    99   clientApps.Start (Seconds (2.0));
    98   clientApps.Start (Seconds (2.0));
   100   clientApps.Stop (Seconds (10.0));
    99   clientApps.Stop (Seconds (10.0));
   101   //end
   100   //end
       
   101 #endif
   102   Simulator::Stop (Seconds (10.0));
   102   Simulator::Stop (Seconds (10.0));
   103   Simulator::Run ();
   103   Simulator::Run ();
   104   Simulator::Destroy ();
   104   Simulator::Destroy ();
   105   return 0;
   105   return 0;
   106 }
   106 }