blob: 9b62e2b01f6877271b85419d887c227f2300e4e6 [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/**
127 * @brief Structure used to store information for each beacon/probe response
128 */
129struct bss_descriptor {
Dan Williams4ace1132007-05-25 13:16:38 -0400130 u8 bssid[ETH_ALEN];
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200131
Dan Williamsd8efea22007-05-28 23:54:55 -0400132 u8 ssid[IW_ESSID_MAX_SIZE + 1];
133 u8 ssid_len;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200134
Dan Williams0c9ca692007-08-02 10:43:44 -0400135 u16 capability;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200136
137 /* receive signal strength in dBm */
138 long rssi;
139
140 u32 channel;
141
142 u16 beaconperiod;
143
144 u32 atimwindow;
145
Holger Schuriga2235ed2007-08-02 13:12:45 -0400146 /* IW_MODE_AUTO, IW_MODE_ADHOC, IW_MODE_INFRA */
Dan Williams0dc5a292007-05-10 22:58:02 -0400147 u8 mode;
Holger Schuriga2235ed2007-08-02 13:12:45 -0400148
Dan Williams8c512762007-08-02 11:40:45 -0400149 /* zero-terminated array of supported data rates */
150 u8 rates[MAX_RATES + 1];
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200151
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400152 unsigned long last_scanned;
153
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200154 union ieeetypes_phyparamset phyparamset;
155 union IEEEtypes_ssparamset ssparamset;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200156
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200157 struct ieeetypes_countryinfofullset countryinfo;
158
Dan Williams51b0c9d2007-05-10 22:51:28 -0400159 u8 wpa_ie[MAX_WPA_IE_LEN];
160 size_t wpa_ie_len;
161 u8 rsn_ie[MAX_WPA_IE_LEN];
162 size_t rsn_ie_len;
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400163
Luis Carlos Cobo1e838bf2007-08-02 10:51:27 -0400164 u8 mesh;
165
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400166 struct list_head list;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200167};
168
Holger Schurig10078322007-11-15 18:05:47 -0500169int lbs_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len);
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400170
Holger Schurig69f90322007-11-23 15:43:44 +0100171struct bss_descriptor *lbs_find_ssid_in_list(struct lbs_adapter *adapter,
Holger Schurig10078322007-11-15 18:05:47 -0500172 u8 *ssid, u8 ssid_len, u8 *bssid, u8 mode,
173 int channel);
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400174
Holger Schurig69f90322007-11-23 15:43:44 +0100175struct bss_descriptor *lbs_find_bssid_in_list(struct lbs_adapter *adapter,
Holger Schurig10078322007-11-15 18:05:47 -0500176 u8 *bssid, u8 mode);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200177
Holger Schurig69f90322007-11-23 15:43:44 +0100178int lbs_find_best_network_ssid(struct lbs_private *priv, u8 *out_ssid,
Dan Williamsd8efea22007-05-28 23:54:55 -0400179 u8 *out_ssid_len, u8 preferred_mode, u8 *out_mode);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200180
Holger Schurig69f90322007-11-23 15:43:44 +0100181int lbs_send_specific_ssid_scan(struct lbs_private *priv, u8 *ssid,
Dan Williamsd8efea22007-05-28 23:54:55 -0400182 u8 ssid_len, u8 clear_ssid);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200183
Holger Schurig69f90322007-11-23 15:43:44 +0100184int lbs_cmd_80211_scan(struct lbs_private *priv,
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200185 struct cmd_ds_command *cmd,
186 void *pdata_buf);
187
Holger Schurig69f90322007-11-23 15:43:44 +0100188int lbs_ret_80211_scan(struct lbs_private *priv,
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200189 struct cmd_ds_command *resp);
190
Holger Schurig69f90322007-11-23 15:43:44 +0100191int lbs_scan_networks(struct lbs_private *priv,
Holger Schurig10078322007-11-15 18:05:47 -0500192 const struct lbs_ioctl_user_scan_cfg *puserscanin,
Marcelo Tosatti2be92192007-05-25 00:33:28 -0400193 int full_scan);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200194
195struct ifreq;
196
197struct iw_point;
198struct iw_param;
199struct iw_request_info;
Holger Schurig10078322007-11-15 18:05:47 -0500200int lbs_get_scan(struct net_device *dev, struct iw_request_info *info,
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200201 struct iw_point *dwrq, char *extra);
Holger Schurig10078322007-11-15 18:05:47 -0500202int lbs_set_scan(struct net_device *dev, struct iw_request_info *info,
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200203 struct iw_param *vwrq, char *extra);
204
Holger Schurig10078322007-11-15 18:05:47 -0500205void lbs_scan_worker(struct work_struct *work);
Dan Williams2afc0c52007-08-02 13:19:04 -0400206
Holger Schurig10078322007-11-15 18:05:47 -0500207#endif