Blame view
drivers/staging/vt6655/80211hdr.h
12.1 KB
5449c685a Staging: Add pris... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
/* * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * |
612822f5d Staging: vt665x: ... |
19 |
* |
5449c685a Staging: Add pris... |
20 21 |
* File: 80211hdr.h * |
612822f5d Staging: vt665x: ... |
22 23 |
* Purpose: 802.11 MAC headers related pre-defines and macros. * |
5449c685a Staging: Add pris... |
24 25 26 27 28 29 |
* * Author: Lyndon Chen * * Date: Apr 8, 2002 * */ |
5449c685a Staging: Add pris... |
30 31 |
#ifndef __80211HDR_H__ #define __80211HDR_H__ |
5449c685a Staging: Add pris... |
32 |
#include "ttype.h" |
5449c685a Staging: Add pris... |
33 |
|
0b25a610c Staging: vt6655: ... |
34 |
/* bit type */ |
5449c685a Staging: Add pris... |
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
#define BIT0 0x00000001 #define BIT1 0x00000002 #define BIT2 0x00000004 #define BIT3 0x00000008 #define BIT4 0x00000010 #define BIT5 0x00000020 #define BIT6 0x00000040 #define BIT7 0x00000080 #define BIT8 0x00000100 #define BIT9 0x00000200 #define BIT10 0x00000400 #define BIT11 0x00000800 #define BIT12 0x00001000 #define BIT13 0x00002000 #define BIT14 0x00004000 #define BIT15 0x00008000 #define BIT16 0x00010000 #define BIT17 0x00020000 #define BIT18 0x00040000 #define BIT19 0x00080000 #define BIT20 0x00100000 #define BIT21 0x00200000 #define BIT22 0x00400000 #define BIT23 0x00800000 #define BIT24 0x01000000 #define BIT25 0x02000000 #define BIT26 0x04000000 #define BIT27 0x08000000 #define BIT28 0x10000000 #define BIT29 0x20000000 #define BIT30 0x40000000 #define BIT31 0x80000000 |
bd83515a9 Staging: vt6655: ... |
67 |
/* 802.11 frame related, defined as 802.11 spec */ |
5449c685a Staging: Add pris... |
68 69 70 71 72 73 74 75 76 77 78 |
#define WLAN_ADDR_LEN 6 #define WLAN_CRC_LEN 4 #define WLAN_CRC32_LEN 4 #define WLAN_FCS_LEN 4 #define WLAN_BSSID_LEN 6 #define WLAN_BSS_TS_LEN 8 #define WLAN_HDR_ADDR2_LEN 16 #define WLAN_HDR_ADDR3_LEN 24 #define WLAN_HDR_ADDR4_LEN 30 #define WLAN_IEHDR_LEN 2 #define WLAN_SSID_MAXLEN 32 |
5449c685a Staging: Add pris... |
79 80 81 82 |
#define WLAN_RATES_MAXLEN 16 #define WLAN_RATES_MAXLEN_11B 4 #define WLAN_RSN_MAXLEN 32 #define WLAN_DATA_MAXLEN 2312 |
4309635f6 Staging: vt6655: ... |
83 84 |
#define WLAN_A3FR_MAXLEN (WLAN_HDR_ADDR3_LEN + WLAN_DATA_MAXLEN + \ WLAN_CRC_LEN) |
5449c685a Staging: Add pris... |
85 |
|
5449c685a Staging: Add pris... |
86 87 88 89 90 91 92 93 94 95 96 97 |
#define WLAN_BEACON_FR_MAXLEN WLAN_A3FR_MAXLEN #define WLAN_ATIM_FR_MAXLEN (WLAN_HDR_ADDR3_LEN + 0) #define WLAN_NULLDATA_FR_MAXLEN (WLAN_HDR_ADDR3_LEN + 0) #define WLAN_DISASSOC_FR_MAXLEN (WLAN_HDR_ADDR3_LEN + 2) #define WLAN_ASSOCREQ_FR_MAXLEN WLAN_A3FR_MAXLEN #define WLAN_ASSOCRESP_FR_MAXLEN WLAN_A3FR_MAXLEN #define WLAN_REASSOCREQ_FR_MAXLEN WLAN_A3FR_MAXLEN #define WLAN_REASSOCRESP_FR_MAXLEN WLAN_A3FR_MAXLEN #define WLAN_PROBEREQ_FR_MAXLEN WLAN_A3FR_MAXLEN #define WLAN_PROBERESP_FR_MAXLEN WLAN_A3FR_MAXLEN #define WLAN_AUTHEN_FR_MAXLEN WLAN_A3FR_MAXLEN #define WLAN_DEAUTHEN_FR_MAXLEN (WLAN_HDR_ADDR3_LEN + 2) |
5449c685a Staging: Add pris... |
98 99 100 101 |
#define WLAN_WEP_NKEYS 4 #define WLAN_WEP40_KEYLEN 5 #define WLAN_WEP104_KEYLEN 13 #define WLAN_WEP232_KEYLEN 29 |
5449c685a Staging: Add pris... |
102 103 104 105 106 107 108 |
#define WLAN_WEPMAX_KEYLEN 32 #define WLAN_CHALLENGE_IE_MAXLEN 255 #define WLAN_CHALLENGE_IE_LEN 130 #define WLAN_CHALLENGE_LEN 128 #define WLAN_WEP_IV_LEN 4 #define WLAN_WEP_ICV_LEN 4 #define WLAN_FRAGS_MAX 16 |
0b25a610c Staging: vt6655: ... |
109 |
/* Frame Type */ |
5449c685a Staging: Add pris... |
110 111 112 113 114 115 116 |
#define WLAN_TYPE_MGR 0x00 #define WLAN_TYPE_CTL 0x01 #define WLAN_TYPE_DATA 0x02 #define WLAN_FTYPE_MGMT 0x00 #define WLAN_FTYPE_CTL 0x01 #define WLAN_FTYPE_DATA 0x02 |
0b25a610c Staging: vt6655: ... |
117 |
/* Frame Subtypes */ |
5449c685a Staging: Add pris... |
118 119 120 121 122 123 124 125 126 127 128 129 |
#define WLAN_FSTYPE_ASSOCREQ 0x00 #define WLAN_FSTYPE_ASSOCRESP 0x01 #define WLAN_FSTYPE_REASSOCREQ 0x02 #define WLAN_FSTYPE_REASSOCRESP 0x03 #define WLAN_FSTYPE_PROBEREQ 0x04 #define WLAN_FSTYPE_PROBERESP 0x05 #define WLAN_FSTYPE_BEACON 0x08 #define WLAN_FSTYPE_ATIM 0x09 #define WLAN_FSTYPE_DISASSOC 0x0a #define WLAN_FSTYPE_AUTHEN 0x0b #define WLAN_FSTYPE_DEAUTHEN 0x0c #define WLAN_FSTYPE_ACTION 0x0d |
0b25a610c Staging: vt6655: ... |
130 |
/* Control */ |
5449c685a Staging: Add pris... |
131 132 133 134 135 136 |
#define WLAN_FSTYPE_PSPOLL 0x0a #define WLAN_FSTYPE_RTS 0x0b #define WLAN_FSTYPE_CTS 0x0c #define WLAN_FSTYPE_ACK 0x0d #define WLAN_FSTYPE_CFEND 0x0e #define WLAN_FSTYPE_CFENDCFACK 0x0f |
0b25a610c Staging: vt6655: ... |
137 |
/* Data */ |
5449c685a Staging: Add pris... |
138 139 140 141 142 143 144 145 |
#define WLAN_FSTYPE_DATAONLY 0x00 #define WLAN_FSTYPE_DATA_CFACK 0x01 #define WLAN_FSTYPE_DATA_CFPOLL 0x02 #define WLAN_FSTYPE_DATA_CFACK_CFPOLL 0x03 #define WLAN_FSTYPE_NULL 0x04 #define WLAN_FSTYPE_CFACK 0x05 #define WLAN_FSTYPE_CFPOLL 0x06 #define WLAN_FSTYPE_CFACK_CFPOLL 0x07 |
5449c685a Staging: Add pris... |
146 |
#ifdef __BIG_ENDIAN |
0b25a610c Staging: vt6655: ... |
147 |
/* GET & SET Frame Control bit */ |
4d6090184 vt6655: balance f... |
148 |
#define WLAN_GET_FC_PRVER(n) (((unsigned short)(n) >> 8) & (BIT0 | BIT1)) |
2986db5fd Staging: vt6655: ... |
149 150 151 152 153 154 155 156 157 158 |
#define WLAN_GET_FC_FTYPE(n) ((((unsigned short)(n) >> 8) & (BIT2 | BIT3)) >> 2) #define WLAN_GET_FC_FSTYPE(n) ((((unsigned short)(n) >> 8) & (BIT4|BIT5|BIT6|BIT7)) >> 4) #define WLAN_GET_FC_TODS(n) ((((unsigned short)(n) << 8) & (BIT8)) >> 8) #define WLAN_GET_FC_FROMDS(n) ((((unsigned short)(n) << 8) & (BIT9)) >> 9) #define WLAN_GET_FC_MOREFRAG(n) ((((unsigned short)(n) << 8) & (BIT10)) >> 10) #define WLAN_GET_FC_RETRY(n) ((((unsigned short)(n) << 8) & (BIT11)) >> 11) #define WLAN_GET_FC_PWRMGT(n) ((((unsigned short)(n) << 8) & (BIT12)) >> 12) #define WLAN_GET_FC_MOREDATA(n) ((((unsigned short)(n) << 8) & (BIT13)) >> 13) #define WLAN_GET_FC_ISWEP(n) ((((unsigned short)(n) << 8) & (BIT14)) >> 14) #define WLAN_GET_FC_ORDER(n) ((((unsigned short)(n) << 8) & (BIT15)) >> 15) |
5449c685a Staging: Add pris... |
159 |
|
0b25a610c Staging: vt6655: ... |
160 |
/* Sequence Field bit */ |
2986db5fd Staging: vt6655: ... |
161 162 |
#define WLAN_GET_SEQ_FRGNUM(n) (((unsigned short)(n) >> 8) & (BIT0|BIT1|BIT2|BIT3)) #define WLAN_GET_SEQ_SEQNUM(n) ((((unsigned short)(n) >> 8) & (~(BIT0|BIT1|BIT2|BIT3))) >> 4) |
5449c685a Staging: Add pris... |
163 |
|
0b25a610c Staging: vt6655: ... |
164 |
/* Capability Field bit */ |
5449c685a Staging: Add pris... |
165 166 167 168 169 170 171 172 173 174 175 176 |
#define WLAN_GET_CAP_INFO_ESS(n) (((n) >> 8) & BIT0) #define WLAN_GET_CAP_INFO_IBSS(n) ((((n) >> 8) & BIT1) >> 1) #define WLAN_GET_CAP_INFO_CFPOLLABLE(n) ((((n) >> 8) & BIT2) >> 2) #define WLAN_GET_CAP_INFO_CFPOLLREQ(n) ((((n) >> 8) & BIT3) >> 3) #define WLAN_GET_CAP_INFO_PRIVACY(n) ((((n) >> 8) & BIT4) >> 4) #define WLAN_GET_CAP_INFO_SHORTPREAMBLE(n) ((((n) >> 8) & BIT5) >> 5) #define WLAN_GET_CAP_INFO_PBCC(n) ((((n) >> 8) & BIT6) >> 6) #define WLAN_GET_CAP_INFO_AGILITY(n) ((((n) >> 8) & BIT7) >> 7) #define WLAN_GET_CAP_INFO_SPECTRUMMNG(n) ((((n)) & BIT8) >> 10) #define WLAN_GET_CAP_INFO_SHORTSLOTTIME(n) ((((n)) & BIT10) >> 10) #define WLAN_GET_CAP_INFO_DSSSOFDM(n) ((((n)) & BIT13) >> 13) #define WLAN_GET_CAP_INFO_GRPACK(n) ((((n)) & BIT14) >> 14) |
5449c685a Staging: Add pris... |
177 |
#else |
0b25a610c Staging: vt6655: ... |
178 |
/* GET & SET Frame Control bit */ |
2986db5fd Staging: vt6655: ... |
179 180 181 182 183 184 185 186 187 188 189 |
#define WLAN_GET_FC_PRVER(n) (((unsigned short)(n)) & (BIT0 | BIT1)) #define WLAN_GET_FC_FTYPE(n) ((((unsigned short)(n)) & (BIT2 | BIT3)) >> 2) #define WLAN_GET_FC_FSTYPE(n) ((((unsigned short)(n)) & (BIT4|BIT5|BIT6|BIT7)) >> 4) #define WLAN_GET_FC_TODS(n) ((((unsigned short)(n)) & (BIT8)) >> 8) #define WLAN_GET_FC_FROMDS(n) ((((unsigned short)(n)) & (BIT9)) >> 9) #define WLAN_GET_FC_MOREFRAG(n) ((((unsigned short)(n)) & (BIT10)) >> 10) #define WLAN_GET_FC_RETRY(n) ((((unsigned short)(n)) & (BIT11)) >> 11) #define WLAN_GET_FC_PWRMGT(n) ((((unsigned short)(n)) & (BIT12)) >> 12) #define WLAN_GET_FC_MOREDATA(n) ((((unsigned short)(n)) & (BIT13)) >> 13) #define WLAN_GET_FC_ISWEP(n) ((((unsigned short)(n)) & (BIT14)) >> 14) #define WLAN_GET_FC_ORDER(n) ((((unsigned short)(n)) & (BIT15)) >> 15) |
5449c685a Staging: Add pris... |
190 |
|
0b25a610c Staging: vt6655: ... |
191 |
/* Sequence Field bit */ |
2986db5fd Staging: vt6655: ... |
192 193 |
#define WLAN_GET_SEQ_FRGNUM(n) (((unsigned short)(n)) & (BIT0|BIT1|BIT2|BIT3)) #define WLAN_GET_SEQ_SEQNUM(n) ((((unsigned short)(n)) & (~(BIT0|BIT1|BIT2|BIT3))) >> 4) |
5449c685a Staging: Add pris... |
194 |
|
0b25a610c Staging: vt6655: ... |
195 |
/* Capability Field bit */ |
5449c685a Staging: Add pris... |
196 197 198 199 200 201 202 203 204 205 206 207 |
#define WLAN_GET_CAP_INFO_ESS(n) ((n) & BIT0) #define WLAN_GET_CAP_INFO_IBSS(n) (((n) & BIT1) >> 1) #define WLAN_GET_CAP_INFO_CFPOLLABLE(n) (((n) & BIT2) >> 2) #define WLAN_GET_CAP_INFO_CFPOLLREQ(n) (((n) & BIT3) >> 3) #define WLAN_GET_CAP_INFO_PRIVACY(n) (((n) & BIT4) >> 4) #define WLAN_GET_CAP_INFO_SHORTPREAMBLE(n) (((n) & BIT5) >> 5) #define WLAN_GET_CAP_INFO_PBCC(n) (((n) & BIT6) >> 6) #define WLAN_GET_CAP_INFO_AGILITY(n) (((n) & BIT7) >> 7) #define WLAN_GET_CAP_INFO_SPECTRUMMNG(n) (((n) & BIT8) >> 10) #define WLAN_GET_CAP_INFO_SHORTSLOTTIME(n) (((n) & BIT10) >> 10) #define WLAN_GET_CAP_INFO_DSSSOFDM(n) (((n) & BIT13) >> 13) #define WLAN_GET_CAP_INFO_GRPACK(n) (((n) & BIT14) >> 14) |
0b25a610c Staging: vt6655: ... |
208 |
#endif /*#ifdef __BIG_ENDIAN */ |
5449c685a Staging: Add pris... |
209 |
|
5449c685a Staging: Add pris... |
210 211 212 213 214 215 216 217 218 219 220 221 |
#define WLAN_SET_CAP_INFO_ESS(n) (n) #define WLAN_SET_CAP_INFO_IBSS(n) ((n) << 1) #define WLAN_SET_CAP_INFO_CFPOLLABLE(n) ((n) << 2) #define WLAN_SET_CAP_INFO_CFPOLLREQ(n) ((n) << 3) #define WLAN_SET_CAP_INFO_PRIVACY(n) ((n) << 4) #define WLAN_SET_CAP_INFO_SHORTPREAMBLE(n) ((n) << 5) #define WLAN_SET_CAP_INFO_SPECTRUMMNG(n) ((n) << 8) #define WLAN_SET_CAP_INFO_PBCC(n) ((n) << 6) #define WLAN_SET_CAP_INFO_AGILITY(n) ((n) << 7) #define WLAN_SET_CAP_INFO_SHORTSLOTTIME(n) ((n) << 10) #define WLAN_SET_CAP_INFO_DSSSOFDM(n) ((n) << 13) #define WLAN_SET_CAP_INFO_GRPACK(n) ((n) << 14) |
2986db5fd Staging: vt6655: ... |
222 223 224 225 226 227 228 229 230 231 232 |
#define WLAN_SET_FC_PRVER(n) ((unsigned short)(n)) #define WLAN_SET_FC_FTYPE(n) (((unsigned short)(n)) << 2) #define WLAN_SET_FC_FSTYPE(n) (((unsigned short)(n)) << 4) #define WLAN_SET_FC_TODS(n) (((unsigned short)(n)) << 8) #define WLAN_SET_FC_FROMDS(n) (((unsigned short)(n)) << 9) #define WLAN_SET_FC_MOREFRAG(n) (((unsigned short)(n)) << 10) #define WLAN_SET_FC_RETRY(n) (((unsigned short)(n)) << 11) #define WLAN_SET_FC_PWRMGT(n) (((unsigned short)(n)) << 12) #define WLAN_SET_FC_MOREDATA(n) (((unsigned short)(n)) << 13) #define WLAN_SET_FC_ISWEP(n) (((unsigned short)(n)) << 14) #define WLAN_SET_FC_ORDER(n) (((unsigned short)(n)) << 15) |
5449c685a Staging: Add pris... |
233 |
|
2986db5fd Staging: vt6655: ... |
234 235 |
#define WLAN_SET_SEQ_FRGNUM(n) ((unsigned short)(n)) #define WLAN_SET_SEQ_SEQNUM(n) (((unsigned short)(n)) << 4) |
5449c685a Staging: Add pris... |
236 |
|
0b25a610c Staging: vt6655: ... |
237 |
/* ERP Field bit */ |
5449c685a Staging: Add pris... |
238 239 240 241 242 243 244 245 |
#define WLAN_GET_ERP_NONERP_PRESENT(n) ((n) & BIT0) #define WLAN_GET_ERP_USE_PROTECTION(n) (((n) & BIT1) >> 1) #define WLAN_GET_ERP_BARKER_MODE(n) (((n) & BIT2) >> 2) #define WLAN_SET_ERP_NONERP_PRESENT(n) (n) #define WLAN_SET_ERP_USE_PROTECTION(n) ((n) << 1) #define WLAN_SET_ERP_BARKER_MODE(n) ((n) << 2) |
0b25a610c Staging: vt6655: ... |
246 |
/* Support & Basic Rates field */ |
5449c685a Staging: Add pris... |
247 248 |
#define WLAN_MGMT_IS_BASICRATE(b) ((b) & BIT7) #define WLAN_MGMT_GET_RATE(b) ((b) & ~BIT7) |
0b25a610c Staging: vt6655: ... |
249 |
/* TIM field */ |
5449c685a Staging: Add pris... |
250 251 |
#define WLAN_MGMT_IS_MULTICAST_TIM(b) ((b) & BIT0) #define WLAN_MGMT_GET_TIM_OFFSET(b) (((b) & ~BIT0) >> 1) |
0b25a610c Staging: vt6655: ... |
252 |
/* 3-Addr & 4-Addr */ |
2989e96f1 Staging: vt6655: ... |
253 254 |
#define WLAN_HDR_A3_DATA_PTR(p) (((unsigned char *)(p)) + WLAN_HDR_ADDR3_LEN) #define WLAN_HDR_A4_DATA_PTR(p) (((unsigned char *)(p)) + WLAN_HDR_ADDR4_LEN) |
5449c685a Staging: Add pris... |
255 |
|
0b25a610c Staging: vt6655: ... |
256 |
/* IEEE ADDR */ |
5449c685a Staging: Add pris... |
257 258 259 260 |
#define IEEE_ADDR_UNIVERSAL 0x02 #define IEEE_ADDR_GROUP 0x01 typedef struct { |
d74e97699 staging:vt6655:80... |
261 |
unsigned char abyAddr[6]; |
5449c685a Staging: Add pris... |
262 |
} IEEE_ADDR, *PIEEE_ADDR; |
0b25a610c Staging: vt6655: ... |
263 |
/* 802.11 Header Format */ |
5449c685a Staging: Add pris... |
264 265 |
typedef struct tagWLAN_80211HDR_A2 { |
d74e97699 staging:vt6655:80... |
266 267 268 269 |
unsigned short wFrameCtl; unsigned short wDurationID; unsigned char abyAddr1[WLAN_ADDR_LEN]; unsigned char abyAddr2[WLAN_ADDR_LEN]; |
0b25a610c Staging: vt6655: ... |
270 |
} __attribute__ ((__packed__)) |
5449c685a Staging: Add pris... |
271 272 273 |
WLAN_80211HDR_A2, *PWLAN_80211HDR_A2; typedef struct tagWLAN_80211HDR_A3 { |
d74e97699 staging:vt6655:80... |
274 275 276 277 278 279 |
unsigned short wFrameCtl; unsigned short wDurationID; unsigned char abyAddr1[WLAN_ADDR_LEN]; unsigned char abyAddr2[WLAN_ADDR_LEN]; unsigned char abyAddr3[WLAN_ADDR_LEN]; unsigned short wSeqCtl; |
d74e97699 staging:vt6655:80... |
280 |
} __attribute__ ((__packed__)) |
5449c685a Staging: Add pris... |
281 282 283 |
WLAN_80211HDR_A3, *PWLAN_80211HDR_A3; typedef struct tagWLAN_80211HDR_A4 { |
d74e97699 staging:vt6655:80... |
284 285 286 287 288 289 290 |
unsigned short wFrameCtl; unsigned short wDurationID; unsigned char abyAddr1[WLAN_ADDR_LEN]; unsigned char abyAddr2[WLAN_ADDR_LEN]; unsigned char abyAddr3[WLAN_ADDR_LEN]; unsigned short wSeqCtl; unsigned char abyAddr4[WLAN_ADDR_LEN]; |
0b25a610c Staging: vt6655: ... |
291 |
} __attribute__ ((__packed__)) |
5449c685a Staging: Add pris... |
292 |
WLAN_80211HDR_A4, *PWLAN_80211HDR_A4; |
5449c685a Staging: Add pris... |
293 |
typedef union tagUWLAN_80211HDR { |
d74e97699 staging:vt6655:80... |
294 295 296 |
WLAN_80211HDR_A2 sA2; WLAN_80211HDR_A3 sA3; WLAN_80211HDR_A4 sA4; |
5449c685a Staging: Add pris... |
297 |
} UWLAN_80211HDR, *PUWLAN_80211HDR; |
0b25a610c Staging: vt6655: ... |
298 |
#endif /* __80211HDR_H__ */ |