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 | * |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 19 | * File: 80211mgr.c |
| 20 | * |
Uwe Kleine-König | 658ce9d | 2009-07-23 08:33:56 +0200 | [diff] [blame] | 21 | * Purpose: Handles the 802.11 management support functions |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 22 | * |
| 23 | * Author: Lyndon Chen |
| 24 | * |
| 25 | * Date: May 8, 2002 |
| 26 | * |
| 27 | * Functions: |
| 28 | * vMgrEncodeBeacon - Encode the Beacon frame |
| 29 | * vMgrDecodeBeacon - Decode the Beacon frame |
| 30 | * vMgrEncodeIBSSATIM - Encode the IBSS ATIM frame |
| 31 | * vMgrDecodeIBSSATIM - Decode the IBSS ATIM frame |
| 32 | * vMgrEncodeDisassociation - Encode the Disassociation frame |
| 33 | * vMgrDecodeDisassociation - Decode the Disassociation frame |
| 34 | * vMgrEncodeAssocRequest - Encode the Association request frame |
| 35 | * vMgrDecodeAssocRequest - Decode the Association request frame |
| 36 | * vMgrEncodeAssocResponse - Encode the Association response frame |
| 37 | * vMgrDecodeAssocResponse - Decode the Association response frame |
| 38 | * vMgrEncodeReAssocRequest - Encode the ReAssociation request frame |
| 39 | * vMgrDecodeReAssocRequest - Decode the ReAssociation request frame |
| 40 | * vMgrEncodeProbeRequest - Encode the Probe request frame |
| 41 | * vMgrDecodeProbeRequest - Decode the Probe request frame |
| 42 | * vMgrEncodeProbeResponse - Encode the Probe response frame |
| 43 | * vMgrDecodeProbeResponse - Decode the Probe response frame |
| 44 | * vMgrEncodeAuthen - Encode the Authentication frame |
| 45 | * vMgrDecodeAuthen - Decode the Authentication frame |
| 46 | * vMgrEncodeDeauthen - Encode the DeAuthentication frame |
| 47 | * vMgrDecodeDeauthen - Decode the DeAuthentication frame |
| 48 | * vMgrEncodeReassocResponse - Encode the Reassociation response frame |
| 49 | * vMgrDecodeReassocResponse - Decode the Reassociation response frame |
| 50 | * |
| 51 | * Revision History: |
| 52 | * |
| 53 | */ |
| 54 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 55 | #include "tmacro.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 56 | #include "tether.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 57 | #include "80211mgr.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 58 | #include "80211hdr.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 59 | #include "device.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 60 | #include "wpa.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 61 | |
| 62 | /*--------------------- Static Definitions -------------------------*/ |
| 63 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 64 | /*--------------------- Static Classes ----------------------------*/ |
| 65 | |
| 66 | /*--------------------- Static Variables --------------------------*/ |
| 67 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 68 | static int msglevel = MSG_LEVEL_INFO; |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 69 | /* static int msglevel =MSG_LEVEL_DEBUG; */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 70 | /*--------------------- Static Functions --------------------------*/ |
| 71 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 72 | /*--------------------- Export Variables --------------------------*/ |
| 73 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 74 | /*--------------------- Export Functions --------------------------*/ |
| 75 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 76 | /*+ |
| 77 | * |
| 78 | * Routine Description: |
| 79 | * Encode Beacon frame body offset |
| 80 | * |
| 81 | * Return Value: |
| 82 | * None. |
| 83 | * |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 84 | -*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 85 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 86 | void |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 87 | vMgrEncodeBeacon( |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 88 | PWLAN_FR_BEACON pFrame |
| 89 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 90 | { |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 91 | pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 92 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 93 | /* Fixed Fields */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 94 | pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 95 | + WLAN_BEACON_OFF_TS); |
| 96 | pFrame->pwBeaconInterval = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 97 | + WLAN_BEACON_OFF_BCN_INT); |
| 98 | pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 99 | + WLAN_BEACON_OFF_CAPINFO); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 100 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 101 | pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_BEACON_OFF_SSID; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 102 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 103 | return; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | /*+ |
| 107 | * |
| 108 | * Routine Description: |
| 109 | * Decode Beacon frame body offset |
| 110 | * |
| 111 | * |
| 112 | * Return Value: |
| 113 | * None. |
| 114 | * |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 115 | -*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 116 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 117 | void |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 118 | vMgrDecodeBeacon( |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 119 | PWLAN_FR_BEACON pFrame |
| 120 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 121 | { |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 122 | PWLAN_IE pItem; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 123 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 124 | pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 125 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 126 | /* Fixed Fields */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 127 | pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 128 | + WLAN_BEACON_OFF_TS); |
| 129 | pFrame->pwBeaconInterval = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 130 | + WLAN_BEACON_OFF_BCN_INT); |
| 131 | pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 132 | + WLAN_BEACON_OFF_CAPINFO); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 133 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 134 | /* Information elements */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 135 | pItem = (PWLAN_IE)((unsigned char *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))) |
| 136 | + WLAN_BEACON_OFF_SSID); |
| 137 | while (((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) { |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 138 | switch (pItem->byElementID) { |
| 139 | case WLAN_EID_SSID: |
| 140 | if (pFrame->pSSID == NULL) |
| 141 | pFrame->pSSID = (PWLAN_IE_SSID)pItem; |
| 142 | break; |
| 143 | case WLAN_EID_SUPP_RATES: |
| 144 | if (pFrame->pSuppRates == NULL) |
| 145 | pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem; |
| 146 | break; |
| 147 | case WLAN_EID_FH_PARMS: |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 148 | /* pFrame->pFHParms = (PWLAN_IE_FH_PARMS)pItem; */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 149 | break; |
| 150 | case WLAN_EID_DS_PARMS: |
| 151 | if (pFrame->pDSParms == NULL) |
| 152 | pFrame->pDSParms = (PWLAN_IE_DS_PARMS)pItem; |
| 153 | break; |
| 154 | case WLAN_EID_CF_PARMS: |
| 155 | if (pFrame->pCFParms == NULL) |
| 156 | pFrame->pCFParms = (PWLAN_IE_CF_PARMS)pItem; |
| 157 | break; |
| 158 | case WLAN_EID_IBSS_PARMS: |
| 159 | if (pFrame->pIBSSParms == NULL) |
| 160 | pFrame->pIBSSParms = (PWLAN_IE_IBSS_PARMS)pItem; |
| 161 | break; |
| 162 | case WLAN_EID_TIM: |
| 163 | if (pFrame->pTIM == NULL) |
| 164 | pFrame->pTIM = (PWLAN_IE_TIM)pItem; |
| 165 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 166 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 167 | case WLAN_EID_RSN: |
| 168 | if (pFrame->pRSN == NULL) { |
| 169 | pFrame->pRSN = (PWLAN_IE_RSN)pItem; |
| 170 | } |
| 171 | break; |
| 172 | case WLAN_EID_RSN_WPA: |
| 173 | if (pFrame->pRSNWPA == NULL) { |
| 174 | if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == true) |
| 175 | pFrame->pRSNWPA = (PWLAN_IE_RSN_EXT)pItem; |
| 176 | } |
| 177 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 178 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 179 | case WLAN_EID_ERP: |
| 180 | if (pFrame->pERP == NULL) |
| 181 | pFrame->pERP = (PWLAN_IE_ERP)pItem; |
| 182 | break; |
| 183 | case WLAN_EID_EXTSUPP_RATES: |
| 184 | if (pFrame->pExtSuppRates == NULL) |
| 185 | pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem; |
| 186 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 187 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 188 | case WLAN_EID_COUNTRY: /* 7 */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 189 | if (pFrame->pIE_Country == NULL) |
| 190 | pFrame->pIE_Country = (PWLAN_IE_COUNTRY)pItem; |
| 191 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 192 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 193 | case WLAN_EID_PWR_CONSTRAINT: /* 32 */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 194 | if (pFrame->pIE_PowerConstraint == NULL) |
| 195 | pFrame->pIE_PowerConstraint = (PWLAN_IE_PW_CONST)pItem; |
| 196 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 197 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 198 | case WLAN_EID_CH_SWITCH: /* 37 */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 199 | if (pFrame->pIE_CHSW == NULL) |
| 200 | pFrame->pIE_CHSW = (PWLAN_IE_CH_SW)pItem; |
| 201 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 202 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 203 | case WLAN_EID_QUIET: /* 40 */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 204 | if (pFrame->pIE_Quiet == NULL) |
| 205 | pFrame->pIE_Quiet = (PWLAN_IE_QUIET)pItem; |
| 206 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 207 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 208 | case WLAN_EID_IBSS_DFS: |
| 209 | if (pFrame->pIE_IBSSDFS == NULL) |
| 210 | pFrame->pIE_IBSSDFS = (PWLAN_IE_IBSS_DFS)pItem; |
| 211 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 212 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 213 | default: |
| 214 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unrecognized EID=%dd in beacon decode.\n", pItem->byElementID); |
| 215 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 216 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 217 | } |
| 218 | pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len); |
| 219 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 220 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 221 | return; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 222 | } |
| 223 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 224 | /*+ |
| 225 | * |
| 226 | * Routine Description: |
| 227 | * Encode IBSS ATIM |
| 228 | * |
| 229 | * |
| 230 | * Return Value: |
| 231 | * None. |
| 232 | * |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 233 | -*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 234 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 235 | void |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 236 | vMgrEncodeIBSSATIM( |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 237 | PWLAN_FR_IBSSATIM pFrame |
| 238 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 239 | { |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 240 | pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; |
| 241 | pFrame->len = WLAN_HDR_ADDR3_LEN; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 242 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 243 | return; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 244 | } |
| 245 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 246 | /*+ |
| 247 | * |
| 248 | * Routine Description: |
| 249 | * Decode IBSS ATIM |
| 250 | * |
| 251 | * |
| 252 | * Return Value: |
| 253 | * None. |
| 254 | * |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 255 | -*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 256 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 257 | void |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 258 | vMgrDecodeIBSSATIM( |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 259 | PWLAN_FR_IBSSATIM pFrame |
| 260 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 261 | { |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 262 | pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 263 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 264 | return; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 265 | } |
| 266 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 267 | /*+ |
| 268 | * |
| 269 | * Routine Description: |
| 270 | * Encode Disassociation |
| 271 | * |
| 272 | * |
| 273 | * Return Value: |
| 274 | * None. |
| 275 | * |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 276 | -*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 277 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 278 | void |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 279 | vMgrEncodeDisassociation( |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 280 | PWLAN_FR_DISASSOC pFrame |
| 281 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 282 | { |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 283 | pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 284 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 285 | /* Fixed Fields */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 286 | pFrame->pwReason = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 287 | + WLAN_DISASSOC_OFF_REASON); |
| 288 | pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_DISASSOC_OFF_REASON + sizeof(*(pFrame->pwReason)); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 289 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 290 | return; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 291 | } |
| 292 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 293 | /*+ |
| 294 | * |
| 295 | * Routine Description: |
| 296 | * Decode Disassociation |
| 297 | * |
| 298 | * |
| 299 | * Return Value: |
| 300 | * None. |
| 301 | * |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 302 | -*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 303 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 304 | void |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 305 | vMgrDecodeDisassociation( |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 306 | PWLAN_FR_DISASSOC pFrame |
| 307 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 308 | { |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 309 | pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 310 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 311 | /* Fixed Fields */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 312 | pFrame->pwReason = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 313 | + WLAN_DISASSOC_OFF_REASON); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 314 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 315 | return; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 316 | } |
| 317 | |
| 318 | /*+ |
| 319 | * |
| 320 | * Routine Description: |
| 321 | * Encode Association Request |
| 322 | * |
| 323 | * |
| 324 | * Return Value: |
| 325 | * None. |
| 326 | * |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 327 | -*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 328 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 329 | void |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 330 | vMgrEncodeAssocRequest( |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 331 | PWLAN_FR_ASSOCREQ pFrame |
| 332 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 333 | { |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 334 | pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 335 | /* Fixed Fields */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 336 | pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 337 | + WLAN_ASSOCREQ_OFF_CAP_INFO); |
| 338 | pFrame->pwListenInterval = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 339 | + WLAN_ASSOCREQ_OFF_LISTEN_INT); |
| 340 | pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_ASSOCREQ_OFF_LISTEN_INT + sizeof(*(pFrame->pwListenInterval)); |
| 341 | return; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 342 | } |
| 343 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 344 | /*+ |
| 345 | * |
| 346 | * Routine Description: (AP) |
| 347 | * Decode Association Request |
| 348 | * |
| 349 | * |
| 350 | * Return Value: |
| 351 | * None. |
| 352 | * |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 353 | -*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 354 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 355 | void |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 356 | vMgrDecodeAssocRequest( |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 357 | PWLAN_FR_ASSOCREQ pFrame |
| 358 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 359 | { |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 360 | PWLAN_IE pItem; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 361 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 362 | pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 363 | /* Fixed Fields */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 364 | pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 365 | + WLAN_ASSOCREQ_OFF_CAP_INFO); |
| 366 | pFrame->pwListenInterval = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 367 | + WLAN_ASSOCREQ_OFF_LISTEN_INT); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 368 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 369 | /* Information elements */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 370 | pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 371 | + WLAN_ASSOCREQ_OFF_SSID); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 372 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 373 | while (((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) { |
| 374 | switch (pItem->byElementID) { |
| 375 | case WLAN_EID_SSID: |
| 376 | if (pFrame->pSSID == NULL) |
| 377 | pFrame->pSSID = (PWLAN_IE_SSID)pItem; |
| 378 | break; |
| 379 | case WLAN_EID_SUPP_RATES: |
| 380 | if (pFrame->pSuppRates == NULL) |
| 381 | pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem; |
| 382 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 383 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 384 | case WLAN_EID_RSN: |
| 385 | if (pFrame->pRSN == NULL) { |
| 386 | pFrame->pRSN = (PWLAN_IE_RSN)pItem; |
| 387 | } |
| 388 | break; |
| 389 | case WLAN_EID_RSN_WPA: |
| 390 | if (pFrame->pRSNWPA == NULL) { |
| 391 | if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == true) |
| 392 | pFrame->pRSNWPA = (PWLAN_IE_RSN_EXT)pItem; |
| 393 | } |
| 394 | break; |
| 395 | case WLAN_EID_EXTSUPP_RATES: |
| 396 | if (pFrame->pExtSuppRates == NULL) |
| 397 | pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem; |
| 398 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 399 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 400 | default: |
| 401 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unrecognized EID=%dd in assocreq decode.\n", |
| 402 | pItem->byElementID); |
| 403 | break; |
| 404 | } |
| 405 | pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len); |
| 406 | } |
| 407 | return; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 408 | } |
| 409 | |
| 410 | /*+ |
| 411 | * |
| 412 | * Routine Description: (AP) |
| 413 | * Encode Association Response |
| 414 | * |
| 415 | * |
| 416 | * Return Value: |
| 417 | * None. |
| 418 | * |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 419 | -*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 420 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 421 | void |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 422 | vMgrEncodeAssocResponse( |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 423 | PWLAN_FR_ASSOCRESP pFrame |
| 424 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 425 | { |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 426 | pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 427 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 428 | /* Fixed Fields */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 429 | pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 430 | + WLAN_ASSOCRESP_OFF_CAP_INFO); |
| 431 | pFrame->pwStatus = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 432 | + WLAN_ASSOCRESP_OFF_STATUS); |
| 433 | pFrame->pwAid = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 434 | + WLAN_ASSOCRESP_OFF_AID); |
| 435 | pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_ASSOCRESP_OFF_AID |
| 436 | + sizeof(*(pFrame->pwAid)); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 437 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 438 | return; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 439 | } |
| 440 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 441 | /*+ |
| 442 | * |
| 443 | * Routine Description: |
| 444 | * Decode Association Response |
| 445 | * |
| 446 | * |
| 447 | * Return Value: |
| 448 | * None. |
| 449 | * |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 450 | -*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 451 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 452 | void |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 453 | vMgrDecodeAssocResponse( |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 454 | PWLAN_FR_ASSOCRESP pFrame |
| 455 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 456 | { |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 457 | PWLAN_IE pItem; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 458 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 459 | pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 460 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 461 | /* Fixed Fields */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 462 | pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 463 | + WLAN_ASSOCRESP_OFF_CAP_INFO); |
| 464 | pFrame->pwStatus = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 465 | + WLAN_ASSOCRESP_OFF_STATUS); |
| 466 | pFrame->pwAid = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 467 | + WLAN_ASSOCRESP_OFF_AID); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 468 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 469 | /* Information elements */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 470 | pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 471 | + WLAN_ASSOCRESP_OFF_SUPP_RATES); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 472 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 473 | pItem = (PWLAN_IE)(pFrame->pSuppRates); |
| 474 | pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 475 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 476 | if ((((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) && |
| 477 | (pItem->byElementID == WLAN_EID_EXTSUPP_RATES)) { |
| 478 | pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem; |
| 479 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pFrame->pExtSuppRates=[%p].\n", pItem); |
Joe Perches | 5e0cc8a | 2013-03-18 20:55:37 -0700 | [diff] [blame] | 480 | } else { |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 481 | pFrame->pExtSuppRates = NULL; |
| 482 | } |
| 483 | return; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 484 | } |
| 485 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 486 | /*+ |
| 487 | * |
| 488 | * Routine Description: |
| 489 | * Encode Reassociation Request |
| 490 | * |
| 491 | * |
| 492 | * Return Value: |
| 493 | * None. |
| 494 | * |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 495 | -*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 496 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 497 | void |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 498 | vMgrEncodeReassocRequest( |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 499 | PWLAN_FR_REASSOCREQ pFrame |
| 500 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 501 | { |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 502 | pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 503 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 504 | /* Fixed Fields */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 505 | pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 506 | + WLAN_REASSOCREQ_OFF_CAP_INFO); |
| 507 | pFrame->pwListenInterval = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 508 | + WLAN_REASSOCREQ_OFF_LISTEN_INT); |
| 509 | pFrame->pAddrCurrAP = (PIEEE_ADDR)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 510 | + WLAN_REASSOCREQ_OFF_CURR_AP); |
| 511 | pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_REASSOCREQ_OFF_CURR_AP + sizeof(*(pFrame->pAddrCurrAP)); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 512 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 513 | return; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 514 | } |
| 515 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 516 | /*+ |
| 517 | * |
| 518 | * Routine Description: (AP) |
| 519 | * Decode Reassociation Request |
| 520 | * |
| 521 | * |
| 522 | * Return Value: |
| 523 | * None. |
| 524 | * |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 525 | -*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 526 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 527 | void |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 528 | vMgrDecodeReassocRequest( |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 529 | PWLAN_FR_REASSOCREQ pFrame |
| 530 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 531 | { |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 532 | PWLAN_IE pItem; |
| 533 | pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 534 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 535 | /* Fixed Fields */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 536 | pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 537 | + WLAN_REASSOCREQ_OFF_CAP_INFO); |
| 538 | pFrame->pwListenInterval = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 539 | + WLAN_REASSOCREQ_OFF_LISTEN_INT); |
| 540 | pFrame->pAddrCurrAP = (PIEEE_ADDR)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 541 | + WLAN_REASSOCREQ_OFF_CURR_AP); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 542 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 543 | /* Information elements */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 544 | pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 545 | + WLAN_REASSOCREQ_OFF_SSID); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 546 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 547 | while (((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) { |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 548 | switch (pItem->byElementID) { |
| 549 | case WLAN_EID_SSID: |
| 550 | if (pFrame->pSSID == NULL) |
| 551 | pFrame->pSSID = (PWLAN_IE_SSID)pItem; |
| 552 | break; |
| 553 | case WLAN_EID_SUPP_RATES: |
| 554 | if (pFrame->pSuppRates == NULL) |
| 555 | pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem; |
| 556 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 557 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 558 | case WLAN_EID_RSN: |
| 559 | if (pFrame->pRSN == NULL) { |
| 560 | pFrame->pRSN = (PWLAN_IE_RSN)pItem; |
| 561 | } |
| 562 | break; |
| 563 | case WLAN_EID_RSN_WPA: |
| 564 | if (pFrame->pRSNWPA == NULL) { |
| 565 | if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == true) |
| 566 | pFrame->pRSNWPA = (PWLAN_IE_RSN_EXT)pItem; |
| 567 | } |
| 568 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 569 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 570 | case WLAN_EID_EXTSUPP_RATES: |
| 571 | if (pFrame->pExtSuppRates == NULL) |
| 572 | pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem; |
| 573 | break; |
| 574 | default: |
| 575 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unrecognized EID=%dd in reassocreq decode.\n", |
| 576 | pItem->byElementID); |
| 577 | break; |
| 578 | } |
| 579 | pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len); |
| 580 | } |
| 581 | return; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 582 | } |
| 583 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 584 | /*+ |
| 585 | * |
| 586 | * Routine Description: |
| 587 | * Encode Probe Request |
| 588 | * |
| 589 | * |
| 590 | * Return Value: |
| 591 | * None. |
| 592 | * |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 593 | -*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 594 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 595 | void |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 596 | vMgrEncodeProbeRequest( |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 597 | PWLAN_FR_PROBEREQ pFrame |
| 598 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 599 | { |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 600 | pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; |
| 601 | pFrame->len = WLAN_HDR_ADDR3_LEN; |
| 602 | return; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 603 | } |
| 604 | |
| 605 | /*+ |
| 606 | * |
| 607 | * Routine Description: |
| 608 | * Decode Probe Request |
| 609 | * |
| 610 | * |
| 611 | * Return Value: |
| 612 | * None. |
| 613 | * |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 614 | -*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 615 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 616 | void |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 617 | vMgrDecodeProbeRequest( |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 618 | PWLAN_FR_PROBEREQ pFrame |
| 619 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 620 | { |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 621 | PWLAN_IE pItem; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 622 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 623 | pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 624 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 625 | /* Information elements */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 626 | pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 627 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 628 | while (((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) { |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 629 | switch (pItem->byElementID) { |
| 630 | case WLAN_EID_SSID: |
| 631 | if (pFrame->pSSID == NULL) |
| 632 | pFrame->pSSID = (PWLAN_IE_SSID)pItem; |
| 633 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 634 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 635 | case WLAN_EID_SUPP_RATES: |
| 636 | if (pFrame->pSuppRates == NULL) |
| 637 | pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem; |
| 638 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 639 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 640 | case WLAN_EID_EXTSUPP_RATES: |
| 641 | if (pFrame->pExtSuppRates == NULL) |
| 642 | pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem; |
| 643 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 644 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 645 | default: |
| 646 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Bad EID=%dd in probereq\n", pItem->byElementID); |
| 647 | break; |
| 648 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 649 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 650 | pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len); |
| 651 | } |
| 652 | return; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 653 | } |
| 654 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 655 | /*+ |
| 656 | * |
| 657 | * Routine Description: |
| 658 | * Encode Probe Response |
| 659 | * |
| 660 | * |
| 661 | * Return Value: |
| 662 | * None. |
| 663 | * |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 664 | -*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 665 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 666 | void |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 667 | vMgrEncodeProbeResponse( |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 668 | PWLAN_FR_PROBERESP pFrame |
| 669 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 670 | { |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 671 | pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 672 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 673 | /* Fixed Fields */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 674 | pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 675 | + WLAN_PROBERESP_OFF_TS); |
| 676 | pFrame->pwBeaconInterval = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 677 | + WLAN_PROBERESP_OFF_BCN_INT); |
| 678 | pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 679 | + WLAN_PROBERESP_OFF_CAP_INFO); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 680 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 681 | pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_PROBERESP_OFF_CAP_INFO + |
| 682 | sizeof(*(pFrame->pwCapInfo)); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 683 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 684 | return; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 685 | } |
| 686 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 687 | /*+ |
| 688 | * |
| 689 | * Routine Description: |
| 690 | * Decode Probe Response |
| 691 | * |
| 692 | * |
| 693 | * Return Value: |
| 694 | * None. |
| 695 | * |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 696 | -*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 697 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 698 | void |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 699 | vMgrDecodeProbeResponse( |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 700 | PWLAN_FR_PROBERESP pFrame |
| 701 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 702 | { |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 703 | PWLAN_IE pItem; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 704 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 705 | pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 706 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 707 | /* Fixed Fields */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 708 | pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 709 | + WLAN_PROBERESP_OFF_TS); |
| 710 | pFrame->pwBeaconInterval = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 711 | + WLAN_PROBERESP_OFF_BCN_INT); |
| 712 | pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 713 | + WLAN_PROBERESP_OFF_CAP_INFO); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 714 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 715 | /* Information elements */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 716 | pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 717 | + WLAN_PROBERESP_OFF_SSID); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 718 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 719 | while (((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) { |
| 720 | switch (pItem->byElementID) { |
| 721 | case WLAN_EID_SSID: |
| 722 | if (pFrame->pSSID == NULL) |
| 723 | pFrame->pSSID = (PWLAN_IE_SSID)pItem; |
| 724 | break; |
| 725 | case WLAN_EID_SUPP_RATES: |
| 726 | if (pFrame->pSuppRates == NULL) |
| 727 | pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem; |
| 728 | break; |
| 729 | case WLAN_EID_FH_PARMS: |
| 730 | break; |
| 731 | case WLAN_EID_DS_PARMS: |
| 732 | if (pFrame->pDSParms == NULL) |
| 733 | pFrame->pDSParms = (PWLAN_IE_DS_PARMS)pItem; |
| 734 | break; |
| 735 | case WLAN_EID_CF_PARMS: |
| 736 | if (pFrame->pCFParms == NULL) |
| 737 | pFrame->pCFParms = (PWLAN_IE_CF_PARMS)pItem; |
| 738 | break; |
| 739 | case WLAN_EID_IBSS_PARMS: |
| 740 | if (pFrame->pIBSSParms == NULL) |
| 741 | pFrame->pIBSSParms = (PWLAN_IE_IBSS_PARMS)pItem; |
| 742 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 743 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 744 | case WLAN_EID_RSN: |
| 745 | if (pFrame->pRSN == NULL) { |
| 746 | pFrame->pRSN = (PWLAN_IE_RSN)pItem; |
| 747 | } |
| 748 | break; |
| 749 | case WLAN_EID_RSN_WPA: |
| 750 | if (pFrame->pRSNWPA == NULL) { |
| 751 | if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == true) |
| 752 | pFrame->pRSNWPA = (PWLAN_IE_RSN_EXT)pItem; |
| 753 | } |
| 754 | break; |
| 755 | case WLAN_EID_ERP: |
| 756 | if (pFrame->pERP == NULL) |
| 757 | pFrame->pERP = (PWLAN_IE_ERP)pItem; |
| 758 | break; |
| 759 | case WLAN_EID_EXTSUPP_RATES: |
| 760 | if (pFrame->pExtSuppRates == NULL) |
| 761 | pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem; |
| 762 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 763 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 764 | case WLAN_EID_COUNTRY: /* 7 */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 765 | if (pFrame->pIE_Country == NULL) |
| 766 | pFrame->pIE_Country = (PWLAN_IE_COUNTRY)pItem; |
| 767 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 768 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 769 | case WLAN_EID_PWR_CONSTRAINT: /* 32 */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 770 | if (pFrame->pIE_PowerConstraint == NULL) |
| 771 | pFrame->pIE_PowerConstraint = (PWLAN_IE_PW_CONST)pItem; |
| 772 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 773 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 774 | case WLAN_EID_CH_SWITCH: /* 37 */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 775 | if (pFrame->pIE_CHSW == NULL) |
| 776 | pFrame->pIE_CHSW = (PWLAN_IE_CH_SW)pItem; |
| 777 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 778 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 779 | case WLAN_EID_QUIET: /* 40 */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 780 | if (pFrame->pIE_Quiet == NULL) |
| 781 | pFrame->pIE_Quiet = (PWLAN_IE_QUIET)pItem; |
| 782 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 783 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 784 | case WLAN_EID_IBSS_DFS: |
| 785 | if (pFrame->pIE_IBSSDFS == NULL) |
| 786 | pFrame->pIE_IBSSDFS = (PWLAN_IE_IBSS_DFS)pItem; |
| 787 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 788 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 789 | default: |
| 790 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Bad EID=%dd in proberesp\n", pItem->byElementID); |
| 791 | break; |
| 792 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 793 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 794 | pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len); |
| 795 | } |
| 796 | return; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 797 | } |
| 798 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 799 | /*+ |
| 800 | * |
| 801 | * Routine Description: |
| 802 | * Encode Authentication frame |
| 803 | * |
| 804 | * |
| 805 | * Return Value: |
| 806 | * None. |
| 807 | * |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 808 | -*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 809 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 810 | void |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 811 | vMgrEncodeAuthen( |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 812 | PWLAN_FR_AUTHEN pFrame |
| 813 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 814 | { |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 815 | pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 816 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 817 | /* Fixed Fields */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 818 | pFrame->pwAuthAlgorithm = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 819 | + WLAN_AUTHEN_OFF_AUTH_ALG); |
| 820 | pFrame->pwAuthSequence = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 821 | + WLAN_AUTHEN_OFF_AUTH_SEQ); |
| 822 | pFrame->pwStatus = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 823 | + WLAN_AUTHEN_OFF_STATUS); |
| 824 | pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_AUTHEN_OFF_STATUS + sizeof(*(pFrame->pwStatus)); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 825 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 826 | return; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 827 | } |
| 828 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 829 | /*+ |
| 830 | * |
| 831 | * Routine Description: |
| 832 | * Decode Authentication |
| 833 | * |
| 834 | * |
| 835 | * Return Value: |
| 836 | * None. |
| 837 | * |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 838 | -*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 839 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 840 | void |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 841 | vMgrDecodeAuthen( |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 842 | PWLAN_FR_AUTHEN pFrame |
| 843 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 844 | { |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 845 | PWLAN_IE pItem; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 846 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 847 | pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 848 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 849 | /* Fixed Fields */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 850 | pFrame->pwAuthAlgorithm = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 851 | + WLAN_AUTHEN_OFF_AUTH_ALG); |
| 852 | pFrame->pwAuthSequence = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 853 | + WLAN_AUTHEN_OFF_AUTH_SEQ); |
| 854 | pFrame->pwStatus = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 855 | + WLAN_AUTHEN_OFF_STATUS); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 856 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 857 | /* Information elements */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 858 | pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 859 | + WLAN_AUTHEN_OFF_CHALLENGE); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 860 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 861 | if ((((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) && (pItem->byElementID == WLAN_EID_CHALLENGE)) { |
| 862 | pFrame->pChallenge = (PWLAN_IE_CHALLENGE)pItem; |
| 863 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 864 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 865 | return; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 866 | } |
| 867 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 868 | /*+ |
| 869 | * |
| 870 | * Routine Description: |
| 871 | * Encode Authentication |
| 872 | * |
| 873 | * |
| 874 | * Return Value: |
| 875 | * None. |
| 876 | * |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 877 | -*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 878 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 879 | void |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 880 | vMgrEncodeDeauthen( |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 881 | PWLAN_FR_DEAUTHEN pFrame |
| 882 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 883 | { |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 884 | pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 885 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 886 | /* Fixed Fields */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 887 | pFrame->pwReason = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 888 | + WLAN_DEAUTHEN_OFF_REASON); |
| 889 | pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_DEAUTHEN_OFF_REASON + sizeof(*(pFrame->pwReason)); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 890 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 891 | return; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 892 | } |
| 893 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 894 | /*+ |
| 895 | * |
| 896 | * Routine Description: |
| 897 | * Decode Deauthentication |
| 898 | * |
| 899 | * |
| 900 | * Return Value: |
| 901 | * None. |
| 902 | * |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 903 | -*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 904 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 905 | void |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 906 | vMgrDecodeDeauthen( |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 907 | PWLAN_FR_DEAUTHEN pFrame |
| 908 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 909 | { |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 910 | pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 911 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 912 | /* Fixed Fields */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 913 | pFrame->pwReason = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 914 | + WLAN_DEAUTHEN_OFF_REASON); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 915 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 916 | return; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 917 | } |
| 918 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 919 | /*+ |
| 920 | * |
| 921 | * Routine Description: (AP) |
| 922 | * Encode Reassociation Response |
| 923 | * |
| 924 | * |
| 925 | * Return Value: |
| 926 | * None. |
| 927 | * |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 928 | -*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 929 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 930 | void |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 931 | vMgrEncodeReassocResponse( |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 932 | PWLAN_FR_REASSOCRESP pFrame |
| 933 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 934 | { |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 935 | pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 936 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 937 | /* Fixed Fields */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 938 | pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 939 | + WLAN_REASSOCRESP_OFF_CAP_INFO); |
| 940 | pFrame->pwStatus = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 941 | + WLAN_REASSOCRESP_OFF_STATUS); |
| 942 | pFrame->pwAid = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 943 | + WLAN_REASSOCRESP_OFF_AID); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 944 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 945 | pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_REASSOCRESP_OFF_AID + sizeof(*(pFrame->pwAid)); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 946 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 947 | return; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 948 | } |
| 949 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 950 | /*+ |
| 951 | * |
| 952 | * Routine Description: |
| 953 | * Decode Reassociation Response |
| 954 | * |
| 955 | * |
| 956 | * Return Value: |
| 957 | * None. |
| 958 | * |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 959 | -*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 960 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 961 | void |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 962 | vMgrDecodeReassocResponse( |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 963 | PWLAN_FR_REASSOCRESP pFrame |
| 964 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 965 | { |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 966 | PWLAN_IE pItem; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 967 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 968 | pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 969 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 970 | /* Fixed Fields */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 971 | pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 972 | + WLAN_REASSOCRESP_OFF_CAP_INFO); |
| 973 | pFrame->pwStatus = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 974 | + WLAN_REASSOCRESP_OFF_STATUS); |
| 975 | pFrame->pwAid = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 976 | + WLAN_REASSOCRESP_OFF_AID); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 977 | |
Tülin İzer | 1b37f29 | 2013-05-15 23:40:30 +0300 | [diff] [blame] | 978 | /* Information elements */ |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 979 | pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) |
| 980 | + WLAN_REASSOCRESP_OFF_SUPP_RATES); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 981 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 982 | pItem = (PWLAN_IE)(pFrame->pSuppRates); |
| 983 | pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 984 | |
Joe Perches | ab4622c | 2013-03-18 10:44:35 -0700 | [diff] [blame] | 985 | if ((((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) && |
| 986 | (pItem->byElementID == WLAN_EID_EXTSUPP_RATES)) { |
| 987 | pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem; |
| 988 | } |
| 989 | return; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 990 | } |