diff options
Diffstat (limited to 'emu-radio/wifi-emulator')
-rw-r--r-- | emu-radio/wifi-emulator/CMakeLists.txt | 34 | ||||
-rw-r--r-- | emu-radio/wifi-emulator/src/wifi-emulator.cc | 338 | ||||
-rw-r--r-- | emu-radio/wifi-emulator/src/wifi-emulator.h | 124 | ||||
-rw-r--r-- | emu-radio/wifi-emulator/src/wifi_main.cc | 152 |
4 files changed, 648 insertions, 0 deletions
diff --git a/emu-radio/wifi-emulator/CMakeLists.txt b/emu-radio/wifi-emulator/CMakeLists.txt new file mode 100644 index 00000000..f1b58902 --- /dev/null +++ b/emu-radio/wifi-emulator/CMakeLists.txt @@ -0,0 +1,34 @@ +# Copyright (c) 2017 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +cmake_minimum_required(VERSION 3.4) +project(wifi_emulator) + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + +pkg_search_module(NS3-wifi REQUIRED libns3.26-wifi-optimized libns3.26-wifi libns3.26-wifi-debug libns3.25-wifi-optimized libns3.25-wifi libns3.25-wifi-debug libns3.24.1-wifi-optimized libns3.24.1-wifi libns3.24.1-wifi-debug) + +set(WiFi_Ns3_LIBRARIES ${Ns3_LIBRARIES} ${NS3-wifi_LIBRARIES}) +set(WiFi_Ns3_INCLUDE_DIRECTORIES ${NS3-wifi_INCLUDE_DIRS}) + +include_directories(${WiFi_Ns3_INCLUDE_DIRECTORIES}) + +set(SOURCE_FILES + src/wifi_main.cc + src/wifi-emulator.cc + src/wifi-emulator.h) + +add_executable(wifi_emulator ${SOURCE_FILES} ${COMMON_FILES}) +target_link_libraries(wifi_emulator ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${WiFi_Ns3_LIBRARIES}) + +install(TARGETS wifi_emulator DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) diff --git a/emu-radio/wifi-emulator/src/wifi-emulator.cc b/emu-radio/wifi-emulator/src/wifi-emulator.cc new file mode 100644 index 00000000..2f15e793 --- /dev/null +++ b/emu-radio/wifi-emulator/src/wifi-emulator.cc @@ -0,0 +1,338 @@ +/* + * Copyright (c) 2017 Cisco and/or its affiliates. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "wifi-emulator.h" + +namespace ns3 +{ +namespace emulator +{ + +std::map<uint64_t, double> WifiEmulator::McsRateMap = {{0, 15.0}, + {1, 30.0}, + {2, 45.0}, + {3, 60.0}, + {4, 90.0}, + {5, 120.0}, + {6, 135.0}, + {7, 150.0}}; + +WifiEmulator::WifiEmulator (unsigned int accessPointNumber, unsigned int stationNumber) + : m_accessPointNumber (accessPointNumber), m_stationNumber (stationNumber), m_channel (YansWifiChannelHelper::Default ()), m_phy (YansWifiPhyHelper::Default ()), m_wifi (WifiHelper::Default ()), m_mac (HtWifiMacHelper::Default ()), m_ssid (SSID), m_avgTransmissionRate (0), m_alpha (0.1) +{ + // + // We are interacting with the outside, real, world. This means we have to + // interact in real-time and therefore means we have to use the real-time + // simulator and take the time to calculate checksums. + // + GlobalValue::Bind ("SimulatorImplementationType", StringValue ("ns3::RealtimeSimulatorImpl")); + GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true)); + + m_wifiStaNodes.Create (stationNumber); + m_wifiApNodes.Create (accessPointNumber); +} + +WifiEmulator &WifiEmulator::setWifi (WifiPhyStandard standard) +{ + switch (standard) + { + case WIFI_PHY_STANDARD_80211n_5GHZ: + installNWifi (standard); + break; + default: + std::cerr << "The wifi standard requested is not available!" << std::endl; + break; + } + + return *this; +} + +void WifiEmulator::installNWifi (WifiPhyStandard standard) +{ + // Default propagation loss model. + m_channel.AddPropagationLoss ("ns3::NakagamiPropagationLossModel", "m0", DoubleValue (1.0), "m1", DoubleValue (1.0), "m2", DoubleValue (1.0)); + + m_phy.SetChannel (m_channel.Create ()); + m_phy.Set ("ShortGuardEnabled", BooleanValue (1)); + + m_wifi.SetStandard (standard); + + m_wifi.SetRemoteStationManager ("ns3::MinstrelHtWifiManager"); + + m_mac.SetMpduAggregatorForAc (AC_BE, "ns3::MpduStandardAggregator"); // A-MPDU of max length 65535 bytes + m_mac.SetMsduAggregatorForAc (AC_BE, "ns3::MsduStandardAggregator"); // A-MSDU of max length 7935 bytes + m_mac.SetBlockAckThresholdForAc (AC_BE, 2); // block acknowledgement of 5 MPDU + m_mac.SetBlockAckInactivityTimeoutForAc (AC_BE, 400); + + m_mac.SetType ("ns3::StaWifiMac", "Ssid", SsidValue (m_ssid), "ActiveProbing", BooleanValue (false)); + + m_staDevices = m_wifi.Install (m_phy, m_mac, m_wifiStaNodes); + + m_mac.SetType ("ns3::ApWifiMac", "Ssid", SsidValue (m_ssid)); + + m_apDevices = m_wifi.Install (m_phy, m_mac, m_wifiApNodes); + + // Set callbacks and values + Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (40)); + + Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/RemoteStationManager/$ns3::MinstrelHtWifiManager/RateChange", MakeCallback (&WifiEmulator::logNewTransmissionRate, this)); +} + +WifiEmulator &WifiEmulator::setMobility (double bs_x, double bs_y, double initialDistance) +{ + // Access point mobility + MobilityHelper apMobility; + Ptr <ListPositionAllocator> apPositionAlloc = CreateObject<ListPositionAllocator> (); + apPositionAlloc->Add (Vector (bs_x, bs_y, 0.0)); + apMobility.SetPositionAllocator (apPositionAlloc); + apMobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); + apMobility.Install (m_wifiApNodes); + + // Station mobility. By default the stations start from the same position of the access point + MobilityHelper staMobility; + Ptr <ListPositionAllocator> staPositionAlloc = CreateObject<ListPositionAllocator> (); + staPositionAlloc->Add (Vector (bs_x, bs_y + initialDistance, 0.0)); + staMobility.SetPositionAllocator (staPositionAlloc); + staMobility.SetMobilityModel ("ns3::WaypointMobilityModel", "InitialPositionIsWaypoint", BooleanValue (false)); + staMobility.Install (m_wifiStaNodes); + + return *this; +} + +WifiEmulator & +WifiEmulator::setTapDevices (std::list <std::string> &ap_list, std::list <std::string> &station_list, std::list <std::string> &sta_taps_list, std::list <std::string> &ap_taps_list, std::list <std::string> &sta_macs_list, std::list <std::string> &ap_macs_list) +{ + TapBridgeHelper tapBridge; + tapBridge.SetAttribute ("Mode", StringValue ("UseLocal")); + + std::list<std::string>::const_iterator station; + std::list<std::string>::const_iterator ap; + std::list<std::string>::const_iterator sta_tap; + std::list<std::string>::const_iterator sta_mac; + std::list<std::string>::const_iterator ap_tap; + std::list<std::string>::const_iterator ap_mac; + + uint32_t i; + + assert (station_list.size () == sta_taps_list.size () && sta_taps_list.size () == sta_macs_list.size ()); + assert (ap_list.size () == ap_taps_list.size () && ap_taps_list.size () == ap_macs_list.size ()); + + for (sta_tap = sta_taps_list.begin (), sta_mac = sta_macs_list.begin (), station = station_list.begin (), i = 0; + sta_tap != sta_taps_list.end () && sta_mac != sta_macs_list.end () + && station != station_list.end (); sta_tap++, sta_mac++, station++, i++) + { + m_mapNameNs3node[*station] = m_wifiStaNodes.Get (i); + + if (sta_mac->compare ("")) + { + m_staDevices.Get (i)->SetAddress (Mac48Address (sta_mac->c_str ())); + } + + tapBridge.SetAttribute ("DeviceName", StringValue (sta_tap->c_str ())); + tapBridge.Install (m_wifiStaNodes.Get (i), m_staDevices.Get (i)); + } + + for (ap_tap = ap_taps_list.begin (), ap_mac = ap_macs_list.begin (), ap = ap_list.begin (), i = 0; + ap_tap != ap_taps_list.end () && ap_mac != ap_macs_list.end () + && ap != ap_list.end (); ap_tap++, ap_mac++, ap++, i++) + { + m_mapNameNs3node[*ap] = m_wifiApNodes.Get (i); + + if (ap_mac->compare ("")) + { + m_apDevices.Get (i)->SetAddress (Mac48Address (ap_mac->c_str ())); + } + + tapBridge.SetAttribute ("DeviceName", StringValue (ap_tap->c_str ())); + tapBridge.Install (m_wifiApNodes.Get (i), m_apDevices.Get (i)); + } + + return *this; +} + +void WifiEmulator::logNewTransmissionRate (std::string context, const uint64_t rate, const Mac48Address remoteAddress) +{ + // TODO Linear search! Improve it with an hash table when there will be more stations! + + for (auto station : m_mapNameNs3node) + { + if (station.second->GetDevice (0)->GetAddress () == remoteAddress) + { + const std::string &sta = station.first; + + // Compute EWMA of the physical rate + m_avgTransmissionRate[sta] = m_alpha * McsRateMap[rate] + (1.0 - m_alpha) * m_avgTransmissionRate[sta]; + } + } +} + +bool WifiEmulator::getTransmissionRate (const std::string &station, double *transmissionRate) +{ + if (m_avgTransmissionRate.find (station) != m_avgTransmissionRate.end ()) + { + *transmissionRate = m_avgTransmissionRate[station]; + return true; + } + + return false; +} + +WifiEmulator &WifiEmulator::runEmulation (bool async) +{ + m_simulationHandle = std::async (std::launch::async, [] () + { + Simulator::Stop (); + Simulator::Run (); + Simulator::Destroy (); + }); + + if (!async) + { + m_simulationHandle.get (); + } + + return *this; +} + +WifiEmulator &WifiEmulator::stopEmulation () +{ + Simulator::Stop (); +// Simulator::Destroy(); +} + +bool WifiEmulator::checkIfExist (const std::string &station) +{ + if (m_mapNameNs3node.find (station) == m_mapNameNs3node.end ()) + { + std::cerr << "The station [" << station << "] does not exist in this simulation!" << std::endl; + return false; + } + + return true; +} + +Ptr <MobilityModel> WifiEmulator::getMobilityModel (const std::string &station) +{ + if (checkIfExist (station)) + { + Ptr <Node> sta_ptr = m_mapNameNs3node[station]; + Ptr <MobilityModel> staMobilityModel = sta_ptr->GetObject<MobilityModel> (); + return staMobilityModel; + } + else + { + return nullptr; + } +} + +bool WifiEmulator::setStationCoordinates (const std::string &station, double x, double y) +{ + if (checkIfExist (station)) + { + Ptr <MobilityModel> staMobilityModel = getMobilityModel (station); + staMobilityModel->SetPosition (Vector (x, y, 0.0)); + return true; + } + + return false; +} + +bool WifiEmulator::setStationXCoordinate (const std::string &station, double x) +{ + if (checkIfExist (station)) + { + Ptr <MobilityModel> staMobilityModel = getMobilityModel (station); + staMobilityModel->SetPosition (Vector (x, staMobilityModel->GetPosition ().y, 0.0)); + return true; + } + + return false; +} + +bool WifiEmulator::setStationYCoordinate (const std::string &station, double y) +{ + if (checkIfExist (station)) + { + Ptr <MobilityModel> staMobilityModel = getMobilityModel (station); + staMobilityModel->SetPosition (Vector (staMobilityModel->GetPosition ().x, y, 0.0)); + return true; + } + + return false; +} + +std::pair<double, double> WifiEmulator::getStationCoordinates (const std::string &station) +{ + if (checkIfExist (station)) + { + Ptr <MobilityModel> staMobilityModel = getMobilityModel (station); + return {staMobilityModel->GetPosition ().x, staMobilityModel->GetPosition ().y}; + } + + return {}; +} + +bool WifiEmulator::getStationXCoordinate (const std::string &station, double *x) +{ + if (checkIfExist (station)) + { + Ptr <MobilityModel> staMobilityModel = getMobilityModel (station); + *x = staMobilityModel->GetPosition ().x; + return true; + } + + return false; +} + +bool WifiEmulator::getStationYCoordinate (const std::string &station, double *y) +{ + if (checkIfExist (station)) + { + Ptr <MobilityModel> staMobilityModel = getMobilityModel (station); + *y = staMobilityModel->GetPosition ().y; + return true; + } + + return false; +} + +WifiEmulator & +WifiEmulator::moveStationAlongSegment (const std::string &station, double start_x, double start_y, double end_x, double end_y, double duration) +{ + if (checkIfExist (station)) + { + + Ptr <Node> sta_ptr = m_mapNameNs3node[station]; + Ptr <WaypointMobilityModel> staMobilityModel = sta_ptr->GetObject<WaypointMobilityModel> (); + + if (staMobilityModel) + { + + staMobilityModel->SetPosition (Vector (start_x, start_y, 0.0)); + staMobilityModel->AddWaypoint (Waypoint (Seconds (Simulator::Now ().GetSeconds ()), Vector3D (start_x, start_y, 0.0))); + staMobilityModel->AddWaypoint (Waypoint ( + Seconds (Simulator::Now ().GetSeconds ()) + Seconds (duration), Vector3D (end_x, end_y, 0.0))); + } + else + { + std::cerr << "Access point has a constant position mobility model. Impossible to move it" << std::endl; + } + } + + return *this; +} + +} // End namespace ns3 +} // End namespace emulator
\ No newline at end of file diff --git a/emu-radio/wifi-emulator/src/wifi-emulator.h b/emu-radio/wifi-emulator/src/wifi-emulator.h new file mode 100644 index 00000000..9438071f --- /dev/null +++ b/emu-radio/wifi-emulator/src/wifi-emulator.h @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2017 Cisco and/or its affiliates. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef WIFI_EMULATOR_WIFIEMULATOR_H +#define WIFI_EMULATOR_WIFIEMULATOR_H + +#include <ns3/core-module.h> +#include <ns3/network-module.h> +#include <ns3/wifi-module.h> +#include <ns3/mobility-module.h> +#include <ns3/tap-bridge-module.h> +#include <boost/algorithm/string.hpp> +#include <future> +#include <unordered_map> + +#include "emulator.h" + +#define CONSTANT_POSITION "constant_position" +#define RANDOM_WAYPOINT "random_waypoint" + +// NS_LOG_COMPONENT_DEFINE ("wifi-emulator"); + +#define SSID "ns-3-ssid" + +namespace ns3 +{ +namespace emulator +{ + +class WifiEmulator : public Emulator { + + public: + explicit WifiEmulator (unsigned int accessPointNumber, unsigned int stationNumber); + + WifiEmulator &setWifi (WifiPhyStandard standard); + + WifiEmulator &setMobility (double bs_x = 0, double bs_y = 0, double initialDistance = 0); + + WifiEmulator & + setTapDevices (std::list <std::string> &ap_list, std::list <std::string> &station_list, std::list <std::string> &sta_taps_list, std::list <std::string> &ap_taps_list, std::list <std::string> &sta_macs_list, std::list <std::string> &ap_macs_list); + + WifiEmulator &runEmulation (bool async = false); + + WifiEmulator &stopEmulation (); + + std::pair<double, double> getStationCoordinates (const std::string &station); + + bool setStationCoordinates (const std::string &station, double x, double y); + + bool setStationXCoordinate (const std::string &station, double x); + + bool getStationYCoordinate (const std::string &station, double *y); + + bool getStationXCoordinate (const std::string &station, double *x); + + bool setStationYCoordinate (const std::string &station, double y); + + WifiEmulator & + moveStationAlongSegment (const std::string &station, double start_x, double start_y, double end_x, double end_y, double duration); + + bool getTransmissionRate (const std::string &station, double *transmissionRate); + + public: + + static std::map<uint64_t, double> McsRateMap; + + private: + + Ptr <MobilityModel> getMobilityModel (const std::string &station); + + void installNWifi (WifiPhyStandard standard = WIFI_PHY_STANDARD_80211n_5GHZ); + + void logNewTransmissionRate (std::string context, const uint64_t rate, const Mac48Address remoteAddress); + + bool checkIfExist (const std::string &node); + + private: + unsigned int m_accessPointNumber; + unsigned int m_stationNumber; + + NodeContainer m_wifiStaNodes; + NodeContainer m_wifiApNodes; + + NetDeviceContainer m_staDevices; + NetDeviceContainer m_apDevices; + + MobilityHelper m_apMobility; + MobilityHelper m_staMobility; + + Ptr <ListPositionAllocator> m_apPositionAlloc; + Ptr <ListPositionAllocator> m_staPositionAlloc; + + YansWifiChannelHelper m_channel; + YansWifiPhyHelper m_phy; + WifiHelper m_wifi; + HtWifiMacHelper m_mac; + Ssid m_ssid; + + std::unordered_map <std::string, ns3::Ptr<ns3::Node>> m_mapNameNs3node; + std::future<void> m_simulationHandle; + + std::unordered_map<std::string, double> m_avgTransmissionRate; + + double m_alpha; + +}; + +} // End namespace emulator + +} // End namespace ns3 + +#endif //WIFI_EMULATOR_WIFIEMULATOR_H diff --git a/emu-radio/wifi-emulator/src/wifi_main.cc b/emu-radio/wifi-emulator/src/wifi_main.cc new file mode 100644 index 00000000..88870aaf --- /dev/null +++ b/emu-radio/wifi-emulator/src/wifi_main.cc @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2017 Cisco and/or its affiliates. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "wifi-emulator.h" +#include "connection-pool.h" +#include "query.h" +#include "communication-protocol.h" + +#define DEFAULT_EXPERIMENT_ID "wifi-emulation" +#define N_AP 1 + +using namespace ns3; + +namespace ns3 +{ +namespace emulator +{ + +typedef struct EmulationParameters { + + std::string bs_name = ""; + std::string bs_tap = ""; + std::string sta_list_str = ""; + std::string sta_taps_str = ""; + std::string sta_macs_str = ""; + std::string bs_mac_str = ""; + std::string experiment_id_str = DEFAULT_EXPERIMENT_ID; + + double bs_x = 0; + double bs_y = 0; + double distance = 0; + uint32_t n_sta = 0; + uint16_t control_port = 0; + + void parseParameters (int argc, char **argv) + { + CommandLine cmd; + cmd.AddValue<std::string> ("bs-tap", "Name of the tap between NS3 and the base station", bs_tap); + cmd.AddValue<std::string> ("sta-list", "List of the stations of the simulation", sta_list_str); + cmd.AddValue<std::string> ("sta-taps", "List of the taps between NS3 and the mobile stations", sta_taps_str); + cmd.AddValue<std::string> ("sta-macs", "List of the macs of the mobile stations", sta_macs_str); + cmd.AddValue<double> ("bs-x", "X position of the Base Station", bs_x); + cmd.AddValue<double> ("bs-y", "Y position of the Base Station", bs_y); + cmd.AddValue<std::string> ("experiment-id", "Distance between the station and the base station", experiment_id_str); + cmd.AddValue<std::string> ("bs-name", "Index of the base station", bs_name); + cmd.AddValue<std::string> ("bs-mac", "Base station MAC address", bs_mac_str); + cmd.AddValue<uint16_t> ("control-port", "Control port for dynamically managing the stations movement", control_port); + cmd.AddValue<double> ("distance", "Initial distance between the bs and the other stations", distance); + cmd.AddValue<uint32_t> ("n-sta", "Number of stations in the simulation", n_sta); + + cmd.Parse (argc, argv); + } + + bool checkMissingParameters () + { + if (bs_tap == "" || n_sta == 0 || sta_list_str == "" || sta_taps_str == "" || sta_macs_str == "" || bs_name == "" + || control_port == 0) + { + return false; + } + + return true; + } + +} EmulationParameters; + +int main (int argc, char **argv) +{ + EmulationParameters emulationParameters; + + emulationParameters.parseParameters (argc, argv); + + if (!emulationParameters.checkMissingParameters ()) + { + std::cerr << "Important parameters are missing!" << std::endl; + return -1; + } + + WifiEmulator emulator (N_AP, emulationParameters.n_sta); + + std::list <std::string> ap_list; + std::list <std::string> station_list; + std::list <std::string> sta_taps_list; + std::list <std::string> ap_taps_list; + std::list <std::string> sta_macs_list; + std::list <std::string> ap_macs_list; + + boost::split (ap_list, emulationParameters.bs_name, boost::is_any_of (",")); + + boost::split (station_list, emulationParameters.sta_list_str, boost::is_any_of (",")); + + boost::split (sta_macs_list, emulationParameters.sta_macs_str, boost::is_any_of (",")); + + boost::split (ap_macs_list, emulationParameters.bs_mac_str, boost::is_any_of (",")); + + boost::split (sta_taps_list, emulationParameters.sta_taps_str, boost::is_any_of (",")); + + boost::split (ap_taps_list, emulationParameters.bs_tap, boost::is_any_of (",")); + + emulator + .setWifi (WIFI_PHY_STANDARD_80211n_5GHZ) + .setMobility (emulationParameters.bs_x, emulationParameters.bs_y, emulationParameters.distance) + .setTapDevices (ap_list, station_list, sta_taps_list, ap_taps_list, sta_macs_list, ap_macs_list).runEmulation (true); + + // Handler function for outcoming connections + + CommunicationProtocol protocol; + + HandlerFunction handler = [&emulator, &protocol] (Server *s, websocketpp::connection_hdl hdl, message_ptr msg, const uint8_t *data, std::size_t size) + { + + std::string command ((char *) data, size); + boost::trim (command); + + std::cout << command << std::endl; + + Query query = Query::fromJsonString (command); + + protocol.processQuery (s, hdl, msg, emulator, query); + }; + + ConnectionPool connPool (emulationParameters.control_port, 9000); + + std::cout << "Starting listeners" << std::endl; + + connPool.startListeners (handler).processEvents (); + + // If we reach this point the control servers have stopped, that means we can also stop the simulation. + + emulator.stopEmulation (); + +} + +} // End namespace emulator +} // End namespace ns3 + +int main (int argc, char *argv[]) +{ + return ns3::emulator::main (argc, argv); +} |