View | Details | Raw Unified | Return to bug 2848
Collapse All | Expand All

(-)a/src/wifi/model/ap-wifi-mac.cc (-20 / +37 lines)
 Lines 200-208    Link Here 
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
            }
 Lines 233-241    Link Here 
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;
 Lines 249-261    Link Here 
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
    }
 Lines 555-566    Link Here 
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)
 Lines 569-575    Link Here 
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;
 Lines 579-591    Link Here 
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
        }
 Lines 736-742    Link Here 
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
    {
 Lines 1147-1157    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
              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
                }
 Lines 1261-1264    Link Here 
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
(-)a/src/wifi/model/ap-wifi-mac.h (-1 / +6 lines)
 Lines 289-301    Link Here 
289
  void DoDispose (void);
289
  void DoDispose (void);
290
  void DoInitialize (void);
290
  void DoInitialize (void);
291
291
292
  /**
293
   * \return the next Association ID to be allocated by the AP
294
   */
295
  uint16_t GetNextAssociationId (void);
296
292
  Ptr<DcaTxop> m_beaconDca;                  //!< Dedicated DcaTxop for beacons
297
  Ptr<DcaTxop> m_beaconDca;                  //!< Dedicated DcaTxop for beacons
293
  Time m_beaconInterval;                     //!< Interval between beacons
298
  Time m_beaconInterval;                     //!< Interval between beacons
294
  bool m_enableBeaconGeneration;             //!< Flag whether beacons are being generated
299
  bool m_enableBeaconGeneration;             //!< Flag whether beacons are being generated
295
  EventId m_beaconEvent;                     //!< Event to generate one beacon
300
  EventId m_beaconEvent;                     //!< Event to generate one beacon
296
  Ptr<UniformRandomVariable> m_beaconJitter; //!< UniformRandomVariable used to randomize the time of the first beacon
301
  Ptr<UniformRandomVariable> m_beaconJitter; //!< UniformRandomVariable used to randomize the time of the first beacon
297
  bool m_enableBeaconJitter;                 //!< Flag whether the first beacon should be generated at random time
302
  bool m_enableBeaconJitter;                 //!< Flag whether the first beacon should be generated at random time
298
  std::list<Mac48Address> m_staList;         //!< List of all stations currently associated to the AP
303
  std::map<uint16_t, Mac48Address> m_staList;//!< Map of all stations currently associated to the AP with their association ID
299
  std::list<Mac48Address> m_nonErpStations;  //!< List of all non-ERP stations currently associated to the AP
304
  std::list<Mac48Address> m_nonErpStations;  //!< List of all non-ERP stations currently associated to the AP
300
  std::list<Mac48Address> m_nonHtStations;   //!< List of all non-HT stations currently associated to the AP
305
  std::list<Mac48Address> m_nonHtStations;   //!< List of all non-HT stations currently associated to the AP
301
  bool m_enableNonErpProtection;             //!< Flag whether protection mechanism is used or not when non-ERP STAs are present within the BSS
306
  bool m_enableNonErpProtection;             //!< Flag whether protection mechanism is used or not when non-ERP STAs are present within the BSS
(-)a/src/wifi/model/mgt-headers.cc (+7 lines)
 Lines 48-53    Link Here 
48
}
48
}
49
49
50
void
50
void
51
MgtAssocResponseHeader::SetAssociationId (uint16_t aid)
52
{
53
  m_aid = aid;
54
}
55
56
void
51
MgtProbeRequestHeader::SetSupportedRates (SupportedRates rates)
57
MgtProbeRequestHeader::SetSupportedRates (SupportedRates rates)
52
{
58
{
53
  m_rates = rates;
59
  m_rates = rates;
 Lines 880-885    Link Here 
880
MgtAssocResponseHeader::Print (std::ostream &os) const
886
MgtAssocResponseHeader::Print (std::ostream &os) const
881
{
887
{
882
  os << "status code=" << m_code << ", "
888
  os << "status code=" << m_code << ", "
889
     << "aid=" << m_aid << ", "
883
     << "rates=" << m_rates << ", "
890
     << "rates=" << m_rates << ", "
884
     << "ERP information=" << m_erpInformation << ", "
891
     << "ERP information=" << m_erpInformation << ", "
885
     << "HT Capabilities=" << m_htCapability << " , "
892
     << "HT Capabilities=" << m_htCapability << " , "
(-)a/src/wifi/model/mgt-headers.h (+6 lines)
 Lines 302-307    Link Here 
302
   */
302
   */
303
  void SetStatusCode (StatusCode code);
303
  void SetStatusCode (StatusCode code);
304
  /**
304
  /**
305
   * Set the association ID.
306
   *
307
   * \param aid the association ID
308
   */
309
  void SetAssociationId (uint16_t aid);
310
  /**
305
   * Set the ERP information.
311
   * Set the ERP information.
306
   *
312
   *
307
   * \param erpInformation the ERP information
313
   * \param erpInformation the ERP information

Return to bug 2848