diff --git a/src/wifi/model/wifi-mac.cc b/src/wifi/model/wifi-mac.cc index abfe6e69c..5b76b159f 100644 --- a/src/wifi/model/wifi-mac.cc +++ b/src/wifi/model/wifi-mac.cc @@ -897,6 +897,7 @@ WifiMac::SetWifiRemoteStationManagers( { // the link may already exist in case PHY objects were configured first auto [it, inserted] = m_links.emplace(i, CreateLinkEntity()); + m_linkIds.insert(i); it->second->stationManager = stationManagers[i]; } } @@ -934,6 +935,12 @@ WifiMac::GetNLinks() const return m_links.size(); } +const std::set& +WifiMac::GetLinkIds() const +{ + return m_linkIds; +} + void WifiMac::UpdateLinkId(uint8_t id) { @@ -1034,6 +1041,12 @@ WifiMac::SwapLinks(std::map links) to = nextTo->second; } while (true); } + + m_linkIds.clear(); + for (const auto& [id, link] : m_links) + { + m_linkIds.insert(id); + } } void @@ -1056,6 +1069,7 @@ WifiMac::SetWifiPhys(const std::vector>& phys) // (ResetWifiPhys just nullified the PHY(s) but left the links) // or the remote station managers were configured first auto [it, inserted] = m_links.emplace(i, CreateLinkEntity()); + m_linkIds.insert(i); it->second->phy = phys[i]; } } diff --git a/src/wifi/model/wifi-mac.h b/src/wifi/model/wifi-mac.h index a95521ac0..2c745d6aa 100644 --- a/src/wifi/model/wifi-mac.h +++ b/src/wifi/model/wifi-mac.h @@ -142,6 +142,12 @@ class WifiMac : public Object * \return the number of links used by this MAC */ uint8_t GetNLinks() const; + + /** + * \return the set of link IDs in use by this device + */ + const std::set& GetLinkIds() const; + /** * Get the ID of the link having the given MAC address, if any. * @@ -974,6 +980,7 @@ class WifiMac : public Object Ptr m_device; //!< Pointer to the device std::map> m_links; //!< ID-indexed map of Link objects + std::set m_linkIds; //!< IDs of the links in use Mac48Address m_address; //!< MAC address of this station Ssid m_ssid; //!< Service Set ID (SSID)