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 |
| 5 | * implemented in wlan_scan.c. |
| 6 | */ |
| 7 | #ifndef _WLAN_SCAN_H |
| 8 | #define _WLAN_SCAN_H |
| 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 | * |
| 16 | * @sa wlan_ioctl_user_scan_cfg |
| 17 | */ |
| 18 | #define WLAN_IOCTL_USER_SCAN_CHAN_MAX 50 |
| 19 | |
| 20 | //! Infrastructure BSS scan type in wlan_scan_cmd_config |
| 21 | #define WLAN_SCAN_BSS_TYPE_BSS 1 |
| 22 | |
| 23 | //! Adhoc BSS scan type in wlan_scan_cmd_config |
| 24 | #define WLAN_SCAN_BSS_TYPE_IBSS 2 |
| 25 | |
| 26 | //! Adhoc or Infrastructure BSS scan type in wlan_scan_cmd_config, no filter |
| 27 | #define WLAN_SCAN_BSS_TYPE_ANY 3 |
| 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 |
| 33 | * scan command prepared by libertas_cmd_80211_scan. |
| 34 | * |
| 35 | * @sa wlan_scan_networks |
| 36 | * |
| 37 | */ |
| 38 | struct wlan_scan_cmd_config { |
| 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 | * |
| 45 | * - WLAN_SCAN_BSS_TYPE_BSS (infrastructure) |
| 46 | * - WLAN_SCAN_BSS_TYPE_IBSS (adhoc) |
| 47 | * - WLAN_SCAN_BSS_TYPE_ANY (unrestricted, adhoc and infrastructure) |
| 48 | */ |
| 49 | u8 bsstype; |
| 50 | |
| 51 | /** |
| 52 | * @brief Specific BSSID used to filter scan results in the firmware |
| 53 | */ |
| 54 | u8 specificBSSID[ETH_ALEN]; |
| 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 | /** |
| 71 | * @brief IOCTL channel sub-structure sent in wlan_ioctl_user_scan_cfg |
| 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 | */ |
| 76 | struct wlan_ioctl_user_scan_chan { |
| 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 | * |
| 86 | * Used in the setuserscan (WLAN_SET_USER_SCAN) private ioctl. Specifies |
| 87 | * a number of parameters to be used in general for the scan as well |
| 88 | * as a channel list (wlan_ioctl_user_scan_chan) for each scan period |
| 89 | * desired. |
| 90 | * |
| 91 | * @sa libertas_set_user_scan_ioctl |
| 92 | */ |
| 93 | struct wlan_ioctl_user_scan_cfg { |
| 94 | |
| 95 | /** |
| 96 | * @brief Flag set to keep the previous scan table intact |
| 97 | * |
| 98 | * If set, the scan results will accumulate, replacing any previous |
| 99 | * matched entries for a BSS with the new scan data |
| 100 | */ |
| 101 | u8 keeppreviousscan; //!< Do not erase the existing scan results |
| 102 | |
| 103 | /** |
| 104 | * @brief BSS type to be sent in the firmware command |
| 105 | * |
| 106 | * Field can be used to restrict the types of networks returned in the |
| 107 | * scan. valid settings are: |
| 108 | * |
| 109 | * - WLAN_SCAN_BSS_TYPE_BSS (infrastructure) |
| 110 | * - WLAN_SCAN_BSS_TYPE_IBSS (adhoc) |
| 111 | * - WLAN_SCAN_BSS_TYPE_ANY (unrestricted, adhoc and infrastructure) |
| 112 | */ |
| 113 | u8 bsstype; |
| 114 | |
| 115 | /** |
| 116 | * @brief Configure the number of probe requests for active chan scans |
| 117 | */ |
| 118 | u8 numprobes; |
| 119 | |
| 120 | /** |
| 121 | * @brief BSSID filter sent in the firmware command to limit the results |
| 122 | */ |
| 123 | u8 specificBSSID[ETH_ALEN]; |
| 124 | |
| 125 | /** |
| 126 | * @brief SSID filter sent in the firmware command to limit the results |
| 127 | */ |
| 128 | char specificSSID[IW_ESSID_MAX_SIZE + 1]; |
| 129 | |
| 130 | /** |
| 131 | * @brief Variable number (fixed maximum) of channels to scan up |
| 132 | */ |
| 133 | struct wlan_ioctl_user_scan_chan chanlist[WLAN_IOCTL_USER_SCAN_CHAN_MAX]; |
| 134 | }; |
| 135 | |
| 136 | /** |
| 137 | * @brief Structure used to store information for each beacon/probe response |
| 138 | */ |
| 139 | struct bss_descriptor { |
Dan Williams | 4ace113 | 2007-05-25 13:16:38 -0400 | [diff] [blame^] | 140 | u8 bssid[ETH_ALEN]; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 141 | |
| 142 | struct WLAN_802_11_SSID ssid; |
| 143 | |
| 144 | /* WEP encryption requirement */ |
| 145 | u32 privacy; |
| 146 | |
| 147 | /* receive signal strength in dBm */ |
| 148 | long rssi; |
| 149 | |
| 150 | u32 channel; |
| 151 | |
| 152 | u16 beaconperiod; |
| 153 | |
| 154 | u32 atimwindow; |
| 155 | |
Dan Williams | 0dc5a29 | 2007-05-10 22:58:02 -0400 | [diff] [blame] | 156 | u8 mode; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 157 | u8 libertas_supported_rates[WLAN_SUPPORTED_RATES]; |
| 158 | |
| 159 | int extra_ie; |
| 160 | |
| 161 | u8 timestamp[8]; //!< TSF value included in the beacon/probe response |
| 162 | union ieeetypes_phyparamset phyparamset; |
| 163 | union IEEEtypes_ssparamset ssparamset; |
| 164 | struct ieeetypes_capinfo cap; |
| 165 | u8 datarates[WLAN_SUPPORTED_RATES]; |
| 166 | |
| 167 | __le64 networktsf; //!< TSF timestamp from the current firmware TSF |
| 168 | |
| 169 | struct ieeetypes_countryinfofullset countryinfo; |
| 170 | |
Dan Williams | 51b0c9d | 2007-05-10 22:51:28 -0400 | [diff] [blame] | 171 | u8 wpa_ie[MAX_WPA_IE_LEN]; |
| 172 | size_t wpa_ie_len; |
| 173 | u8 rsn_ie[MAX_WPA_IE_LEN]; |
| 174 | size_t rsn_ie_len; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 175 | }; |
| 176 | |
| 177 | extern int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1, |
| 178 | struct WLAN_802_11_SSID *ssid2); |
| 179 | extern int libertas_find_SSID_in_list(wlan_adapter * adapter, struct WLAN_802_11_SSID *ssid, |
Dan Williams | 0dc5a29 | 2007-05-10 22:58:02 -0400 | [diff] [blame] | 180 | u8 * bssid, u8 mode); |
| 181 | int libertas_find_best_SSID_in_list(wlan_adapter * adapter, u8 mode); |
| 182 | extern int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, u8 mode); |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 183 | |
| 184 | int libertas_find_best_network_SSID(wlan_private * priv, |
| 185 | struct WLAN_802_11_SSID *pSSID, |
Dan Williams | 0dc5a29 | 2007-05-10 22:58:02 -0400 | [diff] [blame] | 186 | u8 preferred_mode, u8 *out_mode); |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 187 | |
| 188 | extern int libertas_send_specific_SSID_scan(wlan_private * priv, |
| 189 | struct WLAN_802_11_SSID *prequestedssid, |
| 190 | u8 keeppreviousscan); |
| 191 | extern int libertas_send_specific_BSSID_scan(wlan_private * priv, |
| 192 | u8 * bssid, u8 keeppreviousscan); |
| 193 | |
| 194 | extern int libertas_cmd_80211_scan(wlan_private * priv, |
| 195 | struct cmd_ds_command *cmd, |
| 196 | void *pdata_buf); |
| 197 | |
| 198 | extern int libertas_ret_80211_scan(wlan_private * priv, |
| 199 | struct cmd_ds_command *resp); |
| 200 | |
| 201 | int wlan_scan_networks(wlan_private * priv, |
Marcelo Tosatti | 2be9219 | 2007-05-25 00:33:28 -0400 | [diff] [blame] | 202 | const struct wlan_ioctl_user_scan_cfg * puserscanin, |
| 203 | int full_scan); |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 204 | |
| 205 | struct ifreq; |
| 206 | |
| 207 | struct iw_point; |
| 208 | struct iw_param; |
| 209 | struct iw_request_info; |
| 210 | extern int libertas_get_scan(struct net_device *dev, struct iw_request_info *info, |
| 211 | struct iw_point *dwrq, char *extra); |
| 212 | extern int libertas_set_scan(struct net_device *dev, struct iw_request_info *info, |
| 213 | struct iw_param *vwrq, char *extra); |
| 214 | |
| 215 | #endif /* _WLAN_SCAN_H */ |