1 /* |
|
2 * Copyright (c) 2005-2006 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 "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 |
|
21 #ifndef WLAN802DOT11_H |
|
22 #define WLAN802DOT11_H |
|
23 |
|
24 // for copy, equal and operator != support |
|
25 #include "algorithm.h" |
|
26 #include "pack.h" |
|
27 |
|
28 // returns aDest |
|
29 extern |
|
30 TAny* os_memcpy( TAny* aDest, const TAny* aSrc, TUint32 aLengthinBytes ); |
|
31 // returns 0 if equal |
|
32 extern TInt |
|
33 os_memcmp( const TAny* aSrc1, const TAny* aSrc2, TUint aLengthinBytes ); |
|
34 |
|
35 /** |
|
36 * Returns a TUint16 host byte order value in WLAN MAC layer byte order |
|
37 * (LSB first) |
|
38 * |
|
39 * @since S60 3.1 |
|
40 * @param aNw value in network byte order |
|
41 * @return value in host byte order |
|
42 */ |
|
43 extern TUint16 os_Hton( TUint16 aHost ); |
|
44 |
|
45 /** |
|
46 * Returns a TUint16 WLAN MAC layer byte order (LSB first) value in host byte |
|
47 * order |
|
48 * |
|
49 * @since S60 3.1 |
|
50 * @param aNw value in network byte order |
|
51 * @return value in host byte order |
|
52 */ |
|
53 extern TUint16 os_Ntoh( TUint16 aNw ); |
|
54 |
|
55 /** |
|
56 * Allows also unaligned reading of a TUint16 WLAN MAC layer byte order |
|
57 * (LSB first) value and returns the result in the byte order which |
|
58 * is in use in the host |
|
59 * |
|
60 * @since S60 3.1 |
|
61 * @param aNwSource where to read the WLAN MAC layer byte order value from |
|
62 * @return the value which was read, in host byte order |
|
63 */ |
|
64 inline TUint16 ReadUint16Toh( const TUint16* aNwSource ) |
|
65 { |
|
66 return ( os_Ntoh( |
|
67 ( static_cast<const TUint16>( |
|
68 ( reinterpret_cast<const TUint8*>(aNwSource) )[0] ) | |
|
69 ( static_cast<const TUint16>( |
|
70 ( reinterpret_cast<const TUint8*>(aNwSource) )[1] ) << 8 ) ) ) ); |
|
71 } |
|
72 |
|
73 /** |
|
74 * Allows also unaligned writing of a TUint16 host byte order value |
|
75 * into WLAN MAC layer byte order |
|
76 * |
|
77 * @since S60 3.1 |
|
78 * @param aNwTarget where to write the WLAN MAC layer byte order value to |
|
79 * @param aHostValue the host byte order value to be written |
|
80 */ |
|
81 inline void WriteHtoUint16( TUint16* aNwTarget, TUint16 aHostValue ) |
|
82 { |
|
83 TUint16 nwValue = os_Hton( aHostValue ); |
|
84 reinterpret_cast<TUint8*>(aNwTarget)[0] = |
|
85 ( reinterpret_cast<TUint8*>(&nwValue) )[0]; |
|
86 reinterpret_cast<TUint8*>(aNwTarget)[1] = |
|
87 ( reinterpret_cast<TUint8*>(&nwValue) )[1]; |
|
88 } |
|
89 |
|
90 /** |
|
91 * Reverses the byte order of a TUint16 value |
|
92 * |
|
93 * @since S60 3.1 |
|
94 * @param aOriginal value whose byte order is to be reversed |
|
95 * @return the input parameter in reversed byte order |
|
96 */ |
|
97 inline TUint16 ReverseUint16( TUint16 aOriginal ) |
|
98 { |
|
99 return ( ( aOriginal >> 8 ) | ( aOriginal << 8 ) ); |
|
100 } |
|
101 |
|
102 |
|
103 /** |
|
104 * A measurement of time equal to 1024 µs. |
|
105 */ |
|
106 const TUint16 KTU = 1024; |
|
107 |
|
108 /** |
|
109 * Length of the MAC address |
|
110 */ |
|
111 const TUint8 KMacAddressLength = 6; |
|
112 |
|
113 /** |
|
114 * Length of MAC header |
|
115 */ |
|
116 const TUint8 KMacHeaderLength = 24; |
|
117 |
|
118 /** |
|
119 * Maximum number of 802.11b supported rates |
|
120 * 1, 2, 5.5, 11 MBit/s |
|
121 */ |
|
122 const TUint8 KMaxNumberOfDot11bRates = 4; |
|
123 |
|
124 /** |
|
125 * Maximum number of actual supported rate elements in |
|
126 * supported rates information element |
|
127 */ |
|
128 const TUint8 KMaxNumberOfRates = 8; |
|
129 |
|
130 /** |
|
131 * Maximum number of actual 802.11 supported rate elements in |
|
132 * extended supported rates information element |
|
133 */ |
|
134 const TUint8 KMaxNumberOfExtendedRates = 255; |
|
135 |
|
136 /** |
|
137 * Maximum number of 802.11b plus 802.11g supported rates |
|
138 */ |
|
139 const TUint8 KMaxNumberOfDot11bAndgRates = 14; |
|
140 |
|
141 /** |
|
142 * Bit mask for checking is supported rate element |
|
143 * part of BSS Basic Rate Set (MSB bit is set) |
|
144 */ |
|
145 const TUint8 KBasicRateMask = 0x80; |
|
146 |
|
147 /** |
|
148 * Maximum length for a WEP key in BYTES |
|
149 */ |
|
150 const TUint32 KMaxWEPKeyLength = 29; // 232 bits |
|
151 |
|
152 /** |
|
153 * Length of TKIP key; |
|
154 */ |
|
155 const TUint8 KTKIPKeyLength = 16; |
|
156 |
|
157 /** |
|
158 * Length of WEP Init.Vector in BYTES |
|
159 */ |
|
160 const TUint8 KWepIVLength = 4; |
|
161 |
|
162 /** |
|
163 * Length of WEP ICV in BYTES |
|
164 */ |
|
165 const TUint8 KWEPICVLength = 4; |
|
166 |
|
167 /** |
|
168 * Length of Extended IV field in bytes. |
|
169 */ |
|
170 const TUint8 KWepExtendedIVLength = 4; |
|
171 |
|
172 /** |
|
173 * Mask to determine is Ext IV bit up in WEP IV |
|
174 */ |
|
175 const TUint32 KWepExtendedIvMask = 0x20000000; |
|
176 |
|
177 /** |
|
178 * Mask for Use Protection bit in ERP Information IE |
|
179 */ |
|
180 const TUint8 KUseProtectionMask = 0x02; |
|
181 |
|
182 /** |
|
183 * Length of MIC in BYTEs |
|
184 */ |
|
185 const TUint8 KMicLength = 8; |
|
186 |
|
187 /** |
|
188 * Length of the MIC key in BYTEs |
|
189 */ |
|
190 const TUint8 KMicKeyLength = 8; |
|
191 |
|
192 /** |
|
193 * Maximum length of a SSID in BYTES |
|
194 */ |
|
195 const TUint8 KMaxSSIDLength = 32; |
|
196 |
|
197 /** |
|
198 * Maximum length of an outbound RSN IE length in BYTEs |
|
199 */ |
|
200 const TUint8 KMaxTxRsnIELength = 38; |
|
201 |
|
202 /** |
|
203 * Length of ID and Length fields of an information element. |
|
204 */ |
|
205 const TUint8 KInfoElementHeaderLength = 2; |
|
206 |
|
207 /** |
|
208 * Length of the challenge text in BYTES used in shared key authentication |
|
209 */ |
|
210 const TUint8 KChallengeTextLength = 128; |
|
211 |
|
212 /** |
|
213 * Ethernet header type field identifier for Bounce type packet |
|
214 */ |
|
215 const TUint16 KBounceType = 0x8013; |
|
216 |
|
217 /** |
|
218 * Ethernet header type field identifier for EAPOL type packet (IEEE 802.1X) |
|
219 */ |
|
220 const TUint16 KEapolType = 0x888E; |
|
221 |
|
222 /** |
|
223 * Ethernet header type field identifier for IP type packet |
|
224 */ |
|
225 const TUint16 KIpType = 0x0800; |
|
226 |
|
227 /** |
|
228 * Ethernet header type field identifier for IPv6 type packet |
|
229 */ |
|
230 const TUint16 KIpv6Type = 0x86DD; |
|
231 |
|
232 /** |
|
233 * Ethernet header type field identifier for ARP type packet |
|
234 */ |
|
235 const TUint16 KArpType = 0x0806; |
|
236 |
|
237 /** |
|
238 * Maks for determining does PLCP header service field have PBCC bit set |
|
239 */ |
|
240 const TUint8 KPlcpServicePbccMask = 0x08; |
|
241 |
|
242 /** |
|
243 * Length of OUI field in SNAP header |
|
244 */ |
|
245 const TUint8 KOIULength = 3; |
|
246 |
|
247 /** |
|
248 * Maximum length of 802.11 Frame Body field |
|
249 */ |
|
250 const TUint16 KMaxDot11FrameBodyLength = 2312; |
|
251 |
|
252 /** |
|
253 * Length of trailing FCS in bytes |
|
254 */ |
|
255 const TUint32 KFcsLength = 4; |
|
256 |
|
257 /** |
|
258 * Maximum length of 802.11 frame we will transmit or receive. |
|
259 * This excludes the tailing FCS ( HW strips it ) |
|
260 * and Address4 field in the MPDU header |
|
261 * ( AP-to-AP mode frames are filtered out ) |
|
262 */ |
|
263 const TUint16 KMaxDot11FrameLength = KMacHeaderLength |
|
264 + KMaxDot11FrameBodyLength; // 24 + 2312 = 2336 |
|
265 |
|
266 /** |
|
267 * Maximum length of 802.11 frame as stated in the standard |
|
268 */ |
|
269 const TUint16 KDot11MPDUMaxLength = 2346; |
|
270 |
|
271 /** |
|
272 * Maximum length of ethernet frame |
|
273 */ |
|
274 const TUint16 KMaxEthernetFrameLength = 1514; |
|
275 |
|
276 /** |
|
277 * Maximum value in ethernet length field |
|
278 */ |
|
279 const TUint16 KMaxEthernetLengthFieldvalue = 1500; |
|
280 |
|
281 /** |
|
282 * Length of the TKIP key in BYTEs |
|
283 */ |
|
284 const TUint8 KTkIpKeyLength = 16; |
|
285 |
|
286 /** |
|
287 * Length of IPv4 address field in BYTEs |
|
288 */ |
|
289 const TUint8 KIpv4AddrLength = 4; |
|
290 |
|
291 /** |
|
292 * Length of the priority filed used in WPA MIC calculation |
|
293 */ |
|
294 const TUint32 KWpaPriorityVecLen = 4; |
|
295 |
|
296 /** |
|
297 * WPA priority field used in MIC calculation |
|
298 */ |
|
299 const TUint8 KWpaPriorityVec[KWpaPriorityVecLen] = {0,0,0,0}; |
|
300 |
|
301 /** |
|
302 * Mask for frame type for frame control field. |
|
303 */ |
|
304 const TUint32 K802Dot11FrameTypeMask = 0xFFFF; |
|
305 |
|
306 /** |
|
307 * Mask to determine if U-APSD bit is up in QoS info field of WMM IE |
|
308 */ |
|
309 const TUint8 KUapsdQosInfoMask = 0x80; |
|
310 |
|
311 /** |
|
312 * Mask for parameter set count in QoS info field of WMM IE |
|
313 */ |
|
314 const TUint8 KParamSetCountQosInfoMask = 0x0F; |
|
315 |
|
316 /** |
|
317 * Length of WMM Information Element |
|
318 */ |
|
319 const TUint8 KWmmInfoElemLen = 7; |
|
320 |
|
321 /** |
|
322 * Length of OUI field in Information Elements |
|
323 */ |
|
324 const TUint8 KIeOuiLength = 3; |
|
325 |
|
326 typedef TUint8 TIeOui[KIeOuiLength]; |
|
327 |
|
328 /** |
|
329 * OUI value of WMM Information Element and |
|
330 * WMM Parameter Element |
|
331 */ |
|
332 const TIeOui KWmmElemOui = { 0x00, 0x50, 0xF2 }; |
|
333 |
|
334 /** |
|
335 * OUI Type value of WMM Information Element and |
|
336 * WMM Parameter Element |
|
337 */ |
|
338 const TUint8 KWmmElemOuiType = 2; |
|
339 |
|
340 /** |
|
341 * OUI Subtype value of WMM Information Element |
|
342 */ |
|
343 const TUint8 KWmmInfoElemOuiSubType = 0; |
|
344 |
|
345 /** |
|
346 * OUI Subtype value of WMM Parameter Element |
|
347 */ |
|
348 const TUint8 KWmmParamElemOuiSubtype = 1; |
|
349 |
|
350 /** |
|
351 * Version of WMM Information Element |
|
352 */ |
|
353 const TUint8 KWmmInfoElemVersion = 1; |
|
354 |
|
355 /** |
|
356 * Version of WMM Parameter Element |
|
357 */ |
|
358 const TUint8 KWmmParamElemVersion = 1; |
|
359 |
|
360 /** |
|
361 * The TXOP Limit in the AC Parameters Record of WMM Parameter Element |
|
362 * needs to be multiplied by this value to get TXOP Limit in microseconds |
|
363 */ |
|
364 const TUint8 KWmmTxOpLimitMultiplier = 32; |
|
365 |
|
366 /** |
|
367 * AC flags in QoS info field of WMM IE |
|
368 * When a flag is set the corresponding AC is both trigger and delivery enabled |
|
369 */ |
|
370 enum TQosInfoUapsdFlag |
|
371 { |
|
372 EAcVoUapsdFlag = 0x01, // Voice |
|
373 EAcViUapsdFlag = 0x02, // Video |
|
374 EAcBkUapsdFlag = 0x04, // Background |
|
375 EAcBeUapsdFlag = 0x08 // Best Effort |
|
376 }; |
|
377 |
|
378 |
|
379 /** |
|
380 * Maximum U-APSD Service Period length. Indicates the max number of MSDUs and |
|
381 * MMPDUs the WMM AP may deliver to a WMM STA during any service period |
|
382 * triggered by the WMM STA. |
|
383 */ |
|
384 enum TQosInfoUapsdMaxSpLen |
|
385 { |
|
386 EMaxSpLenAllFrames = 0x00, |
|
387 EMaxSpLenTwoFrames = 0x20, |
|
388 EMaxSpLenFourFrames = 0x40, |
|
389 EMaxSpLenSixFrames = 0x60 |
|
390 }; |
|
391 |
|
392 const TUint8 K802Dot11AccessCategoryMask = 0x60; |
|
393 |
|
394 /** |
|
395 * WMM Access Categories |
|
396 */ |
|
397 enum TWmmAccessCategory |
|
398 { |
|
399 EAcBestEffort = 0x00, |
|
400 EAcBackground = 0x20, |
|
401 EAcVideo = 0x40, |
|
402 EAcVoice = 0x60 |
|
403 }; |
|
404 |
|
405 /** |
|
406 * Number of WMM Access Categories |
|
407 */ |
|
408 const TUint8 KNumOfWmmACs = 4; |
|
409 |
|
410 /** |
|
411 * Mask for the Admission Control Mandatory flag |
|
412 * in ACI/AIFSN field |
|
413 * of AC parameter Record |
|
414 * of WMM Parameter Element |
|
415 */ |
|
416 const TUint8 KWmmAdmissionCtrlMandatoryMask = 0x10; |
|
417 |
|
418 /** |
|
419 * Mask for the AIFSN subfiled |
|
420 * in ACI/AIFSN field |
|
421 * of AC parameter Record |
|
422 * of WMM Parameter Element |
|
423 */ |
|
424 const TUint8 KWmmAifsnMask = 0x0F; |
|
425 |
|
426 /** |
|
427 * Mask for the ECWmin field |
|
428 * of AC parameter Record |
|
429 * of WMM Parameter Element |
|
430 */ |
|
431 const TUint8 KWmmEcwMinMask = 0x0F; |
|
432 |
|
433 /** |
|
434 * Mask for the ECWmax field |
|
435 * of AC parameter Record |
|
436 * of WMM Parameter Element |
|
437 */ |
|
438 const TUint8 KWmmEcwMaxMask = 0xF0; |
|
439 |
|
440 /** |
|
441 * 802.11 Authentication sequence numbers |
|
442 */ |
|
443 enum T802Dot11AuthenticationSeqNmbr |
|
444 { |
|
445 E802Dot11AuthenticationSeqNmbr1 = 1, |
|
446 E802Dot11AuthenticationSeqNmbr2 = 2, |
|
447 E802Dot11AuthenticationSeqNmbr3 = 3, |
|
448 E802Dot11AuthenticationSeqNmbr4 = 4 |
|
449 }; |
|
450 |
|
451 /** |
|
452 * 802.11 WEP key ID values |
|
453 */ |
|
454 enum T802Dot11WepKeyId |
|
455 { |
|
456 E802Dot11WepKeyId0 = 0, |
|
457 E802Dot11WepKeyId1 = 1, |
|
458 E802Dot11WepKeyId2 = 2, |
|
459 E802Dot11WepKeyId3 = 3, |
|
460 // defined as an upper bound |
|
461 E802Dot11WepKeyIdMax = 4 |
|
462 }; |
|
463 |
|
464 /** |
|
465 * 802.11 supported rate bytes. Used e.g. in Beacon frames. |
|
466 */ |
|
467 enum T802Dot11SupportedRate |
|
468 { |
|
469 E802Dot11Rate1MBit = 2, |
|
470 E802Dot11Rate2MBit = 4, |
|
471 E802Dot11Rate5p5MBit = 11, |
|
472 E802Dot11Rate6MBit = 12, |
|
473 E802Dot11Rate9MBit = 18, |
|
474 E802Dot11Rate11MBit = 22, |
|
475 E802Dot11Rate12MBit = 24, |
|
476 E802Dot11Rate18MBit = 36, |
|
477 E802Dot11Rate22MBit = 44, |
|
478 E802Dot11Rate24MBit = 48, |
|
479 E802Dot11Rate33MBit = 66, |
|
480 E802Dot11Rate36MBit = 72, |
|
481 E802Dot11Rate48MBit = 96, |
|
482 E802Dot11Rate54MBit = 108 |
|
483 }; |
|
484 |
|
485 /** |
|
486 * Management frame information element IDs. |
|
487 */ |
|
488 enum T802Dot11InformationElementID |
|
489 { |
|
490 E802Dot11SsidIE = 0, |
|
491 E802Dot11SupportedRatesIE = 1, |
|
492 E802Doi11FhParameterSetIE = 2, |
|
493 E802Dot11DsParameterSetIE = 3, |
|
494 E802Dot11CfParameterSetIE = 4, |
|
495 E802Dot11TimIE = 5, |
|
496 E802Dot11IbssParameterSetIE = 6, |
|
497 E802Dot11CountryIE = 7, |
|
498 E802Dot11HoppingPatternParamIE = 8, |
|
499 E802Dot11HoppingPatternTableIE = 9, |
|
500 E802Dot11RequestIE = 10, |
|
501 |
|
502 E802Dot11ChallengeTextIE = 16, |
|
503 // Reserved for challenge text extension 17 - 31 |
|
504 E802Dot11ErpInformationIE = 42, |
|
505 E802Dot11ExtendedRatesIE = 50, |
|
506 E802Dot11RsnIE = 221, |
|
507 E802Dot11VendorSpecificIE = 221 |
|
508 }; |
|
509 |
|
510 /** |
|
511 * Bit masks for bit fields ín Frame Control field. |
|
512 */ |
|
513 enum T802Dot11FrameControlBitMask |
|
514 { |
|
515 E802Dot11FrameControlProtVersionMask= 0x0003, |
|
516 E802Dot11FrameControlTypeMask = 0x000C, |
|
517 E802Dot11FrameControlSubtypeMask = 0x00F0, |
|
518 E802Dot11FrameControlToDsMask = 0x0100, |
|
519 E802Dot11FrameControlFromDsMask = 0x0200, |
|
520 E802Dot11FrameControlMoreFragMask = 0x0400, |
|
521 E802Dot11FrameControlRetryMask = 0x0800, |
|
522 E802Dot11FrameControlPowerMgmtMask = 0x1000, |
|
523 E802Dot11FrameControlMoreDataMask = 0x2000, |
|
524 E802Dot11FrameControlWepMask = 0x4000, |
|
525 E802Dot11FrameControlOrderMask = 0x8000 |
|
526 }; |
|
527 |
|
528 /** |
|
529 * Frame Control field type masks. |
|
530 */ |
|
531 enum T802Dot11FrameControlBasicTypeMask |
|
532 { |
|
533 E802Dot11FrameBasicTypeManagement = 0x00, |
|
534 E802Dot11FrameBasicTypeControl = 0x04, |
|
535 E802Dot11FrameBasicTypeData = 0x08 |
|
536 }; |
|
537 |
|
538 /** |
|
539 * Frame Control field subtype masks. |
|
540 */ |
|
541 enum T802Dot11FrameControlTypeMask |
|
542 { |
|
543 E802Dot11FrameTypeAssociationReq = 0x00, |
|
544 E802Dot11FrameTypeAssociationResp = 0x10, |
|
545 E802Dot11FrameTypeReassociationReq = 0x20, |
|
546 E802Dot11FrameTypeReassociationResp = 0x30, |
|
547 E802Dot11FrameTypeProbeReq = 0x40, |
|
548 E802Dot11FrameTypeProbeResp = 0x50, |
|
549 E802Dot11FrameTypeBeacon = 0x80, |
|
550 E802Dot11FrameTypeAtim = 0x90, |
|
551 E802Dot11FrameTypeDisassociation = 0xA0, |
|
552 E802Dot11FrameTypeAuthentication = 0xB0, |
|
553 E802Dot11FrameTypeDeauthentication = 0xC0, |
|
554 E802Dot11FrameTypePowerSavePoll = 0xA4, |
|
555 E802Dot11FrameTypeReqToSend = 0xB4, |
|
556 E802Dot11FrameTypeClearToSend = 0xC4, |
|
557 E802Dot11FrameTypeAcknowledgement = 0xD4, |
|
558 E802Dot11FrameTypeCfEnd = 0xE4, |
|
559 E802Dot11FrameTypeCfEndCfAck = 0xF4, |
|
560 E802Dot11FrameTypeData = 0x08, |
|
561 E802Dot11FrameTypeDataCfAck = 0x18, |
|
562 E802Dot11FrameTypeDataCfPoll = 0x28, |
|
563 E802Dot11FrameTypeDataCfAckCfPoll = 0x38, |
|
564 E802Dot11FrameTypeDataNull = 0x48, |
|
565 E802Dot11FrameTypeCfAckNoData = 0x58, |
|
566 E802Dot11FrameTypeCfPollNoData = 0x68, |
|
567 E802Dot11FrameTypeCfAckCfPollNoData = 0x78, |
|
568 E802Dot11FrameTypeQosData = 0x88, |
|
569 E802Dot11FrameTypeQosDataCfAck = 0x98, |
|
570 E802Dot11FrameTypeQosDataCfPoll = 0xA8, |
|
571 E802Dot11FrameTypeQosDataCfAckCfPoll = 0xB8, |
|
572 E802Dot11FrameTypeQosDataNull = 0xC8, |
|
573 |
|
574 // not valid 802.11 types. |
|
575 // just used in TxCompleted function to distinct separate cases |
|
576 E802Dot11FrameTypeAuthSeqNmbr1 = 0xFD, |
|
577 E802Dot11FrameTypeAuthSeqNmbr3 = 0xFE, |
|
578 E802Dot11FrameTypeDataEapol = 0xFF, |
|
579 |
|
580 // not valid 802.11 types. |
|
581 // just for test purposes |
|
582 E802Dot11FrameTypeTestFrame = 0xFFFF |
|
583 }; |
|
584 |
|
585 /** |
|
586 * Bit masks for Capability Information field. |
|
587 */ |
|
588 enum T802Dot11CapabilityBitMask |
|
589 { |
|
590 E802Dot11CapabilityEssMask = 0x0001, |
|
591 E802Dot11CapabilityIbssMask = 0x0002, |
|
592 E802Dot11CapabilityCfPollableMask = 0x0004, |
|
593 E802Dot11CapabilityCfPollRequestMask= 0x0008, |
|
594 E802Dot11CapabilityPrivacyMask = 0x0010, |
|
595 // these little critters are from 802.11b spec |
|
596 E802Dot11ShortPreambleMask = 0x0020, |
|
597 E802Dot11PbccMask = 0x0040, |
|
598 E802Dot11ChannelAgilityMask = 0x0080, |
|
599 E802Dot11ShortSlotTimeMask = 0x0400 |
|
600 }; |
|
601 |
|
602 /** |
|
603 * Supported authentication modes |
|
604 */ |
|
605 const TUint16 K802Dot11AuthModeOpen = 0; |
|
606 const TUint16 K802Dot11AuthModeShared = 1; |
|
607 |
|
608 /** |
|
609 * 802.11 status codes |
|
610 */ |
|
611 enum T802Dot11ManagementStatusCode |
|
612 { |
|
613 E802Dot11StatusSuccess = 0, |
|
614 E802Dot11StatusUnspecifiedFailure = 1, |
|
615 // 2 -9 reserved |
|
616 E802Dot11StatusUnsupportedCapabilities = 10, |
|
617 E802Dot11StatusReAssociationDenied = 11, |
|
618 E802Dot11StatusAssocDenied = 12, |
|
619 E802Dot11StatusAuthAlgorithmNotSupported = 13, |
|
620 E802Dot11StatusAuthFrameOutOfSequence = 14, |
|
621 E802Dot11StatusChallengeFailure = 15, |
|
622 E802Dot11StatusAuthRejectedTimeout = 16, |
|
623 E802Dot11StatusAssocDeniedApFull = 17, |
|
624 E802Dot11StatusAssocDeniedBasicRatesUnSupp = 18, |
|
625 // following three little critters are from 802.11b spec |
|
626 E802Dot11StatusAssocDeniedShortPreambleUnSupp = 19, |
|
627 E802Dot11StatusAssocDeniedPbccUnSupp = 20, |
|
628 E802Dot11StatusAssocDeniedChannelAgilityUnSupp = 21 |
|
629 // 22 - 65,535 reserved |
|
630 }; |
|
631 |
|
632 /** |
|
633 * 802.11 reason codes |
|
634 */ |
|
635 enum T802Dot11ManagementReasonCode |
|
636 { |
|
637 // 0 reserved |
|
638 E802Dot11ReasonUnspecified = 1, |
|
639 E802Dot11ReasonAuthNoLongerValid = 2, |
|
640 E802Dot11ReasonDeauthStationLeft = 3, |
|
641 E802Dot11ReasonDisAssocInactivity = 4, |
|
642 E802Dot11ReasonDisAssocAPFull = 5, |
|
643 E802Dot11ReasonClass2FrameWhenNotAuth = 6, |
|
644 E802Dot11ReasonClass3FrameWhenNotAssoc = 7, |
|
645 E802Dot11ReasonDisAssocStationLeft = 8, |
|
646 E802Dot11ReasonAssocFailNotAuth = 9, |
|
647 // 10 - 12 reserved |
|
648 // WPA stuff |
|
649 E802Dot11ReasonInvalidIe = 13, |
|
650 E802Dot11ReasonMicFailure = 14, |
|
651 E802Dot11ReasonHandshakeTimeout = 15, |
|
652 E802Dot11ReasonGroupKeyUpdateTimeout = 16, |
|
653 E802Dot11ReasonIeMismatch = 17, |
|
654 E802Dot11ReasonMulticastChipherNotValid = 18, |
|
655 E802Dot11ReasonUnicastChipherNotValid = 19, |
|
656 E802Dot11ReasonAkmpNotValid = 20, |
|
657 E802Dot11ReasonUnsupportedRsneVersion = 21, |
|
658 E802Dot11ReasonInvalidRsneCapabilities = 22, |
|
659 E802Dot11Reason1xAuthenticationFailed = 23, |
|
660 // 24 - 65,535 reserved |
|
661 }; |
|
662 |
|
663 /** |
|
664 * 802.11 management frame fixed field and IE lengths in BYTEs |
|
665 */ |
|
666 const TUint32 KTimeStampFixedFieldLength = 8; |
|
667 const TUint32 KBeaconIntervalFixedFieldLength = 2; |
|
668 const TUint32 KCapabilityInformationFixedFieldLength = 2; |
|
669 const TUint32 KDsParameterSetIeLength = 3; |
|
670 const TUint32 KIbssParameterSetIeLength = 4; |
|
671 |
|
672 /** |
|
673 * The one and only MAC address struct |
|
674 */ |
|
675 #pragma pack( 1 ) |
|
676 struct TMacAddress |
|
677 { |
|
678 /** the MAC address */ |
|
679 TUint8 iMacAddress[KMacAddressLength]; |
|
680 } __PACKED; // 6 bytes |
|
681 |
|
682 /** |
|
683 * Broadcast MAC Address. |
|
684 */ |
|
685 const TMacAddress KBroadcastMacAddr = {{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }}; |
|
686 |
|
687 /** |
|
688 * MAC address that all zeros |
|
689 */ |
|
690 const TMacAddress KZeroMacAddr = {{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}; |
|
691 |
|
692 /** |
|
693 * operator== for TMacAddress |
|
694 * @param aLhs left hand side |
|
695 * @param aRhs right hand side |
|
696 * @return ETrue equal, EFalse not equal |
|
697 */ |
|
698 inline TBool operator== ( |
|
699 const TMacAddress& aLhs, const TMacAddress& aRhs ) |
|
700 { |
|
701 return ( equal( (aLhs.iMacAddress), |
|
702 (aLhs.iMacAddress) + KMacAddressLength, |
|
703 aRhs.iMacAddress) ); |
|
704 } |
|
705 |
|
706 /** |
|
707 * Sets or clears the group bit of the MAC address |
|
708 * @param aMac the address |
|
709 * @param aSet set or clear the bit |
|
710 */ |
|
711 inline void GroupBit( TMacAddress& aMac, TBool aSet = ETrue ) |
|
712 { |
|
713 if ( aSet ) |
|
714 { |
|
715 aMac.iMacAddress[0] |= KBit0; |
|
716 } |
|
717 else |
|
718 { |
|
719 aMac.iMacAddress[0] &= ~KBit0; |
|
720 } |
|
721 } |
|
722 |
|
723 /** |
|
724 * Evaluates if the group bit of the MAC address is set |
|
725 * @param aMac the address |
|
726 * @return ETrue if group bit is set EFalse in other case |
|
727 */ |
|
728 inline TBool IsGroupBitSet( const TMacAddress& aMac ) |
|
729 { |
|
730 return (aMac.iMacAddress[0] & KBit0); |
|
731 } |
|
732 |
|
733 /** |
|
734 * Sets or clears the local bit of the MAC address |
|
735 * @param aMac the address |
|
736 * @param aSet set or clear the bit |
|
737 */ |
|
738 inline void LocalBit( TMacAddress& aMac, TBool aSet = ETrue ) |
|
739 { |
|
740 if ( aSet ) |
|
741 { |
|
742 aMac.iMacAddress[0] |= KBit1; |
|
743 } |
|
744 else |
|
745 { |
|
746 aMac.iMacAddress[0] &= ~KBit1; |
|
747 } |
|
748 } |
|
749 |
|
750 /** |
|
751 * Evaluates if the local bit of the MAC address is set |
|
752 * @param aMac the address |
|
753 * @return ETrue if group bit is set EFalse in other case |
|
754 */ |
|
755 inline TBool IsLocalBitSet( const TMacAddress& aMac ) |
|
756 { |
|
757 return (aMac.iMacAddress[0] & KBit1); |
|
758 } |
|
759 |
|
760 /** |
|
761 * 802.11 information element header |
|
762 */ |
|
763 #pragma pack( 1 ) |
|
764 struct SInformationElementHeader |
|
765 { |
|
766 /** the element ID */ |
|
767 const TUint8 iElementID; |
|
768 /** length of the following IE */ |
|
769 TUint8 iLength; |
|
770 |
|
771 /** |
|
772 * Ctor |
|
773 * @param aElementID element ID used |
|
774 */ |
|
775 explicit SInformationElementHeader( |
|
776 T802Dot11InformationElementID aElementID ) |
|
777 : iElementID( static_cast<TUint8>(aElementID) ), iLength( 0 ) {}; |
|
778 /** |
|
779 * Ctor |
|
780 * @param aElementID element ID used |
|
781 * @param aLength length of the information element following this header |
|
782 */ |
|
783 SInformationElementHeader( T802Dot11InformationElementID aElementID, |
|
784 const TUint8 aLength ) |
|
785 : iElementID( static_cast<TUint8>(aElementID) ), iLength( aLength ) {}; |
|
786 |
|
787 private: |
|
788 |
|
789 /** Prohibit assignment operator */ |
|
790 SInformationElementHeader& operator= ( const SInformationElementHeader& ); |
|
791 /** Prohibit copy constructor */ |
|
792 SInformationElementHeader( const SInformationElementHeader& ); |
|
793 } __PACKED; // 2 bytes |
|
794 |
|
795 /** |
|
796 * operator== for SInformationElementHeader |
|
797 * @param aLhs left hand side |
|
798 * @param aRhs right hand side |
|
799 * @return ETrue equal, EFalse not equal |
|
800 */ |
|
801 inline TBool operator== ( |
|
802 const SInformationElementHeader& aLhs, |
|
803 const SInformationElementHeader& aRhs ) |
|
804 { |
|
805 return static_cast<TBool>(( aLhs.iElementID == aRhs.iElementID |
|
806 && aLhs.iLength == aRhs.iLength )); |
|
807 } |
|
808 |
|
809 /** |
|
810 * 802.11 SSID information element |
|
811 */ |
|
812 #pragma pack( 1 ) |
|
813 struct SSsIdIE |
|
814 { |
|
815 /** information element header */ |
|
816 SInformationElementHeader iHeader; // 2 bytes |
|
817 /** SSID information element */ |
|
818 TUint8 iSsIdIe[KMaxSSIDLength]; // 32 bytes |
|
819 |
|
820 /** |
|
821 * Ctor |
|
822 */ |
|
823 inline SSsIdIE() : iHeader( E802Dot11SsidIE ) {}; |
|
824 |
|
825 /** |
|
826 * Ctor |
|
827 * @param aData pointer to SSID |
|
828 * @param aLength length of aData |
|
829 */ |
|
830 inline SSsIdIE( const TUint8* aData, TUint8 aLength ); |
|
831 |
|
832 /** |
|
833 * Returns information elements length ( the element + its header ) |
|
834 * @return see above |
|
835 */ |
|
836 TUint8 GetIeLength() const { return static_cast<TUint8>( |
|
837 (iHeader.iLength + sizeof( SInformationElementHeader ) ) ); } |
|
838 |
|
839 private: |
|
840 |
|
841 /** Prohibit assignment operator */ |
|
842 SSsIdIE& operator= ( const SSsIdIE& ); |
|
843 /** Prohibit copy constructor */ |
|
844 SSsIdIE( const SSsIdIE& ); |
|
845 } __PACKED; // 34 bytes |
|
846 |
|
847 // --------------------------------------------------------------------------- |
|
848 // |
|
849 // --------------------------------------------------------------------------- |
|
850 // |
|
851 inline SSsIdIE::SSsIdIE( const TUint8* aData, TUint8 aLength ) |
|
852 : iHeader( E802Dot11SsidIE ) |
|
853 { |
|
854 iHeader.iLength = aLength; |
|
855 os_memcpy( &(iSsIdIe[0]), aData, aLength ); |
|
856 } |
|
857 |
|
858 /** |
|
859 * operator== for SSsIdIE |
|
860 * @param aLhs left hand side |
|
861 * @param aRhs right hand side |
|
862 * @return ETrue equal EFalse not equal |
|
863 */ |
|
864 inline TBool operator== ( |
|
865 const SSsIdIE& aLhs, |
|
866 const SSsIdIE& aRhs) |
|
867 { |
|
868 return static_cast<TBool>(( ( aLhs.iHeader == aRhs.iHeader ) |
|
869 && !(os_memcmp( aLhs.iSsIdIe, aRhs.iSsIdIe, aLhs.iHeader.iLength )) )); |
|
870 } |
|
871 |
|
872 /** |
|
873 * 802.11 supported rates information element |
|
874 */ |
|
875 #pragma pack( 1 ) |
|
876 struct SSupportedRatesIE |
|
877 { |
|
878 /** information element header */ |
|
879 SInformationElementHeader iHeader; // 2 |
|
880 /** |
|
881 * supported rates information element |
|
882 * NOTE! The 802.11 standard specifies that the max length of the |
|
883 * information part of this IE is eight rates (eight bytes). |
|
884 * However at least some APs seem to put all their supported rates |
|
885 * into this element. In order to be able to associate with those |
|
886 * APs we allocate enough space to incorporate all 802.11b/g rates |
|
887 * in this IE. We ourselves will still always advertise max eight |
|
888 * rates using this IE (and the rest using the Extended Supported |
|
889 * Rates IE). |
|
890 */ |
|
891 TUint8 iSupportedRatesIE[KMaxNumberOfDot11bAndgRates]; // 14 |
|
892 |
|
893 /** |
|
894 * Ctor |
|
895 */ |
|
896 SSupportedRatesIE() |
|
897 : iHeader( E802Dot11SupportedRatesIE, KMaxNumberOfRates ) {}; |
|
898 |
|
899 /** |
|
900 * operator[] to get supported rates element at given index |
|
901 * @param aIdx index to be get |
|
902 * @return value in given index |
|
903 */ |
|
904 inline TUint8 operator[] ( TUint8 aIdx ) const; |
|
905 |
|
906 /** |
|
907 * sets IE data also sets the IE headers length field |
|
908 * @param aIeData actual IE data |
|
909 * @param aLength length of aIeData |
|
910 */ |
|
911 inline void SetIeData( const TUint8* aIeData, const TUint8 aLength); |
|
912 |
|
913 /** |
|
914 * Returns information element's actual length |
|
915 * ( element's size + its header ) |
|
916 * @return see above |
|
917 */ |
|
918 inline TUint8 GetIeLength() const; |
|
919 |
|
920 /** |
|
921 * Returns only the information element's actual length ( header excluded ) |
|
922 * @return see above |
|
923 */ |
|
924 inline TUint8 GetElementLength() const; |
|
925 |
|
926 /** Marks IE zero length size */ |
|
927 inline void Clear(); |
|
928 |
|
929 /** |
|
930 * Appends a single rate element to IE |
|
931 * @param aRate rate element to be appended |
|
932 */ |
|
933 inline void Append( TUint8 aRate ); |
|
934 |
|
935 private: |
|
936 |
|
937 /** Prohibit assignment operator */ |
|
938 SSupportedRatesIE& operator= ( const SSupportedRatesIE& ); |
|
939 /** Prohibit copy constructor */ |
|
940 SSupportedRatesIE( const SSupportedRatesIE& ); |
|
941 } __PACKED; // 16 bytes |
|
942 |
|
943 // --------------------------------------------------------------------------- |
|
944 // |
|
945 // --------------------------------------------------------------------------- |
|
946 // |
|
947 inline void SSupportedRatesIE::SetIeData( |
|
948 const TUint8* aIeData, |
|
949 const TUint8 aLength) |
|
950 { |
|
951 iHeader.iLength = aLength; |
|
952 os_memcpy( iSupportedRatesIE, aIeData, aLength ); |
|
953 } |
|
954 |
|
955 // --------------------------------------------------------------------------- |
|
956 // |
|
957 // --------------------------------------------------------------------------- |
|
958 // |
|
959 inline TUint8 SSupportedRatesIE::operator[] ( TUint8 aIdx ) const |
|
960 { |
|
961 return iSupportedRatesIE[aIdx]; |
|
962 } |
|
963 |
|
964 // --------------------------------------------------------------------------- |
|
965 // |
|
966 // --------------------------------------------------------------------------- |
|
967 // |
|
968 inline TUint8 SSupportedRatesIE::GetIeLength() const |
|
969 { |
|
970 return static_cast<TUint8>( |
|
971 ( iHeader.iLength + sizeof( SInformationElementHeader ) ) ); |
|
972 } |
|
973 |
|
974 // --------------------------------------------------------------------------- |
|
975 // |
|
976 // --------------------------------------------------------------------------- |
|
977 // |
|
978 inline TUint8 SSupportedRatesIE::GetElementLength() const |
|
979 { |
|
980 return iHeader.iLength; |
|
981 } |
|
982 |
|
983 // --------------------------------------------------------------------------- |
|
984 // |
|
985 // --------------------------------------------------------------------------- |
|
986 // |
|
987 inline void SSupportedRatesIE::Clear() |
|
988 { |
|
989 iHeader.iLength = 0; |
|
990 } |
|
991 |
|
992 // --------------------------------------------------------------------------- |
|
993 // |
|
994 // --------------------------------------------------------------------------- |
|
995 // |
|
996 inline void SSupportedRatesIE::Append( TUint8 aRate ) |
|
997 { |
|
998 iSupportedRatesIE[iHeader.iLength] = aRate; |
|
999 ++(iHeader.iLength); |
|
1000 } |
|
1001 |
|
1002 /** |
|
1003 * operator== for SSupportedRatesIE |
|
1004 * @param aLhs left hand side |
|
1005 * @param aRhs right hand side |
|
1006 * @return ETrue equal, EFalse not equal |
|
1007 */ |
|
1008 inline TBool operator== ( |
|
1009 const SSupportedRatesIE& aLhs, |
|
1010 const SSupportedRatesIE& aRhs ) |
|
1011 { |
|
1012 return static_cast<TBool>(( ( aLhs.iHeader == aRhs.iHeader ) |
|
1013 && !(os_memcmp( aLhs.iSupportedRatesIE, |
|
1014 aRhs.iSupportedRatesIE, aLhs.iHeader.iLength )) )); |
|
1015 } |
|
1016 |
|
1017 /** |
|
1018 * 802.11 extended supported rates information element |
|
1019 */ |
|
1020 #pragma pack( 1 ) |
|
1021 struct SExtendedSupportedRatesIE |
|
1022 { |
|
1023 enum { KPad = 1 }; |
|
1024 /** information element header */ |
|
1025 SInformationElementHeader iHeader; // 2 |
|
1026 /** supported rates information element */ |
|
1027 TUint8 iSupportedRatesIE[KMaxNumberOfExtendedRates]; // 255 |
|
1028 /** padding */ |
|
1029 TUint8 iPad[KPad]; // 1 |
|
1030 |
|
1031 /** |
|
1032 * Ctor |
|
1033 */ |
|
1034 SExtendedSupportedRatesIE() |
|
1035 : iHeader( E802Dot11ExtendedRatesIE, KMaxNumberOfExtendedRates ) {}; |
|
1036 |
|
1037 /** |
|
1038 * operator[] to get supported rates element at given index |
|
1039 * @param aIdx index to be get |
|
1040 * @return value in given index |
|
1041 */ |
|
1042 inline TUint8 operator[] ( TUint8 aIdx ) const; |
|
1043 |
|
1044 /** |
|
1045 * sets IE data also sets the IE headers length field |
|
1046 * @param aIeData actual IE data |
|
1047 * @param aLength length of aIeData |
|
1048 */ |
|
1049 inline void SetIeData( const TUint8* aIeData, const TUint8 aLength); |
|
1050 |
|
1051 /** |
|
1052 * Returns information element's actual length |
|
1053 * ( element's size + its header ) |
|
1054 * @return see above |
|
1055 */ |
|
1056 inline TUint8 GetIeLength() const; |
|
1057 |
|
1058 /** |
|
1059 * Returns only the information element's actual length ( header excluded ) |
|
1060 * @return see above |
|
1061 */ |
|
1062 inline TUint8 GetElementLength() const; |
|
1063 |
|
1064 /** Marks IE zero length size */ |
|
1065 inline void Clear(); |
|
1066 |
|
1067 /** |
|
1068 * Appends a single rate element to IE |
|
1069 * @param aRate rate element to be appended |
|
1070 */ |
|
1071 inline void Append( TUint8 aRate ); |
|
1072 |
|
1073 private: |
|
1074 |
|
1075 /** Prohibit assignment operator */ |
|
1076 SExtendedSupportedRatesIE& operator= ( const SExtendedSupportedRatesIE& ); |
|
1077 /** Prohibit copy constructor */ |
|
1078 SExtendedSupportedRatesIE( const SExtendedSupportedRatesIE& ); |
|
1079 } __PACKED; |
|
1080 |
|
1081 // --------------------------------------------------------------------------- |
|
1082 // |
|
1083 // --------------------------------------------------------------------------- |
|
1084 // |
|
1085 inline void SExtendedSupportedRatesIE::SetIeData( |
|
1086 const TUint8* aIeData, |
|
1087 const TUint8 aLength) |
|
1088 { |
|
1089 iHeader.iLength = aLength; |
|
1090 os_memcpy( iSupportedRatesIE, aIeData, aLength ); |
|
1091 } |
|
1092 |
|
1093 // --------------------------------------------------------------------------- |
|
1094 // |
|
1095 // --------------------------------------------------------------------------- |
|
1096 // |
|
1097 inline TUint8 SExtendedSupportedRatesIE::operator[] ( TUint8 aIdx ) const |
|
1098 { |
|
1099 return iSupportedRatesIE[aIdx]; |
|
1100 } |
|
1101 |
|
1102 // --------------------------------------------------------------------------- |
|
1103 // |
|
1104 // --------------------------------------------------------------------------- |
|
1105 // |
|
1106 inline TUint8 SExtendedSupportedRatesIE::GetIeLength() const |
|
1107 { |
|
1108 return static_cast<TUint8>( |
|
1109 ( iHeader.iLength + sizeof( SInformationElementHeader ) ) ); |
|
1110 } |
|
1111 |
|
1112 // --------------------------------------------------------------------------- |
|
1113 // |
|
1114 // --------------------------------------------------------------------------- |
|
1115 // |
|
1116 inline TUint8 SExtendedSupportedRatesIE::GetElementLength() const |
|
1117 { |
|
1118 return iHeader.iLength; |
|
1119 } |
|
1120 |
|
1121 // --------------------------------------------------------------------------- |
|
1122 // |
|
1123 // --------------------------------------------------------------------------- |
|
1124 // |
|
1125 inline void SExtendedSupportedRatesIE::Clear() |
|
1126 { |
|
1127 iHeader.iLength = 0; |
|
1128 } |
|
1129 |
|
1130 // --------------------------------------------------------------------------- |
|
1131 // |
|
1132 // --------------------------------------------------------------------------- |
|
1133 // |
|
1134 inline void SExtendedSupportedRatesIE::Append( TUint8 aRate ) |
|
1135 { |
|
1136 iSupportedRatesIE[iHeader.iLength] = aRate; |
|
1137 ++(iHeader.iLength); |
|
1138 } |
|
1139 |
|
1140 /** |
|
1141 * operator== for SExtendedSupportedRatesIE |
|
1142 * @param aLhs left hand side |
|
1143 * @param aRhs right hand side |
|
1144 * @return ETrue equal, EFalse not equal |
|
1145 */ |
|
1146 inline TBool operator== ( |
|
1147 const SExtendedSupportedRatesIE& aLhs, |
|
1148 const SExtendedSupportedRatesIE& aRhs ) |
|
1149 { |
|
1150 return static_cast<TBool>(( ( aLhs.iHeader == aRhs.iHeader ) |
|
1151 && !(os_memcmp( aLhs.iSupportedRatesIE, |
|
1152 aRhs.iSupportedRatesIE, aLhs.iHeader.iLength )) )); |
|
1153 } |
|
1154 |
|
1155 #pragma pack( 1 ) |
|
1156 struct SDsParameterSetIE |
|
1157 { |
|
1158 SInformationElementHeader iHeader; // 2 |
|
1159 TUint8 iValue; // 1 |
|
1160 |
|
1161 inline SDsParameterSetIE( const TUint32 aValue ); |
|
1162 |
|
1163 private: |
|
1164 |
|
1165 /** Prohibit assignment operator */ |
|
1166 SDsParameterSetIE& operator= ( const SDsParameterSetIE& aObj ); |
|
1167 /** Prohibit copy constructor */ |
|
1168 SDsParameterSetIE( const SDsParameterSetIE& ); |
|
1169 } __PACKED; // 3 bytes |
|
1170 |
|
1171 inline SDsParameterSetIE::SDsParameterSetIE( |
|
1172 const TUint32 aValue ) |
|
1173 : iHeader( E802Dot11DsParameterSetIE, sizeof(iValue) ) |
|
1174 { |
|
1175 iValue = aValue; |
|
1176 } |
|
1177 |
|
1178 #pragma pack( 1 ) |
|
1179 struct SIbssParameterSetIE |
|
1180 { |
|
1181 SInformationElementHeader iHeader; // 2 |
|
1182 TUint16 iValue; // 2 |
|
1183 |
|
1184 inline SIbssParameterSetIE( const TUint16 aValue ); |
|
1185 |
|
1186 inline TUint16 AtimWindow() const; |
|
1187 |
|
1188 private: |
|
1189 |
|
1190 /** Prohibit assignment operator */ |
|
1191 SIbssParameterSetIE& operator= ( const SIbssParameterSetIE& aObj ); |
|
1192 /** Prohibit copy constructor */ |
|
1193 SIbssParameterSetIE( const SIbssParameterSetIE& ); |
|
1194 } __PACKED; // 4 bytes |
|
1195 |
|
1196 inline SIbssParameterSetIE::SIbssParameterSetIE( |
|
1197 const TUint16 aValue ) |
|
1198 : iHeader( E802Dot11IbssParameterSetIE, sizeof(iValue) ) |
|
1199 { |
|
1200 WriteHtoUint16( &iValue, aValue ); |
|
1201 } |
|
1202 |
|
1203 inline TUint16 SIbssParameterSetIE::AtimWindow() const |
|
1204 { |
|
1205 return ( ReadUint16Toh( &iValue ) ); |
|
1206 } |
|
1207 |
|
1208 /** |
|
1209 * 802.11 WiFi WPA outbound information element |
|
1210 */ |
|
1211 #pragma pack( 1 ) |
|
1212 struct STxRsnIE |
|
1213 { |
|
1214 /** information element header */ |
|
1215 SInformationElementHeader iHeader; // 2 |
|
1216 /** RSN information element */ |
|
1217 TUint8 iTxRsnIe[KMaxTxRsnIELength]; // 38 |
|
1218 |
|
1219 /** Ctor */ |
|
1220 STxRsnIE() |
|
1221 : iHeader( E802Dot11VendorSpecificIE , KMaxTxRsnIELength ) {}; |
|
1222 |
|
1223 /** |
|
1224 * Returns information element's actual length |
|
1225 * ( element's size + its header ) |
|
1226 * @return see above |
|
1227 */ |
|
1228 inline TUint8 GetIeLength() const; |
|
1229 |
|
1230 /** |
|
1231 * Sets iTxRsnIe field and IE length field |
|
1232 * @param aData data to be set |
|
1233 * @param aLength length of the data |
|
1234 */ |
|
1235 inline void SetRsn( const TUint8* aData, TUint32 aLength ); |
|
1236 |
|
1237 private: |
|
1238 |
|
1239 /** Prohibit assignment operator */ |
|
1240 STxRsnIE& operator= ( const STxRsnIE& aObj ); |
|
1241 /** Prohibit copy constructor */ |
|
1242 STxRsnIE( const STxRsnIE& ); |
|
1243 } __PACKED; // 40 bytes |
|
1244 |
|
1245 // --------------------------------------------------------------------------- |
|
1246 // |
|
1247 // --------------------------------------------------------------------------- |
|
1248 // |
|
1249 inline TUint8 STxRsnIE::GetIeLength() const |
|
1250 { |
|
1251 return static_cast<TUint8>( |
|
1252 ( iHeader.iLength + sizeof( SInformationElementHeader ) ) ); |
|
1253 } |
|
1254 |
|
1255 // --------------------------------------------------------------------------- |
|
1256 // |
|
1257 // --------------------------------------------------------------------------- |
|
1258 // |
|
1259 inline void STxRsnIE::SetRsn( const TUint8* aData, TUint32 aLength ) |
|
1260 { |
|
1261 iHeader.iLength = static_cast<TUint8>(aLength); |
|
1262 os_memcpy( iTxRsnIe, aData, aLength ); |
|
1263 } |
|
1264 |
|
1265 /** |
|
1266 * Inbound WMM information element without IE header |
|
1267 */ |
|
1268 #pragma pack( 1 ) |
|
1269 struct SRxWmmIeData |
|
1270 { |
|
1271 TIeOui iOui; // 3 |
|
1272 TUint8 iOuiType; // 1 |
|
1273 TUint8 iOuiSubType; // 1 |
|
1274 TUint8 iVersion; // 1 |
|
1275 /** information element */ |
|
1276 TUint8 iQosInfo; // 1 |
|
1277 |
|
1278 /** |
|
1279 * Evaluates if U-APSD bit is up |
|
1280 * @return ETrue if bit is up, otherwise EFalse |
|
1281 */ |
|
1282 inline TBool IsUapsdBitSet() const; |
|
1283 |
|
1284 /** |
|
1285 * Gets the the parameter set count |
|
1286 * @return parameter set count |
|
1287 */ |
|
1288 inline TUint8 ParameterSetCount() const; |
|
1289 |
|
1290 private: |
|
1291 |
|
1292 /** Prohibit assignment operator */ |
|
1293 SRxWmmIeData& operator= ( const SRxWmmIeData& aObj ); |
|
1294 /** Prohibit copy constructor */ |
|
1295 SRxWmmIeData( const SRxWmmIeData& ); |
|
1296 } __PACKED; // 7 bytes |
|
1297 |
|
1298 // --------------------------------------------------------------------------- |
|
1299 // |
|
1300 // --------------------------------------------------------------------------- |
|
1301 // |
|
1302 inline TBool SRxWmmIeData::IsUapsdBitSet() const |
|
1303 { |
|
1304 return ( (iQosInfo & KUapsdQosInfoMask )? ETrue : EFalse ); |
|
1305 } |
|
1306 |
|
1307 // --------------------------------------------------------------------------- |
|
1308 // |
|
1309 // --------------------------------------------------------------------------- |
|
1310 // |
|
1311 inline TUint8 SRxWmmIeData::ParameterSetCount() const |
|
1312 { |
|
1313 return ( iQosInfo & KParamSetCountQosInfoMask ); |
|
1314 } |
|
1315 |
|
1316 |
|
1317 /** |
|
1318 * Outbound WMM information element |
|
1319 */ |
|
1320 #pragma pack( 1 ) |
|
1321 struct STxWmmIE |
|
1322 { |
|
1323 /** information element header */ |
|
1324 SInformationElementHeader iHeader; // 2 |
|
1325 TIeOui iOui; // 3 |
|
1326 TUint8 iOuiType; // 1 |
|
1327 TUint8 iOuiSubType; // 1 |
|
1328 TUint8 iVersion; // 1 |
|
1329 /** information element */ |
|
1330 TUint8 iQosInfo; // 1 |
|
1331 |
|
1332 |
|
1333 /** |
|
1334 * Ctor |
|
1335 */ |
|
1336 inline STxWmmIE() : iHeader( E802Dot11VendorSpecificIE, KWmmInfoElemLen ), |
|
1337 iOuiType( KWmmElemOuiType ), |
|
1338 iOuiSubType( KWmmInfoElemOuiSubType ), iVersion( KWmmInfoElemVersion ), |
|
1339 iQosInfo( 0 ) |
|
1340 { |
|
1341 os_memcpy( iOui, KWmmElemOui, KIeOuiLength ); |
|
1342 } |
|
1343 |
|
1344 /** |
|
1345 * Sets the U-APSD flags for different ACs |
|
1346 * @param aFlags flag(s) to be set |
|
1347 */ |
|
1348 inline void SetUapsdFlags( TQosInfoUapsdFlag aFlags ); |
|
1349 |
|
1350 /** |
|
1351 * Sets the maximum service period length |
|
1352 * @param aMaxSpLen length of the service period |
|
1353 */ |
|
1354 inline void SetMaxSpLen( TQosInfoUapsdMaxSpLen aMaxSpLen ); |
|
1355 |
|
1356 /** |
|
1357 * Returns information elements total length, i.e. |
|
1358 * element's length + header length |
|
1359 * @return see above |
|
1360 */ |
|
1361 inline TUint8 GetIeLength() const; |
|
1362 |
|
1363 /** Clears the IE content, i.e. the iQosInfo field */ |
|
1364 inline void Clear(); |
|
1365 |
|
1366 private: |
|
1367 |
|
1368 /** Prohibit assignment operator */ |
|
1369 STxWmmIE& operator= ( const STxWmmIE& aObj ); |
|
1370 /** Prohibit copy constructor */ |
|
1371 STxWmmIE( const STxWmmIE& ); |
|
1372 } __PACKED; // 9 bytes |
|
1373 |
|
1374 |
|
1375 // --------------------------------------------------------------------------- |
|
1376 // |
|
1377 // --------------------------------------------------------------------------- |
|
1378 // |
|
1379 inline void STxWmmIE::SetUapsdFlags( TQosInfoUapsdFlag aFlags ) |
|
1380 { |
|
1381 iQosInfo |= aFlags; |
|
1382 } |
|
1383 |
|
1384 // --------------------------------------------------------------------------- |
|
1385 // |
|
1386 // --------------------------------------------------------------------------- |
|
1387 // |
|
1388 inline void STxWmmIE::SetMaxSpLen( TQosInfoUapsdMaxSpLen aMaxSpLen ) |
|
1389 { |
|
1390 iQosInfo |= aMaxSpLen; |
|
1391 } |
|
1392 |
|
1393 // --------------------------------------------------------------------------- |
|
1394 // |
|
1395 // --------------------------------------------------------------------------- |
|
1396 // |
|
1397 inline TUint8 STxWmmIE::GetIeLength() const |
|
1398 { |
|
1399 return static_cast<TUint8>( |
|
1400 ( iHeader.iLength + sizeof( SInformationElementHeader ) ) ); |
|
1401 } |
|
1402 |
|
1403 // --------------------------------------------------------------------------- |
|
1404 // |
|
1405 // --------------------------------------------------------------------------- |
|
1406 // |
|
1407 inline void STxWmmIE::Clear() |
|
1408 { |
|
1409 iQosInfo = 0; |
|
1410 } |
|
1411 |
|
1412 /** |
|
1413 * AC parameters record of WMM parameter element |
|
1414 */ |
|
1415 #pragma pack( 1 ) |
|
1416 struct SAcParamsRecord |
|
1417 { |
|
1418 |
|
1419 TUint8 iAciAifsn; // 1 |
|
1420 TUint8 iEcwMinMax; // 1 |
|
1421 TUint16 iTxOpLimit; // 2 |
|
1422 |
|
1423 inline TWmmAccessCategory AccessCategory() const; |
|
1424 |
|
1425 inline TBool AdmissionControlMandatory() const; |
|
1426 |
|
1427 inline TUint8 Aifsn() const; |
|
1428 |
|
1429 inline TUint16 CwMin() const; |
|
1430 |
|
1431 inline TUint16 CwMax() const; |
|
1432 |
|
1433 inline TUint16 TxOpLimit() const; |
|
1434 |
|
1435 private: |
|
1436 |
|
1437 /** Prohibit assignment operator */ |
|
1438 SAcParamsRecord& operator= ( const SAcParamsRecord& aObj ); |
|
1439 /** Prohibit copy constructor */ |
|
1440 SAcParamsRecord( const SAcParamsRecord& ); |
|
1441 } __PACKED; // 4 bytes |
|
1442 |
|
1443 inline TWmmAccessCategory SAcParamsRecord::AccessCategory() const |
|
1444 { |
|
1445 return ( static_cast<TWmmAccessCategory>(iAciAifsn & K802Dot11AccessCategoryMask) ); |
|
1446 } |
|
1447 |
|
1448 inline TBool SAcParamsRecord::AdmissionControlMandatory() const |
|
1449 { |
|
1450 return ( iAciAifsn & KWmmAdmissionCtrlMandatoryMask ); |
|
1451 } |
|
1452 |
|
1453 inline TUint8 SAcParamsRecord::Aifsn() const |
|
1454 { |
|
1455 return ( iAciAifsn & KWmmAifsnMask ); |
|
1456 } |
|
1457 |
|
1458 inline TUint16 SAcParamsRecord::CwMin() const |
|
1459 { |
|
1460 return ( ( static_cast<TUint16>( 1 ) << |
|
1461 ( iEcwMinMax & KWmmEcwMinMask ) ) - 1 ); |
|
1462 } |
|
1463 |
|
1464 inline TUint16 SAcParamsRecord::CwMax() const |
|
1465 { |
|
1466 return ( ( static_cast<TUint16>( 1 ) << |
|
1467 ( ( iEcwMinMax & KWmmEcwMaxMask ) >> 4 ) ) - 1 ); |
|
1468 } |
|
1469 |
|
1470 inline TUint16 SAcParamsRecord::TxOpLimit() const |
|
1471 { |
|
1472 return ( ReadUint16Toh( &iTxOpLimit ) ); |
|
1473 } |
|
1474 |
|
1475 /** |
|
1476 * WMM Parameter Element without element header |
|
1477 */ |
|
1478 #pragma pack( 1 ) |
|
1479 struct SWmmParamElemData |
|
1480 { |
|
1481 /** information element header */ |
|
1482 TIeOui iOui; // 3 |
|
1483 TUint8 iOuiType; // 1 |
|
1484 TUint8 iOuiSubType; // 1 |
|
1485 TUint8 iVersion; // 1 |
|
1486 /** information element fields: */ |
|
1487 TUint8 iQosInfo; // 1 |
|
1488 TUint8 iReserved; // 1 |
|
1489 SAcParamsRecord iAcParams[KNumOfWmmACs]; // 16 |
|
1490 |
|
1491 /** |
|
1492 * Evaluates if U-APSD bit is up |
|
1493 * @return ETrue if bit is up, otherwise EFalse |
|
1494 */ |
|
1495 inline TBool IsUapsdBitSet() const; |
|
1496 |
|
1497 /** |
|
1498 * Gets the the parameter set count |
|
1499 * @return parameter set count |
|
1500 */ |
|
1501 inline TUint8 ParameterSetCount() const; |
|
1502 |
|
1503 private: |
|
1504 |
|
1505 /** Prohibit assignment operator */ |
|
1506 SWmmParamElemData& operator= ( const SWmmParamElemData& aObj ); |
|
1507 /** Prohibit copy constructor */ |
|
1508 SWmmParamElemData( const SWmmParamElemData& ); |
|
1509 } __PACKED; // 24 |
|
1510 |
|
1511 // --------------------------------------------------------------------------- |
|
1512 // |
|
1513 // --------------------------------------------------------------------------- |
|
1514 // |
|
1515 inline TBool SWmmParamElemData::IsUapsdBitSet() const |
|
1516 { |
|
1517 return ( (iQosInfo & KUapsdQosInfoMask )? ETrue : EFalse ); |
|
1518 } |
|
1519 |
|
1520 // --------------------------------------------------------------------------- |
|
1521 // |
|
1522 // --------------------------------------------------------------------------- |
|
1523 // |
|
1524 inline TUint8 SWmmParamElemData::ParameterSetCount() const |
|
1525 { |
|
1526 return ( iQosInfo & KParamSetCountQosInfoMask ); |
|
1527 } |
|
1528 |
|
1529 // capability information fixed-field |
|
1530 // |
|
1531 // bit 14 - 15 13 11 - 12 10 8-9 7 6 |
|
1532 // ----------+-------+-----------+-------+---------+----------+------- |
|
1533 // reserved | DSSS- | reserved | short | reserved| Channel | PBCC |
|
1534 // | OFDM | | slot | | Agility | |
|
1535 // ----------+-------+-----------+-------+---------+----------+-------- |
|
1536 // bit 5 4 3 2 1 0 |
|
1537 // ----------+----------+----------+----------+----------+----------+ |
|
1538 // Short | Privacy | CF-Poll | CF | IBSS | ESS | |
|
1539 // Preamble| (WEP) | Request | Pollable | | | |
|
1540 // ----------+----------+----------+----------+----------+----------+ |
|
1541 |
|
1542 /** |
|
1543 * 802.11 management frame body capability information fixed-field |
|
1544 */ |
|
1545 #pragma pack( 1 ) |
|
1546 struct SCapabilityInformationField |
|
1547 { |
|
1548 enum { KReservedFieldsMask = 0xEB00 }; |
|
1549 |
|
1550 /** capability information fixed field */ |
|
1551 TUint16 iCapabilityInformationField; |
|
1552 |
|
1553 /** |
|
1554 * Ctor |
|
1555 */ |
|
1556 SCapabilityInformationField() |
|
1557 : iCapabilityInformationField( 0 ) {}; |
|
1558 |
|
1559 /** |
|
1560 * Ctor |
|
1561 * @param aParam value used in iCapabilityInformationField field |
|
1562 */ |
|
1563 explicit inline SCapabilityInformationField( const TUint16 aParam ); |
|
1564 |
|
1565 /** |
|
1566 * Assignment operator for TUint16 type |
|
1567 * @param aParam value used as iCapabilityInformationField |
|
1568 */ |
|
1569 inline SCapabilityInformationField& operator= ( const TUint16 aParam ); |
|
1570 |
|
1571 /** |
|
1572 * Returns the value of the Capability Information Field |
|
1573 * @return |
|
1574 */ |
|
1575 inline TUint16 CapabilityInformationField() const; |
|
1576 /** |
|
1577 * Evaluates if ESS bit is up |
|
1578 * @return ETrue if bit is up, otherwise EFalse |
|
1579 */ |
|
1580 inline TBool IsEssBitSet() const; |
|
1581 /** |
|
1582 * Evaluates if IBSS bit is up |
|
1583 * @return ETrue if bit is up, otherwise EFalse |
|
1584 */ |
|
1585 inline TBool IsIbssBitSet() const; |
|
1586 /** |
|
1587 * Evaluates if Privaecy bit bit is up |
|
1588 * @return ETrue if bit is up, otherwise EFalse |
|
1589 */ |
|
1590 inline TBool IsPrivacyBitSet() const; |
|
1591 /** |
|
1592 * Evaluates if Short Preamble bit is up |
|
1593 * @return ETrue if bit is up, otherwise EFalse |
|
1594 */ |
|
1595 inline TBool IsShortPreambleBitSet() const; |
|
1596 /** |
|
1597 * Evaluates if PBCC bit is up |
|
1598 * @return ETrue if bit is up, otherwise EFalse |
|
1599 */ |
|
1600 inline TBool IsPbccBitSet() const; |
|
1601 /** |
|
1602 * Evaluates if Channel Agility bit is up |
|
1603 * @return ETrue if bit is up, otherwise EFalse |
|
1604 */ |
|
1605 inline TBool IsChannelAgilityBitSet() const; |
|
1606 /** |
|
1607 * Evaluates if short slot time bit is up |
|
1608 * @return ETrue if bit is up, otherwise EFalse |
|
1609 */ |
|
1610 inline TBool IsShortSlotTimeBitSet() const; |
|
1611 /** |
|
1612 * Clears both CF bits |
|
1613 */ |
|
1614 inline void ClearCfFields(); |
|
1615 /** |
|
1616 * Clear CF pollable field |
|
1617 */ |
|
1618 inline void ClearCfPollable(); |
|
1619 /** |
|
1620 * Clears both CF poll request field |
|
1621 */ |
|
1622 inline void ClearCfPollRequest(); |
|
1623 /** |
|
1624 * Sets the short preamble bit |
|
1625 */ |
|
1626 inline void SetShortPreamble(); |
|
1627 /** |
|
1628 * Clears the short preamble bit |
|
1629 */ |
|
1630 inline void ClearShortPreamble(); |
|
1631 /** |
|
1632 * sets the pbcc bit |
|
1633 */ |
|
1634 inline void SetPbcc(); |
|
1635 /** |
|
1636 * sets the IBSS bit |
|
1637 */ |
|
1638 inline void SetIbss(); |
|
1639 /** |
|
1640 * Clear PBCC bit |
|
1641 */ |
|
1642 inline void ClearPbcc(); |
|
1643 /** Clear reserved fields */ |
|
1644 inline void ClearReservedFields(); |
|
1645 /** Set WEP bit */ |
|
1646 inline void SetWepBit(); |
|
1647 /** Clear WEP bit */ |
|
1648 inline void ClearWepBit(); |
|
1649 |
|
1650 private: |
|
1651 |
|
1652 /** Prohibit copy constructor */ |
|
1653 SCapabilityInformationField( const SCapabilityInformationField& ); |
|
1654 } __PACKED; // 2 bytes |
|
1655 |
|
1656 |
|
1657 inline SCapabilityInformationField::SCapabilityInformationField( const TUint16 aParam ) |
|
1658 { |
|
1659 WriteHtoUint16( &iCapabilityInformationField, aParam ); |
|
1660 } |
|
1661 |
|
1662 // --------------------------------------------------------------------------- |
|
1663 // |
|
1664 // --------------------------------------------------------------------------- |
|
1665 // |
|
1666 inline SCapabilityInformationField& SCapabilityInformationField::operator= ( |
|
1667 const TUint16 aParam ) |
|
1668 { |
|
1669 WriteHtoUint16( &iCapabilityInformationField, aParam ); |
|
1670 return (*this); |
|
1671 } |
|
1672 |
|
1673 // --------------------------------------------------------- |
|
1674 // |
|
1675 // --------------------------------------------------------- |
|
1676 // |
|
1677 inline TUint16 SCapabilityInformationField::CapabilityInformationField() const |
|
1678 { |
|
1679 return ( ReadUint16Toh( &iCapabilityInformationField ) ); |
|
1680 } |
|
1681 |
|
1682 // --------------------------------------------------------------------------- |
|
1683 // |
|
1684 // --------------------------------------------------------------------------- |
|
1685 // |
|
1686 inline TBool SCapabilityInformationField::IsEssBitSet() const |
|
1687 { |
|
1688 return ( ( ReadUint16Toh( &iCapabilityInformationField ) & |
|
1689 E802Dot11CapabilityEssMask ) |
|
1690 ? ETrue : EFalse ); |
|
1691 } |
|
1692 |
|
1693 // --------------------------------------------------------------------------- |
|
1694 // |
|
1695 // --------------------------------------------------------------------------- |
|
1696 // |
|
1697 inline TBool SCapabilityInformationField::IsIbssBitSet() const |
|
1698 { |
|
1699 return ( ( ReadUint16Toh( &iCapabilityInformationField ) & |
|
1700 E802Dot11CapabilityIbssMask ) |
|
1701 ? ETrue : EFalse ); |
|
1702 } |
|
1703 |
|
1704 // --------------------------------------------------------------------------- |
|
1705 // |
|
1706 // --------------------------------------------------------------------------- |
|
1707 // |
|
1708 inline TBool SCapabilityInformationField::IsPrivacyBitSet() const |
|
1709 { |
|
1710 return ( ( ReadUint16Toh( &iCapabilityInformationField ) & |
|
1711 E802Dot11CapabilityPrivacyMask ) |
|
1712 ? ETrue : EFalse ); |
|
1713 } |
|
1714 |
|
1715 // --------------------------------------------------------------------------- |
|
1716 // |
|
1717 // --------------------------------------------------------------------------- |
|
1718 // |
|
1719 inline TBool SCapabilityInformationField::IsShortPreambleBitSet() const |
|
1720 { |
|
1721 return ( ( ReadUint16Toh( &iCapabilityInformationField ) & |
|
1722 E802Dot11ShortPreambleMask ) |
|
1723 ? ETrue : EFalse ); |
|
1724 } |
|
1725 |
|
1726 // --------------------------------------------------------------------------- |
|
1727 // |
|
1728 // --------------------------------------------------------------------------- |
|
1729 // |
|
1730 inline TBool SCapabilityInformationField::IsPbccBitSet() const |
|
1731 { |
|
1732 return ( ( ReadUint16Toh( &iCapabilityInformationField ) & |
|
1733 E802Dot11PbccMask ) |
|
1734 ? ETrue : EFalse ); |
|
1735 } |
|
1736 |
|
1737 // --------------------------------------------------------------------------- |
|
1738 // |
|
1739 // --------------------------------------------------------------------------- |
|
1740 // |
|
1741 inline TBool SCapabilityInformationField::IsChannelAgilityBitSet() const |
|
1742 { |
|
1743 return ( ( ReadUint16Toh( &iCapabilityInformationField ) & |
|
1744 E802Dot11ChannelAgilityMask ) |
|
1745 ? ETrue : EFalse ); |
|
1746 } |
|
1747 |
|
1748 |
|
1749 // --------------------------------------------------------------------------- |
|
1750 // |
|
1751 // --------------------------------------------------------------------------- |
|
1752 // |
|
1753 inline TBool SCapabilityInformationField::IsShortSlotTimeBitSet() const |
|
1754 { |
|
1755 return ( ( ReadUint16Toh( &iCapabilityInformationField ) & |
|
1756 E802Dot11ShortSlotTimeMask ) |
|
1757 ? ETrue : EFalse ); |
|
1758 } |
|
1759 |
|
1760 |
|
1761 // --------------------------------------------------------------------------- |
|
1762 // |
|
1763 // --------------------------------------------------------------------------- |
|
1764 // |
|
1765 inline void SCapabilityInformationField::ClearCfFields() |
|
1766 { |
|
1767 ClearCfPollable(); |
|
1768 ClearCfPollRequest(); |
|
1769 } |
|
1770 |
|
1771 // --------------------------------------------------------------------------- |
|
1772 // |
|
1773 // --------------------------------------------------------------------------- |
|
1774 // |
|
1775 inline void SCapabilityInformationField::ClearCfPollable() |
|
1776 { |
|
1777 WriteHtoUint16( &iCapabilityInformationField, |
|
1778 ReadUint16Toh( &iCapabilityInformationField ) & |
|
1779 ( ~E802Dot11CapabilityCfPollableMask ) ); |
|
1780 } |
|
1781 |
|
1782 // --------------------------------------------------------------------------- |
|
1783 // |
|
1784 // --------------------------------------------------------------------------- |
|
1785 // |
|
1786 inline void SCapabilityInformationField::ClearCfPollRequest() |
|
1787 { |
|
1788 WriteHtoUint16( &iCapabilityInformationField, |
|
1789 ReadUint16Toh( &iCapabilityInformationField ) & |
|
1790 ( ~E802Dot11CapabilityCfPollRequestMask ) ); |
|
1791 } |
|
1792 |
|
1793 // --------------------------------------------------------------------------- |
|
1794 // |
|
1795 // --------------------------------------------------------------------------- |
|
1796 // |
|
1797 inline void SCapabilityInformationField::SetShortPreamble() |
|
1798 { |
|
1799 WriteHtoUint16( &iCapabilityInformationField, |
|
1800 ReadUint16Toh( &iCapabilityInformationField ) | |
|
1801 E802Dot11ShortPreambleMask ); |
|
1802 } |
|
1803 |
|
1804 // --------------------------------------------------------------------------- |
|
1805 // |
|
1806 // --------------------------------------------------------------------------- |
|
1807 // |
|
1808 inline void SCapabilityInformationField::SetPbcc() |
|
1809 { |
|
1810 WriteHtoUint16( &iCapabilityInformationField, |
|
1811 ReadUint16Toh( &iCapabilityInformationField ) | |
|
1812 E802Dot11PbccMask ); |
|
1813 } |
|
1814 |
|
1815 // --------------------------------------------------------------------------- |
|
1816 // |
|
1817 // --------------------------------------------------------------------------- |
|
1818 // |
|
1819 inline void SCapabilityInformationField::SetIbss() |
|
1820 { |
|
1821 WriteHtoUint16( &iCapabilityInformationField, |
|
1822 ReadUint16Toh( &iCapabilityInformationField ) | |
|
1823 E802Dot11CapabilityIbssMask ); |
|
1824 } |
|
1825 |
|
1826 // --------------------------------------------------------------------------- |
|
1827 // |
|
1828 // --------------------------------------------------------------------------- |
|
1829 // |
|
1830 inline void SCapabilityInformationField::ClearShortPreamble() |
|
1831 { |
|
1832 WriteHtoUint16( &iCapabilityInformationField, |
|
1833 ReadUint16Toh( &iCapabilityInformationField ) & |
|
1834 ( ~E802Dot11ShortPreambleMask ) ); |
|
1835 } |
|
1836 |
|
1837 // --------------------------------------------------------------------------- |
|
1838 // |
|
1839 // --------------------------------------------------------------------------- |
|
1840 // |
|
1841 inline void SCapabilityInformationField::ClearPbcc() |
|
1842 { |
|
1843 WriteHtoUint16( &iCapabilityInformationField, |
|
1844 ReadUint16Toh( &iCapabilityInformationField ) & |
|
1845 ( ~E802Dot11PbccMask ) ); |
|
1846 } |
|
1847 |
|
1848 // --------------------------------------------------------------------------- |
|
1849 // |
|
1850 // --------------------------------------------------------------------------- |
|
1851 // |
|
1852 inline void SCapabilityInformationField::ClearReservedFields() |
|
1853 { |
|
1854 WriteHtoUint16( &iCapabilityInformationField, |
|
1855 ReadUint16Toh( &iCapabilityInformationField ) & |
|
1856 ( ~KReservedFieldsMask ) ); |
|
1857 } |
|
1858 |
|
1859 // --------------------------------------------------------------------------- |
|
1860 // |
|
1861 // --------------------------------------------------------------------------- |
|
1862 // |
|
1863 inline void SCapabilityInformationField::SetWepBit() |
|
1864 { |
|
1865 WriteHtoUint16( &iCapabilityInformationField, |
|
1866 ReadUint16Toh( &iCapabilityInformationField ) | |
|
1867 E802Dot11CapabilityPrivacyMask ); |
|
1868 } |
|
1869 |
|
1870 // --------------------------------------------------------------------------- |
|
1871 // |
|
1872 // --------------------------------------------------------------------------- |
|
1873 // |
|
1874 inline void SCapabilityInformationField::ClearWepBit() |
|
1875 { |
|
1876 WriteHtoUint16( &iCapabilityInformationField, |
|
1877 ReadUint16Toh( &iCapabilityInformationField ) & |
|
1878 ( ~E802Dot11CapabilityPrivacyMask ) ); |
|
1879 } |
|
1880 |
|
1881 /** |
|
1882 * operator== for SCapabilityInformationField |
|
1883 * @param aLhs left hand side |
|
1884 * @param aRhs right hand side |
|
1885 * @return ETrue equal, EFalse not equal |
|
1886 */ |
|
1887 inline TBool operator== ( |
|
1888 const SCapabilityInformationField& aLhs, |
|
1889 const SCapabilityInformationField& aRhs) |
|
1890 { |
|
1891 return static_cast<TBool>( aLhs.CapabilityInformationField() |
|
1892 == aRhs.CapabilityInformationField() ); |
|
1893 } |
|
1894 |
|
1895 /** |
|
1896 * 802.11 management frame body listen interval fixed-field |
|
1897 */ |
|
1898 #pragma pack( 1 ) |
|
1899 struct SListenIntervalField |
|
1900 { |
|
1901 /** listen interval fixed field */ |
|
1902 TUint16 iListenInterval; |
|
1903 |
|
1904 /** |
|
1905 * Ctor |
|
1906 */ |
|
1907 SListenIntervalField() : iListenInterval( 0 ) {}; |
|
1908 |
|
1909 /** |
|
1910 * Ctor |
|
1911 * @param aParam value used in iListenInterval |
|
1912 */ |
|
1913 explicit inline SListenIntervalField( const TUint16 aParam ); |
|
1914 |
|
1915 /** |
|
1916 * Returns the value of the Listen Interval |
|
1917 * @return Listen Interval |
|
1918 */ |
|
1919 inline TUint16 ListenInterval() const; |
|
1920 |
|
1921 /** |
|
1922 * assignment operator for TUint16 type |
|
1923 * @param aInterval listen interval fixed field |
|
1924 */ |
|
1925 inline SListenIntervalField& operator= ( const TUint16 aInterval ); |
|
1926 |
|
1927 private: |
|
1928 |
|
1929 /** Prohibit assignment operator */ |
|
1930 SListenIntervalField& operator= ( const SListenIntervalField& ); |
|
1931 /** Prohibit copy constructor */ |
|
1932 SListenIntervalField( const SListenIntervalField& ); |
|
1933 } __PACKED; // 2 bytes |
|
1934 |
|
1935 inline SListenIntervalField::SListenIntervalField( const TUint16 aParam ) |
|
1936 { |
|
1937 WriteHtoUint16( &iListenInterval, aParam ); |
|
1938 } |
|
1939 |
|
1940 inline TUint16 SListenIntervalField::ListenInterval() const |
|
1941 { |
|
1942 return ( ReadUint16Toh( &iListenInterval ) ); |
|
1943 } |
|
1944 |
|
1945 inline SListenIntervalField& SListenIntervalField::operator= ( |
|
1946 const TUint16 aInterval ) |
|
1947 { |
|
1948 WriteHtoUint16( &iListenInterval, aInterval ); |
|
1949 return (*this); |
|
1950 } |
|
1951 |
|
1952 /** |
|
1953 * operator== for SListenIntervalField |
|
1954 * @param aLhs left hand side |
|
1955 * @param aRhs right hand side |
|
1956 * @return ETrue equal, EFalse not equal |
|
1957 */ |
|
1958 inline TBool operator== ( |
|
1959 const SListenIntervalField& aLhs, |
|
1960 const SListenIntervalField& aRhs) |
|
1961 { |
|
1962 return static_cast<TBool>( aLhs.ListenInterval() == aRhs.ListenInterval() ); |
|
1963 } |
|
1964 |
|
1965 |
|
1966 /* |
|
1967 802.11 DATA Frame |
|
1968 +----------------+ |
|
1969 | | |
|
1970 | Frame Control | |
|
1971 | 2 bytes | |
|
1972 +----------------+ |
|
1973 | | |
|
1974 | Duration ID | |
|
1975 | 2 bytes | |
|
1976 +----------------+ |
|
1977 | | |
|
1978 | Address 1 | |
|
1979 | 6 bytes | |
|
1980 +----------------+ |
|
1981 | | |
|
1982 | Address 2 | |
|
1983 | 6 bytes | |
|
1984 +----------------+ |
|
1985 | | |
|
1986 | Address 3 | |
|
1987 | 6 bytes | |
|
1988 +----------------+ |
|
1989 | | |
|
1990 | Sequence Cntrl | |
|
1991 | 2 bytes | |
|
1992 +----------------+ |
|
1993 | | |
|
1994 | Address 4 | |
|
1995 | 6 bytes | |
|
1996 +----------------+ |
|
1997 | DSAP - 1 byte | = 0xAA ( SNAP ) |
|
1998 +----------------+ |
|
1999 | SSAP - 1 byte | = 0xAA ( SNAP ) |
|
2000 +----------------+ |
|
2001 |Control - 1 byte| = 0x03 |
|
2002 +----------------+ |
|
2003 | OUI - 3 bytes | = 0x0 |
|
2004 | | |
|
2005 +----------------+ |
|
2006 | Type - 2 bytes | = Ethernet type (IP=0x0800) |
|
2007 +----------------+ |
|
2008 | | |
|
2009 | Data | |
|
2010 | | |
|
2011 ~ ~ |
|
2012 ~ ~ |
|
2013 | 46 to 1500 | |
|
2014 | bytes | |
|
2015 | | |
|
2016 +----------------+ |
|
2017 | FCS | |
|
2018 | 4 bytes | |
|
2019 +----------------+ |
|
2020 |
|
2021 */ |
|
2022 |
|
2023 // FrameControl field of the 802.11 header |
|
2024 // |
|
2025 // |--------------------- control -----------------------| |
|
2026 // |
|
2027 // bit 15 14 13 12 11 10 9 8 |
|
2028 // +-------+-----+------+-----+-------+------+------+----+ |
|
2029 // | Order | WEP | More | Pwr | Retry | More | From | To | |
|
2030 // | | | Data | Mgmt| | Frag | DS | DS | |
|
2031 // +-------+-----+------+-----+-------+------+------+----+ |
|
2032 // 1 1 1 1 1 1 1 1 |
|
2033 //--------- type ------------| |
|
2034 // |
|
2035 // 7-4 3-2 1-0 |
|
2036 //---------+------+----------+ |
|
2037 // Subtype | Type | Protocol | |
|
2038 // | | Version | |
|
2039 //---------+------+----------+ |
|
2040 // 4 2 2 |
|
2041 |
|
2042 /** |
|
2043 * 802.11 Frame Control field |
|
2044 */ |
|
2045 #pragma pack( 1 ) |
|
2046 struct SFrameControl |
|
2047 { |
|
2048 /** type field */ |
|
2049 TUint8 iType; |
|
2050 /** control filed */ |
|
2051 TUint8 iControl; |
|
2052 |
|
2053 /** |
|
2054 * Ctor |
|
2055 * @param aType type field |
|
2056 * @param aControl control field |
|
2057 */ |
|
2058 SFrameControl( |
|
2059 T802Dot11FrameControlTypeMask aType, |
|
2060 T802Dot11FrameControlBitMask aControl ) |
|
2061 : iType( static_cast<TUint8>(aType) ), |
|
2062 iControl( static_cast<TUint8>(aControl) ) {}; |
|
2063 |
|
2064 /** |
|
2065 * Returns type and control fields combined as a single TUint16 value |
|
2066 * @return see above |
|
2067 */ |
|
2068 inline TUint16 operator()() const; |
|
2069 |
|
2070 private: |
|
2071 |
|
2072 /** Prohibit assignment operator */ |
|
2073 SFrameControl& operator= ( const SFrameControl& aObj ); |
|
2074 /** Prohibit copy constructor */ |
|
2075 SFrameControl( const SFrameControl& ); |
|
2076 } __PACKED; |
|
2077 |
|
2078 // --------------------------------------------------------------------------- |
|
2079 // |
|
2080 // --------------------------------------------------------------------------- |
|
2081 // |
|
2082 inline TUint16 SFrameControl::operator()() const |
|
2083 { |
|
2084 TUint16 value( iType ); |
|
2085 return ( static_cast<TUint16>(( value << 8 ) + iControl )); |
|
2086 } |
|
2087 |
|
2088 /** |
|
2089 * operator== for SFrameControl |
|
2090 * @param aLhs left hand side |
|
2091 * @param aRhs right hand side |
|
2092 * @return ETrue equal, EFalse not equal |
|
2093 */ |
|
2094 inline TBool operator== ( |
|
2095 const SFrameControl& aLhs, |
|
2096 const SFrameControl& aRhs) |
|
2097 { |
|
2098 return static_cast<TBool>( aLhs.iType == aRhs.iType |
|
2099 && aLhs.iControl == aRhs.iControl ); |
|
2100 } |
|
2101 |
|
2102 |
|
2103 // SequenceControl field of the 802.11 header |
|
2104 // |
|
2105 // bit 15 - 4 3 - 0 |
|
2106 // +-------------------+-----------+ |
|
2107 // | Sequence Number | Fragment | |
|
2108 // | | Number | |
|
2109 // +-------------------+-----------+ |
|
2110 // 12 4 |
|
2111 |
|
2112 #pragma pack( 1 ) |
|
2113 struct SPsPoll |
|
2114 { |
|
2115 const SFrameControl iFrameControl; // 2 bytes |
|
2116 TUint16 iAid; // 2 bytes |
|
2117 const TMacAddress iBssId; // 6 bytes |
|
2118 const TMacAddress iTa; // 6 bytes |
|
2119 |
|
2120 inline SPsPoll( |
|
2121 TUint16 aAid, |
|
2122 const TMacAddress& aBssId, |
|
2123 const TMacAddress& aTa ); |
|
2124 } __PACKED; // 16 bytes |
|
2125 |
|
2126 |
|
2127 inline SPsPoll::SPsPoll( |
|
2128 TUint16 aAid, |
|
2129 const TMacAddress& aBssId, |
|
2130 const TMacAddress& aTa ) |
|
2131 : iFrameControl( E802Dot11FrameTypePowerSavePoll, |
|
2132 static_cast<T802Dot11FrameControlBitMask>(0) ), |
|
2133 iAid( 0 ), |
|
2134 iBssId( aBssId ), iTa( aTa ) |
|
2135 { |
|
2136 // AID always has the 2 most significant bits set to 1 |
|
2137 WriteHtoUint16( &iAid, ( aAid | 0xC000 ) ); |
|
2138 } |
|
2139 |
|
2140 /** |
|
2141 * 802.11 data frame MAC header |
|
2142 */ |
|
2143 #pragma pack( 1 ) |
|
2144 struct SDataFrameHeader |
|
2145 { |
|
2146 /** frame control field */ |
|
2147 SFrameControl iFrameControl; // 2 bytes |
|
2148 /** duration field */ |
|
2149 const TUint16 iDuration; // 2 bytes |
|
2150 /** address1 field */ |
|
2151 TMacAddress iAddress1; // 6 bytes |
|
2152 /** address2 field */ |
|
2153 TMacAddress iAddress2; // 6 bytes |
|
2154 /** address3 field */ |
|
2155 TMacAddress iAddress3; // 6 bytes |
|
2156 /** sequence control field */ |
|
2157 const TUint16 iSeqCtl; // 2 bytes |
|
2158 // this littly piggy is only used in AP-AP mode |
|
2159 // which we don't do so it is omitted |
|
2160 // const TMacAddress iAddress4; // 6 bytes |
|
2161 |
|
2162 /** |
|
2163 * Ctor |
|
2164 */ |
|
2165 SDataFrameHeader() |
|
2166 : iFrameControl( E802Dot11FrameTypeData, |
|
2167 static_cast<T802Dot11FrameControlBitMask>(0) ) |
|
2168 ,iDuration( 0 ), iSeqCtl( 0 ) {}; |
|
2169 |
|
2170 /** |
|
2171 * Sets WEP bit from Frame Control field |
|
2172 */ |
|
2173 inline void SetWepBit(); |
|
2174 /** |
|
2175 * Clears WEP bit from Frame Control field |
|
2176 */ |
|
2177 inline void ClearWepBit(); |
|
2178 /** |
|
2179 * Sets ToDS bit from Frame Control field |
|
2180 */ |
|
2181 inline void SetToDsBit(); |
|
2182 /** |
|
2183 * Clears ToDS bit from Frame Control field |
|
2184 */ |
|
2185 inline void ClearToDsBit(); |
|
2186 /** |
|
2187 * Clears FromDS bit from Frame Control field |
|
2188 */ |
|
2189 inline void ClearFromDsBit(); |
|
2190 /** |
|
2191 * Evaluates is FromDS bit set from Frame Control field |
|
2192 */ |
|
2193 inline TBool IsFromDsBitSet() const; |
|
2194 inline TBool IsToDsBitSet() const; |
|
2195 /** |
|
2196 * Evaluates is WEP bit set from Frame Control field |
|
2197 */ |
|
2198 inline TBool IsWepBitSet() const; |
|
2199 /** |
|
2200 * Gets Frame Control field |
|
2201 * @return reference to the frame control field |
|
2202 */ |
|
2203 inline const SFrameControl& GetFrameControl() const; |
|
2204 |
|
2205 /** |
|
2206 * Returns Sequence Number from iSeqCtl field |
|
2207 * @return Sequence Number |
|
2208 */ |
|
2209 inline TUint16 SequenceNumber() const; |
|
2210 |
|
2211 private: |
|
2212 |
|
2213 /** Prohibit assignment operator */ |
|
2214 SDataFrameHeader& operator= ( const SDataFrameHeader& aObj ); |
|
2215 /** Prohibit copy constructor */ |
|
2216 SDataFrameHeader( const SDataFrameHeader& ); |
|
2217 } __PACKED; |
|
2218 |
|
2219 // --------------------------------------------------------------------------- |
|
2220 // |
|
2221 // --------------------------------------------------------------------------- |
|
2222 // |
|
2223 inline void SDataFrameHeader::SetWepBit() |
|
2224 { |
|
2225 iFrameControl.iControl |= ( E802Dot11FrameControlWepMask >> 8 ); |
|
2226 } |
|
2227 |
|
2228 // --------------------------------------------------------------------------- |
|
2229 // |
|
2230 // --------------------------------------------------------------------------- |
|
2231 // |
|
2232 inline void SDataFrameHeader::ClearWepBit() |
|
2233 { |
|
2234 iFrameControl.iControl &= ~( E802Dot11FrameControlWepMask >> 8 ); |
|
2235 } |
|
2236 |
|
2237 // --------------------------------------------------------------------------- |
|
2238 // |
|
2239 // --------------------------------------------------------------------------- |
|
2240 // |
|
2241 inline void SDataFrameHeader::SetToDsBit() |
|
2242 { |
|
2243 iFrameControl.iControl |= ( E802Dot11FrameControlToDsMask >> 8 ); |
|
2244 } |
|
2245 |
|
2246 // --------------------------------------------------------------------------- |
|
2247 // |
|
2248 // --------------------------------------------------------------------------- |
|
2249 // |
|
2250 inline void SDataFrameHeader::ClearToDsBit() |
|
2251 { |
|
2252 iFrameControl.iControl &= ~( E802Dot11FrameControlToDsMask >> 8 ); |
|
2253 } |
|
2254 |
|
2255 // --------------------------------------------------------------------------- |
|
2256 // |
|
2257 // --------------------------------------------------------------------------- |
|
2258 // |
|
2259 inline void SDataFrameHeader::ClearFromDsBit() |
|
2260 { |
|
2261 iFrameControl.iControl &= ~( E802Dot11FrameControlFromDsMask >> 8 ); |
|
2262 } |
|
2263 |
|
2264 // --------------------------------------------------------------------------- |
|
2265 // |
|
2266 // --------------------------------------------------------------------------- |
|
2267 // |
|
2268 inline TBool SDataFrameHeader::IsFromDsBitSet() const |
|
2269 { |
|
2270 return static_cast<TBool>( iFrameControl.iControl & ( |
|
2271 E802Dot11FrameControlFromDsMask >> 8 )); |
|
2272 } |
|
2273 |
|
2274 // --------------------------------------------------------------------------- |
|
2275 // |
|
2276 // --------------------------------------------------------------------------- |
|
2277 // |
|
2278 inline TBool SDataFrameHeader::IsToDsBitSet() const |
|
2279 { |
|
2280 return static_cast<TBool>( iFrameControl.iControl & ( |
|
2281 E802Dot11FrameControlToDsMask >> 8 )); |
|
2282 } |
|
2283 |
|
2284 // --------------------------------------------------------------------------- |
|
2285 // |
|
2286 // --------------------------------------------------------------------------- |
|
2287 // |
|
2288 inline TBool SDataFrameHeader::IsWepBitSet() const |
|
2289 { |
|
2290 return static_cast<TBool>( iFrameControl.iControl & ( |
|
2291 E802Dot11FrameControlWepMask >> 8 )); |
|
2292 } |
|
2293 |
|
2294 // --------------------------------------------------------------------------- |
|
2295 // |
|
2296 // --------------------------------------------------------------------------- |
|
2297 // |
|
2298 inline const SFrameControl& SDataFrameHeader::GetFrameControl() const |
|
2299 { |
|
2300 return iFrameControl; |
|
2301 } |
|
2302 |
|
2303 // --------------------------------------------------------- |
|
2304 // |
|
2305 // --------------------------------------------------------- |
|
2306 // |
|
2307 inline TUint16 SDataFrameHeader::SequenceNumber() const |
|
2308 { |
|
2309 return ( ReadUint16Toh( &iSeqCtl ) >> 4 ); |
|
2310 } |
|
2311 |
|
2312 |
|
2313 typedef SDataFrameHeader SNullDataFrame; |
|
2314 typedef SDataFrameHeader Sdot11MacHeader; |
|
2315 |
|
2316 typedef TUint16 T802Dot11QosControl; |
|
2317 |
|
2318 /** |
|
2319 * According to the WiFi-WMM Test Specification v1.2 bits 3-5 of |
|
2320 * the DSCP bits 0-5 of the DS field determine the user priority |
|
2321 * This is a mask for those bits for IPv4 header |
|
2322 */ |
|
2323 const T802Dot11QosControl KWmmUserPriorityMask = 0x0007; |
|
2324 |
|
2325 /** |
|
2326 * 802.11 QoS data frame MAC header |
|
2327 */ |
|
2328 #pragma pack( 1 ) |
|
2329 struct SQosDataFrameHeader |
|
2330 { |
|
2331 /** frame control field */ |
|
2332 SDataFrameHeader iHdr; // 24 bytes |
|
2333 /** QoS control field */ |
|
2334 T802Dot11QosControl iQosControl; // 2 bytes |
|
2335 |
|
2336 /** |
|
2337 * Resets the QoS Control field to zero |
|
2338 */ |
|
2339 inline void ResetQosControl(); |
|
2340 |
|
2341 /** |
|
2342 * Sets the WMM user priority (3 lowest bits) of the QoS Control field |
|
2343 */ |
|
2344 inline void SetUserPriority( TUint8 aPriority ); |
|
2345 |
|
2346 /** |
|
2347 * Returns the WMM user priority (3 lowest bits) of the QoS Control field |
|
2348 */ |
|
2349 inline TUint8 UserPriority() const; |
|
2350 } __PACKED; |
|
2351 |
|
2352 // --------------------------------------------------------------------------- |
|
2353 // |
|
2354 // --------------------------------------------------------------------------- |
|
2355 // |
|
2356 inline void SQosDataFrameHeader::ResetQosControl() |
|
2357 { |
|
2358 iQosControl = 0; |
|
2359 } |
|
2360 |
|
2361 // --------------------------------------------------------------------------- |
|
2362 // |
|
2363 // --------------------------------------------------------------------------- |
|
2364 // |
|
2365 inline void SQosDataFrameHeader::SetUserPriority( TUint8 aPriority ) |
|
2366 { |
|
2367 // clear old priority |
|
2368 WriteHtoUint16( &iQosControl, |
|
2369 ReadUint16Toh( &iQosControl ) & |
|
2370 ( ~KWmmUserPriorityMask ) ); |
|
2371 // set new priority |
|
2372 WriteHtoUint16( &iQosControl, |
|
2373 ReadUint16Toh( &iQosControl ) | |
|
2374 aPriority ); |
|
2375 } |
|
2376 |
|
2377 // --------------------------------------------------------------------------- |
|
2378 // |
|
2379 // --------------------------------------------------------------------------- |
|
2380 // |
|
2381 inline TUint8 SQosDataFrameHeader::UserPriority() const |
|
2382 { |
|
2383 return ( ReadUint16Toh( &iQosControl ) & KWmmUserPriorityMask ); |
|
2384 } |
|
2385 |
|
2386 typedef SQosDataFrameHeader SQosNullDataFrame; |
|
2387 |
|
2388 /** |
|
2389 * 802.11 management frame MAC header |
|
2390 */ |
|
2391 #pragma pack( 1 ) |
|
2392 struct SManagementFrameHeader |
|
2393 { |
|
2394 /** frame control field */ |
|
2395 SFrameControl iFrameControl; // 2 bytes |
|
2396 /** duration field */ |
|
2397 const TUint16 iDuration; // 2 bytes |
|
2398 /** DA address field */ |
|
2399 TMacAddress iDA; // 6 bytes frames destination = AP |
|
2400 /** SA address field */ |
|
2401 TMacAddress iSA; // 6 bytes source address |
|
2402 /** BSSID address field */ |
|
2403 TMacAddress iBSSID; // 6 bytes BSS identifier = iDA |
|
2404 /** sequence control field */ |
|
2405 const TUint16 iSeqCtl; // 2 bytes |
|
2406 |
|
2407 /** |
|
2408 * Ctor |
|
2409 * @param aTypeMask frame control type mask |
|
2410 * @param aControlMask frame control control mask |
|
2411 */ |
|
2412 SManagementFrameHeader( |
|
2413 T802Dot11FrameControlTypeMask aTypeMask, |
|
2414 T802Dot11FrameControlBitMask aControlMask |
|
2415 = static_cast<T802Dot11FrameControlBitMask>( 0 ) ) |
|
2416 : iFrameControl( aTypeMask, aControlMask ), |
|
2417 iDuration( 0 ), iSeqCtl( 0 ) {}; |
|
2418 |
|
2419 /** |
|
2420 * Set WEP bit from Frame Control Field |
|
2421 */ |
|
2422 void SetWepBit(); |
|
2423 /** |
|
2424 * Clear WEP bit from Frame Control Field |
|
2425 */ |
|
2426 void ClearWepBit(); |
|
2427 |
|
2428 private: |
|
2429 |
|
2430 /** Prohibit assignment operator */ |
|
2431 SManagementFrameHeader& operator= ( SManagementFrameHeader& aObj ); |
|
2432 /** Prohibit copy constructor */ |
|
2433 SManagementFrameHeader( const SManagementFrameHeader& ); |
|
2434 } __PACKED; |
|
2435 |
|
2436 // --------------------------------------------------------------------------- |
|
2437 // |
|
2438 // --------------------------------------------------------------------------- |
|
2439 // |
|
2440 inline void SManagementFrameHeader::SetWepBit() |
|
2441 { |
|
2442 iFrameControl.iControl |= ( E802Dot11FrameControlWepMask >> 8 ); |
|
2443 } |
|
2444 |
|
2445 // --------------------------------------------------------------------------- |
|
2446 // |
|
2447 // --------------------------------------------------------------------------- |
|
2448 // |
|
2449 inline void SManagementFrameHeader::ClearWepBit() |
|
2450 { |
|
2451 iFrameControl.iControl &= ~( E802Dot11FrameControlWepMask >> 8 ); |
|
2452 } |
|
2453 |
|
2454 /** |
|
2455 * 802.11 fixed length components required in |
|
2456 * authentication request management frame |
|
2457 */ |
|
2458 #pragma pack( 1 ) |
|
2459 struct SAuthenticationFixedFields |
|
2460 { |
|
2461 /** algorithm number */ |
|
2462 TUint16 iAlgorithmNumber; // 2 bytes |
|
2463 /** sequence number */ |
|
2464 TUint16 iSequenceNmbr; // 2 bytes |
|
2465 /** status code */ |
|
2466 TUint16 iStatusCode; // 2 bytes |
|
2467 |
|
2468 /** |
|
2469 * Ctor |
|
2470 * @param aAlgorithm authentication mode used |
|
2471 * @param aSeqNmbr sequence number used |
|
2472 * @param aStatusCode status code used |
|
2473 */ |
|
2474 inline SAuthenticationFixedFields( |
|
2475 const TUint16 aAlgorithm = K802Dot11AuthModeOpen, |
|
2476 const TUint16 aSeqNmbr = E802Dot11AuthenticationSeqNmbr1, |
|
2477 const T802Dot11ManagementStatusCode aStatusCode |
|
2478 = E802Dot11StatusSuccess ); |
|
2479 |
|
2480 /** |
|
2481 * Returns the authentication transaction algorithm number |
|
2482 * @return sequence number |
|
2483 */ |
|
2484 inline TUint16 AlgorithmNumber() const; |
|
2485 |
|
2486 /** |
|
2487 * Sets the authentication transaction algorithm number |
|
2488 * @param aSequenceNumber value to be set |
|
2489 */ |
|
2490 inline void SetAlgorithmNumber( |
|
2491 TUint16 aAlgorithmNumber ); |
|
2492 |
|
2493 /** |
|
2494 * Returns the authentication transaction sequence number |
|
2495 * @return sequence number |
|
2496 */ |
|
2497 inline TUint16 SequenceNumber() const; |
|
2498 |
|
2499 /** |
|
2500 * Sets the authentication transaction sequence number |
|
2501 * @param aSequenceNumber value to be set |
|
2502 */ |
|
2503 inline void SetSequenceNumber( TUint16 aSequenceNumber ); |
|
2504 |
|
2505 /** |
|
2506 * Returns the authentication transaction status code |
|
2507 * @return status code |
|
2508 */ |
|
2509 inline TUint16 StatusCode() const; |
|
2510 |
|
2511 } __PACKED; |
|
2512 |
|
2513 inline SAuthenticationFixedFields::SAuthenticationFixedFields( |
|
2514 const TUint16 aAlgorithm, |
|
2515 const TUint16 aSeqNmbr, |
|
2516 const T802Dot11ManagementStatusCode aStatusCode ) |
|
2517 { |
|
2518 WriteHtoUint16( &iAlgorithmNumber, static_cast<TUint16>( aAlgorithm ) ); |
|
2519 WriteHtoUint16( &iSequenceNmbr, static_cast<TUint16>( aSeqNmbr ) ); |
|
2520 WriteHtoUint16( &iStatusCode, static_cast<TUint16>( aStatusCode ) ); |
|
2521 } |
|
2522 |
|
2523 inline TUint16 SAuthenticationFixedFields::AlgorithmNumber() const |
|
2524 { |
|
2525 return ( ReadUint16Toh( &iAlgorithmNumber ) ); |
|
2526 } |
|
2527 |
|
2528 inline void SAuthenticationFixedFields::SetAlgorithmNumber( TUint16 aAlgorithmNumber ) |
|
2529 { |
|
2530 WriteHtoUint16( &iAlgorithmNumber, aAlgorithmNumber ); |
|
2531 } |
|
2532 |
|
2533 inline TUint16 SAuthenticationFixedFields::SequenceNumber() const |
|
2534 { |
|
2535 return ( ReadUint16Toh( &iSequenceNmbr ) ); |
|
2536 } |
|
2537 |
|
2538 inline void SAuthenticationFixedFields::SetSequenceNumber( |
|
2539 TUint16 aSequenceNumber ) |
|
2540 { |
|
2541 WriteHtoUint16( &iSequenceNmbr, aSequenceNumber ); |
|
2542 } |
|
2543 |
|
2544 inline TUint16 SAuthenticationFixedFields::StatusCode() const |
|
2545 { |
|
2546 return ( ReadUint16Toh( &iStatusCode ) ); |
|
2547 } |
|
2548 |
|
2549 |
|
2550 /** |
|
2551 * 802.11 authentication management frame |
|
2552 */ |
|
2553 #pragma pack( 1 ) |
|
2554 struct SAuthenticationFrame |
|
2555 { |
|
2556 /** management frame header */ |
|
2557 SManagementFrameHeader iHeader; // 24 bytes |
|
2558 /** authentication frame fixed fields */ |
|
2559 SAuthenticationFixedFields iAuthenticationFields; // 6 bytes |
|
2560 |
|
2561 /** Ctor */ |
|
2562 SAuthenticationFrame() |
|
2563 : iHeader( E802Dot11FrameTypeAuthentication ) {}; |
|
2564 |
|
2565 /** Increments sequnece number to next number we shall send */ |
|
2566 inline void IncrementSeqNmbr(); |
|
2567 |
|
2568 /** Resets sequnece number to initial value */ |
|
2569 inline void ResetSeqNmbr(); |
|
2570 |
|
2571 /** |
|
2572 * Gets the frames sequence number |
|
2573 * @return frames sequence number |
|
2574 */ |
|
2575 inline TUint16 GetSeqNmbr() const; |
|
2576 |
|
2577 /** |
|
2578 * Gets the frames status code field |
|
2579 * @return frames status code field |
|
2580 */ |
|
2581 inline TUint16 GetStatusCode() const; |
|
2582 |
|
2583 /** |
|
2584 * Gets the algorithm number |
|
2585 * @return algorithm number |
|
2586 */ |
|
2587 inline TUint16 GetAlgorithmNumber() const; |
|
2588 |
|
2589 /** Sets the WEP bit from frame control field */ |
|
2590 inline void SetWepBit(); |
|
2591 |
|
2592 /** Clears the WEP bit from frame control field */ |
|
2593 inline void ClearWepBit(); |
|
2594 |
|
2595 /** |
|
2596 * Sets the the algorithm number field |
|
2597 * @param aAlgorithm algorithm to be used |
|
2598 */ |
|
2599 inline void SetAlgorithmNmbr( TUint16 aAlgorithm ); |
|
2600 |
|
2601 private: |
|
2602 |
|
2603 /** Prohibit assignment operator */ |
|
2604 SAuthenticationFrame& operator= ( const SAuthenticationFrame& ); |
|
2605 /** Prohibit copy constructor */ |
|
2606 SAuthenticationFrame( const SAuthenticationFrame& ); |
|
2607 } __PACKED; |
|
2608 |
|
2609 // --------------------------------------------------------------------------- |
|
2610 // |
|
2611 // --------------------------------------------------------------------------- |
|
2612 // |
|
2613 inline void SAuthenticationFrame::IncrementSeqNmbr() |
|
2614 { |
|
2615 iAuthenticationFields.SetSequenceNumber( |
|
2616 iAuthenticationFields.SequenceNumber() + 2 ); |
|
2617 } |
|
2618 |
|
2619 // --------------------------------------------------------------------------- |
|
2620 // |
|
2621 // --------------------------------------------------------------------------- |
|
2622 // |
|
2623 inline void SAuthenticationFrame::ResetSeqNmbr() |
|
2624 { |
|
2625 iAuthenticationFields.SetSequenceNumber( E802Dot11AuthenticationSeqNmbr1 ); |
|
2626 } |
|
2627 |
|
2628 // --------------------------------------------------------------------------- |
|
2629 // |
|
2630 // --------------------------------------------------------------------------- |
|
2631 // |
|
2632 inline TUint16 SAuthenticationFrame::GetSeqNmbr() const |
|
2633 { |
|
2634 return ( iAuthenticationFields.SequenceNumber() ); |
|
2635 } |
|
2636 |
|
2637 // --------------------------------------------------------------------------- |
|
2638 // |
|
2639 // --------------------------------------------------------------------------- |
|
2640 // |
|
2641 inline TUint16 SAuthenticationFrame::GetStatusCode() const |
|
2642 { |
|
2643 return ( iAuthenticationFields.StatusCode() ); |
|
2644 } |
|
2645 |
|
2646 // --------------------------------------------------------------------------- |
|
2647 // |
|
2648 // --------------------------------------------------------------------------- |
|
2649 // |
|
2650 inline void SAuthenticationFrame::SetAlgorithmNmbr( |
|
2651 TUint16 aAlgorithm ) |
|
2652 { |
|
2653 iAuthenticationFields.SetAlgorithmNumber( aAlgorithm ); |
|
2654 } |
|
2655 |
|
2656 // --------------------------------------------------------------------------- |
|
2657 // |
|
2658 // --------------------------------------------------------------------------- |
|
2659 // |
|
2660 inline TUint16 SAuthenticationFrame::GetAlgorithmNumber() const |
|
2661 { |
|
2662 return ( iAuthenticationFields.AlgorithmNumber() ); |
|
2663 } |
|
2664 |
|
2665 // --------------------------------------------------------------------------- |
|
2666 // |
|
2667 // --------------------------------------------------------------------------- |
|
2668 // |
|
2669 inline void SAuthenticationFrame::SetWepBit() |
|
2670 { |
|
2671 iHeader.SetWepBit(); |
|
2672 } |
|
2673 |
|
2674 // --------------------------------------------------------------------------- |
|
2675 // |
|
2676 // --------------------------------------------------------------------------- |
|
2677 // |
|
2678 inline void SAuthenticationFrame::ClearWepBit() |
|
2679 { |
|
2680 iHeader.ClearWepBit(); |
|
2681 } |
|
2682 |
|
2683 /** |
|
2684 * 802.11 fixed length components required |
|
2685 * in association request management frame |
|
2686 */ |
|
2687 #pragma pack( 1 ) |
|
2688 struct SAssociationRequestFixedFields |
|
2689 { |
|
2690 /** capability info fixed field */ |
|
2691 SCapabilityInformationField iCapabilityInfo; // 2 bytes |
|
2692 /** listeninterval fixed field */ |
|
2693 SListenIntervalField iListenInterval; // 2 bytes |
|
2694 |
|
2695 /** Ctor */ |
|
2696 SAssociationRequestFixedFields() {}; |
|
2697 |
|
2698 private: |
|
2699 |
|
2700 /** Prohibit assignment operator */ |
|
2701 SAssociationRequestFixedFields& operator= ( |
|
2702 const SAssociationRequestFixedFields& ); |
|
2703 /** Prohibit copy constructor */ |
|
2704 SAssociationRequestFixedFields( |
|
2705 const SAssociationRequestFixedFields& ); |
|
2706 } __PACKED; |
|
2707 |
|
2708 /** |
|
2709 * operator== for SAssociationRequestFixedFields |
|
2710 * @param aLhs left hand side |
|
2711 * @param aRhs right hand side |
|
2712 * @return ETrue equal, EFalse not equal |
|
2713 */ |
|
2714 inline TBool operator== ( |
|
2715 const SAssociationRequestFixedFields& aLhs, |
|
2716 const SAssociationRequestFixedFields& aRhs) |
|
2717 { |
|
2718 return static_cast<TBool>( aLhs.iCapabilityInfo == aRhs.iCapabilityInfo |
|
2719 && aLhs.iListenInterval == aRhs.iListenInterval ); |
|
2720 } |
|
2721 |
|
2722 |
|
2723 /** |
|
2724 * 802.11 association request management frame |
|
2725 * excluding variable length information elements |
|
2726 * - SSID |
|
2727 * - supported rates |
|
2728 */ |
|
2729 #pragma pack( 1 ) |
|
2730 struct SAssociationRequestFrame |
|
2731 { |
|
2732 /** management frame header */ |
|
2733 SManagementFrameHeader iHeader; // 24 bytes |
|
2734 /** association request fixed fields */ |
|
2735 SAssociationRequestFixedFields iFixedFields; // 4 bytes |
|
2736 |
|
2737 /** Ctor */ |
|
2738 SAssociationRequestFrame() |
|
2739 : iHeader( E802Dot11FrameTypeAssociationReq ), |
|
2740 iFixedFields() {}; |
|
2741 |
|
2742 /** |
|
2743 * Helper function to set short preamble bit in capability info |
|
2744 */ |
|
2745 inline void SetCapabilityShortPreamble(); |
|
2746 |
|
2747 /** |
|
2748 * Helper function to clear short preamble bit in capability info |
|
2749 */ |
|
2750 inline void ClearCapabilityShortPreamble(); |
|
2751 |
|
2752 /** |
|
2753 * Helper function to set PBCC bit in capability info |
|
2754 */ |
|
2755 inline void SetCapabilityPbcc(); |
|
2756 |
|
2757 /** |
|
2758 * Helper function to clear PBCC bit in capability info |
|
2759 */ |
|
2760 inline void ClearCapabilityPbcc(); |
|
2761 |
|
2762 /** |
|
2763 * Helper function to clear CF fields from capability info |
|
2764 */ |
|
2765 inline void ClearCFfields(); |
|
2766 |
|
2767 /** Helper function to clear reserved fields */ |
|
2768 inline void ClearReservedFields(); |
|
2769 |
|
2770 /** Helper function to set WEP bit from the capability info fixed field */ |
|
2771 inline void SetWepBit(); |
|
2772 |
|
2773 /** |
|
2774 * Helper function to clear WEP bit from |
|
2775 * the capability info fixed field |
|
2776 */ |
|
2777 inline void ClearWepBit(); |
|
2778 |
|
2779 private: |
|
2780 |
|
2781 /** Prohibit assignment operator */ |
|
2782 SAssociationRequestFrame& operator= ( |
|
2783 const SAssociationRequestFrame& ); |
|
2784 /** Prohibit copy constructor */ |
|
2785 SAssociationRequestFrame( |
|
2786 const SAssociationRequestFrame& ); |
|
2787 } __PACKED; // 28 bytes |
|
2788 |
|
2789 // --------------------------------------------------------------------------- |
|
2790 // |
|
2791 // --------------------------------------------------------------------------- |
|
2792 // |
|
2793 inline void SAssociationRequestFrame::SetCapabilityShortPreamble() |
|
2794 { |
|
2795 iFixedFields.iCapabilityInfo.SetShortPreamble(); |
|
2796 } |
|
2797 |
|
2798 // --------------------------------------------------------------------------- |
|
2799 // |
|
2800 // --------------------------------------------------------------------------- |
|
2801 // |
|
2802 inline void SAssociationRequestFrame::ClearCapabilityShortPreamble() |
|
2803 { |
|
2804 iFixedFields.iCapabilityInfo.ClearShortPreamble(); |
|
2805 } |
|
2806 |
|
2807 // --------------------------------------------------------------------------- |
|
2808 // |
|
2809 // --------------------------------------------------------------------------- |
|
2810 // |
|
2811 inline void SAssociationRequestFrame::SetCapabilityPbcc() |
|
2812 { |
|
2813 iFixedFields.iCapabilityInfo.SetPbcc(); |
|
2814 } |
|
2815 |
|
2816 // --------------------------------------------------------------------------- |
|
2817 // |
|
2818 // --------------------------------------------------------------------------- |
|
2819 // |
|
2820 inline void SAssociationRequestFrame::ClearCapabilityPbcc() |
|
2821 { |
|
2822 iFixedFields.iCapabilityInfo.ClearPbcc(); |
|
2823 } |
|
2824 |
|
2825 // --------------------------------------------------------------------------- |
|
2826 // |
|
2827 // --------------------------------------------------------------------------- |
|
2828 // |
|
2829 inline void SAssociationRequestFrame::ClearCFfields() |
|
2830 { |
|
2831 iFixedFields.iCapabilityInfo.ClearCfFields(); |
|
2832 } |
|
2833 |
|
2834 // --------------------------------------------------------------------------- |
|
2835 // |
|
2836 // --------------------------------------------------------------------------- |
|
2837 // |
|
2838 inline void SAssociationRequestFrame::ClearReservedFields() |
|
2839 { |
|
2840 iFixedFields.iCapabilityInfo.ClearReservedFields(); |
|
2841 } |
|
2842 |
|
2843 // --------------------------------------------------------------------------- |
|
2844 // |
|
2845 // --------------------------------------------------------------------------- |
|
2846 // |
|
2847 inline void SAssociationRequestFrame::SetWepBit() |
|
2848 { |
|
2849 iFixedFields.iCapabilityInfo.SetWepBit(); |
|
2850 } |
|
2851 |
|
2852 // --------------------------------------------------------------------------- |
|
2853 // |
|
2854 // --------------------------------------------------------------------------- |
|
2855 // |
|
2856 inline void SAssociationRequestFrame::ClearWepBit() |
|
2857 { |
|
2858 iFixedFields.iCapabilityInfo.ClearWepBit(); |
|
2859 } |
|
2860 |
|
2861 /** |
|
2862 * 802.11 association response frame fixed fields |
|
2863 */ |
|
2864 #pragma pack( 1 ) |
|
2865 struct SAssociationResponseFixedFields |
|
2866 { |
|
2867 /** capability info fixed field */ |
|
2868 SCapabilityInformationField iCapabilityInfo; // 2 bytes |
|
2869 /** status code fixed field */ |
|
2870 TUint16 iStatusCode; // 2 bytes |
|
2871 /** AID fixed field */ |
|
2872 TUint16 iAID; // 2 bytes |
|
2873 |
|
2874 /** |
|
2875 * Returns the association response status code |
|
2876 * @return status code |
|
2877 */ |
|
2878 inline TUint16 StatusCode() const; |
|
2879 |
|
2880 /** |
|
2881 * Returns the Association ID (AID) |
|
2882 * @return AID |
|
2883 */ |
|
2884 inline TUint16 Aid() const; |
|
2885 |
|
2886 private: |
|
2887 |
|
2888 /** Prohibit assignment operator */ |
|
2889 SAssociationResponseFixedFields& operator= ( |
|
2890 const SAssociationResponseFixedFields& ); |
|
2891 /** Prohibit copy constructor */ |
|
2892 SAssociationResponseFixedFields( const SAssociationResponseFixedFields& ); |
|
2893 } __PACKED; |
|
2894 |
|
2895 inline TUint16 SAssociationResponseFixedFields::StatusCode() const |
|
2896 { |
|
2897 return ( ReadUint16Toh( &iStatusCode ) ); |
|
2898 } |
|
2899 |
|
2900 inline TUint16 SAssociationResponseFixedFields::Aid() const |
|
2901 { |
|
2902 return ( ReadUint16Toh( &iAID ) ); |
|
2903 } |
|
2904 |
|
2905 |
|
2906 /** |
|
2907 * 802.11 fixed length components required in deauthenticate frame |
|
2908 */ |
|
2909 #pragma pack( 1 ) |
|
2910 struct SDeauthenticateFixedFields |
|
2911 { |
|
2912 /** reason code fixed field */ |
|
2913 TUint16 iReasonCode; |
|
2914 |
|
2915 /** Ctor */ |
|
2916 SDeauthenticateFixedFields() |
|
2917 : iReasonCode( E802Dot11ReasonDeauthStationLeft ) {}; |
|
2918 |
|
2919 /* |
|
2920 * Returns the reason code |
|
2921 * @return Reason code |
|
2922 */ |
|
2923 inline TUint16 ReasonCode() const; |
|
2924 |
|
2925 /** Setter for the reason code */ |
|
2926 inline void SetReasonCode( TUint16 aReasonCode ); |
|
2927 |
|
2928 private: |
|
2929 |
|
2930 /** Prohibit assignment operator */ |
|
2931 SDeauthenticateFixedFields& operator= ( |
|
2932 T802Dot11ManagementReasonCode aReason ); |
|
2933 /** Prohibit copy constructor */ |
|
2934 SDeauthenticateFixedFields( const SDeauthenticateFixedFields& ); |
|
2935 } __PACKED; |
|
2936 |
|
2937 // --------------------------------------------------------------------------- |
|
2938 // |
|
2939 // --------------------------------------------------------------------------- |
|
2940 // |
|
2941 inline TUint16 SDeauthenticateFixedFields::ReasonCode() const |
|
2942 { |
|
2943 return ( ReadUint16Toh( &iReasonCode ) ); |
|
2944 } |
|
2945 |
|
2946 // --------------------------------------------------------------------------- |
|
2947 // |
|
2948 // --------------------------------------------------------------------------- |
|
2949 // |
|
2950 inline void SDeauthenticateFixedFields::SetReasonCode( TUint16 aReasonCode ) |
|
2951 { |
|
2952 WriteHtoUint16( &iReasonCode, aReasonCode ); |
|
2953 } |
|
2954 |
|
2955 /** |
|
2956 * operator== for SDeauthenticateFixedFields |
|
2957 * @param aLhs left hand side |
|
2958 * @param aRhs right hand side |
|
2959 * @return ETrue equal, EFalse not equal |
|
2960 */ |
|
2961 inline TBool operator== ( |
|
2962 const SDeauthenticateFixedFields& aLhs, |
|
2963 const SDeauthenticateFixedFields& aRhs) |
|
2964 { |
|
2965 return static_cast<TBool>( |
|
2966 aLhs.ReasonCode() == aRhs.ReasonCode() ); |
|
2967 } |
|
2968 |
|
2969 /** |
|
2970 * 802.11 deauthenticate management frame |
|
2971 */ |
|
2972 #pragma pack( 1 ) |
|
2973 struct SDeauthenticateFrame |
|
2974 { |
|
2975 /** management frame header */ |
|
2976 SManagementFrameHeader iHeader; // 24 bytes |
|
2977 /** reason code fixed field */ |
|
2978 SDeauthenticateFixedFields iReasonCode; // 2 bytes |
|
2979 |
|
2980 /** Ctor */ |
|
2981 SDeauthenticateFrame() |
|
2982 : iHeader( E802Dot11FrameTypeDeauthentication ), |
|
2983 iReasonCode() {}; |
|
2984 |
|
2985 private: |
|
2986 |
|
2987 /** Prohibit assignment operator */ |
|
2988 SDeauthenticateFrame& operator= ( const SDeauthenticateFrame& ); |
|
2989 /** Prohibit copy constructor */ |
|
2990 SDeauthenticateFrame( const SDeauthenticateFrame& ); |
|
2991 } __PACKED; |
|
2992 |
|
2993 /** |
|
2994 * operator== for SDeauthenticateFrame |
|
2995 * @param aLhs left hand side |
|
2996 * @param aRhs right hand side |
|
2997 * @return ETrue equal, EFalse not equal |
|
2998 */ |
|
2999 inline TBool operator== ( |
|
3000 const SDeauthenticateFrame& aLhs, |
|
3001 const SDeauthenticateFrame& aRhs) |
|
3002 { |
|
3003 return ( aLhs == aRhs ); |
|
3004 } |
|
3005 |
|
3006 /** |
|
3007 * 802.11 fixed length components required in disassociate frame |
|
3008 */ |
|
3009 #pragma pack( 1 ) |
|
3010 struct SDisAssociateFixedFields |
|
3011 { |
|
3012 /** reason code fixed field */ |
|
3013 TUint16 iReasonCode; |
|
3014 |
|
3015 /** Ctor */ |
|
3016 inline SDisAssociateFixedFields(); |
|
3017 |
|
3018 /* |
|
3019 * Returns the reason code |
|
3020 * @return Reason code |
|
3021 */ |
|
3022 inline TUint16 ReasonCode() const; |
|
3023 |
|
3024 /** Setter for the reason code */ |
|
3025 inline void SetReasonCode( TUint16 aReasonCode ); |
|
3026 |
|
3027 private: |
|
3028 // Prohibit assignment operator |
|
3029 SDisAssociateFixedFields& operator= ( const SDisAssociateFixedFields& ); |
|
3030 // Prohibit copy constructor |
|
3031 SDisAssociateFixedFields( const SDisAssociateFixedFields& ); |
|
3032 } __PACKED; |
|
3033 |
|
3034 // --------------------------------------------------------------------------- |
|
3035 // |
|
3036 // --------------------------------------------------------------------------- |
|
3037 // |
|
3038 inline SDisAssociateFixedFields::SDisAssociateFixedFields() |
|
3039 { |
|
3040 WriteHtoUint16( &iReasonCode, E802Dot11ReasonClass3FrameWhenNotAssoc ); |
|
3041 } |
|
3042 |
|
3043 // --------------------------------------------------------------------------- |
|
3044 // |
|
3045 // --------------------------------------------------------------------------- |
|
3046 // |
|
3047 inline TUint16 SDisAssociateFixedFields::ReasonCode() const |
|
3048 { |
|
3049 return ( ReadUint16Toh( &iReasonCode ) ); |
|
3050 } |
|
3051 |
|
3052 // --------------------------------------------------------------------------- |
|
3053 // |
|
3054 // --------------------------------------------------------------------------- |
|
3055 // |
|
3056 inline void SDisAssociateFixedFields::SetReasonCode( TUint16 aReasonCode ) |
|
3057 { |
|
3058 WriteHtoUint16( &iReasonCode, aReasonCode ); |
|
3059 } |
|
3060 |
|
3061 /** |
|
3062 * operator== for SDisAssociateFixedFields |
|
3063 * @param aLhs left hand side |
|
3064 * @param aRhs right hand side |
|
3065 * @return ETrue equal, EFalse not equal |
|
3066 */ |
|
3067 inline TBool operator== ( |
|
3068 const SDisAssociateFixedFields& aLhs, |
|
3069 const SDisAssociateFixedFields& aRhs) |
|
3070 { |
|
3071 return static_cast<TBool>( |
|
3072 aLhs.ReasonCode() == aRhs.ReasonCode() ); |
|
3073 } |
|
3074 |
|
3075 /** |
|
3076 * 802.11 disassociate management frame |
|
3077 */ |
|
3078 #pragma pack( 1 ) |
|
3079 struct SDisassociateFrame |
|
3080 { |
|
3081 /** management frame header */ |
|
3082 SManagementFrameHeader iHeader; // 24 bytes |
|
3083 /** reason code fixed field */ |
|
3084 SDisAssociateFixedFields iReasonCode; // 2 bytes |
|
3085 |
|
3086 /** Ctor */ |
|
3087 SDisassociateFrame() |
|
3088 : iHeader( E802Dot11FrameTypeDisassociation ), |
|
3089 iReasonCode() {}; |
|
3090 |
|
3091 private: |
|
3092 |
|
3093 /** Prohibit assignment operator */ |
|
3094 SDisassociateFrame& operator= ( const SDisassociateFrame& ); |
|
3095 /** Prohibit copy constructor */ |
|
3096 SDisassociateFrame( const SDisassociateFrame& ); |
|
3097 } __PACKED; // 26 bytes |
|
3098 |
|
3099 /** |
|
3100 * operator== for SDisassociateFrame |
|
3101 * @param aLhs left hand side |
|
3102 * @param aRhs right hand side |
|
3103 * @return ETrue equal, EFalse not equal |
|
3104 */ |
|
3105 inline TBool operator== ( |
|
3106 const SDisassociateFrame& aLhs, |
|
3107 const SDisassociateFrame& aRhs) |
|
3108 { |
|
3109 return ( aLhs == aRhs ); |
|
3110 } |
|
3111 |
|
3112 /** |
|
3113 * 802.11 fixed length components required |
|
3114 * in reassociation request management frame |
|
3115 */ |
|
3116 #pragma pack( 1 ) |
|
3117 struct SReassociationRequestFixedFields |
|
3118 { |
|
3119 /** capability info fixed field */ |
|
3120 SCapabilityInformationField iCapabilityInfo; // 2 bytes |
|
3121 /** listeninterval fixed field */ |
|
3122 SListenIntervalField iListenInterval; // 2 bytes |
|
3123 /** current AP address fixed field */ |
|
3124 TMacAddress iCurrentApAddress; // 6 bytes |
|
3125 |
|
3126 /** Ctor */ |
|
3127 SReassociationRequestFixedFields() {}; |
|
3128 |
|
3129 private: |
|
3130 |
|
3131 /** Prohibit assignment operator */ |
|
3132 SReassociationRequestFixedFields& operator= ( |
|
3133 const SReassociationRequestFixedFields& ); |
|
3134 /** Prohibit copy constructor */ |
|
3135 SReassociationRequestFixedFields( |
|
3136 const SReassociationRequestFixedFields& ); |
|
3137 } __PACKED; |
|
3138 |
|
3139 /** |
|
3140 * operator== for SReassociationRequestFixedFields |
|
3141 * @param aLhs left hand side |
|
3142 * @param aRhs right hand side |
|
3143 * @return ETrue equal, EFalse not equal |
|
3144 */ |
|
3145 inline TBool operator== ( |
|
3146 const SReassociationRequestFixedFields& aLhs, |
|
3147 const SReassociationRequestFixedFields& aRhs) |
|
3148 { |
|
3149 return static_cast<TBool>( aLhs.iCapabilityInfo == aRhs.iCapabilityInfo |
|
3150 && aLhs.iListenInterval == aRhs.iListenInterval |
|
3151 && aLhs.iCurrentApAddress == aRhs.iCurrentApAddress ); |
|
3152 } |
|
3153 |
|
3154 /** |
|
3155 * 802.11 reassociation request management frame |
|
3156 * excluding variable length information elements |
|
3157 */ |
|
3158 #pragma pack( 1 ) |
|
3159 struct SReassociationRequestFrame |
|
3160 { |
|
3161 /** management frame header */ |
|
3162 SManagementFrameHeader iHeader; // 24 bytes |
|
3163 /** association request fixed fields */ |
|
3164 SReassociationRequestFixedFields iFixedFields; // 10 bytes |
|
3165 |
|
3166 /** Ctor */ |
|
3167 SReassociationRequestFrame() |
|
3168 : iHeader( E802Dot11FrameTypeReassociationReq ), |
|
3169 iFixedFields() {}; |
|
3170 |
|
3171 /** |
|
3172 * Helper function to set short preamble bit in capability info |
|
3173 */ |
|
3174 inline void SetCapabilityShortPreamble(); |
|
3175 |
|
3176 /** |
|
3177 * Helper function to clear short preamble bit in capability info |
|
3178 */ |
|
3179 inline void ClearCapabilityShortPreamble(); |
|
3180 |
|
3181 /** |
|
3182 * Helper function to set PBCC bit in capability info |
|
3183 */ |
|
3184 inline void SetCapabilityPbcc(); |
|
3185 |
|
3186 /** |
|
3187 * Helper function to clear PBCC bit in capability info |
|
3188 */ |
|
3189 inline void ClearCapabilityPbcc(); |
|
3190 |
|
3191 /** |
|
3192 * Helper function to clear CF fields from capability info |
|
3193 */ |
|
3194 inline void ClearCFfields(); |
|
3195 |
|
3196 /** Helper function to clear reserved fields */ |
|
3197 inline void ClearReservedFields(); |
|
3198 |
|
3199 /** Helper function to set WEP bit from the capability info fixed field */ |
|
3200 inline void SetWepBit(); |
|
3201 |
|
3202 /** |
|
3203 * Helper function to clear WEP bit from |
|
3204 * the capability info fixed field |
|
3205 */ |
|
3206 inline void ClearWepBit(); |
|
3207 |
|
3208 private: |
|
3209 |
|
3210 /** Prohibit assignment operator */ |
|
3211 SReassociationRequestFrame& operator= ( |
|
3212 const SReassociationRequestFrame& ); |
|
3213 /** Prohibit copy constructor */ |
|
3214 SReassociationRequestFrame( |
|
3215 const SReassociationRequestFrame& ); |
|
3216 } __PACKED; // 34 bytes |
|
3217 |
|
3218 // --------------------------------------------------------------------------- |
|
3219 // |
|
3220 // --------------------------------------------------------------------------- |
|
3221 // |
|
3222 inline void SReassociationRequestFrame::SetCapabilityShortPreamble() |
|
3223 { |
|
3224 iFixedFields.iCapabilityInfo.SetShortPreamble(); |
|
3225 } |
|
3226 |
|
3227 // --------------------------------------------------------------------------- |
|
3228 // |
|
3229 // --------------------------------------------------------------------------- |
|
3230 // |
|
3231 inline void SReassociationRequestFrame::ClearCapabilityShortPreamble() |
|
3232 { |
|
3233 iFixedFields.iCapabilityInfo.ClearShortPreamble(); |
|
3234 } |
|
3235 |
|
3236 // --------------------------------------------------------------------------- |
|
3237 // |
|
3238 // --------------------------------------------------------------------------- |
|
3239 // |
|
3240 inline void SReassociationRequestFrame::SetCapabilityPbcc() |
|
3241 { |
|
3242 iFixedFields.iCapabilityInfo.SetPbcc(); |
|
3243 } |
|
3244 |
|
3245 // --------------------------------------------------------------------------- |
|
3246 // |
|
3247 // --------------------------------------------------------------------------- |
|
3248 // |
|
3249 inline void SReassociationRequestFrame::ClearCapabilityPbcc() |
|
3250 { |
|
3251 iFixedFields.iCapabilityInfo.ClearPbcc(); |
|
3252 } |
|
3253 |
|
3254 // --------------------------------------------------------------------------- |
|
3255 // |
|
3256 // --------------------------------------------------------------------------- |
|
3257 // |
|
3258 inline void SReassociationRequestFrame::ClearCFfields() |
|
3259 { |
|
3260 iFixedFields.iCapabilityInfo.ClearCfFields(); |
|
3261 } |
|
3262 |
|
3263 // --------------------------------------------------------------------------- |
|
3264 // |
|
3265 // --------------------------------------------------------------------------- |
|
3266 // |
|
3267 inline void SReassociationRequestFrame::ClearReservedFields() |
|
3268 { |
|
3269 iFixedFields.iCapabilityInfo.ClearReservedFields(); |
|
3270 } |
|
3271 |
|
3272 // --------------------------------------------------------------------------- |
|
3273 // |
|
3274 // --------------------------------------------------------------------------- |
|
3275 // |
|
3276 inline void SReassociationRequestFrame::SetWepBit() |
|
3277 { |
|
3278 iFixedFields.iCapabilityInfo.SetWepBit(); |
|
3279 } |
|
3280 |
|
3281 // --------------------------------------------------------------------------- |
|
3282 // |
|
3283 // --------------------------------------------------------------------------- |
|
3284 // |
|
3285 inline void SReassociationRequestFrame::ClearWepBit() |
|
3286 { |
|
3287 iFixedFields.iCapabilityInfo.ClearWepBit(); |
|
3288 } |
|
3289 |
|
3290 /** |
|
3291 * 802.11 reassociation response frame fixed fields |
|
3292 */ |
|
3293 #pragma pack( 1 ) |
|
3294 struct SReassociationResponseFixedFields |
|
3295 { |
|
3296 /** capability info fixed field */ |
|
3297 SCapabilityInformationField iCapabilityInfo; // 2 bytes |
|
3298 /** status code fixed field */ |
|
3299 TUint16 iStatusCode; // 2 bytes |
|
3300 /** AID fixed field */ |
|
3301 TUint16 iAID; // 2 bytes |
|
3302 |
|
3303 /* |
|
3304 * Returns the reassociation response status code |
|
3305 * @return status code |
|
3306 */ |
|
3307 inline TUint16 StatusCode() const; |
|
3308 |
|
3309 /* |
|
3310 * Returns the Asociation ID (AID) |
|
3311 * @return AID |
|
3312 */ |
|
3313 inline TUint16 Aid() const; |
|
3314 |
|
3315 private: |
|
3316 |
|
3317 /** Prohibit assignment operator */ |
|
3318 SReassociationResponseFixedFields& operator= ( |
|
3319 const SReassociationResponseFixedFields& ); |
|
3320 /** Prohibit copy constructor */ |
|
3321 SReassociationResponseFixedFields( const SReassociationResponseFixedFields& ); |
|
3322 } __PACKED; |
|
3323 |
|
3324 // --------------------------------------------------------------------------- |
|
3325 // |
|
3326 // --------------------------------------------------------------------------- |
|
3327 // |
|
3328 inline TUint16 SReassociationResponseFixedFields::StatusCode() const |
|
3329 { |
|
3330 return ( ReadUint16Toh( &iStatusCode ) ); |
|
3331 } |
|
3332 |
|
3333 // --------------------------------------------------------------------------- |
|
3334 // |
|
3335 // --------------------------------------------------------------------------- |
|
3336 // |
|
3337 inline TUint16 SReassociationResponseFixedFields::Aid() const |
|
3338 { |
|
3339 return ( ReadUint16Toh( &iAID ) ); |
|
3340 } |
|
3341 |
|
3342 |
|
3343 /** |
|
3344 * SNAP header |
|
3345 */ |
|
3346 #pragma pack( 1 ) |
|
3347 struct SSnapHeader |
|
3348 { |
|
3349 /** destination service access point */ |
|
3350 TUint8 iDSAP; |
|
3351 /** source service access point */ |
|
3352 TUint8 iSSAP; |
|
3353 /** control field */ |
|
3354 TUint8 iControl; |
|
3355 /** organizationally unique identifier */ |
|
3356 TUint8 iOUI[KOIULength]; // 3 |
|
3357 } __PACKED; // 6 bytes |
|
3358 |
|
3359 /** |
|
3360 * operator== for SSnapHeader |
|
3361 * @param aLhs left hand side |
|
3362 * @param aRhs right hand side |
|
3363 * @return ETrue equal, EFalse not equal |
|
3364 */ |
|
3365 inline TBool operator== ( |
|
3366 const SSnapHeader& aLhs, |
|
3367 const SSnapHeader& aRhs) |
|
3368 { |
|
3369 return ( equal( reinterpret_cast<const TUint8*>(&aLhs), |
|
3370 reinterpret_cast<const TUint8*>(&aLhs) + sizeof(SSnapHeader), |
|
3371 reinterpret_cast<const TUint8*>(&aRhs) )); |
|
3372 } |
|
3373 |
|
3374 /** |
|
3375 * RFC 1042 encapsulation SNAP header |
|
3376 */ |
|
3377 const SSnapHeader KEncapsulatingRfc1042SnapHeader |
|
3378 = { 0xAA, 0xAA, 0x03, { 0x00, 0x00, 0x00 } }; |
|
3379 |
|
3380 /** |
|
3381 * 802.1 h SNAP header |
|
3382 */ |
|
3383 const SSnapHeader KEncapsulating802_1hSnapHeader |
|
3384 = { 0xAA, 0xAA, 0x03, { 0x00, 0x00, 0xF8 } }; |
|
3385 |
|
3386 /** |
|
3387 * 802.11 data frame encapsulation header |
|
3388 */ |
|
3389 #pragma pack( 1 ) |
|
3390 struct SDataFrameEncapsulationHeader |
|
3391 { |
|
3392 /** SNAP header */ |
|
3393 SSnapHeader iSnapHeader; // 6 |
|
3394 } __PACKED; |
|
3395 |
|
3396 /** |
|
3397 * 802.11 data frame and its encapsulation header combined |
|
3398 */ |
|
3399 #pragma pack( 1 ) |
|
3400 struct SDataMpduHeader |
|
3401 { |
|
3402 /** Ctor */ |
|
3403 SDataMpduHeader() |
|
3404 { |
|
3405 iEncHdr.iSnapHeader = KEncapsulatingRfc1042SnapHeader; |
|
3406 } |
|
3407 |
|
3408 /** 802.11 data frame header */ |
|
3409 SDataFrameHeader iHdr; // 24 |
|
3410 /** 802.11 data frame encapsulation header */ |
|
3411 SDataFrameEncapsulationHeader iEncHdr; // 6 |
|
3412 } __PACKED; // 30 |
|
3413 |
|
3414 /* |
|
3415 802.2 SNAP DATA Frame |
|
3416 +----------------+ |
|
3417 | | |
|
3418 | Destination | |
|
3419 | 6 bytes | |
|
3420 +----------------+ |
|
3421 | | |
|
3422 | Source | |
|
3423 | 6 bytes | |
|
3424 +----------------+ |
|
3425 | Frame Length | Must be <= 1500 Dec. |
|
3426 | 2 bytes | |
|
3427 +----------------+ |
|
3428 | DSAP - 1 byte | = 0xAA ( SNAP ) |
|
3429 +----------------+ |
|
3430 | SSAP - 1 byte | = 0xAA ( SNAP ) |
|
3431 +----------------+ |
|
3432 |Control - 1 byte| = 0x03 |
|
3433 +----------------+ |
|
3434 | OUI - 3 bytes | = 0x0 |
|
3435 | | |
|
3436 +----------------+ |
|
3437 | Type - 2 bytes | = Ethernet type (IP=0x0800) |
|
3438 +----------------+ |
|
3439 | | |
|
3440 | Data | |
|
3441 | | |
|
3442 ~ ~ |
|
3443 ~ ~ |
|
3444 | 46 to 1500 | |
|
3445 | bytes | |
|
3446 | | |
|
3447 +----------------+ |
|
3448 | FCS | |
|
3449 | 4 bytes | |
|
3450 +----------------+ |
|
3451 */ |
|
3452 |
|
3453 /* |
|
3454 This is an Ethernet Version 2 frame: |
|
3455 |
|
3456 +--------------+ |
|
3457 | | The destination address is a six byte Media Access |
|
3458 | Destination | Control (MAC) address, usually burned into the |
|
3459 | 6 bytes | ROM of the Ethernet card. |
|
3460 +--------------+ |
|
3461 | | The source address is a six byte MAC address, and |
|
3462 | Source | can signify a physical station or a broadcast. |
|
3463 | 6 bytes | |
|
3464 +--------------+ |
|
3465 | Type | The Type field it must be grater then 1500 dec. |
|
3466 | 2 bytes | |
|
3467 +--------------+ |
|
3468 | | Any higher layer information is placed in the |
|
3469 | Data | data field, which could contain protocol |
|
3470 | | information or user data. |
|
3471 ~ ~ |
|
3472 ~ ~ |
|
3473 | 46 to 1500 | |
|
3474 | bytes | |
|
3475 | | |
|
3476 +--------------+ |
|
3477 | FCS | |
|
3478 | 4 bytes | |
|
3479 +--------------+ |
|
3480 |
|
3481 */ |
|
3482 |
|
3483 /** |
|
3484 * 802.11 QoS data frame and its encapsulation header combined |
|
3485 */ |
|
3486 #pragma pack( 1 ) |
|
3487 struct SQosDataMpduHeader |
|
3488 { |
|
3489 /** Ctor */ |
|
3490 SQosDataMpduHeader() |
|
3491 { |
|
3492 iEncHdr.iSnapHeader = KEncapsulatingRfc1042SnapHeader; |
|
3493 } |
|
3494 |
|
3495 /** 802.11 QoS data frame header */ |
|
3496 SQosDataFrameHeader iHdr; // 26 |
|
3497 /** 802.11 data frame encapsulation header */ |
|
3498 SDataFrameEncapsulationHeader iEncHdr; // 6 |
|
3499 } __PACKED; // 33 |
|
3500 |
|
3501 const TUint16 KUint16HiByteMask = 0xFF00; |
|
3502 |
|
3503 /** |
|
3504 * Ethernet 14-byte Header (RFC 894) |
|
3505 */ |
|
3506 #pragma pack( 1 ) |
|
3507 struct SEthernetHeader |
|
3508 { |
|
3509 /** destination MAC address */ |
|
3510 TMacAddress iDA; // 6 |
|
3511 /** source MAC address */ |
|
3512 TMacAddress iSA; // 6 |
|
3513 /** ethernet type field */ |
|
3514 TUint16 iType; // 2 |
|
3515 |
|
3516 /** |
|
3517 * Returns the Ethernet Type |
|
3518 * @return ethernet type |
|
3519 */ |
|
3520 inline TUint16 Type() const; |
|
3521 } __PACKED; |
|
3522 |
|
3523 // --------------------------------------------------------------------------- |
|
3524 // If the type is other than EAPOL (e.g. IP or ARP), we need to reverse the |
|
3525 // byte order as the IP world uses different byter order (MSB first) as WLAN |
|
3526 // MAC layer (LSB first) |
|
3527 // --------------------------------------------------------------------------- |
|
3528 // |
|
3529 inline TUint16 SEthernetHeader::Type() const |
|
3530 { |
|
3531 return ReverseUint16( ReadUint16Toh( &iType ) ); |
|
3532 } |
|
3533 |
|
3534 /** |
|
3535 * Ethernet 802.2/802.3 Header (RFC 1042) |
|
3536 */ |
|
3537 #pragma pack( 1 ) |
|
3538 struct SEthernet802_3Header |
|
3539 { |
|
3540 /** destination MAC address */ |
|
3541 TMacAddress iDA; // 6 |
|
3542 /** source MAC address */ |
|
3543 TMacAddress iSA; // 6 |
|
3544 /** length of frame */ |
|
3545 TUint16 iLength; // 2 |
|
3546 /** SNAP header */ |
|
3547 SSnapHeader iSnapHeader;// 6 |
|
3548 /** type field */ |
|
3549 TUint16 iType; // 2 |
|
3550 } __PACKED; |
|
3551 |
|
3552 /** |
|
3553 * Ethernet type field |
|
3554 */ |
|
3555 #pragma pack( 1 ) |
|
3556 struct SEthernetType |
|
3557 { |
|
3558 /** type field */ |
|
3559 TUint16 iType; // 2 |
|
3560 |
|
3561 /** |
|
3562 * Returns the Ethernet Type |
|
3563 * @return ethernet type |
|
3564 */ |
|
3565 inline TUint16 Type() const; |
|
3566 } __PACKED; |
|
3567 |
|
3568 // --------------------------------------------------------------------------- |
|
3569 // We need to reverse the byte order as the IP world uses different byter |
|
3570 // order (MSB first) as WLAN MAC layer (LSB first) |
|
3571 // --------------------------------------------------------------------------- |
|
3572 // |
|
3573 inline TUint16 SEthernetType::Type() const |
|
3574 { |
|
3575 return ReverseUint16( ReadUint16Toh( &iType ) ); |
|
3576 } |
|
3577 |
|
3578 /** |
|
3579 * IP version mask |
|
3580 */ |
|
3581 const TUint8 KIpVersionMask = 0xF0; |
|
3582 |
|
3583 /** |
|
3584 * The DS (differentiated services) field according to RFC 2474 |
|
3585 * Bits 0-5: DSCP (differentiated services codepoint) |
|
3586 * Bits 6-7: CU (currently unused) |
|
3587 */ |
|
3588 typedef TUint8 TDsField; |
|
3589 |
|
3590 /** |
|
3591 * According to the WiFi-WMM Test Specification v1.2 the three highest |
|
3592 * bits of the DS field determine the user priority |
|
3593 * This is a mask for those bits in IPv4 header |
|
3594 */ |
|
3595 const TUint8 KDscpIpv4Mask = 0xE0; |
|
3596 |
|
3597 /** |
|
3598 * Version number for IPv4 |
|
3599 */ |
|
3600 const TUint8 KIpv4 = 4; |
|
3601 |
|
3602 /** |
|
3603 * Version number for IPv6 |
|
3604 */ |
|
3605 const TUint8 KIpv6 = 6; |
|
3606 |
|
3607 /** |
|
3608 * IPv4 header (RFC 791) prefix with the Type of Service field redefined |
|
3609 * as the DS field according to RFC 2474 |
|
3610 */ |
|
3611 #pragma pack( 1 ) |
|
3612 struct SIpv4HeaderPrefix |
|
3613 { |
|
3614 /** Version (4 highest bits) + IHL (Internet Header Length, 4 lowest |
|
3615 bits) */ |
|
3616 TUint8 iVersionIhl; // 1 |
|
3617 /** DS field */ |
|
3618 TDsField iDs; // 1 |
|
3619 |
|
3620 /** |
|
3621 * Returns the IP protocol version |
|
3622 */ |
|
3623 inline TUint8 Version() const; |
|
3624 |
|
3625 /** |
|
3626 * Returns the 802.1d priority value (range 0-7) |
|
3627 */ |
|
3628 inline TUint8 The802Dot1dPriority() const; |
|
3629 } __PACKED; |
|
3630 |
|
3631 // --------------------------------------------------------------------------- |
|
3632 // |
|
3633 // --------------------------------------------------------------------------- |
|
3634 // |
|
3635 inline TUint8 SIpv4HeaderPrefix::Version() const |
|
3636 { |
|
3637 return ( iVersionIhl & KIpVersionMask ) >> 4; |
|
3638 } |
|
3639 |
|
3640 // --------------------------------------------------------------------------- |
|
3641 // |
|
3642 // --------------------------------------------------------------------------- |
|
3643 // |
|
3644 inline TUint8 SIpv4HeaderPrefix::The802Dot1dPriority() const |
|
3645 { |
|
3646 return ( ( iDs & KDscpIpv4Mask ) >> 5 ); |
|
3647 } |
|
3648 |
|
3649 /** |
|
3650 * According to the WiFi-WMM Test Specification v1.2 the three highest |
|
3651 * bits of the DS field determine the user priority |
|
3652 * This is a mask for those bits in IPv6 header |
|
3653 */ |
|
3654 const TUint8 KDscpIpv6Mask = 0x0E; |
|
3655 |
|
3656 /** |
|
3657 * IPv6 header (RFC 2460) prefix with the Traffic Class field redefined |
|
3658 * as the DS field according to RFC 2474 |
|
3659 */ |
|
3660 #pragma pack( 1 ) |
|
3661 struct SIpv6HeaderPrefix |
|
3662 { |
|
3663 /** |
|
3664 * Version (highest 4 bits) + highest 4 bits of the DS (in lowest 4 bits |
|
3665 * of this byte) |
|
3666 */ |
|
3667 TUint8 iVersionDs; // 1 |
|
3668 |
|
3669 /** |
|
3670 * Returns the 802.1d priority value (range 0-7) |
|
3671 */ |
|
3672 inline TUint8 The802Dot1dPriority() const; |
|
3673 } __PACKED; |
|
3674 |
|
3675 // --------------------------------------------------------------------------- |
|
3676 // |
|
3677 // --------------------------------------------------------------------------- |
|
3678 // |
|
3679 inline TUint8 SIpv6HeaderPrefix::The802Dot1dPriority() const |
|
3680 { |
|
3681 return ( ( iVersionDs & KDscpIpv6Mask ) >> 1 ); |
|
3682 } |
|
3683 |
|
3684 // pop the pragma pack stack to return to normal alignment of structures |
|
3685 #pragma pack( ) |
|
3686 |
|
3687 /** |
|
3688 * typedef for WEP key |
|
3689 */ |
|
3690 typedef TUint8 TWepKey[KMaxWEPKeyLength]; |
|
3691 |
|
3692 /** |
|
3693 * Struct for mapped key: key + mac address |
|
3694 */ |
|
3695 struct SMappedWepKey |
|
3696 { |
|
3697 TMacAddress MacAddress; |
|
3698 TWepKey WepKey; |
|
3699 }; |
|
3700 |
|
3701 /** |
|
3702 * Struct for tkip key |
|
3703 */ |
|
3704 struct STkipKey |
|
3705 { |
|
3706 TMacAddress MacAddress; |
|
3707 TWepKey WepKey; |
|
3708 TUint8 KeyId; |
|
3709 TUint8 KeyIndicator; |
|
3710 TUint8 KeyIndex; |
|
3711 }; |
|
3712 |
|
3713 #endif // WLAN802DOT11_H |
|