blob: 7ed66f40d181b792a00d890197742a901ede7031 [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
Holger Schurig10078322007-11-15 18:05:47 -05005 * implemented in scan.c.
Marcelo Tosatti876c9d32007-02-10 12:25:27 -02006 */
Holger Schurig10078322007-11-15 18:05:47 -05007#ifndef _LBS_SCAN_H
8#define _LBS_SCAN_H
Marcelo Tosatti876c9d32007-02-10 12:25:27 -02009
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 *
Holger Schurig10078322007-11-15 18:05:47 -050016 * @sa lbs_ioctl_user_scan_cfg
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020017 */
Holger Schurig10078322007-11-15 18:05:47 -050018#define LBS_IOCTL_USER_SCAN_CHAN_MAX 50
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020019
Holger Schurig10078322007-11-15 18:05:47 -050020//! Infrastructure BSS scan type in lbs_scan_cmd_config
21#define LBS_SCAN_BSS_TYPE_BSS 1
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020022
Holger Schurig10078322007-11-15 18:05:47 -050023//! Adhoc BSS scan type in lbs_scan_cmd_config
24#define LBS_SCAN_BSS_TYPE_IBSS 2
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020025
Holger Schurig10078322007-11-15 18:05:47 -050026//! Adhoc or Infrastructure BSS scan type in lbs_scan_cmd_config, no filter
27#define LBS_SCAN_BSS_TYPE_ANY 3
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020028
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
Holger Schurig10078322007-11-15 18:05:47 -050033 * scan command prepared by lbs_cmd_80211_scan.
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020034 *
Holger Schurig10078322007-11-15 18:05:47 -050035 * @sa lbs_scan_networks
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020036 *
37 */
Holger Schurig10078322007-11-15 18:05:47 -050038struct lbs_scan_cmd_config {
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020039 /**
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 *
Holger Schurig10078322007-11-15 18:05:47 -050045 * - LBS_SCAN_BSS_TYPE_BSS (infrastructure)
46 * - LBS_SCAN_BSS_TYPE_IBSS (adhoc)
47 * - LBS_SCAN_BSS_TYPE_ANY (unrestricted, adhoc and infrastructure)
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020048 */
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/**
Holger Schurig10078322007-11-15 18:05:47 -050071 * @brief IOCTL channel sub-structure sent in lbs_ioctl_user_scan_cfg
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020072 *
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 */
Holger Schurig10078322007-11-15 18:05:47 -050076struct lbs_ioctl_user_scan_chan {
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020077 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 *
Holger Schurig10078322007-11-15 18:05:47 -050086 * Used in the setuserscan (LBS_SET_USER_SCAN) private ioctl. Specifies
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020087 * a number of parameters to be used in general for the scan as well
Holger Schurig10078322007-11-15 18:05:47 -050088 * as a channel list (lbs_ioctl_user_scan_chan) for each scan period
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020089 * desired.
90 *
Holger Schurig10078322007-11-15 18:05:47 -050091 * @sa lbs_set_user_scan_ioctl
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020092 */
Holger Schurig10078322007-11-15 18:05:47 -050093struct lbs_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 *
Holger Schurig10078322007-11-15 18:05:47 -0500100 * - LBS_SCAN_BSS_TYPE_BSS (infrastructure)
101 * - LBS_SCAN_BSS_TYPE_IBSS (adhoc)
102 * - LBS_SCAN_BSS_TYPE_ANY (unrestricted, adhoc and infrastructure)
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200103 */
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 */
Holger Schurig10078322007-11-15 18:05:47 -0500131 struct lbs_ioctl_user_scan_chan chanlist[LBS_IOCTL_USER_SCAN_CHAN_MAX];
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200132};
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 Williams0c9ca692007-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
Holger Schuriga2235ed2007-08-02 13:12:45 -0400154 /* IW_MODE_AUTO, IW_MODE_ADHOC, IW_MODE_INFRA */
Dan Williams0dc5a292007-05-10 22:58:02 -0400155 u8 mode;
Holger Schuriga2235ed2007-08-02 13:12:45 -0400156
Dan Williams8c512762007-08-02 11:40:45 -0400157 /* zero-terminated array of supported data rates */
158 u8 rates[MAX_RATES + 1];
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200159
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400160 unsigned long last_scanned;
161
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200162 union ieeetypes_phyparamset phyparamset;
163 union IEEEtypes_ssparamset ssparamset;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200164
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200165 struct ieeetypes_countryinfofullset countryinfo;
166
Dan Williams51b0c9d2007-05-10 22:51:28 -0400167 u8 wpa_ie[MAX_WPA_IE_LEN];
168 size_t wpa_ie_len;
169 u8 rsn_ie[MAX_WPA_IE_LEN];
170 size_t rsn_ie_len;
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400171
Luis Carlos Cobo1e838bf2007-08-02 10:51:27 -0400172 u8 mesh;
173
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400174 struct list_head list;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200175};
176
Holger Schurig10078322007-11-15 18:05:47 -0500177int lbs_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len);
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400178
Holger Schurig10078322007-11-15 18:05:47 -0500179struct bss_descriptor *lbs_find_ssid_in_list(lbs_adapter *adapter,
180 u8 *ssid, u8 ssid_len, u8 *bssid, u8 mode,
181 int channel);
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400182
Holger Schurig10078322007-11-15 18:05:47 -0500183struct bss_descriptor *lbs_find_bssid_in_list(lbs_adapter *adapter,
184 u8 *bssid, u8 mode);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200185
Holger Schurig10078322007-11-15 18:05:47 -0500186int lbs_find_best_network_ssid(lbs_private *priv, u8 *out_ssid,
Dan Williamsd8efea22007-05-28 23:54:55 -0400187 u8 *out_ssid_len, u8 preferred_mode, u8 *out_mode);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200188
Holger Schurig10078322007-11-15 18:05:47 -0500189int lbs_send_specific_ssid_scan(lbs_private *priv, u8 *ssid,
Dan Williamsd8efea22007-05-28 23:54:55 -0400190 u8 ssid_len, u8 clear_ssid);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200191
Holger Schurig10078322007-11-15 18:05:47 -0500192int lbs_cmd_80211_scan(lbs_private *priv,
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200193 struct cmd_ds_command *cmd,
194 void *pdata_buf);
195
Holger Schurig10078322007-11-15 18:05:47 -0500196int lbs_ret_80211_scan(lbs_private *priv,
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200197 struct cmd_ds_command *resp);
198
Holger Schurig10078322007-11-15 18:05:47 -0500199int lbs_scan_networks(lbs_private *priv,
200 const struct lbs_ioctl_user_scan_cfg *puserscanin,
Marcelo Tosatti2be92192007-05-25 00:33:28 -0400201 int full_scan);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200202
203struct ifreq;
204
205struct iw_point;
206struct iw_param;
207struct iw_request_info;
Holger Schurig10078322007-11-15 18:05:47 -0500208int lbs_get_scan(struct net_device *dev, struct iw_request_info *info,
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200209 struct iw_point *dwrq, char *extra);
Holger Schurig10078322007-11-15 18:05:47 -0500210int lbs_set_scan(struct net_device *dev, struct iw_request_info *info,
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200211 struct iw_param *vwrq, char *extra);
212
Holger Schurig10078322007-11-15 18:05:47 -0500213void lbs_scan_worker(struct work_struct *work);
Dan Williams2afc0c52007-08-02 13:19:04 -0400214
Holger Schurig10078322007-11-15 18:05:47 -0500215#endif