blob: 1a8756edfeb563a95c7756b39d397d8f1710e149 [file] [log] [blame]
Marcelo Tosatti876c9d32007-02-10 12:25:27 -02001/* -*- mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
2/* vi: set expandtab shiftwidth=4 tabstop=4 textwidth=78: */
3
4/**
5 * Interface for the wlan network scan routines
6 *
7 * Driver interface functions and type declarations for the scan module
8 * implemented in wlan_scan.c.
9 */
10#ifndef _WLAN_SCAN_H
11#define _WLAN_SCAN_H
12
Dan Williams51b0c9d2007-05-10 22:51:28 -040013#include <net/ieee80211.h>
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020014#include "hostcmd.h"
15
16/**
17 * @brief Maximum number of channels that can be sent in a setuserscan ioctl
18 *
19 * @sa wlan_ioctl_user_scan_cfg
20 */
21#define WLAN_IOCTL_USER_SCAN_CHAN_MAX 50
22
23//! Infrastructure BSS scan type in wlan_scan_cmd_config
24#define WLAN_SCAN_BSS_TYPE_BSS 1
25
26//! Adhoc BSS scan type in wlan_scan_cmd_config
27#define WLAN_SCAN_BSS_TYPE_IBSS 2
28
29//! Adhoc or Infrastructure BSS scan type in wlan_scan_cmd_config, no filter
30#define WLAN_SCAN_BSS_TYPE_ANY 3
31
32/**
33 * @brief Structure used internally in the wlan driver to configure a scan.
34 *
35 * Sent to the command processing module to configure the firmware
36 * scan command prepared by libertas_cmd_80211_scan.
37 *
38 * @sa wlan_scan_networks
39 *
40 */
41struct wlan_scan_cmd_config {
42 /**
43 * @brief BSS type to be sent in the firmware command
44 *
45 * Field can be used to restrict the types of networks returned in the
46 * scan. valid settings are:
47 *
48 * - WLAN_SCAN_BSS_TYPE_BSS (infrastructure)
49 * - WLAN_SCAN_BSS_TYPE_IBSS (adhoc)
50 * - WLAN_SCAN_BSS_TYPE_ANY (unrestricted, adhoc and infrastructure)
51 */
52 u8 bsstype;
53
54 /**
55 * @brief Specific BSSID used to filter scan results in the firmware
56 */
57 u8 specificBSSID[ETH_ALEN];
58
59 /**
60 * @brief length of TLVs sent in command starting at tlvBuffer
61 */
62 int tlvbufferlen;
63
64 /**
65 * @brief SSID TLV(s) and ChanList TLVs to be sent in the firmware command
66 *
67 * @sa TLV_TYPE_CHANLIST, mrvlietypes_chanlistparamset_t
68 * @sa TLV_TYPE_SSID, mrvlietypes_ssidparamset_t
69 */
70 u8 tlvbuffer[1]; //!< SSID TLV(s) and ChanList TLVs are stored here
71};
72
73/**
74 * @brief IOCTL channel sub-structure sent in wlan_ioctl_user_scan_cfg
75 *
76 * Multiple instances of this structure are included in the IOCTL command
77 * to configure a instance of a scan on the specific channel.
78 */
79struct wlan_ioctl_user_scan_chan {
80 u8 channumber; //!< channel Number to scan
81 u8 radiotype; //!< Radio type: 'B/G' band = 0, 'A' band = 1
82 u8 scantype; //!< Scan type: Active = 0, Passive = 1
83 u16 scantime; //!< Scan duration in milliseconds; if 0 default used
84};
85
86/**
87 * @brief IOCTL input structure to configure an immediate scan cmd to firmware
88 *
89 * Used in the setuserscan (WLAN_SET_USER_SCAN) private ioctl. Specifies
90 * a number of parameters to be used in general for the scan as well
91 * as a channel list (wlan_ioctl_user_scan_chan) for each scan period
92 * desired.
93 *
94 * @sa libertas_set_user_scan_ioctl
95 */
96struct wlan_ioctl_user_scan_cfg {
97
98 /**
99 * @brief Flag set to keep the previous scan table intact
100 *
101 * If set, the scan results will accumulate, replacing any previous
102 * matched entries for a BSS with the new scan data
103 */
104 u8 keeppreviousscan; //!< Do not erase the existing scan results
105
106 /**
107 * @brief BSS type to be sent in the firmware command
108 *
109 * Field can be used to restrict the types of networks returned in the
110 * scan. valid settings are:
111 *
112 * - WLAN_SCAN_BSS_TYPE_BSS (infrastructure)
113 * - WLAN_SCAN_BSS_TYPE_IBSS (adhoc)
114 * - WLAN_SCAN_BSS_TYPE_ANY (unrestricted, adhoc and infrastructure)
115 */
116 u8 bsstype;
117
118 /**
119 * @brief Configure the number of probe requests for active chan scans
120 */
121 u8 numprobes;
122
123 /**
124 * @brief BSSID filter sent in the firmware command to limit the results
125 */
126 u8 specificBSSID[ETH_ALEN];
127
128 /**
129 * @brief SSID filter sent in the firmware command to limit the results
130 */
131 char specificSSID[IW_ESSID_MAX_SIZE + 1];
132
133 /**
134 * @brief Variable number (fixed maximum) of channels to scan up
135 */
136 struct wlan_ioctl_user_scan_chan chanlist[WLAN_IOCTL_USER_SCAN_CHAN_MAX];
137};
138
139/**
140 * @brief Structure used to store information for each beacon/probe response
141 */
142struct bss_descriptor {
143 u8 macaddress[ETH_ALEN];
144
145 struct WLAN_802_11_SSID ssid;
146
147 /* WEP encryption requirement */
148 u32 privacy;
149
150 /* receive signal strength in dBm */
151 long rssi;
152
153 u32 channel;
154
155 u16 beaconperiod;
156
157 u32 atimwindow;
158
159 enum WLAN_802_11_NETWORK_INFRASTRUCTURE inframode;
160 u8 libertas_supported_rates[WLAN_SUPPORTED_RATES];
161
162 int extra_ie;
163
164 u8 timestamp[8]; //!< TSF value included in the beacon/probe response
165 union ieeetypes_phyparamset phyparamset;
166 union IEEEtypes_ssparamset ssparamset;
167 struct ieeetypes_capinfo cap;
168 u8 datarates[WLAN_SUPPORTED_RATES];
169
170 __le64 networktsf; //!< TSF timestamp from the current firmware TSF
171
172 struct ieeetypes_countryinfofullset countryinfo;
173
Dan Williams51b0c9d2007-05-10 22:51:28 -0400174 u8 wpa_ie[MAX_WPA_IE_LEN];
175 size_t wpa_ie_len;
176 u8 rsn_ie[MAX_WPA_IE_LEN];
177 size_t rsn_ie_len;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200178};
179
180extern int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1,
181 struct WLAN_802_11_SSID *ssid2);
182extern int libertas_find_SSID_in_list(wlan_adapter * adapter, struct WLAN_802_11_SSID *ssid,
183 u8 * bssid, int mode);
184int libertas_find_best_SSID_in_list(wlan_adapter * adapter, enum WLAN_802_11_NETWORK_INFRASTRUCTURE mode);
185extern int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, int mode);
186
187int libertas_find_best_network_SSID(wlan_private * priv,
188 struct WLAN_802_11_SSID *pSSID,
189 enum WLAN_802_11_NETWORK_INFRASTRUCTURE preferred_mode,
190 enum WLAN_802_11_NETWORK_INFRASTRUCTURE *out_mode);
191
192extern int libertas_send_specific_SSID_scan(wlan_private * priv,
193 struct WLAN_802_11_SSID *prequestedssid,
194 u8 keeppreviousscan);
195extern int libertas_send_specific_BSSID_scan(wlan_private * priv,
196 u8 * bssid, u8 keeppreviousscan);
197
198extern int libertas_cmd_80211_scan(wlan_private * priv,
199 struct cmd_ds_command *cmd,
200 void *pdata_buf);
201
202extern int libertas_ret_80211_scan(wlan_private * priv,
203 struct cmd_ds_command *resp);
204
205int wlan_scan_networks(wlan_private * priv,
206 const struct wlan_ioctl_user_scan_cfg * puserscanin);
207
208struct ifreq;
209
210struct iw_point;
211struct iw_param;
212struct iw_request_info;
213extern int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
214 struct iw_point *dwrq, char *extra);
215extern int libertas_set_scan(struct net_device *dev, struct iw_request_info *info,
216 struct iw_param *vwrq, char *extra);
217
218#endif /* _WLAN_SCAN_H */