wifi: Add a WifiMac method to get the set of link IDs

This commit is contained in:
Stefano Avallone
2023-05-18 12:14:04 +02:00
committed by Stefano Avallone
parent 1ab959a512
commit f326367143
2 changed files with 21 additions and 0 deletions

View File

@@ -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<uint8_t>&
WifiMac::GetLinkIds() const
{
return m_linkIds;
}
void
WifiMac::UpdateLinkId(uint8_t id)
{
@@ -1034,6 +1041,12 @@ WifiMac::SwapLinks(std::map<uint8_t, uint8_t> 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<Ptr<WifiPhy>>& 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];
}
}

View File

@@ -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<uint8_t>& GetLinkIds() const;
/**
* Get the ID of the link having the given MAC address, if any.
*
@@ -974,6 +980,7 @@ class WifiMac : public Object
Ptr<WifiNetDevice> m_device; //!< Pointer to the device
std::map<uint8_t, std::unique_ptr<LinkEntity>> m_links; //!< ID-indexed map of Link objects
std::set<uint8_t> m_linkIds; //!< IDs of the links in use
Mac48Address m_address; //!< MAC address of this station
Ssid m_ssid; //!< Service Set ID (SSID)