|
@@ -124,6 +124,8 @@
|
124
|
124
|
#define WLAN_FSTYPE_DEAUTHEN 0x0c
|
125
|
125
|
|
126
|
126
|
/* Control */
|
|
127
|
+#define WLAN_FSTYPE_BLOCKACKREQ 0x8
|
|
128
|
+#define WLAN_FSTYPE_BLOCKACK 0x9
|
127
|
129
|
#define WLAN_FSTYPE_PSPOLL 0x0a
|
128
|
130
|
#define WLAN_FSTYPE_RTS 0x0b
|
129
|
131
|
#define WLAN_FSTYPE_CTS 0x0c
|
|
@@ -218,35 +220,32 @@
|
218
|
220
|
typedef UINT8 wlan_bss_ts_t[WLAN_BSS_TS_LEN];
|
219
|
221
|
|
220
|
222
|
/* Generic 802.11 Header types */
|
221
|
|
-__WLAN_PRAGMA_PACK1__
|
|
223
|
+
|
222
|
224
|
typedef struct p80211_hdr_a3
|
223
|
225
|
{
|
224
|
|
- UINT16 fc __WLAN_ATTRIB_PACK__;
|
225
|
|
- UINT16 dur __WLAN_ATTRIB_PACK__;
|
226
|
|
- UINT8 a1[WLAN_ADDR_LEN] __WLAN_ATTRIB_PACK__;
|
227
|
|
- UINT8 a2[WLAN_ADDR_LEN] __WLAN_ATTRIB_PACK__;
|
228
|
|
- UINT8 a3[WLAN_ADDR_LEN] __WLAN_ATTRIB_PACK__;
|
229
|
|
- UINT16 seq __WLAN_ATTRIB_PACK__;
|
|
226
|
+ UINT16 fc;
|
|
227
|
+ UINT16 dur;
|
|
228
|
+ UINT8 a1[WLAN_ADDR_LEN];
|
|
229
|
+ UINT8 a2[WLAN_ADDR_LEN];
|
|
230
|
+ UINT8 a3[WLAN_ADDR_LEN];
|
|
231
|
+ UINT16 seq;
|
230
|
232
|
} __WLAN_ATTRIB_PACK__ p80211_hdr_a3_t;
|
231
|
|
-__WLAN_PRAGMA_PACKDFLT__
|
232
|
233
|
|
233
|
|
-__WLAN_PRAGMA_PACK1__
|
234
|
234
|
typedef struct p80211_hdr_a4
|
235
|
235
|
{
|
236
|
|
- UINT16 fc __WLAN_ATTRIB_PACK__;
|
237
|
|
- UINT16 dur __WLAN_ATTRIB_PACK__;
|
238
|
|
- UINT8 a1[WLAN_ADDR_LEN] __WLAN_ATTRIB_PACK__;
|
239
|
|
- UINT8 a2[WLAN_ADDR_LEN] __WLAN_ATTRIB_PACK__;
|
240
|
|
- UINT8 a3[WLAN_ADDR_LEN] __WLAN_ATTRIB_PACK__;
|
241
|
|
- UINT16 seq __WLAN_ATTRIB_PACK__;
|
242
|
|
- UINT8 a4[WLAN_ADDR_LEN] __WLAN_ATTRIB_PACK__;
|
|
236
|
+ UINT16 fc;
|
|
237
|
+ UINT16 dur;
|
|
238
|
+ UINT8 a1[WLAN_ADDR_LEN];
|
|
239
|
+ UINT8 a2[WLAN_ADDR_LEN];
|
|
240
|
+ UINT8 a3[WLAN_ADDR_LEN];
|
|
241
|
+ UINT16 seq;
|
|
242
|
+ UINT8 a4[WLAN_ADDR_LEN];
|
243
|
243
|
} __WLAN_ATTRIB_PACK__ p80211_hdr_a4_t;
|
244
|
|
-__WLAN_PRAGMA_PACKDFLT__
|
245
|
244
|
|
246
|
245
|
typedef union p80211_hdr
|
247
|
246
|
{
|
248
|
|
- p80211_hdr_a3_t a3 __WLAN_ATTRIB_PACK__;
|
249
|
|
- p80211_hdr_a4_t a4 __WLAN_ATTRIB_PACK__;
|
|
247
|
+ p80211_hdr_a3_t a3;
|
|
248
|
+ p80211_hdr_a4_t a4;
|
250
|
249
|
} __WLAN_ATTRIB_PACK__ p80211_hdr_t;
|
251
|
250
|
|
252
|
251
|
|
|
@@ -257,6 +256,44 @@ typedef union p80211_hdr
|
257
|
256
|
/*================================================================*/
|
258
|
257
|
/* Function Declarations */
|
259
|
258
|
|
260
|
|
-void p802addr_to_str( char *buf, UINT8 *addr);
|
|
259
|
+/* Frame and header lenght macros */
|
|
260
|
+
|
|
261
|
+#define WLAN_CTL_FRAMELEN(fstype) (\
|
|
262
|
+ (fstype) == WLAN_FSTYPE_BLOCKACKREQ ? 24 : \
|
|
263
|
+ (fstype) == WLAN_FSTYPE_BLOCKACK ? 152 : \
|
|
264
|
+ (fstype) == WLAN_FSTYPE_PSPOLL ? 20 : \
|
|
265
|
+ (fstype) == WLAN_FSTYPE_RTS ? 20 : \
|
|
266
|
+ (fstype) == WLAN_FSTYPE_CTS ? 14 : \
|
|
267
|
+ (fstype) == WLAN_FSTYPE_ACK ? 14 : \
|
|
268
|
+ (fstype) == WLAN_FSTYPE_CFEND ? 20 : \
|
|
269
|
+ (fstype) == WLAN_FSTYPE_CFENDCFACK ? 20 : 4)
|
|
270
|
+
|
|
271
|
+#define WLAN_FCS_LEN 4
|
|
272
|
+
|
|
273
|
+/* ftcl in HOST order */
|
|
274
|
+inline static UINT16 p80211_headerlen(UINT16 fctl)
|
|
275
|
+{
|
|
276
|
+ UINT16 hdrlen = 0;
|
|
277
|
+
|
|
278
|
+ switch ( WLAN_GET_FC_FTYPE(fctl) ) {
|
|
279
|
+ case WLAN_FTYPE_MGMT:
|
|
280
|
+ hdrlen = WLAN_HDR_A3_LEN;
|
|
281
|
+ break;
|
|
282
|
+ case WLAN_FTYPE_DATA:
|
|
283
|
+ hdrlen = WLAN_HDR_A3_LEN;
|
|
284
|
+ if ( WLAN_GET_FC_TODS(fctl) && WLAN_GET_FC_FROMDS(fctl) ) {
|
|
285
|
+ hdrlen += WLAN_ADDR_LEN;
|
|
286
|
+ }
|
|
287
|
+ break;
|
|
288
|
+ case WLAN_FTYPE_CTL:
|
|
289
|
+ hdrlen = WLAN_CTL_FRAMELEN(WLAN_GET_FC_FSTYPE(fctl)) -
|
|
290
|
+ WLAN_FCS_LEN;
|
|
291
|
+ break;
|
|
292
|
+ default:
|
|
293
|
+ hdrlen = WLAN_HDR_A3_LEN;
|
|
294
|
+ }
|
|
295
|
+
|
|
296
|
+ return hdrlen;
|
|
297
|
+}
|
261
|
298
|
|
262
|
299
|
#endif /* _P80211HDR_H */
|