1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ 2 /* 3 * Copyright (c) 2013 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 * Authors: Ghada Badawy <gbadawy@gmail.com> 19 * Sébastien Deronne <sebastien.deronne@gmail.com> 20 */ 21 22 #ifndef HT_CAPABILITIES_H 23 #define HT_CAPABILITIES_H 24 25 #include "ns3/wifi-information-element.h" 26 27 /** 28 * This defines the maximum number of supported MCSs that a STA is 29 * allowed to have. Currently this number is set for IEEE 802.11n 30 */ 31 #define MAX_SUPPORTED_MCS (77) 32 33 namespace ns3 { 34 35 /** 36 * \brief The HT Capabilities Information Element 37 * \ingroup wifi 38 * 39 * This class knows how to serialise and deserialise the HT Capabilities Information Element 40 */ 41 class HtCapabilities : public WifiInformationElement 42 { 43 public: 44 HtCapabilities (); 45 46 // Implementations of pure virtual methods of WifiInformationElement 47 WifiInformationElementId ElementId () const override; 48 uint8_t GetInformationFieldSize () const override; 49 void SerializeInformationField (Buffer::Iterator start) const override; 50 uint8_t DeserializeInformationField (Buffer::Iterator start, 51 uint8_t length) override; 52 /* This information element is a bit special in that it is only 53 included if the STA is an HT STA. To support this we 54 override the Serialize and GetSerializedSize methods of 55 WifiInformationElement. */ 56 Buffer::Iterator Serialize (Buffer::Iterator start) const override; 57 uint16_t GetSerializedSize () const override; 58 59 /** 60 * Set the HT supported field. 61 * 62 * \param htSupported the HT supported field 63 */ 64 void SetHtSupported (uint8_t htSupported); 65 66 /** 67 * Set the HT Capabilities Info field in the HT Capabilities information element. 68 * 69 * \param ctrl the HT Capabilities Info field in the HT Capabilities information element 70 */ 71 void SetHtCapabilitiesInfo (uint16_t ctrl); 72 /** 73 * Set the A-MPDU Parameters field in the HT Capabilities information element. 74 * 75 * \param ctrl the A-MPDU Parameters field in the HT Capabilities information element 76 */ 77 void SetAmpduParameters (uint8_t ctrl); 78 /** 79 * Set the Supported MCS Set field in the HT Capabilities information element. 80 * 81 * \param ctrl1 the first 64 bytes of the Supported MCS Set field in the HT Capabilities information element 82 * \param ctrl2 the last 64 bytes of the Supported MCS Set field in the HT Capabilities information element 83 */ 84 void SetSupportedMcsSet (uint64_t ctrl1, uint64_t ctrl2); 85 /** 86 * Set the Extended HT Capabilities field in the HT Capabilities information element. 87 * 88 * \param ctrl the Extended HT Capabilities field in the HT Capabilities information element 89 */ 90 void SetExtendedHtCapabilities (uint16_t ctrl); 91 /** 92 * Set the Transmit Beamforming (TxBF) Capabilities field in the HT Capabilities information element. 93 * 94 * \param ctrl the Transmit Beamforming (TxBF) Capabilities field in the HT Capabilities information element 95 */ 96 void SetTxBfCapabilities (uint32_t ctrl); 97 /** 98 * Set the the Antenna Selection (ASEL) Capabilities field in the HT Capabilities information element. 99 * 100 * \param ctrl the Antenna Selection (ASEL) Capabilities field in the HT Capabilities information element 101 */ 102 void SetAntennaSelectionCapabilities (uint8_t ctrl); 103 104 /** 105 * Set the LDPC field. 106 * 107 * \param ldpc the LDPC field 108 */ 109 void SetLdpc (uint8_t ldpc); 110 /** 111 * Set the supported channel width field. 112 * 113 * \param supportedChannelWidth the supported channel width field 114 */ 115 void SetSupportedChannelWidth (uint8_t supportedChannelWidth); 116 /** 117 * Set the short guard interval 20 field. 118 * 119 * \param shortGuardInterval the short guard interval 120 */ 121 void SetShortGuardInterval20 (uint8_t shortGuardInterval); 122 /** 123 * Set the short guard interval 40 field. 124 * 125 * \param shortGuardInterval the short guard interval 126 */ 127 void SetShortGuardInterval40 (uint8_t shortGuardInterval); 128 /** 129 * Set the maximum AMSDU length. 130 * 131 * \param maxAmsduLength Either 3839 or 7935 132 */ 133 void SetMaxAmsduLength (uint16_t maxAmsduLength); 134 /** 135 * Set the LSIG protection support. 136 * 137 * \param lSigProtection the LSIG protection support field 138 */ 139 void SetLSigProtectionSupport (uint8_t lSigProtection); 140 141 /** 142 * Set the maximum AMPDU length. 143 * 144 * \param maxAmpduLength 2^(13 + x) - 1, x in the range 0 to 3 145 */ 146 void SetMaxAmpduLength (uint32_t maxAmpduLength); 147 148 /** 149 * Set the receive MCS bitmask. 150 * 151 * \param index the index of the receive MCS 152 */ 153 void SetRxMcsBitmask (uint8_t index); 154 /** 155 * Set the receive highest supported data rate. 156 * 157 * \param maxSupportedRate the maximum supported data rate 158 */ 159 void SetRxHighestSupportedDataRate (uint16_t maxSupportedRate); 160 /** 161 * Set the transmit MCS set defined. 162 * 163 * \param txMcsSetDefined the TX MCS set defined 164 */ 165 void SetTxMcsSetDefined (uint8_t txMcsSetDefined); 166 /** 167 * Set the transmit / receive MCS set unequal. 168 * 169 * \param txRxMcsSetUnequal the TX/RX MCS set unequal field 170 */ 171 void SetTxRxMcsSetUnequal (uint8_t txRxMcsSetUnequal); 172 /** 173 * Set the transmit maximum N spatial streams. 174 * 175 * \param maxTxSpatialStreams the maximum number of TX SSs 176 */ 177 void SetTxMaxNSpatialStreams (uint8_t maxTxSpatialStreams); 178 /** 179 * Set the transmit unequal modulation. 180 * 181 * \param txUnequalModulation the TX unequal modulation field 182 */ 183 void SetTxUnequalModulation (uint8_t txUnequalModulation); 184 185 /** 186 * Return the HT Capabilities Info field in the HT Capabilities information element. 187 * 188 * \return the HT Capabilities Info field in the HT Capabilities information element 189 */ 190 uint16_t GetHtCapabilitiesInfo (void) const; 191 /** 192 * Return the A-MPDU Parameters field in the HT Capabilities information element. 193 * 194 * \return the A-MPDU Parameters field in the HT Capabilities information element 195 */ 196 uint8_t GetAmpduParameters (void) const; 197 /** 198 * Return the first 64 bytes of the Supported MCS Set field in the HT Capabilities information element. 199 * 200 * \return the first 64 bytes of the Supported MCS Set field in the HT Capabilities information element 201 */ 202 uint64_t GetSupportedMcsSet1 (void) const; 203 /** 204 * Return the last 64 bytes of the Supported MCS Set field in the HT Capabilities information element. 205 * 206 * \return the last 64 bytes of the Supported MCS Set field in the HT Capabilities information element 207 */ 208 uint64_t GetSupportedMcsSet2 (void) const; 209 /** 210 * Return the Extended HT Capabilities field in the HT Capabilities information element. 211 * 212 * \return the Extended HT Capabilities field in the HT Capabilities information element 213 */ 214 uint16_t GetExtendedHtCapabilities (void) const; 215 /** 216 * Return the Transmit Beamforming (TxBF) Capabilities field in the HT Capabilities information element. 217 * 218 * \return the Transmit Beamforming (TxBF) Capabilities field in the HT Capabilities information element 219 */ 220 uint32_t GetTxBfCapabilities (void) const; 221 /** 222 * Return the Antenna Selection (ASEL) Capabilities field in the HT Capabilities information element. 223 * 224 * \return the Antenna Selection (ASEL) Capabilities field in the HT Capabilities information element 225 */ 226 uint8_t GetAntennaSelectionCapabilities (void) const; 227 228 /** 229 * Return LDPC. 230 * 231 * \return the LDPC value 232 */ 233 uint8_t GetLdpc (void) const; 234 /** 235 * Return the supported channel width. 236 * 237 * \return the supported channel width 238 */ 239 uint8_t GetSupportedChannelWidth (void) const; 240 /** 241 * Return the short guard interval 20 value. 242 * 243 * \return the short guard interval 20 value 244 */ 245 uint8_t GetShortGuardInterval20 (void) const; 246 /** 247 * Return the maximum A-MSDU length. 248 * 249 * \return the maximum A-MSDU length 250 */ 251 uint16_t GetMaxAmsduLength (void) const; 252 /** 253 * Return the maximum A-MPDU length. 254 * 255 * \return the maximum A-MPDU length 256 */ 257 uint32_t GetMaxAmpduLength (void) const; 258 /** 259 * Return the is MCS supported flag. 260 * 261 * \param mcs is MCS supported flag 262 * 263 * \return true if successful 264 */ 265 bool IsSupportedMcs (uint8_t mcs) const; 266 /** 267 * Return the receive highest supported antennas. 268 * 269 * \return the receive highest supported antennas 270 */ 271 uint8_t GetRxHighestSupportedAntennas (void) const; 272 273 274 private: 275 //HT Capabilities Info field 276 uint8_t m_ldpc; ///< LDPC 277 uint8_t m_supportedChannelWidth; ///< supported channel width 278 uint8_t m_smPowerSave; ///< SM power save 279 uint8_t m_greenField; ///< Greenfield 280 uint8_t m_shortGuardInterval20; ///< short guard interval 20 MHz 281 uint8_t m_shortGuardInterval40; ///< short guard interval 40 MHz 282 uint8_t m_txStbc; ///< transmit STBC 283 uint8_t m_rxStbc; ///< receive STBC 284 uint8_t m_htDelayedBlockAck; ///< HT delayed block ack 285 uint8_t m_maxAmsduLength; ///< maximum A-MSDU length 286 uint8_t m_dssMode40; ///< DSS mode 40 287 uint8_t m_psmpSupport; ///< PSMP support 288 uint8_t m_fortyMhzIntolerant; ///< 40 MHz intolerant 289 uint8_t m_lsigProtectionSupport; ///< L-SIG protection support 290 291 //A-MPDU Parameters field 292 uint8_t m_maxAmpduLengthExponent; ///< maximum A-MPDU length 293 uint8_t m_minMpduStartSpace; ///< minimum MPDU start space 294 uint8_t m_ampduReserved; ///< A-MPDU reserved 295 296 //Supported MCS Set field 297 uint8_t m_reservedMcsSet1; ///< reserved MCS set 1 298 uint16_t m_rxHighestSupportedDataRate; ///< receive highest supported data rate 299 uint8_t m_reservedMcsSet2; ///< reserved MCS set 2 300 uint8_t m_txMcsSetDefined; ///< transmit MCS set defined 301 uint8_t m_txRxMcsSetUnequal; ///< transmit / receive MCS set unequal 302 uint8_t m_txMaxNSpatialStreams; ///< transmit maximum number spatial streams 303 uint8_t m_txUnequalModulation; ///< transmit unequal modulation 304 uint32_t m_reservedMcsSet3; ///< reserved MCS set 3 305 uint8_t m_rxMcsBitmask[MAX_SUPPORTED_MCS]; ///< receive MCS bitmask 306 307 //HT Extended Capabilities field 308 uint8_t m_pco; ///< PCO 309 uint8_t m_pcoTransitionTime; ///< PCO transition time 310 uint8_t m_reservedExtendedCapabilities; ///< reserved extended capabilities 311 uint8_t m_mcsFeedback; ///< MCS feedback 312 uint8_t m_htcSupport; ///< HTC support 313 uint8_t m_reverseDirectionResponder; ///< reverse direction responder 314 uint8_t m_reservedExtendedCapabilities2; ///< reserver extended capabilities 2 315 316 //Transmit Beamforming Capabilities field 317 uint8_t m_implicitRxBfCapable; ///< implicit receive BF capable 318 uint8_t m_rxStaggeredSoundingCapable; ///< receive staggered sounding capable 319 uint8_t m_txStaggeredSoundingCapable; ///< transmit staggered sounding capable 320 uint8_t m_rxNdpCapable; ///< receive NDP capable 321 uint8_t m_txNdpCapable; ///< transmit NDP capable 322 uint8_t m_implicitTxBfCapable; ///< implicit transmit BF capable 323 uint8_t m_calibration; ///< calibration 324 uint8_t m_explicitCsiTxBfCapable; ///< explicit CSI transmit BF capable 325 uint8_t m_explicitNoncompressedSteeringCapable; ///< explicit non compressed steeering capable 326 uint8_t m_explicitCompressedSteeringCapable; ///< explicit compressed steeering capable 327 uint8_t m_explicitTxBfCsiFeedback; ///< explicit transmit BF CSI feedback 328 uint8_t m_explicitNoncompressedBfFeedbackCapable; ///< explicit non compressed BF feedback capable 329 uint8_t m_explicitCompressedBfFeedbackCapable; ///< explicit compressed BF feedback capable 330 uint8_t m_minimalGrouping; ///< minimal grouping 331 uint8_t m_csiNBfAntennasSupported; ///< CSI NBF antenna supported 332 uint8_t m_noncompressedSteeringNBfAntennasSupported; ///< non compressed steering NBF antenna supported 333 uint8_t m_compressedSteeringNBfAntennasSupported; ///< compressed steering NBF antenna supported 334 uint8_t m_csiMaxNRowsBfSupported; ///< CSI maximum number rows BF supported 335 uint8_t m_channelEstimationCapability; ///< channel estimation capability 336 uint8_t m_reservedTxBf; ///< reserved transmit BF 337 338 //ASEL Capabilities field 339 uint8_t m_antennaSelectionCapability; ///< antenna selection capability 340 uint8_t m_explicitCsiFeedbackBasedTxASelCapable; ///< explicit CSI feedback based transmit antenna selection capable 341 uint8_t m_antennaIndicesFeedbackBasedTxASelCapable; ///< antenna indices feedback based transmit antenna selection capable 342 uint8_t m_explicitCsiFeedbackCapable; ///< explicit CSI feedback capable 343 uint8_t m_antennaIndicesFeedbackCapable; ///< antenna indices feedback capable 344 uint8_t m_rxASelCapable; ///< receive antenna selection capable 345 uint8_t m_txSoundingPpdusCapable; ///< sounding PPDUS capable 346 uint8_t m_reservedASel; ///< reserved ASEL 347 348 /// This is used to decide whether this element should be added to the frame or not 349 uint8_t m_htSupported; 350 }; 351 352 /** 353 * output stream output operator 354 * 355 * \param os output stream 356 * \param htcapabilities the HT capabilities 357 * 358 * \returns output stream 359 */ 360 std::ostream &operator << (std::ostream &os, const HtCapabilities &htcapabilities); 361 362 } //namespace ns3 363 364 #endif /* HT_CAPABILITY_H */ 365