📄 mlme.h
字号:
/* ************************************************************************* * Ralink Tech Inc. * 4F, No. 2 Technology 5th Rd. * Science-based Industrial Park * Hsin-chu, Taiwan, R.O.C. * * (c) Copyright 2002-2007, Ralink Technology, Inc. * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * * ************************************************************************* Module Name: mlme.h Abstract: Revision History: Who When What -------- ---------- ---------------------------------------------- John Chang 2003-08-28 Created John Chang 2004-09-06 modified for RT2600 */#ifndef __MLME_H__#define __MLME_H__//extern UCHAR BROADCAST_ADDR[];// maximum supported capability information - // ESS, IBSS, Privacy, Short Preamble, Spectrum mgmt, Short Slot#define SUPPORTED_CAPABILITY_INFO 0x0533#define END_OF_ARGS -1#define LFSR_MASK 0x80000057#define MLME_TASK_EXEC_INTV 200 // #define MLME_TASK_EXEC_MULTIPLE 5 // MLME_TASK_EXEC_MULTIPLE * MLME_TASK_EXEC_INTV = 1 sec#define REORDER_EXEC_INTV 100 // 0.1 sec//#define TBTT_PRELOAD_TIME 384 // usec. LomgPreamble + 24-byte at 1Mbps// The definition of Radar detection duration region#define CE 0#define FCC 1#define JAP 2#define JAP_W53 3#define JAP_W56 4#define MAX_RD_REGION 5#ifdef NDIS51_MINIPORT#define BEACON_LOST_TIME 4000 // 2048 msec = 2 sec#else#define BEACON_LOST_TIME 4000 // 2048 msec = 2 sec#endif#define AUTH_TIMEOUT 300 // unit: msec#define ASSOC_TIMEOUT 300 // unit: msec#define JOIN_TIMEOUT 2000 // unit: msec#define SHORT_CHANNEL_TIME 90 // unit: msec#define MIN_CHANNEL_TIME 110 // unit: msec, for dual band scan#define MAX_CHANNEL_TIME 140 // unit: msec, for single band scan#define FAST_ACTIVE_SCAN_TIME 30 // Active scan waiting for probe response time#define CW_MIN_IN_BITS 4 // actual CwMin = 2^CW_MIN_IN_BITS - 1#ifdef CONFIG_STA_SUPPORT #define CW_MAX_IN_BITS 10 // actual CwMax = 2^CW_MAX_IN_BITS - 1#endif // CONFIG_STA_SUPPORT //// Note: RSSI_TO_DBM_OFFSET has been changed to variable for new RF (2004-0720).// SHould not refer to this constant anymore//#define RSSI_TO_DBM_OFFSET 120 // for RT2530 RSSI-115 = dBm#define RSSI_FOR_MID_TX_POWER -55 // -55 db is considered mid-distance#define RSSI_FOR_LOW_TX_POWER -45 // -45 db is considered very short distance and // eligible to use a lower TX power#define RSSI_FOR_LOWEST_TX_POWER -30//#define MID_TX_POWER_DELTA 0 // 0 db from full TX power upon mid-distance to AP#define LOW_TX_POWER_DELTA 6 // -3 db from full TX power upon very short distance. 1 grade is 0.5 db#define LOWEST_TX_POWER_DELTA 16 // -8 db from full TX power upon shortest distance. 1 grade is 0.5 db#define RSSI_TRIGGERED_UPON_BELOW_THRESHOLD 0#define RSSI_TRIGGERED_UPON_EXCCEED_THRESHOLD 1#define RSSI_THRESHOLD_FOR_ROAMING 25#define RSSI_DELTA 5// Channel Quality Indication#define CQI_IS_GOOD(cqi) ((cqi) >= 50)//#define CQI_IS_FAIR(cqi) (((cqi) >= 20) && ((cqi) < 50))#define CQI_IS_POOR(cqi) (cqi < 50) //(((cqi) >= 5) && ((cqi) < 20))#define CQI_IS_BAD(cqi) (cqi < 5)#define CQI_IS_DEAD(cqi) (cqi == 0)// weighting factor to calculate Channel quality, total should be 100%#define RSSI_WEIGHTING 50#define TX_WEIGHTING 30#define RX_WEIGHTING 20//#define PEER_KEY_NOT_USED 0//#define PEER_KEY_64_BIT 64//#define PEER_KEY_128_BIT 128//#define PEER_KEY_64BIT_LEN 8//#define PEER_KEY_128BIT_LEN 16#define BSS_NOT_FOUND 0xFFFFFFFF#ifdef CONFIG_STA_SUPPORT#define MAX_LEN_OF_MLME_QUEUE 20 //10#endif // CONFIG_STA_SUPPORT //#define SCAN_PASSIVE 18 // scan with no probe request, only wait beacon and probe response#define SCAN_ACTIVE 19 // scan with probe request, and wait beacon and probe response#define SCAN_CISCO_PASSIVE 20 // Single channel passive scan#define SCAN_CISCO_ACTIVE 21 // Single channel active scan#define SCAN_CISCO_NOISE 22 // Single channel passive scan for noise histogram collection#define SCAN_CISCO_CHANNEL_LOAD 23 // Single channel passive scan for channel load collection#define FAST_SCAN_ACTIVE 24 // scan with probe request, and wait beacon and probe response//#define BSS_TABLE_EMPTY(x) ((x).BssNr == 0)#define MAC_ADDR_IS_GROUP(Addr) (((Addr[0]) & 0x01))#define MAC_ADDR_HASH(Addr) (Addr[0] ^ Addr[1] ^ Addr[2] ^ Addr[3] ^ Addr[4] ^ Addr[5])#define MAC_ADDR_HASH_INDEX(Addr) (MAC_ADDR_HASH(Addr) % HASH_TABLE_SIZE)#define TID_MAC_HASH(Addr,TID) (TID^Addr[0] ^ Addr[1] ^ Addr[2] ^ Addr[3] ^ Addr[4] ^ Addr[5])#define TID_MAC_HASH_INDEX(Addr,TID) (TID_MAC_HASH(Addr,TID) % HASH_TABLE_SIZE)// LED Control// assoiation ON. one LED ON. another blinking when TX, OFF when idle// no association, both LED off#define ASIC_LED_ACT_ON(pAd) RTMP_IO_WRITE32(pAd, MAC_CSR14, 0x00031e46)#define ASIC_LED_ACT_OFF(pAd) RTMP_IO_WRITE32(pAd, MAC_CSR14, 0x00001e46)// bit definition of the 2-byte pBEACON->Capability field#define CAP_IS_ESS_ON(x) (((x) & 0x0001) != 0)#define CAP_IS_IBSS_ON(x) (((x) & 0x0002) != 0)#define CAP_IS_CF_POLLABLE_ON(x) (((x) & 0x0004) != 0)#define CAP_IS_CF_POLL_REQ_ON(x) (((x) & 0x0008) != 0)#define CAP_IS_PRIVACY_ON(x) (((x) & 0x0010) != 0)#define CAP_IS_SHORT_PREAMBLE_ON(x) (((x) & 0x0020) != 0)#define CAP_IS_PBCC_ON(x) (((x) & 0x0040) != 0)#define CAP_IS_AGILITY_ON(x) (((x) & 0x0080) != 0)#define CAP_IS_SPECTRUM_MGMT(x) (((x) & 0x0100) != 0) // 802.11e d9#define CAP_IS_QOS(x) (((x) & 0x0200) != 0) // 802.11e d9#define CAP_IS_SHORT_SLOT(x) (((x) & 0x0400) != 0)#define CAP_IS_APSD(x) (((x) & 0x0800) != 0) // 802.11e d9#define CAP_IS_IMMED_BA(x) (((x) & 0x1000) != 0) // 802.11e d9#define CAP_IS_DSSS_OFDM(x) (((x) & 0x2000) != 0)#define CAP_IS_DELAY_BA(x) (((x) & 0x4000) != 0) // 802.11e d9#define CAP_GENERATE(ess,ibss,priv,s_pre,s_slot) (((ess) ? 0x0001 : 0x0000) | ((ibss) ? 0x0002 : 0x0000) | ((priv) ? 0x0010 : 0x0000) | ((s_pre) ? 0x0020 : 0x0000) | ((s_slot) ? 0x0400 : 0x0000))//#define STA_QOS_CAPABILITY 0 // 1-byte. see 802.11e d9.0 for bit definition#define ERP_IS_NON_ERP_PRESENT(x) (((x) & 0x01) != 0) // 802.11g#define ERP_IS_USE_PROTECTION(x) (((x) & 0x02) != 0) // 802.11g#define ERP_IS_USE_BARKER_PREAMBLE(x) (((x) & 0x04) != 0) // 802.11g#define DRS_TX_QUALITY_WORST_BOUND 3#define DRS_PENALTY 8#define BA_NOTUSE 2//BA Policy subfiled value in ADDBA frame#define IMMED_BA 1#define DELAY_BA 0// BA Initiator subfield in DELBA frame#define ORIGINATOR 1#define RECIPIENT 0// ADDBA Status Code#define ADDBA_RESULTCODE_SUCCESS 0#define ADDBA_RESULTCODE_REFUSED 37#define ADDBA_RESULTCODE_INVALID_PARAMETERS 38// DELBA Reason Code#define DELBA_REASONCODE_QSTA_LEAVING 36#define DELBA_REASONCODE_END_BA 37#define DELBA_REASONCODE_UNKNOWN_BA 38#define DELBA_REASONCODE_TIMEOUT 39//// 802.11 frame formats//// HT Capability INFO field in HT Cap IE . typedef struct PACKED {#ifdef BIG_ENDIAN USHORT LSIGTxopProSup:1; USHORT Forty_Mhz_Intolerant:1; USHORT PSMP:1; USHORT CCKmodein40:1; USHORT AMsduSize:1; USHORT DelayedBA:1; //rt2860c not support USHORT RxSTBC:2; USHORT TxSTBC:1; USHORT ShortGIfor40:1; //for40MHz USHORT ShortGIfor20:1; USHORT GF:1; //green field USHORT MimoPs:2;//momi power safe USHORT ChannelWidth:1; USHORT AdvCoding:1;#else USHORT AdvCoding:1; USHORT ChannelWidth:1; USHORT MimoPs:2;//momi power safe USHORT GF:1; //green field USHORT ShortGIfor20:1; USHORT ShortGIfor40:1; //for40MHz USHORT TxSTBC:1; USHORT RxSTBC:2; USHORT DelayedBA:1; //rt2860c not support USHORT AMsduSize:1; // only support as zero USHORT CCKmodein40:1; USHORT PSMP:1; USHORT Forty_Mhz_Intolerant:1; USHORT LSIGTxopProSup:1;#endif /* !BIG_ENDIAN */} HT_CAP_INFO, *PHT_CAP_INFO;// HT Capability INFO field in HT Cap IE . typedef struct PACKED {#ifdef BIG_ENDIAN UCHAR rsv:3;//momi power safe UCHAR MpduDensity:3; UCHAR MaxRAmpduFactor:2;#else UCHAR MaxRAmpduFactor:2; UCHAR MpduDensity:3; UCHAR rsv:3;//momi power safe#endif /* !BIG_ENDIAN */} HT_CAP_PARM, *PHT_CAP_PARM;// HT Capability INFO field in HT Cap IE . typedef struct PACKED {#ifdef BIG_ENDIAN USHORT rsv2:4; USHORT RDGSupport:1; //reverse Direction Grant support USHORT PlusHTC:1; //+HTC control field support USHORT MCSFeedback:2; //0:no MCS feedback, 2:unsolicited MCS feedback, 3:Full MCS feedback, 1:rsv. USHORT rsv:5;//momi power safe USHORT TranTime:2; USHORT Pco:1;#else USHORT Pco:1; USHORT TranTime:2; USHORT rsv:5;//momi power safe USHORT MCSFeedback:2; //0:no MCS feedback, 2:unsolicited MCS feedback, 3:Full MCS feedback, 1:rsv. USHORT PlusHTC:1; //+HTC control field support USHORT RDGSupport:1; //reverse Direction Grant support USHORT rsv2:4;#endif /* BIG_ENDIAN */} EXT_HT_CAP_INFO, *PEXT_HT_CAP_INFO;// Draft 1.0 set IE length 26, but is extensible..#define SIZE_HT_CAP_IE 26// The structure for HT Capability IE.typedef struct PACKED { HT_CAP_INFO HtCapInfo; HT_CAP_PARM HtCapParm; UCHAR MCSSet[16]; EXT_HT_CAP_INFO ExtHtCapInfo; UCHAR TxBFCap[4]; // beamforming cap. rt2860c not support beamforming. UCHAR ASCap; //antenna selection.} HT_CAPABILITY_IE, *PHT_CAPABILITY_IE;//This structure substracts ralink supports from all 802.11n-related features.//Features not listed here but contained in 802.11n spec are not supported in rt2860.typedef struct { BOOLEAN bHtEnable; // If we should use ht rate. BOOLEAN bPreNHt; // If we should use ht rate. //Substract from HT Capability IE UCHAR MCSSet[16]; //only supoort MCS=0-15,32 , #ifdef BIG_ENDIAN USHORT rsv:5; USHORT AmsduSize:1; // Max receiving A-MSDU size USHORT AmsduEnable:1; // Enable to transmit A-MSDU. Suggest disable. We should use A-MPDU to gain best benifit of 802.11n USHORT RxSTBC:2; // 2 bits USHORT TxSTBC:1; USHORT ShortGIfor40:1; //for40MHz USHORT ShortGIfor20:1; USHORT GF:1; //green field USHORT MimoPs:2;//mimo power safe MMPS_ USHORT ChannelWidth:1;#else USHORT ChannelWidth:1; USHORT MimoPs:2;//mimo power safe MMPS_ USHORT GF:1; //green field USHORT ShortGIfor20:1; USHORT ShortGIfor40:1; //for40MHz USHORT TxSTBC:1; USHORT RxSTBC:2; // 2 bits USHORT AmsduEnable:1; // Enable to transmit A-MSDU. Suggest disable. We should use A-MPDU to gain best benifit of 802.11n USHORT AmsduSize:1; // Max receiving A-MSDU size USHORT rsv:5;#endif //Substract from Addiont HT INFO IE#ifdef BIG_ENDIAN UCHAR RecomWidth:1; UCHAR ExtChanOffset:2; // Please not the difference with following UCHAR NewExtChannelOffset; from 802.11n UCHAR MpduDensity:3; UCHAR MaxRAmpduFactor:2;#else UCHAR MaxRAmpduFactor:2; UCHAR MpduDensity:3; UCHAR ExtChanOffset:2; // Please not the difference with following UCHAR NewExtChannelOffset; from 802.11n UCHAR RecomWidth:1;#endif#ifdef BIG_ENDIAN USHORT rsv2:11; USHORT OBSSNonHT:1; USHORT TransmitBustLimit:1; USHORT NonGfPresent:1; USHORT OperaionMode:2;#else USHORT OperaionMode:2; USHORT NonGfPresent:1; USHORT TransmitBustLimit:1; USHORT OBSSNonHT:1; USHORT rsv2:11;#endif // New Extension Channel Offset IE UCHAR NewExtChannelOffset; } RT_HT_CAPABILITY, *PRT_HT_CAPABILITY;// field in Addtional HT Information IE . typedef struct PACKED {#ifdef BIG_ENDIAN UCHAR SerInterGranu:3; //service interval granularity UCHAR CntlAccOnly:1; //controlled access only UCHAR RifsMode:1; UCHAR RecomWidth:1; UCHAR ExtChanOffset:2;#else UCHAR ExtChanOffset:2; UCHAR RecomWidth:1; UCHAR RifsMode:1; UCHAR CntlAccOnly:1; //controlled access only UCHAR SerInterGranu:3; //service interval granularity#endif} ADD_HTINFO, *PADD_HTINFO;typedef struct PACKED{#ifdef BIG_ENDIAN USHORT rsv:11; USHORT OBSSNonHT:1; USHORT TransmitBustLimit:1; USHORT NonGfPresent:1; USHORT OperaionMode:2; #else USHORT OperaionMode:2; USHORT NonGfPresent:1; USHORT TransmitBustLimit:1; USHORT OBSSNonHT:1; USHORT rsv:11; #endif} ADD_HTINFO2, *PADD_HTINFO2;typedef struct PACKED{#ifdef BIG_ENDIAN USHORT rsv:4; USHORT PcoPhase:1; USHORT PcoActive:1; USHORT LsigTxopProtFull:1; // L-SIG TXOP protection full support USHORT SecondBeacon:1; USHORT DualStbcProtect:1; USHORT StbcMcs:7;#else USHORT StbcMcs:7; USHORT DualStbcProtect:1; USHORT SecondBeacon:1; USHORT LsigTxopProtFull:1; // L-SIG TXOP protection full support USHORT PcoActive:1; USHORT PcoPhase:1; USHORT rsv:4; #endif} ADD_HTINFO3, *PADD_HTINFO3;#define SIZE_ADD_HT_INFO_IE 22typedef struct PACKED{ UCHAR ControlChan; ADD_HTINFO AddHtInfo; ADD_HTINFO2 AddHtInfo2; ADD_HTINFO3 AddHtInfo3; UCHAR MCSSet[16];} ADD_HT_INFO_IE, *PADD_HT_INFO_IE;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -