+WifiZone::WifiZone(std::string name_, simgrid::s4u::Host* host_, ns3::Ptr<ns3::Node> ap_node_,
+ ns3::Ptr<ns3::YansWifiChannel> channel_, int network_, int link_) :
+ name(name_), host(host_), ap_node(ap_node_), channel(channel_), network(network_), link(link_){
+ n_sta_nodes = 0;
+ wifi_zones[name_] = this;
+}
+
+const char* WifiZone::get_cname() {
+ return name.c_str();
+}
+
+simgrid::s4u::Host* WifiZone::get_host(){
+ return host;
+}
+
+ns3::Ptr<ns3::Node> WifiZone::get_ap_node() {
+ return ap_node;
+}
+
+ns3::Ptr<ns3::YansWifiChannel> WifiZone::get_channel() {
+ return channel;
+}
+
+int WifiZone::get_network() {
+ return network;
+}
+
+int WifiZone::get_link() {
+ return link;
+}
+
+int WifiZone::get_n_sta_nodes() {
+ return n_sta_nodes;
+}
+
+void WifiZone::set_ap_node(ns3::Ptr<ns3::Node> ap_node_) {
+ ap_node = ap_node_;
+}
+
+void WifiZone::set_network(int network_) {
+ network = network_;
+}
+
+void WifiZone::set_link(int link_) {
+ link = link_;
+}
+
+void WifiZone::add_sta_node() {
+ n_sta_nodes++;
+}
+
+bool WifiZone::is_ap(ns3::Ptr<ns3::Node> ap){
+ for (std::pair<std::string, WifiZone*> zone : wifi_zones)
+ if (zone.second->get_ap_node() == ap)
+ 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);
+ wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
+ "ControlMode", ns3::StringValue ("HtMcs0"),
+ "DataMode", ns3::StringValue ("HtMcs3"));
+
+ std::vector <simgrid::s4u::Host*> hosts = simgrid::s4u::Engine::get_instance()->get_all_hosts();
+ for (auto host : hosts)
+ if (host->get_property("cell"))
+ new WifiZone(host->get_property("cell"), host, nullptr, wifiChannel.Create (), 0, 0);
+}
+