166252c3a27d2392e0901e220157510450bd6c2a1Forest Bond/*
266252c3a27d2392e0901e220157510450bd6c2a1Forest Bond * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
366252c3a27d2392e0901e220157510450bd6c2a1Forest Bond * All rights reserved.
466252c3a27d2392e0901e220157510450bd6c2a1Forest Bond *
566252c3a27d2392e0901e220157510450bd6c2a1Forest Bond * This program is free software; you can redistribute it and/or modify
666252c3a27d2392e0901e220157510450bd6c2a1Forest Bond * it under the terms of the GNU General Public License as published by
766252c3a27d2392e0901e220157510450bd6c2a1Forest Bond * the Free Software Foundation; either version 2 of the License, or
866252c3a27d2392e0901e220157510450bd6c2a1Forest Bond * (at your option) any later version.
966252c3a27d2392e0901e220157510450bd6c2a1Forest Bond *
1066252c3a27d2392e0901e220157510450bd6c2a1Forest Bond * This program is distributed in the hope that it will be useful,
1166252c3a27d2392e0901e220157510450bd6c2a1Forest Bond * but WITHOUT ANY WARRANTY; without even the implied warranty of
1266252c3a27d2392e0901e220157510450bd6c2a1Forest Bond * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1366252c3a27d2392e0901e220157510450bd6c2a1Forest Bond * GNU General Public License for more details.
1466252c3a27d2392e0901e220157510450bd6c2a1Forest Bond *
1566252c3a27d2392e0901e220157510450bd6c2a1Forest Bond * You should have received a copy of the GNU General Public License along
1666252c3a27d2392e0901e220157510450bd6c2a1Forest Bond * with this program; if not, write to the Free Software Foundation, Inc.,
1766252c3a27d2392e0901e220157510450bd6c2a1Forest Bond * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1866252c3a27d2392e0901e220157510450bd6c2a1Forest Bond *
1966252c3a27d2392e0901e220157510450bd6c2a1Forest Bond * File: iowpa.h
2066252c3a27d2392e0901e220157510450bd6c2a1Forest Bond *
2166252c3a27d2392e0901e220157510450bd6c2a1Forest Bond * Purpose: Handles wpa supplicant ioctl interface
2266252c3a27d2392e0901e220157510450bd6c2a1Forest Bond *
2366252c3a27d2392e0901e220157510450bd6c2a1Forest Bond * Author: Lyndon Chen
2466252c3a27d2392e0901e220157510450bd6c2a1Forest Bond *
2566252c3a27d2392e0901e220157510450bd6c2a1Forest Bond * Date: May 8, 2002
2666252c3a27d2392e0901e220157510450bd6c2a1Forest Bond *
2766252c3a27d2392e0901e220157510450bd6c2a1Forest Bond */
2866252c3a27d2392e0901e220157510450bd6c2a1Forest Bond
2966252c3a27d2392e0901e220157510450bd6c2a1Forest Bond#ifndef __IOWPA_H__
3066252c3a27d2392e0901e220157510450bd6c2a1Forest Bond#define __IOWPA_H__
3166252c3a27d2392e0901e220157510450bd6c2a1Forest Bond
3266252c3a27d2392e0901e220157510450bd6c2a1Forest Bond/*---------------------  Export Definitions -------------------------*/
3366252c3a27d2392e0901e220157510450bd6c2a1Forest Bond
3466252c3a27d2392e0901e220157510450bd6c2a1Forest Bond#define WPA_IE_LEN 64
3566252c3a27d2392e0901e220157510450bd6c2a1Forest Bond
3666252c3a27d2392e0901e220157510450bd6c2a1Forest Bond//WPA related
3766252c3a27d2392e0901e220157510450bd6c2a1Forest Bond/*
3866252c3a27d2392e0901e220157510450bd6c2a1Forest Bondtypedef enum { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP } wpa_alg;
3966252c3a27d2392e0901e220157510450bd6c2a1Forest Bondtypedef enum { CIPHER_NONE, CIPHER_WEP40, CIPHER_TKIP, CIPHER_CCMP,
4066252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	       CIPHER_WEP104 } wpa_cipher;
4166252c3a27d2392e0901e220157510450bd6c2a1Forest Bondtypedef enum { KEY_MGMT_802_1X, KEY_MGMT_PSK, KEY_MGMT_NONE,
4266252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	       KEY_MGMT_802_1X_NO_WPA, KEY_MGMT_WPA_NONE } wpa_key_mgmt;
4366252c3a27d2392e0901e220157510450bd6c2a1Forest Bond*/
4466252c3a27d2392e0901e220157510450bd6c2a1Forest Bond
4566252c3a27d2392e0901e220157510450bd6c2a1Forest Bondenum {
4666252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	VIAWGET_SET_WPA = 1,
4766252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	VIAWGET_SET_KEY = 2,
4866252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	VIAWGET_SET_SCAN = 3,
4966252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	VIAWGET_GET_SCAN = 4,
5066252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	VIAWGET_GET_SSID = 5,
5166252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	VIAWGET_GET_BSSID = 6,
5266252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	VIAWGET_SET_DROP_UNENCRYPT = 7,
5366252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	VIAWGET_SET_DEAUTHENTICATE = 8,
5466252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	VIAWGET_SET_ASSOCIATE = 9,
55d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More	VIAWGET_SET_DISASSOCIATE = 10
5666252c3a27d2392e0901e220157510450bd6c2a1Forest Bond};
5766252c3a27d2392e0901e220157510450bd6c2a1Forest Bond
5866252c3a27d2392e0901e220157510450bd6c2a1Forest Bond
5966252c3a27d2392e0901e220157510450bd6c2a1Forest Bondenum {
6066252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	VIAWGET_ASSOC_MSG = 1,
6166252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	VIAWGET_DISASSOC_MSG = 2,
6266252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	VIAWGET_PTK_MIC_MSG = 3,
6366252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	VIAWGET_GTK_MIC_MSG = 4,
6466252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	VIAWGET_CCKM_ROAM_MSG = 5,
6566252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	VIAWGET_DEVICECLOSE_MSG = 6
6666252c3a27d2392e0901e220157510450bd6c2a1Forest Bond};
6766252c3a27d2392e0901e220157510450bd6c2a1Forest Bond
6866252c3a27d2392e0901e220157510450bd6c2a1Forest Bond
6966252c3a27d2392e0901e220157510450bd6c2a1Forest Bond
7066252c3a27d2392e0901e220157510450bd6c2a1Forest Bond#pragma pack(1)
7166252c3a27d2392e0901e220157510450bd6c2a1Forest Bondtypedef struct viawget_wpa_header {
7266252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	u8 type;
7366252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	u16 req_ie_len;
7466252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	u16 resp_ie_len;
7566252c3a27d2392e0901e220157510450bd6c2a1Forest Bond} viawget_wpa_header;
7666252c3a27d2392e0901e220157510450bd6c2a1Forest Bond
7766252c3a27d2392e0901e220157510450bd6c2a1Forest Bondstruct viawget_wpa_param {
7866252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	u32 cmd;
7966252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	u8 addr[6];
8066252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	union {
8166252c3a27d2392e0901e220157510450bd6c2a1Forest Bond		struct {
8266252c3a27d2392e0901e220157510450bd6c2a1Forest Bond			u8 len;
8366252c3a27d2392e0901e220157510450bd6c2a1Forest Bond			u8 data[0];
8466252c3a27d2392e0901e220157510450bd6c2a1Forest Bond		} generic_elem;
8566252c3a27d2392e0901e220157510450bd6c2a1Forest Bond		struct {
86d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More			u8 bssid[6];
8766252c3a27d2392e0901e220157510450bd6c2a1Forest Bond			u8 ssid[32];
8866252c3a27d2392e0901e220157510450bd6c2a1Forest Bond			u8 ssid_len;
89d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More			u8 *wpa_ie;
90d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More			u16 wpa_ie_len;
91d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More			int pairwise_suite;
92d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More			int group_suite;
93d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More			int key_mgmt_suite;
94d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More			int auth_alg;
95d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More			int mode;
96d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More			u8 roam_dbm;
9766252c3a27d2392e0901e220157510450bd6c2a1Forest Bond		} wpa_associate;
9866252c3a27d2392e0901e220157510450bd6c2a1Forest Bond		struct {
99d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More			int alg_name;
100d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More			u16 key_index;
101d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More			u16 set_tx;
102d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More			u8 *seq;
103d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More			u16 seq_len;
104d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More			u8 *key;
105d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More			u16 key_len;
10666252c3a27d2392e0901e220157510450bd6c2a1Forest Bond		} wpa_key;
10766252c3a27d2392e0901e220157510450bd6c2a1Forest Bond		struct {
10866252c3a27d2392e0901e220157510450bd6c2a1Forest Bond			u8 ssid_len;
10966252c3a27d2392e0901e220157510450bd6c2a1Forest Bond			u8 ssid[32];
11066252c3a27d2392e0901e220157510450bd6c2a1Forest Bond		} scan_req;
11166252c3a27d2392e0901e220157510450bd6c2a1Forest Bond		struct {
11266252c3a27d2392e0901e220157510450bd6c2a1Forest Bond			u16 scan_count;
11366252c3a27d2392e0901e220157510450bd6c2a1Forest Bond			u8 *buf;
11466252c3a27d2392e0901e220157510450bd6c2a1Forest Bond		} scan_results;
11566252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	} u;
11666252c3a27d2392e0901e220157510450bd6c2a1Forest Bond};
11766252c3a27d2392e0901e220157510450bd6c2a1Forest Bond
11866252c3a27d2392e0901e220157510450bd6c2a1Forest Bond#pragma pack(1)
11966252c3a27d2392e0901e220157510450bd6c2a1Forest Bondstruct viawget_scan_result {
12066252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	u8 bssid[6];
12166252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	u8 ssid[32];
12266252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	u16 ssid_len;
12366252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	u8 wpa_ie[WPA_IE_LEN];
12466252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	u16 wpa_ie_len;
12566252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	u8 rsn_ie[WPA_IE_LEN];
12666252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	u16 rsn_ie_len;
12766252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	int freq; // MHz
12866252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	int caps; // e.g. privacy
12966252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	int qual; // signal quality
13066252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	int noise;
13166252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	int level;
13266252c3a27d2392e0901e220157510450bd6c2a1Forest Bond	int maxrate;
13366252c3a27d2392e0901e220157510450bd6c2a1Forest Bond};
13466252c3a27d2392e0901e220157510450bd6c2a1Forest Bond
13566252c3a27d2392e0901e220157510450bd6c2a1Forest Bond/*---------------------  Export Classes  ----------------------------*/
13666252c3a27d2392e0901e220157510450bd6c2a1Forest Bond
13766252c3a27d2392e0901e220157510450bd6c2a1Forest Bond/*---------------------  Export Variables  --------------------------*/
13866252c3a27d2392e0901e220157510450bd6c2a1Forest Bond
13966252c3a27d2392e0901e220157510450bd6c2a1Forest Bond/*---------------------  Export Types  ------------------------------*/
14066252c3a27d2392e0901e220157510450bd6c2a1Forest Bond
14166252c3a27d2392e0901e220157510450bd6c2a1Forest Bond/*---------------------  Export Functions  --------------------------*/
14266252c3a27d2392e0901e220157510450bd6c2a1Forest Bond
143e7b07d1d8936e06f88dbe227401ce659c2f9dee5Andres More#endif /* __IOWPA_H__ */
144