blob: e420cd9217cdd8a0c4ae5af91e9992996226f718 [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
Holger Schurig69f90322007-11-23 15:43:44 +010013struct lbs_adapter;
14
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020015/**
16 * @brief Maximum number of channels that can be sent in a setuserscan ioctl
17 *
Holger Schurig10078322007-11-15 18:05:47 -050018 * @sa lbs_ioctl_user_scan_cfg
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020019 */
Holger Schurig10078322007-11-15 18:05:47 -050020#define LBS_IOCTL_USER_SCAN_CHAN_MAX 50
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020021
Holger Schurig10078322007-11-15 18:05:47 -050022//! Infrastructure BSS scan type in lbs_scan_cmd_config
23#define LBS_SCAN_BSS_TYPE_BSS 1
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020024
Holger Schurig10078322007-11-15 18:05:47 -050025//! Adhoc BSS scan type in lbs_scan_cmd_config
26#define LBS_SCAN_BSS_TYPE_IBSS 2
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020027
Holger Schurig10078322007-11-15 18:05:47 -050028//! Adhoc or Infrastructure BSS scan type in lbs_scan_cmd_config, no filter
29#define LBS_SCAN_BSS_TYPE_ANY 3
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020030
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
Holger Schurig10078322007-11-15 18:05:47 -050035 * scan command prepared by lbs_cmd_80211_scan.
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020036 *
Holger Schurig10078322007-11-15 18:05:47 -050037 * @sa lbs_scan_networks
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020038 *
39 */
Holger Schurig10078322007-11-15 18:05:47 -050040struct lbs_scan_cmd_config {
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020041 /**
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 *
Holger Schurig10078322007-11-15 18:05:47 -050047 * - LBS_SCAN_BSS_TYPE_BSS (infrastructure)
48 * - LBS_SCAN_BSS_TYPE_IBSS (adhoc)
49 * - LBS_SCAN_BSS_TYPE_ANY (unrestricted, adhoc and infrastructure)
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020050 */
51 u8 bsstype;
52
53 /**
54 * @brief Specific BSSID used to filter scan results in the firmware
55 */
Dan Williamseb8f7332007-05-25 16:25:21 -040056 u8 bssid[ETH_ALEN];
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020057
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/**
Holger Schurig10078322007-11-15 18:05:47 -050073 * @brief IOCTL channel sub-structure sent in lbs_ioctl_user_scan_cfg
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020074 *
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 */
Holger Schurig10078322007-11-15 18:05:47 -050078struct lbs_ioctl_user_scan_chan {
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020079 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 *
Holger Schurig10078322007-11-15 18:05:47 -050088 * Used in the setuserscan (LBS_SET_USER_SCAN) private ioctl. Specifies
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020089 * a number of parameters to be used in general for the scan as well
Holger Schurig10078322007-11-15 18:05:47 -050090 * as a channel list (lbs_ioctl_user_scan_chan) for each scan period
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020091 * desired.
92 *
Holger Schurig10078322007-11-15 18:05:47 -050093 * @sa lbs_set_user_scan_ioctl
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020094 */
Holger Schurig10078322007-11-15 18:05:47 -050095struct lbs_ioctl_user_scan_cfg {
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020096 /**
97 * @brief BSS type to be sent in the firmware command
98 *
99 * Field can be used to restrict the types of networks returned in the
100 * scan. valid settings are:
101 *
Holger Schurig10078322007-11-15 18:05:47 -0500102 * - LBS_SCAN_BSS_TYPE_BSS (infrastructure)
103 * - LBS_SCAN_BSS_TYPE_IBSS (adhoc)
104 * - LBS_SCAN_BSS_TYPE_ANY (unrestricted, adhoc and infrastructure)
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200105 */
106 u8 bsstype;
107
Dan Williamseb8f7332007-05-25 16:25:21 -0400108 /**
109 * @brief BSSID filter sent in the firmware command to limit the results
110 */
111 u8 bssid[ETH_ALEN];
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200112
Dan Williamseb8f7332007-05-25 16:25:21 -0400113 /* Clear existing scan results matching this BSSID */
114 u8 clear_bssid;
115
116 /**
117 * @brief SSID filter sent in the firmware command to limit the results
118 */
119 char ssid[IW_ESSID_MAX_SIZE];
120 u8 ssid_len;
121
122 /* Clear existing scan results matching this SSID */
123 u8 clear_ssid;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200124
125 /**
126 * @brief Variable number (fixed maximum) of channels to scan up
127 */
Holger Schurig10078322007-11-15 18:05:47 -0500128 struct lbs_ioctl_user_scan_chan chanlist[LBS_IOCTL_USER_SCAN_CHAN_MAX];
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200129};
130
131/**
132 * @brief Structure used to store information for each beacon/probe response
133 */
134struct bss_descriptor {
Dan Williams4ace1132007-05-25 13:16:38 -0400135 u8 bssid[ETH_ALEN];
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200136
Dan Williamsd8efea22007-05-28 23:54:55 -0400137 u8 ssid[IW_ESSID_MAX_SIZE + 1];
138 u8 ssid_len;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200139
Dan Williams0c9ca692007-08-02 10:43:44 -0400140 u16 capability;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200141
142 /* receive signal strength in dBm */
143 long rssi;
144
145 u32 channel;
146
147 u16 beaconperiod;
148
149 u32 atimwindow;
150
Holger Schuriga2235ed2007-08-02 13:12:45 -0400151 /* IW_MODE_AUTO, IW_MODE_ADHOC, IW_MODE_INFRA */
Dan Williams0dc5a292007-05-10 22:58:02 -0400152 u8 mode;
Holger Schuriga2235ed2007-08-02 13:12:45 -0400153
Dan Williams8c512762007-08-02 11:40:45 -0400154 /* zero-terminated array of supported data rates */
155 u8 rates[MAX_RATES + 1];
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200156
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400157 unsigned long last_scanned;
158
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200159 union ieeetypes_phyparamset phyparamset;
160 union IEEEtypes_ssparamset ssparamset;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200161
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200162 struct ieeetypes_countryinfofullset countryinfo;
163
Dan Williams51b0c9d2007-05-10 22:51:28 -0400164 u8 wpa_ie[MAX_WPA_IE_LEN];
165 size_t wpa_ie_len;
166 u8 rsn_ie[MAX_WPA_IE_LEN];
167 size_t rsn_ie_len;
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400168
Luis Carlos Cobo1e838bf2007-08-02 10:51:27 -0400169 u8 mesh;
170
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400171 struct list_head list;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200172};
173
Holger Schurig10078322007-11-15 18:05:47 -0500174int lbs_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len);
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400175
Holger Schurig69f90322007-11-23 15:43:44 +0100176struct bss_descriptor *lbs_find_ssid_in_list(struct lbs_adapter *adapter,
Holger Schurig10078322007-11-15 18:05:47 -0500177 u8 *ssid, u8 ssid_len, u8 *bssid, u8 mode,
178 int channel);
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400179
Holger Schurig69f90322007-11-23 15:43:44 +0100180struct bss_descriptor *lbs_find_bssid_in_list(struct lbs_adapter *adapter,
Holger Schurig10078322007-11-15 18:05:47 -0500181 u8 *bssid, u8 mode);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200182
Holger Schurig69f90322007-11-23 15:43:44 +0100183int lbs_find_best_network_ssid(struct lbs_private *priv, u8 *out_ssid,
Dan Williamsd8efea22007-05-28 23:54:55 -0400184 u8 *out_ssid_len, u8 preferred_mode, u8 *out_mode);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200185
Holger Schurig69f90322007-11-23 15:43:44 +0100186int lbs_send_specific_ssid_scan(struct lbs_private *priv, u8 *ssid,
Dan Williamsd8efea22007-05-28 23:54:55 -0400187 u8 ssid_len, u8 clear_ssid);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200188
Holger Schurig69f90322007-11-23 15:43:44 +0100189int lbs_cmd_80211_scan(struct lbs_private *priv,
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200190 struct cmd_ds_command *cmd,
191 void *pdata_buf);
192
Holger Schurig69f90322007-11-23 15:43:44 +0100193int lbs_ret_80211_scan(struct lbs_private *priv,
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200194 struct cmd_ds_command *resp);
195
Holger Schurig69f90322007-11-23 15:43:44 +0100196int lbs_scan_networks(struct lbs_private *priv,
Holger Schurig10078322007-11-15 18:05:47 -0500197 const struct lbs_ioctl_user_scan_cfg *puserscanin,
Marcelo Tosatti2be92192007-05-25 00:33:28 -0400198 int full_scan);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200199
200struct ifreq;
201
202struct iw_point;
203struct iw_param;
204struct iw_request_info;
Holger Schurig10078322007-11-15 18:05:47 -0500205int lbs_get_scan(struct net_device *dev, struct iw_request_info *info,
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200206 struct iw_point *dwrq, char *extra);
Holger Schurig10078322007-11-15 18:05:47 -0500207int lbs_set_scan(struct net_device *dev, struct iw_request_info *info,
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200208 struct iw_param *vwrq, char *extra);
209
Holger Schurig10078322007-11-15 18:05:47 -0500210void lbs_scan_worker(struct work_struct *work);
Dan Williams2afc0c52007-08-02 13:19:04 -0400211
Holger Schurig10078322007-11-15 18:05:47 -0500212#endif