vntwifi.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700
  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. *
  19. *
  20. * File: vntwifi.c
  21. *
  22. * Purpose: export functions for vntwifi lib
  23. *
  24. * Functions:
  25. *
  26. * Revision History:
  27. *
  28. * Author: Yiching Chen
  29. *
  30. * Date: feb. 2, 2005
  31. *
  32. */
  33. #include "vntwifi.h"
  34. #include "IEEE11h.h"
  35. #include "country.h"
  36. #include "device.h"
  37. #include "wmgr.h"
  38. #include "datarate.h"
  39. /*--------------------- Static Definitions -------------------------*/
  40. /*--------------------- Static Classes ----------------------------*/
  41. /*--------------------- Static Variables --------------------------*/
  42. /*--------------------- Static Functions --------------------------*/
  43. /*--------------------- Export Variables --------------------------*/
  44. /*--------------------- Export Functions --------------------------*/
  45. /*+
  46. *
  47. * Description:
  48. * Set Operation Mode
  49. *
  50. * Parameters:
  51. * In:
  52. * pMgmtHandle - pointer to management object
  53. * eOPMode - Operation Mode
  54. * Out:
  55. * none
  56. *
  57. * Return Value: none
  58. *
  59. -*/
  60. void
  61. VNTWIFIvSetOPMode(
  62. void *pMgmtHandle,
  63. WMAC_CONFIG_MODE eOPMode
  64. )
  65. {
  66. PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
  67. pMgmt->eConfigMode = eOPMode;
  68. }
  69. /*+
  70. *
  71. * Description:
  72. * Set Operation Mode
  73. *
  74. * Parameters:
  75. * In:
  76. * pMgmtHandle - pointer to management object
  77. * wBeaconPeriod - Beacon Period
  78. * wATIMWindow - ATIM window
  79. * uChannel - channel number
  80. * Out:
  81. * none
  82. *
  83. * Return Value: none
  84. *
  85. -*/
  86. void
  87. VNTWIFIvSetIBSSParameter(
  88. void *pMgmtHandle,
  89. unsigned short wBeaconPeriod,
  90. unsigned short wATIMWindow,
  91. unsigned int uChannel
  92. )
  93. {
  94. PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
  95. pMgmt->wIBSSBeaconPeriod = wBeaconPeriod;
  96. pMgmt->wIBSSATIMWindow = wATIMWindow;
  97. pMgmt->uIBSSChannel = uChannel;
  98. }
  99. /*+
  100. *
  101. * Description:
  102. * Get current SSID
  103. *
  104. * Parameters:
  105. * In:
  106. * pMgmtHandle - pointer to management object
  107. * Out:
  108. * none
  109. *
  110. * Return Value: current SSID pointer.
  111. *
  112. -*/
  113. PWLAN_IE_SSID
  114. VNTWIFIpGetCurrentSSID(
  115. void *pMgmtHandle
  116. )
  117. {
  118. PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
  119. return (PWLAN_IE_SSID) pMgmt->abyCurrSSID;
  120. }
  121. /*+
  122. *
  123. * Description:
  124. * Get current link channel
  125. *
  126. * Parameters:
  127. * In:
  128. * pMgmtHandle - pointer to management object
  129. * Out:
  130. * none
  131. *
  132. * Return Value: current Channel.
  133. *
  134. -*/
  135. unsigned int
  136. VNTWIFIpGetCurrentChannel(
  137. void *pMgmtHandle
  138. )
  139. {
  140. PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
  141. if (pMgmtHandle != NULL)
  142. return pMgmt->uCurrChannel;
  143. return 0;
  144. }
  145. /*+
  146. *
  147. * Description:
  148. * Get current Assoc ID
  149. *
  150. * Parameters:
  151. * In:
  152. * pMgmtHandle - pointer to management object
  153. * Out:
  154. * none
  155. *
  156. * Return Value: current Assoc ID
  157. *
  158. -*/
  159. unsigned short
  160. VNTWIFIwGetAssocID(
  161. void *pMgmtHandle
  162. )
  163. {
  164. PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
  165. return pMgmt->wCurrAID;
  166. }
  167. /*+
  168. *
  169. * Description:
  170. * This routine return max support rate of IES
  171. *
  172. * Parameters:
  173. * In:
  174. * pSupportRateIEs
  175. * pExtSupportRateIEs
  176. *
  177. * Out:
  178. *
  179. * Return Value: max support rate
  180. *
  181. -*/
  182. unsigned char
  183. VNTWIFIbyGetMaxSupportRate(
  184. PWLAN_IE_SUPP_RATES pSupportRateIEs,
  185. PWLAN_IE_SUPP_RATES pExtSupportRateIEs
  186. )
  187. {
  188. unsigned char byMaxSupportRate = RATE_1M;
  189. unsigned char bySupportRate = RATE_1M;
  190. unsigned int ii = 0;
  191. if (pSupportRateIEs) {
  192. for (ii = 0; ii < pSupportRateIEs->len; ii++) {
  193. bySupportRate = DATARATEbyGetRateIdx(pSupportRateIEs->abyRates[ii]);
  194. if (bySupportRate > byMaxSupportRate)
  195. byMaxSupportRate = bySupportRate;
  196. }
  197. }
  198. if (pExtSupportRateIEs) {
  199. for (ii = 0; ii < pExtSupportRateIEs->len; ii++) {
  200. bySupportRate = DATARATEbyGetRateIdx(pExtSupportRateIEs->abyRates[ii]);
  201. if (bySupportRate > byMaxSupportRate)
  202. byMaxSupportRate = bySupportRate;
  203. }
  204. }
  205. return byMaxSupportRate;
  206. }
  207. /*+
  208. *
  209. * Description:
  210. * This routine return data rate of ACK packtet
  211. *
  212. * Parameters:
  213. * In:
  214. * byRxDataRate
  215. * pSupportRateIEs
  216. * pExtSupportRateIEs
  217. *
  218. * Out:
  219. *
  220. * Return Value: max support rate
  221. *
  222. -*/
  223. unsigned char
  224. VNTWIFIbyGetACKTxRate(
  225. unsigned char byRxDataRate,
  226. PWLAN_IE_SUPP_RATES pSupportRateIEs,
  227. PWLAN_IE_SUPP_RATES pExtSupportRateIEs
  228. )
  229. {
  230. unsigned char byMaxAckRate;
  231. unsigned char byBasicRate;
  232. unsigned int ii;
  233. if (byRxDataRate <= RATE_11M) {
  234. byMaxAckRate = RATE_1M;
  235. } else {
  236. /* 24M is mandatory for 802.11a and 802.11g */
  237. byMaxAckRate = RATE_24M;
  238. }
  239. if (pSupportRateIEs) {
  240. for (ii = 0; ii < pSupportRateIEs->len; ii++) {
  241. if (pSupportRateIEs->abyRates[ii] & 0x80) {
  242. byBasicRate = DATARATEbyGetRateIdx(pSupportRateIEs->abyRates[ii]);
  243. if ((byBasicRate <= byRxDataRate) &&
  244. (byBasicRate > byMaxAckRate)) {
  245. byMaxAckRate = byBasicRate;
  246. }
  247. }
  248. }
  249. }
  250. if (pExtSupportRateIEs) {
  251. for (ii = 0; ii < pExtSupportRateIEs->len; ii++) {
  252. if (pExtSupportRateIEs->abyRates[ii] & 0x80) {
  253. byBasicRate = DATARATEbyGetRateIdx(pExtSupportRateIEs->abyRates[ii]);
  254. if ((byBasicRate <= byRxDataRate) &&
  255. (byBasicRate > byMaxAckRate)) {
  256. byMaxAckRate = byBasicRate;
  257. }
  258. }
  259. }
  260. }
  261. return byMaxAckRate;
  262. }
  263. /*+
  264. *
  265. * Description:
  266. * Set Authentication Mode
  267. *
  268. * Parameters:
  269. * In:
  270. * pMgmtHandle - pointer to management object
  271. * eAuthMode - Authentication mode
  272. * Out:
  273. * none
  274. *
  275. * Return Value: none
  276. *
  277. -*/
  278. void
  279. VNTWIFIvSetAuthenticationMode(
  280. void *pMgmtHandle,
  281. WMAC_AUTHENTICATION_MODE eAuthMode
  282. )
  283. {
  284. PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
  285. pMgmt->eAuthenMode = eAuthMode;
  286. if ((eAuthMode == WMAC_AUTH_SHAREKEY) ||
  287. (eAuthMode == WMAC_AUTH_AUTO)) {
  288. pMgmt->bShareKeyAlgorithm = true;
  289. } else {
  290. pMgmt->bShareKeyAlgorithm = false;
  291. }
  292. }
  293. /*+
  294. *
  295. * Description:
  296. * Set Encryption Mode
  297. *
  298. * Parameters:
  299. * In:
  300. * pMgmtHandle - pointer to management object
  301. * eAuthMode - Authentication mode
  302. * Out:
  303. * none
  304. *
  305. * Return Value: none
  306. *
  307. -*/
  308. void
  309. VNTWIFIvSetEncryptionMode(
  310. void *pMgmtHandle,
  311. WMAC_ENCRYPTION_MODE eEncryptionMode
  312. )
  313. {
  314. PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
  315. pMgmt->eEncryptionMode = eEncryptionMode;
  316. if ((eEncryptionMode == WMAC_ENCRYPTION_WEPEnabled) ||
  317. (eEncryptionMode == WMAC_ENCRYPTION_TKIPEnabled) ||
  318. (eEncryptionMode == WMAC_ENCRYPTION_AESEnabled)) {
  319. pMgmt->bPrivacyInvoked = true;
  320. } else {
  321. pMgmt->bPrivacyInvoked = false;
  322. }
  323. }
  324. bool
  325. VNTWIFIbConfigPhyMode(
  326. void *pMgmtHandle,
  327. CARD_PHY_TYPE ePhyType
  328. )
  329. {
  330. PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
  331. if ((ePhyType != PHY_TYPE_AUTO) &&
  332. (ePhyType != pMgmt->eCurrentPHYMode)) {
  333. if (CARDbSetPhyParameter(pMgmt->pAdapter, ePhyType, 0, 0, NULL, NULL) == true)
  334. pMgmt->eCurrentPHYMode = ePhyType;
  335. else
  336. return false;
  337. }
  338. pMgmt->eConfigPHYMode = ePhyType;
  339. return true;
  340. }
  341. void
  342. VNTWIFIbGetConfigPhyMode(
  343. void *pMgmtHandle,
  344. void *pePhyType
  345. )
  346. {
  347. PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
  348. if ((pMgmt != NULL) && (pePhyType != NULL))
  349. *(PCARD_PHY_TYPE)pePhyType = pMgmt->eConfigPHYMode;
  350. }
  351. /*+
  352. *
  353. * Description:
  354. * Clear BSS List Database except current assoc BSS
  355. *
  356. * Parameters:
  357. * In:
  358. * pMgmtHandle - Management Object structure
  359. * bLinkPass - Current Link status
  360. * Out:
  361. *
  362. * Return Value: None.
  363. *
  364. -*/
  365. /*+
  366. *
  367. * Description:
  368. * Query BSS List in management database
  369. *
  370. * Parameters:
  371. * In:
  372. * pMgmtHandle - Management Object structure
  373. * Out:
  374. * puBSSCount - BSS count
  375. * pvFirstBSS - pointer to first BSS
  376. *
  377. * Return Value: None.
  378. *
  379. -*/
  380. void
  381. VNTWIFIvQueryBSSList(void *pMgmtHandle, unsigned int *puBSSCount, void **pvFirstBSS)
  382. {
  383. unsigned int ii = 0;
  384. PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
  385. PKnownBSS pBSS = NULL;
  386. unsigned int uCount = 0;
  387. *pvFirstBSS = NULL;
  388. for (ii = 0; ii < MAX_BSS_NUM; ii++) {
  389. pBSS = &(pMgmt->sBSSList[ii]);
  390. if (!pBSS->bActive)
  391. continue;
  392. if (*pvFirstBSS == NULL)
  393. *pvFirstBSS = &(pMgmt->sBSSList[ii]);
  394. uCount++;
  395. }
  396. *puBSSCount = uCount;
  397. }
  398. void
  399. VNTWIFIvGetNextBSS(
  400. void *pMgmtHandle,
  401. void *pvCurrentBSS,
  402. void **pvNextBSS
  403. )
  404. {
  405. PKnownBSS pBSS = (PKnownBSS) pvCurrentBSS;
  406. PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
  407. *pvNextBSS = NULL;
  408. while (*pvNextBSS == NULL) {
  409. pBSS++;
  410. if (pBSS > &(pMgmt->sBSSList[MAX_BSS_NUM]))
  411. return;
  412. if (pBSS->bActive == true) {
  413. *pvNextBSS = pBSS;
  414. return;
  415. }
  416. }
  417. }
  418. /*+
  419. *
  420. * Description:
  421. * Update Tx attemps, Tx failure counter in Node DB
  422. *
  423. * In:
  424. * Out:
  425. * none
  426. *
  427. * Return Value: none
  428. *
  429. -*/
  430. void
  431. VNTWIFIvUpdateNodeTxCounter(
  432. void *pMgmtHandle,
  433. unsigned char *pbyDestAddress,
  434. bool bTxOk,
  435. unsigned short wRate,
  436. unsigned char *pbyTxFailCount
  437. )
  438. {
  439. PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
  440. unsigned int uNodeIndex = 0;
  441. unsigned int ii;
  442. if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ||
  443. (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) {
  444. if (BSSDBbIsSTAInNodeDB(pMgmt, pbyDestAddress, &uNodeIndex) == false)
  445. return;
  446. }
  447. pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts++;
  448. if (bTxOk) {
  449. /* transmit success, TxAttempts at least plus one */
  450. pMgmt->sNodeDBTable[uNodeIndex].uTxOk[MAX_RATE]++;
  451. pMgmt->sNodeDBTable[uNodeIndex].uTxOk[wRate]++;
  452. } else {
  453. pMgmt->sNodeDBTable[uNodeIndex].uTxFailures++;
  454. }
  455. pMgmt->sNodeDBTable[uNodeIndex].uTxRetry += pbyTxFailCount[MAX_RATE];
  456. for (ii = 0; ii < MAX_RATE; ii++)
  457. pMgmt->sNodeDBTable[uNodeIndex].uTxFail[ii] += pbyTxFailCount[ii];
  458. }
  459. void
  460. VNTWIFIvGetTxRate(
  461. void *pMgmtHandle,
  462. unsigned char *pbyDestAddress,
  463. unsigned short *pwTxDataRate,
  464. unsigned char *pbyACKRate,
  465. unsigned char *pbyCCKBasicRate,
  466. unsigned char *pbyOFDMBasicRate
  467. )
  468. {
  469. PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
  470. unsigned int uNodeIndex = 0;
  471. unsigned short wTxDataRate = RATE_1M;
  472. unsigned char byACKRate = RATE_1M;
  473. unsigned char byCCKBasicRate = RATE_1M;
  474. unsigned char byOFDMBasicRate = RATE_24M;
  475. PWLAN_IE_SUPP_RATES pSupportRateIEs = NULL;
  476. PWLAN_IE_SUPP_RATES pExtSupportRateIEs = NULL;
  477. if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ||
  478. (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) {
  479. /* Adhoc Tx rate decided from node DB */
  480. if (BSSDBbIsSTAInNodeDB(pMgmt, pbyDestAddress, &uNodeIndex)) {
  481. wTxDataRate = (pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate);
  482. pSupportRateIEs = (PWLAN_IE_SUPP_RATES) (pMgmt->sNodeDBTable[uNodeIndex].abyCurrSuppRates);
  483. pExtSupportRateIEs = (PWLAN_IE_SUPP_RATES) (pMgmt->sNodeDBTable[uNodeIndex].abyCurrExtSuppRates);
  484. } else {
  485. if (pMgmt->eCurrentPHYMode != PHY_TYPE_11A)
  486. wTxDataRate = RATE_2M;
  487. else
  488. wTxDataRate = RATE_24M;
  489. pSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates;
  490. pExtSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates;
  491. }
  492. } else { /* Infrastructure: rate decided from AP Node, index = 0 */
  493. wTxDataRate = (pMgmt->sNodeDBTable[0].wTxDataRate);
  494. pSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates;
  495. pExtSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates;
  496. }
  497. byACKRate = VNTWIFIbyGetACKTxRate((unsigned char) wTxDataRate,
  498. pSupportRateIEs,
  499. pExtSupportRateIEs
  500. );
  501. if (byACKRate > (unsigned char) wTxDataRate)
  502. byACKRate = (unsigned char) wTxDataRate;
  503. byCCKBasicRate = VNTWIFIbyGetACKTxRate(RATE_11M,
  504. pSupportRateIEs,
  505. pExtSupportRateIEs
  506. );
  507. byOFDMBasicRate = VNTWIFIbyGetACKTxRate(RATE_54M,
  508. pSupportRateIEs,
  509. pExtSupportRateIEs
  510. );
  511. *pwTxDataRate = wTxDataRate;
  512. *pbyACKRate = byACKRate;
  513. *pbyCCKBasicRate = byCCKBasicRate;
  514. *pbyOFDMBasicRate = byOFDMBasicRate;
  515. }
  516. unsigned char
  517. VNTWIFIbyGetKeyCypher(
  518. void *pMgmtHandle,
  519. bool bGroupKey
  520. )
  521. {
  522. PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
  523. if (bGroupKey)
  524. return pMgmt->byCSSGK;
  525. else
  526. return pMgmt->byCSSPK;
  527. }
  528. bool
  529. VNTWIFIbSetPMKIDCache(
  530. void *pMgmtObject,
  531. unsigned long ulCount,
  532. void *pPMKIDInfo
  533. )
  534. {
  535. PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
  536. if (ulCount > MAX_PMKID_CACHE)
  537. return false;
  538. pMgmt->gsPMKIDCache.BSSIDInfoCount = ulCount;
  539. memcpy(pMgmt->gsPMKIDCache.BSSIDInfo, pPMKIDInfo, (ulCount*sizeof(PMKIDInfo)));
  540. return true;
  541. }
  542. unsigned short
  543. VNTWIFIwGetMaxSupportRate(
  544. void *pMgmtObject
  545. )
  546. {
  547. unsigned short wRate = RATE_54M;
  548. PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
  549. for (wRate = RATE_54M; wRate > RATE_1M; wRate--) {
  550. if (pMgmt->sNodeDBTable[0].wSuppRate & (1<<wRate))
  551. return wRate;
  552. }
  553. if (pMgmt->eCurrentPHYMode == PHY_TYPE_11A)
  554. return RATE_6M;
  555. else
  556. return RATE_1M;
  557. }
  558. void
  559. VNTWIFIvSet11h(
  560. void *pMgmtObject,
  561. bool b11hEnable
  562. )
  563. {
  564. PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
  565. pMgmt->b11hEnable = b11hEnable;
  566. }
  567. bool
  568. VNTWIFIbMeasureReport(
  569. void *pMgmtObject,
  570. bool bEndOfReport,
  571. void *pvMeasureEID,
  572. unsigned char byReportMode,
  573. unsigned char byBasicMap,
  574. unsigned char byCCAFraction,
  575. unsigned char *pbyRPIs
  576. )
  577. {
  578. PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
  579. unsigned char *pbyCurrentEID = (unsigned char *)(pMgmt->pCurrMeasureEIDRep);
  580. if ((pvMeasureEID != NULL) &&
  581. (pMgmt->uLengthOfRepEIDs < (WLAN_A3FR_MAXLEN - sizeof(MEASEURE_REP) - sizeof(WLAN_80211HDR_A3) - 3))
  582. ) {
  583. pMgmt->pCurrMeasureEIDRep->byElementID = WLAN_EID_MEASURE_REP;
  584. pMgmt->pCurrMeasureEIDRep->len = 3;
  585. pMgmt->pCurrMeasureEIDRep->byToken = ((PWLAN_IE_MEASURE_REQ)pvMeasureEID)->byToken;
  586. pMgmt->pCurrMeasureEIDRep->byMode = byReportMode;
  587. pMgmt->pCurrMeasureEIDRep->byType = ((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->byType;
  588. switch (pMgmt->pCurrMeasureEIDRep->byType) {
  589. case MEASURE_TYPE_BASIC:
  590. pMgmt->pCurrMeasureEIDRep->len += sizeof(MEASEURE_REP_BASIC);
  591. memcpy(&(pMgmt->pCurrMeasureEIDRep->sRep.sBasic),
  592. &(((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->sReq),
  593. sizeof(MEASEURE_REQ));
  594. pMgmt->pCurrMeasureEIDRep->sRep.sBasic.byMap = byBasicMap;
  595. break;
  596. case MEASURE_TYPE_CCA:
  597. pMgmt->pCurrMeasureEIDRep->len += sizeof(MEASEURE_REP_CCA);
  598. memcpy(&(pMgmt->pCurrMeasureEIDRep->sRep.sCCA),
  599. &(((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->sReq),
  600. sizeof(MEASEURE_REQ));
  601. pMgmt->pCurrMeasureEIDRep->sRep.sCCA.byCCABusyFraction = byCCAFraction;
  602. break;
  603. case MEASURE_TYPE_RPI:
  604. pMgmt->pCurrMeasureEIDRep->len += sizeof(MEASEURE_REP_RPI);
  605. memcpy(&(pMgmt->pCurrMeasureEIDRep->sRep.sRPI),
  606. &(((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->sReq),
  607. sizeof(MEASEURE_REQ));
  608. memcpy(pMgmt->pCurrMeasureEIDRep->sRep.sRPI.abyRPIdensity, pbyRPIs, 8);
  609. break;
  610. default:
  611. break;
  612. }
  613. pbyCurrentEID += (2 + pMgmt->pCurrMeasureEIDRep->len);
  614. pMgmt->uLengthOfRepEIDs += (2 + pMgmt->pCurrMeasureEIDRep->len);
  615. pMgmt->pCurrMeasureEIDRep = (PWLAN_IE_MEASURE_REP) pbyCurrentEID;
  616. }
  617. if (bEndOfReport)
  618. IEEE11hbMSRRepTx(pMgmt);
  619. return true;
  620. }
  621. bool
  622. VNTWIFIbChannelSwitch(
  623. void *pMgmtObject,
  624. unsigned char byNewChannel
  625. )
  626. {
  627. PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
  628. pMgmt->uCurrChannel = byNewChannel;
  629. pMgmt->bSwitchChannel = false;
  630. return true;
  631. }