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

(-)a/src/wifi/model/aarf-wifi-manager.cc (-1 / +1 lines)
 Lines 255-261    Link Here 
255
      channelWidth = 20;
255
      channelWidth = 20;
256
    }
256
    }
257
  WifiTxVector rtsTxVector;
257
  WifiTxVector rtsTxVector;
258
  if (GetUseProtection () == false)
258
  if (GetUseNonErpProtection () == false)
259
    {
259
    {
260
      rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
260
      rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
261
    }
261
    }
(-)a/src/wifi/model/aarfcd-wifi-manager.cc (-1 / +1 lines)
 Lines 327-333    Link Here 
327
      channelWidth = 20;
327
      channelWidth = 20;
328
    }
328
    }
329
  WifiTxVector rtsTxVector;
329
  WifiTxVector rtsTxVector;
330
  if (GetUseProtection () == false)
330
  if (GetUseNonErpProtection () == false)
331
    {
331
    {
332
      rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
332
      rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
333
    }
333
    }
(-)a/src/wifi/model/amrr-wifi-manager.cc (-1 / +1 lines)
 Lines 357-363    Link Here 
357
    }
357
    }
358
  UpdateMode (station);
358
  UpdateMode (station);
359
  WifiTxVector rtsTxVector;
359
  WifiTxVector rtsTxVector;
360
  if (GetUseProtection () == false)
360
  if (GetUseNonErpProtection () == false)
361
    {
361
    {
362
      rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
362
      rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
363
    }
363
    }
(-)a/src/wifi/model/ap-wifi-mac.cc (-21 / +78 lines)
 Lines 50-70    Link Here 
50
    .SetParent<RegularWifiMac> ()
50
    .SetParent<RegularWifiMac> ()
51
    .SetGroupName ("Wifi")
51
    .SetGroupName ("Wifi")
52
    .AddConstructor<ApWifiMac> ()
52
    .AddConstructor<ApWifiMac> ()
53
    .AddAttribute ("BeaconInterval", "Delay between two beacons",
53
    .AddAttribute ("BeaconInterval",
54
                   "Delay between two beacons",
54
                   TimeValue (MicroSeconds (102400)),
55
                   TimeValue (MicroSeconds (102400)),
55
                   MakeTimeAccessor (&ApWifiMac::GetBeaconInterval,
56
                   MakeTimeAccessor (&ApWifiMac::GetBeaconInterval,
56
                                     &ApWifiMac::SetBeaconInterval),
57
                                     &ApWifiMac::SetBeaconInterval),
57
                   MakeTimeChecker ())
58
                   MakeTimeChecker ())
58
    .AddAttribute ("BeaconJitter", "A uniform random variable to cause the initial beacon starting time (after simulation time 0) "
59
    .AddAttribute ("BeaconJitter",
60
                   "A uniform random variable to cause the initial beacon starting time (after simulation time 0) "
59
                   "to be distributed between 0 and the BeaconInterval.",
61
                   "to be distributed between 0 and the BeaconInterval.",
60
                   StringValue ("ns3::UniformRandomVariable"),
62
                   StringValue ("ns3::UniformRandomVariable"),
61
                   MakePointerAccessor (&ApWifiMac::m_beaconJitter),
63
                   MakePointerAccessor (&ApWifiMac::m_beaconJitter),
62
                   MakePointerChecker<UniformRandomVariable> ())
64
                   MakePointerChecker<UniformRandomVariable> ())
63
    .AddAttribute ("EnableBeaconJitter", "If beacons are enabled, whether to jitter the initial send event.",
65
    .AddAttribute ("EnableBeaconJitter",
66
                   "If beacons are enabled, whether to jitter the initial send event.",
64
                   BooleanValue (false),
67
                   BooleanValue (false),
65
                   MakeBooleanAccessor (&ApWifiMac::m_enableBeaconJitter),
68
                   MakeBooleanAccessor (&ApWifiMac::m_enableBeaconJitter),
66
                   MakeBooleanChecker ())
69
                   MakeBooleanChecker ())
67
    .AddAttribute ("BeaconGeneration", "Whether or not beacons are generated.",
70
    .AddAttribute ("BeaconGeneration",
71
                   "Whether or not beacons are generated.",
68
                   BooleanValue (true),
72
                   BooleanValue (true),
69
                   MakeBooleanAccessor (&ApWifiMac::SetBeaconGeneration,
73
                   MakeBooleanAccessor (&ApWifiMac::SetBeaconGeneration,
70
                                        &ApWifiMac::GetBeaconGeneration),
74
                                        &ApWifiMac::GetBeaconGeneration),
 Lines 100-105    Link Here 
100
  NS_LOG_FUNCTION (this);
104
  NS_LOG_FUNCTION (this);
101
  m_staList.clear();
105
  m_staList.clear();
102
  m_nonErpStations.clear ();
106
  m_nonErpStations.clear ();
107
  m_nonHtStations.clear ();
103
}
108
}
104
109
105
void
110
void
 Lines 396-402    Link Here 
396
  if (m_erpSupported)
401
  if (m_erpSupported)
397
    {
402
    {
398
      information.SetNonErpPresent (!m_nonErpStations.empty ());
403
      information.SetNonErpPresent (!m_nonErpStations.empty ());
399
      information.SetUseProtection (GetUseProtection ());
404
      information.SetUseProtection (GetUseNonErpProtection ());
400
      if (GetShortPreambleEnabled ())
405
      if (GetShortPreambleEnabled ())
401
        {
406
        {
402
          information.SetBarkerPreambleMode (0);
407
          information.SetBarkerPreambleMode (0);
 Lines 442-447    Link Here 
442
  return capabilities;
447
  return capabilities;
443
}
448
}
444
449
450
HtOperations
451
ApWifiMac::GetHtOperations (void) const
452
{
453
  HtOperations operations;
454
  operations.SetHtSupported (1);
455
  if (m_htSupported)
456
    {
457
      if (!m_nonHtStations.empty ())
458
        {
459
          operations.SetHtProtection (MIXED_MODE_PROTECTION);
460
        }
461
      else
462
        {
463
          operations.SetHtProtection (NO_PROTECTION);
464
        }
465
    }
466
  return operations;
467
}
468
445
VhtCapabilities
469
VhtCapabilities
446
ApWifiMac::GetVhtCapabilities (void) const
470
ApWifiMac::GetVhtCapabilities (void) const
447
{
471
{
 Lines 504-509    Link Here 
504
  if (m_htSupported || m_vhtSupported)
528
  if (m_htSupported || m_vhtSupported)
505
    {
529
    {
506
      probe.SetHtCapabilities (GetHtCapabilities ());
530
      probe.SetHtCapabilities (GetHtCapabilities ());
531
      probe.SetHtOperations (GetHtOperations ());
507
      hdr.SetNoOrder ();
532
      hdr.SetNoOrder ();
508
    }
533
    }
509
  if (m_vhtSupported)
534
  if (m_vhtSupported)
 Lines 552-557    Link Here 
552
  if (m_htSupported || m_vhtSupported)
577
  if (m_htSupported || m_vhtSupported)
553
    {
578
    {
554
      assoc.SetHtCapabilities (GetHtCapabilities ());
579
      assoc.SetHtCapabilities (GetHtCapabilities ());
580
      assoc.SetHtOperations (GetHtOperations ());
555
      hdr.SetNoOrder ();
581
      hdr.SetNoOrder ();
556
    }
582
    }
557
  if (m_vhtSupported)
583
  if (m_vhtSupported)
 Lines 593-598    Link Here 
593
  if (m_htSupported || m_vhtSupported)
619
  if (m_htSupported || m_vhtSupported)
594
    {
620
    {
595
      beacon.SetHtCapabilities (GetHtCapabilities ());
621
      beacon.SetHtCapabilities (GetHtCapabilities ());
622
      beacon.SetHtOperations (GetHtOperations ());
596
      hdr.SetNoOrder ();
623
      hdr.SetNoOrder ();
597
    }
624
    }
598
  if (m_vhtSupported)
625
  if (m_vhtSupported)
 Lines 746-751    Link Here 
746
              m_stationManager->AddSupportedPlcpPreamble (from, capabilities.IsShortPreamble ());
773
              m_stationManager->AddSupportedPlcpPreamble (from, capabilities.IsShortPreamble ());
747
              SupportedRates rates = assocReq.GetSupportedRates ();
774
              SupportedRates rates = assocReq.GetSupportedRates ();
748
              bool problem = false;
775
              bool problem = false;
776
              bool isVhtStation = false;
777
              bool isHtStation = false;
778
              bool isOfdmStation = false;
749
              bool isErpStation = false;
779
              bool isErpStation = false;
750
              bool isDsssStation = false;
780
              bool isDsssStation = false;
751
              for (uint32_t i = 0; i < m_stationManager->GetNBasicModes (); i++)
781
              for (uint32_t i = 0; i < m_stationManager->GetNBasicModes (); i++)
 Lines 761-767    Link Here 
761
                        {
791
                        {
762
                          isErpStation = false;
792
                          isErpStation = false;
763
                        }
793
                        }
764
                      if (isDsssStation == false && isErpStation == false)
794
                      else if (mode.GetModulationClass () == WIFI_MOD_CLASS_OFDM)
795
                        {
796
                          isOfdmStation = false;
797
                        }
798
                      if (isDsssStation == false && isErpStation == false && isOfdmStation == false)
765
                        {
799
                        {
766
                          problem = true;
800
                          problem = true;
767
                          break;
801
                          break;
 Lines 777-810    Link Here 
777
                        {
811
                        {
778
                          isErpStation = true;
812
                          isErpStation = true;
779
                        }
813
                        }
814
                      else if (mode.GetModulationClass () == WIFI_MOD_CLASS_OFDM)
815
                        {
816
                          isOfdmStation = true;
817
                        }
780
                    }
818
                    }
781
                }
819
                }
782
              m_stationManager->AddSupportedErpSlotTime (from, capabilities.IsShortSlotTime () && isErpStation);
820
              m_stationManager->AddSupportedErpSlotTime (from, capabilities.IsShortSlotTime () && isErpStation);
783
              if (m_htSupported)
821
              if (m_htSupported)
784
                {
822
                {
785
                  //check that the STA supports all MCSs in Basic MCS Set
823
                  //check whether the HT STA supports all MCSs in Basic MCS Set
786
                  HtCapabilities htcapabilities = assocReq.GetHtCapabilities ();
824
                  HtCapabilities htcapabilities = assocReq.GetHtCapabilities ();
787
                  for (uint32_t i = 0; i < m_stationManager->GetNBasicMcs (); i++)
825
                  if (htcapabilities.GetHtCapabilitiesInfo () != 0)
788
                    {
826
                    {
789
                      WifiMode mcs = m_stationManager->GetBasicMcs (i);
827
                      isHtStation = true;
790
                      if (!htcapabilities.IsSupportedMcs (mcs.GetMcsValue ()))
828
                      for (uint32_t i = 0; i < m_stationManager->GetNBasicMcs (); i++)
791
                        {
829
                        {
792
                          problem = true;
830
                          WifiMode mcs = m_stationManager->GetBasicMcs (i);
793
                          break;
831
                          if (!htcapabilities.IsSupportedMcs (mcs.GetMcsValue ()))
832
                            {
833
                              problem = true;
834
                              break;
835
                            }
794
                        }
836
                        }
795
                    }
837
                    }
796
                }
838
                }
797
              if (m_vhtSupported)
839
              if (m_vhtSupported)
798
                {
840
                {
799
                  //check that the STA supports all MCSs in Basic MCS Set
841
                  //check whether the VHT STA supports all MCSs in Basic MCS Set
800
                  VhtCapabilities vhtcapabilities = assocReq.GetVhtCapabilities ();
842
                  VhtCapabilities vhtcapabilities = assocReq.GetVhtCapabilities ();
801
                  for (uint32_t i = 0; i < m_stationManager->GetNBasicMcs (); i++)
843
                  if (vhtcapabilities.GetVhtCapabilitiesInfo () != 0)
802
                    {
844
                    {
803
                      WifiMode mcs = m_stationManager->GetBasicMcs (i);
845
                      isVhtStation = true;
804
                      if (!vhtcapabilities.IsSupportedTxMcs (mcs.GetMcsValue ()))
846
                      for (uint32_t i = 0; i < m_stationManager->GetNBasicMcs (); i++)
805
                        {
847
                        {
806
                          problem = true;
848
                          WifiMode mcs = m_stationManager->GetBasicMcs (i);
807
                          break;
849
                          if (!vhtcapabilities.IsSupportedTxMcs (mcs.GetMcsValue ()))
850
                            {
851
                              problem = true;
852
                              break;
853
                            }
808
                        }
854
                        }
809
                    }
855
                    }
810
                }
856
                }
 Lines 855-860    Link Here 
855
                        }
901
                        }
856
                    }
902
                    }
857
                  m_stationManager->RecordWaitAssocTxOk (from);
903
                  m_stationManager->RecordWaitAssocTxOk (from);
904
                  if (!isHtStation)
905
                    {
906
                      m_nonHtStations.push_back (hdr->GetAddr2 ());
907
                    }
858
                  if (!isErpStation && isDsssStation)
908
                  if (!isErpStation && isDsssStation)
859
                    {
909
                    {
860
                      m_nonErpStations.push_back (hdr->GetAddr2 ());
910
                      m_nonErpStations.push_back (hdr->GetAddr2 ());
 Lines 883-888    Link Here 
883
                    break;
933
                    break;
884
                  }
934
                  }
885
              }
935
              }
936
              for (std::list<Mac48Address>::iterator j = m_nonHtStations.begin (); j != m_nonHtStations.end (); j++)
937
              {
938
                if ((*j) == from)
939
                  {
940
                    m_nonHtStations.erase (j);
941
                    break;
942
                  }
943
              }
886
              return;
944
              return;
887
            }
945
            }
888
        }
946
        }
 Lines 944-955    Link Here 
944
}
1002
}
945
1003
946
bool
1004
bool
947
ApWifiMac::GetUseProtection (void) const
1005
ApWifiMac::GetUseNonErpProtection (void) const
948
{
1006
{
949
  bool useProtection = !m_nonErpStations.empty () && m_enableNonErpProtection;
1007
  bool useProtection = !m_nonErpStations.empty () && m_enableNonErpProtection;
950
  m_stationManager->SetUseProtection (useProtection);
1008
  m_stationManager->SetUseNonErpProtection (useProtection);
951
  return useProtection;
1009
  return useProtection;
952
}
1010
}
953
1011
954
955
} //namespace ns3
1012
} //namespace ns3
(-)a/src/wifi/model/ap-wifi-mac.h (-3 / +16 lines)
 Lines 26-31    Link Here 
26
#include "regular-wifi-mac.h"
26
#include "regular-wifi-mac.h"
27
#include "capability-information.h"
27
#include "capability-information.h"
28
#include "ht-capabilities.h"
28
#include "ht-capabilities.h"
29
#include "ht-operations.h"
29
#include "vht-capabilities.h"
30
#include "vht-capabilities.h"
30
#include "amsdu-subframe-header.h"
31
#include "amsdu-subframe-header.h"
31
#include "supported-rates.h"
32
#include "supported-rates.h"
 Lines 214-219    Link Here 
214
   */
215
   */
215
  HtCapabilities GetHtCapabilities (void) const;
216
  HtCapabilities GetHtCapabilities (void) const;
216
  /**
217
  /**
218
   * Return the HT operations of the current AP.
219
   *
220
   * \return the HT operations that we support
221
   */
222
  HtOperations GetHtOperations (void) const;
223
  /**
217
   * Return the VHT capability of the current AP.
224
   * Return the VHT capability of the current AP.
218
   *
225
   *
219
   * \return the VHT capability that we support
226
   * \return the VHT capability that we support
 Lines 238-245    Link Here 
238
   * \return true if beacons are periodically generated, false otherwise
245
   * \return true if beacons are periodically generated, false otherwise
239
   */
246
   */
240
  bool GetBeaconGeneration (void) const;
247
  bool GetBeaconGeneration (void) const;
241
  
248
  /**
242
  bool GetUseProtection (void) const;
249
   * Return whether protection for non-ERP stations is used in the BSS.
250
   *
251
   * \return true if protection for non-ERP stations is used in the BSS, 
252
   *         false otherwise
253
   */
254
  bool GetUseNonErpProtection (void) const;
243
255
244
  virtual void DoDispose (void);
256
  virtual void DoDispose (void);
245
  virtual void DoInitialize (void);
257
  virtual void DoInitialize (void);
 Lines 251-257    Link Here 
251
  Ptr<UniformRandomVariable> m_beaconJitter; //!< UniformRandomVariable used to randomize the time of the first beacon
263
  Ptr<UniformRandomVariable> m_beaconJitter; //!< UniformRandomVariable used to randomize the time of the first beacon
252
  bool m_enableBeaconJitter;                 //!< Flag whether the first beacon should be generated at random time
264
  bool m_enableBeaconJitter;                 //!< Flag whether the first beacon should be generated at random time
253
  std::list<Mac48Address> m_staList;         //!< List of all stations currently associated to the AP
265
  std::list<Mac48Address> m_staList;         //!< List of all stations currently associated to the AP
254
  std::list<Mac48Address> m_nonErpStations;  //!< List of all 802.11b stations currently associated to the AP
266
  std::list<Mac48Address> m_nonErpStations;  //!< List of all non-ERP stations currently associated to the AP
267
  std::list<Mac48Address> m_nonHtStations;   //!< List of all non-HT stations currently associated to the AP
255
  bool m_enableNonErpProtection;             //!< Flag whether protection mechanism is used or not when non-ERP STAs are present within the BSS
268
  bool m_enableNonErpProtection;             //!< Flag whether protection mechanism is used or not when non-ERP STAs are present within the BSS
256
};
269
};
257
270
(-)a/src/wifi/model/aparf-wifi-manager.cc (-1 / +1 lines)
 Lines 346-352    Link Here 
346
      channelWidth = 20;
346
      channelWidth = 20;
347
    }
347
    }
348
  WifiTxVector rtsTxVector;
348
  WifiTxVector rtsTxVector;
349
  if (GetUseProtection () == false)
349
  if (GetUseNonErpProtection () == false)
350
    {
350
    {
351
      rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
351
      rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
352
    }
352
    }
(-)a/src/wifi/model/arf-wifi-manager.cc (-1 / +1 lines)
 Lines 231-237    Link Here 
231
      channelWidth = 20;
231
      channelWidth = 20;
232
    }
232
    }
233
  WifiTxVector rtsTxVector;
233
  WifiTxVector rtsTxVector;
234
  if (GetUseProtection () == false)
234
  if (GetUseNonErpProtection () == false)
235
    {
235
    {
236
      rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
236
      rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
237
    }
237
    }
(-)a/src/wifi/model/cara-wifi-manager.cc (-1 / +1 lines)
 Lines 206-212    Link Here 
206
      channelWidth = 20;
206
      channelWidth = 20;
207
    }
207
    }
208
  WifiTxVector rtsTxVector;
208
  WifiTxVector rtsTxVector;
209
  if (GetUseProtection () == false)
209
  if (GetUseNonErpProtection () == false)
210
    {
210
    {
211
      rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
211
      rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
212
    }
212
    }
(-)a/src/wifi/model/ht-capabilities.cc (+25 lines)
 Lines 175-185    Link Here 
175
}
175
}
176
176
177
void
177
void
178
HtCapabilities::SetTxRxMcsSetUnequal (uint8_t txrxmcssetunequal)
179
{
180
  m_txRxMcsSetUnequal = txrxmcssetunequal;
181
}
182
183
void
178
HtCapabilities::SetTxMaxNSpatialStreams (uint8_t maxtxspatialstreams)
184
HtCapabilities::SetTxMaxNSpatialStreams (uint8_t maxtxspatialstreams)
179
{
185
{
180
  m_txMaxNSpatialStreams = maxtxspatialstreams;
186
  m_txMaxNSpatialStreams = maxtxspatialstreams;
181
}
187
}
182
188
189
void
190
HtCapabilities::SetTxUnequalModulation (uint8_t txunequalmodulation)
191
{
192
  m_txUnequalModulation = txunequalmodulation;
193
}
194
183
uint8_t
195
uint8_t
184
HtCapabilities::GetLdpc (void) const
196
HtCapabilities::GetLdpc (void) const
185
{
197
{
 Lines 259-270    Link Here 
259
}
271
}
260
272
261
uint8_t
273
uint8_t
274
HtCapabilities::GetTxRxMcsSetUnequal (void) const
275
{
276
  return m_txRxMcsSetUnequal;
277
}
278
279
280
uint8_t
262
HtCapabilities::GetTxMaxNSpatialStreams (void) const
281
HtCapabilities::GetTxMaxNSpatialStreams (void) const
263
{
282
{
264
  return m_txMaxNSpatialStreams;
283
  return m_txMaxNSpatialStreams;
265
}
284
}
266
285
267
uint8_t
286
uint8_t
287
HtCapabilities::GetTxUnequalModulation (void) const
288
{
289
  return m_txUnequalModulation;
290
}
291
292
uint8_t
268
HtCapabilities::GetInformationFieldSize () const
293
HtCapabilities::GetInformationFieldSize () const
269
{
294
{
270
  //we should not be here if ht is not supported
295
  //we should not be here if ht is not supported
(-)a/src/wifi/model/ht-capabilities.h (+4 lines)
 Lines 100-106    Link Here 
100
  void SetRxMcsBitmask (uint8_t index);
100
  void SetRxMcsBitmask (uint8_t index);
101
  void SetRxHighestSupportedDataRate (uint16_t maxsupportedrate);
101
  void SetRxHighestSupportedDataRate (uint16_t maxsupportedrate);
102
  void SetTxMcsSetDefined (uint8_t txmcssetdefined);
102
  void SetTxMcsSetDefined (uint8_t txmcssetdefined);
103
  void SetTxRxMcsSetUnequal (uint8_t txrxmcssetunequal);
103
  void SetTxMaxNSpatialStreams (uint8_t maxtxspatialstreams);
104
  void SetTxMaxNSpatialStreams (uint8_t maxtxspatialstreams);
105
  void SetTxUnequalModulation (uint8_t txunequalmodulation);
104
106
105
  /*
107
  /*
106
   * Return the HT Capabilties Info field in the HT Capabilities information element.
108
   * Return the HT Capabilties Info field in the HT Capabilities information element.
 Lines 159-165    Link Here 
159
  bool IsSupportedMcs (uint8_t mcs);
161
  bool IsSupportedMcs (uint8_t mcs);
160
  uint16_t GetRxHighestSupportedDataRate (void) const;
162
  uint16_t GetRxHighestSupportedDataRate (void) const;
161
  uint8_t GetTxMcsSetDefined (void) const;
163
  uint8_t GetTxMcsSetDefined (void) const;
164
  uint8_t GetTxRxMcsSetUnequal (void) const;
162
  uint8_t GetTxMaxNSpatialStreams (void) const;
165
  uint8_t GetTxMaxNSpatialStreams (void) const;
166
  uint8_t GetTxUnequalModulation (void) const;
163
167
164
  WifiInformationElementId ElementId () const;
168
  WifiInformationElementId ElementId () const;
165
  uint8_t GetInformationFieldSize () const;
169
  uint8_t GetInformationFieldSize () const;
(-)303b328f07e9 (+519 lines)
Added Link Here 
1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
 * Copyright (c) 2016 Sébastien Deronne
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License version 2 as
7
 * published by the Free Software Foundation;
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program; if not, write to the Free Software
16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
 *
18
 * Author: Sébastien Deronne <sebastien.deronne@gmail.com>
19
 */
20
21
#include "ht-operations.h"
22
#include "ns3/assert.h"
23
#include "ns3/log.h"
24
25
namespace ns3 {
26
27
NS_LOG_COMPONENT_DEFINE ("HtOperations");
28
29
HtOperations::HtOperations ()
30
  : m_primaryChannel (0),
31
    m_secondaryChannelOffset (0),
32
    m_staChannelWidth (0),
33
    m_rifsMode (0),
34
    m_reservedInformationSubset1 (0),
35
    m_htProtection (0),
36
    m_nonGfHtStasPresent (0),
37
    m_reservedInformationSubset2_1 (0),
38
    m_obssNonHtStasPresent (0),
39
    m_reservedInformationSubset2_2 (0),
40
    m_reservedInformationSubset3_1 (0),
41
    m_dualBeacon (0),
42
    m_dualCtsProtection (0),
43
    m_stbcBeacon (0),
44
    m_lSigTxopProtectionFullSupport (0),
45
    m_pcoActive (0),
46
    m_pcoPhase (0),
47
    m_reservedInformationSubset3_2 (0),
48
    m_reservedMcsSet1 (0),
49
    m_rxHighestSupportedDataRate (0),
50
    m_reservedMcsSet2 (0),
51
    m_txMcsSetDefined (0),
52
    m_txRxMcsSetUnequal (0),
53
    m_txMaxNSpatialStreams (0),
54
    m_txUnequalModulation (0),
55
    m_reservedMcsSet3 (0),
56
    m_htSupported (0)
57
{
58
  for (uint32_t k = 0; k < MAX_SUPPORTED_MCS; k++)
59
    {
60
      m_rxMcsBitmask[k] = 0;
61
    }
62
}
63
64
WifiInformationElementId
65
HtOperations::ElementId () const
66
{
67
  return IE_HT_OPERATIONS;
68
}
69
70
void
71
HtOperations::SetHtSupported (uint8_t htsupported)
72
{
73
  m_htSupported = htsupported;
74
}
75
76
uint8_t
77
HtOperations::GetInformationFieldSize () const
78
{
79
  //we should not be here if ht is not supported
80
  NS_ASSERT (m_htSupported > 0);
81
  return 22;
82
}
83
84
void
85
HtOperations::SetPrimaryChannel (uint8_t ctrl)
86
{
87
  m_primaryChannel = ctrl;
88
}
89
90
void
91
HtOperations::SetSecondaryChannelOffset (uint8_t secondarychanneloffset)
92
{
93
  m_secondaryChannelOffset = secondarychanneloffset;
94
}
95
96
void
97
HtOperations::SetStaChannelWidth (uint8_t stachannelwidth)
98
{
99
  m_staChannelWidth = stachannelwidth;
100
}
101
102
void
103
HtOperations::SetRifsMode (uint8_t rifsmode)
104
{
105
  m_rifsMode = rifsmode;
106
}
107
108
void
109
HtOperations::SetHtProtection (uint8_t htprotection)
110
{
111
  m_htProtection = htprotection;
112
}
113
114
void
115
HtOperations::SetNonGfHtStasPresent (uint8_t nongfhtstaspresent)
116
{
117
  m_nonGfHtStasPresent = nongfhtstaspresent;
118
}
119
120
void
121
HtOperations::SetObssNonHtStasPresent (uint8_t obssnonhtstaspresent)
122
{
123
  m_obssNonHtStasPresent = obssnonhtstaspresent;
124
}
125
126
void
127
HtOperations::SetDualBeacon (uint8_t dualbeacon)
128
{
129
  m_dualBeacon = dualbeacon;
130
}
131
132
void
133
HtOperations::SetDualCtsProtection (uint8_t dualctsprotection)
134
{
135
  m_dualCtsProtection = dualctsprotection;
136
}
137
138
void
139
HtOperations::SetStbcBeacon (uint8_t stbcbeacon)
140
{
141
  m_stbcBeacon = stbcbeacon;
142
}
143
144
void
145
HtOperations::SetLSigTxopProtectionFullSupport (uint8_t lsigtxopprotectionfullsupport)
146
{
147
  m_lSigTxopProtectionFullSupport = lsigtxopprotectionfullsupport;
148
}
149
150
void
151
HtOperations::SetPcoActive (uint8_t pcoactive)
152
{
153
  m_pcoActive = pcoactive;
154
}
155
156
void
157
HtOperations::SetPhase (uint8_t pcophase)
158
{
159
  m_pcoPhase = pcophase;
160
}
161
162
void
163
HtOperations::SetRxMcsBitmask (uint8_t index)
164
{
165
  m_rxMcsBitmask[index] = 1;
166
}
167
168
void
169
HtOperations::SetRxHighestSupportedDataRate (uint16_t maxsupportedrate)
170
{
171
  m_rxHighestSupportedDataRate = maxsupportedrate;
172
}
173
174
void
175
HtOperations::SetTxMcsSetDefined (uint8_t txmcssetdefined)
176
{
177
  m_txMcsSetDefined = txmcssetdefined;
178
}
179
180
void
181
HtOperations::SetTxRxMcsSetUnequal (uint8_t txrxmcssetunequal)
182
{
183
  m_txRxMcsSetUnequal = txrxmcssetunequal;
184
}
185
186
void
187
HtOperations::SetTxMaxNSpatialStreams (uint8_t maxtxspatialstreams)
188
{
189
  m_txMaxNSpatialStreams = maxtxspatialstreams;
190
}
191
192
void
193
HtOperations::SetTxUnequalModulation (uint8_t txunequalmodulation)
194
{
195
  m_txUnequalModulation = txunequalmodulation;
196
}
197
198
uint8_t
199
HtOperations::GetPrimaryChannel (void) const
200
{
201
  return m_primaryChannel;
202
}
203
204
uint8_t
205
HtOperations::GetSecondaryChannelOffset (void) const
206
{
207
  return m_secondaryChannelOffset;
208
}
209
210
uint8_t
211
HtOperations::GetStaChannelWidth (void) const
212
{
213
  return m_staChannelWidth;
214
}
215
216
uint8_t
217
HtOperations::GetRifsMode (void) const
218
{
219
  return m_rifsMode;
220
}
221
222
uint8_t
223
HtOperations::GetHtProtection (void) const
224
{
225
  return m_htProtection;
226
}
227
228
uint8_t
229
HtOperations::GetNonGfHtStasPresent (void) const
230
{
231
  return m_nonGfHtStasPresent;
232
}
233
234
uint8_t
235
HtOperations::GetObssNonHtStasPresent (void) const
236
{
237
  return m_obssNonHtStasPresent;
238
}
239
240
uint8_t
241
HtOperations::GetDualBeacon (void) const
242
{
243
  return m_dualBeacon;
244
}
245
246
uint8_t
247
HtOperations::GetDualCtsProtection (void) const
248
{
249
  return m_dualCtsProtection;
250
}
251
252
uint8_t
253
HtOperations::GetStbcBeacon (void) const
254
{
255
  return m_stbcBeacon;
256
}
257
258
uint8_t
259
HtOperations::GetLSigTxopProtectionFullSupport (void) const
260
{
261
  return m_lSigTxopProtectionFullSupport;
262
}
263
264
uint8_t
265
HtOperations::GetPcoActive (void) const
266
{
267
  return m_pcoActive;
268
}
269
270
uint8_t
271
HtOperations::GetPhase (void) const
272
{
273
  return m_pcoPhase;
274
}
275
276
bool
277
HtOperations::IsSupportedMcs (uint8_t mcs)
278
{
279
  if (m_rxMcsBitmask[mcs] == 1)
280
    {
281
      return true;
282
    }
283
  return false;
284
}
285
286
uint16_t
287
HtOperations::GetRxHighestSupportedDataRate (void) const
288
{
289
  return m_rxHighestSupportedDataRate;
290
}
291
292
uint8_t
293
HtOperations::GetTxMcsSetDefined (void) const
294
{
295
  return m_txMcsSetDefined;
296
}
297
298
uint8_t
299
HtOperations::GetTxRxMcsSetUnequal (void) const
300
{
301
  return m_txRxMcsSetUnequal;
302
}
303
304
uint8_t
305
HtOperations::GetTxMaxNSpatialStreams (void) const
306
{
307
  return m_txMaxNSpatialStreams;
308
}
309
310
uint8_t
311
HtOperations::GetTxUnequalModulation (void) const
312
{
313
  return m_txUnequalModulation;
314
}
315
316
Buffer::Iterator
317
HtOperations::Serialize (Buffer::Iterator i) const
318
{
319
  if (m_htSupported < 1)
320
    {
321
      return i;
322
    }
323
  return WifiInformationElement::Serialize (i);
324
}
325
326
uint16_t
327
HtOperations::GetSerializedSize () const
328
{
329
  if (m_htSupported < 1)
330
    {
331
      return 0;
332
    }
333
  return WifiInformationElement::GetSerializedSize ();
334
}
335
336
uint8_t
337
HtOperations::GetInformationSubset1 (void) const
338
{
339
  uint16_t val = 0;
340
  val |= m_secondaryChannelOffset & 0x03;
341
  val |= (m_staChannelWidth & 0x01) << 2;
342
  val |= (m_rifsMode & 0x01) << 3;
343
  val |= (m_reservedInformationSubset1 & 0x0f) << 4;
344
  return val;
345
}
346
347
void
348
HtOperations::SetInformationSubset1 (uint8_t ctrl)
349
{
350
  m_secondaryChannelOffset = ctrl & 0x03;
351
  m_staChannelWidth = (ctrl >> 2) & 0x01;
352
  m_rifsMode = (ctrl >> 3) & 0x01;
353
  m_reservedInformationSubset1 = (ctrl >> 4) & 0x0f;
354
}
355
356
uint16_t
357
HtOperations::GetInformationSubset2 (void) const
358
{
359
  uint16_t val = 0;
360
  val |= m_htProtection & 0x03;
361
  val |= (m_nonGfHtStasPresent & 0x01) << 2;
362
  val |= (m_reservedInformationSubset2_1 & 0x01) << 3;
363
  val |= (m_obssNonHtStasPresent & 0x01) << 4;
364
  val |= (m_reservedInformationSubset2_1 & 0x07ff) << 5;
365
  return val;
366
}
367
368
void
369
HtOperations::SetInformationSubset2 (uint16_t ctrl)
370
{
371
  m_htProtection = ctrl & 0x03;
372
  m_nonGfHtStasPresent = (ctrl >> 2) & 0x01;
373
  m_reservedInformationSubset2_1 = (ctrl >> 3) & 0x01;
374
  m_obssNonHtStasPresent = (ctrl >> 4) & 0x01;
375
  m_reservedInformationSubset2_1 = (ctrl >> 5) & 0x07ff;
376
}
377
378
uint16_t
379
HtOperations::GetInformationSubset3 (void) const
380
{
381
  uint16_t val = 0;
382
  val |= m_reservedInformationSubset3_1 & 0x3f;
383
  val |= (m_dualBeacon & 0x01) << 6;
384
  val |= (m_dualCtsProtection & 0x01) << 7;
385
  val |= (m_stbcBeacon & 0x01) << 8;
386
  val |= (m_lSigTxopProtectionFullSupport & 0x01) << 9;
387
  val |= (m_pcoActive & 0x01) << 10;
388
  val |= (m_pcoPhase & 0x01) << 11;
389
  val |= (m_reservedInformationSubset3_2 & 0x0f) << 12;
390
  return val;
391
}
392
393
void
394
HtOperations::SetInformationSubset3 (uint16_t ctrl)
395
{
396
  m_reservedInformationSubset3_1 = ctrl & 0x3f;
397
  m_dualBeacon = (ctrl >> 6) & 0x01;
398
  m_dualCtsProtection = (ctrl >> 7) & 0x01;
399
  m_stbcBeacon = (ctrl >> 8) & 0x01;
400
  m_lSigTxopProtectionFullSupport = (ctrl >> 9) & 0x01;
401
  m_pcoActive = (ctrl >> 10) & 0x01;
402
  m_pcoPhase = (ctrl >> 11) & 0x01;
403
  m_reservedInformationSubset3_2 = (ctrl >> 12) & 0x0f;
404
}
405
406
void
407
HtOperations::SetBasicMcsSet (uint64_t ctrl1, uint64_t ctrl2)
408
{
409
  for (uint64_t i = 0; i < 77; i++)
410
    {
411
      if (i < 64)
412
        {
413
          m_rxMcsBitmask[i] = (ctrl1 >> i) & 0x01;
414
        }
415
      else
416
        {
417
          m_rxMcsBitmask[i] = (ctrl2 >> (i - 64)) & 0x01;
418
        }
419
    }
420
  m_reservedMcsSet1 = (ctrl2 >> 13) & 0x07;
421
  m_rxHighestSupportedDataRate = (ctrl2 >> 16) & 0x03ff;
422
  m_reservedMcsSet2 = (ctrl2 >> 26) & 0x3f;
423
  m_txMcsSetDefined = (ctrl2 >> 32) & 0x01;
424
  m_txRxMcsSetUnequal = (ctrl2 >> 33) & 0x01;
425
  m_txMaxNSpatialStreams = (ctrl2 >> 34) & 0x03;
426
  m_txUnequalModulation = (ctrl2 >> 36) & 0x01;
427
  m_reservedMcsSet3 = (ctrl2 >> 37) & 0x07ffffff;
428
}
429
430
uint64_t
431
HtOperations::GetBasicMcsSet1 (void) const
432
{
433
  uint64_t val = 0;
434
  for (uint64_t i = 63; i > 0; i--)
435
    {
436
      val = (val << 1) | (m_rxMcsBitmask[i] & 0x01);
437
    }
438
  val = (val << 1) | (m_rxMcsBitmask[0] & 0x01);
439
  return val;
440
}
441
442
uint64_t
443
HtOperations::GetBasicMcsSet2 (void) const
444
{
445
  uint64_t val = 0;
446
  val = val | (m_reservedMcsSet3 & 0x07ffffff);
447
  val = (val << 1) | (m_txUnequalModulation & 0x01);
448
  val = (val << 2) | (m_txMaxNSpatialStreams & 0x03);
449
  val = (val << 1) | (m_txRxMcsSetUnequal & 0x01);
450
  val = (val << 1) | (m_txMcsSetDefined & 0x01);
451
  val = (val << 6) | (m_reservedMcsSet2 & 0x3f);
452
  val = (val << 10) | (m_rxHighestSupportedDataRate & 0x3ff);
453
  val = (val << 3) | (m_reservedMcsSet1 & 0x07);
454
455
  for (uint64_t i = 13; i > 0; i--)
456
    {
457
      val = (val << 1) | ( m_rxMcsBitmask[i + 63] & 0x01);
458
    }
459
  return val;
460
}
461
462
void
463
HtOperations::SerializeInformationField (Buffer::Iterator start) const
464
{
465
  if (m_htSupported == 1)
466
    {
467
      //write the corresponding value for each bit
468
      start.WriteU8 (GetPrimaryChannel ());
469
      start.WriteU8 (GetInformationSubset1 ());
470
      start.WriteU16 (GetInformationSubset2 ());
471
      start.WriteU16 (GetInformationSubset3 ());
472
      start.WriteHtolsbU64 (GetBasicMcsSet1 ());
473
      start.WriteHtolsbU64 (GetBasicMcsSet2 ());
474
    }
475
}
476
477
uint8_t
478
HtOperations::DeserializeInformationField (Buffer::Iterator start,
479
                                             uint8_t length)
480
{
481
  Buffer::Iterator i = start;
482
  uint8_t primarychannel = i.ReadU8 ();
483
  uint8_t informationsubset1 = i.ReadU8 ();
484
  uint8_t informationsubset2 = i.ReadU16 ();
485
  uint8_t informationsubset3 = i.ReadU16 ();
486
  uint64_t mcsset1 = i.ReadLsbtohU64 ();
487
  uint64_t mcsset2 = i.ReadLsbtohU64 ();
488
  SetPrimaryChannel (primarychannel);
489
  SetInformationSubset1 (informationsubset1);
490
  SetInformationSubset2 (informationsubset2);
491
  SetInformationSubset3 (informationsubset3);
492
  SetBasicMcsSet (mcsset1, mcsset2);
493
  return length;
494
}
495
496
ATTRIBUTE_HELPER_CPP (HtOperations);
497
498
std::ostream &
499
operator << (std::ostream &os, const HtOperations &htoperations)
500
{
501
  os <<  bool (htoperations.GetStaChannelWidth ())
502
     << "|" << bool (htoperations.GetRifsMode ())
503
     << "|" << bool (htoperations.GetDualCtsProtection());
504
    
505
  return os;
506
}
507
508
std::istream &operator >> (std::istream &is, HtOperations &htoperations)
509
{
510
  bool c1, c2, c3;
511
  is >> c1 >> c2 >> c3;
512
  htoperations.SetStaChannelWidth (c1);
513
  htoperations.SetRifsMode (c2);
514
  htoperations.SetDualCtsProtection (c3);
515
  
516
  return is;
517
}
518
519
} //namespace ns3
(-)303b328f07e9 (+245 lines)
Added Link Here 
1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
 * Copyright (c) 2016 Sébastien Deronne
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License version 2 as
7
 * published by the Free Software Foundation;
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program; if not, write to the Free Software
16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
 *
18
 * Author: Sébastien Deronne <sebastien.deronne@gmail.com>
19
 */
20
21
#ifndef HT_OPERATIONS_H
22
#define HT_OPERATIONS_H
23
24
#include <stdint.h>
25
#include "ns3/buffer.h"
26
#include "ns3/attribute-helper.h"
27
#include "ns3/wifi-information-element.h"
28
29
/**
30
 * This defines the maximum number of supported MCSs that a STA is
31
 * allowed to have. Currently this number is set for IEEE 802.11n
32
 */
33
#define MAX_SUPPORTED_MCS  (77)
34
35
namespace ns3 {
36
37
enum HtProtectionType
38
{
39
  NO_PROTECTION,
40
  NON_MEMBER_PROTECTION,
41
  TWENTY_MHZ_PROTECTION,
42
  MIXED_MODE_PROTECTION
43
};
44
45
/**
46
 * \brief The HT Operations Information Element
47
 * \ingroup wifi
48
 *
49
 * This class knows how to serialise and deserialise 
50
 * the HT Operations Information Element
51
 *
52
 * \see attribute_HtOperations
53
 */
54
class HtOperations: public WifiInformationElement
55
{
56
public:
57
  HtOperations ();
58
  void SetHtSupported (uint8_t htsupported);
59
  
60
  /**
61
   * Set the Primary Channel field in the HT Operations information element.
62
   *
63
   * \param ctrl the Primary Channel field in the HT Operations information element
64
   */
65
  void SetPrimaryChannel (uint8_t ctrl);
66
  /**
67
   * Set the Information Subset 1 field in the HT Operations information element.
68
   *
69
   * \param ctrl the Information Subset 1 field in the HT Operations information element
70
   */
71
  void SetInformationSubset1 (uint8_t ctrl);
72
  /**
73
   * Set the Information Subset 2 field in the HT Operations information element.
74
   *
75
   * \param ctrl the Information Subset 2 field in the HT Operations information element
76
   */
77
  void SetInformationSubset2 (uint16_t ctrl);
78
  /**
79
   * Set the Information Subset 3 field in the HT Operations information element.
80
   *
81
   * \param ctrl the Information Subset 3 field in the HT Operations information element
82
   */
83
  void SetInformationSubset3 (uint16_t ctrl);
84
  /**
85
   * Set the Basic MCS Set field in the HT Operations information element.
86
   *
87
   * \param ctrl1 the first 64 bytes of the Basic MCS Set field in the HT Operations information element
88
   * \param ctrl2 the last 64 bytes of the Basic MCS Set field in the HT Operations information element
89
   */
90
  void SetBasicMcsSet (uint64_t ctrl1, uint64_t ctrl2);
91
92
  void SetSecondaryChannelOffset (uint8_t secondarychanneloffset);
93
  void SetStaChannelWidth (uint8_t stachannelwidth);
94
  void SetRifsMode (uint8_t rifsmode);
95
96
  void SetHtProtection (uint8_t htprotection);
97
  void SetNonGfHtStasPresent (uint8_t nongfhtstaspresent);
98
  void SetObssNonHtStasPresent (uint8_t obssnonhtstaspresent);
99
100
  void SetDualBeacon (uint8_t dualbeacon);
101
  void SetDualCtsProtection (uint8_t dualctsprotection);
102
  void SetStbcBeacon (uint8_t stbcbeacon);
103
  void SetLSigTxopProtectionFullSupport (uint8_t lsigtxopprotectionfullsupport);
104
  void SetPcoActive (uint8_t pcoactive);
105
  void SetPhase (uint8_t pcophase);
106
107
  void SetRxMcsBitmask (uint8_t index);
108
  void SetRxHighestSupportedDataRate (uint16_t maxsupportedrate);
109
  void SetTxMcsSetDefined (uint8_t txmcssetdefined);
110
  void SetTxRxMcsSetUnequal (uint8_t txrxmcssetunequal);
111
  void SetTxMaxNSpatialStreams (uint8_t maxtxspatialstreams);
112
  void SetTxUnequalModulation (uint8_t txunequalmodulation);
113
  
114
  /*
115
   * Return the Primary Channel field in the HT Operations information element.
116
   *
117
   * \return the Primary Channel field in the HT Operations information element
118
   */
119
  uint8_t GetPrimaryChannel (void) const;
120
  /*
121
   * Return the Information Subset 1 field in the HT Operations information element.
122
   *
123
   * \return the Information Subset 1 field in the HT Operations information element
124
   */
125
  uint8_t GetInformationSubset1 (void) const;
126
  /*
127
   * Return the Information Subset 2 field in the HT Operations information element.
128
   *
129
   * \return the Information Subset 2 field in the HT Operations information element
130
   */
131
  uint16_t GetInformationSubset2 (void) const;
132
  /*
133
   * Return the Information Subset 3 field in the HT Operations information element.
134
   *
135
   * \return the Information Subset 3 field in the HT Operations information element
136
   */
137
  uint16_t GetInformationSubset3 (void) const;
138
  /*
139
   * Return the first 64 bytes of the Basic MCS Set field in the HT Operations information element.
140
   *
141
   * \return the first 64 bytes of the Basic MCS Set field in the HT Operations information element
142
   */
143
  uint64_t GetBasicMcsSet1 (void) const;
144
  /*
145
   * Return the last 64 bytes of the Basic MCS Set field in the HT Operations information element.
146
   *
147
   * \return the last 64 bytes of the Basic MCS Set field in the HT Operations information element
148
   */
149
  uint64_t GetBasicMcsSet2 (void) const;
150
  
151
  uint8_t GetSecondaryChannelOffset (void) const;
152
  uint8_t GetStaChannelWidth (void) const;
153
  uint8_t GetRifsMode (void) const;
154
  
155
  uint8_t GetHtProtection (void) const;
156
  uint8_t GetNonGfHtStasPresent (void) const;
157
  uint8_t GetObssNonHtStasPresent (void) const;
158
  
159
  uint8_t GetDualBeacon (void) const;
160
  uint8_t GetDualCtsProtection (void) const;
161
  uint8_t GetStbcBeacon (void) const;
162
  uint8_t GetLSigTxopProtectionFullSupport (void) const;
163
  uint8_t GetPcoActive (void) const;
164
  uint8_t GetPhase (void) const;
165
  
166
  bool IsSupportedMcs (uint8_t mcs);
167
  uint16_t GetRxHighestSupportedDataRate (void) const;
168
  uint8_t GetTxMcsSetDefined (void) const;
169
  uint8_t GetTxRxMcsSetUnequal (void) const;
170
  uint8_t GetTxMaxNSpatialStreams (void) const;
171
  uint8_t GetTxUnequalModulation (void) const;
172
173
  WifiInformationElementId ElementId () const;
174
  uint8_t GetInformationFieldSize () const;
175
  void SerializeInformationField (Buffer::Iterator start) const;
176
  uint8_t DeserializeInformationField (Buffer::Iterator start,
177
                                       uint8_t length);
178
  /**
179
   * This information element is a bit special in that it is only
180
   * included if the STA is an HT STA. To support this we
181
   * override the Serialize and GetSerializedSize methods of
182
   * WifiInformationElement.
183
   *
184
   * \param start
185
   *
186
   * \return an iterator
187
   */
188
  Buffer::Iterator Serialize (Buffer::Iterator start) const;
189
  /**
190
   * Return the serialized size of this HT Operations IE.
191
   *
192
   * \return the serialized size of this HT Operations IE
193
   */
194
  uint16_t GetSerializedSize () const;
195
196
197
private:
198
  uint8_t m_primaryChannel;
199
200
  //HT Information Subset 1
201
  uint8_t m_secondaryChannelOffset;
202
  uint8_t m_staChannelWidth;
203
  uint8_t m_rifsMode;
204
  uint8_t m_reservedInformationSubset1;
205
206
  //HT Information Subset 2
207
  uint8_t m_htProtection;
208
  uint8_t m_nonGfHtStasPresent;
209
  uint8_t m_reservedInformationSubset2_1;
210
  uint8_t m_obssNonHtStasPresent;
211
  uint8_t m_reservedInformationSubset2_2;
212
213
  //HT Information Subset 3
214
  uint8_t m_reservedInformationSubset3_1;
215
  uint8_t m_dualBeacon;
216
  uint8_t m_dualCtsProtection;
217
  uint8_t m_stbcBeacon;
218
  uint8_t m_lSigTxopProtectionFullSupport;
219
  uint8_t m_pcoActive;
220
  uint8_t m_pcoPhase;
221
  uint8_t m_reservedInformationSubset3_2;
222
223
  //Basic MCS Set field
224
  uint8_t m_reservedMcsSet1;
225
  uint16_t m_rxHighestSupportedDataRate;
226
  uint8_t m_reservedMcsSet2;
227
  uint8_t m_txMcsSetDefined;
228
  uint8_t m_txRxMcsSetUnequal;
229
  uint8_t m_txMaxNSpatialStreams;
230
  uint8_t m_txUnequalModulation;
231
  uint32_t m_reservedMcsSet3;
232
  uint8_t m_rxMcsBitmask[MAX_SUPPORTED_MCS];
233
234
  //This is used to decide whether this element should be added to the frame or not
235
  uint8_t m_htSupported;
236
};
237
238
std::ostream &operator << (std::ostream &os, const HtOperations &htoperations);
239
std::istream &operator >> (std::istream &is, HtOperations &htoperations);
240
241
ATTRIBUTE_HELPER_HEADER (HtOperations);
242
243
} //namespace ns3
244
245
#endif /* HT_OPERATIONS_H */
(-)a/src/wifi/model/ideal-wifi-manager.cc (-1 / +1 lines)
 Lines 187-193    Link Here 
187
  //ensure correct packet delivery.
187
  //ensure correct packet delivery.
188
  double maxThreshold = 0.0;
188
  double maxThreshold = 0.0;
189
  WifiMode maxMode = GetDefaultMode ();
189
  WifiMode maxMode = GetDefaultMode ();
190
  if (GetUseProtection () == false)
190
  if (GetUseNonErpProtection () == false)
191
    {
191
    {
192
      for (uint32_t i = 0; i < GetNBasicModes (); i++)
192
      for (uint32_t i = 0; i < GetNBasicModes (); i++)
193
        {
193
        {
(-)a/src/wifi/model/mac-low.cc (-1 / +1 lines)
 Lines 807-813    Link Here 
807
    }
807
    }
808
  else
808
  else
809
    {
809
    {
810
      if ((m_ctsToSelfSupported || m_stationManager->GetUseProtection ()) && NeedCtsToSelf ())
810
      if ((m_ctsToSelfSupported || m_stationManager->GetUseNonErpProtection ()) && NeedCtsToSelf ())
811
        {
811
        {
812
          SendCtsToSelf ();
812
          SendCtsToSelf ();
813
        }
813
        }
(-)a/src/wifi/model/mgt-headers.cc (-6 / +38 lines)
 Lines 210-215    Link Here 
210
}
210
}
211
211
212
void
212
void
213
MgtProbeResponseHeader::SetHtOperations (HtOperations htoperations)
214
{
215
  m_htOperations = htoperations;
216
}
217
218
HtOperations
219
MgtProbeResponseHeader::GetHtOperations (void) const
220
{
221
  return m_htOperations;
222
}
223
224
void
213
MgtProbeResponseHeader::SetVhtCapabilities (VhtCapabilities vhtcapabilities)
225
MgtProbeResponseHeader::SetVhtCapabilities (VhtCapabilities vhtcapabilities)
214
{
226
{
215
  m_vhtCapability = vhtcapabilities;
227
  m_vhtCapability = vhtcapabilities;
 Lines 281-286    Link Here 
281
  size += m_erpInformation.GetSerializedSize ();
293
  size += m_erpInformation.GetSerializedSize ();
282
  size += m_rates.extended.GetSerializedSize ();
294
  size += m_rates.extended.GetSerializedSize ();
283
  size += m_htCapability.GetSerializedSize ();
295
  size += m_htCapability.GetSerializedSize ();
296
  size += m_htOperations.GetSerializedSize ();
284
  size += m_vhtCapability.GetSerializedSize ();
297
  size += m_vhtCapability.GetSerializedSize ();
285
  return size;
298
  return size;
286
}
299
}
 Lines 292-297    Link Here 
292
     << "rates=" << m_rates << ", "
305
     << "rates=" << m_rates << ", "
293
     << "ERP information=" << m_erpInformation << ", "
306
     << "ERP information=" << m_erpInformation << ", "
294
     << "HT Capabilities=" << m_htCapability << " , "
307
     << "HT Capabilities=" << m_htCapability << " , "
308
     << "HT Operations=" << m_htOperations << " , "
295
     << "VHT Capabilities= " << m_vhtCapability;
309
     << "VHT Capabilities= " << m_vhtCapability;
296
}
310
}
297
311
 Lines 317-322    Link Here 
317
  i = m_erpInformation.Serialize (i);
331
  i = m_erpInformation.Serialize (i);
318
  i = m_rates.extended.Serialize (i);
332
  i = m_rates.extended.Serialize (i);
319
  i = m_htCapability.Serialize (i);
333
  i = m_htCapability.Serialize (i);
334
  i = m_htOperations.Serialize (i);
320
  i = m_vhtCapability.Serialize (i);
335
  i = m_vhtCapability.Serialize (i);
321
}
336
}
322
337
 Lines 334-339    Link Here 
334
  i = m_erpInformation.DeserializeIfPresent (i);
349
  i = m_erpInformation.DeserializeIfPresent (i);
335
  i = m_rates.extended.DeserializeIfPresent (i);
350
  i = m_rates.extended.DeserializeIfPresent (i);
336
  i = m_htCapability.DeserializeIfPresent (i);
351
  i = m_htCapability.DeserializeIfPresent (i);
352
  i = m_htOperations.DeserializeIfPresent (i);
337
  i = m_vhtCapability.DeserializeIfPresent (i);
353
  i = m_vhtCapability.DeserializeIfPresent (i);
338
  return i.GetDistanceFrom (start);
354
  return i.GetDistanceFrom (start);
339
}
355
}
 Lines 570-575    Link Here 
570
  m_htCapability = htcapabilities;
586
  m_htCapability = htcapabilities;
571
}
587
}
572
588
589
HtCapabilities
590
MgtAssocResponseHeader::GetHtCapabilities (void) const
591
{
592
  return m_htCapability;
593
}
594
595
void
596
MgtAssocResponseHeader::SetHtOperations (HtOperations htoperations)
597
{
598
  m_htOperations = htoperations;
599
}
600
601
HtOperations
602
MgtAssocResponseHeader::GetHtOperations (void) const
603
{
604
  return m_htOperations;
605
}
606
573
void
607
void
574
MgtAssocResponseHeader::SetVhtCapabilities (VhtCapabilities vhtcapabilities)
608
MgtAssocResponseHeader::SetVhtCapabilities (VhtCapabilities vhtcapabilities)
575
{
609
{
 Lines 582-593    Link Here 
582
  return m_vhtCapability;
616
  return m_vhtCapability;
583
}
617
}
584
618
585
HtCapabilities
586
MgtAssocResponseHeader::GetHtCapabilities (void) const
587
{
588
  return m_htCapability;
589
}
590
591
void
619
void
592
MgtAssocResponseHeader::SetErpInformation (ErpInformation erpInformation)
620
MgtAssocResponseHeader::SetErpInformation (ErpInformation erpInformation)
593
{
621
{
 Lines 629-634    Link Here 
629
  size += m_erpInformation.GetSerializedSize ();
657
  size += m_erpInformation.GetSerializedSize ();
630
  size += m_rates.extended.GetSerializedSize ();
658
  size += m_rates.extended.GetSerializedSize ();
631
  size += m_htCapability.GetSerializedSize ();
659
  size += m_htCapability.GetSerializedSize ();
660
  size += m_htOperations.GetSerializedSize ();
632
  size += m_vhtCapability.GetSerializedSize ();
661
  size += m_vhtCapability.GetSerializedSize ();
633
  return size;
662
  return size;
634
}
663
}
 Lines 640-645    Link Here 
640
     << "rates=" << m_rates << ", "
669
     << "rates=" << m_rates << ", "
641
     << "ERP information=" << m_erpInformation << ", "
670
     << "ERP information=" << m_erpInformation << ", "
642
     << "HT Capabilities=" << m_htCapability << " , "
671
     << "HT Capabilities=" << m_htCapability << " , "
672
     << "HT Operations=" << m_htOperations << " , "
643
     << "VHT Capabilities= " << m_vhtCapability;
673
     << "VHT Capabilities= " << m_vhtCapability;
644
}
674
}
645
675
 Lines 654-659    Link Here 
654
  i = m_erpInformation.Serialize (i);
684
  i = m_erpInformation.Serialize (i);
655
  i = m_rates.extended.Serialize (i);
685
  i = m_rates.extended.Serialize (i);
656
  i = m_htCapability.Serialize (i);
686
  i = m_htCapability.Serialize (i);
687
  i = m_htOperations.Serialize (i);
657
  i = m_vhtCapability.Serialize (i);
688
  i = m_vhtCapability.Serialize (i);
658
}
689
}
659
690
 Lines 668-673    Link Here 
668
  i = m_erpInformation.DeserializeIfPresent (i);
699
  i = m_erpInformation.DeserializeIfPresent (i);
669
  i = m_rates.extended.DeserializeIfPresent (i);
700
  i = m_rates.extended.DeserializeIfPresent (i);
670
  i = m_htCapability.DeserializeIfPresent (i);
701
  i = m_htCapability.DeserializeIfPresent (i);
702
  i = m_htOperations.DeserializeIfPresent (i);
671
  i = m_vhtCapability.DeserializeIfPresent (i);
703
  i = m_vhtCapability.DeserializeIfPresent (i);
672
  return i.GetDistanceFrom (start);
704
  return i.GetDistanceFrom (start);
673
}
705
}
(-)a/src/wifi/model/mgt-headers.h (+27 lines)
 Lines 31-36    Link Here 
31
#include "supported-rates.h"
31
#include "supported-rates.h"
32
#include "ssid.h"
32
#include "ssid.h"
33
#include "ht-capabilities.h"
33
#include "ht-capabilities.h"
34
#include "ht-operations.h"
34
#include "vht-capabilities.h"
35
#include "vht-capabilities.h"
35
#include "erp-information.h"
36
#include "erp-information.h"
36
37
 Lines 182-187    Link Here 
182
   */
183
   */
183
  HtCapabilities GetHtCapabilities (void) const;
184
  HtCapabilities GetHtCapabilities (void) const;
184
  /**
185
  /**
186
   * Return the HT operations.
187
   *
188
   * \return HT operations
189
   */
190
  HtOperations GetHtOperations (void) const;
191
  /**
185
   * Return the ERP information.
192
   * Return the ERP information.
186
   *
193
   *
187
   * \return the ERP information
194
   * \return the ERP information
 Lines 206-211    Link Here 
206
   */
213
   */
207
  void SetHtCapabilities (HtCapabilities htcapabilities);
214
  void SetHtCapabilities (HtCapabilities htcapabilities);
208
  /**
215
  /**
216
   * Set the HT operations.
217
   *
218
   * \param htoperations HT operations
219
   */
220
  void SetHtOperations (HtOperations htoperations);
221
  /**
209
   * Set the supported rates.
222
   * Set the supported rates.
210
   *
223
   *
211
   * \param rates the supported rates
224
   * \param rates the supported rates
 Lines 242-247    Link Here 
242
  StatusCode m_code; //!< Status code
255
  StatusCode m_code; //!< Status code
243
  uint16_t m_aid;
256
  uint16_t m_aid;
244
  HtCapabilities m_htCapability; //!< HT capabilities
257
  HtCapabilities m_htCapability; //!< HT capabilities
258
  HtOperations m_htOperations; //!< HT operations
245
  VhtCapabilities m_vhtCapability; //!< VHT capabilities
259
  VhtCapabilities m_vhtCapability; //!< VHT capabilities
246
  ErpInformation m_erpInformation;    //!< ERP information
260
  ErpInformation m_erpInformation;    //!< ERP information
247
};
261
};
 Lines 366-371    Link Here 
366
   */
380
   */
367
  HtCapabilities GetHtCapabilities (void) const;
381
  HtCapabilities GetHtCapabilities (void) const;
368
  /**
382
  /**
383
   * Return the HT operations.
384
   *
385
   * \return HT operations
386
   */
387
  HtOperations GetHtOperations (void) const;
388
  /**
369
   * Return the VHT capabilities.
389
   * Return the VHT capabilities.
370
   *
390
   *
371
   * \return VHT capabilities
391
   * \return VHT capabilities
 Lines 390-395    Link Here 
390
   */
410
   */
391
  void SetHtCapabilities (HtCapabilities htcapabilities);
411
  void SetHtCapabilities (HtCapabilities htcapabilities);
392
  /**
412
  /**
413
   * Set the HT operations.
414
   *
415
   * \param htoperations HT operations
416
   */
417
  void SetHtOperations (HtOperations htoperations);
418
  /**
393
   * Set the VHT capabilities.
419
   * Set the VHT capabilities.
394
   *
420
   *
395
   * \param vhtcapabilities VHT capabilities
421
   * \param vhtcapabilities VHT capabilities
 Lines 445-450    Link Here 
445
  SupportedRates m_rates;             //!< List of supported rates
471
  SupportedRates m_rates;             //!< List of supported rates
446
  CapabilityInformation m_capability; //!< Capability information
472
  CapabilityInformation m_capability; //!< Capability information
447
  HtCapabilities m_htCapability;      //!< HT capabilities
473
  HtCapabilities m_htCapability;      //!< HT capabilities
474
  HtOperations m_htOperations;        //!< HT operations
448
  VhtCapabilities m_vhtCapability;    //!< VHT capabilities
475
  VhtCapabilities m_vhtCapability;    //!< VHT capabilities
449
  ErpInformation m_erpInformation;    //!< ERP information
476
  ErpInformation m_erpInformation;    //!< ERP information
450
};
477
};
(-)a/src/wifi/model/minstrel-wifi-manager.cc (-1 / +1 lines)
 Lines 503-509    Link Here 
503
      channelWidth = 20;
503
      channelWidth = 20;
504
    }
504
    }
505
  WifiTxVector rtsTxVector;
505
  WifiTxVector rtsTxVector;
506
  if (GetUseProtection () == false)
506
  if (GetUseNonErpProtection () == false)
507
    {
507
    {
508
      rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
508
      rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
509
    }
509
    }
(-)a/src/wifi/model/onoe-wifi-manager.cc (-1 / +1 lines)
 Lines 299-305    Link Here 
299
    }
299
    }
300
  UpdateMode (station);
300
  UpdateMode (station);
301
  WifiTxVector rtsTxVector;
301
  WifiTxVector rtsTxVector;
302
  if (GetUseProtection () == false)
302
  if (GetUseNonErpProtection () == false)
303
    {
303
    {
304
      rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
304
      rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
305
    }
305
    }
(-)a/src/wifi/model/parf-wifi-manager.cc (-1 / +1 lines)
 Lines 318-324    Link Here 
318
      channelWidth = 20;
318
      channelWidth = 20;
319
    }
319
    }
320
  WifiTxVector rtsTxVector;
320
  WifiTxVector rtsTxVector;
321
  if (GetUseProtection () == false)
321
  if (GetUseNonErpProtection () == false)
322
    {
322
    {
323
      rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
323
      rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false);
324
    }
324
    }
(-)a/src/wifi/model/rraa-wifi-manager.cc (-1 / +1 lines)
 Lines 310-316    Link Here 
310
      channelWidth = 20;
310
      channelWidth = 20;
311
    }
311
    }
312
  WifiTxVector rtsTxVector;
312
  WifiTxVector rtsTxVector;
313
  if (GetUseProtection () == false)
313
  if (GetUseNonErpProtection () == false)
314
    {
314
    {
315
      rtsTxVector = WifiTxVector (GetSupported (st, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (st), false, 1, 0, channelWidth, GetAggregation (station), false);
315
      rtsTxVector = WifiTxVector (GetSupported (st, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (st), false, 1, 0, channelWidth, GetAggregation (station), false);
316
    }
316
    }
(-)a/src/wifi/model/sta-wifi-mac.cc (-4 / +6 lines)
 Lines 37-42    Link Here 
37
#include "amsdu-subframe-header.h"
37
#include "amsdu-subframe-header.h"
38
#include "mgt-headers.h"
38
#include "mgt-headers.h"
39
#include "ht-capabilities.h"
39
#include "ht-capabilities.h"
40
#include "ht-operations.h"
40
#include "vht-capabilities.h"
41
#include "vht-capabilities.h"
41
42
42
/*
43
/*
 Lines 521-531    Link Here 
521
              isShortPreambleEnabled &= !erpInformation.GetBarkerPreambleMode ();
522
              isShortPreambleEnabled &= !erpInformation.GetBarkerPreambleMode ();
522
              if (erpInformation.GetUseProtection() == true)
523
              if (erpInformation.GetUseProtection() == true)
523
                {
524
                {
524
                  m_stationManager->SetUseProtection (true);
525
                  m_stationManager->SetUseNonErpProtection (true);
525
                }
526
                }
526
              else
527
              else
527
                {
528
                {
528
                  m_stationManager->SetUseProtection (false);
529
                  m_stationManager->SetUseNonErpProtection (false);
529
                }
530
                }
530
              if (capabilities.IsShortSlotTime () == true)
531
              if (capabilities.IsShortSlotTime () == true)
531
                {
532
                {
 Lines 590-600    Link Here 
590
              ErpInformation erpInformation = probeResp.GetErpInformation ();
591
              ErpInformation erpInformation = probeResp.GetErpInformation ();
591
              if (erpInformation.GetUseProtection() == true)
592
              if (erpInformation.GetUseProtection() == true)
592
                {
593
                {
593
                  m_stationManager->SetUseProtection (true);
594
                  m_stationManager->SetUseNonErpProtection (true);
594
                }
595
                }
595
              else
596
              else
596
                {
597
                {
597
                  m_stationManager->SetUseProtection (false);
598
                  m_stationManager->SetUseNonErpProtection (false);
598
                }
599
                }
599
              if (capabilities.IsShortSlotTime () == true)
600
              if (capabilities.IsShortSlotTime () == true)
600
                {
601
                {
 Lines 662-667    Link Here 
662
              if (m_htSupported)
663
              if (m_htSupported)
663
                {
664
                {
664
                  HtCapabilities htcapabilities = assocResp.GetHtCapabilities ();
665
                  HtCapabilities htcapabilities = assocResp.GetHtCapabilities ();
666
                  HtOperations htOperations = assocResp.GetHtOperations ();
665
                  m_stationManager->AddStationHtCapabilities (hdr->GetAddr2 (),htcapabilities);
667
                  m_stationManager->AddStationHtCapabilities (hdr->GetAddr2 (),htcapabilities);
666
                }
668
                }
667
              if (m_vhtSupported)
669
              if (m_vhtSupported)
(-)a/src/wifi/model/wifi-information-element.h (-1 / +3 lines)
 Lines 83-89    Link Here 
83
#define IE_RSN                                 ((WifiInformationElementId)48)
83
#define IE_RSN                                 ((WifiInformationElementId)48)
84
// 49 is reserved in 802.11-2007
84
// 49 is reserved in 802.11-2007
85
#define IE_EXTENDED_SUPPORTED_RATES            ((WifiInformationElementId)50)
85
#define IE_EXTENDED_SUPPORTED_RATES            ((WifiInformationElementId)50)
86
// 51 to 126 are reserved in 802.11-2007
86
// 51 to 60 are reserved in 802.11-2007
87
#define IE_HT_OPERATIONS                       ((WifiInformationElementId)61)
88
// 62 to 126 are reserved in 802.11-2007
87
#define IE_EXTENDED_CAPABILITIES               ((WifiInformationElementId)127)
89
#define IE_EXTENDED_CAPABILITIES               ((WifiInformationElementId)127)
88
// 128 to 190 are reserved in 802.11-2007
90
// 128 to 190 are reserved in 802.11-2007
89
#define IE_VHT_CAPABILITIES                    ((WifiInformationElementId)191)
91
#define IE_VHT_CAPABILITIES                    ((WifiInformationElementId)191)
(-)a/src/wifi/model/wifi-remote-station-manager.cc (-10 / +14 lines)
 Lines 360-366    Link Here 
360
WifiRemoteStationManager::WifiRemoteStationManager ()
360
WifiRemoteStationManager::WifiRemoteStationManager ()
361
  : m_htSupported (false),
361
  : m_htSupported (false),
362
    m_vhtSupported (false),
362
    m_vhtSupported (false),
363
    m_useProtection (false),
363
    m_useNonErpProtection (false),
364
    m_shortPreambleEnabled (false),
364
    m_shortPreambleEnabled (false),
365
    m_shortSlotTimeEnabled (false)
365
    m_shortSlotTimeEnabled (false)
366
{
366
{
 Lines 868-875    Link Here 
868
  WifiMode mode = txVector.GetMode ();
868
  WifiMode mode = txVector.GetMode ();
869
  NS_LOG_FUNCTION (this << address << *header << packet << mode);
869
  NS_LOG_FUNCTION (this << address << *header << packet << mode);
870
  if (m_protectionMode == RTS_CTS
870
  if (m_protectionMode == RTS_CTS
871
      && mode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM
871
      && ((mode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM)
872
      && m_useProtection)
872
      || (mode.GetModulationClass () == WIFI_MOD_CLASS_HT)
873
      || (mode.GetModulationClass () == WIFI_MOD_CLASS_VHT))
874
      && m_useNonErpProtection)
873
    {
875
    {
874
      NS_LOG_DEBUG ("WifiRemoteStationManager::NeedRTS returning true to protect non-ERP stations");
876
      NS_LOG_DEBUG ("WifiRemoteStationManager::NeedRTS returning true to protect non-ERP stations");
875
      return true;
877
      return true;
 Lines 888-900    Link Here 
888
  WifiMode mode = txVector.GetMode ();
890
  WifiMode mode = txVector.GetMode ();
889
  NS_LOG_FUNCTION (this << mode);
891
  NS_LOG_FUNCTION (this << mode);
890
  if (m_protectionMode == CTS_TO_SELF
892
  if (m_protectionMode == CTS_TO_SELF
891
      && mode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM
893
      && ((mode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM)
892
      && m_useProtection)
894
      || (mode.GetModulationClass () == WIFI_MOD_CLASS_HT)
895
      || (mode.GetModulationClass () == WIFI_MOD_CLASS_VHT))
896
      && m_useNonErpProtection)
893
    {
897
    {
894
      NS_LOG_DEBUG ("WifiRemoteStationManager::NeedCtsToSelf returning true to protect non-ERP stations");
898
      NS_LOG_DEBUG ("WifiRemoteStationManager::NeedCtsToSelf returning true to protect non-ERP stations");
895
      return true;
899
      return true;
896
    }
900
    }
897
  else if (!m_useProtection)
901
  else if (!m_useNonErpProtection)
898
    {
902
    {
899
    //search for the BSS Basic Rate set, if the used mode is in the basic set then there is no need for Cts To Self
903
    //search for the BSS Basic Rate set, if the used mode is in the basic set then there is no need for Cts To Self
900
      for (WifiModeListIterator i = m_bssBasicRateSet.begin (); i != m_bssBasicRateSet.end (); i++)
904
      for (WifiModeListIterator i = m_bssBasicRateSet.begin (); i != m_bssBasicRateSet.end (); i++)
 Lines 924-938    Link Here 
924
}
928
}
925
929
926
void
930
void
927
WifiRemoteStationManager::SetUseProtection (bool enable)
931
WifiRemoteStationManager::SetUseNonErpProtection (bool enable)
928
{
932
{
929
  m_useProtection = enable;
933
  m_useNonErpProtection = enable;
930
}
934
}
931
935
932
bool
936
bool
933
WifiRemoteStationManager::GetUseProtection (void) const
937
WifiRemoteStationManager::GetUseNonErpProtection (void) const
934
{
938
{
935
  return m_useProtection;
939
  return m_useNonErpProtection;
936
}
940
}
937
941
938
bool
942
bool
(-)a/src/wifi/model/wifi-remote-station-manager.h (-4 / +4 lines)
 Lines 95-101    Link Here 
95
  
95
  
96
  enum ProtectionMode
96
  enum ProtectionMode
97
  {
97
  {
98
    RTS_CTS = 0,
98
    RTS_CTS,
99
    CTS_TO_SELF
99
    CTS_TO_SELF
100
  };
100
  };
101
101
 Lines 223-236    Link Here 
223
   *
223
   *
224
   * \param enable enable or disable protection for non-ERP stations
224
   * \param enable enable or disable protection for non-ERP stations
225
   */
225
   */
226
  void SetUseProtection (bool enable);
226
  void SetUseNonErpProtection (bool enable);
227
  /**
227
  /**
228
   * Return whether the device supports protection of non-ERP stations.
228
   * Return whether the device supports protection of non-ERP stations.
229
   *
229
   *
230
   * \return true if protection for non-ERP stations is enabled, 
230
   * \return true if protection for non-ERP stations is enabled, 
231
   *         false otherwise
231
   *         false otherwise
232
   */
232
   */
233
  bool GetUseProtection (void) const;
233
  bool GetUseNonErpProtection (void) const;
234
  /**
234
  /**
235
   * Enable or disable short PLCP preambles.
235
   * Enable or disable short PLCP preambles.
236
   *
236
   *
 Lines 1176-1182    Link Here 
1176
  uint32_t m_nextFragmentationThreshold;  //!< Threshold for fragmentation that will be used for the next transmission
1176
  uint32_t m_nextFragmentationThreshold;  //!< Threshold for fragmentation that will be used for the next transmission
1177
  uint8_t m_defaultTxPowerLevel;  //!< Default tranmission power level
1177
  uint8_t m_defaultTxPowerLevel;  //!< Default tranmission power level
1178
  WifiMode m_nonUnicastMode;  //!< Transmission mode for non-unicast DATA frames
1178
  WifiMode m_nonUnicastMode;  //!< Transmission mode for non-unicast DATA frames
1179
  bool m_useProtection; //!< flag if protection for non-ERP stations against ERP transmissions is enabled
1179
  bool m_useNonErpProtection; //!< flag if protection for non-ERP stations against ERP transmissions is enabled
1180
  bool m_shortPreambleEnabled; //!< flag if short PLCP preamble is enabled
1180
  bool m_shortPreambleEnabled; //!< flag if short PLCP preamble is enabled
1181
  bool m_shortSlotTimeEnabled; //!< flag if short slot time is enabled
1181
  bool m_shortSlotTimeEnabled; //!< flag if short slot time is enabled
1182
  ProtectionMode m_protectionMode; //!< Protection mode for ERP stations when non-ERP stations are detected
1182
  ProtectionMode m_protectionMode; //!< Protection mode for ERP stations when non-ERP stations are detected
(-)a/src/wifi/model/yans-wifi-phy.cc (-30 / +7 lines)
 Lines 904-918    Link Here 
904
YansWifiPhy::Configure80211g (void)
904
YansWifiPhy::Configure80211g (void)
905
{
905
{
906
  NS_LOG_FUNCTION (this);
906
  NS_LOG_FUNCTION (this);
907
  m_channelStartingFrequency = 2407; //2.407 GHz
907
  Configure80211b ();
908
  SetChannelWidth (20); //20 MHz
908
  SetChannelWidth (20); //20 MHz
909
909
910
  m_deviceRateSet.push_back (WifiPhy::GetDsssRate1Mbps ());
911
  m_deviceRateSet.push_back (WifiPhy::GetDsssRate2Mbps ());
912
  m_deviceRateSet.push_back (WifiPhy::GetDsssRate5_5Mbps ());
913
  m_deviceRateSet.push_back (WifiPhy::GetErpOfdmRate6Mbps ());
910
  m_deviceRateSet.push_back (WifiPhy::GetErpOfdmRate6Mbps ());
914
  m_deviceRateSet.push_back (WifiPhy::GetErpOfdmRate9Mbps ());
911
  m_deviceRateSet.push_back (WifiPhy::GetErpOfdmRate9Mbps ());
915
  m_deviceRateSet.push_back (WifiPhy::GetDsssRate11Mbps ());
916
  m_deviceRateSet.push_back (WifiPhy::GetErpOfdmRate12Mbps ());
912
  m_deviceRateSet.push_back (WifiPhy::GetErpOfdmRate12Mbps ());
917
  m_deviceRateSet.push_back (WifiPhy::GetErpOfdmRate18Mbps ());
913
  m_deviceRateSet.push_back (WifiPhy::GetErpOfdmRate18Mbps ());
918
  m_deviceRateSet.push_back (WifiPhy::GetErpOfdmRate24Mbps ());
914
  m_deviceRateSet.push_back (WifiPhy::GetErpOfdmRate24Mbps ());
 Lines 973-995    Link Here 
973
YansWifiPhy::Configure80211n (void)
969
YansWifiPhy::Configure80211n (void)
974
{
970
{
975
  NS_LOG_FUNCTION (this);
971
  NS_LOG_FUNCTION (this);
976
  SetChannelWidth (20); //20 MHz
977
  if (m_channelStartingFrequency >= 2400 && m_channelStartingFrequency <= 2500) //at 2.4 GHz
972
  if (m_channelStartingFrequency >= 2400 && m_channelStartingFrequency <= 2500) //at 2.4 GHz
978
    {
973
    {
979
      m_deviceRateSet.push_back (WifiPhy::GetDsssRate1Mbps ());
974
      Configure80211b ();
980
      m_deviceRateSet.push_back (WifiPhy::GetDsssRate2Mbps ());
975
      Configure80211g ();
981
      m_deviceRateSet.push_back (WifiPhy::GetDsssRate5_5Mbps ());
982
      m_deviceRateSet.push_back (WifiPhy::GetErpOfdmRate6Mbps ());
983
      m_deviceRateSet.push_back (WifiPhy::GetDsssRate11Mbps ());
984
      m_deviceRateSet.push_back (WifiPhy::GetErpOfdmRate12Mbps ());
985
      m_deviceRateSet.push_back (WifiPhy::GetErpOfdmRate24Mbps ());
986
    }
976
    }
987
  if (m_channelStartingFrequency >= 5000 && m_channelStartingFrequency <= 6000) //at 5 GHz
977
  if (m_channelStartingFrequency >= 5000 && m_channelStartingFrequency <= 6000) //at 5 GHz
988
    {
978
    {
989
      m_deviceRateSet.push_back (WifiPhy::GetOfdmRate6Mbps ());
979
      Configure80211a ();
990
      m_deviceRateSet.push_back (WifiPhy::GetOfdmRate12Mbps ());
991
      m_deviceRateSet.push_back (WifiPhy::GetOfdmRate24Mbps ());
992
    }
980
    }
981
  SetChannelWidth (20); //20 MHz
993
982
994
  m_deviceMcsSet.push_back (WifiPhy::GetHtMcs0 ());
983
  m_deviceMcsSet.push_back (WifiPhy::GetHtMcs0 ());
995
  m_deviceMcsSet.push_back (WifiPhy::GetHtMcs1 ());
984
  m_deviceMcsSet.push_back (WifiPhy::GetHtMcs1 ());
 Lines 1007-1028    Link Here 
1007
YansWifiPhy::Configure80211ac (void)
996
YansWifiPhy::Configure80211ac (void)
1008
{
997
{
1009
  NS_LOG_FUNCTION (this);
998
  NS_LOG_FUNCTION (this);
1010
  m_channelStartingFrequency = 5e3;   //5.000 GHz
999
  m_channelStartingFrequency = 5e3; //5.000 GHz
1000
  Configure80211n ();
1011
  SetChannelWidth (80); //80 MHz
1001
  SetChannelWidth (80); //80 MHz
1012
1002
1013
  m_deviceRateSet.push_back (WifiPhy::GetOfdmRate6Mbps ());
1014
  m_deviceRateSet.push_back (WifiPhy::GetOfdmRate12Mbps ());
1015
  m_deviceRateSet.push_back (WifiPhy::GetOfdmRate24Mbps ());
1016
1017
  m_deviceMcsSet.push_back (WifiPhy::GetHtMcs0 ());
1018
  m_deviceMcsSet.push_back (WifiPhy::GetHtMcs1 ());
1019
  m_deviceMcsSet.push_back (WifiPhy::GetHtMcs2 ());
1020
  m_deviceMcsSet.push_back (WifiPhy::GetHtMcs3 ());
1021
  m_deviceMcsSet.push_back (WifiPhy::GetHtMcs4 ());
1022
  m_deviceMcsSet.push_back (WifiPhy::GetHtMcs5 ());
1023
  m_deviceMcsSet.push_back (WifiPhy::GetHtMcs6 ());
1024
  m_deviceMcsSet.push_back (WifiPhy::GetHtMcs7 ());
1025
1026
  m_deviceMcsSet.push_back (WifiPhy::GetVhtMcs0 ());
1003
  m_deviceMcsSet.push_back (WifiPhy::GetVhtMcs0 ());
1027
  m_deviceMcsSet.push_back (WifiPhy::GetVhtMcs1 ());
1004
  m_deviceMcsSet.push_back (WifiPhy::GetVhtMcs1 ());
1028
  m_deviceMcsSet.push_back (WifiPhy::GetVhtMcs2 ());
1005
  m_deviceMcsSet.push_back (WifiPhy::GetVhtMcs2 ());
(-)a/src/wifi/wscript (+2 lines)
 Lines 73-78    Link Here 
73
        'model/wifi-tx-current-model.cc',
73
        'model/wifi-tx-current-model.cc',
74
        'model/vht-capabilities.cc',
74
        'model/vht-capabilities.cc',
75
        'model/erp-information.cc',
75
        'model/erp-information.cc',
76
        'model/ht-operations.cc',
76
        'helper/wifi-radio-energy-model-helper.cc',
77
        'helper/wifi-radio-energy-model-helper.cc',
77
        'helper/vht-wifi-mac-helper.cc',
78
        'helper/vht-wifi-mac-helper.cc',
78
        'helper/ht-wifi-mac-helper.cc',
79
        'helper/ht-wifi-mac-helper.cc',
 Lines 168-173    Link Here 
168
        'model/wifi-tx-current-model.h',
169
        'model/wifi-tx-current-model.h',
169
        'model/vht-capabilities.h',
170
        'model/vht-capabilities.h',
170
        'model/erp-information.h',
171
        'model/erp-information.h',
172
        'model/ht-operations.h',
171
        'helper/wifi-radio-energy-model-helper.h',
173
        'helper/wifi-radio-energy-model-helper.h',
172
        'helper/vht-wifi-mac-helper.h',
174
        'helper/vht-wifi-mac-helper.h',
173
        'helper/ht-wifi-mac-helper.h',
175
        'helper/ht-wifi-mac-helper.h',

Return to bug 2297