Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 1 | /** |
| 2 | * Interface for the wlan network scan routines |
| 3 | * |
| 4 | * Driver interface functions and type declarations for the scan module |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 5 | * implemented in scan.c. |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 6 | */ |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 7 | #ifndef _LBS_SCAN_H |
| 8 | #define _LBS_SCAN_H |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 9 | |
Dan Williams | 51b0c9d | 2007-05-10 22:51:28 -0400 | [diff] [blame] | 10 | #include <net/ieee80211.h> |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 11 | #include "hostcmd.h" |
| 12 | |
| 13 | /** |
| 14 | * @brief Maximum number of channels that can be sent in a setuserscan ioctl |
| 15 | * |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 16 | * @sa lbs_ioctl_user_scan_cfg |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 17 | */ |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 18 | #define LBS_IOCTL_USER_SCAN_CHAN_MAX 50 |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 19 | |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 20 | //! Infrastructure BSS scan type in lbs_scan_cmd_config |
| 21 | #define LBS_SCAN_BSS_TYPE_BSS 1 |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 22 | |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 23 | //! Adhoc BSS scan type in lbs_scan_cmd_config |
| 24 | #define LBS_SCAN_BSS_TYPE_IBSS 2 |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 25 | |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 26 | //! Adhoc or Infrastructure BSS scan type in lbs_scan_cmd_config, no filter |
| 27 | #define LBS_SCAN_BSS_TYPE_ANY 3 |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 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 |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 33 | * scan command prepared by lbs_cmd_80211_scan. |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 34 | * |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 35 | * @sa lbs_scan_networks |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 36 | * |
| 37 | */ |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 38 | struct lbs_scan_cmd_config { |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 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 | * |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 45 | * - LBS_SCAN_BSS_TYPE_BSS (infrastructure) |
| 46 | * - LBS_SCAN_BSS_TYPE_IBSS (adhoc) |
| 47 | * - LBS_SCAN_BSS_TYPE_ANY (unrestricted, adhoc and infrastructure) |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 48 | */ |
| 49 | u8 bsstype; |
| 50 | |
| 51 | /** |
| 52 | * @brief Specific BSSID used to filter scan results in the firmware |
| 53 | */ |
Dan Williams | eb8f733 | 2007-05-25 16:25:21 -0400 | [diff] [blame] | 54 | u8 bssid[ETH_ALEN]; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 55 | |
| 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 Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 71 | * @brief IOCTL channel sub-structure sent in lbs_ioctl_user_scan_cfg |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 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 | */ |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 76 | struct lbs_ioctl_user_scan_chan { |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 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 | * |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 86 | * Used in the setuserscan (LBS_SET_USER_SCAN) private ioctl. Specifies |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 87 | * a number of parameters to be used in general for the scan as well |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 88 | * as a channel list (lbs_ioctl_user_scan_chan) for each scan period |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 89 | * desired. |
| 90 | * |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 91 | * @sa lbs_set_user_scan_ioctl |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 92 | */ |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 93 | struct lbs_ioctl_user_scan_cfg { |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 94 | /** |
| 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 Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 100 | * - LBS_SCAN_BSS_TYPE_BSS (infrastructure) |
| 101 | * - LBS_SCAN_BSS_TYPE_IBSS (adhoc) |
| 102 | * - LBS_SCAN_BSS_TYPE_ANY (unrestricted, adhoc and infrastructure) |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 103 | */ |
| 104 | u8 bsstype; |
| 105 | |
| 106 | /** |
| 107 | * @brief Configure the number of probe requests for active chan scans |
| 108 | */ |
| 109 | u8 numprobes; |
| 110 | |
Dan Williams | eb8f733 | 2007-05-25 16:25:21 -0400 | [diff] [blame] | 111 | /** |
| 112 | * @brief BSSID filter sent in the firmware command to limit the results |
| 113 | */ |
| 114 | u8 bssid[ETH_ALEN]; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 115 | |
Dan Williams | eb8f733 | 2007-05-25 16:25:21 -0400 | [diff] [blame] | 116 | /* 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 Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 127 | |
| 128 | /** |
| 129 | * @brief Variable number (fixed maximum) of channels to scan up |
| 130 | */ |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 131 | struct lbs_ioctl_user_scan_chan chanlist[LBS_IOCTL_USER_SCAN_CHAN_MAX]; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 132 | }; |
| 133 | |
| 134 | /** |
| 135 | * @brief Structure used to store information for each beacon/probe response |
| 136 | */ |
| 137 | struct bss_descriptor { |
Dan Williams | 4ace113 | 2007-05-25 13:16:38 -0400 | [diff] [blame] | 138 | u8 bssid[ETH_ALEN]; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 139 | |
Dan Williams | d8efea2 | 2007-05-28 23:54:55 -0400 | [diff] [blame] | 140 | u8 ssid[IW_ESSID_MAX_SIZE + 1]; |
| 141 | u8 ssid_len; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 142 | |
Dan Williams | 0c9ca69 | 2007-08-02 10:43:44 -0400 | [diff] [blame] | 143 | u16 capability; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 144 | |
| 145 | /* receive signal strength in dBm */ |
| 146 | long rssi; |
| 147 | |
| 148 | u32 channel; |
| 149 | |
| 150 | u16 beaconperiod; |
| 151 | |
| 152 | u32 atimwindow; |
| 153 | |
Holger Schurig | a2235ed | 2007-08-02 13:12:45 -0400 | [diff] [blame] | 154 | /* IW_MODE_AUTO, IW_MODE_ADHOC, IW_MODE_INFRA */ |
Dan Williams | 0dc5a29 | 2007-05-10 22:58:02 -0400 | [diff] [blame] | 155 | u8 mode; |
Holger Schurig | a2235ed | 2007-08-02 13:12:45 -0400 | [diff] [blame] | 156 | |
Dan Williams | 8c51276 | 2007-08-02 11:40:45 -0400 | [diff] [blame] | 157 | /* zero-terminated array of supported data rates */ |
| 158 | u8 rates[MAX_RATES + 1]; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 159 | |
Dan Williams | fcdb53d | 2007-05-25 16:15:56 -0400 | [diff] [blame] | 160 | unsigned long last_scanned; |
| 161 | |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 162 | union ieeetypes_phyparamset phyparamset; |
| 163 | union IEEEtypes_ssparamset ssparamset; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 164 | |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 165 | struct ieeetypes_countryinfofullset countryinfo; |
| 166 | |
Dan Williams | 51b0c9d | 2007-05-10 22:51:28 -0400 | [diff] [blame] | 167 | 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 Williams | fcdb53d | 2007-05-25 16:15:56 -0400 | [diff] [blame] | 171 | |
Luis Carlos Cobo | 1e838bf | 2007-08-02 10:51:27 -0400 | [diff] [blame] | 172 | u8 mesh; |
| 173 | |
Dan Williams | fcdb53d | 2007-05-25 16:15:56 -0400 | [diff] [blame] | 174 | struct list_head list; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 175 | }; |
| 176 | |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 177 | int lbs_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len); |
Dan Williams | fcdb53d | 2007-05-25 16:15:56 -0400 | [diff] [blame] | 178 | |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 179 | struct bss_descriptor *lbs_find_ssid_in_list(lbs_adapter *adapter, |
| 180 | u8 *ssid, u8 ssid_len, u8 *bssid, u8 mode, |
| 181 | int channel); |
Dan Williams | fcdb53d | 2007-05-25 16:15:56 -0400 | [diff] [blame] | 182 | |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 183 | struct bss_descriptor *lbs_find_bssid_in_list(lbs_adapter *adapter, |
| 184 | u8 *bssid, u8 mode); |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 185 | |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 186 | int lbs_find_best_network_ssid(lbs_private *priv, u8 *out_ssid, |
Dan Williams | d8efea2 | 2007-05-28 23:54:55 -0400 | [diff] [blame] | 187 | u8 *out_ssid_len, u8 preferred_mode, u8 *out_mode); |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 188 | |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 189 | int lbs_send_specific_ssid_scan(lbs_private *priv, u8 *ssid, |
Dan Williams | d8efea2 | 2007-05-28 23:54:55 -0400 | [diff] [blame] | 190 | u8 ssid_len, u8 clear_ssid); |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 191 | |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 192 | int lbs_cmd_80211_scan(lbs_private *priv, |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 193 | struct cmd_ds_command *cmd, |
| 194 | void *pdata_buf); |
| 195 | |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 196 | int lbs_ret_80211_scan(lbs_private *priv, |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 197 | struct cmd_ds_command *resp); |
| 198 | |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 199 | int lbs_scan_networks(lbs_private *priv, |
| 200 | const struct lbs_ioctl_user_scan_cfg *puserscanin, |
Marcelo Tosatti | 2be9219 | 2007-05-25 00:33:28 -0400 | [diff] [blame] | 201 | int full_scan); |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 202 | |
| 203 | struct ifreq; |
| 204 | |
| 205 | struct iw_point; |
| 206 | struct iw_param; |
| 207 | struct iw_request_info; |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 208 | int lbs_get_scan(struct net_device *dev, struct iw_request_info *info, |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 209 | struct iw_point *dwrq, char *extra); |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 210 | int lbs_set_scan(struct net_device *dev, struct iw_request_info *info, |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 211 | struct iw_param *vwrq, char *extra); |
| 212 | |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 213 | void lbs_scan_worker(struct work_struct *work); |
Dan Williams | 2afc0c5 | 2007-08-02 13:19:04 -0400 | [diff] [blame] | 214 | |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame^] | 215 | #endif |