wifi: Add an AP MAC method to get the MLD or link address from the AID

This commit is contained in:
Stefano Avallone
2022-12-07 14:51:50 +01:00
committed by Stefano Avallone
parent 5c1e6e3fab
commit a3ceae1ea7
2 changed files with 27 additions and 0 deletions

View File

@@ -1177,6 +1177,11 @@ ApWifiMac::SetAid(MgtAssocResponseHeader& assoc, const LinkIdStaAddrMap& linkIdS
aid = GetNextAssociationId(linkIds);
}
// store the MLD or link address in the AID-to-address map
const auto& [linkId, staAddr] = *linkIdStaAddrMap.cbegin();
m_aidToMldOrLinkAddress[aid] =
GetWifiRemoteStationManager(linkId)->GetMldAddress(staAddr).value_or(staAddr);
for (const auto& [id, staAddr] : linkIdStaAddrMap)
{
auto remoteStationManager = GetWifiRemoteStationManager(id);
@@ -1531,6 +1536,17 @@ ApWifiMac::DoGetLocalAddress(const Mac48Address& remoteAddr) const
return GetFrameExchangeManager(*linkId)->GetAddress();
}
std::optional<Mac48Address>
ApWifiMac::GetMldOrLinkAddressByAid(uint16_t aid) const
{
if (const auto staIt = m_aidToMldOrLinkAddress.find(aid);
staIt != m_aidToMldOrLinkAddress.cend())
{
return staIt->second;
}
return std::nullopt;
}
void
ApWifiMac::Receive(Ptr<const WifiMpdu> mpdu, uint8_t linkId)
{

View File

@@ -126,6 +126,13 @@ class ApWifiMac : public WifiMac
*/
std::optional<uint8_t> IsAssociated(const Mac48Address& address) const;
/**
* \param aid the given AID
* \return the MLD address (in case of MLD) or link address (in case of single link device)
* of the STA having the given AID, if any
*/
std::optional<Mac48Address> GetMldOrLinkAddressByAid(uint16_t aid) const;
/**
* Return the value of the Queue Size subfield of the last QoS Data or QoS Null
* frame received from the station with the given MAC address and belonging to
@@ -193,6 +200,10 @@ class ApWifiMac : public WifiMac
*/
ApLinkEntity& GetLink(uint8_t linkId) const;
std::map<uint16_t, Mac48Address>
m_aidToMldOrLinkAddress; //!< Maps AIDs to MLD addresses (for MLDs) or link addresses (in
//!< case of single link devices)
private:
std::unique_ptr<LinkEntity> CreateLinkEntity() const override;
Mac48Address DoGetLocalAddress(const Mac48Address& remoteAddr) const override;