blob: b23144814677bf99ed00488f89fede615d3e92b4 [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
108 /**
109 * @brief Configure the number of probe requests for active chan scans
110 */
111 u8 numprobes;
112
Dan Williamseb8f7332007-05-25 16:25:21 -0400113 /**
114 * @brief BSSID filter sent in the firmware command to limit the results
115 */
116 u8 bssid[ETH_ALEN];
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200117
Dan Williamseb8f7332007-05-25 16:25:21 -0400118 /* Clear existing scan results matching this BSSID */
119 u8 clear_bssid;
120
121 /**
122 * @brief SSID filter sent in the firmware command to limit the results
123 */
124 char ssid[IW_ESSID_MAX_SIZE];
125 u8 ssid_len;
126
127 /* Clear existing scan results matching this SSID */
128 u8 clear_ssid;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200129
130 /**
131 * @brief Variable number (fixed maximum) of channels to scan up
132 */
Holger Schurig10078322007-11-15 18:05:47 -0500133 struct lbs_ioctl_user_scan_chan chanlist[LBS_IOCTL_USER_SCAN_CHAN_MAX];
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200134};
135
136/**
137 * @brief Structure used to store information for each beacon/probe response
138 */
139struct bss_descriptor {
Dan Williams4ace1132007-05-25 13:16:38 -0400140 u8 bssid[ETH_ALEN];
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200141
Dan Williamsd8efea22007-05-28 23:54:55 -0400142 u8 ssid[IW_ESSID_MAX_SIZE + 1];
143 u8 ssid_len;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200144
Dan Williams0c9ca692007-08-02 10:43:44 -0400145 u16 capability;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200146
147 /* receive signal strength in dBm */
148 long rssi;
149
150 u32 channel;
151
152 u16 beaconperiod;
153
154 u32 atimwindow;
155
Holger Schuriga2235ed2007-08-02 13:12:45 -0400156 /* IW_MODE_AUTO, IW_MODE_ADHOC, IW_MODE_INFRA */
Dan Williams0dc5a292007-05-10 22:58:02 -0400157 u8 mode;
Holger Schuriga2235ed2007-08-02 13:12:45 -0400158
Dan Williams8c512762007-08-02 11:40:45 -0400159 /* zero-terminated array of supported data rates */
160 u8 rates[MAX_RATES + 1];
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200161
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400162 unsigned long last_scanned;
163
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200164 union ieeetypes_phyparamset phyparamset;
165 union IEEEtypes_ssparamset ssparamset;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200166
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200167 struct ieeetypes_countryinfofullset countryinfo;
168
Dan Williams51b0c9d2007-05-10 22:51:28 -0400169 u8 wpa_ie[MAX_WPA_IE_LEN];
170 size_t wpa_ie_len;
171 u8 rsn_ie[MAX_WPA_IE_LEN];
172 size_t rsn_ie_len;
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400173
Luis Carlos Cobo1e838bf2007-08-02 10:51:27 -0400174 u8 mesh;
175
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400176 struct list_head list;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200177};
178
Holger Schurig10078322007-11-15 18:05:47 -0500179int lbs_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len);
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400180
Holger Schurig69f90322007-11-23 15:43:44 +0100181struct bss_descriptor *lbs_find_ssid_in_list(struct lbs_adapter *adapter,
Holger Schurig10078322007-11-15 18:05:47 -0500182 u8 *ssid, u8 ssid_len, u8 *bssid, u8 mode,
183 int channel);
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400184
Holger Schurig69f90322007-11-23 15:43:44 +0100185struct bss_descriptor *lbs_find_bssid_in_list(struct lbs_adapter *adapter,
Holger Schurig10078322007-11-15 18:05:47 -0500186 u8 *bssid, u8 mode);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200187
Holger Schurig69f90322007-11-23 15:43:44 +0100188int lbs_find_best_network_ssid(struct lbs_private *priv, u8 *out_ssid,
Dan Williamsd8efea22007-05-28 23:54:55 -0400189 u8 *out_ssid_len, u8 preferred_mode, u8 *out_mode);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200190
Holger Schurig69f90322007-11-23 15:43:44 +0100191int lbs_send_specific_ssid_scan(struct lbs_private *priv, u8 *ssid,
Dan Williamsd8efea22007-05-28 23:54:55 -0400192 u8 ssid_len, u8 clear_ssid);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200193
Holger Schurig69f90322007-11-23 15:43:44 +0100194int lbs_cmd_80211_scan(struct lbs_private *priv,
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200195 struct cmd_ds_command *cmd,
196 void *pdata_buf);
197
Holger Schurig69f90322007-11-23 15:43:44 +0100198int lbs_ret_80211_scan(struct lbs_private *priv,
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200199 struct cmd_ds_command *resp);
200
Holger Schurig69f90322007-11-23 15:43:44 +0100201int lbs_scan_networks(struct lbs_private *priv,
Holger Schurig10078322007-11-15 18:05:47 -0500202 const struct lbs_ioctl_user_scan_cfg *puserscanin,
Marcelo Tosatti2be92192007-05-25 00:33:28 -0400203 int full_scan);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200204
205struct ifreq;
206
207struct iw_point;
208struct iw_param;
209struct iw_request_info;
Holger Schurig10078322007-11-15 18:05:47 -0500210int lbs_get_scan(struct net_device *dev, struct iw_request_info *info,
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200211 struct iw_point *dwrq, char *extra);
Holger Schurig10078322007-11-15 18:05:47 -0500212int lbs_set_scan(struct net_device *dev, struct iw_request_info *info,
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200213 struct iw_param *vwrq, char *extra);
214
Holger Schurig10078322007-11-15 18:05:47 -0500215void lbs_scan_worker(struct work_struct *work);
Dan Williams2afc0c52007-08-02 13:19:04 -0400216
Holger Schurig10078322007-11-15 18:05:47 -0500217#endif