📄 mlme.h
字号:
/*************************************************************************** * RT2x00 SourceForge Project - http://rt2x00.serialmonkey.com * * * * 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. * * * * Licensed under the GNU GPL * * Original code supplied under license from RaLink Inc, 2004. * ***************************************************************************//*************************************************************************** * 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__#include "oid.h"// 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 1000 // 1 sec//#define TBTT_PRELOAD_TIME 384 // usec. LomgPreamble + 24-byte at 1Mbps#define BEACON_LOST_TIME (4*HZ) // 2048 msec = 2 sec#define AUTH_TIMEOUT 300 // unit: msec#define ASSOC_TIMEOUT 300 // unit: msec#define JOIN_TIMEOUT 2000 // 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 ACTIVE_SCAN_TIME 30 // Active scan waiting for probe response time#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#define CW_MAX_IN_BITS 10 // actual CwMax = 2^CW_MAX_IN_BITS - 1// 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) //((cqi) < 5)// weighting factor to calculate Channel quality, total should be 100%#define RSSI_WEIGHTING 50#define TX_WEIGHTING 30#define RX_WEIGHTING 20#define MAX_LEN_OF_BSS_TABLE 64#define BSS_NOT_FOUND 0xFFFFFFFF#define SCAN_PASSIVE 18#define SCAN_ACTIVE 19#define FAST_SCAN_ACTIVE 24 // scan with probe request, and wait beacon and probe response#define MAX_LEN_OF_MLME_QUEUE 20// 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//// 802.11 frame formats//// 2-byte QOS CONTROL fieldtypedef struct PACKED {#ifdef BIG_ENDIAN USHORT Txop_QueueSize:8; USHORT Rsv:1; USHORT AckPolicy:2; USHORT EOSP:1; USHORT TID:4;#else USHORT TID:4; USHORT EOSP:1; USHORT AckPolicy:2; USHORT Rsv:1; USHORT Txop_QueueSize:8;#endif} QOS_CONTROL, *PQOS_CONTROL;// 2-byte Frame control fieldtypedef struct PACKED {#ifdef BIG_ENDIAN USHORT Order:1; USHORT Wep:1; USHORT MoreData:1; USHORT PwrMgmt:1; USHORT Retry:1; USHORT MoreFrag:1; USHORT FrDs:1; USHORT ToDs:1; USHORT SubType:4; USHORT Type:2; USHORT Ver:2;#else USHORT Ver:2; // Protocol version USHORT Type:2; // MSDU type USHORT SubType:4; // MSDU subtype USHORT ToDs:1; // To DS indication USHORT FrDs:1; // From DS indication USHORT MoreFrag:1; // More fragment bit USHORT Retry:1; // Retry status bit USHORT PwrMgmt:1; // Power management bit USHORT MoreData:1; // More data bit USHORT Wep:1; // Wep data USHORT Order:1; // Strict order expected#endif} FRAME_CONTROL, *PFRAME_CONTROL;typedef struct PACKED _HEADER_802_11 { FRAME_CONTROL FC; USHORT Duration; UCHAR Addr1[MAC_ADDR_LEN]; UCHAR Addr2[MAC_ADDR_LEN]; UCHAR Addr3[MAC_ADDR_LEN];#ifdef BIG_ENDIAN USHORT Sequence:12; USHORT Frag:4;#else USHORT Frag:4; USHORT Sequence:12;#endif} HEADER_802_11, *PHEADER_802_11;typedef struct PACKED _FRAME_802_11 { HEADER_802_11 Hdr; CHAR Octet[1];} FRAME_802_11, *PFRAME_802_11;typedef struct _PSPOLL_FRAME { FRAME_CONTROL FC; USHORT Aid; UCHAR Bssid[MAC_ADDR_LEN]; UCHAR Ta[MAC_ADDR_LEN];} PSPOLL_FRAME, *PPSPOLL_FRAME;typedef struct PACKED _RTS_FRAME { FRAME_CONTROL FC; USHORT Duration; UCHAR Addr1[MAC_ADDR_LEN]; UCHAR Addr2[MAC_ADDR_LEN];} RTS_FRAME, *PRTS_FRAME;//// Contention-free parameter (without ID and Length)//typedef struct PACKED { BOOLEAN bValid; // 1: variable contains valid value UCHAR CfpCount; UCHAR CfpPeriod; USHORT CfpMaxDuration; USHORT CfpDurRemaining;} CF_PARM, *PCF_PARM;typedef struct _CIPHER_SUITE { NDIS_802_11_ENCRYPTION_STATUS PairCipher; // Unicast cipher 1, this one has more secured cipher suite NDIS_802_11_ENCRYPTION_STATUS PairCipherAux; // Unicast cipher 2 if AP announce two unicast cipher suite NDIS_802_11_ENCRYPTION_STATUS GroupCipher; // Group cipher USHORT RsnCapability; // RSN capability from beacon BOOLEAN bMixMode; // Indicate Pair & Group cipher might be different
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -