2 * Copyright (c) 1996, 2005 VIA Networking Technologies, Inc.
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.
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.
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.
28 * Author: Yiching Chen
43 /*--------------------- Static Definitions -------------------------*/
47 typedef struct _WLAN_FRAME_ACTION {
48 WLAN_80211HDR_A3 Header;
49 unsigned char byCategory;
50 unsigned char byAction;
51 unsigned char abyVars[1];
52 } WLAN_FRAME_ACTION, *PWLAN_FRAME_ACTION;
54 typedef struct _WLAN_FRAME_MSRREQ {
55 WLAN_80211HDR_A3 Header;
56 unsigned char byCategory;
57 unsigned char byAction;
58 unsigned char byDialogToken;
59 WLAN_IE_MEASURE_REQ sMSRReqEIDs[1];
60 } WLAN_FRAME_MSRREQ, *PWLAN_FRAME_MSRREQ;
62 typedef struct _WLAN_FRAME_MSRREP {
63 WLAN_80211HDR_A3 Header;
64 unsigned char byCategory;
65 unsigned char byAction;
66 unsigned char byDialogToken;
67 WLAN_IE_MEASURE_REP sMSRRepEIDs[1];
68 } WLAN_FRAME_MSRREP, *PWLAN_FRAME_MSRREP;
70 typedef struct _WLAN_FRAME_TPCREQ {
71 WLAN_80211HDR_A3 Header;
72 unsigned char byCategory;
73 unsigned char byAction;
74 unsigned char byDialogToken;
75 WLAN_IE_TPC_REQ sTPCReqEIDs;
76 } WLAN_FRAME_TPCREQ, *PWLAN_FRAME_TPCREQ;
78 typedef struct _WLAN_FRAME_TPCREP {
79 WLAN_80211HDR_A3 Header;
80 unsigned char byCategory;
81 unsigned char byAction;
82 unsigned char byDialogToken;
83 WLAN_IE_TPC_REP sTPCRepEIDs;
84 } WLAN_FRAME_TPCREP, *PWLAN_FRAME_TPCREP;
88 /* action field reference ieee 802.11h Table 20e */
89 #define ACTION_MSRREQ 0
90 #define ACTION_MSRREP 1
91 #define ACTION_TPCREQ 2
92 #define ACTION_TPCREP 3
95 /*--------------------- Static Classes ----------------------------*/
97 /*--------------------- Static Variables --------------------------*/
99 /*--------------------- Static Functions --------------------------*/
101 /*--------------------- Export Variables --------------------------*/
103 /*--------------------- Export Functions --------------------------*/
105 bool IEEE11hbMSRRepTx(void *pMgmtHandle)
107 PSMgmtObject pMgmt = (PSMgmtObject) pMgmtHandle;
108 PWLAN_FRAME_MSRREP pMSRRep = (PWLAN_FRAME_MSRREP)
109 (pMgmt->abyCurrentMSRRep + sizeof(STxMgmtPacket));
111 PSTxMgmtPacket pTxPacket = NULL;
113 pTxPacket = (PSTxMgmtPacket)pMgmt->abyCurrentMSRRep;
114 memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN);
115 pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket +
116 sizeof(STxMgmtPacket));
118 pMSRRep->Header.wFrameCtl = (WLAN_SET_FC_FTYPE(WLAN_FTYPE_MGMT) |
119 WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_ACTION)
122 memcpy(pMSRRep->Header.abyAddr1, ((PWLAN_FRAME_MSRREQ)
123 (pMgmt->abyCurrentMSRReq))->Header.abyAddr2, WLAN_ADDR_LEN);
124 memcpy(pMSRRep->Header.abyAddr2,
125 CARDpGetCurrentAddress(pMgmt->pAdapter), WLAN_ADDR_LEN);
126 memcpy(pMSRRep->Header.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN);
128 pMSRRep->byCategory = 0;
129 pMSRRep->byAction = 1;
130 pMSRRep->byDialogToken = ((PWLAN_FRAME_MSRREQ)
131 (pMgmt->abyCurrentMSRReq))->byDialogToken;
133 uLength = pMgmt->uLengthOfRepEIDs + offsetof(WLAN_FRAME_MSRREP,
136 pTxPacket->cbMPDULen = uLength;
137 pTxPacket->cbPayloadLen = uLength - WLAN_HDR_ADDR3_LEN;
138 if (csMgmt_xmit(pMgmt->pAdapter, pTxPacket) != CMD_STATUS_PENDING)