|
Lines 92-97
ApWifiMac::ApWifiMac ()
|
Link Here
|
|---|
|
| 92 |
|
92 |
|
| 93 |
//Let the lower layers know that we are acting as an AP. |
93 |
//Let the lower layers know that we are acting as an AP. |
| 94 |
SetTypeOfStation (AP); |
94 |
SetTypeOfStation (AP); |
|
|
95 |
m_nextAid = 1; //0 is excluded |
| 95 |
} |
96 |
} |
| 96 |
|
97 |
|
| 97 |
ApWifiMac::~ApWifiMac () |
98 |
ApWifiMac::~ApWifiMac () |
|
Lines 200-208
ApWifiMac::GetShortSlotTimeEnabled (void) const
|
Link Here
|
|---|
|
| 200 |
} |
201 |
} |
| 201 |
if (m_erpSupported == true && GetShortSlotTimeSupported () == true) |
202 |
if (m_erpSupported == true && GetShortSlotTimeSupported () == true) |
| 202 |
{ |
203 |
{ |
| 203 |
for (std::list<Mac48Address>::const_iterator i = m_staList.begin (); i != m_staList.end (); i++) |
204 |
for (std::map<Mac48Address, uint16_t>::const_iterator i = m_staList.begin (); i != m_staList.end (); i++) |
| 204 |
{ |
205 |
{ |
| 205 |
if (m_stationManager->GetShortSlotTimeSupported (*i) == false) |
206 |
if (m_stationManager->GetShortSlotTimeSupported (i->first) == false) |
| 206 |
{ |
207 |
{ |
| 207 |
return false; |
208 |
return false; |
| 208 |
} |
209 |
} |
|
|
| 233 |
ApWifiMac::IsNonGfHtStasPresent (void) const |
234 |
ApWifiMac::IsNonGfHtStasPresent (void) const |
| 234 |
{ |
235 |
{ |
| 235 |
bool isNonGfHtStasPresent = false; |
236 |
bool isNonGfHtStasPresent = false; |
| 236 |
for (std::list<Mac48Address>::const_iterator i = m_staList.begin (); i != m_staList.end (); i++) |
237 |
for (std::map<Mac48Address, uint16_t>::const_iterator i = m_staList.begin (); i != m_staList.end (); i++) |
| 237 |
{ |
238 |
{ |
| 238 |
if (m_stationManager->GetGreenfieldSupported (*i) == false) |
239 |
if (m_stationManager->GetGreenfieldSupported (i->first) == false) |
| 239 |
{ |
240 |
{ |
| 240 |
isNonGfHtStasPresent = true; |
241 |
isNonGfHtStasPresent = true; |
| 241 |
break; |
242 |
break; |
|
|
| 249 |
ApWifiMac::GetVhtOperationalChannelWidth (void) const |
250 |
ApWifiMac::GetVhtOperationalChannelWidth (void) const |
| 250 |
{ |
251 |
{ |
| 251 |
uint8_t channelWidth = m_phy->GetChannelWidth (); |
252 |
uint8_t channelWidth = m_phy->GetChannelWidth (); |
| 252 |
for (std::list<Mac48Address>::const_iterator i = m_staList.begin (); i != m_staList.end (); i++) |
253 |
for (std::map<Mac48Address, uint16_t>::const_iterator i = m_staList.begin (); i != m_staList.end (); i++) |
| 253 |
{ |
254 |
{ |
| 254 |
if (m_stationManager->GetVhtSupported (*i)) |
255 |
if (m_stationManager->GetVhtSupported (i->first)) |
| 255 |
{ |
256 |
{ |
| 256 |
if (m_stationManager->GetChannelWidthSupported (*i) < channelWidth) |
257 |
if (m_stationManager->GetChannelWidthSupported (i->first) < channelWidth) |
| 257 |
{ |
258 |
{ |
| 258 |
channelWidth = m_stationManager->GetChannelWidthSupported (*i); |
259 |
channelWidth = m_stationManager->GetChannelWidthSupported (i->first); |
| 259 |
} |
260 |
} |
| 260 |
} |
261 |
} |
| 261 |
} |
262 |
} |
|
Lines 555-566
ApWifiMac::GetHtOperation (void) const
|
Link Here
|
|---|
|
| 555 |
} |
556 |
} |
| 556 |
uint8_t maxSpatialStream = m_phy->GetMaxSupportedTxSpatialStreams (); |
557 |
uint8_t maxSpatialStream = m_phy->GetMaxSupportedTxSpatialStreams (); |
| 557 |
uint8_t nMcs = m_phy->GetNMcs (); |
558 |
uint8_t nMcs = m_phy->GetNMcs (); |
| 558 |
for (std::list<Mac48Address>::const_iterator i = m_staList.begin (); i != m_staList.end (); i++) |
559 |
for (std::map<Mac48Address, uint16_t>::const_iterator i = m_staList.begin (); i != m_staList.end (); i++) |
| 559 |
{ |
560 |
{ |
| 560 |
if (m_stationManager->GetHtSupported (*i)) |
561 |
if (m_stationManager->GetHtSupported (i->first)) |
| 561 |
{ |
562 |
{ |
| 562 |
uint64_t maxSupportedRateByHtSta = 0; //in bit/s |
563 |
uint64_t maxSupportedRateByHtSta = 0; //in bit/s |
| 563 |
for (uint8_t j = 0; j < (std::min (nMcs, m_stationManager->GetNMcsSupported (*i))); j++) |
564 |
for (uint8_t j = 0; j < (std::min (nMcs, m_stationManager->GetNMcsSupported (i->first))); j++) |
| 564 |
{ |
565 |
{ |
| 565 |
WifiMode mcs = m_phy->GetMcs (j); |
566 |
WifiMode mcs = m_phy->GetMcs (j); |
| 566 |
if (mcs.GetModulationClass () != WIFI_MOD_CLASS_HT) |
567 |
if (mcs.GetModulationClass () != WIFI_MOD_CLASS_HT) |
|
Lines 569-575
ApWifiMac::GetHtOperation (void) const
|
Link Here
|
|---|
|
| 569 |
} |
570 |
} |
| 570 |
uint8_t nss = (mcs.GetMcsValue () / 8) + 1; |
571 |
uint8_t nss = (mcs.GetMcsValue () / 8) + 1; |
| 571 |
NS_ASSERT (nss > 0 && nss < 5); |
572 |
NS_ASSERT (nss > 0 && nss < 5); |
| 572 |
uint64_t dataRate = mcs.GetDataRate (m_stationManager->GetChannelWidthSupported (*i), m_stationManager->GetShortGuardInterval (*i) ? 400 : 800, nss); |
573 |
uint64_t dataRate = mcs.GetDataRate (m_stationManager->GetChannelWidthSupported (i->first), m_stationManager->GetShortGuardInterval (i->first) ? 400 : 800, nss); |
| 573 |
if (dataRate > maxSupportedRateByHtSta) |
574 |
if (dataRate > maxSupportedRateByHtSta) |
| 574 |
{ |
575 |
{ |
| 575 |
maxSupportedRateByHtSta = dataRate; |
576 |
maxSupportedRateByHtSta = dataRate; |
|
Lines 579-591
ApWifiMac::GetHtOperation (void) const
|
Link Here
|
|---|
|
| 579 |
{ |
580 |
{ |
| 580 |
maxSupportedRate = maxSupportedRateByHtSta; |
581 |
maxSupportedRate = maxSupportedRateByHtSta; |
| 581 |
} |
582 |
} |
| 582 |
if (m_stationManager->GetNMcsSupported (*i) < nMcs) |
583 |
if (m_stationManager->GetNMcsSupported (i->first) < nMcs) |
| 583 |
{ |
584 |
{ |
| 584 |
nMcs = m_stationManager->GetNMcsSupported (*i); |
585 |
nMcs = m_stationManager->GetNMcsSupported (i->first); |
| 585 |
} |
586 |
} |
| 586 |
if (m_stationManager->GetNumberOfSupportedStreams (*i) < maxSpatialStream) |
587 |
if (m_stationManager->GetNumberOfSupportedStreams (i->first) < maxSpatialStream) |
| 587 |
{ |
588 |
{ |
| 588 |
maxSpatialStream = m_stationManager->GetNumberOfSupportedStreams (*i); |
589 |
maxSpatialStream = m_stationManager->GetNumberOfSupportedStreams (i->first); |
| 589 |
} |
590 |
} |
| 590 |
} |
591 |
} |
| 591 |
} |
592 |
} |
|
Lines 736-742
ApWifiMac::SendAssocResp (Mac48Address to, bool success)
|
Link Here
|
|---|
|
| 736 |
if (success) |
737 |
if (success) |
| 737 |
{ |
738 |
{ |
| 738 |
code.SetSuccess (); |
739 |
code.SetSuccess (); |
| 739 |
m_staList.push_back (to); |
740 |
uint16_t aid = AllocateAid (to); |
|
|
741 |
assoc.SetAid (aid); |
| 740 |
} |
742 |
} |
| 741 |
else |
743 |
else |
| 742 |
{ |
744 |
{ |
|
Lines 1147-1160
ApWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
|
Link Here
|
|---|
|
| 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 |
DeallocateAid (from); |
| 1151 |
{ |
|
|
| 1152 |
if ((*i) == from) |
| 1153 |
{ |
| 1154 |
m_staList.erase (i); |
| 1155 |
break; |
| 1156 |
} |
| 1157 |
} |
| 1158 |
for (std::list<Mac48Address>::const_iterator j = m_nonErpStations.begin (); j != m_nonErpStations.end (); j++) |
1153 |
for (std::list<Mac48Address>::const_iterator j = m_nonErpStations.begin (); j != m_nonErpStations.end (); j++) |
| 1159 |
{ |
1154 |
{ |
| 1160 |
if ((*j) == from) |
1155 |
if ((*j) == from) |
|
Lines 1261-1264
ApWifiMac::GetRifsMode (void) const
|
Link Here
|
|---|
|
| 1261 |
return rifsMode; |
1256 |
return rifsMode; |
| 1262 |
} |
1257 |
} |
| 1263 |
|
1258 |
|
|
|
1259 |
uint16_t |
| 1260 |
ApWifiMac::GetNextAid (void) |
| 1261 |
{ |
| 1262 |
NS_LOG_FUNCTION (this); |
| 1263 |
uint16_t retval = m_nextAid++; |
| 1264 |
NS_ASSERT (retval != 0 && retval <= 2007); // values given for non-DMG stations (802.11-2016 section 9.4.1.8.)) |
| 1265 |
return retval; |
| 1266 |
} |
| 1267 |
|
| 1268 |
uint16_t |
| 1269 |
ApWifiMac::GetAidByAddress (Mac48Address addr) const |
| 1270 |
{ |
| 1271 |
std::map<Mac48Address, uint16_t>::const_iterator i = m_staList.find (addr); |
| 1272 |
if (i != m_staList.end ()) |
| 1273 |
{ |
| 1274 |
return i->second; |
| 1275 |
} |
| 1276 |
return 0; |
| 1277 |
} |
| 1278 |
|
| 1279 |
Mac48Address |
| 1280 |
ApWifiMac::GetAddressByAid (uint16_t aid) const |
| 1281 |
{ |
| 1282 |
for (std::map<Mac48Address, uint16_t>::const_iterator i = m_staList.begin (); i != m_staList.end (); i++) |
| 1283 |
{ |
| 1284 |
if (i->second == aid) |
| 1285 |
{ |
| 1286 |
return i->first; |
| 1287 |
} |
| 1288 |
} |
| 1289 |
return Mac48Address::GetBroadcast (); |
| 1290 |
} |
| 1291 |
|
| 1292 |
bool |
| 1293 |
ApWifiMac::IsAllocated (uint16_t aid) const |
| 1294 |
{ |
| 1295 |
for (std::map<Mac48Address, uint16_t>::const_iterator i = m_staList.begin (); i != m_staList.end (); i++) |
| 1296 |
{ |
| 1297 |
if (i->second == aid) |
| 1298 |
{ |
| 1299 |
return true; |
| 1300 |
} |
| 1301 |
} |
| 1302 |
return false; |
| 1303 |
} |
| 1304 |
|
| 1305 |
uint16_t |
| 1306 |
ApWifiMac::AllocateAid (Mac48Address addr) |
| 1307 |
{ |
| 1308 |
NS_LOG_FUNCTION (this << addr); |
| 1309 |
uint16_t aid = GetNextAid (); |
| 1310 |
NS_ASSERT (!IsAllocated (aid)); |
| 1311 |
m_staList[addr] = aid; |
| 1312 |
return aid; |
| 1313 |
} |
| 1314 |
|
| 1315 |
void |
| 1316 |
ApWifiMac::DeallocateAid (Mac48Address addr) |
| 1317 |
{ |
| 1318 |
NS_LOG_FUNCTION (this << addr); |
| 1319 |
NS_ASSERT (m_staList.find (addr) != m_staList.end ()); |
| 1320 |
m_staList.erase (addr); |
| 1321 |
} |
| 1322 |
|
| 1323 |
|
| 1264 |
} //namespace ns3 |
1324 |
} //namespace ns3 |