Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v3.18-rc5 141 lines 4.2 kB view raw
1/* 2 * Copyright (c) 1996, 2005 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: IEEE11h.c 21 * 22 * Purpose: 23 * 24 * Functions: 25 * 26 * Revision History: 27 * 28 * Author: Yiching Chen 29 * 30 * Date: Mar. 31, 2005 31 * 32 */ 33 34#include "ttype.h" 35#include "tmacro.h" 36#include "tether.h" 37#include "IEEE11h.h" 38#include "device.h" 39#include "wmgr.h" 40#include "rxtx.h" 41#include "channel.h" 42 43/*--------------------- Static Definitions -------------------------*/ 44 45#pragma pack(1) 46 47typedef 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; 53 54typedef 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; 61 62typedef 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; 69 70typedef 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; 77 78typedef 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; 85 86#pragma pack() 87 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 93#define ACTION_CHSW 4 94 95/*--------------------- Static Classes ----------------------------*/ 96 97/*--------------------- Static Variables --------------------------*/ 98 99/*--------------------- Static Functions --------------------------*/ 100 101/*--------------------- Export Variables --------------------------*/ 102 103/*--------------------- Export Functions --------------------------*/ 104 105bool IEEE11hbMSRRepTx(void *pMgmtHandle) 106{ 107 PSMgmtObject pMgmt = (PSMgmtObject) pMgmtHandle; 108 PWLAN_FRAME_MSRREP pMSRRep = (PWLAN_FRAME_MSRREP) 109 (pMgmt->abyCurrentMSRRep + sizeof(STxMgmtPacket)); 110 size_t uLength = 0; 111 PSTxMgmtPacket pTxPacket = NULL; 112 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)); 117 118 pMSRRep->Header.wFrameCtl = (WLAN_SET_FC_FTYPE(WLAN_FTYPE_MGMT) | 119 WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_ACTION) 120); 121 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); 127 128 pMSRRep->byCategory = 0; 129 pMSRRep->byAction = 1; 130 pMSRRep->byDialogToken = ((PWLAN_FRAME_MSRREQ) 131 (pMgmt->abyCurrentMSRReq))->byDialogToken; 132 133 uLength = pMgmt->uLengthOfRepEIDs + offsetof(WLAN_FRAME_MSRREP, 134 sMSRRepEIDs); 135 136 pTxPacket->cbMPDULen = uLength; 137 pTxPacket->cbPayloadLen = uLength - WLAN_HDR_ADDR3_LEN; 138 if (csMgmt_xmit(pMgmt->pAdapter, pTxPacket) != CMD_STATUS_PENDING) 139 return false; 140 return true; 141}