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 | |
David Woodhouse | fa62f99 | 2008-03-03 12:18:03 +0100 | [diff] [blame^] | 20 | //! Infrastructure BSS scan type in cmd_ds_802_11_scan |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame] | 21 | #define LBS_SCAN_BSS_TYPE_BSS 1 |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 22 | |
David Woodhouse | fa62f99 | 2008-03-03 12:18:03 +0100 | [diff] [blame^] | 23 | //! Adhoc BSS scan type in cmd_ds_802_11_scan |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame] | 24 | #define LBS_SCAN_BSS_TYPE_IBSS 2 |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 25 | |
David Woodhouse | fa62f99 | 2008-03-03 12:18:03 +0100 | [diff] [blame^] | 26 | //! Adhoc or Infrastructure BSS scan type in cmd_ds_802_11_scan, no filter |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame] | 27 | #define LBS_SCAN_BSS_TYPE_ANY 3 |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 28 | |
| 29 | /** |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame] | 30 | * @brief IOCTL channel sub-structure sent in lbs_ioctl_user_scan_cfg |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 31 | * |
| 32 | * Multiple instances of this structure are included in the IOCTL command |
| 33 | * to configure a instance of a scan on the specific channel. |
| 34 | */ |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame] | 35 | struct lbs_ioctl_user_scan_chan { |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 36 | u8 channumber; //!< channel Number to scan |
| 37 | u8 radiotype; //!< Radio type: 'B/G' band = 0, 'A' band = 1 |
| 38 | u8 scantype; //!< Scan type: Active = 0, Passive = 1 |
| 39 | u16 scantime; //!< Scan duration in milliseconds; if 0 default used |
| 40 | }; |
| 41 | |
| 42 | /** |
| 43 | * @brief IOCTL input structure to configure an immediate scan cmd to firmware |
| 44 | * |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame] | 45 | * Used in the setuserscan (LBS_SET_USER_SCAN) private ioctl. Specifies |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 46 | * 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] | 47 | * 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] | 48 | * desired. |
| 49 | * |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame] | 50 | * @sa lbs_set_user_scan_ioctl |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 51 | */ |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame] | 52 | struct lbs_ioctl_user_scan_cfg { |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 53 | /** |
| 54 | * @brief BSS type to be sent in the firmware command |
| 55 | * |
| 56 | * Field can be used to restrict the types of networks returned in the |
| 57 | * scan. valid settings are: |
| 58 | * |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame] | 59 | * - LBS_SCAN_BSS_TYPE_BSS (infrastructure) |
| 60 | * - LBS_SCAN_BSS_TYPE_IBSS (adhoc) |
| 61 | * - LBS_SCAN_BSS_TYPE_ANY (unrestricted, adhoc and infrastructure) |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 62 | */ |
| 63 | u8 bsstype; |
| 64 | |
Dan Williams | eb8f733 | 2007-05-25 16:25:21 -0400 | [diff] [blame] | 65 | /** |
| 66 | * @brief BSSID filter sent in the firmware command to limit the results |
| 67 | */ |
| 68 | u8 bssid[ETH_ALEN]; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 69 | |
Dan Williams | eb8f733 | 2007-05-25 16:25:21 -0400 | [diff] [blame] | 70 | /* Clear existing scan results matching this BSSID */ |
| 71 | u8 clear_bssid; |
| 72 | |
| 73 | /** |
| 74 | * @brief SSID filter sent in the firmware command to limit the results |
| 75 | */ |
| 76 | char ssid[IW_ESSID_MAX_SIZE]; |
| 77 | u8 ssid_len; |
| 78 | |
| 79 | /* Clear existing scan results matching this SSID */ |
| 80 | u8 clear_ssid; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 81 | }; |
| 82 | |
| 83 | /** |
| 84 | * @brief Structure used to store information for each beacon/probe response |
| 85 | */ |
| 86 | struct bss_descriptor { |
Dan Williams | 4ace113 | 2007-05-25 13:16:38 -0400 | [diff] [blame] | 87 | u8 bssid[ETH_ALEN]; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 88 | |
Dan Williams | d8efea2 | 2007-05-28 23:54:55 -0400 | [diff] [blame] | 89 | u8 ssid[IW_ESSID_MAX_SIZE + 1]; |
| 90 | u8 ssid_len; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 91 | |
Dan Williams | 0c9ca69 | 2007-08-02 10:43:44 -0400 | [diff] [blame] | 92 | u16 capability; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 93 | |
| 94 | /* receive signal strength in dBm */ |
| 95 | long rssi; |
| 96 | |
| 97 | u32 channel; |
| 98 | |
| 99 | u16 beaconperiod; |
| 100 | |
| 101 | u32 atimwindow; |
| 102 | |
Holger Schurig | a2235ed | 2007-08-02 13:12:45 -0400 | [diff] [blame] | 103 | /* IW_MODE_AUTO, IW_MODE_ADHOC, IW_MODE_INFRA */ |
Dan Williams | 0dc5a29 | 2007-05-10 22:58:02 -0400 | [diff] [blame] | 104 | u8 mode; |
Holger Schurig | a2235ed | 2007-08-02 13:12:45 -0400 | [diff] [blame] | 105 | |
Dan Williams | 8c51276 | 2007-08-02 11:40:45 -0400 | [diff] [blame] | 106 | /* zero-terminated array of supported data rates */ |
| 107 | u8 rates[MAX_RATES + 1]; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 108 | |
Dan Williams | fcdb53d | 2007-05-25 16:15:56 -0400 | [diff] [blame] | 109 | unsigned long last_scanned; |
| 110 | |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 111 | union ieeetypes_phyparamset phyparamset; |
| 112 | union IEEEtypes_ssparamset ssparamset; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 113 | |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 114 | struct ieeetypes_countryinfofullset countryinfo; |
| 115 | |
Dan Williams | 51b0c9d | 2007-05-10 22:51:28 -0400 | [diff] [blame] | 116 | u8 wpa_ie[MAX_WPA_IE_LEN]; |
| 117 | size_t wpa_ie_len; |
| 118 | u8 rsn_ie[MAX_WPA_IE_LEN]; |
| 119 | size_t rsn_ie_len; |
Dan Williams | fcdb53d | 2007-05-25 16:15:56 -0400 | [diff] [blame] | 120 | |
Luis Carlos Cobo | 1e838bf | 2007-08-02 10:51:27 -0400 | [diff] [blame] | 121 | u8 mesh; |
| 122 | |
Dan Williams | fcdb53d | 2007-05-25 16:15:56 -0400 | [diff] [blame] | 123 | struct list_head list; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 124 | }; |
| 125 | |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame] | 126 | 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] | 127 | |
David Woodhouse | aa21c00 | 2007-12-08 20:04:36 +0000 | [diff] [blame] | 128 | struct bss_descriptor *lbs_find_ssid_in_list(struct lbs_private *priv, |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame] | 129 | u8 *ssid, u8 ssid_len, u8 *bssid, u8 mode, |
| 130 | int channel); |
Dan Williams | fcdb53d | 2007-05-25 16:15:56 -0400 | [diff] [blame] | 131 | |
David Woodhouse | aa21c00 | 2007-12-08 20:04:36 +0000 | [diff] [blame] | 132 | struct bss_descriptor *lbs_find_bssid_in_list(struct lbs_private *priv, |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame] | 133 | u8 *bssid, u8 mode); |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 134 | |
Holger Schurig | 69f9032 | 2007-11-23 15:43:44 +0100 | [diff] [blame] | 135 | int lbs_find_best_network_ssid(struct lbs_private *priv, u8 *out_ssid, |
Dan Williams | d8efea2 | 2007-05-28 23:54:55 -0400 | [diff] [blame] | 136 | u8 *out_ssid_len, u8 preferred_mode, u8 *out_mode); |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 137 | |
Holger Schurig | 69f9032 | 2007-11-23 15:43:44 +0100 | [diff] [blame] | 138 | int lbs_send_specific_ssid_scan(struct lbs_private *priv, u8 *ssid, |
Dan Williams | d8efea2 | 2007-05-28 23:54:55 -0400 | [diff] [blame] | 139 | u8 ssid_len, u8 clear_ssid); |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 140 | |
Holger Schurig | 69f9032 | 2007-11-23 15:43:44 +0100 | [diff] [blame] | 141 | int lbs_scan_networks(struct lbs_private *priv, |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame] | 142 | const struct lbs_ioctl_user_scan_cfg *puserscanin, |
Marcelo Tosatti | 2be9219 | 2007-05-25 00:33:28 -0400 | [diff] [blame] | 143 | int full_scan); |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 144 | |
| 145 | struct ifreq; |
| 146 | |
| 147 | struct iw_point; |
| 148 | struct iw_param; |
| 149 | struct iw_request_info; |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame] | 150 | 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] | 151 | struct iw_point *dwrq, char *extra); |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame] | 152 | 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] | 153 | struct iw_param *vwrq, char *extra); |
| 154 | |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame] | 155 | void lbs_scan_worker(struct work_struct *work); |
Dan Williams | 2afc0c5 | 2007-08-02 13:19:04 -0400 | [diff] [blame] | 156 | |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame] | 157 | #endif |