Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux...
[linux-2.6] / drivers / staging / winbond / sme_s.h
1 //
2 // SME_S.H -
3 // SME task global CONSTANTS, STRUCTURES, variables
4 //
5
6 //////////////////////////////////////////////////////////////////////////
7 //define the msg type of SME module
8 // 0x00~0x1F : MSG from GUI dispatch
9 // 0x20~0x3F : MSG from MLME
10 // 0x40~0x5F : MSG from SCAN
11 // 0x60~0x6F : MSG from TX/RX
12 // 0x70~0x7F : MSG from ROAMING
13 // 0x80~0x8F : MSG from ISR
14 // 0x90          : MSG TimeOut
15
16 // from GUI
17 #define SMEMSG_SCAN_REQ                                 0x01
18 //#define SMEMSG_PASSIVE_SCAN_REQ                       0x02
19 #define SMEMSG_JOIN_REQ                                 0x03
20 #define SMEMSG_START_IBSS                               0x04
21 #define SMEMSG_DISCONNECT_REQ                   0x05
22 #define SMEMSG_AUTHEN_REQ                               0x06
23 #define SMEMSG_DEAUTHEN_REQ                             0x07
24 #define SMEMSG_ASSOC_REQ                                0x08
25 #define SMEMSG_REASSOC_REQ                              0x09
26 #define SMEMSG_DISASSOC_REQ                             0x0a
27 #define SMEMSG_POWERSAVE_REQ                    0x0b
28
29
30 // from MLME
31 #define SMEMSG_AUTHEN_CFM                               0x21
32 #define SMEMSG_AUTHEN_IND                               0x22
33 #define SMEMSG_ASSOC_CFM                                0x23
34 #define SMEMSG_DEAUTHEN_IND                             0x24
35 #define SMEMSG_DISASSOC_IND                             0x25
36 // from SCAN
37 #define SMEMSG_SCAN_CFM                                 0x41
38 #define SMEMSG_START_IBSS_CFM                   0x42
39 // from MTO, function call to set SME parameters
40
41 // 0x60~0x6F : MSG from TX/RX
42 //#define SMEMSG_IBSS_JOIN_UPDATE_BSSID 0x61
43 #define SMEMSG_COUNTERMEASURE_MICFAIL_TIMEOUT           0x62
44 #define SMEMSG_COUNTERMEASURE_BLOCK_TIMEOUT     0x63
45 // from ROAMING
46 #define SMEMSG_HANDOVER_JOIN_REQ                0x71
47 #define SMEMSG_END_ROAMING                              0x72
48 #define SMEMSG_SCAN_JOIN_REQ                    0x73
49 // from ISR
50 #define SMEMSG_TSF_SYNC_IND                             0x81
51 // from TimeOut
52 #define SMEMSG_TIMEOUT                                  0x91
53
54
55
56 #define MAX_PMKID_Accunt                16
57 //@added by ws 04/22/05
58 #define Cipher_Disabled                 0
59 #define Cipher_Wep                      1
60 #define Cipher_Tkip                     2
61 #define Cipher_Ccmp                     4
62
63
64 ///////////////////////////////////////////////////////////////////////////
65 //Constants
66
67 ///////////////////////////////////////////////////////////////////////////
68 //Global data structures
69
70 #define NUMOFWEPENTRIES     64
71
72 typedef enum _WEPKeyMode
73 {
74     WEPKEY_DISABLED = 0,
75     WEPKEY_64       = 1,
76     WEPKEY_128      = 2
77
78 } WEPKEYMODE, *pWEPKEYMODE;
79
80 #ifdef _WPA2_
81
82 typedef struct _BSSInfo
83 {
84   u8        PreAuthBssID[6];
85   PMKID        pmkid_value;
86 }BSSID_Info;
87
88 typedef struct _PMKID_Table //added by ws 05/05/04
89 {
90    u32  Length;
91    u32  BSSIDInfoCount;
92    BSSID_Info BSSIDInfo[16];
93
94 } PMKID_Table;
95
96 #endif //end def _WPA2_
97
98 #define MAX_BASIC_RATE_SET          15
99 #define MAX_OPT_RATE_SET            MAX_BASIC_RATE_SET
100
101
102 typedef struct _SME_PARAMETERS
103 {
104     u16                         wState;
105         u8                              boDUTmode;
106         u8                              bDesiredPowerSave;
107
108         // SME timer and timeout value
109         //NDIS_MINIPORT_TIMER   nTimer;
110         OS_TIMER                        nTimer;
111
112         u8                              boInTimerHandler;
113         u8                              boAuthRetryActive;
114         u8                              reserved_0[2];
115
116         u32                             AuthenRetryTimerVal;    // NOTE: Assoc don't fail timeout
117         u32                             JoinFailTimerVal;               // 10*Beacon-Interval
118
119         //Rates
120         u8                              BSSBasicRateSet[(MAX_BASIC_RATE_SET + 3) & ~0x03 ];    // BSS basic rate set
121         u8                              OperationalRateSet[(MAX_OPT_RATE_SET + 3) & ~0x03 ]; // Operational rate set
122
123         u8                              NumOfBSSBasicRate;
124         u8                              NumOfOperationalRate;
125         u8                              reserved_1[2];
126
127         u32                             BasicRateBitmap;
128         u32                             OpRateBitmap;
129
130         // System parameters Set by GUI
131         //-------------------- start IBSS parameter ---------------------------//
132         u32                             boStartIBSS;                    //Start IBSS toggle
133
134         u16                             wBeaconPeriod;
135         u16                             wATIM_Window;
136
137         ChanInfo                        IbssChan; // 2B //channel setting when start IBSS
138         u8                              reserved_2[2];
139
140     // Join related
141         u16                             wDesiredJoinBSS;                // BSS index which desire to join
142         u8                              boJoinReq;                              //Join request toggle
143         u8                              bDesiredBSSType;                //for Join request
144
145     u16                         wCapabilityInfo;        // Used when invoking the MLME_Associate_request().
146         u16                             wNonERPcapabilityInfo;
147
148     struct SSID_Element sDesiredSSID; // 34 B
149         u8                              reserved_3[2];
150
151         u8                      abDesiredBSSID[MAC_ADDR_LENGTH + 2];
152
153         u8                              bJoinScanCount;                 // the time of scan-join action need to do
154         u8                              bDesiredAuthMode;       // AUTH_OPEN_SYSTEM or AUTH_SHARED_KEY
155         u8                              reserved_4[2];
156
157     // Encryption parameters
158         u8                      _dot11PrivacyInvoked;
159     u8                  _dot11PrivacyOptionImplemented;
160         u8                              reserved_5[2];
161
162     //@ ws added
163     u8                          DesiredEncrypt;
164         u8                              encrypt_status; //ENCRYPT_DISABLE, ENCRYPT_WEP, ENCRYPT_WEP_NOKEY, ENCRYPT_TKIP, ...
165         u8                              key_length;
166         u8                              pairwise_key_ok;
167
168         u8                              group_key_ok;
169     u8                          wpa_ok;             // indicate the control port of 802.1x is open or close
170         u8                              pairwise_key_type;
171         u8                              group_key_type;
172
173     u32               _dot11WEPDefaultKeyID;
174
175         u8                      tx_mic_key[8];      // TODO: 0627 kevin-TKIP
176         u8                      rx_mic_key[8];      // TODO: 0627 kevin-TKIP
177         u8                              group_tx_mic_key[8];
178         u8                              group_rx_mic_key[8];
179
180 //      #ifdef _WPA_
181         u8                              AssocReqVarIE[200];
182         u8                              AssocRespVarIE[200];
183
184         u16                             AssocReqVarLen;
185         u16                             AssocRespVarLen;
186         u8                              boReassoc;                              //use assoc. or reassoc.
187         u8                              reserved_6[3];
188         u16                             AssocRespCapability;
189         u16                             AssocRespStatus;
190 //      #endif
191
192         #ifdef _WPA2_
193     u8               PmkIdTable[256];
194     u32               PmkidTableIndex;
195         #endif //end def _WPA2_
196
197 } SME_PARAMETERS, *PSME_PARAMETERS;
198
199 #define psSME                   (&(Adapter->sSmePara))
200
201 #define wSMEGetCurrentSTAState(Adapter)         ((u16)(Adapter)->sSmePara.wState)
202
203
204
205 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
206 //      SmeModule.h
207 //              Define the related definitions of SME module
208 //      history -- 01/14/03' created
209 //
210 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
211
212 //Define the state of SME module
213 #define DISABLED                                                0
214 #define INIT_SCAN                                               1
215 #define SCAN_READY                                              2
216 #define START_IBSS                                              3
217 #define JOIN_PENDING                                    4
218 #define JOIN_CFM                                                5
219 #define AUTHENTICATE_PENDING                    6
220 #define AUTHENTICATED                                   7
221 #define CONNECTED                                               8
222 //#define EAP_STARTING                                  9
223 //#define EAPOL_AUTHEN_PENDING                  10
224 //#define SECURE_CONNECTED                              11
225
226
227 // Static function
228