|
|
| 200 |
} |
200 |
} |
| 201 |
if (m_erpSupported == true && GetShortSlotTimeSupported () == true) |
201 |
if (m_erpSupported == true && GetShortSlotTimeSupported () == true) |
| 202 |
{ |
202 |
{ |
| 203 |
for (std::list<Mac48Address>::const_iterator i = m_staList.begin (); i != m_staList.end (); i++) |
203 |
for (std::map<uint16_t, Mac48Address>::const_iterator i = m_staList.begin (); i != m_staList.end (); i++) |
| 204 |
{ |
204 |
{ |
| 205 |
if (m_stationManager->GetShortSlotTimeSupported (*i) == false) |
205 |
if (m_stationManager->GetShortSlotTimeSupported (i->second) == false) |
| 206 |
{ |
206 |
{ |
| 207 |
return false; |
207 |
return false; |
| 208 |
} |
208 |
} |
|
|
| 233 |
ApWifiMac::IsNonGfHtStasPresent (void) const |
233 |
ApWifiMac::IsNonGfHtStasPresent (void) const |
| 234 |
{ |
234 |
{ |
| 235 |
bool isNonGfHtStasPresent = false; |
235 |
bool isNonGfHtStasPresent = false; |
| 236 |
for (std::list<Mac48Address>::const_iterator i = m_staList.begin (); i != m_staList.end (); i++) |
236 |
for (std::map<uint16_t, Mac48Address>::const_iterator i = m_staList.begin (); i != m_staList.end (); i++) |
| 237 |
{ |
237 |
{ |
| 238 |
if (m_stationManager->GetGreenfieldSupported (*i) == false) |
238 |
if (m_stationManager->GetGreenfieldSupported (i->second) == false) |
| 239 |
{ |
239 |
{ |
| 240 |
isNonGfHtStasPresent = true; |
240 |
isNonGfHtStasPresent = true; |
| 241 |
break; |
241 |
break; |
|
|
| 249 |
ApWifiMac::GetVhtOperationalChannelWidth (void) const |
249 |
ApWifiMac::GetVhtOperationalChannelWidth (void) const |
| 250 |
{ |
250 |
{ |
| 251 |
uint8_t channelWidth = m_phy->GetChannelWidth (); |
251 |
uint8_t channelWidth = m_phy->GetChannelWidth (); |
| 252 |
for (std::list<Mac48Address>::const_iterator i = m_staList.begin (); i != m_staList.end (); i++) |
252 |
for (std::map<uint16_t, Mac48Address>::const_iterator i = m_staList.begin (); i != m_staList.end (); i++) |
| 253 |
{ |
253 |
{ |
| 254 |
if (m_stationManager->GetVhtSupported (*i)) |
254 |
if (m_stationManager->GetVhtSupported (i->second)) |
| 255 |
{ |
255 |
{ |
| 256 |
if (m_stationManager->GetChannelWidthSupported (*i) < channelWidth) |
256 |
if (m_stationManager->GetChannelWidthSupported (i->second) < channelWidth) |
| 257 |
{ |
257 |
{ |
| 258 |
channelWidth = m_stationManager->GetChannelWidthSupported (*i); |
258 |
channelWidth = m_stationManager->GetChannelWidthSupported (i->second); |
| 259 |
} |
259 |
} |
| 260 |
} |
260 |
} |
| 261 |
} |
261 |
} |
|
|
| 555 |
} |
555 |
} |
| 556 |
uint8_t maxSpatialStream = m_phy->GetMaxSupportedTxSpatialStreams (); |
556 |
uint8_t maxSpatialStream = m_phy->GetMaxSupportedTxSpatialStreams (); |
| 557 |
uint8_t nMcs = m_phy->GetNMcs (); |
557 |
uint8_t nMcs = m_phy->GetNMcs (); |
| 558 |
for (std::list<Mac48Address>::const_iterator i = m_staList.begin (); i != m_staList.end (); i++) |
558 |
for (std::map<uint16_t, Mac48Address>::const_iterator i = m_staList.begin (); i != m_staList.end (); i++) |
| 559 |
{ |
559 |
{ |
| 560 |
if (m_stationManager->GetHtSupported (*i)) |
560 |
if (m_stationManager->GetHtSupported (i->second)) |
| 561 |
{ |
561 |
{ |
| 562 |
uint64_t maxSupportedRateByHtSta = 0; //in bit/s |
562 |
uint64_t maxSupportedRateByHtSta = 0; //in bit/s |
| 563 |
for (uint8_t j = 0; j < (std::min (nMcs, m_stationManager->GetNMcsSupported (*i))); j++) |
563 |
for (uint8_t j = 0; j < (std::min (nMcs, m_stationManager->GetNMcsSupported (i->second))); j++) |
| 564 |
{ |
564 |
{ |
| 565 |
WifiMode mcs = m_phy->GetMcs (j); |
565 |
WifiMode mcs = m_phy->GetMcs (j); |
| 566 |
if (mcs.GetModulationClass () != WIFI_MOD_CLASS_HT) |
566 |
if (mcs.GetModulationClass () != WIFI_MOD_CLASS_HT) |
|
|
| 569 |
} |
569 |
} |
| 570 |
uint8_t nss = (mcs.GetMcsValue () / 8) + 1; |
570 |
uint8_t nss = (mcs.GetMcsValue () / 8) + 1; |
| 571 |
NS_ASSERT (nss > 0 && nss < 5); |
571 |
NS_ASSERT (nss > 0 && nss < 5); |
| 572 |
uint64_t dataRate = mcs.GetDataRate (m_stationManager->GetChannelWidthSupported (*i), m_stationManager->GetShortGuardInterval (*i) ? 400 : 800, nss); |
572 |
uint64_t dataRate = mcs.GetDataRate (m_stationManager->GetChannelWidthSupported (i->second), m_stationManager->GetShortGuardInterval (i->second) ? 400 : 800, nss); |
| 573 |
if (dataRate > maxSupportedRateByHtSta) |
573 |
if (dataRate > maxSupportedRateByHtSta) |
| 574 |
{ |
574 |
{ |
| 575 |
maxSupportedRateByHtSta = dataRate; |
575 |
maxSupportedRateByHtSta = dataRate; |
|
|
| 579 |
{ |
579 |
{ |
| 580 |
maxSupportedRate = maxSupportedRateByHtSta; |
580 |
maxSupportedRate = maxSupportedRateByHtSta; |
| 581 |
} |
581 |
} |
| 582 |
if (m_stationManager->GetNMcsSupported (*i) < nMcs) |
582 |
if (m_stationManager->GetNMcsSupported (i->second) < nMcs) |
| 583 |
{ |
583 |
{ |
| 584 |
nMcs = m_stationManager->GetNMcsSupported (*i); |
584 |
nMcs = m_stationManager->GetNMcsSupported (i->second); |
| 585 |
} |
585 |
} |
| 586 |
if (m_stationManager->GetNumberOfSupportedStreams (*i) < maxSpatialStream) |
586 |
if (m_stationManager->GetNumberOfSupportedStreams (i->second) < maxSpatialStream) |
| 587 |
{ |
587 |
{ |
| 588 |
maxSpatialStream = m_stationManager->GetNumberOfSupportedStreams (*i); |
588 |
maxSpatialStream = m_stationManager->GetNumberOfSupportedStreams (i->second); |
| 589 |
} |
589 |
} |
| 590 |
} |
590 |
} |
| 591 |
} |
591 |
} |
|
|
| 736 |
if (success) |
736 |
if (success) |
| 737 |
{ |
737 |
{ |
| 738 |
code.SetSuccess (); |
738 |
code.SetSuccess (); |
| 739 |
m_staList.push_back (to); |
739 |
uint16_t aid = GetNextAssociationId (); |
|
|
740 |
m_staList.insert (std::make_pair (aid, to)); |
| 741 |
assoc.SetAssociationId (aid); |
| 740 |
} |
742 |
} |
| 741 |
else |
743 |
else |
| 742 |
{ |
744 |
{ |
|
|
| 1147 |
else if (hdr->IsDisassociation ()) |
1149 |
else if (hdr->IsDisassociation ()) |
| 1148 |
{ |
1150 |
{ |
| 1149 |
m_stationManager->RecordDisassociated (from); |
1151 |
m_stationManager->RecordDisassociated (from); |
| 1150 |
for (std::list<Mac48Address>::const_iterator i = m_staList.begin (); i != m_staList.end (); i++) |
1152 |
for (std::map<uint16_t, Mac48Address>::const_iterator j = m_staList.begin (); j != m_staList.end (); j++) |
| 1151 |
{ |
1153 |
{ |
| 1152 |
if ((*i) == from) |
1154 |
if (j->second == from) |
| 1153 |
{ |
1155 |
{ |
| 1154 |
m_staList.erase (i); |
1156 |
m_staList.erase (j); |
| 1155 |
break; |
1157 |
break; |
| 1156 |
} |
1158 |
} |
| 1157 |
} |
1159 |
} |
|
|
| 1261 |
return rifsMode; |
1263 |
return rifsMode; |
| 1262 |
} |
1264 |
} |
| 1263 |
|
1265 |
|
|
|
1266 |
uint16_t |
| 1267 |
ApWifiMac::GetNextAssociationId (void) |
| 1268 |
{ |
| 1269 |
//Return the first free AID value between 1 and 2007 |
| 1270 |
for (uint16_t nextAid = 1; nextAid <= 2007; nextAid++) |
| 1271 |
{ |
| 1272 |
if (m_staList.find (nextAid) == m_staList.end ()) |
| 1273 |
{ |
| 1274 |
return nextAid; |
| 1275 |
} |
| 1276 |
} |
| 1277 |
NS_ASSERT_MSG (false, "No free association ID available!"); |
| 1278 |
return 0; |
| 1279 |
} |
| 1280 |
|
| 1264 |
} //namespace ns3 |
1281 |
} //namespace ns3 |