wlan_bearer/wlanldd/wlan_common/umac_common/inc/802dot11.h
changeset 0 c40eb8fe8501
child 7 0abc8c98be24
equal deleted inserted replaced
-1:000000000000 0:c40eb8fe8501
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   Header file mainly for 802.11 specific declarations and 
       
    15 *                definitions.
       
    16 *
       
    17 */
       
    18 
       
    19 /*
       
    20 * %version: 44 %
       
    21 */
       
    22 
       
    23 #ifndef WLAN802DOT11_H
       
    24 #define WLAN802DOT11_H
       
    25 
       
    26 #include "umac_types.h"
       
    27 // for copy, equal and operator != support
       
    28 #include "algorithm.h"
       
    29 #include "pack.h"
       
    30 
       
    31 /**
       
    32  * Returns a TUint16 host byte order value in WLAN MAC layer byte order 
       
    33  * (LSB first)
       
    34  *
       
    35  * @since S60 3.1
       
    36  * @param aNw value in network byte order
       
    37  * @return value in host byte order
       
    38  */
       
    39 extern TUint16 os_Hton( TUint16 aHost );
       
    40 
       
    41 /**
       
    42  * Returns a TUint16 WLAN MAC layer byte order (LSB first) value in host byte 
       
    43  * order
       
    44  *
       
    45  * @since S60 3.1
       
    46  * @param aNw value in network byte order
       
    47  * @return value in host byte order
       
    48  */
       
    49 extern TUint16 os_Ntoh( TUint16 aNw );
       
    50 
       
    51 /**
       
    52  * Returns a TUint32 host byte order value in WLAN MAC layer byte order 
       
    53  * (LSB first)
       
    54  *
       
    55  * @param aNw value in network byte order
       
    56  * @return value in host byte order
       
    57  */
       
    58 extern TUint32 os_H32ton( TUint32 aHost );
       
    59 
       
    60 /**
       
    61  * Returns a TUint32 WLAN MAC layer byte order (LSB first) value in host byte 
       
    62  * order
       
    63  *
       
    64  * @param aNw value in network byte order
       
    65  * @return value in host byte order
       
    66  */
       
    67 extern TUint32 os_N32toh( TUint32 aNw );
       
    68 
       
    69 /**
       
    70  * Allows also unaligned reading of a TUint16 WLAN MAC layer byte order 
       
    71  * (LSB first) value and returns the result in the byte order which
       
    72  * is in use in the host
       
    73  *
       
    74  * @since S60 3.1
       
    75  * @param aNwSource where to read the WLAN MAC layer byte order value from
       
    76  * @return the value which was read, in host byte order
       
    77  */
       
    78 #ifdef __ARMCC_VERSION
       
    79 /* Use the __packed qualifier for ARM compilations */
       
    80 inline TUint16 ReadUint16Toh( const __packed TUint16* aNwSource )
       
    81 #else
       
    82 inline TUint16 ReadUint16Toh( const TUint16* aNwSource )
       
    83 #endif
       
    84     {
       
    85     const TUint16 loByte ( static_cast<const TUint16>( 
       
    86             ( reinterpret_cast<const TUint8*>(aNwSource) )[0] ) );
       
    87 
       
    88     const TUint16 hiByte ( static_cast<const TUint16>(
       
    89             ( reinterpret_cast<const TUint8*>(aNwSource) )[1] ) << 8 );
       
    90     
       
    91     return ( os_Ntoh( loByte | hiByte ) );
       
    92     }
       
    93 
       
    94 /**
       
    95  * Allows also unaligned writing of a TUint16 host byte order value
       
    96  * into WLAN MAC layer byte order
       
    97  *
       
    98  * @since S60 3.1
       
    99  * @param aNwTarget where to write the WLAN MAC layer byte order value to
       
   100  * @param aHostValue the host byte order value to be written
       
   101  */
       
   102 #ifdef __ARMCC_VERSION
       
   103 /* Use the __packed qualifier for ARM compilations */
       
   104 inline void WriteHtoUint16( __packed TUint16* aNwTarget, TUint16 aHostValue )
       
   105 #else
       
   106 inline void WriteHtoUint16( TUint16* aNwTarget, TUint16 aHostValue )
       
   107 #endif
       
   108     {
       
   109     TUint16 nwValue = os_Hton( aHostValue );
       
   110     reinterpret_cast<TUint8*>(aNwTarget)[0] = 
       
   111         ( reinterpret_cast<TUint8*>(&nwValue) )[0];
       
   112     reinterpret_cast<TUint8*>(aNwTarget)[1] = 
       
   113         ( reinterpret_cast<TUint8*>(&nwValue) )[1];
       
   114     }
       
   115 
       
   116 /**
       
   117  * Allows also unaligned reading of a TUint32 WLAN MAC layer byte order 
       
   118  * (LSB first) value and returns the result in the byte order which
       
   119  * is in use in the host
       
   120  *
       
   121  * @param aNwSource where to read the WLAN MAC layer byte order value from
       
   122  * @return the value which was read, in host byte order
       
   123  */
       
   124 #ifdef __ARMCC_VERSION
       
   125 /* Use the __packed qualifier for ARM compilations */
       
   126 inline TUint32 ReadUint32Toh( const __packed TUint32* aNwSource )
       
   127 #else
       
   128 inline TUint32 ReadUint32Toh( const TUint32* aNwSource )
       
   129 #endif
       
   130     {
       
   131     const TUint32 byte0 ( static_cast<const TUint32>( 
       
   132             ( reinterpret_cast<const TUint8*>(aNwSource) )[0] ) );
       
   133 
       
   134     const TUint32 byte1 ( static_cast<const TUint32>(
       
   135             ( reinterpret_cast<const TUint8*>(aNwSource) )[1] ) << 8 );
       
   136     
       
   137     const TUint32 byte2 ( static_cast<const TUint32>(
       
   138             ( reinterpret_cast<const TUint8*>(aNwSource) )[2] ) << 16 );
       
   139 
       
   140     const TUint32 byte3 ( static_cast<const TUint32>(
       
   141             ( reinterpret_cast<const TUint8*>(aNwSource) )[3] ) << 24 );
       
   142 
       
   143     return ( os_N32toh( byte0 | byte1 | byte2 | byte3 ) );
       
   144     }
       
   145 
       
   146 /**
       
   147  * Allows also unaligned writing of a TUint32 host byte order value
       
   148  * into WLAN MAC layer byte order
       
   149  *
       
   150  * @param aNwTarget where to write the WLAN MAC layer byte order value to
       
   151  * @param aHostValue the host byte order value to be written
       
   152  */
       
   153 #ifdef __ARMCC_VERSION
       
   154 /* Use the __packed qualifier for ARM compilations */
       
   155 inline void WriteHtoUint32( __packed TUint32* aNwTarget, TUint32 aHostValue )
       
   156 #else
       
   157 inline void WriteHtoUint32( TUint32* aNwTarget, TUint32 aHostValue )
       
   158 #endif
       
   159     {
       
   160     TUint32 nwValue = os_H32ton( aHostValue );
       
   161     reinterpret_cast<TUint8*>(aNwTarget)[0] = 
       
   162         ( reinterpret_cast<TUint8*>(&nwValue) )[0];
       
   163     reinterpret_cast<TUint8*>(aNwTarget)[1] = 
       
   164         ( reinterpret_cast<TUint8*>(&nwValue) )[1];
       
   165     reinterpret_cast<TUint8*>(aNwTarget)[2] = 
       
   166         ( reinterpret_cast<TUint8*>(&nwValue) )[2];
       
   167     reinterpret_cast<TUint8*>(aNwTarget)[3] = 
       
   168         ( reinterpret_cast<TUint8*>(&nwValue) )[3];
       
   169     }
       
   170 
       
   171 /**
       
   172  * Reverses the byte order of a TUint16 value
       
   173  *
       
   174  * @since S60 3.1
       
   175  * @param aOriginal value whose byte order is to be reversed
       
   176  * @return the input parameter in reversed byte order
       
   177  */
       
   178 inline TUint16 ReverseUint16( TUint16 aOriginal )
       
   179     {
       
   180     return ( ( aOriginal >> 8 ) | ( aOriginal << 8 ) );
       
   181     }
       
   182 
       
   183 
       
   184 /**
       
   185 * A measurement of time equal to 1024 µs.
       
   186 */
       
   187 const TUint16 KTU = 1024;
       
   188 
       
   189 /**
       
   190 * Length of MAC header
       
   191 */
       
   192 const TUint8 KMacHeaderLength = 24;
       
   193 
       
   194 /**
       
   195 * Length of QoS MAC header
       
   196 */
       
   197 const TUint8 KQoSMacHeaderLength = 26;
       
   198 
       
   199 /**
       
   200 * Length of HT Control field in bytes
       
   201 */
       
   202 const TUint32 KHtControlFieldLength = 4;
       
   203 
       
   204 /**
       
   205 * Length of QoS MAC header with HT Control field in bytes
       
   206 */
       
   207 const TUint8 KHtQoSMacHeaderLength = 
       
   208     KQoSMacHeaderLength + KHtControlFieldLength;
       
   209 
       
   210 /**
       
   211 * Maximum number of 802.11b supported rates 
       
   212 * 1, 2, 5.5, 11 MBit/s
       
   213 */
       
   214 const TUint8 KMaxNumberOfDot11bRates = 4; 
       
   215 
       
   216 /**
       
   217 * Maximum number of actual supported rate elements in 
       
   218 * supported rates information element
       
   219 */
       
   220 const TUint8 KMaxNumberOfRates = 8;
       
   221 
       
   222 /**
       
   223 * Maximum number of actual 802.11 supported rate elements in 
       
   224 * extended supported rates information element
       
   225 */
       
   226 const TUint8 KMaxNumberOfExtendedRates = 255;
       
   227 
       
   228 /**
       
   229 * Maximum number of 802.11b plus 802.11g supported rates 
       
   230 */
       
   231 const TUint8 KMaxNumberOfDot11bAndgRates = 14; 
       
   232 
       
   233 /**
       
   234 * Bit mask for checking is supported rate element 
       
   235 * part of BSS Basic Rate Set (MSB bit is set)
       
   236 */
       
   237 const TUint8 KBasicRateMask = 0x80;
       
   238 
       
   239 /**
       
   240 * Maximum length for a WEP key in BYTES
       
   241 */
       
   242 const TUint32 KMaxWEPKeyLength = 29;    // 232 bits
       
   243 
       
   244 /**
       
   245 * Length of TKIP key;
       
   246 */
       
   247 const TUint8 KTKIPKeyLength = 16;
       
   248 
       
   249 /**
       
   250 * Length of WEP Init.Vector in BYTES
       
   251 */
       
   252 const TUint8 KWepIVLength = 4;
       
   253 
       
   254 /**
       
   255 * Length of WEP ICV in BYTES
       
   256 */
       
   257 const TUint8 KWEPICVLength = 4;
       
   258 
       
   259 /**
       
   260 * Length of Extended IV field in bytes.
       
   261 */
       
   262 const TUint8 KWepExtendedIVLength = 4;
       
   263 
       
   264 /**
       
   265 * Length of CCMP header in bytes.
       
   266 */
       
   267 const TUint8 KCcmpHeaderLength = 8;
       
   268 
       
   269 /**
       
   270 * Length of WAPI header in bytes.
       
   271 */
       
   272 const TUint8 KWapiHeaderLength = 18;
       
   273 
       
   274 /**
       
   275 * Length of WAPI MIC in bytes.
       
   276 */
       
   277 const TUint8 KWapiMicLength = 16;
       
   278 
       
   279 /**
       
   280 * Mask to determine is Ext IV bit up in WEP IV
       
   281 */
       
   282 const TUint32 KWepExtendedIvMask = 0x20000000;
       
   283 
       
   284 /**
       
   285 * Mask for Use Protection bit in ERP Information IE
       
   286 */
       
   287 const TUint8 KUseProtectionMask = 0x02;
       
   288 
       
   289 /**
       
   290 * Length of MIC in BYTEs
       
   291 */
       
   292 const TUint8 KMicLength = 8;
       
   293 
       
   294 /** 
       
   295 * Length of the MIC key in BYTEs
       
   296 */ 
       
   297 const TUint8 KMicKeyLength = 8;
       
   298 
       
   299 /**
       
   300 * Length of ID and Length fields of an information element.
       
   301 */
       
   302 const TUint8 KInfoElementHeaderLength = 2;
       
   303 
       
   304 /**
       
   305 * Length of the challenge text in BYTES used in shared key authentication
       
   306 */
       
   307 const TUint8 KChallengeTextLength = 128;
       
   308 
       
   309 /**
       
   310 * Ethernet header type field identifier for Bounce type packet
       
   311 */
       
   312 const TUint16 KBounceType = 0x8013;
       
   313 
       
   314 /**
       
   315 * Ethernet header type field identifier for EAPOL type packet (IEEE 802.1X)
       
   316 */
       
   317 const TUint16 KEapolType = 0x888E;
       
   318 
       
   319 /**
       
   320 * Ethernet header type field identifier for WAPI authentication, i.e. WAI,
       
   321 * type packet
       
   322 */
       
   323 const TUint16 KWaiType = 0x88B4;
       
   324 
       
   325 /**
       
   326 * Ethernet header type field identifier for IP type packet
       
   327 */
       
   328 const TUint16 KIpType = 0x0800;
       
   329 
       
   330 /**
       
   331 * Ethernet header type field identifier for IPv6 type packet
       
   332 */
       
   333 const TUint16 KIpv6Type = 0x86DD;
       
   334 
       
   335 /**
       
   336 * Ethernet header type field identifier for ARP type packet
       
   337 */
       
   338 const TUint16 KArpType = 0x0806;
       
   339 
       
   340 /**
       
   341 * Length of OUI field in SNAP header
       
   342 */
       
   343 const TUint8 KOIULength = 3;
       
   344 
       
   345 /**
       
   346 * Maximum length of 802.11 MSDU in bytes
       
   347 */
       
   348 const TUint16 KMaxDot11MsduLength = 2304;
       
   349 
       
   350 /**
       
   351 * Maximum length of 802.11 A-MSDU in bytes
       
   352 */
       
   353 const TUint16 KMaxDot11AmsduLength = 7935;
       
   354 
       
   355 /**
       
   356 * Length of trailing FCS in bytes
       
   357 */
       
   358 const TUint32 KFcsLength = 4;
       
   359 
       
   360 /**
       
   361 * Maximum length in bytes of security encapsulation header in a
       
   362 * 802.11 MPDU
       
   363 */
       
   364 const TUint16 KMaxDot11SecurityHeaderLength = KWapiHeaderLength; // 18
       
   365 
       
   366 /**
       
   367 * Maximum length in bytes of security encapsulation trailer in a
       
   368 * 802.11 MPDU
       
   369 */
       
   370 const TUint16 KMaxDot11SecurityTrailerLength = KWapiMicLength;   // 16
       
   371 
       
   372 /**
       
   373 * Maximum length in bytes of security encapsulation header and trailer in a
       
   374 * 802.11 MPDU
       
   375 */
       
   376 const TUint16 KMaxDot11SecurityEncapsulationLength =    // 34
       
   377     KMaxDot11SecurityHeaderLength +                     // 18
       
   378     KMaxDot11SecurityTrailerLength;                     // 16    
       
   379 
       
   380 /**
       
   381 * Maximum length of 802.11 MPDU we will receive.
       
   382 * This excludes the tailing FCS ( HW strips it )
       
   383 * and Address4 field in the MPDU header 
       
   384 * ( AP-to-AP mode frames are filtered out )
       
   385 */
       
   386 const TUint16 KMaxDot11RxMpduLength =        // 7999
       
   387     KHtQoSMacHeaderLength +                  //   30
       
   388     KMaxDot11SecurityEncapsulationLength +   //   34
       
   389     KMaxDot11AmsduLength;                    // 7935
       
   390 
       
   391 /**
       
   392 * Maximum length of 802.11 MPDU we will transmit.
       
   393 * This excludes the tailing FCS ( HW strips it )
       
   394 * and Address4 field in the MPDU header 
       
   395 * ( AP-to-AP mode frames are filtered out )
       
   396 * Additionally we don't currently support A-MSDU Tx 
       
   397 */
       
   398 const TUint16 KMaxDot11TxMpduLength =        // 2368
       
   399     KHtQoSMacHeaderLength +                  //   30
       
   400     KMaxDot11SecurityEncapsulationLength +   //   34
       
   401     KMaxDot11MsduLength;                     // 2304
       
   402 
       
   403 /**
       
   404 * Maximum length of ethernet frame
       
   405 */
       
   406 const TUint16 KMaxEthernetFrameLength = 1514;
       
   407 
       
   408 /**
       
   409 * Maximum value in ethernet length field
       
   410 */
       
   411 const TUint16 KMaxEthernetLengthFieldvalue = 1500;
       
   412 
       
   413 /**
       
   414 * Length of the TKIP key in BYTEs
       
   415 */
       
   416 const TUint8 KTkIpKeyLength = 16;
       
   417 
       
   418 /**
       
   419 * Length of IPv4 address field in BYTEs
       
   420 */
       
   421 const TUint8 KIpv4AddrLength = 4;
       
   422 
       
   423 /**
       
   424 * Length of the priority field used in WPA MIC calculation
       
   425 */
       
   426 const TUint32 KWpaPriorityVecLen = 4;
       
   427 
       
   428 /**
       
   429 * WPA priority field used in MIC calculation
       
   430 */
       
   431 const TUint8 KWpaPriorityVec[KWpaPriorityVecLen] = {0,0,0,0};
       
   432 
       
   433 /**
       
   434 * Mask for frame type for frame control field.
       
   435 */
       
   436 const TUint32 K802Dot11FrameTypeMask = 0xFFFF;
       
   437 
       
   438 /**
       
   439 * Mask to determine if U-APSD bit is up in QoS info field of WMM IE
       
   440 */
       
   441 const TUint8 KUapsdQosInfoMask = 0x80;
       
   442 
       
   443 /**
       
   444 * Mask for parameter set count in QoS info field of WMM IE
       
   445 */
       
   446 const TUint8 KParamSetCountQosInfoMask = 0x0F;
       
   447 
       
   448 /**
       
   449 * Length of WMM Information Element
       
   450 */
       
   451 const TUint8 KWmmInfoElemLen = 7;
       
   452 
       
   453 /**
       
   454 * Length of OUI field in Information Elements
       
   455 */
       
   456 const TUint8 KIeOuiLength = 3;
       
   457 
       
   458 typedef TUint8 TIeOui[KIeOuiLength];
       
   459 
       
   460 /**
       
   461 * OUI value of WMM Information Element and
       
   462 * WMM Parameter Element
       
   463 */
       
   464 const TIeOui KWmmElemOui = { 0x00, 0x50, 0xF2 };
       
   465 
       
   466 /**
       
   467 * OUI Type value of WMM Information Element and
       
   468 * WMM Parameter Element
       
   469 */
       
   470 const TUint8 KWmmElemOuiType = 2;
       
   471 
       
   472 /**
       
   473 * OUI Subtype value of WMM Information Element
       
   474 */
       
   475 const TUint8 KWmmInfoElemOuiSubType = 0;
       
   476 
       
   477 /**
       
   478 * OUI Subtype value of WMM Parameter Element
       
   479 */
       
   480 const TUint8 KWmmParamElemOuiSubtype = 1;
       
   481 
       
   482 /**
       
   483 * Version of WMM Information Element
       
   484 */
       
   485 const TUint8 KWmmInfoElemVersion = 1;
       
   486 
       
   487 /**
       
   488 * Version of WMM Parameter Element
       
   489 */
       
   490 const TUint8 KWmmParamElemVersion = 1;
       
   491 
       
   492 /**
       
   493 * AC flags in QoS info field of WMM IE
       
   494 * When a flag is set the corresponding AC is both trigger and delivery enabled
       
   495 */
       
   496 enum TQosInfoUapsdFlag
       
   497     {
       
   498     EAcVoUapsdFlag = 0x01, // Voice 
       
   499     EAcViUapsdFlag = 0x02, // Video 
       
   500     EAcBkUapsdFlag = 0x04, // Background 
       
   501     EAcBeUapsdFlag = 0x08  // Best Effort 
       
   502     };
       
   503 
       
   504 
       
   505 /**
       
   506 * Maximum U-APSD Service Period length. Indicates the max number of MSDUs and 
       
   507 * MMPDUs the WMM AP may deliver to a WMM STA during any service period 
       
   508 * triggered by the WMM STA.
       
   509 */
       
   510 enum TQosInfoUapsdMaxSpLen
       
   511     {
       
   512     EMaxSpLenAllFrames  = 0x00,
       
   513     EMaxSpLenTwoFrames  = 0x20,
       
   514     EMaxSpLenFourFrames = 0x40,
       
   515     EMaxSpLenSixFrames  = 0x60
       
   516     };
       
   517 
       
   518 const TUint8 K802Dot11AccessCategoryMask = 0x60;
       
   519 
       
   520 /**
       
   521 * WMM Access Categories
       
   522 */
       
   523 enum TWmmAccessCategory
       
   524     {
       
   525     EAcBestEffort   = 0x00, 
       
   526     EAcBackground   = 0x20,
       
   527     EAcVideo        = 0x40,
       
   528     EAcVoice        = 0x60
       
   529     };
       
   530 
       
   531 /**
       
   532 * Number of WMM Access Categories
       
   533 */
       
   534 const TUint8 KNumOfWmmACs = 4;
       
   535 
       
   536 /**
       
   537 * Mask for the Admission Control Mandatory flag
       
   538 * in ACI/AIFSN field
       
   539 * of AC parameter Record
       
   540 * of WMM Parameter Element
       
   541 */
       
   542 const TUint8 KWmmAdmissionCtrlMandatoryMask = 0x10;
       
   543 
       
   544 /**
       
   545 * Mask for the AIFSN subfiled
       
   546 * in ACI/AIFSN field
       
   547 * of AC parameter Record
       
   548 * of WMM Parameter Element
       
   549 */
       
   550 const TUint8 KWmmAifsnMask = 0x0F;
       
   551 
       
   552 /**
       
   553 * Mask for the ECWmin field
       
   554 * of AC parameter Record
       
   555 * of WMM Parameter Element
       
   556 */
       
   557 const TUint8 KWmmEcwMinMask = 0x0F;
       
   558 
       
   559 /**
       
   560 * Mask for the ECWmax field
       
   561 * of AC parameter Record
       
   562 * of WMM Parameter Element
       
   563 */
       
   564 const TUint8 KWmmEcwMaxMask = 0xF0;
       
   565 
       
   566 /**
       
   567 * 802.11 Authentication sequence numbers
       
   568 */
       
   569 enum T802Dot11AuthenticationSeqNmbr
       
   570     {
       
   571     E802Dot11AuthenticationSeqNmbr1   = 1,
       
   572     E802Dot11AuthenticationSeqNmbr2   = 2,
       
   573     E802Dot11AuthenticationSeqNmbr3   = 3,
       
   574     E802Dot11AuthenticationSeqNmbr4   = 4
       
   575     };
       
   576 
       
   577 /**
       
   578 * 802.11 supported rate bytes. Used e.g. in Beacon frames.
       
   579 */
       
   580 enum T802Dot11SupportedRate
       
   581     {
       
   582     E802Dot11Rate1MBit              = 2,
       
   583     E802Dot11Rate2MBit              = 4,
       
   584     E802Dot11Rate5p5MBit            = 11,
       
   585     E802Dot11Rate6MBit              = 12,
       
   586     E802Dot11Rate9MBit              = 18,
       
   587     E802Dot11Rate11MBit             = 22,
       
   588     E802Dot11Rate12MBit             = 24,
       
   589     E802Dot11Rate18MBit             = 36,
       
   590     E802Dot11Rate22MBit             = 44,
       
   591     E802Dot11Rate24MBit             = 48,
       
   592     E802Dot11Rate33MBit             = 66,
       
   593     E802Dot11Rate36MBit             = 72,
       
   594     E802Dot11Rate48MBit             = 96,
       
   595     E802Dot11Rate54MBit             = 108
       
   596     };
       
   597 
       
   598 /**
       
   599 * Management frame information element IDs.
       
   600 */
       
   601 enum T802Dot11InformationElementID
       
   602     {
       
   603     E802Dot11SsidIE                 = 0,
       
   604     E802Dot11SupportedRatesIE       = 1,
       
   605     E802Doi11FhParameterSetIE       = 2,
       
   606     E802Dot11DsParameterSetIE       = 3,
       
   607     E802Dot11CfParameterSetIE       = 4,
       
   608     E802Dot11TimIE                  = 5,
       
   609     E802Dot11IbssParameterSetIE     = 6,
       
   610     E802Dot11CountryIE              = 7,
       
   611     E802Dot11HoppingPatternParamIE  = 8,
       
   612     E802Dot11HoppingPatternTableIE  = 9,
       
   613     E802Dot11RequestIE              = 10,
       
   614 
       
   615     E802Dot11ChallengeTextIE        = 16,
       
   616     // Reserved for challenge text extension 17 - 31
       
   617     E802Dot11ErpInformationIE       = 42,
       
   618     E802Dot11HtCapabilitiesIE       = 45,
       
   619     E802Dot11ExtendedRatesIE        = 50,
       
   620     E802Dot11HtOperationIE          = 61,
       
   621     E802Dot11VendorSpecificIE       = 221    
       
   622     };
       
   623 
       
   624 /**
       
   625 * Bit masks for bit fields ín Frame Control field.
       
   626 */
       
   627 enum T802Dot11FrameControlBitMask
       
   628     {
       
   629     E802Dot11FrameControlProtVersionMask= 0x0003,
       
   630     E802Dot11FrameControlTypeMask       = 0x000C,
       
   631     E802Dot11FrameControlSubtypeMask    = 0x00F0,
       
   632     E802Dot11FrameControlToDsMask       = 0x0100,
       
   633     E802Dot11FrameControlFromDsMask     = 0x0200,
       
   634     E802Dot11FrameControlMoreFragMask   = 0x0400,
       
   635     E802Dot11FrameControlRetryMask      = 0x0800,
       
   636     E802Dot11FrameControlPowerMgmtMask  = 0x1000,
       
   637     E802Dot11FrameControlMoreDataMask   = 0x2000,
       
   638     E802Dot11FrameControlWepMask        = 0x4000,
       
   639     E802Dot11FrameControlOrderMask      = 0x8000
       
   640     };
       
   641 
       
   642 /**
       
   643 * Frame Control field type masks.
       
   644 */
       
   645 enum T802Dot11FrameControlBasicTypeMask
       
   646 {
       
   647     E802Dot11FrameBasicTypeManagement       = 0x00,
       
   648     E802Dot11FrameBasicTypeControl          = 0x04,
       
   649     E802Dot11FrameBasicTypeData             = 0x08
       
   650 };
       
   651 
       
   652 /**
       
   653 * Frame Control field subtype masks.
       
   654 */
       
   655 enum T802Dot11FrameControlTypeMask
       
   656     {
       
   657     E802Dot11FrameTypeAssociationReq        = 0x00,
       
   658     E802Dot11FrameTypeAssociationResp       = 0x10,
       
   659     E802Dot11FrameTypeReassociationReq      = 0x20,
       
   660     E802Dot11FrameTypeReassociationResp     = 0x30,
       
   661     E802Dot11FrameTypeProbeReq              = 0x40,
       
   662     E802Dot11FrameTypeProbeResp             = 0x50,
       
   663     E802Dot11FrameTypeBeacon                = 0x80,
       
   664     E802Dot11FrameTypeAtim                  = 0x90,
       
   665     E802Dot11FrameTypeDisassociation        = 0xA0,
       
   666     E802Dot11FrameTypeAuthentication        = 0xB0,
       
   667     E802Dot11FrameTypeDeauthentication      = 0xC0,
       
   668     E802Dot11FrameTypePowerSavePoll         = 0xA4,
       
   669     E802Dot11FrameTypeReqToSend             = 0xB4,
       
   670     E802Dot11FrameTypeClearToSend           = 0xC4,
       
   671     E802Dot11FrameTypeAcknowledgement       = 0xD4,
       
   672     E802Dot11FrameTypeCfEnd                 = 0xE4,
       
   673     E802Dot11FrameTypeCfEndCfAck            = 0xF4,
       
   674     E802Dot11FrameTypeData                  = 0x08,
       
   675     E802Dot11FrameTypeDataCfAck             = 0x18,
       
   676     E802Dot11FrameTypeDataCfPoll            = 0x28,
       
   677     E802Dot11FrameTypeDataCfAckCfPoll       = 0x38,
       
   678     E802Dot11FrameTypeDataNull              = 0x48,
       
   679     E802Dot11FrameTypeCfAckNoData           = 0x58,
       
   680     E802Dot11FrameTypeCfPollNoData          = 0x68,
       
   681     E802Dot11FrameTypeCfAckCfPollNoData     = 0x78,
       
   682     E802Dot11FrameTypeQosData               = 0x88,
       
   683     E802Dot11FrameTypeQosDataCfAck          = 0x98,
       
   684     E802Dot11FrameTypeQosDataCfPoll         = 0xA8,
       
   685     E802Dot11FrameTypeQosDataCfAckCfPoll    = 0xB8,
       
   686     E802Dot11FrameTypeQosDataNull           = 0xC8,
       
   687     E802Dot11FrameTypeManagementAction      = 0xD0,
       
   688 
       
   689     // not valid 802.11 types. 
       
   690     // just used at Tx completion to distinguish separate cases
       
   691     E802Dot11FrameTypeAuthSeqNmbr1          = 0xFD,
       
   692     E802Dot11FrameTypeAuthSeqNmbr3          = 0xFE,
       
   693     E802Dot11FrameTypeDataEapol             = 0xFF,
       
   694     E802Dot11FrameTypeTestFrame             = 0xFFFF
       
   695     };
       
   696 
       
   697 /**
       
   698 * Bit masks for Capability Information field.
       
   699 */
       
   700 enum T802Dot11CapabilityBitMask
       
   701     {
       
   702     E802Dot11CapabilityEssMask          = 0x0001,
       
   703     E802Dot11CapabilityIbssMask         = 0x0002,
       
   704     E802Dot11CapabilityCfPollableMask   = 0x0004,
       
   705     E802Dot11CapabilityCfPollRequestMask= 0x0008,
       
   706     E802Dot11CapabilityPrivacyMask      = 0x0010,
       
   707     // these little critters are from 802.11b spec
       
   708     E802Dot11ShortPreambleMask          = 0x0020,
       
   709     E802Dot11PbccMask                   = 0x0040,      
       
   710     E802Dot11ChannelAgilityMask         = 0x0080,
       
   711     E802Dot11ShortSlotTimeMask          = 0x0400,
       
   712     E802Dot11RadioMeasurementMask       = 0x1000
       
   713     };
       
   714 
       
   715 /**
       
   716 * Supported authentication modes
       
   717 */
       
   718 const TUint16 K802Dot11AuthModeOpen   = 0;
       
   719 const TUint16 K802Dot11AuthModeShared = 1;
       
   720 
       
   721 /**
       
   722 * 802.11 status codes
       
   723 */
       
   724 enum T802Dot11ManagementStatusCode
       
   725     {
       
   726     E802Dot11StatusSuccess                          = 0,
       
   727     E802Dot11StatusUnspecifiedFailure               = 1,
       
   728     // 2 -9 reserved    
       
   729     E802Dot11StatusUnsupportedCapabilities          = 10,
       
   730     E802Dot11StatusReAssociationDenied              = 11,
       
   731     E802Dot11StatusAssocDenied                      = 12,
       
   732     E802Dot11StatusAuthAlgorithmNotSupported        = 13,
       
   733     E802Dot11StatusAuthFrameOutOfSequence           = 14,
       
   734     E802Dot11StatusChallengeFailure                 = 15,
       
   735     E802Dot11StatusAuthRejectedTimeout              = 16,
       
   736     E802Dot11StatusAssocDeniedApFull                = 17,
       
   737     E802Dot11StatusAssocDeniedBasicRatesUnSupp      = 18,
       
   738     // following three little critters are from 802.11b spec
       
   739     E802Dot11StatusAssocDeniedShortPreambleUnSupp   = 19,
       
   740     E802Dot11StatusAssocDeniedPbccUnSupp            = 20,
       
   741     E802Dot11StatusAssocDeniedChannelAgilityUnSupp  = 21    
       
   742     // 22 - 65,535 reserved
       
   743     };
       
   744 
       
   745 /**
       
   746 * 802.11 reason codes
       
   747 */
       
   748 enum T802Dot11ManagementReasonCode
       
   749     {
       
   750     // 0 reserved
       
   751     E802Dot11ReasonUnspecified                = 1,
       
   752     E802Dot11ReasonAuthNoLongerValid          = 2,
       
   753     E802Dot11ReasonDeauthStationLeft          = 3,
       
   754     E802Dot11ReasonDisAssocInactivity         = 4,
       
   755     E802Dot11ReasonDisAssocAPFull             = 5,
       
   756     E802Dot11ReasonClass2FrameWhenNotAuth     = 6,
       
   757     E802Dot11ReasonClass3FrameWhenNotAssoc    = 7,
       
   758     E802Dot11ReasonDisAssocStationLeft        = 8,
       
   759     E802Dot11ReasonAssocFailNotAuth           = 9,
       
   760     // 10 - 12 reserved    
       
   761     // WPA stuff
       
   762     E802Dot11ReasonInvalidIe                  = 13,
       
   763     E802Dot11ReasonMicFailure                 = 14,
       
   764     E802Dot11ReasonHandshakeTimeout           = 15,
       
   765     E802Dot11ReasonGroupKeyUpdateTimeout      = 16,
       
   766     E802Dot11ReasonIeMismatch                 = 17,
       
   767     E802Dot11ReasonMulticastChipherNotValid   = 18,
       
   768     E802Dot11ReasonUnicastChipherNotValid     = 19,
       
   769     E802Dot11ReasonAkmpNotValid               = 20,
       
   770     E802Dot11ReasonUnsupportedRsneVersion     = 21,
       
   771     E802Dot11ReasonInvalidRsneCapabilities    = 22,
       
   772     E802Dot11Reason1xAuthenticationFailed     = 23,
       
   773     // 24 - 65,535 reserved    
       
   774     };
       
   775 
       
   776 /**
       
   777 * 802.11 management frame fixed field and IE lengths in bytes
       
   778 */
       
   779 const TUint KTimeStampFixedFieldLength                = 8;
       
   780 const TUint KBeaconIntervalFixedFieldLength           = 2;
       
   781 const TUint KCapabilityInformationFixedFieldLength    = 2;
       
   782 const TUint K802Dot11ErpInformationIeDataLen          = 1;
       
   783 
       
   784 /**
       
   785 * 802.11 management frame IE data part min/max lengths in bytes
       
   786 */
       
   787 
       
   788 const TUint K802Dot11SupportedRatesIeDataMinLen = 1;
       
   789 
       
   790 const TUint K802Dot11TimIeDataMinLen = 4;
       
   791 const TUint K802Dot11TimIeDataMaxLen = 254;
       
   792 
       
   793 const TUint K802Dot11ExtendedRatesIeDataMinLen = 1;
       
   794 
       
   795 /**
       
   796 * 802.11 BSS Membership Selector values for different features
       
   797 */
       
   798 enum T802Dot11BssMembershipSelector
       
   799     {
       
   800     E802Dot11HtPhy = 127 | KBasicRateMask  // 255
       
   801     };
       
   802 
       
   803 /**
       
   804 * operator== for TMacAddress 
       
   805 * @param aLhs left hand side
       
   806 * @param aRhs right hand side
       
   807 * @return ETrue equal, EFalse not equal
       
   808 */
       
   809 inline TBool operator== ( 
       
   810     const TMacAddress& aLhs, const TMacAddress& aRhs )
       
   811     {
       
   812     return ( equal( (aLhs.iMacAddress),
       
   813                     (aLhs.iMacAddress) + KMacAddressLength, 
       
   814                     aRhs.iMacAddress) );
       
   815     }
       
   816 
       
   817 /**
       
   818 * Sets or clears the group bit of the MAC address 
       
   819 * @param aMac the address
       
   820 * @param aSet set or clear the bit
       
   821 */
       
   822 inline void GroupBit( TMacAddress& aMac, TBool aSet = ETrue )
       
   823     {
       
   824     if ( aSet )
       
   825         {
       
   826         aMac.iMacAddress[0] |= KBit0;
       
   827         }
       
   828     else
       
   829         {
       
   830         aMac.iMacAddress[0] &= ~KBit0;
       
   831         }
       
   832     }
       
   833 
       
   834 /**
       
   835 * Evaluates if the group bit of the MAC address is set
       
   836 * @param aMac the address
       
   837 * @return ETrue if group bit is set EFalse in other case
       
   838 */
       
   839 inline TBool IsGroupBitSet( const TMacAddress& aMac )
       
   840     {
       
   841     return (aMac.iMacAddress[0] & KBit0);
       
   842     }
       
   843 
       
   844 /**
       
   845 * Sets or clears the local bit of the MAC address 
       
   846 * @param aMac the address
       
   847 * @param aSet set or clear the bit
       
   848 */
       
   849 inline void LocalBit( TMacAddress& aMac, TBool aSet = ETrue )
       
   850     {
       
   851     if ( aSet )
       
   852         {
       
   853         aMac.iMacAddress[0] |= KBit1;
       
   854         }
       
   855     else
       
   856         {
       
   857         aMac.iMacAddress[0] &= ~KBit1;
       
   858         }
       
   859     }
       
   860 
       
   861 /**
       
   862 * Evaluates if the local bit of the MAC address is set
       
   863 * @param aMac the address
       
   864 * @return ETrue if group bit is set EFalse in other case
       
   865 */
       
   866 inline TBool IsLocalBitSet( const TMacAddress& aMac )
       
   867     {
       
   868     return (aMac.iMacAddress[0] & KBit1);
       
   869     }
       
   870 
       
   871 /**
       
   872 * 802.11 information element header
       
   873 */
       
   874 #pragma pack( 1 )
       
   875 struct SInformationElementHeader
       
   876     {
       
   877     /** the element ID */
       
   878     const TUint8    iElementID;
       
   879     /** length of the following IE */
       
   880     TUint8          iLength;      
       
   881 
       
   882     /**
       
   883     * Ctor
       
   884     * @param aElementID element ID used
       
   885     */
       
   886     explicit SInformationElementHeader( 
       
   887         T802Dot11InformationElementID aElementID ) 
       
   888         : iElementID( static_cast<TUint8>(aElementID) ), iLength( 0 ) {};
       
   889     /**
       
   890     * Ctor
       
   891     * @param aElementID element ID used
       
   892     * @param aLength length of the information element following this header
       
   893     */
       
   894     SInformationElementHeader( T802Dot11InformationElementID aElementID, 
       
   895         const TUint8 aLength ) 
       
   896         : iElementID( static_cast<TUint8>(aElementID) ), iLength( aLength ) {};
       
   897 
       
   898 private:
       
   899 
       
   900     /** Prohibit assignment operator */
       
   901     SInformationElementHeader& operator= ( const SInformationElementHeader& );
       
   902     /** Prohibit copy constructor */
       
   903     SInformationElementHeader( const SInformationElementHeader& );
       
   904     } __PACKED; // 2 bytes
       
   905 
       
   906 /**
       
   907 * operator== for SInformationElementHeader
       
   908 * @param aLhs left hand side
       
   909 * @param aRhs right hand side
       
   910 * @return ETrue equal, EFalse not equal
       
   911 */
       
   912 inline TBool operator== ( 
       
   913     const SInformationElementHeader& aLhs, 
       
   914     const SInformationElementHeader& aRhs )
       
   915     {
       
   916     return static_cast<TBool>(( aLhs.iElementID == aRhs.iElementID
       
   917         && aLhs.iLength == aRhs.iLength ));
       
   918     }
       
   919 
       
   920 /**
       
   921 * 802.11 SSID information element
       
   922 */
       
   923 #pragma pack( 1 )
       
   924 struct  SSsIdIE
       
   925     {
       
   926     /** information element header */
       
   927     SInformationElementHeader   iHeader;                    // 2 bytes
       
   928     /** SSID information element */
       
   929     TUint8                      iSsIdIe[KMaxSSIDLength];    // 32 bytes 
       
   930 
       
   931     /**
       
   932     * Ctor
       
   933     */
       
   934     inline SSsIdIE();
       
   935 
       
   936     /**
       
   937     * Ctor
       
   938     * @param aData pointer to SSID
       
   939     * @param aLength length of aData
       
   940     */
       
   941     inline SSsIdIE( const TUint8* aData, TUint8 aLength );
       
   942 
       
   943     /**
       
   944     * Returns information elements length ( the element + its header )
       
   945     * @return see above
       
   946     */
       
   947     TUint8 GetIeLength() const { return static_cast<TUint8>( 
       
   948         (iHeader.iLength + sizeof( SInformationElementHeader ) ) ); }        
       
   949 
       
   950 private:
       
   951 
       
   952     /** Prohibit assignment operator */
       
   953     SSsIdIE& operator= ( const SSsIdIE& );
       
   954     /** Prohibit copy constructor */
       
   955     SSsIdIE( const SSsIdIE& );
       
   956     } __PACKED; // 34 bytes
       
   957 
       
   958 
       
   959 // ---------------------------------------------------------------------------
       
   960 // 
       
   961 // ---------------------------------------------------------------------------
       
   962 //
       
   963 inline SSsIdIE::SSsIdIE() : iHeader( E802Dot11SsidIE ) 
       
   964     {
       
   965     os_memset( iSsIdIe, 0, sizeof( iSsIdIe ) );
       
   966     }
       
   967 
       
   968 // ---------------------------------------------------------------------------
       
   969 // 
       
   970 // ---------------------------------------------------------------------------
       
   971 //
       
   972 inline SSsIdIE::SSsIdIE( const TUint8* aData, TUint8 aLength ) 
       
   973     : iHeader( E802Dot11SsidIE )
       
   974     {
       
   975     iHeader.iLength =  aLength;
       
   976     os_memcpy( &(iSsIdIe[0]), aData, aLength );   
       
   977     }       
       
   978 
       
   979 /**
       
   980 * operator== for SSsIdIE
       
   981 * @param aLhs left hand side
       
   982 * @param aRhs right hand side
       
   983 * @return ETrue equal EFalse not equal
       
   984 */
       
   985 inline TBool operator== (
       
   986     const SSsIdIE& aLhs,
       
   987     const SSsIdIE& aRhs)
       
   988     {
       
   989     return static_cast<TBool>(( ( aLhs.iHeader == aRhs.iHeader )
       
   990         && !(os_memcmp( aLhs.iSsIdIe, aRhs.iSsIdIe, aLhs.iHeader.iLength )) ));
       
   991     }
       
   992 
       
   993 /**
       
   994 * 802.11 supported rates information element
       
   995 */
       
   996 #pragma pack( 1 )
       
   997 struct SSupportedRatesIE
       
   998     {
       
   999     /** information element header */
       
  1000     SInformationElementHeader iHeader;                      // 2
       
  1001     /** 
       
  1002     * supported rates information element
       
  1003     * NOTE! The 802.11 standard specifies that the max length of the 
       
  1004     * information part of this IE is eight rates (eight bytes).
       
  1005     * However at least some APs seem to put all their supported rates
       
  1006     * into this element. In order to be able to associate with those
       
  1007     * APs we allocate enough space to incorporate all 802.11b/g rates
       
  1008     * in this IE. We ourselves will still always advertise max eight 
       
  1009     * rates using this IE (and the rest using the Extended Supported
       
  1010     * Rates IE).
       
  1011     */
       
  1012     TUint8 iSupportedRatesIE[KMaxNumberOfDot11bAndgRates];  // 14
       
  1013 
       
  1014     /**
       
  1015     * Ctor
       
  1016     */
       
  1017     inline SSupportedRatesIE();
       
  1018 
       
  1019     /**
       
  1020     * operator[] to get supported rates element at given index
       
  1021     * @param aIdx index to be get
       
  1022     * @return value in given index
       
  1023     */
       
  1024     inline TUint8 operator[] ( TUint8 aIdx ) const;
       
  1025 
       
  1026     /**
       
  1027     * sets IE data also sets the IE headers length field
       
  1028     * @param aIeData actual IE data
       
  1029     * @param aLength length of aIeData
       
  1030     */
       
  1031     inline void SetIeData( const TUint8* aIeData, const TUint8 aLength);
       
  1032 
       
  1033     /**
       
  1034     * Returns information element's actual length 
       
  1035     * ( element's size + its header )
       
  1036     * @return see above
       
  1037     */
       
  1038     inline TUint8 GetIeLength() const; 
       
  1039 
       
  1040     /**
       
  1041     * Returns only the information element's actual length ( header excluded )
       
  1042     * @return see above
       
  1043     */
       
  1044     inline TUint8 GetElementLength() const; 
       
  1045 
       
  1046     /** Marks IE zero length size */
       
  1047     inline void Clear();
       
  1048 
       
  1049     /**
       
  1050     * Appends a single rate element to IE
       
  1051     * @param aRate rate element to be appended
       
  1052     */
       
  1053     inline void Append( TUint8 aRate );
       
  1054 
       
  1055 private:
       
  1056 
       
  1057     /** Prohibit assignment operator */
       
  1058     SSupportedRatesIE& operator= ( const SSupportedRatesIE& );
       
  1059     /** Prohibit copy constructor */
       
  1060     SSupportedRatesIE( const SSupportedRatesIE& );
       
  1061     } __PACKED; // 16 bytes
       
  1062 
       
  1063 
       
  1064 // ---------------------------------------------------------------------------
       
  1065 // 
       
  1066 // ---------------------------------------------------------------------------
       
  1067 //
       
  1068 inline SSupportedRatesIE::SSupportedRatesIE() 
       
  1069     : iHeader( E802Dot11SupportedRatesIE, KMaxNumberOfRates ) 
       
  1070     {
       
  1071     os_memset( iSupportedRatesIE, 0, sizeof( iSupportedRatesIE ) );
       
  1072     }
       
  1073 
       
  1074 // ---------------------------------------------------------------------------
       
  1075 // 
       
  1076 // ---------------------------------------------------------------------------
       
  1077 //
       
  1078 inline void SSupportedRatesIE::SetIeData( 
       
  1079     const TUint8* aIeData, 
       
  1080     const TUint8 aLength)
       
  1081     {
       
  1082     iHeader.iLength = aLength;
       
  1083     os_memcpy( iSupportedRatesIE, aIeData, aLength );
       
  1084     }
       
  1085 
       
  1086 // ---------------------------------------------------------------------------
       
  1087 // 
       
  1088 // ---------------------------------------------------------------------------
       
  1089 //
       
  1090 inline TUint8 SSupportedRatesIE::operator[] ( TUint8 aIdx ) const
       
  1091     {
       
  1092     return iSupportedRatesIE[aIdx];
       
  1093     }
       
  1094 
       
  1095 // ---------------------------------------------------------------------------
       
  1096 // 
       
  1097 // ---------------------------------------------------------------------------
       
  1098 //
       
  1099 inline TUint8 SSupportedRatesIE::GetIeLength() const 
       
  1100     { 
       
  1101     return static_cast<TUint8>( 
       
  1102         ( iHeader.iLength + sizeof( SInformationElementHeader ) ) ); 
       
  1103     }
       
  1104 
       
  1105 // ---------------------------------------------------------------------------
       
  1106 // 
       
  1107 // ---------------------------------------------------------------------------
       
  1108 //
       
  1109 inline TUint8 SSupportedRatesIE::GetElementLength() const
       
  1110     {
       
  1111     return iHeader.iLength;
       
  1112     }
       
  1113 
       
  1114 // ---------------------------------------------------------------------------
       
  1115 // 
       
  1116 // ---------------------------------------------------------------------------
       
  1117 //
       
  1118 inline void SSupportedRatesIE::Clear()
       
  1119     {
       
  1120     iHeader.iLength = 0;
       
  1121     }
       
  1122 
       
  1123 // ---------------------------------------------------------------------------
       
  1124 // 
       
  1125 // ---------------------------------------------------------------------------
       
  1126 //
       
  1127 inline void SSupportedRatesIE::Append( TUint8 aRate )
       
  1128     {
       
  1129     iSupportedRatesIE[iHeader.iLength] = aRate;
       
  1130     ++(iHeader.iLength);
       
  1131     }
       
  1132 
       
  1133 /**
       
  1134 * operator== for SSupportedRatesIE
       
  1135 * @param aLhs left hand side
       
  1136 * @param aRhs right hand side
       
  1137 * @return ETrue equal, EFalse not equal
       
  1138 */
       
  1139 inline TBool operator== (
       
  1140     const SSupportedRatesIE& aLhs,
       
  1141     const SSupportedRatesIE& aRhs )
       
  1142     {
       
  1143     return static_cast<TBool>(( ( aLhs.iHeader == aRhs.iHeader )
       
  1144         && !(os_memcmp( aLhs.iSupportedRatesIE, 
       
  1145         aRhs.iSupportedRatesIE, aLhs.iHeader.iLength )) ));
       
  1146     }
       
  1147 
       
  1148 /**
       
  1149 * 802.11 extended supported rates information element
       
  1150 */
       
  1151 #pragma pack( 1 )
       
  1152 struct SExtendedSupportedRatesIE
       
  1153     {
       
  1154 	enum { KPad = 1 };
       
  1155     /** information element header */
       
  1156     SInformationElementHeader   iHeader;                                        // 2
       
  1157     /** supported rates information element */
       
  1158     TUint8                      iSupportedRatesIE[KMaxNumberOfExtendedRates];   // 255
       
  1159 	/** padding */
       
  1160 	TUint8						iPad[KPad];				                        // 1
       
  1161 
       
  1162     /**
       
  1163     * Ctor
       
  1164     */
       
  1165     inline SExtendedSupportedRatesIE();
       
  1166 
       
  1167     /**
       
  1168     * operator[] to get supported rates element at given index
       
  1169     * @param aIdx index to be get
       
  1170     * @return value in given index
       
  1171     */
       
  1172     inline TUint8 operator[] ( TUint8 aIdx ) const;
       
  1173 
       
  1174     /**
       
  1175     * Sets IE data and the IE header's length field
       
  1176     * @param aIeData actual IE data
       
  1177     * @param aLength length of aIeData
       
  1178     */
       
  1179     inline void SetIeData( const TUint8* aIeData, const TUint8 aLength);
       
  1180 
       
  1181     /**
       
  1182     * Returns information element's actual length 
       
  1183     * ( element's size + its header )
       
  1184     * @return see above
       
  1185     */
       
  1186     inline TUint8 GetIeLength() const; 
       
  1187 
       
  1188     /**
       
  1189     * Returns only the information element's actual length ( header excluded )
       
  1190     * @return see above
       
  1191     */
       
  1192     inline TUint8 GetElementLength() const; 
       
  1193 
       
  1194     /** Marks IE zero length size */
       
  1195     inline void Clear();
       
  1196 
       
  1197     /**
       
  1198     * Appends a single rate element to IE
       
  1199     * @param aRate rate element to be appended
       
  1200     */
       
  1201     inline void Append( TUint8 aRate );
       
  1202 
       
  1203 private:
       
  1204 
       
  1205     /** Prohibit assignment operator */
       
  1206     SExtendedSupportedRatesIE& operator= ( const SExtendedSupportedRatesIE& );
       
  1207     /** Prohibit copy constructor */
       
  1208     SExtendedSupportedRatesIE( const SExtendedSupportedRatesIE& );
       
  1209     } __PACKED;
       
  1210 
       
  1211 
       
  1212 // ---------------------------------------------------------------------------
       
  1213 // 
       
  1214 // ---------------------------------------------------------------------------
       
  1215 //
       
  1216 inline SExtendedSupportedRatesIE::SExtendedSupportedRatesIE() 
       
  1217         : iHeader( E802Dot11ExtendedRatesIE, KMaxNumberOfExtendedRates ) 
       
  1218     {
       
  1219     os_memset( iSupportedRatesIE, 0, sizeof( iSupportedRatesIE ) );
       
  1220     os_memset( iPad, 0, sizeof( iPad ) );
       
  1221     }
       
  1222 
       
  1223 // ---------------------------------------------------------------------------
       
  1224 // 
       
  1225 // ---------------------------------------------------------------------------
       
  1226 //
       
  1227 inline void SExtendedSupportedRatesIE::SetIeData( 
       
  1228     const TUint8* aIeData, 
       
  1229     const TUint8 aLength)
       
  1230     {
       
  1231     iHeader.iLength = aLength;
       
  1232     os_memcpy( iSupportedRatesIE, aIeData, aLength );
       
  1233     }
       
  1234 
       
  1235 // ---------------------------------------------------------------------------
       
  1236 // 
       
  1237 // ---------------------------------------------------------------------------
       
  1238 //
       
  1239 inline TUint8 SExtendedSupportedRatesIE::operator[] ( TUint8 aIdx ) const
       
  1240     {
       
  1241     return iSupportedRatesIE[aIdx];
       
  1242     }
       
  1243 
       
  1244 // ---------------------------------------------------------------------------
       
  1245 // 
       
  1246 // ---------------------------------------------------------------------------
       
  1247 //
       
  1248 inline TUint8 SExtendedSupportedRatesIE::GetIeLength() const 
       
  1249     { 
       
  1250     return static_cast<TUint8>( 
       
  1251         ( iHeader.iLength + sizeof( SInformationElementHeader ) ) ); 
       
  1252     }
       
  1253 
       
  1254 // ---------------------------------------------------------------------------
       
  1255 // 
       
  1256 // ---------------------------------------------------------------------------
       
  1257 //
       
  1258 inline TUint8 SExtendedSupportedRatesIE::GetElementLength() const
       
  1259     {
       
  1260     return iHeader.iLength;
       
  1261     }
       
  1262 
       
  1263 // ---------------------------------------------------------------------------
       
  1264 // 
       
  1265 // ---------------------------------------------------------------------------
       
  1266 //
       
  1267 inline void SExtendedSupportedRatesIE::Clear()
       
  1268     {
       
  1269     iHeader.iLength = 0;
       
  1270     }
       
  1271 
       
  1272 // ---------------------------------------------------------------------------
       
  1273 // 
       
  1274 // ---------------------------------------------------------------------------
       
  1275 //
       
  1276 inline void SExtendedSupportedRatesIE::Append( TUint8 aRate )
       
  1277     {
       
  1278     iSupportedRatesIE[iHeader.iLength] = aRate;
       
  1279     ++(iHeader.iLength);
       
  1280     }
       
  1281 
       
  1282 /**
       
  1283 * operator== for SExtendedSupportedRatesIE
       
  1284 * @param aLhs left hand side
       
  1285 * @param aRhs right hand side
       
  1286 * @return ETrue equal, EFalse not equal
       
  1287 */
       
  1288 inline TBool operator== (
       
  1289     const SExtendedSupportedRatesIE& aLhs,
       
  1290     const SExtendedSupportedRatesIE& aRhs )
       
  1291     {
       
  1292     return static_cast<TBool>(( ( aLhs.iHeader == aRhs.iHeader )
       
  1293         && !(os_memcmp( aLhs.iSupportedRatesIE, 
       
  1294         aRhs.iSupportedRatesIE, aLhs.iHeader.iLength )) ));
       
  1295     }
       
  1296 
       
  1297 #pragma pack( 1 )
       
  1298 struct SDsParameterSetIE
       
  1299     {
       
  1300     SInformationElementHeader   iHeader;                // 2
       
  1301     TUint8                      iValue;                 // 1                         
       
  1302 
       
  1303     inline SDsParameterSetIE( const TUint32 aValue );
       
  1304 
       
  1305 private:
       
  1306 
       
  1307     /** Prohibit assignment operator */
       
  1308     SDsParameterSetIE& operator= ( const SDsParameterSetIE& aObj );
       
  1309     /** Prohibit copy constructor */
       
  1310     SDsParameterSetIE( const SDsParameterSetIE& );
       
  1311     } __PACKED;     // 3 bytes 
       
  1312 
       
  1313 inline SDsParameterSetIE::SDsParameterSetIE( const TUint32 aValue ) : 
       
  1314     iHeader( E802Dot11DsParameterSetIE, sizeof( iValue ) ),
       
  1315     iValue( aValue )
       
  1316     {    
       
  1317     }
       
  1318 
       
  1319 const TUint K802Dot11DsParameterSetIeDataLen = 
       
  1320     sizeof( SDsParameterSetIE ) - sizeof( SInformationElementHeader );
       
  1321     
       
  1322 
       
  1323 #pragma pack( 1 )
       
  1324 struct SIbssParameterSetIE
       
  1325     {
       
  1326     SInformationElementHeader   iHeader;                // 2
       
  1327     TUint16                     iValue;                 // 2                         
       
  1328 
       
  1329     inline SIbssParameterSetIE( const TUint16 aValue );
       
  1330     
       
  1331     inline TUint16 AtimWindow() const;
       
  1332 
       
  1333 private:
       
  1334 
       
  1335     /** Prohibit default contructor */
       
  1336     SIbssParameterSetIE();
       
  1337     /** Prohibit assignment operator */
       
  1338     SIbssParameterSetIE& operator= ( const SIbssParameterSetIE& aObj );
       
  1339     /** Prohibit copy constructor */
       
  1340     SIbssParameterSetIE( const SIbssParameterSetIE& );
       
  1341     } __PACKED;     // 4 bytes 
       
  1342 
       
  1343 inline SIbssParameterSetIE::SIbssParameterSetIE( const TUint16 aValue ) : 
       
  1344     iHeader( E802Dot11IbssParameterSetIE, sizeof( iValue ) )
       
  1345     {
       
  1346     WriteHtoUint16( &iValue, aValue );
       
  1347     }
       
  1348 
       
  1349 inline TUint16 SIbssParameterSetIE::AtimWindow() const
       
  1350     {
       
  1351     return ( ReadUint16Toh( &iValue ) );
       
  1352     }
       
  1353 
       
  1354 const TUint K802Dot11IbssParameterSetIeDataLen = 
       
  1355     sizeof( SIbssParameterSetIE ) - sizeof( SInformationElementHeader );
       
  1356 
       
  1357 
       
  1358 /**
       
  1359 * Inbound WMM information element without IE header
       
  1360 */
       
  1361 #pragma pack( 1 )
       
  1362 struct SRxWmmIeData
       
  1363     {
       
  1364     TIeOui                      iOui;           // 3
       
  1365     TUint8                      iOuiType;       // 1
       
  1366     TUint8                      iOuiSubType;    // 1
       
  1367     TUint8                      iVersion;       // 1
       
  1368     /** information element */
       
  1369     TUint8                      iQosInfo;       // 1
       
  1370 
       
  1371     /**
       
  1372     * Evaluates if U-APSD bit is up
       
  1373     * @return ETrue if bit is up, otherwise EFalse
       
  1374     */
       
  1375     inline TBool IsUapsdBitSet() const;
       
  1376 
       
  1377     /**
       
  1378     * Gets the the parameter set count
       
  1379     * @return parameter set count
       
  1380     */
       
  1381     inline TUint8 ParameterSetCount() const;
       
  1382 
       
  1383 private:
       
  1384 
       
  1385     /** Prohibit default constructor */
       
  1386     SRxWmmIeData();
       
  1387     /** Prohibit assignment operator */
       
  1388     SRxWmmIeData& operator= ( const SRxWmmIeData& aObj );
       
  1389     /** Prohibit copy constructor */
       
  1390     SRxWmmIeData( const SRxWmmIeData& );
       
  1391     } __PACKED;     // 7 bytes 
       
  1392 
       
  1393 // ---------------------------------------------------------------------------
       
  1394 // 
       
  1395 // ---------------------------------------------------------------------------
       
  1396 //
       
  1397 inline TBool SRxWmmIeData::IsUapsdBitSet() const
       
  1398     {
       
  1399     return ( (iQosInfo & KUapsdQosInfoMask )? ETrue : EFalse );
       
  1400     }
       
  1401 
       
  1402 // ---------------------------------------------------------------------------
       
  1403 // 
       
  1404 // ---------------------------------------------------------------------------
       
  1405 //
       
  1406 inline TUint8 SRxWmmIeData::ParameterSetCount() const
       
  1407     {
       
  1408     return ( iQosInfo & KParamSetCountQosInfoMask );
       
  1409     }
       
  1410 
       
  1411 
       
  1412 /**
       
  1413 * Outbound WMM information element
       
  1414 */
       
  1415 #pragma pack( 1 )
       
  1416 struct STxWmmIE
       
  1417     {
       
  1418     /** information element header */
       
  1419     SInformationElementHeader   iHeader;        // 2
       
  1420     TIeOui                      iOui;           // 3
       
  1421     TUint8                      iOuiType;       // 1
       
  1422     TUint8                      iOuiSubType;    // 1
       
  1423     TUint8                      iVersion;       // 1
       
  1424     /** information element */
       
  1425     TUint8                      iQosInfo;       // 1
       
  1426 
       
  1427 
       
  1428     /**
       
  1429     * Ctor
       
  1430     */
       
  1431     inline STxWmmIE() : iHeader( E802Dot11VendorSpecificIE, KWmmInfoElemLen ),
       
  1432         iOuiType( KWmmElemOuiType ), 
       
  1433         iOuiSubType( KWmmInfoElemOuiSubType ), iVersion( KWmmInfoElemVersion ),
       
  1434         iQosInfo( 0 ) 
       
  1435         { 
       
  1436         os_memcpy( iOui, KWmmElemOui, KIeOuiLength );
       
  1437         }
       
  1438 
       
  1439     /**
       
  1440     * Sets the U-APSD flags for different ACs
       
  1441     * @param aFlags flag(s) to be set
       
  1442     */
       
  1443     inline void SetUapsdFlags( TQosInfoUapsdFlag aFlags );
       
  1444 
       
  1445     /**
       
  1446     * Sets the maximum service period length
       
  1447     * @param aMaxSpLen length of the service period 
       
  1448     */
       
  1449     inline void SetMaxSpLen( TQosInfoUapsdMaxSpLen aMaxSpLen );
       
  1450     
       
  1451     /**
       
  1452     * Returns information elements total length, i.e.
       
  1453     * element's length + header length
       
  1454     * @return see above
       
  1455     */
       
  1456     inline TUint8 GetIeLength() const; 
       
  1457 
       
  1458     /** Clears the IE content, i.e. the iQosInfo field */
       
  1459     inline void Clear();    
       
  1460 
       
  1461 private:
       
  1462 
       
  1463     /** Prohibit assignment operator */
       
  1464     STxWmmIE& operator= ( const STxWmmIE& aObj );
       
  1465     /** Prohibit copy constructor */
       
  1466     STxWmmIE( const STxWmmIE& );
       
  1467     } __PACKED;     // 9 bytes 
       
  1468 
       
  1469 
       
  1470 // ---------------------------------------------------------------------------
       
  1471 // 
       
  1472 // ---------------------------------------------------------------------------
       
  1473 //
       
  1474 inline void STxWmmIE::SetUapsdFlags( TQosInfoUapsdFlag aFlags )
       
  1475     {
       
  1476     iQosInfo |= aFlags;
       
  1477     }
       
  1478 
       
  1479 // ---------------------------------------------------------------------------
       
  1480 // 
       
  1481 // ---------------------------------------------------------------------------
       
  1482 //
       
  1483 inline void STxWmmIE::SetMaxSpLen( TQosInfoUapsdMaxSpLen aMaxSpLen )
       
  1484     {
       
  1485     iQosInfo |= aMaxSpLen;    
       
  1486     }
       
  1487 
       
  1488 // ---------------------------------------------------------------------------
       
  1489 // 
       
  1490 // ---------------------------------------------------------------------------
       
  1491 //
       
  1492 inline TUint8 STxWmmIE::GetIeLength() const
       
  1493     {
       
  1494     return static_cast<TUint8>( 
       
  1495         ( iHeader.iLength + sizeof( SInformationElementHeader ) ) ); 
       
  1496     }
       
  1497 
       
  1498 // ---------------------------------------------------------------------------
       
  1499 // 
       
  1500 // ---------------------------------------------------------------------------
       
  1501 //
       
  1502 inline void STxWmmIE::Clear()
       
  1503     {
       
  1504     iQosInfo = 0;    
       
  1505     }
       
  1506 
       
  1507 /**
       
  1508 * AC parameters record of WMM parameter element
       
  1509 */
       
  1510 #pragma pack( 1 )
       
  1511 struct SAcParamsRecord
       
  1512     {
       
  1513     
       
  1514     TUint8                      iAciAifsn;      // 1
       
  1515     TUint8                      iEcwMinMax;     // 1
       
  1516     TUint16                     iTxOpLimit;     // 2
       
  1517     
       
  1518     inline TWmmAccessCategory AccessCategory() const;
       
  1519 
       
  1520     inline TBool AdmissionControlMandatory() const;
       
  1521     
       
  1522     inline TUint8 Aifsn() const;
       
  1523 
       
  1524     inline TUint16 CwMin() const;
       
  1525     
       
  1526     inline TUint16 CwMax() const;
       
  1527 
       
  1528     inline TUint16 TxOpLimit() const;        
       
  1529     
       
  1530 private:
       
  1531 
       
  1532     /** Prohibit default constructor */
       
  1533     SAcParamsRecord();
       
  1534     /** Prohibit assignment operator */
       
  1535     SAcParamsRecord& operator= ( const SAcParamsRecord& aObj );
       
  1536     /** Prohibit copy constructor */
       
  1537     SAcParamsRecord( const SAcParamsRecord& );
       
  1538     } __PACKED;     // 4 bytes 
       
  1539 
       
  1540 inline TWmmAccessCategory SAcParamsRecord::AccessCategory() const
       
  1541     {
       
  1542     return ( static_cast<TWmmAccessCategory>(iAciAifsn & K802Dot11AccessCategoryMask) );
       
  1543     }
       
  1544 
       
  1545 inline TBool SAcParamsRecord::AdmissionControlMandatory() const
       
  1546     {
       
  1547     return ( iAciAifsn & KWmmAdmissionCtrlMandatoryMask );
       
  1548     }
       
  1549 
       
  1550 inline TUint8 SAcParamsRecord::Aifsn() const
       
  1551     {
       
  1552     return ( iAciAifsn & KWmmAifsnMask );
       
  1553     }
       
  1554 
       
  1555 inline TUint16 SAcParamsRecord::CwMin() const
       
  1556     {
       
  1557     return ( ( static_cast<TUint16>( 1 ) << 
       
  1558              ( iEcwMinMax & KWmmEcwMinMask ) ) - 1 );
       
  1559     }
       
  1560 
       
  1561 inline TUint16 SAcParamsRecord::CwMax() const
       
  1562     {
       
  1563     return ( ( static_cast<TUint16>( 1 ) << 
       
  1564              ( ( iEcwMinMax & KWmmEcwMaxMask ) >> 4 ) ) - 1 );
       
  1565     }
       
  1566 
       
  1567 inline TUint16 SAcParamsRecord::TxOpLimit() const
       
  1568     {
       
  1569     // the TxOpLimit value in the AC parameters record is in units of 32 
       
  1570     // microseconds, but the value we need to return is in microseconds. 
       
  1571     // Hence we need to multiply the nw provided value by 32
       
  1572     const TUint16 KTxOpLimitMultiplier = 32;
       
  1573     
       
  1574     // the value provided by the nw cannot, in practice, be bigger than 
       
  1575     // the value below. However, if the nw still provides a bigger value, we 
       
  1576     // will return the microsecond value corresponding to this value
       
  1577     const TUint16 KTxOpLimitMaxNwValueInPractice = 2047;
       
  1578     
       
  1579     const TUint16 KTxOpLimitNwValue = ReadUint16Toh( &iTxOpLimit );
       
  1580     
       
  1581     return ( KTxOpLimitNwValue <= KTxOpLimitMaxNwValueInPractice ? 
       
  1582                 KTxOpLimitNwValue * KTxOpLimitMultiplier :
       
  1583                 KTxOpLimitMaxNwValueInPractice * KTxOpLimitMultiplier );
       
  1584     }
       
  1585 
       
  1586 /**
       
  1587 * WMM Parameter Element without element header
       
  1588 */
       
  1589 #pragma pack( 1 )
       
  1590 struct SWmmParamElemData
       
  1591     {
       
  1592     /** information element header */
       
  1593     TIeOui                      iOui;                    // 3
       
  1594     TUint8                      iOuiType;                // 1
       
  1595     TUint8                      iOuiSubType;             // 1
       
  1596     TUint8                      iVersion;                // 1
       
  1597     /** information element fields: */
       
  1598     TUint8                      iQosInfo;                // 1
       
  1599     TUint8                      iReserved;               // 1
       
  1600     SAcParamsRecord             iAcParams[KNumOfWmmACs]; // 16
       
  1601 
       
  1602     /**
       
  1603     * Evaluates if U-APSD bit is up
       
  1604     * @return ETrue if bit is up, otherwise EFalse
       
  1605     */
       
  1606     inline TBool IsUapsdBitSet() const;
       
  1607 
       
  1608     /**
       
  1609     * Gets the the parameter set count
       
  1610     * @return parameter set count
       
  1611     */
       
  1612     inline TUint8 ParameterSetCount() const;
       
  1613 
       
  1614 private:
       
  1615 
       
  1616     /** Prohibit default constructor */
       
  1617     SWmmParamElemData();
       
  1618     /** Prohibit assignment operator */
       
  1619     SWmmParamElemData& operator= ( const SWmmParamElemData& aObj );
       
  1620     /** Prohibit copy constructor */
       
  1621     SWmmParamElemData( const SWmmParamElemData& );
       
  1622     } __PACKED;     // 24
       
  1623 
       
  1624 // ---------------------------------------------------------------------------
       
  1625 // 
       
  1626 // ---------------------------------------------------------------------------
       
  1627 //
       
  1628 inline TBool SWmmParamElemData::IsUapsdBitSet() const
       
  1629     {
       
  1630     return ( (iQosInfo & KUapsdQosInfoMask )? ETrue : EFalse );
       
  1631     }
       
  1632 
       
  1633 // ---------------------------------------------------------------------------
       
  1634 // 
       
  1635 // ---------------------------------------------------------------------------
       
  1636 //
       
  1637 inline TUint8 SWmmParamElemData::ParameterSetCount() const
       
  1638     {
       
  1639     return ( iQosInfo & KParamSetCountQosInfoMask );
       
  1640     }
       
  1641 
       
  1642 /**
       
  1643 * HT capabilities element without IE header
       
  1644 */
       
  1645 #pragma pack( 1 )
       
  1646 struct SHtCapabilitiesIeData
       
  1647     {
       
  1648     /** 
       
  1649     * Bit masks for HT capabilities info field
       
  1650     */
       
  1651     enum TCapabilitiesInfoBitMask
       
  1652         {
       
  1653         ELdpcRxMask             = 0x0001,
       
  1654         EFortyMhzOperationMask  = 0x0002,
       
  1655         EGreenfieldFormatMask   = 0x0010,
       
  1656         EShortGiFor20MhzMask    = 0x0020,
       
  1657         EShortGiFor40MhzMask    = 0x0040,
       
  1658         EStbcTxMask             = 0x0080,
       
  1659         EStbcRxMask             = 0x0300,
       
  1660         EDelayedBlockAckMask    = 0x0400,
       
  1661         EDsssCckIn40MhzMask     = 0x1000,
       
  1662         EPsmpMask               = 0x2000,
       
  1663         ELsigTxopProtectionMask = 0x8000
       
  1664         };    
       
  1665 
       
  1666     /** 
       
  1667     * Offsets for HT capabilities info field
       
  1668     */
       
  1669     enum TCapabilitiesInfoOffset
       
  1670         {
       
  1671         EOffsetToStbcRx         = 8
       
  1672         };
       
  1673     
       
  1674     /** 
       
  1675     * Bit masks for SM power save subfield of 
       
  1676     * HT capabilities info field
       
  1677     */
       
  1678     enum TSmPowerSave
       
  1679         {
       
  1680         ESmPowerSaveStatic      = 0x0000,
       
  1681         ESmPowerSaveDynamic     = 0x0004,
       
  1682         ESmPowerSaveDisabled    = 0x000C
       
  1683         };    
       
  1684 
       
  1685     /**
       
  1686     * Bit masks for A-MPDU parameters field
       
  1687     */
       
  1688     enum TAmpduParametersBitMask
       
  1689         {
       
  1690         EMaxAmpduLenExpMask         = 0x03,
       
  1691         EMinMpduStartSpacingMask    = 0x1C
       
  1692         };    
       
  1693 
       
  1694     /** 
       
  1695     * Offsets for A-MPDU parameters field
       
  1696     */
       
  1697     enum TAmpduParametersOffset
       
  1698         {
       
  1699         EOffsetToMinMpduStartSpacing = 2
       
  1700         };
       
  1701 
       
  1702     /** 
       
  1703     * Bit masks for iTxInfo subfield of 
       
  1704     * Supported MCS set field
       
  1705     */
       
  1706     enum TTxInfoMask
       
  1707         {
       
  1708         ETxMcsSetDefinedMask      = 0x01,
       
  1709         ETxRxMcsSetNotEqualMask   = 0x02
       
  1710         };    
       
  1711 
       
  1712     /**
       
  1713     * Bit masks for HT extended capabilities field
       
  1714     */
       
  1715     enum TExtCapabilitiesBitMask
       
  1716         {
       
  1717         EPcoMask                = 0x0001,
       
  1718         EMcsFeedbackMask        = 0x0300,
       
  1719         EHtcMask                = 0x0400,
       
  1720         ERdResponderMask        = 0x0800
       
  1721         };    
       
  1722 
       
  1723     /** HT capabilities info */
       
  1724     TUint16                      iCapabilitiesInfo;     //  2
       
  1725     /** A-MPDU parameters */
       
  1726     TUint8                       iAmpdu;                //  1
       
  1727     /** Supported MCS set */
       
  1728     TUint8                       iRxMcsBitmask[10];     // 10
       
  1729     TUint16                      iRxDataRate;           //  2
       
  1730     TUint8                       iTxInfo;               //  1
       
  1731     TUint8                       iReserved[3];          //  3
       
  1732     /** HT extended capabilities */
       
  1733     TUint16                      iExtCapabilities;      //  2
       
  1734     /** Transmit beamforming capabilities */
       
  1735     TUint32                      iTransBeamfCapa;       //  4
       
  1736     /** ASEL capabilities */
       
  1737     TUint8                       iAsel;                 //  1
       
  1738 
       
  1739     /**
       
  1740     * Constructor
       
  1741     */
       
  1742     inline SHtCapabilitiesIeData();
       
  1743 
       
  1744     /**
       
  1745     * Evaluates if receiving LDPC coded packets is supported
       
  1746     * @return ETrue if supported, EFalse otherwise
       
  1747     */
       
  1748     inline TBool LdpcRx() const;
       
  1749 
       
  1750     /**
       
  1751     * Sets support for receiving LDPC coded packets 
       
  1752     * @param aValue ETrue if supported, EFalse otherwise
       
  1753     */
       
  1754     inline void SetLdpcRx( TBool aValue );
       
  1755 
       
  1756     /**
       
  1757     * Evaluates if 40 MHz operation is supported
       
  1758     * @return ETrue if supported, EFalse otherwise
       
  1759     */
       
  1760     inline TBool FortyMhzOperation() const;
       
  1761 
       
  1762     /**
       
  1763     * Sets support for 40 MHz operation
       
  1764     * @param aValue ETrue if supported, EFalse otherwise
       
  1765     */
       
  1766     inline void SetFortyMhzOperation( TBool aValue );
       
  1767 
       
  1768     /**
       
  1769     * Sets support for SM power save 
       
  1770     * @param aValue ETrue if supported, EFalse otherwise
       
  1771     */
       
  1772     inline void SetSmPowerSave( TSmPowerSave aSmPowerSave );
       
  1773 
       
  1774     /**
       
  1775     * Evaluates if reception of HT Greenfield format PPDUs is supported
       
  1776     * @return ETrue if supported, EFalse otherwise
       
  1777     */
       
  1778     inline TBool GreenfieldFormat() const;
       
  1779 
       
  1780     /**
       
  1781     * Sets support for reception of HT Greenfield format PPDUs
       
  1782     * @param aValue ETrue if supported, EFalse otherwise
       
  1783     */
       
  1784     inline void SetGreenfieldFormat( TBool aValue );
       
  1785 
       
  1786     /**
       
  1787     * Evaluates if short GI reception of 20 Mhz packets is supported
       
  1788     * @return ETrue if supported, EFalse otherwise
       
  1789     */
       
  1790     inline TBool ShortGiFor20Mhz() const;
       
  1791 
       
  1792     /**
       
  1793     * Sets support for short GI reception of 20 Mhz packets
       
  1794     * @param aValue ETrue if supported, EFalse otherwise
       
  1795     */
       
  1796     inline void SetShortGiFor20Mhz( TBool aValue );
       
  1797 
       
  1798     /**
       
  1799     * Evaluates if short GI reception of 40 Mhz packets is supported
       
  1800     * @return ETrue if supported, EFalse otherwise
       
  1801     */
       
  1802     inline TBool ShortGiFor40Mhz() const;
       
  1803 
       
  1804     /**
       
  1805     * Sets support for short GI reception of 40 Mhz packets
       
  1806     * @param aValue ETrue if supported, EFalse otherwise
       
  1807     */
       
  1808     inline void SetShortGiFor40Mhz( TBool aValue );
       
  1809 
       
  1810     /**
       
  1811     * Evaluates if Tx of PPDUs using STBC is supported
       
  1812     * @return ETrue if supported, EFalse otherwise
       
  1813     */
       
  1814     inline TBool StbcTx() const;
       
  1815 
       
  1816     /**
       
  1817     * Sets support for Tx of PPDUs using STBC
       
  1818     * @param aValue ETrue if supported, EFalse otherwise
       
  1819     */
       
  1820     inline void SetStbcTx( TBool aValue );
       
  1821 
       
  1822     /**
       
  1823     * Returns STBC Rx support information
       
  1824     * @return see above
       
  1825     */
       
  1826     inline TUint8 StbcRx() const;
       
  1827 
       
  1828     /**
       
  1829     * Sets STBC Rx support information
       
  1830     * @param aValue STBC Rx
       
  1831     */
       
  1832     inline void SetStbcRx( TUint8 aValue );
       
  1833 
       
  1834     /**
       
  1835     * Evaluates if HT delayed block ack is supported
       
  1836     * @return ETrue if supported, EFalse otherwise
       
  1837     */
       
  1838     inline TBool DelayedBlockAck() const;
       
  1839 
       
  1840     /**
       
  1841     * Sets support for HT delayed block ack
       
  1842     * @param aValue ETrue if supported, EFalse otherwise
       
  1843     */
       
  1844     inline void SetDelayedBlockAck( TBool aValue );
       
  1845 
       
  1846     /**
       
  1847     * Sets max A-MSDU length
       
  1848     * @param aValue 0 for 3839 octets, 1 for 7935 octets 
       
  1849     */
       
  1850     inline void SetMaxAmsduLength( TUint8 aValue );
       
  1851 
       
  1852     /**
       
  1853     * Evaluates if DSSS/CCK in 40 Mhz is supported
       
  1854     * @return ETrue if supported, EFalse otherwise
       
  1855     */
       
  1856     inline TBool DsssCckIn40Mhz() const;
       
  1857 
       
  1858     /**
       
  1859     * Sets support for DSSS/CCK in 40 Mhz
       
  1860     * @param aValue ETrue if supported, EFalse otherwise
       
  1861     */
       
  1862     inline void SetDsssCckIn40Mhz( TBool aValue );
       
  1863 
       
  1864     /**
       
  1865     * Evaluates if PSMP operation is supported
       
  1866     * @return ETrue if supported, EFalse otherwise
       
  1867     */
       
  1868     inline TBool Psmp() const;
       
  1869 
       
  1870     /**
       
  1871     * Sets support for PSMP operation
       
  1872     * @param aValue ETrue if supported, EFalse otherwise
       
  1873     */
       
  1874     inline void SetPsmp( TBool aValue );
       
  1875 
       
  1876     /**
       
  1877     * Evaluates if L-SIG TXOP protection is supported
       
  1878     * @return ETrue if supported, EFalse otherwise
       
  1879     */
       
  1880     inline TBool LsigTxopProtection() const;
       
  1881     
       
  1882     /**
       
  1883     * Sets support for L-SIG TXOP protection
       
  1884     * @param aValue ETrue if supported, EFalse otherwise
       
  1885     */
       
  1886     inline void SetLsigTxopProtection( TBool aValue );
       
  1887 
       
  1888     /**
       
  1889     * Returns max A-MPDU length exponent
       
  1890     * @return see above
       
  1891     */
       
  1892     inline TUint8 MaxAmpduLenExponent() const;
       
  1893 
       
  1894     /**
       
  1895     * Sets max A-MPDU length exponent
       
  1896     * @param aValue ETrue if supported, EFalse otherwise
       
  1897     */
       
  1898     inline void SetMaxAmpduLenExponent( TUint8 aValue );
       
  1899 
       
  1900     /**
       
  1901     * Returns min MPDU start spacing
       
  1902     * @return see above
       
  1903     */
       
  1904     inline TUint8 MinMpduStartSpacing() const;
       
  1905     
       
  1906     /**
       
  1907     * Sets min MPDU start spacing
       
  1908     * @param aValue ETrue if supported, EFalse otherwise
       
  1909     */
       
  1910     inline void SetMinMpduStartSpacing( TUint8 aValue );
       
  1911 
       
  1912     /**
       
  1913     * Sets max supported Rx data rate
       
  1914     * @param aValue ETrue if supported, EFalse otherwise
       
  1915     */
       
  1916     inline void SetMaxRxDataRate( TUint16 aValue );
       
  1917 
       
  1918     /**
       
  1919     * Sets Tx MCS set defined 
       
  1920     * @param aValue ETrue if defined, EFalse otherwise
       
  1921     */
       
  1922     inline void SetTxMcsSetDefined( TBool aValue );
       
  1923 
       
  1924     /**
       
  1925     * Sets Tx Rx MCS set not equal
       
  1926     * @param aValue ETrue if not equal, EFalse otherwise
       
  1927     */
       
  1928     inline void SetTxRxMcsSetNotEqual( TBool aValue );
       
  1929 
       
  1930     /**
       
  1931     * Evaluates if PCO is supported
       
  1932     * @return ETrue if supported, EFalse otherwise
       
  1933     */
       
  1934     inline TBool Pco() const;
       
  1935 
       
  1936     /**
       
  1937     * Sets support for PCO
       
  1938     * @param aValue ETrue if supported, EFalse otherwise
       
  1939     */
       
  1940     inline void SetPco( TBool aValue );
       
  1941 
       
  1942     /**
       
  1943     * Sets PCO transition time
       
  1944     * @param aValue PCO transition time
       
  1945     */
       
  1946     inline void SetPcoTransitionTime( TUint8 aValue );
       
  1947 
       
  1948     /**
       
  1949     * Returns MCS feedback
       
  1950     * @return see above
       
  1951     */
       
  1952     inline TUint8 McsFeedback() const;
       
  1953 
       
  1954     /**
       
  1955     * Sets MCS feedback
       
  1956     * @param see above
       
  1957     */
       
  1958     inline void SetMcsFeedback( TUint8 aValue );
       
  1959 
       
  1960     /**
       
  1961     * Evaluates if +HTC is supported
       
  1962     * @return ETrue if supported, EFalse otherwise
       
  1963     */
       
  1964     inline TBool Htc() const;
       
  1965 
       
  1966     /**
       
  1967     * Sets support for +HTC
       
  1968     * @param aValue ETrue if supported, EFalse otherwise
       
  1969     */
       
  1970     inline void SetHtc( TBool aValue );
       
  1971 
       
  1972     /**
       
  1973     * Evaluates if RD responder is supported
       
  1974     * @return ETrue if supported, EFalse otherwise
       
  1975     */
       
  1976     inline TBool RdResponder() const;
       
  1977 
       
  1978     /**
       
  1979     * Sets support for RD responder
       
  1980     * @param aValue ETrue if supported, EFalse otherwise
       
  1981     */
       
  1982     inline void SetRdResponder( TBool aValue );
       
  1983 
       
  1984     /**
       
  1985     * Returns Transmit beamforming capabilities
       
  1986     * @return see above
       
  1987     */
       
  1988     inline TUint32 TransmitBeamformingCapabilities() const;
       
  1989     
       
  1990     /**
       
  1991     * Returns ASEL capabilities
       
  1992     * @return see above
       
  1993     */
       
  1994     inline TUint8 AselCapabilities() const;
       
  1995 
       
  1996     private:
       
  1997 
       
  1998     /** Prohibit assignment operator */
       
  1999     SHtCapabilitiesIeData& operator= ( const SHtCapabilitiesIeData& aObj );
       
  2000     /** Prohibit copy constructor */
       
  2001     SHtCapabilitiesIeData( const SHtCapabilitiesIeData& aObj );
       
  2002     } __PACKED;     // 26 bytes 
       
  2003 
       
  2004 // ---------------------------------------------------------------------------
       
  2005 // Note that byte order is not an issue when the data members are 
       
  2006 // initialized to zero, which is the case here
       
  2007 // ---------------------------------------------------------------------------
       
  2008 //
       
  2009 inline SHtCapabilitiesIeData::SHtCapabilitiesIeData() :
       
  2010     iAmpdu( 0 ),
       
  2011     iTxInfo( 0 ),
       
  2012     iAsel( 0 )
       
  2013     {
       
  2014     WriteHtoUint16( &iCapabilitiesInfo, 0 );
       
  2015     WriteHtoUint16( &iRxDataRate, 0 );
       
  2016     WriteHtoUint16( &iExtCapabilities, 0 );
       
  2017     WriteHtoUint32( &iTransBeamfCapa, 0 );
       
  2018     os_memset( iRxMcsBitmask, 0, sizeof( iRxMcsBitmask ) );
       
  2019     os_memset( iReserved, 0, sizeof( iReserved ) );
       
  2020     }
       
  2021     
       
  2022 // ---------------------------------------------------------------------------
       
  2023 // 
       
  2024 // ---------------------------------------------------------------------------
       
  2025 //
       
  2026 inline TBool SHtCapabilitiesIeData::LdpcRx() const
       
  2027     {
       
  2028     return ( ( ReadUint16Toh( &iCapabilitiesInfo ) & ELdpcRxMask )
       
  2029              ? ETrue : EFalse );
       
  2030     }
       
  2031 
       
  2032 // ---------------------------------------------------------------------------
       
  2033 // 
       
  2034 // ---------------------------------------------------------------------------
       
  2035 //
       
  2036 inline void SHtCapabilitiesIeData::SetLdpcRx( TBool aValue )
       
  2037     {
       
  2038     if ( aValue )
       
  2039         {
       
  2040         WriteHtoUint16( &iCapabilitiesInfo, 
       
  2041             ReadUint16Toh( &iCapabilitiesInfo ) | 
       
  2042             ELdpcRxMask );
       
  2043         }
       
  2044     else
       
  2045         {
       
  2046         const TUint16 temp ( ReadUint16Toh( &iCapabilitiesInfo ) );
       
  2047         WriteHtoUint16( &iCapabilitiesInfo, temp & ( ~ELdpcRxMask ) );        
       
  2048         }
       
  2049     }
       
  2050 
       
  2051 // ---------------------------------------------------------------------------
       
  2052 // 
       
  2053 // ---------------------------------------------------------------------------
       
  2054 //
       
  2055 inline TBool SHtCapabilitiesIeData::FortyMhzOperation() const
       
  2056     {
       
  2057     return ( ( ReadUint16Toh( &iCapabilitiesInfo ) & EFortyMhzOperationMask )
       
  2058              ? ETrue : EFalse );
       
  2059     }
       
  2060 
       
  2061 // ---------------------------------------------------------------------------
       
  2062 // 
       
  2063 // ---------------------------------------------------------------------------
       
  2064 //
       
  2065 inline void SHtCapabilitiesIeData::SetFortyMhzOperation( TBool aValue )
       
  2066     {
       
  2067     if ( aValue )
       
  2068         {
       
  2069         WriteHtoUint16( &iCapabilitiesInfo, 
       
  2070             ReadUint16Toh( &iCapabilitiesInfo ) | 
       
  2071             EFortyMhzOperationMask );
       
  2072         }
       
  2073     else
       
  2074         {
       
  2075         const TUint16 temp ( ReadUint16Toh( &iCapabilitiesInfo ) );
       
  2076         WriteHtoUint16( 
       
  2077             &iCapabilitiesInfo, 
       
  2078             temp & ( ~EFortyMhzOperationMask ) );        
       
  2079         }
       
  2080     }
       
  2081 
       
  2082 // ---------------------------------------------------------------------------
       
  2083 // 
       
  2084 // ---------------------------------------------------------------------------
       
  2085 //
       
  2086 inline void SHtCapabilitiesIeData::SetSmPowerSave( TSmPowerSave aSmPowerSave )
       
  2087     {
       
  2088     WriteHtoUint16( &iCapabilitiesInfo, 
       
  2089         ReadUint16Toh( &iCapabilitiesInfo ) | 
       
  2090         aSmPowerSave );    
       
  2091     }
       
  2092 
       
  2093 // ---------------------------------------------------------------------------
       
  2094 // 
       
  2095 // ---------------------------------------------------------------------------
       
  2096 //
       
  2097 inline TBool SHtCapabilitiesIeData::GreenfieldFormat() const
       
  2098     {
       
  2099     return ( ( ReadUint16Toh( &iCapabilitiesInfo ) & EGreenfieldFormatMask )
       
  2100              ? ETrue : EFalse );
       
  2101     }
       
  2102 
       
  2103 // ---------------------------------------------------------------------------
       
  2104 // 
       
  2105 // ---------------------------------------------------------------------------
       
  2106 //
       
  2107 inline void SHtCapabilitiesIeData::SetGreenfieldFormat( TBool aValue )
       
  2108     {
       
  2109     if ( aValue )
       
  2110         {
       
  2111         WriteHtoUint16( &iCapabilitiesInfo, 
       
  2112             ReadUint16Toh( &iCapabilitiesInfo ) | 
       
  2113             EGreenfieldFormatMask );
       
  2114         }
       
  2115     else
       
  2116         {
       
  2117         const TUint16 temp ( ReadUint16Toh( &iCapabilitiesInfo ) );
       
  2118         WriteHtoUint16( 
       
  2119             &iCapabilitiesInfo, 
       
  2120             temp & ( ~EGreenfieldFormatMask ) );        
       
  2121         }
       
  2122     }
       
  2123 
       
  2124 // ---------------------------------------------------------------------------
       
  2125 // 
       
  2126 // ---------------------------------------------------------------------------
       
  2127 //
       
  2128 inline TBool SHtCapabilitiesIeData::ShortGiFor20Mhz() const
       
  2129     {
       
  2130     return ( ( ReadUint16Toh( &iCapabilitiesInfo ) & EShortGiFor20MhzMask )
       
  2131              ? ETrue : EFalse );
       
  2132     }
       
  2133 
       
  2134 // ---------------------------------------------------------------------------
       
  2135 // 
       
  2136 // ---------------------------------------------------------------------------
       
  2137 //
       
  2138 inline void SHtCapabilitiesIeData::SetShortGiFor20Mhz( TBool aValue )
       
  2139     {
       
  2140     if ( aValue )
       
  2141         {
       
  2142         WriteHtoUint16( &iCapabilitiesInfo, 
       
  2143             ReadUint16Toh( &iCapabilitiesInfo ) | 
       
  2144             EShortGiFor20MhzMask );
       
  2145         }
       
  2146     else
       
  2147         {
       
  2148         const TUint16 temp ( ReadUint16Toh( &iCapabilitiesInfo ) );
       
  2149         WriteHtoUint16( 
       
  2150             &iCapabilitiesInfo, 
       
  2151             temp & ( ~EShortGiFor20MhzMask ) );        
       
  2152         }
       
  2153     }
       
  2154 
       
  2155 // ---------------------------------------------------------------------------
       
  2156 // 
       
  2157 // ---------------------------------------------------------------------------
       
  2158 //
       
  2159 inline TBool SHtCapabilitiesIeData::ShortGiFor40Mhz() const
       
  2160     {
       
  2161     return ( ( ReadUint16Toh( &iCapabilitiesInfo ) & EShortGiFor40MhzMask )
       
  2162              ? ETrue : EFalse );
       
  2163     }
       
  2164 
       
  2165 // ---------------------------------------------------------------------------
       
  2166 // 
       
  2167 // ---------------------------------------------------------------------------
       
  2168 //
       
  2169 inline void SHtCapabilitiesIeData::SetShortGiFor40Mhz( TBool aValue )
       
  2170     {
       
  2171     if ( aValue )
       
  2172         {
       
  2173         WriteHtoUint16( &iCapabilitiesInfo, 
       
  2174             ReadUint16Toh( &iCapabilitiesInfo ) | 
       
  2175             EShortGiFor40MhzMask );
       
  2176         }
       
  2177     else
       
  2178         {
       
  2179         const TUint16 temp ( ReadUint16Toh( &iCapabilitiesInfo ) );
       
  2180         WriteHtoUint16( 
       
  2181             &iCapabilitiesInfo, 
       
  2182             temp & ( ~EShortGiFor40MhzMask ) );        
       
  2183         }
       
  2184     }
       
  2185 
       
  2186 // ---------------------------------------------------------------------------
       
  2187 // 
       
  2188 // ---------------------------------------------------------------------------
       
  2189 //
       
  2190 inline TBool SHtCapabilitiesIeData::StbcTx() const
       
  2191     {
       
  2192     return ( ( ReadUint16Toh( &iCapabilitiesInfo ) & EStbcTxMask )
       
  2193              ? ETrue : EFalse );
       
  2194     }
       
  2195 
       
  2196 // ---------------------------------------------------------------------------
       
  2197 // 
       
  2198 // ---------------------------------------------------------------------------
       
  2199 //
       
  2200 inline void SHtCapabilitiesIeData::SetStbcTx( TBool aValue )
       
  2201     {
       
  2202     if ( aValue )
       
  2203         {
       
  2204         WriteHtoUint16( &iCapabilitiesInfo, 
       
  2205             ReadUint16Toh( &iCapabilitiesInfo ) | 
       
  2206             EStbcTxMask );
       
  2207         }
       
  2208     else
       
  2209         {
       
  2210         const TUint16 temp ( ReadUint16Toh( &iCapabilitiesInfo ) );
       
  2211         WriteHtoUint16( 
       
  2212             &iCapabilitiesInfo, 
       
  2213             temp & ( ~EStbcTxMask ) );        
       
  2214         }
       
  2215     }
       
  2216 
       
  2217 // ---------------------------------------------------------------------------
       
  2218 // 
       
  2219 // ---------------------------------------------------------------------------
       
  2220 //
       
  2221 inline TUint8 SHtCapabilitiesIeData::StbcRx() const
       
  2222     {
       
  2223     return ( ( ReadUint16Toh( &iCapabilitiesInfo ) & EStbcRxMask ) 
       
  2224              >> EOffsetToStbcRx ); 
       
  2225     }
       
  2226 
       
  2227 // ---------------------------------------------------------------------------
       
  2228 // 
       
  2229 // ---------------------------------------------------------------------------
       
  2230 //
       
  2231 inline void SHtCapabilitiesIeData::SetStbcRx( TUint8 aValue )
       
  2232     {
       
  2233     const TUint16 KnewStbcRx ( aValue << EOffsetToStbcRx );
       
  2234     WriteHtoUint16( &iCapabilitiesInfo, 
       
  2235         ReadUint16Toh( &iCapabilitiesInfo ) | 
       
  2236         KnewStbcRx );    
       
  2237     }
       
  2238 
       
  2239 // ---------------------------------------------------------------------------
       
  2240 // 
       
  2241 // ---------------------------------------------------------------------------
       
  2242 //
       
  2243 inline TBool SHtCapabilitiesIeData::DelayedBlockAck() const
       
  2244     {
       
  2245     return ( ( ReadUint16Toh( &iCapabilitiesInfo ) & EDelayedBlockAckMask )
       
  2246              ? ETrue : EFalse );
       
  2247     }
       
  2248 
       
  2249 // ---------------------------------------------------------------------------
       
  2250 // 
       
  2251 // ---------------------------------------------------------------------------
       
  2252 //
       
  2253 inline void SHtCapabilitiesIeData::SetDelayedBlockAck( TBool aValue )
       
  2254     {
       
  2255     if ( aValue )
       
  2256         {
       
  2257         WriteHtoUint16( &iCapabilitiesInfo, 
       
  2258             ReadUint16Toh( &iCapabilitiesInfo ) | 
       
  2259             EDelayedBlockAckMask );
       
  2260         }
       
  2261     else
       
  2262         {
       
  2263         const TUint16 temp ( ReadUint16Toh( &iCapabilitiesInfo ) );
       
  2264         WriteHtoUint16( 
       
  2265             &iCapabilitiesInfo, 
       
  2266             temp & ( ~EDelayedBlockAckMask ) );        
       
  2267         }
       
  2268     }
       
  2269 
       
  2270 // ---------------------------------------------------------------------------
       
  2271 // 
       
  2272 // ---------------------------------------------------------------------------
       
  2273 //
       
  2274 inline void SHtCapabilitiesIeData::SetMaxAmsduLength( TUint8 aValue )
       
  2275     {
       
  2276     const TUint8 KOffsetToMaxAmsduLength ( 11 );
       
  2277     TUint16 KnewMaxAmsduLength ( aValue << KOffsetToMaxAmsduLength );
       
  2278     WriteHtoUint16( &iCapabilitiesInfo, 
       
  2279         ReadUint16Toh( &iCapabilitiesInfo ) | 
       
  2280         KnewMaxAmsduLength );
       
  2281     }
       
  2282 
       
  2283 // ---------------------------------------------------------------------------
       
  2284 // 
       
  2285 // ---------------------------------------------------------------------------
       
  2286 //
       
  2287 inline TBool SHtCapabilitiesIeData::DsssCckIn40Mhz() const
       
  2288     {
       
  2289     return ( ( ReadUint16Toh( &iCapabilitiesInfo ) & EDsssCckIn40MhzMask )
       
  2290              ? ETrue : EFalse );
       
  2291     }
       
  2292 
       
  2293 // ---------------------------------------------------------------------------
       
  2294 // 
       
  2295 // ---------------------------------------------------------------------------
       
  2296 //
       
  2297 inline void SHtCapabilitiesIeData::SetDsssCckIn40Mhz( TBool aValue )
       
  2298     {
       
  2299     if ( aValue )
       
  2300         {
       
  2301         WriteHtoUint16( &iCapabilitiesInfo, 
       
  2302             ReadUint16Toh( &iCapabilitiesInfo ) | 
       
  2303             EDsssCckIn40MhzMask );
       
  2304         }
       
  2305     else
       
  2306         {
       
  2307         const TUint16 temp ( ReadUint16Toh( &iCapabilitiesInfo ) );
       
  2308         WriteHtoUint16( 
       
  2309             &iCapabilitiesInfo, 
       
  2310             temp & ( ~EDsssCckIn40MhzMask ) );        
       
  2311         }
       
  2312     }
       
  2313 
       
  2314 // ---------------------------------------------------------------------------
       
  2315 // 
       
  2316 // ---------------------------------------------------------------------------
       
  2317 //
       
  2318 inline TBool SHtCapabilitiesIeData::Psmp() const
       
  2319     {
       
  2320     return ( ( ReadUint16Toh( &iCapabilitiesInfo ) & EPsmpMask )
       
  2321              ? ETrue : EFalse );
       
  2322     }
       
  2323 
       
  2324 // ---------------------------------------------------------------------------
       
  2325 // 
       
  2326 // ---------------------------------------------------------------------------
       
  2327 //
       
  2328 inline void SHtCapabilitiesIeData::SetPsmp( TBool aValue )
       
  2329     {
       
  2330     if ( aValue )
       
  2331         {
       
  2332         WriteHtoUint16( &iCapabilitiesInfo, 
       
  2333             ReadUint16Toh( &iCapabilitiesInfo ) | 
       
  2334             EPsmpMask );
       
  2335         }
       
  2336     else
       
  2337         {
       
  2338         const TUint16 temp ( ReadUint16Toh( &iCapabilitiesInfo ) );
       
  2339         WriteHtoUint16( 
       
  2340             &iCapabilitiesInfo, 
       
  2341             temp & ( ~EPsmpMask ) );        
       
  2342         }
       
  2343     }
       
  2344 
       
  2345 // ---------------------------------------------------------------------------
       
  2346 // 
       
  2347 // ---------------------------------------------------------------------------
       
  2348 //
       
  2349 inline TBool SHtCapabilitiesIeData::LsigTxopProtection() const
       
  2350     {
       
  2351     return ( ( ReadUint16Toh( &iCapabilitiesInfo ) & ELsigTxopProtectionMask )
       
  2352              ? ETrue : EFalse );
       
  2353     }
       
  2354 
       
  2355 // ---------------------------------------------------------------------------
       
  2356 // 
       
  2357 // ---------------------------------------------------------------------------
       
  2358 //
       
  2359 inline void SHtCapabilitiesIeData::SetLsigTxopProtection( TBool aValue )
       
  2360     {
       
  2361     if ( aValue )
       
  2362         {
       
  2363         WriteHtoUint16( &iCapabilitiesInfo, 
       
  2364             ReadUint16Toh( &iCapabilitiesInfo ) | 
       
  2365             ELsigTxopProtectionMask );
       
  2366         }
       
  2367     else
       
  2368         {
       
  2369         const TUint16 temp ( ReadUint16Toh( &iCapabilitiesInfo ) );
       
  2370         WriteHtoUint16( 
       
  2371             &iCapabilitiesInfo, 
       
  2372             temp & ( ~ELsigTxopProtectionMask ) );        
       
  2373         }
       
  2374     }
       
  2375 
       
  2376 // ---------------------------------------------------------------------------
       
  2377 // 
       
  2378 // ---------------------------------------------------------------------------
       
  2379 //
       
  2380 inline TUint8 SHtCapabilitiesIeData::MaxAmpduLenExponent() const
       
  2381     {
       
  2382     return iAmpdu & EMaxAmpduLenExpMask;
       
  2383     }
       
  2384 
       
  2385 // ---------------------------------------------------------------------------
       
  2386 // 
       
  2387 // ---------------------------------------------------------------------------
       
  2388 //
       
  2389 inline void SHtCapabilitiesIeData::SetMaxAmpduLenExponent( TUint8 aValue )
       
  2390     {
       
  2391     iAmpdu |= aValue;
       
  2392     }
       
  2393 
       
  2394 // ---------------------------------------------------------------------------
       
  2395 // 
       
  2396 // ---------------------------------------------------------------------------
       
  2397 //
       
  2398 inline TUint8 SHtCapabilitiesIeData::MinMpduStartSpacing() const
       
  2399     {
       
  2400     return ( ( iAmpdu & EMinMpduStartSpacingMask ) 
       
  2401              >> EOffsetToMinMpduStartSpacing );    
       
  2402     }
       
  2403 
       
  2404 // ---------------------------------------------------------------------------
       
  2405 // 
       
  2406 // ---------------------------------------------------------------------------
       
  2407 //
       
  2408 inline void SHtCapabilitiesIeData::SetMinMpduStartSpacing( TUint8 aValue )
       
  2409     {
       
  2410     iAmpdu |= ( aValue << EOffsetToMinMpduStartSpacing );
       
  2411     }
       
  2412 
       
  2413 // ---------------------------------------------------------------------------
       
  2414 // 
       
  2415 // ---------------------------------------------------------------------------
       
  2416 //
       
  2417 inline void SHtCapabilitiesIeData::SetMaxRxDataRate( TUint16 aValue )
       
  2418     {
       
  2419     WriteHtoUint16( &iRxDataRate, aValue );
       
  2420     }
       
  2421 
       
  2422 // ---------------------------------------------------------------------------
       
  2423 // 
       
  2424 // ---------------------------------------------------------------------------
       
  2425 //
       
  2426 inline void SHtCapabilitiesIeData::SetTxMcsSetDefined( TBool aValue )
       
  2427     {
       
  2428     if ( aValue )
       
  2429         {
       
  2430         iTxInfo |= ETxMcsSetDefinedMask;
       
  2431         }
       
  2432     else
       
  2433         {
       
  2434         iTxInfo &= ( ~ETxMcsSetDefinedMask );        
       
  2435         }
       
  2436     }
       
  2437 
       
  2438 // ---------------------------------------------------------------------------
       
  2439 // 
       
  2440 // ---------------------------------------------------------------------------
       
  2441 //
       
  2442 inline void SHtCapabilitiesIeData::SetTxRxMcsSetNotEqual( TBool aValue )
       
  2443     {
       
  2444     if ( aValue )
       
  2445         {
       
  2446         iTxInfo |= ETxRxMcsSetNotEqualMask;
       
  2447         }
       
  2448     else
       
  2449         {
       
  2450         iTxInfo &= ( ~ETxRxMcsSetNotEqualMask );        
       
  2451         }
       
  2452     }
       
  2453 
       
  2454 // ---------------------------------------------------------------------------
       
  2455 // 
       
  2456 // ---------------------------------------------------------------------------
       
  2457 //
       
  2458 inline TBool SHtCapabilitiesIeData::Pco() const
       
  2459     {
       
  2460     return ( ( ReadUint16Toh( &iExtCapabilities ) & EPcoMask )
       
  2461                ? ETrue : EFalse );     
       
  2462     }
       
  2463 
       
  2464 // ---------------------------------------------------------------------------
       
  2465 // 
       
  2466 // ---------------------------------------------------------------------------
       
  2467 //
       
  2468 inline void SHtCapabilitiesIeData::SetPco( TBool aValue )
       
  2469     {
       
  2470     if ( aValue )
       
  2471         {
       
  2472         WriteHtoUint16( &iExtCapabilities, 
       
  2473             ReadUint16Toh( &iExtCapabilities ) | 
       
  2474             EPcoMask );
       
  2475         }
       
  2476     else
       
  2477         {
       
  2478         const TUint16 temp ( ReadUint16Toh( &iExtCapabilities ) );
       
  2479         WriteHtoUint16( &iExtCapabilities, temp & ( ~EPcoMask ) );        
       
  2480         }
       
  2481     }
       
  2482 
       
  2483 // ---------------------------------------------------------------------------
       
  2484 // 
       
  2485 // ---------------------------------------------------------------------------
       
  2486 //
       
  2487 inline void SHtCapabilitiesIeData::SetPcoTransitionTime( TUint8 aValue )
       
  2488     {
       
  2489     const TUint8 KOffsetToPcoTransitionTime ( 1 );
       
  2490     const TUint16 KnewPcoTransitionTime ( 
       
  2491         aValue << KOffsetToPcoTransitionTime );
       
  2492     WriteHtoUint16( &iExtCapabilities, 
       
  2493         ReadUint16Toh( &iExtCapabilities ) | 
       
  2494         KnewPcoTransitionTime );
       
  2495     }
       
  2496 
       
  2497 // ---------------------------------------------------------------------------
       
  2498 // 
       
  2499 // ---------------------------------------------------------------------------
       
  2500 //
       
  2501 inline TUint8 SHtCapabilitiesIeData::McsFeedback() const
       
  2502     {
       
  2503     const TUint8 KOffsetToMcsFeedback ( 8 );
       
  2504     return ( ( ReadUint16Toh( &iExtCapabilities ) & EMcsFeedbackMask ) 
       
  2505              >> KOffsetToMcsFeedback );
       
  2506     }
       
  2507 
       
  2508 // ---------------------------------------------------------------------------
       
  2509 // 
       
  2510 // ---------------------------------------------------------------------------
       
  2511 //
       
  2512 inline void SHtCapabilitiesIeData::SetMcsFeedback( TUint8 aValue )
       
  2513     {
       
  2514     const TUint8 KOffsetToMcsFeedback ( 8 );
       
  2515     const TUint16 KnewMcsFeedback ( aValue << KOffsetToMcsFeedback );
       
  2516     WriteHtoUint16( &iExtCapabilities, 
       
  2517         ReadUint16Toh( &iExtCapabilities ) | 
       
  2518         KnewMcsFeedback );
       
  2519     }
       
  2520 
       
  2521 // ---------------------------------------------------------------------------
       
  2522 // 
       
  2523 // ---------------------------------------------------------------------------
       
  2524 //
       
  2525 inline TBool SHtCapabilitiesIeData::Htc() const
       
  2526     {
       
  2527     return ( ( ReadUint16Toh( &iExtCapabilities ) & EHtcMask )
       
  2528                ? ETrue : EFalse );     
       
  2529     }
       
  2530 
       
  2531 // ---------------------------------------------------------------------------
       
  2532 // 
       
  2533 // ---------------------------------------------------------------------------
       
  2534 //
       
  2535 inline void SHtCapabilitiesIeData::SetHtc( TBool aValue )
       
  2536     {
       
  2537     if ( aValue )
       
  2538         {
       
  2539         WriteHtoUint16( &iExtCapabilities, 
       
  2540             ReadUint16Toh( &iExtCapabilities ) | 
       
  2541             EHtcMask );
       
  2542         }
       
  2543     else
       
  2544         {
       
  2545         const TUint16 temp ( ReadUint16Toh( &iExtCapabilities ) );
       
  2546         WriteHtoUint16( &iExtCapabilities, temp & ( ~EHtcMask ) );        
       
  2547         }
       
  2548     }
       
  2549 
       
  2550 // ---------------------------------------------------------------------------
       
  2551 // 
       
  2552 // ---------------------------------------------------------------------------
       
  2553 //
       
  2554 inline TBool SHtCapabilitiesIeData::RdResponder() const
       
  2555     {
       
  2556     return ( ( ReadUint16Toh( &iExtCapabilities ) & ERdResponderMask )
       
  2557                ? ETrue : EFalse );     
       
  2558     }
       
  2559 
       
  2560 // ---------------------------------------------------------------------------
       
  2561 // 
       
  2562 // ---------------------------------------------------------------------------
       
  2563 //
       
  2564 inline void SHtCapabilitiesIeData::SetRdResponder( TBool aValue )
       
  2565     {
       
  2566     if ( aValue )
       
  2567         {
       
  2568         WriteHtoUint16( &iExtCapabilities, 
       
  2569             ReadUint16Toh( &iExtCapabilities ) | 
       
  2570             ERdResponderMask );
       
  2571         }
       
  2572     else
       
  2573         {
       
  2574         const TUint16 temp ( ReadUint16Toh( &iExtCapabilities ) );
       
  2575         WriteHtoUint16( &iExtCapabilities, temp & ( ~ERdResponderMask ) );        
       
  2576         }
       
  2577     }
       
  2578 
       
  2579 // ---------------------------------------------------------------------------
       
  2580 // 
       
  2581 // ---------------------------------------------------------------------------
       
  2582 //
       
  2583 inline TUint32 SHtCapabilitiesIeData::TransmitBeamformingCapabilities() const
       
  2584     {
       
  2585     return ReadUint32Toh( &iTransBeamfCapa );
       
  2586     }
       
  2587 
       
  2588 // ---------------------------------------------------------------------------
       
  2589 // 
       
  2590 // ---------------------------------------------------------------------------
       
  2591 //
       
  2592 inline TUint8 SHtCapabilitiesIeData::AselCapabilities() const
       
  2593     {
       
  2594     return iAsel;
       
  2595     }
       
  2596 
       
  2597 const TUint K802Dot11HtCapabilitiesIeDataLen = sizeof( SHtCapabilitiesIeData );
       
  2598 
       
  2599 /**
       
  2600 * HT capabilities element
       
  2601 */
       
  2602 #pragma pack( 1 )
       
  2603 struct SHtCapabilitiesIE
       
  2604     {
       
  2605     /** information element header */
       
  2606     SInformationElementHeader   iHeader;        // 2
       
  2607     /** information element data */
       
  2608     SHtCapabilitiesIeData       iData;          // 26
       
  2609 
       
  2610     /**
       
  2611     * Constructor
       
  2612     */
       
  2613     inline SHtCapabilitiesIE() : 
       
  2614         iHeader( E802Dot11HtCapabilitiesIE, sizeof( SHtCapabilitiesIeData ) )
       
  2615         {
       
  2616         }
       
  2617 
       
  2618     /**
       
  2619     * Returns information element's total length, i.e.
       
  2620     * element's length + header length
       
  2621     * @return see above
       
  2622     */
       
  2623     inline TUint8 GetIeLength() const; 
       
  2624 
       
  2625     /**
       
  2626     * Sets IE data and the IE header's length field
       
  2627     * @param aIeData actual IE data
       
  2628     * @param aLength length of aIeData
       
  2629     */    
       
  2630     inline void SetIeData( const TUint8* aIeData, const TUint8 aLength);
       
  2631     
       
  2632 private:
       
  2633 
       
  2634     /** Prohibit assignment operator */
       
  2635     SHtCapabilitiesIE& operator= ( const SHtCapabilitiesIE& aObj );
       
  2636     /** Prohibit copy constructor */
       
  2637     SHtCapabilitiesIE( const SHtCapabilitiesIE& aObj );
       
  2638     } __PACKED;     // 28 bytes
       
  2639 
       
  2640 // ---------------------------------------------------------------------------
       
  2641 // 
       
  2642 // ---------------------------------------------------------------------------
       
  2643 //
       
  2644 inline TUint8 SHtCapabilitiesIE::GetIeLength() const
       
  2645     {
       
  2646     return static_cast<TUint8>( 
       
  2647         ( iHeader.iLength + sizeof( SInformationElementHeader ) ) ); 
       
  2648     }
       
  2649 
       
  2650 // ---------------------------------------------------------------------------
       
  2651 // 
       
  2652 // ---------------------------------------------------------------------------
       
  2653 //
       
  2654 inline void SHtCapabilitiesIE::SetIeData( 
       
  2655     const TUint8* aIeData, 
       
  2656     const TUint8 aLength)
       
  2657     {
       
  2658     iHeader.iLength = aLength;
       
  2659     os_memcpy( reinterpret_cast<TUint8*>(&iData), aIeData, aLength );
       
  2660     }
       
  2661 
       
  2662 /**
       
  2663 * HT Operation element without IE header
       
  2664 */
       
  2665 #pragma pack( 1 )
       
  2666 struct SHtOperationIeData
       
  2667     {
       
  2668     /**
       
  2669     * Bit masks for byte2 field
       
  2670     */
       
  2671     enum TByte2BitMask
       
  2672         {
       
  2673         ESecondaryChOffsetMask      = 0x03,
       
  2674         EChWidthMask                = 0x04,
       
  2675         ERifsModeMask               = 0x08
       
  2676         };    
       
  2677     
       
  2678     /**
       
  2679     * Bit masks for bytes3_4 field
       
  2680     */
       
  2681     enum TBytes3_4BitMask
       
  2682         {
       
  2683         EHtProtectionMask           = 0x0003,
       
  2684         ENonGreenfieldPresentMask   = 0x0004
       
  2685         };    
       
  2686     
       
  2687     /**
       
  2688     * Bit masks for bytes5_6 field
       
  2689     */
       
  2690     enum TBytes5_6BitMask
       
  2691         {
       
  2692         EDualBeaconMask             = 0x0040,
       
  2693         EDualCtsProtectionMask      = 0x0080,
       
  2694         ELsigTxopProtectionMask     = 0x0200,
       
  2695         EPcoActiveMask              = 0x0400
       
  2696         };    
       
  2697 
       
  2698     /** Primary channel */
       
  2699     TUint8                       iPrimaryChannel;       //  1
       
  2700     TUint8                       iByte2;                //  1
       
  2701     TUint16                      iBytes3_4;             //  2
       
  2702     TUint16                      iBytes5_6;             //  2
       
  2703     /** Basic MCS set */
       
  2704     TUint8                       iBasicMcsSet[10];      // 10
       
  2705     TUint8                       iPadding[6];           //  6
       
  2706 
       
  2707     /**
       
  2708     * Constructor
       
  2709     */
       
  2710     inline SHtOperationIeData();
       
  2711 
       
  2712     /**
       
  2713     * Returns secondary channel offset
       
  2714     * @return see above
       
  2715     */
       
  2716     inline TUint8 SecondaryChOffset() const;
       
  2717 
       
  2718     /**
       
  2719     * Returns channel width
       
  2720     * @return see above
       
  2721     */
       
  2722     inline TUint8 ChWidth() const;
       
  2723 
       
  2724     /**
       
  2725     * Evaluates if RIFS mode is supported
       
  2726     * @return ETrue if supported, EFalse otherwise
       
  2727     */
       
  2728     inline TBool RifsMode() const;
       
  2729 
       
  2730     /**
       
  2731     * Returns HT protection mode
       
  2732     * @return see above
       
  2733     */
       
  2734     inline TUint8 HtProtection() const;
       
  2735 
       
  2736     /**
       
  2737     * Evaluates if non-greefield HT STAs are present
       
  2738     * @return ETrue if present, EFalse otherwise
       
  2739     */
       
  2740     inline TBool NonGreenfieldPresent() const;
       
  2741 
       
  2742     /**
       
  2743     * Evaluates if dual beacon is transmitted
       
  2744     * @return ETrue if transmitted, EFalse otherwise
       
  2745     */
       
  2746     inline TBool DualBeacon() const;
       
  2747 
       
  2748     /**
       
  2749     * Evaluates if dual CTS protection is required
       
  2750     * @return ETrue if required, EFalse otherwise
       
  2751     */
       
  2752     inline TBool DualCtsProtection() const;
       
  2753 
       
  2754     /**
       
  2755     * Evaluates if L-SIG TXOP protection is fully supported
       
  2756     * @return ETrue if supported, EFalse otherwise
       
  2757     */
       
  2758     inline TBool LsigTxopProtection() const;
       
  2759     
       
  2760     /**
       
  2761     * Evaluates if PCO is active in the BSS
       
  2762     * @return ETrue if active, EFalse otherwise
       
  2763     */
       
  2764     inline TBool PcoActive() const;
       
  2765 
       
  2766     private:
       
  2767 
       
  2768     /** Prohibit assignment operator */
       
  2769     SHtOperationIeData& operator= ( const SHtOperationIeData& );
       
  2770     /** Prohibit copy constructor */
       
  2771     SHtOperationIeData( const SHtOperationIeData& );
       
  2772     } __PACKED;     // 22 bytes 
       
  2773 
       
  2774 // ---------------------------------------------------------------------------
       
  2775 // Note that byte order is not an issue when the data members are 
       
  2776 // initialized to zero; which is the case here
       
  2777 // ---------------------------------------------------------------------------
       
  2778 //
       
  2779 inline SHtOperationIeData::SHtOperationIeData() :
       
  2780     iPrimaryChannel( 0 ),
       
  2781     iByte2( 0 )
       
  2782     {
       
  2783     WriteHtoUint16( &iBytes3_4, 0 );
       
  2784     WriteHtoUint16( &iBytes5_6, 0 );
       
  2785     os_memset( iBasicMcsSet, 0, sizeof( iBasicMcsSet ) );
       
  2786     os_memset( iPadding, 0, sizeof( iPadding ) );
       
  2787     }
       
  2788     
       
  2789 // ---------------------------------------------------------------------------
       
  2790 // 
       
  2791 // ---------------------------------------------------------------------------
       
  2792 //
       
  2793 inline TUint8 SHtOperationIeData::SecondaryChOffset() const
       
  2794     {
       
  2795     return iByte2 & ESecondaryChOffsetMask;
       
  2796     }
       
  2797 
       
  2798 // ---------------------------------------------------------------------------
       
  2799 // 
       
  2800 // ---------------------------------------------------------------------------
       
  2801 //
       
  2802 inline TUint8 SHtOperationIeData::ChWidth() const
       
  2803     {
       
  2804     const TUint8 KOffsetToChWidth ( 2 );
       
  2805     return ( ( iByte2 & EChWidthMask ) >> KOffsetToChWidth );
       
  2806     }
       
  2807     
       
  2808 // ---------------------------------------------------------------------------
       
  2809 // 
       
  2810 // ---------------------------------------------------------------------------
       
  2811 //
       
  2812 inline TBool SHtOperationIeData::RifsMode() const
       
  2813     {
       
  2814     return ( (iByte2 & ERifsModeMask ) ? ETrue : EFalse );     
       
  2815     }
       
  2816 
       
  2817 // ---------------------------------------------------------------------------
       
  2818 // 
       
  2819 // ---------------------------------------------------------------------------
       
  2820 //
       
  2821 inline TUint8 SHtOperationIeData::HtProtection() const
       
  2822     {
       
  2823     return iBytes3_4 & EHtProtectionMask;
       
  2824     }
       
  2825 
       
  2826 // ---------------------------------------------------------------------------
       
  2827 // 
       
  2828 // ---------------------------------------------------------------------------
       
  2829 //
       
  2830 inline TBool SHtOperationIeData::NonGreenfieldPresent() const
       
  2831     {
       
  2832     return ( ( ReadUint16Toh( &iBytes3_4 ) & ENonGreenfieldPresentMask )
       
  2833              ? ETrue : EFalse );
       
  2834     }
       
  2835 
       
  2836 // ---------------------------------------------------------------------------
       
  2837 // 
       
  2838 // ---------------------------------------------------------------------------
       
  2839 //
       
  2840 inline TBool SHtOperationIeData::DualBeacon() const
       
  2841     {
       
  2842     return ( ( ReadUint16Toh( &iBytes5_6 ) & EDualBeaconMask )
       
  2843              ? ETrue : EFalse );
       
  2844     }
       
  2845 
       
  2846 // ---------------------------------------------------------------------------
       
  2847 // 
       
  2848 // ---------------------------------------------------------------------------
       
  2849 //
       
  2850 inline TBool SHtOperationIeData::DualCtsProtection() const
       
  2851     {
       
  2852     return ( ( ReadUint16Toh( &iBytes5_6 ) & EDualCtsProtectionMask )
       
  2853              ? ETrue : EFalse );
       
  2854     }
       
  2855 
       
  2856 // ---------------------------------------------------------------------------
       
  2857 // 
       
  2858 // ---------------------------------------------------------------------------
       
  2859 //
       
  2860 inline TBool SHtOperationIeData::LsigTxopProtection() const
       
  2861     {
       
  2862     return ( ( ReadUint16Toh( &iBytes5_6 ) & ELsigTxopProtectionMask )
       
  2863              ? ETrue : EFalse );
       
  2864     }
       
  2865 
       
  2866 // ---------------------------------------------------------------------------
       
  2867 // 
       
  2868 // ---------------------------------------------------------------------------
       
  2869 //
       
  2870 inline TBool SHtOperationIeData::PcoActive() const
       
  2871     {
       
  2872     return ( ( ReadUint16Toh( &iBytes5_6 ) & EPcoActiveMask )
       
  2873              ? ETrue : EFalse );
       
  2874     }
       
  2875 
       
  2876 const TUint K802Dot11HtOperationIeDataLen = sizeof( SHtOperationIeData );
       
  2877 
       
  2878 /**
       
  2879 * HT Operation element
       
  2880 */
       
  2881 #pragma pack( 1 )
       
  2882 struct SHtOperationIE
       
  2883     {
       
  2884     /** information element header */
       
  2885     SInformationElementHeader   iHeader;        //  2
       
  2886     /** information element data */
       
  2887     SHtOperationIeData          iData;          // 22
       
  2888 
       
  2889     /**
       
  2890     * Constructor
       
  2891     */
       
  2892     inline SHtOperationIE() : 
       
  2893         iHeader( E802Dot11HtOperationIE, sizeof( SHtOperationIeData ) )
       
  2894         {
       
  2895         }
       
  2896 
       
  2897     /**
       
  2898     * Sets IE data and the IE header's length field
       
  2899     * @param aIeData actual IE data
       
  2900     * @param aLength length of aIeData
       
  2901     */    
       
  2902     inline void SetIeData( const TUint8* aIeData, const TUint8 aLength);
       
  2903     
       
  2904 private:
       
  2905 
       
  2906     /** Prohibit assignment operator */
       
  2907     SHtOperationIE& operator= ( const SHtOperationIE& );
       
  2908     /** Prohibit copy constructor */
       
  2909     SHtOperationIE( const SHtOperationIE& );
       
  2910     } __PACKED;     // 24 bytes
       
  2911 
       
  2912 // ---------------------------------------------------------------------------
       
  2913 // 
       
  2914 // ---------------------------------------------------------------------------
       
  2915 //
       
  2916 inline void SHtOperationIE::SetIeData( 
       
  2917     const TUint8* aIeData, 
       
  2918     const TUint8 aLength)
       
  2919     {
       
  2920     iHeader.iLength = aLength;
       
  2921     os_memcpy( reinterpret_cast<TUint8*>(&iData), aIeData, aLength );
       
  2922     }
       
  2923 
       
  2924 
       
  2925 // capability information fixed-field 
       
  2926 //
       
  2927 // bit 14 - 15     13     11 - 12    10        8-9       7         6                         
       
  2928 //   ----------+-------+-----------+-------+---------+----------+-------
       
  2929 //    reserved | DSSS- | reserved  | short | reserved|  Channel |   PBCC   
       
  2930 //             | OFDM  |           | slot  |         |  Agility |          
       
  2931 //   ----------+-------+-----------+-------+---------+----------+--------
       
  2932 // bit        5           4         3          2          1          0  
       
  2933 //        ----------+----------+----------+----------+----------+----------+
       
  2934 //           Short  |  Privacy |  CF-Poll |   CF     |   IBSS   |    ESS   |
       
  2935 //          Preamble|   (WEP)  |  Request | Pollable |          |          |        
       
  2936 //        ----------+----------+----------+----------+----------+----------+
       
  2937 
       
  2938 /**
       
  2939 * 802.11 management frame body capability information fixed-field
       
  2940 */
       
  2941 #pragma pack( 1 )
       
  2942 struct SCapabilityInformationField
       
  2943     {
       
  2944     enum { KReservedFieldsMask = 0xEB00 };
       
  2945 
       
  2946     /** capability information fixed field */
       
  2947     TUint16 iCapabilityInformationField;
       
  2948 
       
  2949     /**
       
  2950     * Ctor
       
  2951     */
       
  2952     inline SCapabilityInformationField();
       
  2953 
       
  2954     /**
       
  2955     * Ctor
       
  2956     * @param aParam value used in iCapabilityInformationField field
       
  2957     */
       
  2958     explicit inline SCapabilityInformationField( const TUint16 aParam ); 
       
  2959 
       
  2960     /**
       
  2961     * Assignment operator for TUint16 type
       
  2962     * @param aParam value used as iCapabilityInformationField
       
  2963     */
       
  2964     inline SCapabilityInformationField& operator= ( const TUint16 aParam );
       
  2965         
       
  2966     /**
       
  2967     * Returns the value of the Capability Information Field
       
  2968     * @return 
       
  2969     */
       
  2970     inline TUint16 CapabilityInformationField() const;
       
  2971     /**
       
  2972     * Evaluates if ESS bit is up
       
  2973     * @return ETrue if bit is up, otherwise EFalse
       
  2974     */
       
  2975     inline TBool IsEssBitSet() const;
       
  2976     /**
       
  2977     * Evaluates if IBSS bit is up
       
  2978     * @return ETrue if bit is up, otherwise EFalse
       
  2979     */
       
  2980     inline TBool IsIbssBitSet() const;
       
  2981     /**
       
  2982     * Evaluates if Privaecy bit bit is up
       
  2983     * @return ETrue if bit is up, otherwise EFalse
       
  2984     */
       
  2985     inline TBool IsPrivacyBitSet() const;
       
  2986     /**
       
  2987     * Evaluates if Short Preamble bit is up
       
  2988     * @return ETrue if bit is up, otherwise EFalse
       
  2989     */
       
  2990     inline TBool IsShortPreambleBitSet() const;
       
  2991     /**
       
  2992     * Evaluates if PBCC bit is up
       
  2993     * @return ETrue if bit is up, otherwise EFalse
       
  2994     */
       
  2995     inline TBool IsPbccBitSet() const;
       
  2996     /**
       
  2997     * Evaluates if Channel Agility bit is up
       
  2998     * @return ETrue if bit is up, otherwise EFalse
       
  2999     */
       
  3000     inline TBool IsChannelAgilityBitSet() const;
       
  3001     /**
       
  3002     * Evaluates if short slot time bit is up
       
  3003     * @return ETrue if bit is up, otherwise EFalse
       
  3004     */
       
  3005     inline TBool IsShortSlotTimeBitSet() const;
       
  3006     /**
       
  3007     * Clears both CF bits
       
  3008     */
       
  3009     inline void ClearCfFields();    
       
  3010     /**
       
  3011     * Clear CF pollable field
       
  3012     */
       
  3013     inline void ClearCfPollable();    
       
  3014     /**
       
  3015     * Clears both CF poll request field
       
  3016     */
       
  3017     inline void ClearCfPollRequest();    
       
  3018     /**
       
  3019     * Sets the short preamble bit
       
  3020     */
       
  3021     inline void SetShortPreamble();
       
  3022     /**
       
  3023     * Clears the short preamble bit
       
  3024     */
       
  3025     inline void ClearShortPreamble();
       
  3026     /**
       
  3027     * sets the pbcc bit
       
  3028     */
       
  3029     inline void SetPbcc();
       
  3030     /**
       
  3031     * sets the IBSS bit
       
  3032     */
       
  3033     inline void SetIbss();
       
  3034     /**
       
  3035     * Clear PBCC bit
       
  3036     */
       
  3037     inline void ClearPbcc();
       
  3038     /** Clear reserved fields */
       
  3039     inline void ClearReservedFields();
       
  3040     /** Set WEP bit */
       
  3041     inline void SetWepBit();
       
  3042     /** Clear WEP bit */
       
  3043     inline void ClearWepBit();
       
  3044     /** Set RM bit */
       
  3045     inline void SetRMBit();
       
  3046     /** Clear RM bit */
       
  3047     inline void ClearRMBit();
       
  3048 
       
  3049 private:
       
  3050 
       
  3051     /** Prohibit copy constructor */
       
  3052     SCapabilityInformationField( const SCapabilityInformationField& );
       
  3053     } __PACKED; // 2 bytes
       
  3054 
       
  3055 
       
  3056 // ---------------------------------------------------------------------------
       
  3057 // 
       
  3058 // ---------------------------------------------------------------------------
       
  3059 //
       
  3060 inline SCapabilityInformationField::SCapabilityInformationField() 
       
  3061     {
       
  3062     WriteHtoUint16( &iCapabilityInformationField, 0 );
       
  3063     }
       
  3064     
       
  3065 // ---------------------------------------------------------------------------
       
  3066 // 
       
  3067 // ---------------------------------------------------------------------------
       
  3068 //
       
  3069 inline SCapabilityInformationField::SCapabilityInformationField( 
       
  3070     const TUint16 aParam )
       
  3071     {
       
  3072     WriteHtoUint16( &iCapabilityInformationField, aParam );
       
  3073     }
       
  3074 
       
  3075 // ---------------------------------------------------------------------------
       
  3076 // 
       
  3077 // ---------------------------------------------------------------------------
       
  3078 //
       
  3079 inline SCapabilityInformationField& SCapabilityInformationField::operator= (
       
  3080     const TUint16 aParam )
       
  3081     {
       
  3082     WriteHtoUint16( &iCapabilityInformationField, aParam );
       
  3083     return (*this);
       
  3084     }
       
  3085 
       
  3086 // ---------------------------------------------------------
       
  3087 // 
       
  3088 // ---------------------------------------------------------
       
  3089 //
       
  3090 inline TUint16 SCapabilityInformationField::CapabilityInformationField() const
       
  3091     {
       
  3092     return ( ReadUint16Toh( &iCapabilityInformationField ) );
       
  3093     }
       
  3094 
       
  3095 // ---------------------------------------------------------------------------
       
  3096 // 
       
  3097 // ---------------------------------------------------------------------------
       
  3098 //
       
  3099 inline TBool SCapabilityInformationField::IsEssBitSet() const
       
  3100     {
       
  3101     return ( ( ReadUint16Toh( &iCapabilityInformationField ) & 
       
  3102         E802Dot11CapabilityEssMask )
       
  3103         ? ETrue : EFalse );
       
  3104     }
       
  3105 
       
  3106 // ---------------------------------------------------------------------------
       
  3107 // 
       
  3108 // ---------------------------------------------------------------------------
       
  3109 //
       
  3110 inline TBool SCapabilityInformationField::IsIbssBitSet() const
       
  3111     {
       
  3112     return ( ( ReadUint16Toh( &iCapabilityInformationField ) & 
       
  3113         E802Dot11CapabilityIbssMask )
       
  3114         ? ETrue : EFalse );
       
  3115     }
       
  3116 
       
  3117 // ---------------------------------------------------------------------------
       
  3118 // 
       
  3119 // ---------------------------------------------------------------------------
       
  3120 //
       
  3121 inline TBool SCapabilityInformationField::IsPrivacyBitSet() const
       
  3122     {
       
  3123     return ( ( ReadUint16Toh( &iCapabilityInformationField ) & 
       
  3124         E802Dot11CapabilityPrivacyMask )
       
  3125         ? ETrue : EFalse );    
       
  3126     }
       
  3127 
       
  3128 // ---------------------------------------------------------------------------
       
  3129 // 
       
  3130 // ---------------------------------------------------------------------------
       
  3131 //
       
  3132 inline TBool SCapabilityInformationField::IsShortPreambleBitSet() const
       
  3133     {
       
  3134     return ( ( ReadUint16Toh( &iCapabilityInformationField ) & 
       
  3135         E802Dot11ShortPreambleMask )
       
  3136         ? ETrue : EFalse );    
       
  3137     }
       
  3138 
       
  3139 // ---------------------------------------------------------------------------
       
  3140 // 
       
  3141 // ---------------------------------------------------------------------------
       
  3142 //
       
  3143 inline TBool SCapabilityInformationField::IsPbccBitSet() const
       
  3144     {
       
  3145     return ( ( ReadUint16Toh( &iCapabilityInformationField ) & 
       
  3146         E802Dot11PbccMask )
       
  3147         ? ETrue : EFalse );    
       
  3148     }
       
  3149 
       
  3150 // ---------------------------------------------------------------------------
       
  3151 // 
       
  3152 // ---------------------------------------------------------------------------
       
  3153 //
       
  3154 inline TBool SCapabilityInformationField::IsChannelAgilityBitSet() const
       
  3155     {
       
  3156     return ( ( ReadUint16Toh( &iCapabilityInformationField ) & 
       
  3157         E802Dot11ChannelAgilityMask )
       
  3158         ? ETrue : EFalse );    
       
  3159     }
       
  3160 
       
  3161 
       
  3162 // ---------------------------------------------------------------------------
       
  3163 // 
       
  3164 // ---------------------------------------------------------------------------
       
  3165 //
       
  3166 inline TBool SCapabilityInformationField::IsShortSlotTimeBitSet() const
       
  3167     {
       
  3168     return ( ( ReadUint16Toh( &iCapabilityInformationField ) & 
       
  3169         E802Dot11ShortSlotTimeMask )
       
  3170         ? ETrue : EFalse );    
       
  3171     }
       
  3172 
       
  3173 
       
  3174 // ---------------------------------------------------------------------------
       
  3175 // 
       
  3176 // ---------------------------------------------------------------------------
       
  3177 //
       
  3178 inline void SCapabilityInformationField::ClearCfFields()
       
  3179     {
       
  3180     ClearCfPollable();
       
  3181     ClearCfPollRequest();
       
  3182     }
       
  3183 
       
  3184 // ---------------------------------------------------------------------------
       
  3185 // 
       
  3186 // ---------------------------------------------------------------------------
       
  3187 //
       
  3188 inline void SCapabilityInformationField::ClearCfPollable()
       
  3189     {
       
  3190     WriteHtoUint16( &iCapabilityInformationField, 
       
  3191         ReadUint16Toh( &iCapabilityInformationField ) & 
       
  3192         ( ~E802Dot11CapabilityCfPollableMask ) );
       
  3193     }
       
  3194 
       
  3195 // ---------------------------------------------------------------------------
       
  3196 // 
       
  3197 // ---------------------------------------------------------------------------
       
  3198 //
       
  3199 inline void SCapabilityInformationField::ClearCfPollRequest()
       
  3200     {
       
  3201     WriteHtoUint16( &iCapabilityInformationField, 
       
  3202         ReadUint16Toh( &iCapabilityInformationField ) & 
       
  3203         ( ~E802Dot11CapabilityCfPollRequestMask ) );
       
  3204     }
       
  3205 
       
  3206 // ---------------------------------------------------------------------------
       
  3207 // 
       
  3208 // ---------------------------------------------------------------------------
       
  3209 //
       
  3210 inline void SCapabilityInformationField::SetShortPreamble()
       
  3211     {
       
  3212     WriteHtoUint16( &iCapabilityInformationField, 
       
  3213         ReadUint16Toh( &iCapabilityInformationField ) | 
       
  3214         E802Dot11ShortPreambleMask );
       
  3215     }
       
  3216 
       
  3217 // ---------------------------------------------------------------------------
       
  3218 // 
       
  3219 // ---------------------------------------------------------------------------
       
  3220 //
       
  3221 inline void SCapabilityInformationField::SetPbcc()
       
  3222     {
       
  3223     WriteHtoUint16( &iCapabilityInformationField, 
       
  3224         ReadUint16Toh( &iCapabilityInformationField ) | 
       
  3225         E802Dot11PbccMask );
       
  3226     }
       
  3227 
       
  3228 // ---------------------------------------------------------------------------
       
  3229 // 
       
  3230 // ---------------------------------------------------------------------------
       
  3231 //
       
  3232 inline void SCapabilityInformationField::SetIbss()
       
  3233     {
       
  3234     WriteHtoUint16( &iCapabilityInformationField, 
       
  3235         ReadUint16Toh( &iCapabilityInformationField ) | 
       
  3236         E802Dot11CapabilityIbssMask );
       
  3237     }
       
  3238 
       
  3239 // ---------------------------------------------------------------------------
       
  3240 // 
       
  3241 // ---------------------------------------------------------------------------
       
  3242 //
       
  3243 inline void SCapabilityInformationField::ClearShortPreamble()
       
  3244     {
       
  3245     WriteHtoUint16( &iCapabilityInformationField, 
       
  3246         ReadUint16Toh( &iCapabilityInformationField ) & 
       
  3247         ( ~E802Dot11ShortPreambleMask ) );
       
  3248     }
       
  3249 
       
  3250 // ---------------------------------------------------------------------------
       
  3251 // 
       
  3252 // ---------------------------------------------------------------------------
       
  3253 //
       
  3254 inline void SCapabilityInformationField::ClearPbcc()
       
  3255     {
       
  3256     WriteHtoUint16( &iCapabilityInformationField, 
       
  3257         ReadUint16Toh( &iCapabilityInformationField ) & 
       
  3258         ( ~E802Dot11PbccMask ) );
       
  3259     }
       
  3260 
       
  3261 // ---------------------------------------------------------------------------
       
  3262 // 
       
  3263 // ---------------------------------------------------------------------------
       
  3264 //
       
  3265 inline void SCapabilityInformationField::ClearReservedFields()
       
  3266     {
       
  3267     WriteHtoUint16( &iCapabilityInformationField, 
       
  3268         ReadUint16Toh( &iCapabilityInformationField ) & 
       
  3269         ( ~KReservedFieldsMask ) );
       
  3270     }
       
  3271 // ---------------------------------------------------------------------------
       
  3272 // 
       
  3273 // ---------------------------------------------------------------------------
       
  3274 //
       
  3275 inline void SCapabilityInformationField::SetRMBit()
       
  3276     {
       
  3277     WriteHtoUint16( &iCapabilityInformationField, 
       
  3278         ReadUint16Toh( &iCapabilityInformationField ) | 
       
  3279         E802Dot11RadioMeasurementMask );
       
  3280     }
       
  3281 
       
  3282 // ---------------------------------------------------------------------------
       
  3283 // 
       
  3284 // ---------------------------------------------------------------------------
       
  3285 //
       
  3286 inline void SCapabilityInformationField::ClearRMBit()
       
  3287     {
       
  3288     WriteHtoUint16( &iCapabilityInformationField, 
       
  3289         ReadUint16Toh( &iCapabilityInformationField ) & 
       
  3290         ( ~E802Dot11RadioMeasurementMask ) );
       
  3291     }
       
  3292 // ---------------------------------------------------------------------------
       
  3293 // 
       
  3294 // ---------------------------------------------------------------------------
       
  3295 //
       
  3296 inline void SCapabilityInformationField::SetWepBit()
       
  3297     {
       
  3298     WriteHtoUint16( &iCapabilityInformationField, 
       
  3299         ReadUint16Toh( &iCapabilityInformationField ) | 
       
  3300         E802Dot11CapabilityPrivacyMask );
       
  3301     }
       
  3302 
       
  3303 // ---------------------------------------------------------------------------
       
  3304 // 
       
  3305 // ---------------------------------------------------------------------------
       
  3306 //
       
  3307 inline void SCapabilityInformationField::ClearWepBit()
       
  3308     {
       
  3309     WriteHtoUint16( &iCapabilityInformationField, 
       
  3310         ReadUint16Toh( &iCapabilityInformationField ) & 
       
  3311         ( ~E802Dot11CapabilityPrivacyMask ) );
       
  3312     }
       
  3313 
       
  3314 /**
       
  3315 * operator== for SCapabilityInformationField
       
  3316 * @param aLhs left hand side
       
  3317 * @param aRhs right hand side
       
  3318 * @return ETrue equal, EFalse not equal
       
  3319 */
       
  3320 inline TBool operator== ( 
       
  3321     const SCapabilityInformationField& aLhs,
       
  3322     const SCapabilityInformationField& aRhs)
       
  3323     {
       
  3324     return static_cast<TBool>( aLhs.CapabilityInformationField() 
       
  3325         == aRhs.CapabilityInformationField() );
       
  3326     }
       
  3327 
       
  3328 /**
       
  3329 * 802.11 management frame body listen interval fixed-field
       
  3330 */
       
  3331 #pragma pack( 1 )
       
  3332 struct SListenIntervalField
       
  3333     {
       
  3334     /** listen interval fixed field */
       
  3335     TUint16 iListenInterval;
       
  3336     
       
  3337     /**
       
  3338     * Ctor
       
  3339     */
       
  3340     inline SListenIntervalField();
       
  3341 
       
  3342     /**
       
  3343     * Ctor
       
  3344     * @param aParam value used in iListenInterval
       
  3345     */
       
  3346     explicit inline SListenIntervalField( const TUint16 aParam );
       
  3347 
       
  3348     /**
       
  3349     * Returns the value of the Listen Interval
       
  3350     * @return Listen Interval
       
  3351     */
       
  3352     inline TUint16 ListenInterval() const;
       
  3353 
       
  3354     /**
       
  3355     * assignment operator for TUint16 type
       
  3356     * @param aInterval listen interval fixed field
       
  3357     */
       
  3358     inline SListenIntervalField& operator= ( const TUint16 aInterval );           
       
  3359     
       
  3360 private:
       
  3361 
       
  3362     /** Prohibit assignment operator */
       
  3363     SListenIntervalField& operator= ( const SListenIntervalField& );
       
  3364     /** Prohibit copy constructor */
       
  3365     SListenIntervalField( const SListenIntervalField& );
       
  3366     } __PACKED; // 2 bytes
       
  3367 
       
  3368 inline SListenIntervalField::SListenIntervalField()
       
  3369     {
       
  3370     WriteHtoUint16( &iListenInterval, 0 );
       
  3371     }
       
  3372 
       
  3373 inline SListenIntervalField::SListenIntervalField( const TUint16 aParam )
       
  3374     {
       
  3375     WriteHtoUint16( &iListenInterval, aParam );
       
  3376     }
       
  3377 
       
  3378 inline TUint16 SListenIntervalField::ListenInterval() const
       
  3379     {
       
  3380     return ( ReadUint16Toh( &iListenInterval ) );
       
  3381     }
       
  3382 
       
  3383 inline SListenIntervalField& SListenIntervalField::operator= (
       
  3384     const TUint16 aInterval )
       
  3385     {
       
  3386     WriteHtoUint16( &iListenInterval, aInterval );
       
  3387     return (*this);
       
  3388     }
       
  3389 
       
  3390 /**
       
  3391 * operator== for SListenIntervalField
       
  3392 * @param aLhs left hand side
       
  3393 * @param aRhs right hand side
       
  3394 * @return ETrue equal, EFalse not equal
       
  3395 */
       
  3396 inline TBool operator== (
       
  3397     const SListenIntervalField& aLhs,
       
  3398     const SListenIntervalField& aRhs)
       
  3399     {
       
  3400     return static_cast<TBool>( aLhs.ListenInterval() == aRhs.ListenInterval() );
       
  3401     }
       
  3402 
       
  3403 
       
  3404 /*
       
  3405         802.11 DATA Frame
       
  3406        +----------------+
       
  3407        |                |
       
  3408        |  Frame Control |
       
  3409        |    2 bytes     | 
       
  3410        +----------------+
       
  3411        |                |
       
  3412        |  Duration ID   |
       
  3413        |    2 bytes     |        
       
  3414        +----------------+
       
  3415        |                |
       
  3416        |   Address 1    |
       
  3417        |    6 bytes     |
       
  3418        +----------------+
       
  3419        |                |
       
  3420        |   Address 2    |
       
  3421        |    6 bytes     |
       
  3422        +----------------+
       
  3423        |                |
       
  3424        |   Address 3    |
       
  3425        |    6 bytes     |
       
  3426        +----------------+
       
  3427        |                |
       
  3428        | Sequence Cntrl |
       
  3429        |    2 bytes     |
       
  3430        +----------------+
       
  3431        |                |
       
  3432        |   Address 4    |
       
  3433        |    6 bytes     |
       
  3434        +----------------+
       
  3435        |  DSAP - 1 byte | = 0xAA ( SNAP )
       
  3436        +----------------+
       
  3437        |  SSAP - 1 byte | = 0xAA ( SNAP )
       
  3438        +----------------+
       
  3439        |Control - 1 byte| = 0x03 
       
  3440        +----------------+ 
       
  3441        | OUI - 3 bytes  | = 0x0
       
  3442        |                | 
       
  3443        +----------------+
       
  3444        | Type - 2 bytes |  = Ethernet type (IP=0x0800)
       
  3445        +----------------+ 
       
  3446        |                | 
       
  3447        |      Data      |
       
  3448        |                |
       
  3449        ~                ~
       
  3450        ~                ~
       
  3451        |   46 to 1500   |
       
  3452        |     bytes      |
       
  3453        |                |
       
  3454        +----------------+
       
  3455        |      FCS       |
       
  3456        |    4 bytes     |
       
  3457        +----------------+
       
  3458 
       
  3459 */
       
  3460 
       
  3461 // FrameControl field of the 802.11 header
       
  3462 //
       
  3463 // |--------------------- control -----------------------|
       
  3464 //
       
  3465 // bit 15    14     13     12     11     10      9     8  
       
  3466 // +-------+-----+------+-----+-------+------+------+----+
       
  3467 // | Order | WEP | More | Pwr | Retry | More | From | To |
       
  3468 // |       |     | Data | Mgmt|       | Frag | DS   | DS |
       
  3469 // +-------+-----+------+-----+-------+------+------+----+
       
  3470 //    1      1      1     1      1       1      1     1   
       
  3471 //--------- type ------------|
       
  3472 //
       
  3473 //   7-4     3-2      1-0
       
  3474 //---------+------+----------+
       
  3475 // Subtype | Type | Protocol |
       
  3476 //         |      | Version  |
       
  3477 //---------+------+----------+
       
  3478 //    4       2        2
       
  3479 
       
  3480 /**
       
  3481 * 802.11 Frame Control field 
       
  3482 */
       
  3483 #pragma pack( 1 )
       
  3484 struct SFrameControl
       
  3485     {
       
  3486     /** type field */
       
  3487     TUint8 iType;
       
  3488     /** control filed */
       
  3489     TUint8 iControl;
       
  3490 
       
  3491     /**
       
  3492     * Ctor
       
  3493     * @param aType type field
       
  3494     * @param aControl control field
       
  3495     */
       
  3496     SFrameControl( 
       
  3497         T802Dot11FrameControlTypeMask aType, 
       
  3498         T802Dot11FrameControlBitMask aControl ) 
       
  3499         : iType( static_cast<TUint8>(aType) ), 
       
  3500         iControl( static_cast<TUint8>(aControl) ) {};
       
  3501 
       
  3502     /**
       
  3503     * Returns type and control fields combined as a single TUint16 value
       
  3504     * @return see above
       
  3505     */
       
  3506     inline TUint16 operator()() const;
       
  3507 
       
  3508 private:
       
  3509 
       
  3510     /** Prohibit assignment operator */
       
  3511     SFrameControl& operator= ( const SFrameControl& aObj );    
       
  3512     /** Prohibit copy constructor */
       
  3513     SFrameControl( const SFrameControl& );
       
  3514     } __PACKED;
       
  3515 
       
  3516 // ---------------------------------------------------------------------------
       
  3517 // 
       
  3518 // ---------------------------------------------------------------------------
       
  3519 //
       
  3520 inline TUint16 SFrameControl::operator()() const
       
  3521     {
       
  3522     TUint16 value( iType );
       
  3523     return ( static_cast<TUint16>(( value << 8 ) + iControl ));
       
  3524     }
       
  3525 
       
  3526 /**
       
  3527 * operator== for SFrameControl
       
  3528 * @param aLhs left hand side
       
  3529 * @param aRhs right hand side
       
  3530 * @return ETrue equal, EFalse not equal
       
  3531 */
       
  3532 inline TBool operator== (
       
  3533     const SFrameControl& aLhs,
       
  3534     const SFrameControl& aRhs)
       
  3535     {
       
  3536     return static_cast<TBool>( aLhs.iType == aRhs.iType
       
  3537         && aLhs.iControl == aRhs.iControl );
       
  3538     }
       
  3539 
       
  3540 
       
  3541 #pragma pack( 1 )
       
  3542 struct SPsPoll
       
  3543     {
       
  3544     const SFrameControl   iFrameControl;  // 2 bytes
       
  3545     TUint16               iAid;           // 2 bytes
       
  3546     const TMacAddress     iBssId;         // 6 bytes
       
  3547     const TMacAddress     iTa;            // 6 bytes
       
  3548 
       
  3549     inline SPsPoll( 
       
  3550         TUint16 aAid, 
       
  3551         const TMacAddress& aBssId, 
       
  3552         const TMacAddress& aTa );
       
  3553 
       
  3554 private:
       
  3555 
       
  3556     /** Prohibit default contructor */
       
  3557     SPsPoll();
       
  3558     /** Prohibit assignment operator */
       
  3559     SPsPoll& operator= ( const SPsPoll& );
       
  3560     /** Prohibit copy constructor */
       
  3561     SPsPoll( const SPsPoll& );
       
  3562     } __PACKED; // 16 bytes
       
  3563 
       
  3564 
       
  3565 inline SPsPoll::SPsPoll( 
       
  3566     TUint16 aAid, 
       
  3567     const TMacAddress& aBssId, 
       
  3568     const TMacAddress& aTa )
       
  3569     : iFrameControl( E802Dot11FrameTypePowerSavePoll, 
       
  3570     static_cast<T802Dot11FrameControlBitMask>(0) ),
       
  3571     iBssId( aBssId ), iTa( aTa )
       
  3572     {
       
  3573     // AID always has the 2 most significant bits set to 1
       
  3574     WriteHtoUint16( &iAid, ( aAid | 0xC000  ) );
       
  3575     }
       
  3576 
       
  3577     
       
  3578 // SequenceControl field of the 802.11 header
       
  3579 //
       
  3580 // bit      15 - 4         3 - 0
       
  3581 // +-------------------+-----------+
       
  3582 // |  Sequence Number  | Fragment  |
       
  3583 // |                   |  Number   |
       
  3584 // +-------------------+-----------+
       
  3585 //          12              4
       
  3586     
       
  3587 /**
       
  3588 * 802.11 data frame MAC header
       
  3589 */
       
  3590 #pragma pack( 1 )
       
  3591 struct SDataFrameHeader
       
  3592     {
       
  3593     /** frame control field */
       
  3594     SFrameControl   iFrameControl;  // 2 bytes
       
  3595     /** duration field */
       
  3596     TUint16   iDuration;            // 2 bytes
       
  3597     /** address1 field */
       
  3598     TMacAddress     iAddress1;      // 6 bytes    
       
  3599     /** address2 field */
       
  3600     TMacAddress     iAddress2;      // 6 bytes
       
  3601     /** address3 field */
       
  3602     TMacAddress     iAddress3;      // 6 bytes
       
  3603     /** sequence control field */
       
  3604     TUint16   iSeqCtl;              // 2 bytes
       
  3605     // this littly piggy is only used in AP-AP mode 
       
  3606     // which we don't do, so it is omitted
       
  3607     // const TMacAddress iAddress4;      // 6 bytes   
       
  3608     
       
  3609     /**
       
  3610     * Ctor
       
  3611     */ 
       
  3612     inline SDataFrameHeader();
       
  3613 
       
  3614     /**
       
  3615     * Sets WEP bit from Frame Control field
       
  3616     */
       
  3617     inline void SetWepBit();
       
  3618     /**
       
  3619     * Clears WEP bit from Frame Control field
       
  3620     */
       
  3621     inline void ClearWepBit();
       
  3622     /**
       
  3623     * Sets ToDS bit from Frame Control field
       
  3624     */
       
  3625     inline void SetToDsBit();
       
  3626     /**
       
  3627     * Clears ToDS bit from Frame Control field
       
  3628     */
       
  3629     inline void ClearToDsBit();
       
  3630     /**
       
  3631     * Clears FromDS bit from Frame Control field
       
  3632     */
       
  3633     inline void ClearFromDsBit();
       
  3634     /**
       
  3635     * Evaluates is FromDS bit set from Frame Control field
       
  3636     */
       
  3637     inline TBool IsFromDsBitSet() const;
       
  3638     inline TBool IsToDsBitSet() const;
       
  3639     /**
       
  3640     * Evaluates is WEP bit set from Frame Control field
       
  3641     */
       
  3642     inline TBool IsWepBitSet() const;
       
  3643     /**
       
  3644     * Evaluates is Order bit set from Frame Control field
       
  3645     */
       
  3646     inline TBool IsOrderBitSet() const;
       
  3647     /**
       
  3648     * Sets Order bit from Frame Control field
       
  3649     */
       
  3650     inline void SetOrderBit();
       
  3651     /**
       
  3652     * Clears Order bit from Frame Control field
       
  3653     */
       
  3654     inline void ClearOrderBit();
       
  3655 
       
  3656     /**
       
  3657     * Gets Frame Control field
       
  3658     * @return reference to the frame control field
       
  3659     */
       
  3660     inline const SFrameControl& GetFrameControl() const;
       
  3661 
       
  3662     /**
       
  3663     * Returns Sequence Number from iSeqCtl field
       
  3664     * @return Sequence Number
       
  3665     */
       
  3666     inline TUint16 SequenceNumber() const;
       
  3667 
       
  3668 private:
       
  3669 
       
  3670     /** Prohibit assignment operator */
       
  3671     SDataFrameHeader& operator= ( const SDataFrameHeader& aObj );    
       
  3672     /** Prohibit copy constructor */
       
  3673     SDataFrameHeader( const SDataFrameHeader& );
       
  3674     } __PACKED;
       
  3675 
       
  3676 
       
  3677 // ---------------------------------------------------------------------------
       
  3678 // 
       
  3679 // ---------------------------------------------------------------------------
       
  3680 //
       
  3681 inline SDataFrameHeader::SDataFrameHeader() : 
       
  3682     iFrameControl( E802Dot11FrameTypeData, 
       
  3683     static_cast<T802Dot11FrameControlBitMask>(0) ),
       
  3684     iAddress1( KZeroMacAddr ),
       
  3685     iAddress2( KZeroMacAddr ),
       
  3686     iAddress3( KZeroMacAddr )
       
  3687     {
       
  3688     WriteHtoUint16( &iDuration, 0 );
       
  3689     WriteHtoUint16( &iSeqCtl, 0 );
       
  3690     }
       
  3691 
       
  3692 // ---------------------------------------------------------------------------
       
  3693 // 
       
  3694 // ---------------------------------------------------------------------------
       
  3695 //
       
  3696 inline void SDataFrameHeader::SetWepBit()
       
  3697     {
       
  3698     iFrameControl.iControl |= ( E802Dot11FrameControlWepMask >> 8 );
       
  3699     }
       
  3700 
       
  3701 // ---------------------------------------------------------------------------
       
  3702 // 
       
  3703 // ---------------------------------------------------------------------------
       
  3704 //
       
  3705 inline void SDataFrameHeader::ClearWepBit()
       
  3706     {
       
  3707     iFrameControl.iControl &= ~( E802Dot11FrameControlWepMask >> 8 );
       
  3708     }
       
  3709 
       
  3710 // ---------------------------------------------------------------------------
       
  3711 // 
       
  3712 // ---------------------------------------------------------------------------
       
  3713 //
       
  3714 inline void SDataFrameHeader::SetToDsBit()
       
  3715     {
       
  3716     iFrameControl.iControl |= ( E802Dot11FrameControlToDsMask >> 8 );
       
  3717     }
       
  3718 
       
  3719 // ---------------------------------------------------------------------------
       
  3720 // 
       
  3721 // ---------------------------------------------------------------------------
       
  3722 //
       
  3723 inline void SDataFrameHeader::ClearToDsBit()
       
  3724     {
       
  3725     iFrameControl.iControl &= ~( E802Dot11FrameControlToDsMask >> 8 );
       
  3726     }
       
  3727 
       
  3728 // ---------------------------------------------------------------------------
       
  3729 // 
       
  3730 // ---------------------------------------------------------------------------
       
  3731 //
       
  3732 inline void SDataFrameHeader::ClearFromDsBit()
       
  3733     {
       
  3734     iFrameControl.iControl &= ~( E802Dot11FrameControlFromDsMask >> 8 );
       
  3735     }
       
  3736 
       
  3737 // ---------------------------------------------------------------------------
       
  3738 // 
       
  3739 // ---------------------------------------------------------------------------
       
  3740 //
       
  3741 inline TBool SDataFrameHeader::IsFromDsBitSet() const
       
  3742     {
       
  3743     return static_cast<TBool>( iFrameControl.iControl & ( 
       
  3744         E802Dot11FrameControlFromDsMask >> 8 ));
       
  3745     }
       
  3746 
       
  3747 // ---------------------------------------------------------------------------
       
  3748 // 
       
  3749 // ---------------------------------------------------------------------------
       
  3750 //
       
  3751 inline TBool SDataFrameHeader::IsToDsBitSet() const
       
  3752     {
       
  3753     return static_cast<TBool>( iFrameControl.iControl & ( 
       
  3754         E802Dot11FrameControlToDsMask >> 8 ));
       
  3755     }
       
  3756 
       
  3757 // ---------------------------------------------------------------------------
       
  3758 // 
       
  3759 // ---------------------------------------------------------------------------
       
  3760 //
       
  3761 inline TBool SDataFrameHeader::IsWepBitSet() const
       
  3762     {
       
  3763     return static_cast<TBool>( iFrameControl.iControl & ( 
       
  3764         E802Dot11FrameControlWepMask >> 8 ));
       
  3765     }
       
  3766 
       
  3767 // ---------------------------------------------------------------------------
       
  3768 // 
       
  3769 // ---------------------------------------------------------------------------
       
  3770 //
       
  3771 inline TBool SDataFrameHeader::IsOrderBitSet() const
       
  3772     {
       
  3773     return static_cast<TBool>( iFrameControl.iControl & ( 
       
  3774         E802Dot11FrameControlOrderMask >> 8 ));
       
  3775     }
       
  3776 
       
  3777 // ---------------------------------------------------------------------------
       
  3778 // 
       
  3779 // ---------------------------------------------------------------------------
       
  3780 //
       
  3781 inline void SDataFrameHeader::SetOrderBit()
       
  3782     {
       
  3783     iFrameControl.iControl |= ( E802Dot11FrameControlOrderMask >> 8 );
       
  3784     }
       
  3785 
       
  3786 // ---------------------------------------------------------------------------
       
  3787 // 
       
  3788 // ---------------------------------------------------------------------------
       
  3789 //
       
  3790 inline void SDataFrameHeader::ClearOrderBit()
       
  3791     {
       
  3792     iFrameControl.iControl &= ~( E802Dot11FrameControlOrderMask >> 8 );
       
  3793     }
       
  3794 
       
  3795 // ---------------------------------------------------------------------------
       
  3796 // 
       
  3797 // ---------------------------------------------------------------------------
       
  3798 //
       
  3799 inline const SFrameControl& SDataFrameHeader::GetFrameControl() const
       
  3800     {
       
  3801     return iFrameControl;
       
  3802     }
       
  3803 
       
  3804 // ---------------------------------------------------------
       
  3805 //
       
  3806 // ---------------------------------------------------------
       
  3807 //
       
  3808 inline TUint16 SDataFrameHeader::SequenceNumber() const
       
  3809     {
       
  3810     return ( ReadUint16Toh( &iSeqCtl ) >> 4 );    
       
  3811     }
       
  3812 
       
  3813 
       
  3814 typedef SDataFrameHeader SNullDataFrame;
       
  3815 typedef SDataFrameHeader Sdot11MacHeader;
       
  3816 
       
  3817 typedef TUint16 T802Dot11QosControl;
       
  3818 
       
  3819 /**
       
  3820 * Bits 0-2 of the QoS Control field of a QoS Data Frame determine the user 
       
  3821 * priority of the frame. This is a mask for those bits
       
  3822 */
       
  3823 const T802Dot11QosControl KWmmUserPriorityMask = 0x0007;
       
  3824 
       
  3825 /**
       
  3826 * Bit 7 of the QoS Control field of a QoS Data Frame indicates the presence
       
  3827 * of an A-MSDU in the frame (1: present, 0: not present) (IEEE 802.11n/D6.04).
       
  3828 * This is the mask for that bit
       
  3829 */
       
  3830 const T802Dot11QosControl KAmsduPresentMask = 0x0080;
       
  3831 
       
  3832 /**
       
  3833 * 802.11 QoS data frame MAC header
       
  3834 */
       
  3835 #pragma pack( 1 )
       
  3836 struct SQosDataFrameHeader
       
  3837     {
       
  3838     /** 802.11 data frame MAC header */
       
  3839     SDataFrameHeader iHdr;              // 24 bytes
       
  3840     /** QoS control field */
       
  3841     T802Dot11QosControl iQosControl;    // 2 bytes
       
  3842     
       
  3843     /**
       
  3844     * Ctor
       
  3845     */ 
       
  3846     inline SQosDataFrameHeader();
       
  3847 
       
  3848     /**
       
  3849     * Resets the QoS Control field to zero
       
  3850     */
       
  3851     inline void ResetQosControl();
       
  3852 
       
  3853     /**
       
  3854     * Sets the WMM user priority (3 lowest bits) of the QoS Control field
       
  3855     */
       
  3856     inline void SetUserPriority( TUint8 aPriority );
       
  3857 
       
  3858     /**
       
  3859     * Returns the WMM user priority (3 lowest bits) of the QoS Control field
       
  3860     * @return WMM user priority
       
  3861     */
       
  3862     inline TUint8 UserPriority() const;
       
  3863 
       
  3864     /**
       
  3865     * Returns A-MSDU presence
       
  3866     * @return ETrue if A-MSDU is present
       
  3867     *         EFalse otherwise
       
  3868     */
       
  3869     inline TBool AmsduPresent() const;
       
  3870 
       
  3871 private:
       
  3872 
       
  3873     /** Prohibit assignment operator */
       
  3874     SQosDataFrameHeader& operator= ( const SQosDataFrameHeader& );
       
  3875     /** Prohibit copy constructor */
       
  3876     SQosDataFrameHeader( const SQosDataFrameHeader& );
       
  3877     } __PACKED; // 26 bytes
       
  3878 
       
  3879 // ---------------------------------------------------------------------------
       
  3880 // 
       
  3881 // ---------------------------------------------------------------------------
       
  3882 //
       
  3883 inline SQosDataFrameHeader::SQosDataFrameHeader()
       
  3884     {
       
  3885     WriteHtoUint16( &iQosControl, 0 );
       
  3886     }
       
  3887 
       
  3888 // ---------------------------------------------------------------------------
       
  3889 // 
       
  3890 // ---------------------------------------------------------------------------
       
  3891 //
       
  3892 inline void SQosDataFrameHeader::ResetQosControl()
       
  3893     {
       
  3894     WriteHtoUint16( &iQosControl, 0 );
       
  3895     }
       
  3896 
       
  3897 // ---------------------------------------------------------------------------
       
  3898 // 
       
  3899 // ---------------------------------------------------------------------------
       
  3900 //
       
  3901 inline void SQosDataFrameHeader::SetUserPriority( TUint8 aPriority )
       
  3902     {
       
  3903     // clear old priority
       
  3904     WriteHtoUint16( &iQosControl, 
       
  3905         ReadUint16Toh( &iQosControl ) & 
       
  3906         ( ~KWmmUserPriorityMask ) );
       
  3907     // set new priority
       
  3908     WriteHtoUint16( &iQosControl, 
       
  3909         ReadUint16Toh( &iQosControl ) | 
       
  3910         aPriority );
       
  3911     }
       
  3912 
       
  3913 // ---------------------------------------------------------------------------
       
  3914 // 
       
  3915 // ---------------------------------------------------------------------------
       
  3916 //
       
  3917 inline TUint8 SQosDataFrameHeader::UserPriority() const
       
  3918     {
       
  3919     return ( ReadUint16Toh( &iQosControl ) & KWmmUserPriorityMask );
       
  3920     }
       
  3921 
       
  3922 // ---------------------------------------------------------------------------
       
  3923 // 
       
  3924 // ---------------------------------------------------------------------------
       
  3925 //
       
  3926 inline TBool SQosDataFrameHeader::AmsduPresent() const
       
  3927     {
       
  3928     return ( ReadUint16Toh( &iQosControl ) & KAmsduPresentMask );
       
  3929     }
       
  3930 
       
  3931 typedef SQosDataFrameHeader SQosNullDataFrame;
       
  3932 
       
  3933 /**
       
  3934 * 802.11 QoS data frame MAC header with HT Control field
       
  3935 */
       
  3936 #pragma pack( 1 )
       
  3937 struct SHtQosDataFrameHeader
       
  3938     {
       
  3939     /** 802.11 data frame MAC header */
       
  3940     SQosDataFrameHeader iQosDataFrameHdr;   // 26 bytes
       
  3941     /** HT control field */
       
  3942     TUint32 iHtControl;                     // 4 bytes
       
  3943     /**
       
  3944     * Constructor
       
  3945     */ 
       
  3946     inline SHtQosDataFrameHeader();
       
  3947 
       
  3948     /**
       
  3949     * Resets the HT Control field to zero
       
  3950     */
       
  3951     inline void ResetHtControl();
       
  3952     } __PACKED; // 30 bytes
       
  3953 
       
  3954 // ---------------------------------------------------------------------------
       
  3955 // 
       
  3956 // ---------------------------------------------------------------------------
       
  3957 //
       
  3958 inline SHtQosDataFrameHeader::SHtQosDataFrameHeader() 
       
  3959     {
       
  3960     WriteHtoUint32( &iHtControl, 0 );
       
  3961     }
       
  3962 
       
  3963 // ---------------------------------------------------------------------------
       
  3964 // 
       
  3965 // ---------------------------------------------------------------------------
       
  3966 //
       
  3967 inline void SHtQosDataFrameHeader::ResetHtControl()
       
  3968     {
       
  3969     WriteHtoUint32( &iHtControl, 0 );
       
  3970     }
       
  3971 
       
  3972 typedef SHtQosDataFrameHeader SHtQosNullDataFrame;
       
  3973 
       
  3974 /**
       
  3975 * 802.11 A-MSDU subframe header
       
  3976 */
       
  3977 #pragma pack( 1 )
       
  3978 struct SAmsduSubframeHeader
       
  3979     {
       
  3980     /** destination MAC address */
       
  3981     TMacAddress     iDa;                    // 6 bytes
       
  3982     /** source MAC address */
       
  3983     TMacAddress     iSa;                    // 6 bytes
       
  3984     /** length of the MSDU in bytes */
       
  3985     TUint16 iLength;                        // 2 bytes
       
  3986 
       
  3987     /**
       
  3988     * Returns the length of the MSDU in bytes
       
  3989     */
       
  3990     inline TUint16 Length() const;
       
  3991 
       
  3992 private:
       
  3993 
       
  3994     /** Prohibit default contructor */
       
  3995     SAmsduSubframeHeader();
       
  3996     /** Prohibit assignment operator */
       
  3997     SAmsduSubframeHeader& operator= ( const SAmsduSubframeHeader&);
       
  3998     /** Prohibit copy constructor */
       
  3999     SAmsduSubframeHeader( const SAmsduSubframeHeader& );
       
  4000     } __PACKED; // 14 bytes
       
  4001 
       
  4002 // ---------------------------------------------------------------------------
       
  4003 // We need to reverse the byte order as according to IEEE 802.11n/D6.04 
       
  4004 // "The order of these fields and the bits within these fields (#2061) is 
       
  4005 // the same as the IEEE 802.3 frame format", and IEEE 802.3 specifies the 
       
  4006 // byte order of this field to be MSB first. WLAN MAC layer, however, uses 
       
  4007 // LSB first byte order
       
  4008 // ---------------------------------------------------------------------------
       
  4009 //
       
  4010 inline TUint16 SAmsduSubframeHeader::Length() const
       
  4011     {
       
  4012     return ReverseUint16( ReadUint16Toh( &iLength ) );
       
  4013     }
       
  4014 
       
  4015 
       
  4016 /**
       
  4017 * 802.11 management frame MAC header
       
  4018 */
       
  4019 #pragma pack( 1 )
       
  4020 struct SManagementFrameHeader
       
  4021     {
       
  4022     /** frame control field */
       
  4023     SFrameControl   iFrameControl;  // 2 bytes 
       
  4024     /** duration field */
       
  4025     TUint16   iDuration;            // 2 bytes
       
  4026     /** DA address field */
       
  4027     TMacAddress     iDA;            // 6 bytes frames destination = AP   
       
  4028     /** SA address field */
       
  4029     TMacAddress     iSA;            // 6 bytes source address
       
  4030     /** BSSID address field */
       
  4031     TMacAddress     iBSSID;         // 6 bytes BSS identifier = iDA
       
  4032     /** sequence control field */
       
  4033     TUint16   iSeqCtl;              // 2 bytes
       
  4034         
       
  4035     /**
       
  4036     * Ctor 
       
  4037     * @param aTypeMask frame control type mask
       
  4038     * @param aControlMask frame control control mask
       
  4039     */
       
  4040     inline SManagementFrameHeader( 
       
  4041         T802Dot11FrameControlTypeMask aTypeMask, 
       
  4042         T802Dot11FrameControlBitMask aControlMask 
       
  4043         = static_cast<T802Dot11FrameControlBitMask>( 0 ) );
       
  4044 
       
  4045     /**
       
  4046     * Set WEP bit from Frame Control Field
       
  4047     */
       
  4048     inline void SetWepBit();
       
  4049     /**
       
  4050     * Clear WEP bit from Frame Control Field
       
  4051     */
       
  4052     inline void ClearWepBit();
       
  4053     /**
       
  4054     * Sets Order bit from Frame Control field
       
  4055     */
       
  4056     inline void SetOrderBit();
       
  4057 
       
  4058 private:
       
  4059 
       
  4060     /** Prohibit default constructor */
       
  4061     SManagementFrameHeader();
       
  4062     /** Prohibit assignment operator */
       
  4063     SManagementFrameHeader& operator= ( const SManagementFrameHeader& aObj );
       
  4064     /** Prohibit copy constructor */
       
  4065     SManagementFrameHeader( const SManagementFrameHeader& );
       
  4066     } __PACKED;
       
  4067 
       
  4068 
       
  4069 // ---------------------------------------------------------------------------
       
  4070 // 
       
  4071 // ---------------------------------------------------------------------------
       
  4072 //
       
  4073 inline SManagementFrameHeader::SManagementFrameHeader( 
       
  4074     T802Dot11FrameControlTypeMask aTypeMask, 
       
  4075     T802Dot11FrameControlBitMask aControlMask ) : 
       
  4076     iFrameControl( aTypeMask, aControlMask ), 
       
  4077     iDA( KZeroMacAddr ),
       
  4078     iSA( KZeroMacAddr ),
       
  4079     iBSSID( KZeroMacAddr )
       
  4080     {
       
  4081     WriteHtoUint16( &iDuration, 0 );
       
  4082     WriteHtoUint16( &iSeqCtl, 0 );
       
  4083     }
       
  4084 
       
  4085 // ---------------------------------------------------------------------------
       
  4086 // 
       
  4087 // ---------------------------------------------------------------------------
       
  4088 //
       
  4089 inline void SManagementFrameHeader::SetWepBit()
       
  4090     {
       
  4091     iFrameControl.iControl |= ( E802Dot11FrameControlWepMask >> 8 );
       
  4092     }
       
  4093 
       
  4094 // ---------------------------------------------------------------------------
       
  4095 // 
       
  4096 // ---------------------------------------------------------------------------
       
  4097 //
       
  4098 inline void SManagementFrameHeader::ClearWepBit()
       
  4099     {
       
  4100     iFrameControl.iControl &= ~( E802Dot11FrameControlWepMask >> 8 );
       
  4101     }
       
  4102 
       
  4103 // ---------------------------------------------------------------------------
       
  4104 // 
       
  4105 // ---------------------------------------------------------------------------
       
  4106 //
       
  4107 inline void SManagementFrameHeader::SetOrderBit()
       
  4108     {
       
  4109     iFrameControl.iControl |= ( E802Dot11FrameControlOrderMask >> 8 );
       
  4110     }
       
  4111 
       
  4112 
       
  4113 /**
       
  4114 * 802.11 management frame MAC header with HT Control field
       
  4115 */
       
  4116 #pragma pack( 1 )
       
  4117 struct SHtManagementFrameHeader
       
  4118     {
       
  4119     /** 802.11 management frame MAC header */
       
  4120     SManagementFrameHeader  iMgmtFrameHdr;  // 24 bytes
       
  4121     /** HT control field */
       
  4122     TUint32                 iHtControl;     //  4 bytes    
       
  4123 
       
  4124     /**
       
  4125     * Resets the HT Control field to zero
       
  4126     */
       
  4127     inline void ResetHtControl();
       
  4128 
       
  4129 private:
       
  4130 
       
  4131     /** Prohibit default contructor */
       
  4132     SHtManagementFrameHeader();
       
  4133     /** Prohibit assignment operator */
       
  4134     SHtManagementFrameHeader& operator= ( const SHtManagementFrameHeader& );
       
  4135     /** Prohibit copy constructor */
       
  4136     SHtManagementFrameHeader( const SHtManagementFrameHeader& );
       
  4137     } __PACKED; // 28 bytes
       
  4138 
       
  4139 // ---------------------------------------------------------------------------
       
  4140 // 
       
  4141 // ---------------------------------------------------------------------------
       
  4142 //
       
  4143 inline void SHtManagementFrameHeader::ResetHtControl()
       
  4144     {
       
  4145     WriteHtoUint32( &iHtControl, 0 );
       
  4146     }
       
  4147 
       
  4148 
       
  4149 /**
       
  4150 * 802.11 fixed fields of beacon and probe response frames
       
  4151 *
       
  4152 * @since S60 v3.2
       
  4153 */
       
  4154 #pragma pack( 1 )
       
  4155 struct SScanResponseFixedFields
       
  4156     {    
       
  4157     enum { KTimestampLenInWords = 2 };
       
  4158     
       
  4159     /** timestamp fixed field */
       
  4160     TUint32 iTimestamp[KTimestampLenInWords];   // 8 bytes
       
  4161     /** beacon interval fixed field */
       
  4162     TUint16 iBeaconInterval;                    // 2 bytes
       
  4163     /** capability fixed field */
       
  4164     SCapabilityInformationField iCapability;    // 2 bytes
       
  4165     
       
  4166     /**
       
  4167     * Returns the beacon interval
       
  4168     *
       
  4169     * @since S60 3.2
       
  4170     * @return beacon interval
       
  4171     */
       
  4172     inline TUint16 BeaconInterval() const;
       
  4173 
       
  4174 private:
       
  4175 
       
  4176     /** Prohibit default constructor */
       
  4177     SScanResponseFixedFields();
       
  4178     /** Prohibit assignment operator */
       
  4179     SScanResponseFixedFields& operator= ( 
       
  4180         const SScanResponseFixedFields& );    
       
  4181     /** Prohibit copy constructor */
       
  4182     SScanResponseFixedFields( const SScanResponseFixedFields& );
       
  4183     } __PACKED;
       
  4184 
       
  4185 inline TUint16 SScanResponseFixedFields::BeaconInterval() const
       
  4186     {
       
  4187     return ( ReadUint16Toh( &iBeaconInterval ) );
       
  4188     }
       
  4189 
       
  4190 /**
       
  4191 * 802.11 fixed length components required in 
       
  4192 * authentication request management frame
       
  4193 */
       
  4194 #pragma pack( 1 )
       
  4195 struct SAuthenticationFixedFields
       
  4196     {
       
  4197     /** algorithm number */
       
  4198     TUint16   iAlgorithmNumber;     // 2 bytes
       
  4199     /** sequence number */
       
  4200     TUint16   iSequenceNmbr;        // 2 bytes
       
  4201     /** status code */
       
  4202     TUint16   iStatusCode;          // 2 bytes
       
  4203     
       
  4204     /**
       
  4205     * Ctor
       
  4206     * @param aAlgorithm authentication mode used
       
  4207     * @param aSeqNmbr sequence number used
       
  4208     * @param aStatusCode status code used
       
  4209     */
       
  4210     inline SAuthenticationFixedFields( 
       
  4211         const  TUint16 aAlgorithm = K802Dot11AuthModeOpen, 
       
  4212         const TUint16 aSeqNmbr = E802Dot11AuthenticationSeqNmbr1, 
       
  4213         const T802Dot11ManagementStatusCode aStatusCode 
       
  4214         = E802Dot11StatusSuccess );
       
  4215     
       
  4216     /**
       
  4217     * Returns the authentication transaction algorithm number
       
  4218     * @return sequence number
       
  4219     */
       
  4220     inline TUint16 AlgorithmNumber() const;
       
  4221 
       
  4222     /**
       
  4223     * Sets the authentication transaction algorithm number
       
  4224     * @param aSequenceNumber value to be set
       
  4225     */
       
  4226     inline void SetAlgorithmNumber( 
       
  4227         TUint16 aAlgorithmNumber );
       
  4228 
       
  4229     /**
       
  4230     * Returns the authentication transaction sequence number
       
  4231     * @return sequence number
       
  4232     */
       
  4233     inline TUint16 SequenceNumber() const;
       
  4234 
       
  4235     /**
       
  4236     * Sets the authentication transaction sequence number
       
  4237     * @param aSequenceNumber value to be set
       
  4238     */
       
  4239     inline void SetSequenceNumber( TUint16 aSequenceNumber );
       
  4240 
       
  4241     /**
       
  4242     * Returns the authentication transaction status code
       
  4243     * @return status code
       
  4244     */
       
  4245     inline TUint16 StatusCode() const;
       
  4246 
       
  4247     } __PACKED;
       
  4248     
       
  4249 inline SAuthenticationFixedFields::SAuthenticationFixedFields( 
       
  4250     const  TUint16 aAlgorithm, 
       
  4251     const TUint16 aSeqNmbr, 
       
  4252     const T802Dot11ManagementStatusCode aStatusCode )
       
  4253     {
       
  4254     WriteHtoUint16( &iAlgorithmNumber, static_cast<TUint16>( aAlgorithm ) );
       
  4255     WriteHtoUint16( &iSequenceNmbr, static_cast<TUint16>( aSeqNmbr ) );
       
  4256     WriteHtoUint16( &iStatusCode, static_cast<TUint16>( aStatusCode ) );    
       
  4257     }
       
  4258     
       
  4259 inline TUint16 SAuthenticationFixedFields::AlgorithmNumber() const
       
  4260     {
       
  4261     return ( ReadUint16Toh( &iAlgorithmNumber ) );    
       
  4262     }
       
  4263 
       
  4264 inline void SAuthenticationFixedFields::SetAlgorithmNumber( TUint16 aAlgorithmNumber )
       
  4265     {
       
  4266     WriteHtoUint16( &iAlgorithmNumber, aAlgorithmNumber );    
       
  4267     }
       
  4268 
       
  4269 inline TUint16 SAuthenticationFixedFields::SequenceNumber() const
       
  4270     {
       
  4271     return ( ReadUint16Toh( &iSequenceNmbr ) );
       
  4272     }
       
  4273     
       
  4274 inline void SAuthenticationFixedFields::SetSequenceNumber( 
       
  4275     TUint16 aSequenceNumber )
       
  4276     {
       
  4277     WriteHtoUint16( &iSequenceNmbr, aSequenceNumber );
       
  4278     }
       
  4279 
       
  4280 inline TUint16 SAuthenticationFixedFields::StatusCode() const
       
  4281     {
       
  4282     return ( ReadUint16Toh( &iStatusCode ) );
       
  4283     }    
       
  4284     
       
  4285 
       
  4286 /**
       
  4287 * 802.11 authentication management frame
       
  4288 */
       
  4289 #pragma pack( 1 )
       
  4290 struct SAuthenticationFrame
       
  4291     {
       
  4292     /** management frame header */
       
  4293     SManagementFrameHeader      iHeader;                // 24 bytes
       
  4294     /** authentication frame fixed fields */
       
  4295     SAuthenticationFixedFields  iAuthenticationFields;  // 6 bytes
       
  4296 
       
  4297     /** Ctor */
       
  4298     SAuthenticationFrame() 
       
  4299         : iHeader( E802Dot11FrameTypeAuthentication ) {};
       
  4300     
       
  4301     /** Increments sequnece number to next number we shall send */
       
  4302     inline void IncrementSeqNmbr();
       
  4303 
       
  4304     /** Resets sequnece number to initial value */
       
  4305     inline void ResetSeqNmbr();
       
  4306 
       
  4307     /**
       
  4308     * Gets the frames sequence number
       
  4309     * @return frames sequence number
       
  4310     */
       
  4311     inline TUint16 GetSeqNmbr() const;
       
  4312 
       
  4313     /**
       
  4314     * Gets the frames status code field
       
  4315     * @return frames status code field
       
  4316     */
       
  4317     inline TUint16 GetStatusCode() const;
       
  4318 
       
  4319     /**
       
  4320     * Gets the algorithm number 
       
  4321     * @return algorithm number
       
  4322     */
       
  4323     inline TUint16 GetAlgorithmNumber() const;
       
  4324 
       
  4325     /** Sets the WEP bit from frame control field */
       
  4326     inline void SetWepBit();
       
  4327 
       
  4328     /** Clears the WEP bit from frame control field */
       
  4329     inline void ClearWepBit();
       
  4330 
       
  4331     /**
       
  4332     * Sets the the algorithm number field
       
  4333     * @param aAlgorithm algorithm to be used
       
  4334     */
       
  4335     inline void SetAlgorithmNmbr( TUint16 aAlgorithm );
       
  4336 
       
  4337 private:
       
  4338 
       
  4339     /** Prohibit assignment operator */
       
  4340     SAuthenticationFrame& operator= ( const SAuthenticationFrame& );
       
  4341     /** Prohibit copy constructor */
       
  4342     SAuthenticationFrame( const SAuthenticationFrame& );
       
  4343     } __PACKED;
       
  4344 
       
  4345 // ---------------------------------------------------------------------------
       
  4346 // 
       
  4347 // ---------------------------------------------------------------------------
       
  4348 //
       
  4349 inline void SAuthenticationFrame::IncrementSeqNmbr()
       
  4350     {
       
  4351     iAuthenticationFields.SetSequenceNumber( 
       
  4352         iAuthenticationFields.SequenceNumber() + 2 );
       
  4353     }
       
  4354 
       
  4355 // ---------------------------------------------------------------------------
       
  4356 // 
       
  4357 // ---------------------------------------------------------------------------
       
  4358 //
       
  4359 inline void SAuthenticationFrame::ResetSeqNmbr()
       
  4360     {
       
  4361     iAuthenticationFields.SetSequenceNumber( E802Dot11AuthenticationSeqNmbr1 );        
       
  4362     }
       
  4363 
       
  4364 // ---------------------------------------------------------------------------
       
  4365 // 
       
  4366 // ---------------------------------------------------------------------------
       
  4367 //
       
  4368 inline TUint16 SAuthenticationFrame::GetSeqNmbr() const
       
  4369     {
       
  4370     return ( iAuthenticationFields.SequenceNumber() );
       
  4371     }
       
  4372 
       
  4373 // ---------------------------------------------------------------------------
       
  4374 // 
       
  4375 // ---------------------------------------------------------------------------
       
  4376 //
       
  4377 inline TUint16 SAuthenticationFrame::GetStatusCode() const
       
  4378     {
       
  4379     return ( iAuthenticationFields.StatusCode() );    
       
  4380     }
       
  4381 
       
  4382 // ---------------------------------------------------------------------------
       
  4383 // 
       
  4384 // ---------------------------------------------------------------------------
       
  4385 //
       
  4386 inline void SAuthenticationFrame::SetAlgorithmNmbr( 
       
  4387     TUint16 aAlgorithm )
       
  4388     {
       
  4389     iAuthenticationFields.SetAlgorithmNumber( aAlgorithm );
       
  4390     }
       
  4391 
       
  4392 // ---------------------------------------------------------------------------
       
  4393 // 
       
  4394 // ---------------------------------------------------------------------------
       
  4395 //
       
  4396 inline TUint16 SAuthenticationFrame::GetAlgorithmNumber() const
       
  4397     {
       
  4398     return ( iAuthenticationFields.AlgorithmNumber() );        
       
  4399     }
       
  4400 
       
  4401 // ---------------------------------------------------------------------------
       
  4402 // 
       
  4403 // ---------------------------------------------------------------------------
       
  4404 //
       
  4405 inline void SAuthenticationFrame::SetWepBit()
       
  4406     {
       
  4407     iHeader.SetWepBit();
       
  4408     }
       
  4409 
       
  4410 // ---------------------------------------------------------------------------
       
  4411 // 
       
  4412 // ---------------------------------------------------------------------------
       
  4413 //
       
  4414 inline void SAuthenticationFrame::ClearWepBit()
       
  4415     {
       
  4416     iHeader.ClearWepBit();
       
  4417     }
       
  4418 
       
  4419 
       
  4420 /**
       
  4421 * 802.11 authentication management frame with HT Control field
       
  4422 */
       
  4423 #pragma pack( 1 )
       
  4424 struct SHtAuthenticationFrame
       
  4425     {
       
  4426     /** management frame header */
       
  4427     SManagementFrameHeader      iHeader;                // 24 bytes
       
  4428     /** HT control field */
       
  4429     TUint32                     iHtControl;             //  4 bytes    
       
  4430     /** authentication frame fixed fields */
       
  4431     SAuthenticationFixedFields  iAuthenticationFields;  //  6 bytes
       
  4432 
       
  4433     /** Ctor */
       
  4434     SHtAuthenticationFrame() 
       
  4435         : iHeader( E802Dot11FrameTypeAuthentication ) 
       
  4436         {
       
  4437         WriteHtoUint32( &iHtControl, 0 );
       
  4438         // as the HT Control field is present, the order bit needs to be set
       
  4439         iHeader.SetOrderBit();
       
  4440         };
       
  4441     
       
  4442     /** Increments sequnece number to next number we shall send */
       
  4443     inline void IncrementSeqNmbr();
       
  4444 
       
  4445     /** Resets sequnece number to initial value */
       
  4446     inline void ResetSeqNmbr();
       
  4447 
       
  4448     /**
       
  4449     * Gets the frames sequence number
       
  4450     * @return frames sequence number
       
  4451     */
       
  4452     inline TUint16 GetSeqNmbr() const;
       
  4453 
       
  4454     /**
       
  4455     * Gets the frames status code field
       
  4456     * @return frames status code field
       
  4457     */
       
  4458     inline TUint16 GetStatusCode() const;
       
  4459 
       
  4460     /**
       
  4461     * Gets the algorithm number 
       
  4462     * @return algorithm number
       
  4463     */
       
  4464     inline TUint16 GetAlgorithmNumber() const;
       
  4465 
       
  4466     /** Sets the WEP bit from frame control field */
       
  4467     inline void SetWepBit();
       
  4468 
       
  4469     /** Clears the WEP bit from frame control field */
       
  4470     inline void ClearWepBit();
       
  4471 
       
  4472     /**
       
  4473     * Sets the the algorithm number field
       
  4474     * @param aAlgorithm algorithm to be used
       
  4475     */
       
  4476     inline void SetAlgorithmNmbr( TUint16 aAlgorithm );
       
  4477 
       
  4478 private:
       
  4479 
       
  4480     /** Prohibit assignment operator */
       
  4481     SHtAuthenticationFrame& operator= ( const SHtAuthenticationFrame& );
       
  4482     /** Prohibit copy constructor */
       
  4483     SHtAuthenticationFrame( const SHtAuthenticationFrame& );
       
  4484     } __PACKED;
       
  4485 
       
  4486 // ---------------------------------------------------------------------------
       
  4487 // 
       
  4488 // ---------------------------------------------------------------------------
       
  4489 //
       
  4490 inline void SHtAuthenticationFrame::IncrementSeqNmbr()
       
  4491     {
       
  4492     iAuthenticationFields.SetSequenceNumber( 
       
  4493         iAuthenticationFields.SequenceNumber() + 2 );
       
  4494     }
       
  4495 
       
  4496 // ---------------------------------------------------------------------------
       
  4497 // 
       
  4498 // ---------------------------------------------------------------------------
       
  4499 //
       
  4500 inline void SHtAuthenticationFrame::ResetSeqNmbr()
       
  4501     {
       
  4502     iAuthenticationFields.SetSequenceNumber( E802Dot11AuthenticationSeqNmbr1 );        
       
  4503     }
       
  4504 
       
  4505 // ---------------------------------------------------------------------------
       
  4506 // 
       
  4507 // ---------------------------------------------------------------------------
       
  4508 //
       
  4509 inline TUint16 SHtAuthenticationFrame::GetSeqNmbr() const
       
  4510     {
       
  4511     return ( iAuthenticationFields.SequenceNumber() );
       
  4512     }
       
  4513 
       
  4514 // ---------------------------------------------------------------------------
       
  4515 // 
       
  4516 // ---------------------------------------------------------------------------
       
  4517 //
       
  4518 inline TUint16 SHtAuthenticationFrame::GetStatusCode() const
       
  4519     {
       
  4520     return ( iAuthenticationFields.StatusCode() );    
       
  4521     }
       
  4522 
       
  4523 // ---------------------------------------------------------------------------
       
  4524 // 
       
  4525 // ---------------------------------------------------------------------------
       
  4526 //
       
  4527 inline void SHtAuthenticationFrame::SetAlgorithmNmbr( 
       
  4528     TUint16 aAlgorithm )
       
  4529     {
       
  4530     iAuthenticationFields.SetAlgorithmNumber( aAlgorithm );
       
  4531     }
       
  4532 
       
  4533 // ---------------------------------------------------------------------------
       
  4534 // 
       
  4535 // ---------------------------------------------------------------------------
       
  4536 //
       
  4537 inline TUint16 SHtAuthenticationFrame::GetAlgorithmNumber() const
       
  4538     {
       
  4539     return ( iAuthenticationFields.AlgorithmNumber() );        
       
  4540     }
       
  4541 
       
  4542 // ---------------------------------------------------------------------------
       
  4543 // 
       
  4544 // ---------------------------------------------------------------------------
       
  4545 //
       
  4546 inline void SHtAuthenticationFrame::SetWepBit()
       
  4547     {
       
  4548     iHeader.SetWepBit();
       
  4549     }
       
  4550 
       
  4551 // ---------------------------------------------------------------------------
       
  4552 // 
       
  4553 // ---------------------------------------------------------------------------
       
  4554 //
       
  4555 inline void SHtAuthenticationFrame::ClearWepBit()
       
  4556     {
       
  4557     iHeader.ClearWepBit();
       
  4558     }
       
  4559 
       
  4560 
       
  4561 /**
       
  4562 * 802.11 fixed length components required 
       
  4563 * in association request management frame
       
  4564 */
       
  4565 #pragma pack( 1 )
       
  4566 struct SAssociationRequestFixedFields
       
  4567     {
       
  4568     /** capability info fixed field */
       
  4569     SCapabilityInformationField iCapabilityInfo;    // 2 bytes
       
  4570     /** listeninterval fixed field */
       
  4571     SListenIntervalField iListenInterval;           // 2 bytes
       
  4572 
       
  4573     /** Ctor */
       
  4574     SAssociationRequestFixedFields() {};
       
  4575 
       
  4576 private:
       
  4577 
       
  4578     /** Prohibit assignment operator */
       
  4579     SAssociationRequestFixedFields& operator= ( 
       
  4580         const SAssociationRequestFixedFields& );
       
  4581     /** Prohibit copy constructor */
       
  4582     SAssociationRequestFixedFields( 
       
  4583         const SAssociationRequestFixedFields& );
       
  4584     } __PACKED;
       
  4585 
       
  4586 /**
       
  4587 * operator== for SAssociationRequestFixedFields
       
  4588 * @param aLhs left hand side
       
  4589 * @param aRhs right hand side
       
  4590 * @return ETrue equal, EFalse not equal
       
  4591 */
       
  4592 inline TBool operator== (
       
  4593     const SAssociationRequestFixedFields& aLhs,
       
  4594     const SAssociationRequestFixedFields& aRhs)
       
  4595     {
       
  4596     return static_cast<TBool>( aLhs.iCapabilityInfo == aRhs.iCapabilityInfo
       
  4597         && aLhs.iListenInterval == aRhs.iListenInterval );
       
  4598     }
       
  4599 
       
  4600 
       
  4601 /**
       
  4602 * 802.11 association request management frame
       
  4603 * excluding variable length information elements
       
  4604 * - SSID
       
  4605 * - supported rates
       
  4606 */
       
  4607 #pragma pack( 1 )
       
  4608 struct SAssociationRequestFrame
       
  4609     {
       
  4610     /** management frame header */
       
  4611     SManagementFrameHeader          iHeader;        // 24 bytes
       
  4612     /** association request fixed fields */
       
  4613     SAssociationRequestFixedFields  iFixedFields;   // 4 bytes
       
  4614 
       
  4615     /** Ctor */
       
  4616     SAssociationRequestFrame() 
       
  4617         : iHeader( E802Dot11FrameTypeAssociationReq ),
       
  4618         iFixedFields() {}; 
       
  4619 
       
  4620     /**
       
  4621     * Helper function to set short preamble bit in capability info
       
  4622     */
       
  4623     inline void SetCapabilityShortPreamble();
       
  4624 
       
  4625     /**
       
  4626     * Helper function to clear short preamble bit in capability info
       
  4627     */
       
  4628     inline void ClearCapabilityShortPreamble();
       
  4629 
       
  4630     /**
       
  4631     * Helper function to set PBCC bit in capability info
       
  4632     */
       
  4633     inline void SetCapabilityPbcc();
       
  4634 
       
  4635     /**
       
  4636     * Helper function to clear PBCC bit in capability info
       
  4637     */
       
  4638     inline void ClearCapabilityPbcc();
       
  4639 
       
  4640     /**
       
  4641     * Helper function to clear CF fields from capability info
       
  4642     */
       
  4643     inline void ClearCFfields();
       
  4644 
       
  4645     /** Helper function to clear reserved fields */
       
  4646     inline void ClearReservedFields();
       
  4647 
       
  4648     /** Helper function to set WEP bit from the capability info fixed field */
       
  4649     inline void SetWepBit();
       
  4650 
       
  4651     /** 
       
  4652     * Helper function to clear WEP bit from 
       
  4653     * the capability info fixed field 
       
  4654     */
       
  4655     inline void ClearWepBit();
       
  4656     
       
  4657     /** Helper function to set Radio measurement bit from the capability info fixed field */
       
  4658     inline void SetRMBit();
       
  4659 
       
  4660     /** 
       
  4661     * Helper function to clear Radio measurement bit from 
       
  4662     * the capability info fixed field 
       
  4663     */
       
  4664     inline void ClearRMBit();
       
  4665 private:
       
  4666 
       
  4667     /** Prohibit assignment operator */
       
  4668     SAssociationRequestFrame& operator= ( 
       
  4669         const SAssociationRequestFrame& );
       
  4670     /** Prohibit copy constructor */
       
  4671     SAssociationRequestFrame( 
       
  4672         const SAssociationRequestFrame& );
       
  4673     } __PACKED; // 28 bytes
       
  4674 
       
  4675 // ---------------------------------------------------------------------------
       
  4676 // 
       
  4677 // ---------------------------------------------------------------------------
       
  4678 //
       
  4679 inline void SAssociationRequestFrame::SetCapabilityShortPreamble()
       
  4680     {
       
  4681     iFixedFields.iCapabilityInfo.SetShortPreamble();
       
  4682     }
       
  4683 
       
  4684 // ---------------------------------------------------------------------------
       
  4685 // 
       
  4686 // ---------------------------------------------------------------------------
       
  4687 //
       
  4688 inline void SAssociationRequestFrame::ClearCapabilityShortPreamble()
       
  4689     {
       
  4690     iFixedFields.iCapabilityInfo.ClearShortPreamble();
       
  4691     }
       
  4692 
       
  4693 // ---------------------------------------------------------------------------
       
  4694 // 
       
  4695 // ---------------------------------------------------------------------------
       
  4696 //
       
  4697 inline void SAssociationRequestFrame::SetCapabilityPbcc()
       
  4698     {
       
  4699     iFixedFields.iCapabilityInfo.SetPbcc();
       
  4700     }
       
  4701 
       
  4702 // ---------------------------------------------------------------------------
       
  4703 // 
       
  4704 // ---------------------------------------------------------------------------
       
  4705 //
       
  4706 inline void SAssociationRequestFrame::ClearCapabilityPbcc()
       
  4707     {
       
  4708     iFixedFields.iCapabilityInfo.ClearPbcc();
       
  4709     }
       
  4710 
       
  4711 // ---------------------------------------------------------------------------
       
  4712 // 
       
  4713 // ---------------------------------------------------------------------------
       
  4714 //
       
  4715 inline void SAssociationRequestFrame::ClearCFfields()
       
  4716     {
       
  4717     iFixedFields.iCapabilityInfo.ClearCfFields();
       
  4718     }
       
  4719 
       
  4720 // ---------------------------------------------------------------------------
       
  4721 // 
       
  4722 // ---------------------------------------------------------------------------
       
  4723 //
       
  4724 inline void SAssociationRequestFrame::ClearReservedFields()
       
  4725     {
       
  4726     iFixedFields.iCapabilityInfo.ClearReservedFields();
       
  4727     }
       
  4728 
       
  4729 // ---------------------------------------------------------------------------
       
  4730 // 
       
  4731 // ---------------------------------------------------------------------------
       
  4732 //
       
  4733 inline void SAssociationRequestFrame::SetRMBit()
       
  4734     {
       
  4735     iFixedFields.iCapabilityInfo.SetRMBit();
       
  4736     }
       
  4737 
       
  4738 // ---------------------------------------------------------------------------
       
  4739 // 
       
  4740 // ---------------------------------------------------------------------------
       
  4741 //
       
  4742 inline void SAssociationRequestFrame::ClearRMBit()
       
  4743     {
       
  4744     iFixedFields.iCapabilityInfo.ClearRMBit();
       
  4745     }
       
  4746 
       
  4747 // ---------------------------------------------------------------------------
       
  4748 // 
       
  4749 // ---------------------------------------------------------------------------
       
  4750 //
       
  4751 inline void SAssociationRequestFrame::SetWepBit()
       
  4752     {
       
  4753     iFixedFields.iCapabilityInfo.SetWepBit();
       
  4754     }
       
  4755 
       
  4756 // ---------------------------------------------------------------------------
       
  4757 // 
       
  4758 // ---------------------------------------------------------------------------
       
  4759 //
       
  4760 inline void SAssociationRequestFrame::ClearWepBit()
       
  4761     {
       
  4762     iFixedFields.iCapabilityInfo.ClearWepBit();
       
  4763     }
       
  4764 
       
  4765 
       
  4766 /**
       
  4767 * 802.11 association request management frame with HT Control field
       
  4768 * excluding variable length information elements
       
  4769 * - SSID
       
  4770 * - supported rates
       
  4771 */
       
  4772 #pragma pack( 1 )
       
  4773 struct SHtAssociationRequestFrame
       
  4774     {
       
  4775     /** management frame header */
       
  4776     SManagementFrameHeader          iHeader;        // 24 bytes
       
  4777     /** HT control field */
       
  4778     TUint32                         iHtControl;     //  4 bytes    
       
  4779     /** association request fixed fields */
       
  4780     SAssociationRequestFixedFields  iFixedFields;   //  4 bytes
       
  4781 
       
  4782     /** Ctor */
       
  4783     SHtAssociationRequestFrame() 
       
  4784         : iHeader( E802Dot11FrameTypeAssociationReq ), 
       
  4785           iFixedFields() 
       
  4786         {
       
  4787         WriteHtoUint32( &iHtControl, 0 );
       
  4788         // as the HT Control field is present, the order bit needs to be set
       
  4789         iHeader.SetOrderBit();
       
  4790         }; 
       
  4791 
       
  4792     /**
       
  4793     * Helper function to set short preamble bit in capability info
       
  4794     */
       
  4795     inline void SetCapabilityShortPreamble();
       
  4796 
       
  4797     /**
       
  4798     * Helper function to clear short preamble bit in capability info
       
  4799     */
       
  4800     inline void ClearCapabilityShortPreamble();
       
  4801 
       
  4802     /**
       
  4803     * Helper function to set PBCC bit in capability info
       
  4804     */
       
  4805     inline void SetCapabilityPbcc();
       
  4806 
       
  4807     /**
       
  4808     * Helper function to clear PBCC bit in capability info
       
  4809     */
       
  4810     inline void ClearCapabilityPbcc();
       
  4811 
       
  4812     /**
       
  4813     * Helper function to clear CF fields from capability info
       
  4814     */
       
  4815     inline void ClearCFfields();
       
  4816 
       
  4817     /** Helper function to clear reserved fields */
       
  4818     inline void ClearReservedFields();
       
  4819 
       
  4820     /** Helper function to set WEP bit from the capability info fixed field */
       
  4821     inline void SetWepBit();
       
  4822 
       
  4823     /** 
       
  4824     * Helper function to clear WEP bit from 
       
  4825     * the capability info fixed field 
       
  4826     */
       
  4827     inline void ClearWepBit();
       
  4828 
       
  4829     /** Helper function to set Radio measurement bit from the capability info fixed field */
       
  4830     inline void SetRMBit();
       
  4831 
       
  4832     /** 
       
  4833     * Helper function to clear Radio measurement bit from 
       
  4834     * the capability info fixed field 
       
  4835     */
       
  4836     inline void ClearRMBit();
       
  4837 
       
  4838 private:
       
  4839 
       
  4840     /** Prohibit assignment operator */
       
  4841     SHtAssociationRequestFrame& operator= ( 
       
  4842         const SHtAssociationRequestFrame& );
       
  4843     /** Prohibit copy constructor */
       
  4844     SHtAssociationRequestFrame( 
       
  4845         const SHtAssociationRequestFrame& );
       
  4846     } __PACKED; // 32 bytes
       
  4847 
       
  4848 // ---------------------------------------------------------------------------
       
  4849 // 
       
  4850 // ---------------------------------------------------------------------------
       
  4851 //
       
  4852 inline void SHtAssociationRequestFrame::SetCapabilityShortPreamble()
       
  4853     {
       
  4854     iFixedFields.iCapabilityInfo.SetShortPreamble();
       
  4855     }
       
  4856 
       
  4857 // ---------------------------------------------------------------------------
       
  4858 // 
       
  4859 // ---------------------------------------------------------------------------
       
  4860 //
       
  4861 inline void SHtAssociationRequestFrame::ClearCapabilityShortPreamble()
       
  4862     {
       
  4863     iFixedFields.iCapabilityInfo.ClearShortPreamble();
       
  4864     }
       
  4865 
       
  4866 // ---------------------------------------------------------------------------
       
  4867 // 
       
  4868 // ---------------------------------------------------------------------------
       
  4869 //
       
  4870 inline void SHtAssociationRequestFrame::SetCapabilityPbcc()
       
  4871     {
       
  4872     iFixedFields.iCapabilityInfo.SetPbcc();
       
  4873     }
       
  4874 
       
  4875 // ---------------------------------------------------------------------------
       
  4876 // 
       
  4877 // ---------------------------------------------------------------------------
       
  4878 //
       
  4879 inline void SHtAssociationRequestFrame::ClearCapabilityPbcc()
       
  4880     {
       
  4881     iFixedFields.iCapabilityInfo.ClearPbcc();
       
  4882     }
       
  4883 
       
  4884 // ---------------------------------------------------------------------------
       
  4885 // 
       
  4886 // ---------------------------------------------------------------------------
       
  4887 //
       
  4888 inline void SHtAssociationRequestFrame::ClearCFfields()
       
  4889     {
       
  4890     iFixedFields.iCapabilityInfo.ClearCfFields();
       
  4891     }
       
  4892 
       
  4893 // ---------------------------------------------------------------------------
       
  4894 // 
       
  4895 // ---------------------------------------------------------------------------
       
  4896 //
       
  4897 inline void SHtAssociationRequestFrame::ClearReservedFields()
       
  4898     {
       
  4899     iFixedFields.iCapabilityInfo.ClearReservedFields();
       
  4900     }
       
  4901 
       
  4902 // ---------------------------------------------------------------------------
       
  4903 // 
       
  4904 // ---------------------------------------------------------------------------
       
  4905 //
       
  4906 inline void SHtAssociationRequestFrame::SetRMBit()
       
  4907     {
       
  4908     iFixedFields.iCapabilityInfo.SetRMBit();
       
  4909     }
       
  4910 
       
  4911 // ---------------------------------------------------------------------------
       
  4912 // 
       
  4913 // ---------------------------------------------------------------------------
       
  4914 //
       
  4915 inline void SHtAssociationRequestFrame::ClearRMBit()
       
  4916     {
       
  4917     iFixedFields.iCapabilityInfo.ClearRMBit();
       
  4918     }
       
  4919 
       
  4920 // ---------------------------------------------------------------------------
       
  4921 // 
       
  4922 // ---------------------------------------------------------------------------
       
  4923 //
       
  4924 inline void SHtAssociationRequestFrame::SetWepBit()
       
  4925     {
       
  4926     iFixedFields.iCapabilityInfo.SetWepBit();
       
  4927     }
       
  4928 
       
  4929 // ---------------------------------------------------------------------------
       
  4930 // 
       
  4931 // ---------------------------------------------------------------------------
       
  4932 //
       
  4933 inline void SHtAssociationRequestFrame::ClearWepBit()
       
  4934     {
       
  4935     iFixedFields.iCapabilityInfo.ClearWepBit();
       
  4936     }
       
  4937 
       
  4938 
       
  4939 /**
       
  4940 * 802.11 association response frame fixed fields
       
  4941 */
       
  4942 #pragma pack( 1 )
       
  4943 struct SAssociationResponseFixedFields
       
  4944     {
       
  4945     /** capability info fixed field */
       
  4946     SCapabilityInformationField iCapabilityInfo;    // 2 bytes
       
  4947     /** status code fixed field */
       
  4948     TUint16                     iStatusCode;        // 2 bytes
       
  4949     /** AID fixed field */
       
  4950     TUint16                     iAID;               // 2 bytes
       
  4951     
       
  4952     /**
       
  4953     * Returns the association response status code
       
  4954     * @return status code
       
  4955     */
       
  4956     inline TUint16 StatusCode() const;
       
  4957 
       
  4958     /**
       
  4959     * Returns the Association ID (AID)
       
  4960     * @return AID
       
  4961     */
       
  4962     inline TUint16 Aid() const;
       
  4963 
       
  4964 private:
       
  4965 
       
  4966     /** Prohibit default constructor */
       
  4967     SAssociationResponseFixedFields();
       
  4968     /** Prohibit assignment operator */
       
  4969     SAssociationResponseFixedFields& operator= ( 
       
  4970         const SAssociationResponseFixedFields& );    
       
  4971     /** Prohibit copy constructor */
       
  4972     SAssociationResponseFixedFields( const SAssociationResponseFixedFields& );
       
  4973     } __PACKED;
       
  4974 
       
  4975 inline TUint16 SAssociationResponseFixedFields::StatusCode() const
       
  4976     {
       
  4977     return ( ReadUint16Toh( &iStatusCode ) );
       
  4978     }
       
  4979 
       
  4980 inline TUint16 SAssociationResponseFixedFields::Aid() const
       
  4981     {
       
  4982     return ( ReadUint16Toh( &iAID ) );
       
  4983     }
       
  4984 
       
  4985 
       
  4986 /**
       
  4987 * 802.11 fixed length components required in deauthenticate frame
       
  4988 */
       
  4989 #pragma pack( 1 )
       
  4990 struct SDeauthenticateFixedFields
       
  4991     {
       
  4992     /** reason code fixed field */
       
  4993     TUint16 iReasonCode;
       
  4994 
       
  4995     /** Ctor */
       
  4996     inline SDeauthenticateFixedFields();
       
  4997 
       
  4998     /*
       
  4999     * Returns the reason code 
       
  5000     * @return Reason code
       
  5001     */
       
  5002     inline TUint16 ReasonCode() const;
       
  5003 
       
  5004     /** Setter for the reason code */
       
  5005     inline void SetReasonCode( TUint16 aReasonCode );
       
  5006     
       
  5007 private:
       
  5008 
       
  5009     /** Prohibit assignment operator */
       
  5010     SDeauthenticateFixedFields& operator= ( 
       
  5011         const SDeauthenticateFixedFields& );
       
  5012     /** Prohibit copy constructor */
       
  5013     SDeauthenticateFixedFields( const SDeauthenticateFixedFields& );
       
  5014     } __PACKED;
       
  5015 
       
  5016 // ---------------------------------------------------------------------------
       
  5017 // 
       
  5018 // ---------------------------------------------------------------------------
       
  5019 //
       
  5020 inline SDeauthenticateFixedFields::SDeauthenticateFixedFields()
       
  5021     {
       
  5022     WriteHtoUint16( &iReasonCode, E802Dot11ReasonDeauthStationLeft );
       
  5023     }
       
  5024     
       
  5025 // ---------------------------------------------------------------------------
       
  5026 // 
       
  5027 // ---------------------------------------------------------------------------
       
  5028 //
       
  5029 inline TUint16 SDeauthenticateFixedFields::ReasonCode() const
       
  5030     {
       
  5031     return ( ReadUint16Toh( &iReasonCode ) );
       
  5032     }
       
  5033 
       
  5034 // ---------------------------------------------------------------------------
       
  5035 // 
       
  5036 // ---------------------------------------------------------------------------
       
  5037 //
       
  5038 inline void SDeauthenticateFixedFields::SetReasonCode( TUint16 aReasonCode )
       
  5039     {
       
  5040     WriteHtoUint16( &iReasonCode, aReasonCode );
       
  5041     }
       
  5042 
       
  5043 /**
       
  5044 * operator== for SDeauthenticateFixedFields
       
  5045 * @param aLhs left hand side
       
  5046 * @param aRhs right hand side
       
  5047 * @return ETrue equal, EFalse not equal
       
  5048 */
       
  5049 inline TBool operator== (
       
  5050     const SDeauthenticateFixedFields& aLhs,
       
  5051     const SDeauthenticateFixedFields& aRhs)
       
  5052     {
       
  5053     return static_cast<TBool>( 
       
  5054         aLhs.ReasonCode() == aRhs.ReasonCode() );
       
  5055     }
       
  5056 
       
  5057 /**
       
  5058 * 802.11 deauthenticate management frame
       
  5059 */
       
  5060 #pragma pack( 1 )
       
  5061 struct SDeauthenticateFrame
       
  5062     {
       
  5063     /** management frame header */
       
  5064     SManagementFrameHeader      iHeader;        // 24 bytes     
       
  5065     /** reason code fixed field  */
       
  5066     SDeauthenticateFixedFields  iReasonCode;    // 2 bytes
       
  5067 
       
  5068     /** Ctor */
       
  5069     SDeauthenticateFrame() 
       
  5070         : iHeader( E802Dot11FrameTypeDeauthentication ),
       
  5071         iReasonCode() {};
       
  5072 
       
  5073 private:
       
  5074 
       
  5075     /** Prohibit assignment operator */
       
  5076     SDeauthenticateFrame& operator= ( const SDeauthenticateFrame& );
       
  5077     /** Prohibit copy constructor */
       
  5078     SDeauthenticateFrame( const SDeauthenticateFrame& );
       
  5079     } __PACKED;
       
  5080 
       
  5081 /**
       
  5082 * operator== for SDeauthenticateFrame
       
  5083 * @param aLhs left hand side
       
  5084 * @param aRhs right hand side
       
  5085 * @return ETrue equal, EFalse not equal
       
  5086 */
       
  5087 inline TBool operator== (
       
  5088     const SDeauthenticateFrame& aLhs,
       
  5089     const SDeauthenticateFrame& aRhs)
       
  5090     {
       
  5091     return ( aLhs == aRhs );
       
  5092     }
       
  5093 
       
  5094 
       
  5095 /**
       
  5096 * 802.11 deauthenticate management frame with HT Control field
       
  5097 */
       
  5098 #pragma pack( 1 )
       
  5099 struct SHtDeauthenticateFrame
       
  5100     {
       
  5101     /** management frame header */
       
  5102     SManagementFrameHeader      iHeader;        // 24 bytes     
       
  5103     /** HT control field */
       
  5104     TUint32                     iHtControl;     //  4 bytes    
       
  5105     /** reason code fixed field  */
       
  5106     SDeauthenticateFixedFields  iReasonCode;    //  2 bytes
       
  5107 
       
  5108     /** Ctor */
       
  5109     SHtDeauthenticateFrame() 
       
  5110         : iHeader( E802Dot11FrameTypeDeauthentication ),
       
  5111           iReasonCode() 
       
  5112         {
       
  5113         WriteHtoUint32( &iHtControl, 0 );
       
  5114         // as the HT Control field is present, the order bit needs to be set
       
  5115         iHeader.SetOrderBit();
       
  5116         };
       
  5117 
       
  5118 private:
       
  5119 
       
  5120     /** Prohibit assignment operator */
       
  5121     SHtDeauthenticateFrame& operator= ( const SHtDeauthenticateFrame& );
       
  5122     /** Prohibit copy constructor */
       
  5123     SHtDeauthenticateFrame( const SHtDeauthenticateFrame& );
       
  5124     } __PACKED;
       
  5125 
       
  5126 /**
       
  5127 * operator== for SHtDeauthenticateFrame
       
  5128 * @param aLhs left hand side
       
  5129 * @param aRhs right hand side
       
  5130 * @return ETrue equal, EFalse not equal
       
  5131 */
       
  5132 inline TBool operator== (
       
  5133     const SHtDeauthenticateFrame& aLhs,
       
  5134     const SHtDeauthenticateFrame& aRhs)
       
  5135     {
       
  5136     return ( aLhs == aRhs );
       
  5137     }
       
  5138 
       
  5139 
       
  5140 /**
       
  5141 * 802.11 fixed length components required in disassociate frame
       
  5142 */
       
  5143 #pragma pack( 1 )
       
  5144 struct SDisAssociateFixedFields
       
  5145     {
       
  5146     /** reason code fixed field */
       
  5147     TUint16 iReasonCode;
       
  5148 
       
  5149     /** Ctor */
       
  5150     inline SDisAssociateFixedFields();
       
  5151 
       
  5152     /*
       
  5153     * Returns the reason code 
       
  5154     * @return Reason code
       
  5155     */
       
  5156     inline TUint16 ReasonCode() const;
       
  5157 
       
  5158     /** Setter for the reason code */
       
  5159     inline void SetReasonCode( TUint16 aReasonCode );
       
  5160     
       
  5161 private:
       
  5162     // Prohibit assignment operator
       
  5163     SDisAssociateFixedFields& operator= ( const SDisAssociateFixedFields& );
       
  5164     // Prohibit copy constructor    
       
  5165     SDisAssociateFixedFields( const SDisAssociateFixedFields& );
       
  5166     } __PACKED;
       
  5167 
       
  5168 // ---------------------------------------------------------------------------
       
  5169 // 
       
  5170 // ---------------------------------------------------------------------------
       
  5171 //
       
  5172 inline SDisAssociateFixedFields::SDisAssociateFixedFields()
       
  5173     {
       
  5174     WriteHtoUint16( &iReasonCode, E802Dot11ReasonClass3FrameWhenNotAssoc );
       
  5175     }
       
  5176 
       
  5177 // ---------------------------------------------------------------------------
       
  5178 // 
       
  5179 // ---------------------------------------------------------------------------
       
  5180 //
       
  5181 inline TUint16 SDisAssociateFixedFields::ReasonCode() const
       
  5182     {
       
  5183     return ( ReadUint16Toh( &iReasonCode ) );
       
  5184     }
       
  5185 
       
  5186 // ---------------------------------------------------------------------------
       
  5187 // 
       
  5188 // ---------------------------------------------------------------------------
       
  5189 //
       
  5190 inline void SDisAssociateFixedFields::SetReasonCode( TUint16 aReasonCode )
       
  5191     {
       
  5192     WriteHtoUint16( &iReasonCode, aReasonCode );
       
  5193     }
       
  5194 
       
  5195 /**
       
  5196 * operator== for SDisAssociateFixedFields
       
  5197 * @param aLhs left hand side
       
  5198 * @param aRhs right hand side
       
  5199 * @return ETrue equal, EFalse not equal
       
  5200 */
       
  5201 inline TBool operator== (
       
  5202     const SDisAssociateFixedFields& aLhs,
       
  5203     const SDisAssociateFixedFields& aRhs)
       
  5204     {
       
  5205     return static_cast<TBool>( 
       
  5206         aLhs.ReasonCode() == aRhs.ReasonCode() );
       
  5207     }
       
  5208 
       
  5209 /**
       
  5210 * 802.11 disassociate management frame
       
  5211 */
       
  5212 #pragma pack( 1 )
       
  5213 struct SDisassociateFrame
       
  5214     {
       
  5215     /** management frame header */
       
  5216     SManagementFrameHeader      iHeader;        // 24 bytes 
       
  5217     /** reason code fixed field  */
       
  5218     SDisAssociateFixedFields    iReasonCode;    // 2 bytes
       
  5219 
       
  5220     /** Ctor */
       
  5221     SDisassociateFrame()
       
  5222         : iHeader( E802Dot11FrameTypeDisassociation ),
       
  5223         iReasonCode() {};
       
  5224 
       
  5225 private:
       
  5226 
       
  5227     /** Prohibit assignment operator */
       
  5228     SDisassociateFrame& operator= ( const SDisassociateFrame& );
       
  5229     /** Prohibit copy constructor */
       
  5230     SDisassociateFrame( const SDisassociateFrame& );
       
  5231     } __PACKED; // 26 bytes
       
  5232 
       
  5233 /**
       
  5234 * operator== for SDisassociateFrame
       
  5235 * @param aLhs left hand side
       
  5236 * @param aRhs right hand side
       
  5237 * @return ETrue equal, EFalse not equal
       
  5238 */
       
  5239 inline TBool operator== (
       
  5240     const SDisassociateFrame& aLhs,
       
  5241     const SDisassociateFrame& aRhs)
       
  5242     {
       
  5243     return ( aLhs == aRhs );
       
  5244     }
       
  5245 
       
  5246 
       
  5247 /**
       
  5248 * 802.11 disassociate management frame with HT Control field
       
  5249 */
       
  5250 #pragma pack( 1 )
       
  5251 struct SHtDisassociateFrame
       
  5252     {
       
  5253     /** management frame header */
       
  5254     SManagementFrameHeader      iHeader;        // 24 bytes 
       
  5255     /** HT control field */
       
  5256     TUint32                     iHtControl;     //  4 bytes    
       
  5257     /** reason code fixed field  */
       
  5258     SDisAssociateFixedFields    iReasonCode;    //  2 bytes
       
  5259 
       
  5260     /** Ctor */
       
  5261     SHtDisassociateFrame()
       
  5262         : iHeader( E802Dot11FrameTypeDisassociation ),
       
  5263           iReasonCode() 
       
  5264         {
       
  5265         WriteHtoUint32( &iHtControl, 0 );
       
  5266         // as the HT Control field is present, the order bit needs to be set
       
  5267         iHeader.SetOrderBit();
       
  5268         };
       
  5269 
       
  5270 private:
       
  5271 
       
  5272     /** Prohibit assignment operator */
       
  5273     SHtDisassociateFrame& operator= ( const SHtDisassociateFrame& );
       
  5274     /** Prohibit copy constructor */
       
  5275     SHtDisassociateFrame( const SHtDisassociateFrame& );
       
  5276     } __PACKED; // 30 bytes
       
  5277 
       
  5278 /**
       
  5279 * operator== for SHtDisassociateFrame
       
  5280 * @param aLhs left hand side
       
  5281 * @param aRhs right hand side
       
  5282 * @return ETrue equal, EFalse not equal
       
  5283 */
       
  5284 inline TBool operator== (
       
  5285     const SHtDisassociateFrame& aLhs,
       
  5286     const SHtDisassociateFrame& aRhs)
       
  5287     {
       
  5288     return ( aLhs == aRhs );
       
  5289     }
       
  5290 
       
  5291 
       
  5292 /**
       
  5293 * 802.11 fixed length components required 
       
  5294 * in reassociation request management frame
       
  5295 */
       
  5296 #pragma pack( 1 )
       
  5297 struct SReassociationRequestFixedFields
       
  5298     {
       
  5299     /** capability info fixed field */
       
  5300     SCapabilityInformationField iCapabilityInfo;    // 2 bytes
       
  5301     /** listeninterval fixed field */
       
  5302     SListenIntervalField iListenInterval;           // 2 bytes
       
  5303     /** current AP address fixed field */
       
  5304     TMacAddress iCurrentApAddress;                  // 6 bytes
       
  5305 
       
  5306     /** Ctor */
       
  5307     inline SReassociationRequestFixedFields();
       
  5308 
       
  5309 private:
       
  5310 
       
  5311     /** Prohibit assignment operator */
       
  5312     SReassociationRequestFixedFields& operator= ( 
       
  5313         const SReassociationRequestFixedFields& );
       
  5314     /** Prohibit copy constructor */
       
  5315     SReassociationRequestFixedFields( 
       
  5316         const SReassociationRequestFixedFields& );
       
  5317     } __PACKED;
       
  5318 
       
  5319 
       
  5320 // ---------------------------------------------------------------------------
       
  5321 // 
       
  5322 // ---------------------------------------------------------------------------
       
  5323 //
       
  5324 inline SReassociationRequestFixedFields::SReassociationRequestFixedFields() :
       
  5325     iCurrentApAddress( KZeroMacAddr )
       
  5326     {
       
  5327     }
       
  5328 
       
  5329 
       
  5330 /**
       
  5331 * operator== for SReassociationRequestFixedFields
       
  5332 * @param aLhs left hand side
       
  5333 * @param aRhs right hand side
       
  5334 * @return ETrue equal, EFalse not equal
       
  5335 */
       
  5336 inline TBool operator== (
       
  5337     const SReassociationRequestFixedFields& aLhs,
       
  5338     const SReassociationRequestFixedFields& aRhs)
       
  5339     {
       
  5340     return static_cast<TBool>( aLhs.iCapabilityInfo == aRhs.iCapabilityInfo
       
  5341                                && aLhs.iListenInterval == aRhs.iListenInterval
       
  5342                                && aLhs.iCurrentApAddress == aRhs.iCurrentApAddress );
       
  5343     }
       
  5344 
       
  5345 /**
       
  5346 * 802.11 reassociation request management frame
       
  5347 * excluding variable length information elements
       
  5348 */
       
  5349 #pragma pack( 1 )
       
  5350 struct SReassociationRequestFrame
       
  5351     {
       
  5352     /** management frame header */
       
  5353     SManagementFrameHeader          iHeader;        // 24 bytes
       
  5354     /** association request fixed fields */
       
  5355     SReassociationRequestFixedFields  iFixedFields; // 10 bytes
       
  5356 
       
  5357     /** Ctor */
       
  5358     SReassociationRequestFrame() 
       
  5359         : iHeader( E802Dot11FrameTypeReassociationReq ),
       
  5360         iFixedFields() {}; 
       
  5361 
       
  5362     /**
       
  5363     * Helper function to set short preamble bit in capability info
       
  5364     */
       
  5365     inline void SetCapabilityShortPreamble();
       
  5366 
       
  5367     /**
       
  5368     * Helper function to clear short preamble bit in capability info
       
  5369     */
       
  5370     inline void ClearCapabilityShortPreamble();
       
  5371 
       
  5372     /**
       
  5373     * Helper function to set PBCC bit in capability info
       
  5374     */
       
  5375     inline void SetCapabilityPbcc();
       
  5376 
       
  5377     /**
       
  5378     * Helper function to clear PBCC bit in capability info
       
  5379     */
       
  5380     inline void ClearCapabilityPbcc();
       
  5381 
       
  5382     /**
       
  5383     * Helper function to clear CF fields from capability info
       
  5384     */
       
  5385     inline void ClearCFfields();
       
  5386 
       
  5387     /** Helper function to clear reserved fields */
       
  5388     inline void ClearReservedFields();
       
  5389 
       
  5390     /** Helper function to set WEP bit from the capability info fixed field */
       
  5391     inline void SetWepBit();
       
  5392 
       
  5393     /** 
       
  5394     * Helper function to clear WEP bit from 
       
  5395     * the capability info fixed field 
       
  5396     */
       
  5397     inline void ClearWepBit();
       
  5398 
       
  5399     /** Helper function to set Radio measurement bit from the capability info fixed field */
       
  5400     inline void SetRMBit();
       
  5401 
       
  5402     /** 
       
  5403     * Helper function to clear Radio measurement bit from 
       
  5404     * the capability info fixed field 
       
  5405     */
       
  5406     inline void ClearRMBit();
       
  5407 
       
  5408 private:
       
  5409 
       
  5410     /** Prohibit assignment operator */
       
  5411     SReassociationRequestFrame& operator= ( 
       
  5412         const SReassociationRequestFrame& );
       
  5413     /** Prohibit copy constructor */
       
  5414     SReassociationRequestFrame( 
       
  5415         const SReassociationRequestFrame& );
       
  5416     } __PACKED; // 34 bytes
       
  5417 
       
  5418 // ---------------------------------------------------------------------------
       
  5419 // 
       
  5420 // ---------------------------------------------------------------------------
       
  5421 //
       
  5422 inline void SReassociationRequestFrame::SetCapabilityShortPreamble()
       
  5423     {
       
  5424     iFixedFields.iCapabilityInfo.SetShortPreamble();
       
  5425     }
       
  5426 
       
  5427 // ---------------------------------------------------------------------------
       
  5428 // 
       
  5429 // ---------------------------------------------------------------------------
       
  5430 //
       
  5431 inline void SReassociationRequestFrame::ClearCapabilityShortPreamble()
       
  5432     {
       
  5433     iFixedFields.iCapabilityInfo.ClearShortPreamble();
       
  5434     }
       
  5435 
       
  5436 // ---------------------------------------------------------------------------
       
  5437 // 
       
  5438 // ---------------------------------------------------------------------------
       
  5439 //
       
  5440 inline void SReassociationRequestFrame::SetCapabilityPbcc()
       
  5441     {
       
  5442     iFixedFields.iCapabilityInfo.SetPbcc();
       
  5443     }
       
  5444 
       
  5445 // ---------------------------------------------------------------------------
       
  5446 // 
       
  5447 // ---------------------------------------------------------------------------
       
  5448 //
       
  5449 inline void SReassociationRequestFrame::ClearCapabilityPbcc()
       
  5450     {
       
  5451     iFixedFields.iCapabilityInfo.ClearPbcc();
       
  5452     }
       
  5453 
       
  5454 // ---------------------------------------------------------------------------
       
  5455 // 
       
  5456 // ---------------------------------------------------------------------------
       
  5457 //
       
  5458 inline void SReassociationRequestFrame::ClearCFfields()
       
  5459     {
       
  5460     iFixedFields.iCapabilityInfo.ClearCfFields();
       
  5461     }
       
  5462 
       
  5463 // ---------------------------------------------------------------------------
       
  5464 // 
       
  5465 // ---------------------------------------------------------------------------
       
  5466 //
       
  5467 inline void SReassociationRequestFrame::ClearReservedFields()
       
  5468     {
       
  5469     iFixedFields.iCapabilityInfo.ClearReservedFields();
       
  5470     }
       
  5471 
       
  5472 // ---------------------------------------------------------------------------
       
  5473 // 
       
  5474 // ---------------------------------------------------------------------------
       
  5475 //
       
  5476 inline void SReassociationRequestFrame::SetRMBit()
       
  5477     {
       
  5478     iFixedFields.iCapabilityInfo.SetRMBit();
       
  5479     }
       
  5480 
       
  5481 // ---------------------------------------------------------------------------
       
  5482 // 
       
  5483 // ---------------------------------------------------------------------------
       
  5484 //
       
  5485 inline void SReassociationRequestFrame::ClearRMBit()
       
  5486     {
       
  5487     iFixedFields.iCapabilityInfo.ClearRMBit();
       
  5488     }
       
  5489 
       
  5490 // ---------------------------------------------------------------------------
       
  5491 // 
       
  5492 // ---------------------------------------------------------------------------
       
  5493 //
       
  5494 inline void SReassociationRequestFrame::SetWepBit()
       
  5495     {
       
  5496     iFixedFields.iCapabilityInfo.SetWepBit();
       
  5497     }
       
  5498 
       
  5499 // ---------------------------------------------------------------------------
       
  5500 // 
       
  5501 // ---------------------------------------------------------------------------
       
  5502 //
       
  5503 inline void SReassociationRequestFrame::ClearWepBit()
       
  5504     {
       
  5505     iFixedFields.iCapabilityInfo.ClearWepBit();
       
  5506     }
       
  5507 
       
  5508 
       
  5509 /**
       
  5510 * 802.11 reassociation request management frame with HT Control field
       
  5511 * excluding variable length information elements
       
  5512 */
       
  5513 #pragma pack( 1 )
       
  5514 struct SHtReassociationRequestFrame
       
  5515     {
       
  5516     /** management frame header */
       
  5517     SManagementFrameHeader          iHeader;        // 24 bytes
       
  5518     /** HT control field */
       
  5519     TUint32                         iHtControl;     //  4 bytes    
       
  5520     /** association request fixed fields */
       
  5521     SReassociationRequestFixedFields  iFixedFields; // 10 bytes
       
  5522 
       
  5523     /** Ctor */
       
  5524     SHtReassociationRequestFrame() 
       
  5525         : iHeader( E802Dot11FrameTypeReassociationReq ),
       
  5526           iFixedFields() 
       
  5527         {
       
  5528         WriteHtoUint32( &iHtControl, 0 );
       
  5529         // as the HT Control field is present, the order bit needs to be set
       
  5530         iHeader.SetOrderBit();
       
  5531         }; 
       
  5532 
       
  5533     /**
       
  5534     * Helper function to set short preamble bit in capability info
       
  5535     */
       
  5536     inline void SetCapabilityShortPreamble();
       
  5537 
       
  5538     /**
       
  5539     * Helper function to clear short preamble bit in capability info
       
  5540     */
       
  5541     inline void ClearCapabilityShortPreamble();
       
  5542 
       
  5543     /**
       
  5544     * Helper function to set PBCC bit in capability info
       
  5545     */
       
  5546     inline void SetCapabilityPbcc();
       
  5547 
       
  5548     /**
       
  5549     * Helper function to clear PBCC bit in capability info
       
  5550     */
       
  5551     inline void ClearCapabilityPbcc();
       
  5552 
       
  5553     /**
       
  5554     * Helper function to clear CF fields from capability info
       
  5555     */
       
  5556     inline void ClearCFfields();
       
  5557 
       
  5558     /** Helper function to clear reserved fields */
       
  5559     inline void ClearReservedFields();
       
  5560 
       
  5561     /** Helper function to set Radio measurement bit from the capability info fixed field */
       
  5562     inline void SetRMBit();
       
  5563 
       
  5564     /** 
       
  5565     * Helper function to clear Radio measurement bit from 
       
  5566     * the capability info fixed field 
       
  5567     */
       
  5568     inline void ClearRMBit();
       
  5569 
       
  5570     /** Helper function to set WEP bit from the capability info fixed field */
       
  5571     inline void SetWepBit();
       
  5572 
       
  5573     /** 
       
  5574     * Helper function to clear WEP bit from 
       
  5575     * the capability info fixed field 
       
  5576     */
       
  5577     inline void ClearWepBit();
       
  5578 
       
  5579 private:
       
  5580 
       
  5581     /** Prohibit assignment operator */
       
  5582     SHtReassociationRequestFrame& operator= ( 
       
  5583         const SHtReassociationRequestFrame& );
       
  5584     /** Prohibit copy constructor */
       
  5585     SHtReassociationRequestFrame( 
       
  5586         const SHtReassociationRequestFrame& );
       
  5587     } __PACKED; // 38 bytes
       
  5588 
       
  5589 // ---------------------------------------------------------------------------
       
  5590 // 
       
  5591 // ---------------------------------------------------------------------------
       
  5592 //
       
  5593 inline void SHtReassociationRequestFrame::SetCapabilityShortPreamble()
       
  5594     {
       
  5595     iFixedFields.iCapabilityInfo.SetShortPreamble();
       
  5596     }
       
  5597 
       
  5598 // ---------------------------------------------------------------------------
       
  5599 // 
       
  5600 // ---------------------------------------------------------------------------
       
  5601 //
       
  5602 inline void SHtReassociationRequestFrame::ClearCapabilityShortPreamble()
       
  5603     {
       
  5604     iFixedFields.iCapabilityInfo.ClearShortPreamble();
       
  5605     }
       
  5606 
       
  5607 // ---------------------------------------------------------------------------
       
  5608 // 
       
  5609 // ---------------------------------------------------------------------------
       
  5610 //
       
  5611 inline void SHtReassociationRequestFrame::SetCapabilityPbcc()
       
  5612     {
       
  5613     iFixedFields.iCapabilityInfo.SetPbcc();
       
  5614     }
       
  5615 
       
  5616 // ---------------------------------------------------------------------------
       
  5617 // 
       
  5618 // ---------------------------------------------------------------------------
       
  5619 //
       
  5620 inline void SHtReassociationRequestFrame::ClearCapabilityPbcc()
       
  5621     {
       
  5622     iFixedFields.iCapabilityInfo.ClearPbcc();
       
  5623     }
       
  5624 
       
  5625 // ---------------------------------------------------------------------------
       
  5626 // 
       
  5627 // ---------------------------------------------------------------------------
       
  5628 //
       
  5629 inline void SHtReassociationRequestFrame::ClearCFfields()
       
  5630     {
       
  5631     iFixedFields.iCapabilityInfo.ClearCfFields();
       
  5632     }
       
  5633 
       
  5634 // ---------------------------------------------------------------------------
       
  5635 // 
       
  5636 // ---------------------------------------------------------------------------
       
  5637 //
       
  5638 inline void SHtReassociationRequestFrame::ClearReservedFields()
       
  5639     {
       
  5640     iFixedFields.iCapabilityInfo.ClearReservedFields();
       
  5641     }
       
  5642 
       
  5643 // ---------------------------------------------------------------------------
       
  5644 // 
       
  5645 // ---------------------------------------------------------------------------
       
  5646 //
       
  5647 inline void SHtReassociationRequestFrame::SetRMBit()
       
  5648     {
       
  5649     iFixedFields.iCapabilityInfo.SetRMBit();
       
  5650     }
       
  5651 
       
  5652 // ---------------------------------------------------------------------------
       
  5653 // 
       
  5654 // ---------------------------------------------------------------------------
       
  5655 //
       
  5656 inline void SHtReassociationRequestFrame::ClearRMBit()
       
  5657     {
       
  5658     iFixedFields.iCapabilityInfo.ClearRMBit();
       
  5659     }
       
  5660 
       
  5661 // ---------------------------------------------------------------------------
       
  5662 // 
       
  5663 // ---------------------------------------------------------------------------
       
  5664 //
       
  5665 inline void SHtReassociationRequestFrame::SetWepBit()
       
  5666     {
       
  5667     iFixedFields.iCapabilityInfo.SetWepBit();
       
  5668     }
       
  5669 
       
  5670 // ---------------------------------------------------------------------------
       
  5671 // 
       
  5672 // ---------------------------------------------------------------------------
       
  5673 //
       
  5674 inline void SHtReassociationRequestFrame::ClearWepBit()
       
  5675     {
       
  5676     iFixedFields.iCapabilityInfo.ClearWepBit();
       
  5677     }
       
  5678 
       
  5679 
       
  5680 /**
       
  5681 * 802.11 reassociation response frame fixed fields
       
  5682 */
       
  5683 #pragma pack( 1 )
       
  5684 struct SReassociationResponseFixedFields
       
  5685     {
       
  5686     /** capability info fixed field */
       
  5687     SCapabilityInformationField iCapabilityInfo;    // 2 bytes
       
  5688     /** status code fixed field */
       
  5689     TUint16                     iStatusCode;        // 2 bytes
       
  5690     /** AID fixed field */
       
  5691     TUint16                     iAID;               // 2 bytes
       
  5692 
       
  5693     /*
       
  5694     * Returns the reassociation response status code
       
  5695     * @return status code
       
  5696     */
       
  5697     inline TUint16 StatusCode() const;
       
  5698 
       
  5699     /*
       
  5700     * Returns the Asociation ID (AID)
       
  5701     * @return AID
       
  5702     */
       
  5703     inline TUint16 Aid() const;
       
  5704 
       
  5705 private:
       
  5706 
       
  5707     /** Prohibit default constructor */
       
  5708     SReassociationResponseFixedFields();
       
  5709     /** Prohibit assignment operator */
       
  5710     SReassociationResponseFixedFields& operator= ( 
       
  5711         const SReassociationResponseFixedFields& );    
       
  5712     /** Prohibit copy constructor */
       
  5713     SReassociationResponseFixedFields( const SReassociationResponseFixedFields& );
       
  5714     } __PACKED;
       
  5715 
       
  5716 // ---------------------------------------------------------------------------
       
  5717 // 
       
  5718 // ---------------------------------------------------------------------------
       
  5719 //
       
  5720 inline TUint16 SReassociationResponseFixedFields::StatusCode() const
       
  5721     {
       
  5722     return ( ReadUint16Toh( &iStatusCode ) );
       
  5723     }
       
  5724 
       
  5725 // ---------------------------------------------------------------------------
       
  5726 // 
       
  5727 // ---------------------------------------------------------------------------
       
  5728 //
       
  5729 inline TUint16 SReassociationResponseFixedFields::Aid() const
       
  5730     {
       
  5731     return ( ReadUint16Toh( &iAID ) );
       
  5732     }
       
  5733 
       
  5734 
       
  5735 /**
       
  5736 * SNAP header
       
  5737 */
       
  5738 #pragma pack( 1 )
       
  5739 struct SSnapHeader
       
  5740     {
       
  5741     /** destination service access point */
       
  5742     TUint8 iDSAP;
       
  5743     /** source service access point */
       
  5744     TUint8 iSSAP;
       
  5745     /** control field */
       
  5746     TUint8 iControl;
       
  5747     /** organizationally unique identifier */
       
  5748     TUint8 iOUI[KOIULength];    // 3
       
  5749     } __PACKED; // 6 bytes
       
  5750 
       
  5751 /**
       
  5752 * operator== for SSnapHeader
       
  5753 * @param aLhs left hand side
       
  5754 * @param aRhs right hand side
       
  5755 * @return ETrue equal, EFalse not equal
       
  5756 */
       
  5757 inline TBool operator== (
       
  5758     const SSnapHeader& aLhs,
       
  5759     const SSnapHeader& aRhs)
       
  5760     {    
       
  5761     return ( equal( reinterpret_cast<const TUint8*>(&aLhs),
       
  5762                     reinterpret_cast<const TUint8*>(&aLhs) + sizeof(SSnapHeader), 
       
  5763                     reinterpret_cast<const TUint8*>(&aRhs) ));    
       
  5764     }
       
  5765 
       
  5766 /**
       
  5767 * RFC 1042 encapsulation SNAP header
       
  5768 */
       
  5769 const SSnapHeader KEncapsulatingRfc1042SnapHeader 
       
  5770     = { 0xAA, 0xAA, 0x03, { 0x00, 0x00, 0x00 } };
       
  5771 
       
  5772 /**
       
  5773 * 802.1 h SNAP header
       
  5774 */
       
  5775 const SSnapHeader KEncapsulating802_1hSnapHeader 
       
  5776     = { 0xAA, 0xAA, 0x03, { 0x00, 0x00, 0xF8 } };
       
  5777 
       
  5778 /**
       
  5779 * 802.11 data frame encapsulation header
       
  5780 */ 
       
  5781 #pragma pack( 1 )
       
  5782 struct SDataFrameEncapsulationHeader
       
  5783     {
       
  5784     /** SNAP header */
       
  5785     SSnapHeader     iSnapHeader;    // 6    
       
  5786     } __PACKED;
       
  5787 
       
  5788 /**
       
  5789 * 802.11 data frame and its encapsulation header combined
       
  5790 */ 
       
  5791 #pragma pack( 1 )
       
  5792 struct SDataMpduHeader
       
  5793     {
       
  5794     /** Ctor */
       
  5795     SDataMpduHeader()
       
  5796         {
       
  5797         iEncHdr.iSnapHeader = KEncapsulatingRfc1042SnapHeader;
       
  5798         }
       
  5799 
       
  5800     /** 802.11 data frame header */
       
  5801     SDataFrameHeader iHdr;                  // 24 
       
  5802     /** 802.11 data frame encapsulation header */
       
  5803     SDataFrameEncapsulationHeader iEncHdr;  // 6
       
  5804     } __PACKED; // 30
       
  5805 
       
  5806 /*
       
  5807         802.2 SNAP DATA Frame 
       
  5808        +----------------+
       
  5809        |                |
       
  5810        |  Destination   |
       
  5811        |    6 bytes     |
       
  5812        +----------------+
       
  5813        |                |
       
  5814        |     Source     |
       
  5815        |    6 bytes     |
       
  5816        +----------------+
       
  5817        |  Frame Length  | Must be <= 1500 Dec.
       
  5818        |    2 bytes     |
       
  5819        +----------------+
       
  5820        |  DSAP - 1 byte | = 0xAA ( SNAP )
       
  5821        +----------------+
       
  5822        |  SSAP - 1 byte | = 0xAA ( SNAP )
       
  5823        +----------------+
       
  5824        |Control - 1 byte| = 0x03 
       
  5825        +----------------+ 
       
  5826        | OUI - 3 bytes  | = 0x0
       
  5827        |                | 
       
  5828        +----------------+
       
  5829        | Type - 2 bytes |  = Ethernet type (IP=0x0800)
       
  5830        +----------------+ 
       
  5831        |                | 
       
  5832        |      Data      |
       
  5833        |                |
       
  5834        ~                ~
       
  5835        ~                ~
       
  5836        |   46 to 1500   |
       
  5837        |     bytes      |
       
  5838        |                |
       
  5839        +----------------+
       
  5840        |      FCS       |
       
  5841        |    4 bytes     |
       
  5842        +----------------+
       
  5843 */
       
  5844 
       
  5845 /*
       
  5846 This is an Ethernet Version 2 frame:
       
  5847 
       
  5848        +--------------+
       
  5849        |              | The destination address is a six byte Media Access
       
  5850        | Destination  | Control (MAC) address, usually burned into the
       
  5851        |   6 bytes    | ROM of the Ethernet card.
       
  5852        +--------------+
       
  5853        |              | The source address is a six byte MAC address, and
       
  5854        |   Source     | can signify a physical station or a broadcast.
       
  5855        |   6 bytes    |
       
  5856        +--------------+
       
  5857        |     Type     | The Type field it must be grater then 1500 dec.
       
  5858        |    2 bytes   |
       
  5859        +--------------+
       
  5860        |              |  Any higher layer information is placed in the
       
  5861        |    Data      |  data field, which could contain protocol
       
  5862        |              |  information or user data.
       
  5863        ~              ~
       
  5864        ~              ~
       
  5865        |  46 to 1500  |
       
  5866        |    bytes     |
       
  5867        |              |
       
  5868        +--------------+
       
  5869        |     FCS      |  
       
  5870        |   4 bytes    |  
       
  5871        +--------------+  
       
  5872                          
       
  5873 */
       
  5874 
       
  5875 /**
       
  5876 * 802.11 QoS data frame and its encapsulation header combined
       
  5877 */ 
       
  5878 #pragma pack( 1 )
       
  5879 struct SQosDataMpduHeader
       
  5880     {
       
  5881     /** Ctor */
       
  5882     SQosDataMpduHeader()
       
  5883         {
       
  5884         iEncHdr.iSnapHeader = KEncapsulatingRfc1042SnapHeader;
       
  5885         }
       
  5886 
       
  5887     /** 802.11 QoS data frame header */
       
  5888     SQosDataFrameHeader iHdr;               // 26 
       
  5889     /** 802.11 data frame encapsulation header */
       
  5890     SDataFrameEncapsulationHeader iEncHdr;  // 6
       
  5891     } __PACKED; // 33
       
  5892 
       
  5893 const TUint16 KUint16HiByteMask = 0xFF00;
       
  5894 
       
  5895 /**
       
  5896 * Ethernet 14-byte Header (RFC 894)
       
  5897 */
       
  5898 #pragma pack( 1 )
       
  5899 struct SEthernetHeader 
       
  5900     {
       
  5901     /** destination MAC address */
       
  5902     TMacAddress iDA;    // 6
       
  5903     /** source MAC address */
       
  5904     TMacAddress iSA;    // 6
       
  5905     /** ethernet type field */
       
  5906     TUint16     iType;  // 2
       
  5907 
       
  5908     /**
       
  5909     * Returns the Ethernet Type
       
  5910     * @return ethernet type
       
  5911     */
       
  5912     inline TUint16 Type() const;
       
  5913 
       
  5914 private:
       
  5915 
       
  5916     /** Prohibit default contructor */
       
  5917     SEthernetHeader();
       
  5918     /** Prohibit assignment operator */
       
  5919     SEthernetHeader& operator= ( const SEthernetHeader& );
       
  5920     /** Prohibit copy constructor */
       
  5921     SEthernetHeader( const SEthernetHeader& );
       
  5922     } __PACKED;
       
  5923 
       
  5924 // ---------------------------------------------------------------------------
       
  5925 // We need to reverse the byte order as the IP world uses different byter 
       
  5926 // order (MSB first) as WLAN MAC layer (LSB first)
       
  5927 // ---------------------------------------------------------------------------
       
  5928 //
       
  5929 inline TUint16 SEthernetHeader::Type() const
       
  5930     {
       
  5931     return ReverseUint16( ReadUint16Toh( &iType ) );
       
  5932     }
       
  5933 
       
  5934 /**
       
  5935 * Ethernet type field
       
  5936 */
       
  5937 #pragma pack( 1 )
       
  5938 struct SEthernetType
       
  5939     {
       
  5940     /** type field */    
       
  5941     TUint16     iType;      // 2
       
  5942 
       
  5943     /**
       
  5944     * Returns the Ethernet Type
       
  5945     * @return ethernet type
       
  5946     */
       
  5947     inline TUint16 Type() const;    
       
  5948 
       
  5949 private:
       
  5950 
       
  5951     /** Prohibit default contructor */
       
  5952     SEthernetType();
       
  5953     /** Prohibit assignment operator */
       
  5954     SEthernetType& operator= ( const SEthernetType& );
       
  5955     /** Prohibit copy constructor */
       
  5956     SEthernetType( const SEthernetType& );
       
  5957     } __PACKED;
       
  5958 
       
  5959 // ---------------------------------------------------------------------------
       
  5960 // We need to reverse the byte order as the IP world uses different byte 
       
  5961 // order (MSB first) as WLAN MAC layer (LSB first)
       
  5962 // ---------------------------------------------------------------------------
       
  5963 //
       
  5964 inline TUint16 SEthernetType::Type() const
       
  5965     {
       
  5966     return ReverseUint16( ReadUint16Toh( &iType ) );
       
  5967     }
       
  5968 
       
  5969 
       
  5970 // pop the pragma pack stack to return to normal alignment of structures
       
  5971 #pragma pack( ) 
       
  5972 
       
  5973 #endif      // WLAN802DOT11_H