1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29#ifndef __IOCMD_H__
30#define __IOCMD_H__
31
32
33#define MAGIC_CODE 0x3142
34#define IOCTL_CMD_TEST (SIOCDEVPRIVATE + 0)
35#define IOCTL_CMD_SET (SIOCDEVPRIVATE + 1)
36#define IOCTL_CMD_HOSTAPD (SIOCDEVPRIVATE + 2)
37#define IOCTL_CMD_WPA (SIOCDEVPRIVATE + 3)
38
39typedef enum tagWMAC_CMD {
40
41 WLAN_CMD_BSS_SCAN,
42 WLAN_CMD_BSS_JOIN,
43 WLAN_CMD_DISASSOC,
44 WLAN_CMD_SET_WEP,
45 WLAN_CMD_GET_LINK,
46 WLAN_CMD_GET_LISTLEN,
47 WLAN_CMD_GET_LIST,
48 WLAN_CMD_GET_MIB,
49 WLAN_CMD_GET_STAT,
50 WLAN_CMD_STOP_MAC,
51 WLAN_CMD_START_MAC,
52 WLAN_CMD_AP_START,
53 WLAN_CMD_SET_HOSTAPD,
54 WLAN_CMD_SET_HOSTAPD_STA,
55 WLAN_CMD_SET_802_1X,
56 WLAN_CMD_SET_HOST_WEP,
57 WLAN_CMD_SET_WPA,
58 WLAN_CMD_GET_NODE_CNT,
59 WLAN_CMD_ZONETYPE_SET,
60 WLAN_CMD_GET_NODE_LIST
61
62} WMAC_CMD, *PWMAC_CMD;
63
64typedef enum tagWZONETYPE {
65 ZoneType_USA = 0,
66 ZoneType_Japan = 1,
67 ZoneType_Europe = 2
68} WZONETYPE;
69
70#define ADHOC 0
71#define INFRA 1
72#define BOTH 2
73#define AP 3
74
75#define ADHOC_STARTED 1
76#define ADHOC_JOINTED 2
77
78#define PHY80211a 0
79#define PHY80211b 1
80#define PHY80211g 2
81
82#define SSID_ID 0
83#define SSID_MAXLEN 32
84#define BSSID_LEN 6
85#define WEP_NKEYS 4
86#define WEP_KEYMAXLEN 29
87#define WEP_40BIT_LEN 5
88#define WEP_104BIT_LEN 13
89#define WEP_232BIT_LEN 16
90
91
92
93
94typedef struct tagSCmdRequest {
95 u8 name[16];
96 void *data;
97 u16 wResult;
98 u16 wCmdCode;
99} __packed SCmdRequest, *PSCmdRequest;
100
101
102
103
104
105typedef struct tagSCmdScan {
106
107 u8 ssid[SSID_MAXLEN + 2];
108
109} __packed SCmdScan, *PSCmdScan;
110
111
112
113
114
115typedef struct tagSCmdBSSJoin {
116
117 u16 wBSSType;
118 u16 wBBPType;
119 u8 ssid[SSID_MAXLEN + 2];
120 u32 uChannel;
121 bool bPSEnable;
122 bool bShareKeyAuth;
123
124} __packed SCmdBSSJoin, *PSCmdBSSJoin;
125
126
127
128
129
130typedef struct tagSCmdZoneTypeSet {
131
132 bool bWrite;
133 WZONETYPE ZoneType;
134
135} __packed SCmdZoneTypeSet, *PSCmdZoneTypeSet;
136
137typedef struct tagSWPAResult {
138 char ifname[100];
139 u8 proto;
140 u8 key_mgmt;
141 u8 eap_type;
142 bool authenticated;
143} __packed SWPAResult, *PSWPAResult;
144
145typedef struct tagSCmdStartAP {
146
147 u16 wBSSType;
148 u16 wBBPType;
149 u8 ssid[SSID_MAXLEN + 2];
150 u32 uChannel;
151 u32 uBeaconInt;
152 bool bShareKeyAuth;
153 u8 byBasicRate;
154
155} __packed SCmdStartAP, *PSCmdStartAP;
156
157typedef struct tagSCmdSetWEP {
158
159 bool bEnableWep;
160 u8 byKeyIndex;
161 u8 abyWepKey[WEP_NKEYS][WEP_KEYMAXLEN];
162 bool bWepKeyAvailable[WEP_NKEYS];
163 u32 auWepKeyLength[WEP_NKEYS];
164
165} __packed SCmdSetWEP, *PSCmdSetWEP;
166
167typedef struct tagSBSSIDItem {
168
169 u32 uChannel;
170 u8 abyBSSID[BSSID_LEN];
171 u8 abySSID[SSID_MAXLEN + 1];
172 u16 wBeaconInterval;
173 u16 wCapInfo;
174 u8 byNetType;
175 bool bWEPOn;
176 u32 uRSSI;
177
178} __packed SBSSIDItem;
179
180typedef struct tagSBSSIDList {
181
182 u32 uItem;
183 SBSSIDItem sBSSIDList[0];
184} __packed SBSSIDList, *PSBSSIDList;
185
186typedef struct tagSNodeItem {
187
188 u16 wAID;
189 u8 abyMACAddr[6];
190 u16 wTxDataRate;
191 u16 wInActiveCount;
192 u16 wEnQueueCnt;
193 u16 wFlags;
194 bool bPWBitOn;
195 u8 byKeyIndex;
196 u16 wWepKeyLength;
197 u8 abyWepKey[WEP_KEYMAXLEN];
198
199 bool bIsInFallback;
200 u32 uTxFailures;
201 u32 uTxAttempts;
202 u16 wFailureRatio;
203
204} __packed SNodeItem;
205
206typedef struct tagSNodeList {
207
208 u32 uItem;
209 SNodeItem sNodeList[0];
210
211} __packed SNodeList, *PSNodeList;
212
213typedef struct tagSCmdLinkStatus {
214
215 bool bLink;
216 u16 wBSSType;
217 u8 byState;
218 u8 abyBSSID[BSSID_LEN];
219 u8 abySSID[SSID_MAXLEN + 2];
220 u32 uChannel;
221 u32 uLinkRate;
222
223} __packed SCmdLinkStatus, *PSCmdLinkStatus;
224
225
226
227
228typedef struct tagSDot11MIBCount {
229 u32 TransmittedFragmentCount;
230 u32 MulticastTransmittedFrameCount;
231 u32 FailedCount;
232 u32 RetryCount;
233 u32 MultipleRetryCount;
234 u32 RTSSuccessCount;
235 u32 RTSFailureCount;
236 u32 ACKFailureCount;
237 u32 FrameDuplicateCount;
238 u32 ReceivedFragmentCount;
239 u32 MulticastReceivedFrameCount;
240 u32 FCSErrorCount;
241} __packed SDot11MIBCount, *PSDot11MIBCount;
242
243
244
245
246typedef struct tagSStatMIBCount {
247
248
249
250 u32 dwIsrTx0OK;
251 u32 dwIsrTx1OK;
252 u32 dwIsrBeaconTxOK;
253 u32 dwIsrRxOK;
254 u32 dwIsrTBTTInt;
255 u32 dwIsrSTIMERInt;
256 u32 dwIsrUnrecoverableError;
257 u32 dwIsrSoftInterrupt;
258 u32 dwIsrRxNoBuf;
259
260
261 u32 dwIsrUnknown;
262
263
264
265 u32 dwRsrFrmAlgnErr;
266 u32 dwRsrErr;
267 u32 dwRsrCRCErr;
268 u32 dwRsrCRCOk;
269 u32 dwRsrBSSIDOk;
270 u32 dwRsrADDROk;
271 u32 dwRsrICVOk;
272 u32 dwNewRsrShortPreamble;
273 u32 dwRsrLong;
274 u32 dwRsrRunt;
275
276 u32 dwRsrRxControl;
277 u32 dwRsrRxData;
278 u32 dwRsrRxManage;
279
280 u32 dwRsrRxPacket;
281 u32 dwRsrRxOctet;
282 u32 dwRsrBroadcast;
283 u32 dwRsrMulticast;
284 u32 dwRsrDirected;
285
286 u32 ullRsrOK;
287
288
289 u32 ullRxBroadcastBytes;
290 u32 ullRxMulticastBytes;
291 u32 ullRxDirectedBytes;
292 u32 ullRxBroadcastFrames;
293 u32 ullRxMulticastFrames;
294 u32 ullRxDirectedFrames;
295
296 u32 dwRsrRxFragment;
297 u32 dwRsrRxFrmLen64;
298 u32 dwRsrRxFrmLen65_127;
299 u32 dwRsrRxFrmLen128_255;
300 u32 dwRsrRxFrmLen256_511;
301 u32 dwRsrRxFrmLen512_1023;
302 u32 dwRsrRxFrmLen1024_1518;
303
304
305
306 u32 dwTsrTotalRetry[2];
307 u32 dwTsrOnceRetry[2];
308 u32 dwTsrMoreThanOnceRetry[2];
309 u32 dwTsrRetry[2];
310
311
312 u32 dwTsrACKData[2];
313 u32 dwTsrErr[2];
314 u32 dwAllTsrOK[2];
315 u32 dwTsrRetryTimeout[2];
316 u32 dwTsrTransmitTimeout[2];
317
318 u32 dwTsrTxPacket[2];
319 u32 dwTsrTxOctet[2];
320 u32 dwTsrBroadcast[2];
321 u32 dwTsrMulticast[2];
322 u32 dwTsrDirected[2];
323
324
325 u32 dwCntRxFrmLength;
326 u32 dwCntTxBufLength;
327
328 u8 abyCntRxPattern[16];
329 u8 abyCntTxPattern[16];
330
331
332 u32 dwCntRxDataErr;
333 u32 dwCntDecryptErr;
334 u32 dwCntRxICVErr;
335 u32 idxRxErrorDesc;
336
337
338 u32 ullTsrOK[2];
339
340
341 u32 ullTxBroadcastFrames[2];
342 u32 ullTxMulticastFrames[2];
343 u32 ullTxDirectedFrames[2];
344 u32 ullTxBroadcastBytes[2];
345 u32 ullTxMulticastBytes[2];
346 u32 ullTxDirectedBytes[2];
347} __packed SStatMIBCount, *PSStatMIBCount;
348
349typedef struct tagSCmdValue {
350
351 u32 dwValue;
352
353} __packed SCmdValue, *PSCmdValue;
354
355
356
357
358
359
360enum {
361 VIAWGET_HOSTAPD_FLUSH = 1,
362 VIAWGET_HOSTAPD_ADD_STA = 2,
363 VIAWGET_HOSTAPD_REMOVE_STA = 3,
364 VIAWGET_HOSTAPD_GET_INFO_STA = 4,
365 VIAWGET_HOSTAPD_SET_ENCRYPTION = 5,
366 VIAWGET_HOSTAPD_GET_ENCRYPTION = 6,
367 VIAWGET_HOSTAPD_SET_FLAGS_STA = 7,
368 VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR = 8,
369 VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT = 9,
370 VIAWGET_HOSTAPD_MLME = 10,
371 VIAWGET_HOSTAPD_SCAN_REQ = 11,
372 VIAWGET_HOSTAPD_STA_CLEAR_STATS = 12,
373};
374
375#define VIAWGET_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \
376((int) (&((struct viawget_hostapd_param *) 0)->u.generic_elem.data))
377
378
379
380struct viawget_hostapd_param {
381 u32 cmd;
382 u8 sta_addr[6];
383 union {
384 struct {
385 u16 aid;
386 u16 capability;
387 u8 tx_supp_rates;
388 } add_sta;
389 struct {
390 u32 inactive_sec;
391 } get_info_sta;
392 struct {
393 u8 alg;
394 u32 flags;
395 u32 err;
396 u8 idx;
397 u8 seq[8];
398 u16 key_len;
399 u8 key[0];
400 } crypt;
401 struct {
402 u32 flags_and;
403 u32 flags_or;
404 } set_flags_sta;
405 struct {
406 u16 rid;
407 u16 len;
408 u8 data[0];
409 } rid;
410 struct {
411 u8 len;
412 u8 data[0];
413 } generic_elem;
414 struct {
415 u16 cmd;
416 u16 reason_code;
417 } mlme;
418 struct {
419 u8 ssid_len;
420 u8 ssid[32];
421 } scan_req;
422 } u;
423} __packed;
424
425#endif
426