blob: def0db5c4e619c92f1dcf8afe6b2fdf339f8225f [file] [log] [blame]
Marcelo Tosatti876c9d32007-02-10 12:25:27 -02001/**
2 * Interface for the wlan network scan routines
3 *
4 * Driver interface functions and type declarations for the scan module
5 * implemented in wlan_scan.c.
6 */
7#ifndef _WLAN_SCAN_H
8#define _WLAN_SCAN_H
9
Dan Williams51b0c9d2007-05-10 22:51:28 -040010#include <net/ieee80211.h>
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020011#include "hostcmd.h"
12
13/**
14 * @brief Maximum number of channels that can be sent in a setuserscan ioctl
15 *
16 * @sa wlan_ioctl_user_scan_cfg
17 */
18#define WLAN_IOCTL_USER_SCAN_CHAN_MAX 50
19
20//! Infrastructure BSS scan type in wlan_scan_cmd_config
21#define WLAN_SCAN_BSS_TYPE_BSS 1
22
23//! Adhoc BSS scan type in wlan_scan_cmd_config
24#define WLAN_SCAN_BSS_TYPE_IBSS 2
25
26//! Adhoc or Infrastructure BSS scan type in wlan_scan_cmd_config, no filter
27#define WLAN_SCAN_BSS_TYPE_ANY 3
28
29/**
30 * @brief Structure used internally in the wlan driver to configure a scan.
31 *
32 * Sent to the command processing module to configure the firmware
33 * scan command prepared by libertas_cmd_80211_scan.
34 *
35 * @sa wlan_scan_networks
36 *
37 */
38struct wlan_scan_cmd_config {
39 /**
40 * @brief BSS type to be sent in the firmware command
41 *
42 * Field can be used to restrict the types of networks returned in the
43 * scan. valid settings are:
44 *
45 * - WLAN_SCAN_BSS_TYPE_BSS (infrastructure)
46 * - WLAN_SCAN_BSS_TYPE_IBSS (adhoc)
47 * - WLAN_SCAN_BSS_TYPE_ANY (unrestricted, adhoc and infrastructure)
48 */
49 u8 bsstype;
50
51 /**
52 * @brief Specific BSSID used to filter scan results in the firmware
53 */
Dan Williamseb8f7332007-05-25 16:25:21 -040054 u8 bssid[ETH_ALEN];
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020055
56 /**
57 * @brief length of TLVs sent in command starting at tlvBuffer
58 */
59 int tlvbufferlen;
60
61 /**
62 * @brief SSID TLV(s) and ChanList TLVs to be sent in the firmware command
63 *
64 * @sa TLV_TYPE_CHANLIST, mrvlietypes_chanlistparamset_t
65 * @sa TLV_TYPE_SSID, mrvlietypes_ssidparamset_t
66 */
67 u8 tlvbuffer[1]; //!< SSID TLV(s) and ChanList TLVs are stored here
68};
69
70/**
71 * @brief IOCTL channel sub-structure sent in wlan_ioctl_user_scan_cfg
72 *
73 * Multiple instances of this structure are included in the IOCTL command
74 * to configure a instance of a scan on the specific channel.
75 */
76struct wlan_ioctl_user_scan_chan {
77 u8 channumber; //!< channel Number to scan
78 u8 radiotype; //!< Radio type: 'B/G' band = 0, 'A' band = 1
79 u8 scantype; //!< Scan type: Active = 0, Passive = 1
80 u16 scantime; //!< Scan duration in milliseconds; if 0 default used
81};
82
83/**
84 * @brief IOCTL input structure to configure an immediate scan cmd to firmware
85 *
86 * Used in the setuserscan (WLAN_SET_USER_SCAN) private ioctl. Specifies
87 * a number of parameters to be used in general for the scan as well
88 * as a channel list (wlan_ioctl_user_scan_chan) for each scan period
89 * desired.
90 *
91 * @sa libertas_set_user_scan_ioctl
92 */
93struct wlan_ioctl_user_scan_cfg {
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020094 /**
95 * @brief BSS type to be sent in the firmware command
96 *
97 * Field can be used to restrict the types of networks returned in the
98 * scan. valid settings are:
99 *
100 * - WLAN_SCAN_BSS_TYPE_BSS (infrastructure)
101 * - WLAN_SCAN_BSS_TYPE_IBSS (adhoc)
102 * - WLAN_SCAN_BSS_TYPE_ANY (unrestricted, adhoc and infrastructure)
103 */
104 u8 bsstype;
105
106 /**
107 * @brief Configure the number of probe requests for active chan scans
108 */
109 u8 numprobes;
110
Dan Williamseb8f7332007-05-25 16:25:21 -0400111 /**
112 * @brief BSSID filter sent in the firmware command to limit the results
113 */
114 u8 bssid[ETH_ALEN];
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200115
Dan Williamseb8f7332007-05-25 16:25:21 -0400116 /* Clear existing scan results matching this BSSID */
117 u8 clear_bssid;
118
119 /**
120 * @brief SSID filter sent in the firmware command to limit the results
121 */
122 char ssid[IW_ESSID_MAX_SIZE];
123 u8 ssid_len;
124
125 /* Clear existing scan results matching this SSID */
126 u8 clear_ssid;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200127
128 /**
129 * @brief Variable number (fixed maximum) of channels to scan up
130 */
131 struct wlan_ioctl_user_scan_chan chanlist[WLAN_IOCTL_USER_SCAN_CHAN_MAX];
132};
133
134/**
135 * @brief Structure used to store information for each beacon/probe response
136 */
137struct bss_descriptor {
Dan Williams4ace1132007-05-25 13:16:38 -0400138 u8 bssid[ETH_ALEN];
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200139
Dan Williamsd8efea22007-05-28 23:54:55 -0400140 u8 ssid[IW_ESSID_MAX_SIZE + 1];
141 u8 ssid_len;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200142
Dan Williams0c9ca6902007-08-02 10:43:44 -0400143 u16 capability;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200144
145 /* receive signal strength in dBm */
146 long rssi;
147
148 u32 channel;
149
150 u16 beaconperiod;
151
152 u32 atimwindow;
153
Dan Williams0dc5a292007-05-10 22:58:02 -0400154 u8 mode;
Dan Williams8c512762007-08-02 11:40:45 -0400155 /* zero-terminated array of supported data rates */
156 u8 rates[MAX_RATES + 1];
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200157
David Woodhouse981f1872007-05-25 23:36:54 -0400158 __le64 timestamp; //!< TSF value included in the beacon/probe response
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400159 unsigned long last_scanned;
160
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200161 union ieeetypes_phyparamset phyparamset;
162 union IEEEtypes_ssparamset ssparamset;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200163
David Woodhouse981f1872007-05-25 23:36:54 -0400164 u64 networktsf; //!< TSF timestamp from the current firmware TSF
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200165
166 struct ieeetypes_countryinfofullset countryinfo;
167
Dan Williams51b0c9d2007-05-10 22:51:28 -0400168 u8 wpa_ie[MAX_WPA_IE_LEN];
169 size_t wpa_ie_len;
170 u8 rsn_ie[MAX_WPA_IE_LEN];
171 size_t rsn_ie_len;
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400172
Luis Carlos Cobo1e838bf2007-08-02 10:51:27 -0400173 u8 mesh;
174
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400175 struct list_head list;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200176};
177
Holger Schurigac558ca2007-08-02 11:49:06 -0400178int libertas_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len);
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400179
Dan Williams717c9332007-05-29 00:03:31 -0400180struct bss_descriptor * libertas_find_ssid_in_list(wlan_adapter * adapter,
Dan Williamsd8efea22007-05-28 23:54:55 -0400181 u8 *ssid, u8 ssid_len, u8 * bssid, u8 mode,
Dan Williamsaeea0ab2007-05-25 22:30:48 -0400182 int channel);
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400183
Holger Schurigac558ca2007-08-02 11:49:06 -0400184struct bss_descriptor * libertas_find_bssid_in_list(wlan_adapter * adapter,
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400185 u8 * bssid, u8 mode);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200186
Dan Williams717c9332007-05-29 00:03:31 -0400187int libertas_find_best_network_ssid(wlan_private * priv, u8 *out_ssid,
Dan Williamsd8efea22007-05-28 23:54:55 -0400188 u8 *out_ssid_len, u8 preferred_mode, u8 *out_mode);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200189
Holger Schurigac558ca2007-08-02 11:49:06 -0400190int libertas_send_specific_ssid_scan(wlan_private * priv, u8 *ssid,
Dan Williamsd8efea22007-05-28 23:54:55 -0400191 u8 ssid_len, u8 clear_ssid);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200192
Holger Schurigac558ca2007-08-02 11:49:06 -0400193int libertas_cmd_80211_scan(wlan_private * priv,
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200194 struct cmd_ds_command *cmd,
195 void *pdata_buf);
196
Holger Schurigac558ca2007-08-02 11:49:06 -0400197int libertas_ret_80211_scan(wlan_private * priv,
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200198 struct cmd_ds_command *resp);
199
200int wlan_scan_networks(wlan_private * priv,
Marcelo Tosatti2be92192007-05-25 00:33:28 -0400201 const struct wlan_ioctl_user_scan_cfg * puserscanin,
202 int full_scan);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200203
204struct ifreq;
205
206struct iw_point;
207struct iw_param;
208struct iw_request_info;
Holger Schurigac558ca2007-08-02 11:49:06 -0400209int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200210 struct iw_point *dwrq, char *extra);
Holger Schurigac558ca2007-08-02 11:49:06 -0400211int libertas_set_scan(struct net_device *dev, struct iw_request_info *info,
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200212 struct iw_param *vwrq, char *extra);
213
214#endif /* _WLAN_SCAN_H */