Commit | Line | Data |
---|---|---|
635d2b00 GKH |
1 | /* |
2 | ***************************************************************************** | |
3 | * | |
4 | * FILE : unifi_native.h | |
5 | * | |
6 | * PURPOSE : Private header file for unifi driver support to wireless extensions. | |
7 | * | |
8 | * UDI = UniFi Debug Interface | |
9 | * | |
10 | * Copyright (C) 2005-2008 by Cambridge Silicon Radio Ltd. | |
11 | * | |
12 | * Refer to LICENSE.txt included with this source code for details on | |
13 | * the license terms. | |
14 | * | |
15 | ***************************************************************************** | |
16 | */ | |
17 | #ifndef __LINUX_UNIFI_NATIVE_H__ | |
18 | #define __LINUX_UNIFI_NATIVE_H__ 1 | |
19 | ||
20 | #include <linux/kernel.h> | |
21 | #include <linux/if_arp.h> | |
22 | ||
23 | ||
24 | /* | |
25 | * scan.c wext.c autojoin.c | |
26 | */ | |
27 | /* Structure to hold results of a scan */ | |
28 | typedef struct scan_info { | |
29 | ||
30 | /* CSR_MLME_SCAN_INDICATION msi; */ | |
31 | ||
32 | unsigned char *info_elems; | |
33 | int info_elem_length; | |
34 | ||
35 | } scan_info_t; | |
36 | ||
37 | ||
38 | #define IE_VECTOR_MAXLEN 1024 | |
39 | ||
40 | #ifdef CSR_SUPPORT_WEXT | |
41 | /* | |
42 | * Structre to hold the wireless network configuration info. | |
43 | */ | |
44 | struct wext_config { | |
45 | ||
46 | /* Requested channel when setting up an adhoc network */ | |
47 | int channel; | |
48 | ||
49 | /* wireless extns mode: IW_MODE_AUTO, ADHOC, INFRA, MASTER ... MONITOR */ | |
50 | int mode; | |
51 | ||
52 | /* The capabilities of the currently joined network */ | |
53 | int capability; | |
54 | ||
55 | /* The interval between beacons if we create an IBSS */ | |
56 | int beacon_period; | |
57 | ||
58 | /* | |
59 | * Power-save parameters | |
60 | */ | |
61 | /* The listen interval to ask for in Associate req. */ | |
62 | int assoc_listen_interval; | |
63 | /* Power-mode to put UniFi into */ | |
64 | ||
65 | unsigned char desired_ssid[UNIFI_MAX_SSID_LEN]; /* the last ESSID set by SIOCSIWESSID */ | |
66 | int power_mode; | |
67 | /* Whether to wake for broadcast packets (using DTIM interval) */ | |
68 | int wakeup_for_dtims; | |
69 | ||
70 | /* Currently selected WEP Key ID (0..3) */ | |
71 | int wep_key_id; | |
72 | ||
73 | wep_key_t wep_keys[NUM_WEPKEYS]; | |
74 | ||
75 | /* CSR_AUTHENTICATION_TYPE auth_type; */ | |
76 | int privacy; | |
77 | ||
78 | u32 join_failure_timeout; | |
79 | u32 auth_failure_timeout; | |
80 | u32 assoc_failure_timeout; | |
81 | ||
82 | unsigned char generic_ie[IE_VECTOR_MAXLEN]; | |
83 | int generic_ie_len; | |
84 | ||
85 | struct iw_statistics wireless_stats; | |
86 | ||
87 | ||
88 | /* the ESSID we are currently associated to */ | |
89 | unsigned char current_ssid[UNIFI_MAX_SSID_LEN]; | |
90 | /* the BSSID we are currently associated to */ | |
91 | unsigned char current_bssid[6]; | |
92 | ||
93 | /* | |
94 | * IW_AUTH_WPA_VERSION_DISABLED 0x00000001 | |
95 | * IW_AUTH_WPA_VERSION_WPA 0x00000002 | |
96 | * IW_AUTH_WPA_VERSION_WPA2 0x00000004 | |
97 | */ | |
98 | unsigned char wpa_version; | |
99 | ||
100 | /* | |
101 | * cipher selection: | |
102 | * IW_AUTH_CIPHER_NONE 0x00000001 | |
103 | * IW_AUTH_CIPHER_WEP40 0x00000002 | |
104 | * IW_AUTH_CIPHER_TKIP 0x00000004 | |
105 | * IW_AUTH_CIPHER_CCMP 0x00000008 | |
106 | * IW_AUTH_CIPHER_WEP104 0x00000010 | |
107 | */ | |
108 | unsigned char pairwise_cipher_used; | |
109 | unsigned char group_cipher_used; | |
110 | ||
111 | unsigned int frag_thresh; | |
112 | unsigned int rts_thresh; | |
113 | ||
114 | /* U-APSD value, send with Association Request to WMM Enabled APs */ | |
115 | unsigned char wmm_bss_uapsd_mask; | |
116 | /* The WMM capabilities of the selected BSS */ | |
117 | unsigned int bss_wmm_capabilities; | |
118 | ||
119 | /* Flag to prevent a join when the ssid is set */ | |
120 | int disable_join_on_ssid_set; | |
121 | ||
122 | /* Scan info */ | |
123 | #define UNIFI_MAX_SCANS 32 | |
124 | scan_info_t scan_list[UNIFI_MAX_SCANS]; | |
125 | int num_scan_info; | |
126 | ||
127 | /* Flag on whether non-802.1x packets are allowed out */ | |
fa6173a0 | 128 | /* CsrWifiRouterPortAction block_controlled_port;*/ |
635d2b00 GKH |
129 | |
130 | /* Flag on whether we have completed an authenticate/associate process */ | |
131 | unsigned int flag_associated : 1; | |
132 | }; /* struct wext_config */ | |
133 | ||
134 | #endif /* CSR_SUPPORT_WEXT */ | |
135 | ||
136 | ||
137 | /* | |
138 | * wext.c | |
139 | */ | |
140 | /*int mlme_set_protection(unifi_priv_t *priv, unsigned char *addr, | |
141 | CSR_PROTECT_TYPE prot, CSR_KEY_TYPE key_type); | |
142 | */ | |
143 | ||
144 | /* | |
145 | * scan.c | |
146 | */ | |
147 | /* | |
148 | void unifi_scan_indication_handler(unifi_priv_t *priv, | |
149 | const CSR_MLME_SCAN_INDICATION *msg, | |
150 | const unsigned char *extra, | |
151 | unsigned int len); | |
152 | */ | |
153 | void unifi_clear_scan_table(unifi_priv_t *priv); | |
154 | scan_info_t *unifi_get_scan_report(unifi_priv_t *priv, int index); | |
155 | ||
156 | ||
157 | /* | |
158 | * Utility functions | |
159 | */ | |
160 | const unsigned char *unifi_find_info_element(int id, | |
161 | const unsigned char *info, | |
162 | int len); | |
163 | int unifi_add_info_element(unsigned char *info, | |
164 | int ie_id, | |
165 | const unsigned char *ie_data, | |
166 | int ie_len); | |
167 | ||
168 | /* | |
169 | * autojoin.c | |
170 | */ | |
171 | /* Higher level fns */ | |
172 | int unifi_autojoin(unifi_priv_t *priv, const char *ssid); | |
173 | /* | |
174 | int unifi_do_scan(unifi_priv_t *priv, int scantype, CSR_BSS_TYPE bsstype, | |
175 | const char *ssid, int ssid_len); | |
176 | */ | |
177 | int unifi_set_powermode(unifi_priv_t *priv); | |
178 | int unifi_join_ap(unifi_priv_t *priv, scan_info_t *si); | |
179 | int unifi_join_bss(unifi_priv_t *priv, unsigned char *macaddr); | |
180 | int unifi_leave(unifi_priv_t *priv); | |
181 | unsigned int unifi_get_wmm_bss_capabilities(unifi_priv_t *priv, | |
182 | unsigned char *ie_vector, | |
183 | int ie_len, int *ap_capabilities); | |
184 | ||
185 | /* | |
186 | * Status and management. | |
187 | */ | |
188 | int uf_init_wext_interface(unifi_priv_t *priv); | |
189 | void uf_deinit_wext_interface(unifi_priv_t *priv); | |
190 | ||
191 | /* | |
192 | * Function to reset UniFi's 802.11 state by sending MLME-RESET.req | |
193 | */ | |
194 | int unifi_reset_state(unifi_priv_t *priv, unsigned char *macaddr, unsigned char set_default_mib); | |
195 | ||
196 | ||
197 | /* | |
198 | * mlme.c | |
199 | */ | |
200 | /* Abort an MLME operation - useful in error recovery */ | |
201 | int uf_abort_mlme(unifi_priv_t *priv); | |
202 | ||
203 | int unifi_mlme_blocking_request(unifi_priv_t *priv, ul_client_t *pcli, | |
204 | CSR_SIGNAL *sig, bulk_data_param_t *data_ptrs, | |
205 | int timeout); | |
206 | void unifi_mlme_copy_reply_and_wakeup_client(ul_client_t *pcli, | |
207 | CSR_SIGNAL *signal, int signal_len, | |
208 | const bulk_data_param_t *bulkdata); | |
209 | ||
210 | /* | |
211 | * Utility functions | |
212 | */ | |
213 | const char *lookup_reason_code(int reason); | |
214 | const char *lookup_result_code(int result); | |
215 | ||
216 | ||
217 | /* | |
218 | * sme_native.c | |
219 | */ | |
220 | int uf_sme_init(unifi_priv_t *priv); | |
221 | void uf_sme_deinit(unifi_priv_t *priv); | |
222 | int sme_sys_suspend(unifi_priv_t *priv); | |
223 | int sme_sys_resume(unifi_priv_t *priv); | |
224 | int sme_mgt_wifi_on(unifi_priv_t *priv); | |
225 | ||
226 | /* Callback for event logging to SME clients (unifi_manager) */ | |
227 | void sme_native_log_event(ul_client_t *client, | |
228 | const u8 *sig_packed, int sig_len, | |
229 | const bulk_data_param_t *bulkdata, | |
230 | int dir); | |
231 | ||
232 | void sme_native_mlme_event_handler(ul_client_t *pcli, | |
233 | const u8 *sig_packed, int sig_len, | |
234 | const bulk_data_param_t *bulkdata, | |
235 | int dir); | |
236 | ||
237 | /* Task to query statistics from the MIB */ | |
238 | #define UF_SME_STATS_WQ_TIMEOUT 2000 /* in msecs */ | |
239 | void uf_sme_stats_wq(struct work_struct *work); | |
240 | ||
241 | void uf_native_process_udi_signal(ul_client_t *pcli, | |
242 | const u8 *packed_signal, | |
243 | int packed_signal_len, | |
244 | const bulk_data_param_t *bulkdata, int dir); | |
635d2b00 GKH |
245 | #ifdef UNIFI_SNIFF_ARPHRD |
246 | /* | |
247 | * monitor.c | |
248 | */ | |
249 | int uf_start_sniff(unifi_priv_t *priv); | |
250 | /* | |
251 | void ma_sniffdata_ind(void *ospriv, | |
252 | const CSR_MA_SNIFFDATA_INDICATION *ind, | |
253 | const bulk_data_param_t *bulkdata); | |
254 | */ | |
255 | #endif /* ARPHRD_IEEE80211_PRISM */ | |
256 | ||
257 | #endif /* __LINUX_UNIFI_NATIVE_H__ */ |