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