+WifiZone::WifiZone(std::string name_, simgrid::s4u::Host* host_, ns3::Ptr<ns3::Node> ap_node_,
+ ns3::Ptr<ns3::YansWifiChannel> channel_, int mcs_, int nss_, int network_, int link_) :
+ name(name_), host(host_), ap_node(ap_node_), channel(channel_), mcs(mcs_), nss(nss_),
+ network(network_), link(link_) {
+ n_sta_nodes = 0;
+ wifi_zones[name_] = this;
+}
+
+bool WifiZone::is_ap(ns3::Ptr<ns3::Node> node){
+ for (std::pair<std::string, WifiZone*> zone : wifi_zones)
+ if (zone.second->get_ap_node() == node)
+ return true;
+ return false;
+}
+
+WifiZone* WifiZone::by_name(std::string name) {
+ WifiZone* zone;
+ try {
+ zone = wifi_zones.at(name);
+ }
+ catch (const std::out_of_range& oor) {
+ return nullptr;
+ }
+ return zone;
+}
+
+std::unordered_map<std::string, WifiZone*> WifiZone::wifi_zones;
+
+static void initialize_ns3_wifi() {
+ wifi.SetStandard (ns3::WIFI_PHY_STANDARD_80211n_5GHZ);
+
+ for (auto host : simgrid::s4u::Engine::get_instance()->get_all_hosts()) {
+ const char* wifi_link = host->get_property("wifi_link");
+ const char* wifi_mcs = host->get_property("wifi_mcs");
+ const char* wifi_nss = host->get_property("wifi_nss");
+
+ if (wifi_link)
+ new WifiZone(wifi_link, host, host->get_netpoint()->extension<NetPointNs3>()->ns3_node_,
+ wifiChannel.Create(), wifi_mcs ? atoi(wifi_mcs) : 3, wifi_nss ? atoi(wifi_nss) : 1, 0, 0);
+ }
+}
+