- /* If wifi, create the wifizone now. If not, don't do anything: the links will be created in routeCreate_cb */
-
- if (policy == simgrid::s4u::Link::SharingPolicy::WIFI) {
- static bool wifi_init = false;
- if (!wifi_init) {
- initialize_ns3_wifi();
- wifi_init = true;
- }
-
- ns3::NetDeviceContainer netA;
- WifiZone* zone = WifiZone::by_name(name);
- xbt_assert(zone != nullptr, "Link name '%s' does not match the 'wifi_link' property of a host.", name.c_str());
- auto* netpoint_ns3 = zone->get_host()->get_netpoint()->extension<NetPointNs3>();
-
- wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager", "ControlMode", ns3::StringValue("HtMcs0"), "DataMode",
- ns3::StringValue("HtMcs" + std::to_string(zone->get_mcs())));
-
- wifiPhy.SetChannel(zone->get_channel());
- wifiPhy.Set("Antennas", ns3::UintegerValue(zone->get_nss()));
- wifiPhy.Set("MaxSupportedTxSpatialStreams", ns3::UintegerValue(zone->get_nss()));
- wifiPhy.Set("MaxSupportedRxSpatialStreams", ns3::UintegerValue(zone->get_nss()));
-
- wifiMac.SetType("ns3::ApWifiMac",
- "Ssid", ns3::SsidValue(name));
-
- netA.Add(wifi.Install(wifiPhy, wifiMac, zone->get_ap_node()));
-
- ns3::Ptr<ns3::ListPositionAllocator> positionAllocS = ns3::CreateObject<ns3::ListPositionAllocator>();
- positionAllocS->Add(ns3::Vector(0, 0, 0));
- mobility.SetPositionAllocator(positionAllocS);
- mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
- mobility.Install(zone->get_ap_node());
-
- ns3::Ipv4AddressHelper address;
- std::string addr = simgrid::xbt::string_printf("%d.%d.0.0", number_of_networks, number_of_links);
- address.SetBase(addr.c_str(), "255.255.0.0");
- XBT_DEBUG("\tInterface stack '%s'", addr.c_str());
- auto addresses = address.Assign(netA);
- zone->set_network(number_of_networks);
- zone->set_link(number_of_links);
-
- netpoint_ns3->ipv4_address_ = transformIpv4Address(addresses.GetAddress(1));
-
- if (number_of_links == 255) {
- xbt_assert(number_of_networks < 255, "Number of links and networks exceed 255*255");
- number_of_links = 1;
- number_of_networks++;
- } else {
- number_of_links++;
- }
- }