1 #ifndef __WLAN_BSSDEF_H__
2 #define __WLAN_BSSDEF_H__
3 
4 #define MAX_IE_SZ	768
5 
6 #define NDIS_802_11_LENGTH_SSID         32
7 #define NDIS_802_11_LENGTH_RATES        8
8 #define NDIS_802_11_LENGTH_RATES_EX     16
9 
10 /* Set of 8 data rates*/
11 typedef unsigned char   NDIS_802_11_RATES[NDIS_802_11_LENGTH_RATES];
12 /* Set of 16 data rates */
13 typedef unsigned char   NDIS_802_11_RATES_EX[NDIS_802_11_LENGTH_RATES_EX];
14 
15 struct ndis_802_11_ssid {
16   u32  SsidLength;
17   u8  Ssid[32];
18 };
19 
20 enum NDIS_802_11_NETWORK_TYPE {
21     Ndis802_11FH,
22     Ndis802_11DS,
23     Ndis802_11OFDM5,
24     Ndis802_11OFDM24,
25     Ndis802_11NetworkTypeMax    /* not a real type, defined as an upper bound */
26 };
27 
28 struct NDIS_802_11_CONFIGURATION_FH {
29     u32           Length;             /* Length of structure */
30     u32           HopPattern;         /* As defined by 802.11, MSB set */
31     u32           HopSet;             /* to one if non-802.11 */
32     u32           DwellTime;          /* units are Kusec */
33 };
34 
35 /*
36 	FW will only save the channel number in DSConfig.
37 	ODI Handler will convert the channel number to freq. number.
38 */
39 struct NDIS_802_11_CONFIGURATION {
40     u32           Length;             /* Length of structure */
41     u32           BeaconPeriod;       /* units are Kusec */
42     u32           ATIMWindow;         /* units are Kusec */
43     u32           DSConfig;           /* Frequency, units are kHz */
44     struct NDIS_802_11_CONFIGURATION_FH    FHConfig;
45 };
46 
47 enum NDIS_802_11_NETWORK_INFRASTRUCTURE {
48     Ndis802_11IBSS,
49     Ndis802_11Infrastructure,
50     Ndis802_11AutoUnknown,
51     Ndis802_11InfrastructureMax, /* Not a real value, defined as upper bound */
52     Ndis802_11APMode
53 };
54 
55 struct NDIS_802_11_FIXED_IEs {
56   u8  Timestamp[8];
57   u16  BeaconInterval;
58   u16  Capabilities;
59 };
60 
61 /*
62  * Length is the 4 bytes multiples of the sume of
63  * 6 * sizeof (unsigned char) + 2 + sizeof (ndis_802_11_ssid) + sizeof (u32)
64  * + sizeof (s32) + sizeof (NDIS_802_11_NETWORK_TYPE)
65  * + sizeof (struct NDIS_802_11_CONFIGURATION)
66  * + sizeof (NDIS_802_11_RATES_EX) + IELength
67 
68  * Except the IELength, all other fields are fixed length. Therefore, we can
69  * define a macro to present the partial sum.
70  */
71 
72 struct ndis_wlan_bssid_ex {
73   u32  Length;
74   unsigned char  MacAddress[6];
75   u8  Reserved[2];
76   struct ndis_802_11_ssid  Ssid;
77   u32  Privacy;
78   s32  Rssi;
79   enum NDIS_802_11_NETWORK_TYPE  NetworkTypeInUse;
80   struct NDIS_802_11_CONFIGURATION  Configuration;
81   enum NDIS_802_11_NETWORK_INFRASTRUCTURE  InfrastructureMode;
82   NDIS_802_11_RATES_EX  SupportedRates;
83   u32  IELength;
84 /*(timestamp, beacon interval, and capability information) */
85   u8  IEs[MAX_IE_SZ];
86 };
87 
88 enum NDIS_802_11_AUTHENTICATION_MODE {
89     Ndis802_11AuthModeOpen,
90     Ndis802_11AuthModeShared,
91     Ndis802_11AuthModeAutoSwitch,
92     Ndis802_11AuthModeWPA,
93     Ndis802_11AuthModeWPAPSK,
94     Ndis802_11AuthModeWPANone,
95     Ndis802_11AuthModeMax     /* Not a real mode, defined as upper bound */
96 };
97 
98 enum {
99     Ndis802_11WEPEnabled,
100     Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
101     Ndis802_11WEPDisabled,
102     Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
103     Ndis802_11WEPKeyAbsent,
104     Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
105     Ndis802_11WEPNotSupported,
106     Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
107     Ndis802_11Encryption2Enabled,
108     Ndis802_11Encryption2KeyAbsent,
109     Ndis802_11Encryption3Enabled,
110     Ndis802_11Encryption3KeyAbsent
111 };
112 
113 #define NDIS_802_11_AI_REQFI_CAPABILITIES      1
114 #define NDIS_802_11_AI_REQFI_LISTENINTERVAL    2
115 #define NDIS_802_11_AI_REQFI_CURRENTAPADDRESS  4
116 
117 #define NDIS_802_11_AI_RESFI_CAPABILITIES      1
118 #define NDIS_802_11_AI_RESFI_STATUSCODE        2
119 #define NDIS_802_11_AI_RESFI_ASSOCIATIONID     4
120 
121 struct NDIS_802_11_AI_REQFI {
122     u16 Capabilities;
123     u16 ListenInterval;
124     unsigned char CurrentAPAddress[6];
125 };
126 
127 struct NDIS_802_11_AI_RESFI {
128     u16 Capabilities;
129     u16 StatusCode;
130     u16 AssociationId;
131 };
132 
133 struct NDIS_802_11_ASSOCIATION_INFORMATION {
134     u32                   Length;
135     u16                  AvailableRequestFixedIEs;
136     struct NDIS_802_11_AI_REQFI    RequestFixedIEs;
137     u32                   RequestIELength;
138     u32                   OffsetRequestIEs;
139     u16                  AvailableResponseFixedIEs;
140     struct NDIS_802_11_AI_RESFI    ResponseFixedIEs;
141     u32                   ResponseIELength;
142     u32                   OffsetResponseIEs;
143 };
144 
145 /* Key mapping keys require a BSSID*/
146 struct NDIS_802_11_KEY {
147     u32           Length;             /* Length of this structure */
148     u32           KeyIndex;
149     u32           KeyLength;          /* length of key in bytes */
150     unsigned char BSSID[6];
151     unsigned long long KeyRSC;
152     u8           KeyMaterial[32];     /* variable length */
153 };
154 
155 struct NDIS_802_11_REMOVE_KEY {
156     u32                   Length;        /* Length of this structure */
157     u32                   KeyIndex;
158     unsigned char BSSID[6];
159 };
160 
161 struct NDIS_802_11_WEP {
162     u32     Length;        /* Length of this structure */
163     u32     KeyIndex;      /* 0 is the per-client key,
164 			      * 1-N are the global keys */
165     u32     KeyLength;     /* length of key in bytes */
166     u8     KeyMaterial[16];/* variable length depending on above field */
167 };
168 
169 /* mask for authentication/integrity fields */
170 #define NDIS_802_11_AUTH_REQUEST_AUTH_FIELDS        0x0f
171 #define NDIS_802_11_AUTH_REQUEST_REAUTH			0x01
172 #define NDIS_802_11_AUTH_REQUEST_KEYUPDATE		0x02
173 #define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR		0x06
174 #define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR		0x0E
175 
176 /* MIC check time, 60 seconds. */
177 #define MIC_CHECK_TIME	60000000
178 
179 #ifndef Ndis802_11APMode
180 #define Ndis802_11APMode (Ndis802_11InfrastructureMax+1)
181 #endif
182 
183 struct	wlan_network {
184 	struct list_head list;
185 	int	network_type;	/*refer to ieee80211.h for WIRELESS_11A/B/G */
186 	int	fixed;		/* set to fixed when not to be removed asi
187 				 * site-surveying */
188 	unsigned int	last_scanned; /*timestamp for the network */
189 	int	aid;		/*will only be valid when a BSS is joined. */
190 	int	join_res;
191 	struct ndis_wlan_bssid_ex network; /*must be the last item */
192 };
193 
194 enum VRTL_CARRIER_SENSE {
195     DISABLE_VCS,
196     ENABLE_VCS,
197     AUTO_VCS
198 };
199 
200 enum VCS_TYPE {
201     NONE_VCS,
202     RTS_CTS,
203     CTS_TO_SELF
204 };
205 
206 #define PWR_CAM 0
207 #define PWR_MINPS 1
208 #define PWR_MAXPS 2
209 #define PWR_UAPSD 3
210 #define PWR_VOIP 4
211 
212 enum UAPSD_MAX_SP {
213 	NO_LIMIT,
214        TWO_MSDU,
215        FOUR_MSDU,
216        SIX_MSDU
217 };
218 
219 #define NUM_PRE_AUTH_KEY 16
220 #define NUM_PMKID_CACHE NUM_PRE_AUTH_KEY
221 
222 /*
223  *	WPA2
224  */
225 struct wlan_bssid_ex {
226   u32  Length;
227   unsigned char  MacAddress[6];
228   u8  Reserved[2];
229   struct ndis_802_11_ssid  Ssid;
230   u32  Privacy;
231   s32  Rssi;
232   enum NDIS_802_11_NETWORK_TYPE  NetworkTypeInUse;
233   struct NDIS_802_11_CONFIGURATION  Configuration;
234   enum NDIS_802_11_NETWORK_INFRASTRUCTURE  InfrastructureMode;
235   NDIS_802_11_RATES_EX  SupportedRates;
236   u32  IELength;
237   u8  IEs[MAX_IE_SZ];	/* (timestamp, beacon interval, and capability
238 				 * information) */
239 };
240 
241 #endif /* #ifndef WLAN_BSSDEF_H_ */
242 
243