### Install and Configure UdpEchoServer Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/doc/contributing/source/building-topologies.md Installs a UdpEchoServer on a CSMA node and starts its application. The server port is specified during helper instantiation. ```cpp UdpEchoServerHelper echoServer(9); ApplicationContainer serverApps = echoServer.Install(csmaNodes.Get(nCsma)); serverApps.Start(Seconds(1.0)); serverApps.Stop(Seconds(10.0)); ``` -------------------------------- ### Shell Provisioning Example Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/doc/contributing/source/windows.md This example demonstrates how to provision the Vagrant VM using a shell script. It includes commands to update package lists and install Apache2. Ensure the shell commands are correctly formatted within the inline string. ```shell apt-get update apt-get install -y apache2 ``` -------------------------------- ### TutorialApp Setup Method Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/doc/models/source/tracing.md Configures the TutorialApp with essential parameters including the socket, peer address, packet size, number of packets, and data rate. The socket is a crucial component for tracing. ```cpp void TutorialApp::Setup(Ptr socket, Address address, uint32_t packetSize, uint32_t nPackets, DataRate dataRate) { m_socket = socket; m_peer = address; m_packetSize = packetSize; m_nPackets = nPackets; m_dataRate = dataRate; } ``` -------------------------------- ### Emitter Setup for Probes Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/src/stats/doc/probe.rst Sets up an Emitter object and schedules its start time. The Emitter is used as a trace source in subsequent examples. ```cpp Ptr emitter = CreateObject(); Names::Add("/Names/Emitter", emitter); // The Emitter object is not associated with an ns-3 node, so // it won't get started automatically, so we need to do this ourselves Simulator::Schedule(Seconds(0.0), &Emitter::Start, emitter); ``` -------------------------------- ### Vcpkg Configuration Output Example Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/doc/installation/source/working-with-cmake.md Console output during ns-3 configuration, showing Vcpkg setup, CMake download, and package detection. This output details which packages will be built and installed. ```console -- vcpkg: setting up support Cloning into 'vcpkg'... Updating files: 100% (10434/10434), done. Downloading vcpkg-glibc... vcpkg package management program version 2023-08-02-6d13efa755f9b5e101712d210199e4139b4c29f6 See LICENSE.txt for license information. -- vcpkg: detected a vcpkg manifest file: /ns-3-dev/vcpkg.json A suitable version of cmake was not found (required v3.27.1) Downloading portable cmake 3.27.1... Downloading cmake... https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-linux-x86_64.tar.gz->/ns-3-dev/vcpkg/downloads/cmake-3.27.1-linux-x86_64.tar.gz Extracting cmake... Detecting compiler hash for triplet x64-linux... The following packages will be built and installed: * boost-array:x64-linux -> 1.82.0#2 ... * boost-winapi:x64-linux -> 1.82.0#2 eigen3:x64-linux -> 3.4.0#2 gsl:x64-linux -> 2.7.1#3 * libiconv:x64-linux -> 1.17#1 * liblzma:x64-linux -> 5.4.3#1 libxml2[core,iconv,lzma,zlib]:x64-linux -> 2.10.3#1 sqlite3[core,json1]:x64-linux -> 3.42.0#1 * vcpkg-cmake:x64-linux -> 2023-05-04 * vcpkg-cmake-config:x64-linux -> 2022-02-06#1 * vcpkg-cmake-get-vars:x64-linux -> 2023-03-02 * zlib:x64-linux -> 1.2.13 Additional packages (*) will be modified to complete this operation. Restored 0 package(s) from /root/.cache/vcpkg/archives in 98.7 us. Use --debug to see more details. Installing 1/58 boost-uninstall:x64-linux... ... Installing 50/58 boost-units:x64-linux... Building boost-units:x64-linux... -- Downloading https://github.com/boostorg/units/archive/boost-1.82.0.tar.gz -> boostorg-units-boost-1.82.0.tar.gz... -- Extracting source /ns-3-dev/vcpkg/downloads/boostorg-units-boost-1.82.0.tar.gz -- Using source at /ns-3-dev/vcpkg/buildtrees/boost-units/src/ost-1.82.0-a9fdcc40b2.clean -- Copying headers -- Copying headers done -- Installing: /ns-3-dev/vcpkg/packages/boost-units_x64-linux/share/boost-units/usage -- Installing: /ns-3-dev/vcpkg/packages/boost-units_x64-linux/share/boost-units/copyright -- Performing post-build validation Stored binaries in 1 destinations in 276 ms. Elapsed time to handle boost-units:x64-linux: 3.8 s Installing 51/58 vcpkg-cmake-config:x64-linux... Building vcpkg-cmake-config:x64-linux... -- Installing: /ns-3-dev/vcpkg/packages/vcpkg-cmake-config_x64-linux/share/vcpkg-cmake-config/vcpkg_cmake_config_fixup.cmake -- Installing: /ns-3-dev/vcpkg/packages/vcpkg-cmake-config_x64-linux/share/vcpkg-cmake-config/vcpkg-port-config.cmake -- Installing: /ns-3-dev/vcpkg/packages/vcpkg-cmake-config_x64-linux/share/vcpkg-cmake-config/copyright -- Performing post-build validation Stored binaries in 1 destinations in 8.58 ms. Elapsed time to handle vcpkg-cmake-config:x64-linux: 144 ms Installing 52/58 eigen3:x64-linux... Building eigen3:x64-linux... -- Downloading https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz -> libeigen-eigen-3.4.0.tar.gz... -- Extracting source /ns-3-dev/vcpkg/downloads/libeigen-eigen-3.4.0.tar.gz -- Applying patch remove_configure_checks.patch -- Applying patch fix-vectorized-reductions-half.patch -- Using source at /ns-3-dev/vcpkg/buildtrees/eigen3/src/3.4.0-74a8d62212.clean -- Configuring x64-linux -- Building x64-linux-dbg -- Building x64-linux-rel -- Fixing pkgconfig file: /ns-3-dev/vcpkg/packages/eigen3_x64-linux/lib/pkgconfig/eigen3.pc CMake Error at scripts/cmake/vcpkg_find_acquire_program.cmake:163 (message): Could not find pkg-config. Please install it via your package manager: sudo apt-get install pkg-config Call Stack (most recent call first): scripts/cmake/vcpkg_fixup_pkgconfig.cmake:203 (vcpkg_find_acquire_program) ports/eigen3/portfile.cmake:30 (vcpkg_fixup_pkgconfig) scripts/ports.cmake:147 (include) error: building eigen3:x64-linux failed with: BUILD_FAILED Elapsed time to handle eigen3:x64-linux: 19 s Please ensure you're using the latest port files with `git pull` and `vcpkg update`. Then check for known issues at: ``` -------------------------------- ### Run FqCoDel-L4S Example Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/src/traffic-control/doc/fq-codel.rst Shows how to execute the FqCoDel-L4S example script and lists available command-line options. ```bash $ ./ns3 run "FqCoDel-L4S-example --PrintHelp" $ ./ns3 run "FqCoDel-L4S-example --scenarioNum=5" ``` -------------------------------- ### Install Internet Stack with Specific IPv4/IPv6 Configurations Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/src/internet/doc/ipv6.rst This snippet demonstrates how to install the Internet Stack on nodes with different IPv4 and IPv6 configurations. Node 0 gets both, Node 1 gets only IPv6, and Node 2 gets only IPv4. ```cpp NodeContainer n; n.Create(3); InternetStackHelper internet; InternetStackHelper internetV4only; InternetStackHelper internetV6only; internetV4only.SetIpv6StackInstall(false); internetV6only.SetIpv4StackInstall(false); internet.Install(n.Get(0)); internetV6only.Install(n.Get(1)); internetV4only.Install(n.Get(2)); ``` -------------------------------- ### Run PIE Example with Help Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/src/traffic-control/doc/pie.rst This command runs the PIE example and prints available command-line options. It's useful for understanding the configurable parameters of the PIE simulation. ```bash $ ./ns3 run "pie-example --PrintHelp" ``` -------------------------------- ### Enable Examples and Tests Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/doc/build.txt Configures ns-3 to include examples and tests during the build process. ```bash ./ns3 configure --enable-examples --enable-tests ``` -------------------------------- ### vcpkg Build Output Example Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/src/buildings/doc/source/working-with-cmake.md Example output from vcpkg during the configuration and installation of dependencies, including CMake version detection and package building. ```console -- vcpkg: setting up support Cloning into 'vcpkg'... Updating files: 100% (10434/10434), done. Downloading vcpkg-glibc... vcpkg package management program version 2023-08-02-6d13efa755f9b5e101712d210199e4139b4c29f6 See LICENSE.txt for license information. -- vcpkg: detected a vcpkg manifest file: /ns-3-dev/vcpkg.json A suitable version of cmake was not found (required v3.27.1) Downloading portable cmake 3.27.1... Downloading cmake... https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-linux-x86_64.tar.gz->/ns-3-dev/vcpkg/downloads/cmake-3.27.1-linux-x86_64.tar.gz Extracting cmake... Detecting compiler hash for triplet x64-linux... The following packages will be built and installed: * boost-array:x64-linux -> 1.82.0#2 ... * boost-winapi:x64-linux -> 1.82.0#2 eigen3:x64-linux -> 3.4.0#2 gsl:x64-linux -> 2.7.1#3 * libiconv:x64-linux -> 1.17#1 * liblzma:x64-linux -> 5.4.3#1 libxml2[core,iconv,lzma,zlib]:x64-linux -> 2.10.3#1 sqlite3[core,json1]:x64-linux -> 3.42.0#1 * vcpkg-cmake:x64-linux -> 2023-05-04 * vcpkg-cmake-config:x64-linux -> 2022-02-06#1 * vcpkg-cmake-get-vars:x64-linux -> 2023-03-02 * zlib:x64-linux -> 1.2.13 Additional packages (*) will be modified to complete this operation. Restored 0 package(s) from /root/.cache/vcpkg/archives in 98.7 us. Use --debug to see more details. Installing 1/58 boost-uninstall:x64-linux... ... Installing 50/58 boost-units:x64-linux... Building boost-units:x64-linux... -- Downloading https://github.com/boostorg/units/archive/boost-1.82.0.tar.gz -> boostorg-units-boost-1.82.0.tar.gz... -- Extracting source /ns-3-dev/vcpkg/downloads/boostorg-units-boost-1.82.0.tar.gz -- Using source at /ns-3-dev/vcpkg/buildtrees/boost-units/src/ost-1.82.0-a9fdcc40b2.clean -- Copying headers -- Copying headers done -- Installing: /ns-3-dev/vcpkg/packages/boost-units_x64-linux/share/boost-units/usage -- Installing: /ns-3-dev/vcpkg/packages/boost-units_x64-linux/share/boost-units/copyright -- Performing post-build validation Stored binaries in 1 destinations in 276 ms. Elapsed time to handle boost-units:x64-linux: 3.8 s Installing 51/58 vcpkg-cmake-config:x64-linux... Building vcpkg-cmake-config:x64-linux... -- Installing: /ns-3-dev/vcpkg/packages/vcpkg-cmake-config_x64-linux/share/vcpkg-cmake-config/vcpkg_cmake_config_fixup.cmake -- Installing: /ns-3-dev/vcpkg/packages/vcpkg-cmake-config_x64-linux/share/vcpkg-cmake-config/vcpkg-port-config.cmake -- Installing: /ns-3-dev/vcpkg/packages/vcpkg-cmake-config_x64-linux/share/vcpkg-cmake-config/copyright -- Performing post-build validation Stored binaries in 1 destinations in 8.58 ms. Elapsed time to handle vcpkg-cmake-config:x64-linux: 144 ms Installing 52/58 eigen3:x64-linux... Building eigen3:x64-linux... -- Downloading https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz -> libeigen-eigen-3.4.0.tar.gz... -- Extracting source /ns-3-dev/vcpkg/downloads/libeigen-eigen-3.4.0.tar.gz -- Applying patch remove_configure_checks.patch -- Applying patch fix-vectorized-reductions-half.patch -- Using source at /ns-3-dev/vcpkg/buildtrees/eigen3/src/3.4.0-74a8d62212.clean -- Configuring x64-linux -- Building x64-linux-dbg -- Building x64-linux-rel -- Fixing pkgconfig file: /ns-3-dev/vcpkg/packages/eigen3_x64-linux/lib/pkgconfig/eigen3.pc CMake Error at scripts/cmake/vcpkg_find_acquire_program.cmake:163 (message): Could not find pkg-config. Please install it via your package manager: sudo apt-get install pkg-config Call Stack (most recent call first): scripts/cmake/vcpkg_fixup_pkgconfig.cmake:203 (vcpkg_find_acquire_program) ports/eigen3/portfile.cmake:30 (vcpkg_fixup_pkgconfig) scripts/ports.cmake:147 (include) error: building eigen3:x64-linux failed with: BUILD_FAILED Elapsed time to handle eigen3:x64-linux: 19 s Please ensure you're using the latest port files with `git pull` and `vcpkg update`. Then check for known issues at: ``` -------------------------------- ### TutorialApp StartApplication Method Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/doc/models/source/tracing.md Starts the application by setting the running flag, initializing packet count, binding the socket, connecting to the peer, and initiating packet sending. This method is automatically called by the simulator. ```cpp void TutorialApp::StartApplication() { m_running = true; m_packetsSent = 0; m_socket->Bind(); m_socket->Connect(m_peer); SendPacket(); } ``` -------------------------------- ### Run nix-simple example with IPv6 Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/src/nix-vector-routing/doc/nix-vector-routing.rst Executes the nix-simple example with IPv6 networking enabled via a flag. ```bash ./ns3 run "nix-simple --useIPv6" ``` -------------------------------- ### GDB Session Example Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/doc/installation/source/test-framework.md An example GDB session output when debugging a test suite crash, showing the initial setup and assertion failure. ```text Waf: Entering directory `/home/tomh/hg/sep09/ns-3-allinone/ns-3-dev-678/build` Waf: Leaving directory `/home/tomh/hg/sep09/ns-3-allinone/ns-3-dev-678/build` 'build' finished successfully (0.380s) GNU gdb 6.8-debian Copyright (C) 2008 Free Software Foundation, Inc. L cense GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu"... (gdb) r --suite= Starting program: <..>/build/utils/ns3-dev-test-runner-debug --suite=wifi-interference [Thread debugging using libthread_db enabled] assert failed. file=../src/core/model/type-id.cc, line=138, cond="uid <= m_information.size() && uid != 0" ... ``` -------------------------------- ### Build Example: wifi-spectrum-saturation-example Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/examples/wireless/CMakeLists.txt Builds the wifi-spectrum-saturation-example using its source file and linking necessary libraries. ```cmake build_example( NAME wifi-spectrum-saturation-example SOURCE_FILES wifi-spectrum-saturation-example.cc LIBRARIES_TO_LINK ${libwifi} ${libapplications} ) ``` -------------------------------- ### Install Custom Traffic Generator and Sink Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/src/stats/doc/statistics.rst Installs a custom sender and receiver application on specific nodes to generate and receive traffic, starting them at specified times. ```c++ Ptr appSource = NodeList::GetNode(0); Ptr sender = CreateObject(); appSource->AddApplication(sender); sender->Start(Seconds(1)); Ptr appSink = NodeList::GetNode(1); Ptr receiver = CreateObject(); appSink->AddApplication(receiver); receiver->Start(Seconds(0)); // Config::Set("/NodeList/*/ApplicationList/*/$Sender/Destination", // Ipv4AddressValue("192.168.0.2")); ``` -------------------------------- ### Build Example: wifi-txop-aggregation Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/examples/wireless/CMakeLists.txt Sets up the build process for the wifi-txop-aggregation example, linking against specified libraries. ```cmake build_example( NAME wifi-txop-aggregation SOURCE_FILES wifi-txop-aggregation.cc LIBRARIES_TO_LINK ${libwifi} ${libapplications} ) ``` -------------------------------- ### vcpkg Package Installation Output Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/src/wifi/doc/source/working-with-cmake.md Example output showing vcpkg setting up support, downloading necessary tools like CMake, and listing packages to be built and installed. This output indicates the progress and details of the dependency installation process. ```console -- vcpkg: setting up support Cloning into 'vcpkg'... Updating files: 100% (10434/10434), done. Downloading vcpkg-glibc... vcpkg package management program version 2023-08-02-6d13efa755f9b5e101712d210199e4139b4c29f6 See LICENSE.txt for license information. -- vcpkg: detected a vcpkg manifest file: /ns-3-dev/vcpkg.json A suitable version of cmake was not found (required v3.27.1) Downloading portable cmake 3.27.1... Downloading cmake... https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-linux-x86_64.tar.gz->/ns-3-dev/vcpkg/downloads/cmake-3.27.1-linux-x86_64.tar.gz Extracting cmake... Detecting compiler hash for triplet x64-linux... The following packages will be built and installed: * boost-array:x64-linux -> 1.82.0#2 ... * boost-winapi:x64-linux -> 1.82.0#2 eigen3:x64-linux -> 3.4.0#2 gsl:x64-linux -> 2.7.1#3 * libiconv:x64-linux -> 1.17#1 * liblzma:x64-linux -> 5.4.3#1 libxml2[core,iconv,lzma,zlib]:x64-linux -> 2.10.3#1 sqlite3[core,json1]:x64-linux -> 3.42.0#1 * vcpkg-cmake:x64-linux -> 2023-05-04 * vcpkg-cmake-config:x64-linux -> 2022-02-06#1 * vcpkg-cmake-get-vars:x64-linux -> 2023-03-02 * zlib:x64-linux -> 1.2.13 Additional packages (*) will be modified to complete this operation. Restored 0 package(s) from /root/.cache/vcpkg/archives in 98.7 us. Use --debug to see more details. Installing 1/58 boost-uninstall:x64-linux... ... Installing 50/58 boost-units:x64-linux... Building boost-units:x64-linux... -- Downloading https://github.com/boostorg/units/archive/boost-1.82.0.tar.gz -> boostorg-units-boost-1.82.0.tar.gz... -- Extracting source /ns-3-dev/vcpkg/downloads/boostorg-units-boost-1.82.0.tar.gz -- Using source at /ns-3-dev/vcpkg/buildtrees/boost-units/src/ost-1.82.0-a9fdcc40b2.clean -- Copying headers -- Copying headers done -- Installing: /ns-3-dev/vcpkg/packages/boost-units_x64-linux/share/boost-units/usage -- Installing: /ns-3-dev/vcpkg/packages/boost-units_x64-linux/share/boost-units/copyright -- Performing post-build validation Stored binaries in 1 destinations in 276 ms. Elapsed time to handle boost-units:x64-linux: 3.8 s Installing 51/58 vcpkg-cmake-config:x64-linux... Building vcpkg-cmake-config:x64-linux... -- Installing: /ns-3-dev/vcpkg/packages/vcpkg-cmake-config_x64-linux/share/vcpkg-cmake-config/vcpkg_cmake_config_fixup.cmake -- Installing: /ns-3-dev/vcpkg/packages/vcpkg-cmake-config_x64-linux/share/vcpkg-cmake-config/vcpkg-port-config.cmake -- Installing: /ns-3-dev/vcpkg/packages/vcpkg-cmake-config_x64-linux/share/vcpkg-cmake-config/copyright -- Performing post-build validation Stored binaries in 1 destinations in 8.58 ms. Elapsed time to handle vcpkg-cmake-config:x64-linux: 144 ms Installing 52/58 eigen3:x64-linux... Building eigen3:x64-linux... -- Downloading https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz -> libeigen-eigen-3.4.0.tar.gz... -- Extracting source /ns-3-dev/vcpkg/downloads/libeigen-eigen-3.4.0.tar.gz -- Applying patch remove_configure_checks.patch -- Applying patch fix-vectorized-reductions-half.patch -- Using source at /ns-3-dev/vcpkg/buildtrees/eigen3/src/3.4.0-74a8d62212.clean -- Configuring x64-linux -- Building x64-linux-dbg -- Building x64-linux-rel -- Fixing pkgconfig file: /ns-3-dev/vcpkg/packages/eigen3_x64-linux/lib/pkgconfig/eigen3.pc CMake Error at scripts/cmake/vcpkg_find_acquire_program.cmake:163 (message): Could not find pkg-config. Please install it via your package manager: sudo apt-get install pkg-config Call Stack (most recent call first): scripts/cmake/vcpkg_fixup_pkgconfig.cmake:203 (vcpkg_find_acquire_program) ports/eigen3/portfile.cmake:30 (vcpkg_fixup_pkgconfig) scripts/ports.cmake:147 (include) error: building eigen3:x64-linux failed with: BUILD_FAILED Elapsed time to handle eigen3:x64-linux: 19 s Please ensure you're using the latest port files with `git pull` and `vcpkg update`. Then check for known issues at: ``` -------------------------------- ### Install and Test ns-3 Python Bindings Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/doc/manual/source/python.md Installs the built ns-3 wheel along with testing libraries like matplotlib and numpy, then executes various Python test scripts and examples. ```bash # Install wheel - $PYTHON -m pip install ./wheelhouse/*whl - $PYTHON -m pip install matplotlib numpy # Test the bindings - $PYTHON ./utils/python-unit-tests.py - $PYTHON ./examples/realtime/realtime-udp-echo.py - $PYTHON ./examples/routing/simple-routing-ping6.py - $PYTHON ./examples/tutorial/first.py - $PYTHON ./examples/tutorial/second.py - $PYTHON ./examples/tutorial/third.py - $PYTHON ./examples/wireless/wifi-ap.py - $PYTHON ./examples/wireless/mixed-wired-wireless.py - $PYTHON ./src/bridge/examples/csma-bridge.py - $PYTHON ./src/brite/examples/brite-generic-example.py - $PYTHON ./src/core/examples/sample-simulator.py - $PYTHON ./src/core/examples/sample-rng-plot.py --not-blocking - $PYTHON ./src/click/examples/nsclick-simple-lan.py - $PYTHON ./src/flow-monitor/examples/wifi-olsr-flowmon.py - $PYTHON ./src/flow-monitor/examples/flowmon-parse-results.py output.xml - $PYTHON ./src/openflow/examples/openflow-switch.py ``` -------------------------------- ### Run ns-3 Example with Visualize Option Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/src/visualizer/examples/readme.txt This command runs the 'wifi-simple-adhoc-grid' example and activates the visualizer. Ensure 'visualizer' is a module dependency for your program. ```bash ./ns3 run wifi-simple-adhoc-grid --visualize ``` -------------------------------- ### Run nix-simple example with IPv4 Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/src/nix-vector-routing/doc/nix-vector-routing.rst Executes the nix-simple example using default IPv4 networking. ```bash ./ns3 run nix-simple ``` -------------------------------- ### vcpkg Package Installation Output Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/doc/manual/source/working-with-cmake.md Example console output showing vcpkg downloading and installing dependencies like boost-units and eigen3. It highlights the process and potential build failures, such as missing pkg-config. ```console /ns-3-dev$ ./ns3 clean /ns-3-dev$ ./ns3 configure -- -DNS3_VCPKG=ON ... -- vcpkg: setting up support Cloning into 'vcpkg'... Updating files: 100% (10434/10434), done. Downloading vcpkg-glibc... vcpkg package management program version 2023-08-02-6d13efa755f9b5e101712d210199e4139b4c29f6 See LICENSE.txt for license information. -- vcpkg: detected a vcpkg manifest file: /ns-3-dev/vcpkg.json A suitable version of cmake was not found (required v3.27.1) Downloading portable cmake 3.27.1... Downloading cmake... https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-linux-x86_64.tar.gz->/ns-3-dev/vcpkg/downloads/cmake-3.27.1-linux-x86_64.tar.gz Extracting cmake... Detecting compiler hash for triplet x64-linux... The following packages will be built and installed: * boost-array:x64-linux -> 1.82.0#2 ... * boost-winapi:x64-linux -> 1.82.0#2 eigen3:x64-linux -> 3.4.0#2 gsl:x64-linux -> 2.7.1#3 * libiconv:x64-linux -> 1.17#1 * liblzma:x64-linux -> 5.4.3#1 libxml2[core,iconv,lzma,zlib]:x64-linux -> 2.10.3#1 sqlite3[core,json1]:x64-linux -> 3.42.0#1 * vcpkg-cmake:x64-linux -> 2023-05-04 * vcpkg-cmake-config:x64-linux -> 2022-02-06#1 * vcpkg-cmake-get-vars:x64-linux -> 2023-03-02 * zlib:x64-linux -> 1.2.13 Additional packages (*) will be modified to complete this operation. Restored 0 package(s) from /root/.cache/vcpkg/archives in 98.7 us. Use --debug to see more details. Installing 1/58 boost-uninstall:x64-linux... ... Installing 50/58 boost-units:x64-linux... Building boost-units:x64-linux... -- Downloading https://github.com/boostorg/units/archive/boost-1.82.0.tar.gz -> boostorg-units-boost-1.82.0.tar.gz... -- Extracting source /ns-3-dev/vcpkg/downloads/boostorg-units-boost-1.82.0.tar.gz -- Using source at /ns-3-dev/vcpkg/buildtrees/boost-units/src/ost-1.82.0-a9fdcc40b2.clean -- Copying headers -- Copying headers done -- Installing: /ns-3-dev/vcpkg/packages/boost-units_x64-linux/share/boost-units/usage -- Installing: /ns-3-dev/vcpkg/packages/boost-units_x64-linux/share/boost-units/copyright -- Performing post-build validation Stored binaries in 1 destinations in 276 ms. Elapsed time to handle boost-units:x64-linux: 3.8 s Installing 51/58 vcpkg-cmake-config:x64-linux... Building vcpkg-cmake-config:x64-linux... -- Installing: /ns-3-dev/vcpkg/packages/vcpkg-cmake-config_x64-linux/share/vcpkg-cmake-config/vcpkg_cmake_config_fixup.cmake -- Installing: /ns-3-dev/vcpkg/packages/vcpkg-cmake-config_x64-linux/share/vcpkg-cmake-config/vcpkg-port-config.cmake -- Installing: /ns-3-dev/vcpkg/packages/vcpkg-cmake-config_x64-linux/share/vcpkg-cmake-config/copyright -- Performing post-build validation Stored binaries in 1 destinations in 8.58 ms. Elapsed time to handle vcpkg-cmake-config:x64-linux: 144 ms Installing 52/58 eigen3:x64-linux... Building eigen3:x64-linux... -- Downloading https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz -> libeigen-eigen-3.4.0.tar.gz... -- Extracting source /ns-3-dev/vcpkg/downloads/libeigen-eigen-3.4.0.tar.gz -- Applying patch remove_configure_checks.patch -- Applying patch fix-vectorized-reductions-half.patch -- Using source at /ns-3-dev/vcpkg/buildtrees/eigen3/src/3.4.0-74a8d62212.clean -- Configuring x64-linux -- Building x64-linux-dbg -- Building x64-linux-rel -- Fixing pkgconfig file: /ns-3-dev/vcpkg/packages/eigen3_x64-linux/lib/pkgconfig/eigen3.pc CMake Error at scripts/cmake/vcpkg_find_acquire_program.cmake:163 (message): Could not find pkg-config. Please install it via your package manager: sudo apt-get install pkg-config Call Stack (most recent call first): scripts/cmake/vcpkg_fixup_pkgconfig.cmake:203 (vcpkg_find_acquire_program) ports/eigen3/portfile.cmake:30 (vcpkg_fixup_pkgconfig) scripts/ports.cmake:147 (include) error: building eigen3:x64-linux failed with: BUILD_FAILED Elapsed time to handle eigen3:x64-linux: 19 s Please ensure you're using the latest port files with `git pull` and `vcpkg update`. Then check for known issues at: ``` -------------------------------- ### Install UDP Echo Client Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/doc/contributing/source/building-topologies.md Installs a UDP echo client on a specified node, configuring packet transmission interval, size, and destination. It also sets the start and stop times for the client application. ```cpp UdpEchoClientHelper echoClient(csmaInterfaces.GetAddress(nCsma), 9); echoClient.SetAttribute("MaxPackets", UintegerValue(1)); echoClient.SetAttribute("Interval", TimeValue(Seconds(1.0))); echoClient.SetAttribute("PacketSize", UintegerValue(1024)); ApplicationContainer clientApps = echoClient.Install(wifiStaNodes.Get(nWifi - 1)); clientApps.Start(Seconds(2.0)); clientApps.Stop(Seconds(10.0)); ``` -------------------------------- ### Build Main Test Sync Example Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/src/core/examples/CMakeLists.txt Builds the 'main-test-sync' example, linking against the libnetwork library. ```cmake build_lib_example( NAME main-test-sync SOURCE_FILES main-test-sync.cc LIBRARIES_TO_LINK ${libnetwork} ) ``` -------------------------------- ### Install IPv6 Internet Stack and Assign Addresses Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/src/internet/doc/ipv6.rst This snippet demonstrates the basic setup for IPv6 in ns-3, including installing the internet stack, creating network channels, and assigning IPv6 addresses to devices. ```c++ NodeContainer n; n.Create(4); NS_LOG_INFO("Create IPv6 Internet Stack"); InternetStackHelper internetv6; internetv6.Install(n); NS_LOG_INFO("Create channels."); CsmaHelper csma; NetDeviceContainer d = csma.Install(n); NS_LOG_INFO("Create networks and assign IPv6 Addresses."); Ipv6AddressHelper ipv6; ipv6.SetBase(Ipv6Address("2001:db8::"), Ipv6Prefix(64)); Ipv6InterfaceContainer iic = ipv6.Assign(d); ``` -------------------------------- ### Build Log Example Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/src/core/examples/CMakeLists.txt Builds the 'log-example', linking against both libcore and libnetwork libraries. ```cmake build_lib_example( NAME log-example SOURCE_FILES log-example.cc LIBRARIES_TO_LINK ${libcore} ${libnetwork} ) ``` -------------------------------- ### Install OpenSSH Server and Configure Firewall Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/doc/contributing/source/windows.md Installs the OpenSSH server, sets it to start automatically, and configures the Windows firewall to allow incoming SSH connections on port 22. This enables remote access to the VM. ```powershell Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0 Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 Start-Service sshd Set-Service -Name sshd -StartupType 'Automatic' if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) { Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..." New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22 } else { Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists." } ``` -------------------------------- ### Build ns-3 With All Examples and Tests Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/src/lte/doc/source/enable-tests.md After enabling examples and tests in the .ns3rc file, run the configure and build commands. This will execute all examples and tests. ```bash $ ./ns3 configure $ ./ns3 build ``` ```text 170 of 170 tests passed (170 passed, 0 skipped, 0 failed, 0 crashed, 0 valgrind errors) ``` -------------------------------- ### Assign IP Addresses and Setup Applications in ns-3 Python Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/src/wifi/doc/source/python.md Assigns IPv4 addresses to devices, sets up UDP echo server and client applications, and configures their start and stop times. This snippet is used for basic network simulation setup. ```python # Assign Ipv4 addresses address = ns.internet.Ipv4AddressHelper() address.SetBase(ns.network.Ipv4Address("10.1.2.0"), ns.network.Ipv4Mask("255.255.255.0")) csmaInterfaces = address.Assign(csmaDevices) # Setup applications echoServer = ns.applications.UdpEchoServerHelper(9) serverApps = echoServer.Install(csmaNodes.Get(0)) serverApps.Start(ns.core.Seconds(1.0)) serverApps.Stop(ns.core.Seconds(10.0)) echoClient = ns.applications.UdpEchoClientHelper(csmaInterfaces.GetAddress(0).ConvertTo(), 9) echoClient.SetAttribute("MaxPackets", ns.core.UintegerValue(10)) echoClient.SetAttribute("Interval", ns.core.TimeValue(ns.core.Seconds(1.0))) echoClient.SetAttribute("PacketSize", ns.core.UintegerValue(1024)) clientApps = echoClient.Install(csmaNodes.Get(1)) clientApps.Start(ns.core.Seconds(2.0)) clientApps.Stop(ns.core.Seconds(10.0)) ``` -------------------------------- ### Print Help for lena-simple-epc-emu Example Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/src/antenna/doc/source/lte-user.md Execute the lena-simple-epc-emu example with the --PrintHelp command to list all available command-line parameters. ```bash ./ns3 run lena-simple-epc-emu --command="%s --PrintHelp" ``` -------------------------------- ### Build Standard Library Examples Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/src/core/examples/CMakeLists.txt Iterates through the base_examples list to build each example as a library linked against libcore. ```cmake foreach( example ${base_examples} ) build_lib_example( NAME ${example} SOURCE_FILES ${example}.cc LIBRARIES_TO_LINK ${libcore} ) endforeach() ``` -------------------------------- ### Python Script with ns-3 Bindings and Network Setup Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/doc/contributing/source/python.md Example Python script demonstrating the use of ns-3 bindings to define a C++ callback, set up network nodes, and configure a CSMA channel. This snippet shows basic network simulation setup. ```python from ns import ns ns.cppyy.cppdef(""" using namespace ns3; Callback,const Address&,const Address&> make_sinktrace_callback(void(*func)(Ptr,Address,Address)) { return MakeCallback(func); } ") # Define the trace callback def SinkTracer(packet: ns.Packet, src_address: ns.Address, dst_address: ns.Address) -> None: print(f"At {ns.Simulator.Now().GetSeconds():.0f}s, '{dst_address}' received packet" f" with {packet.__deref__().GetSerializedSize()} bytes from '{src_address}'") # Create two nodes csmaNodes = ns.network.NodeContainer() csmaNodes.Create(2) # Connect the two nodes csma = ns.csma.CsmaHelper() csma.SetChannelAttribute("DataRate", ns.core.StringValue("100Mbps")) csma.SetChannelAttribute("Delay", ns.core.TimeValue(ns.core.NanoSeconds(6560))) csmaDevices = csma.Install(csmaNodes) # Install the internet stack stack = ns.internet.InternetStackHelper() stack.Install(csmaNodes) ``` -------------------------------- ### Creating a DoubleProbe with Attributes Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/src/stats/doc/probe.rst This example illustrates creating a DoubleProbe object with specific attributes like Name, Enabled, Start, and Stop, using CreateObjectWithAttributes. ```cpp Ptr myprobe = CreateObjectWithAttributes( "Name", StringValue("myprobe"), "Enabled", BooleanValue(false), "Start", TimeValue(Seconds(100.0)), "Stop", TimeValue(Seconds(1000.0))); ``` -------------------------------- ### Build Dummy Network Library Example Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/src/fd-net-device/examples/CMakeLists.txt Configures the build for the 'dummy-network' example, linking necessary fd-net-device and internet libraries. ```cmake build_lib_example( NAME dummy-network SOURCE_FILES dummy-network.cc LIBRARIES_TO_LINK ${libfd-net-device} ${libinternet} ${libinternet-apps} ) ``` -------------------------------- ### Setup Downlink Communication with PacketSink and UdpClient Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/src/lte/doc/source/lte-user.md Installs a PacketSink application on a UE and a UdpClient on a remote host to establish downlink communication over a specified port. ```c++ uint16_t dlPort = 1234; PacketSinkHelper packetSinkHelper("ns3::UdpSocketFactory", InetSocketAddress(Ipv4Address::GetAny(), dlPort)); ApplicationContainer serverApps = packetSinkHelper.Install(ue); serverApps.Start(Seconds(0.01)); UdpClientHelper client(ueIpIface.GetAddress(0), dlPort); ApplicationContainer clientApps = client.Install(remoteHost); clientApps.Start(Seconds(0.01)); ``` -------------------------------- ### Build Point-to-Point Library Example Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/src/point-to-point/examples/CMakeLists.txt Configures the build process for the 'main-attribute-value' example, linking it with necessary libraries. ```cmake build_lib_example( NAME main-attribute-value SOURCE_FILES main-attribute-value.cc LIBRARIES_TO_LINK ${libnetwork} ${libpoint-to-point} ) ``` -------------------------------- ### Run lena-simple-epc-emu Example with Default Settings Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/src/antenna/doc/source/lte-user.md Execute the lena-simple-epc-emu example program using the simulated clock and specified virtual ethernet interfaces for SGW and eNB. ```bash ./ns3 run lena-simple-epc-emu --command="%s --ns3::EmuEpcHelper::sgwDeviceName=veth0 --ns3::EmuEpcHelper::enbDeviceName=veth1" ``` -------------------------------- ### Configure Ping Application with PingHelper Source: https://github.com/idolumbantobing/ieee_802.11bf/blob/main/src/internet-apps/doc/internet-apps.rst Use PingHelper to install and configure Ping applications on nodes. This example shows setting remote address, interval, size, and verbosity. ```cpp PingHelper pingHelper(Ipv4Address("192.168.1.2")); pingHelper.SetAttribute("Interval", TimeValue(pingInterval)); pingHelper.SetAttribute("Size", UintegerValue(pingSize)); pingHelper.SetAttribute("VerboseMode", EnumValue(Ping::VerboseMode::SILENT)); ApplicationContainer pingContainer = pingHelper.Install(pingServer); Ptr ping = pingContainer.Get(0)->GetObject(); ping->TraceConnectWithoutContext("Rtt", MakeBoundCallback(&TracePingRtt, &pingOfStream)); pingContainer.Start(Seconds(1)); pingContainer.Stop(stopTime - Seconds(1)); ```