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