blob: 10d1196acf784db8e5c5e052f579942ec7c13b3d [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
13/**
14 * @brief Maximum number of channels that can be sent in a setuserscan ioctl
15 *
Holger Schurig10078322007-11-15 18:05:47 -050016 * @sa lbs_ioctl_user_scan_cfg
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020017 */
Holger Schurig10078322007-11-15 18:05:47 -050018#define LBS_IOCTL_USER_SCAN_CHAN_MAX 50
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020019
David Woodhousefa62f992008-03-03 12:18:03 +010020//! Infrastructure BSS scan type in cmd_ds_802_11_scan
Holger Schurig10078322007-11-15 18:05:47 -050021#define LBS_SCAN_BSS_TYPE_BSS 1
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020022
David Woodhousefa62f992008-03-03 12:18:03 +010023//! Adhoc BSS scan type in cmd_ds_802_11_scan
Holger Schurig10078322007-11-15 18:05:47 -050024#define LBS_SCAN_BSS_TYPE_IBSS 2
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020025
David Woodhousefa62f992008-03-03 12:18:03 +010026//! Adhoc or Infrastructure BSS scan type in cmd_ds_802_11_scan, no filter
Holger Schurig10078322007-11-15 18:05:47 -050027#define LBS_SCAN_BSS_TYPE_ANY 3
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020028
29/**
Holger Schurig10078322007-11-15 18:05:47 -050030 * @brief IOCTL channel sub-structure sent in lbs_ioctl_user_scan_cfg
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020031 *
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 Schurig10078322007-11-15 18:05:47 -050035struct lbs_ioctl_user_scan_chan {
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020036 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 Schurig10078322007-11-15 18:05:47 -050045 * Used in the setuserscan (LBS_SET_USER_SCAN) private ioctl. Specifies
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020046 * a number of parameters to be used in general for the scan as well
Holger Schurig10078322007-11-15 18:05:47 -050047 * as a channel list (lbs_ioctl_user_scan_chan) for each scan period
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020048 * desired.
49 *
Holger Schurig10078322007-11-15 18:05:47 -050050 * @sa lbs_set_user_scan_ioctl
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020051 */
Holger Schurig10078322007-11-15 18:05:47 -050052struct lbs_ioctl_user_scan_cfg {
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020053 /**
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 Schurig10078322007-11-15 18:05:47 -050059 * - LBS_SCAN_BSS_TYPE_BSS (infrastructure)
60 * - LBS_SCAN_BSS_TYPE_IBSS (adhoc)
61 * - LBS_SCAN_BSS_TYPE_ANY (unrestricted, adhoc and infrastructure)
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020062 */
63 u8 bsstype;
64
Dan Williamseb8f7332007-05-25 16:25:21 -040065 /**
66 * @brief BSSID filter sent in the firmware command to limit the results
67 */
68 u8 bssid[ETH_ALEN];
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020069
Dan Williamseb8f7332007-05-25 16:25:21 -040070 /* 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 Tosatti876c9d32007-02-10 12:25:27 -020081};
82
83/**
84 * @brief Structure used to store information for each beacon/probe response
85 */
86struct bss_descriptor {
Dan Williams4ace1132007-05-25 13:16:38 -040087 u8 bssid[ETH_ALEN];
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020088
Dan Williamsd8efea22007-05-28 23:54:55 -040089 u8 ssid[IW_ESSID_MAX_SIZE + 1];
90 u8 ssid_len;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020091
Dan Williams0c9ca692007-08-02 10:43:44 -040092 u16 capability;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020093
94 /* receive signal strength in dBm */
95 long rssi;
96
97 u32 channel;
98
99 u16 beaconperiod;
100
101 u32 atimwindow;
102
Holger Schuriga2235ed2007-08-02 13:12:45 -0400103 /* IW_MODE_AUTO, IW_MODE_ADHOC, IW_MODE_INFRA */
Dan Williams0dc5a292007-05-10 22:58:02 -0400104 u8 mode;
Holger Schuriga2235ed2007-08-02 13:12:45 -0400105
Dan Williams8c512762007-08-02 11:40:45 -0400106 /* zero-terminated array of supported data rates */
107 u8 rates[MAX_RATES + 1];
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200108
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400109 unsigned long last_scanned;
110
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200111 union ieeetypes_phyparamset phyparamset;
112 union IEEEtypes_ssparamset ssparamset;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200113
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200114 struct ieeetypes_countryinfofullset countryinfo;
115
Dan Williams51b0c9d2007-05-10 22:51:28 -0400116 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 Williamsfcdb53d2007-05-25 16:15:56 -0400120
Luis Carlos Cobo1e838bf2007-08-02 10:51:27 -0400121 u8 mesh;
122
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400123 struct list_head list;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200124};
125
Holger Schurig10078322007-11-15 18:05:47 -0500126int lbs_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len);
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400127
David Woodhouseaa21c002007-12-08 20:04:36 +0000128struct bss_descriptor *lbs_find_ssid_in_list(struct lbs_private *priv,
Holger Schurig10078322007-11-15 18:05:47 -0500129 u8 *ssid, u8 ssid_len, u8 *bssid, u8 mode,
130 int channel);
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400131
David Woodhouseaa21c002007-12-08 20:04:36 +0000132struct bss_descriptor *lbs_find_bssid_in_list(struct lbs_private *priv,
Holger Schurig10078322007-11-15 18:05:47 -0500133 u8 *bssid, u8 mode);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200134
Holger Schurig69f90322007-11-23 15:43:44 +0100135int lbs_find_best_network_ssid(struct lbs_private *priv, u8 *out_ssid,
Dan Williamsd8efea22007-05-28 23:54:55 -0400136 u8 *out_ssid_len, u8 preferred_mode, u8 *out_mode);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200137
Holger Schurig69f90322007-11-23 15:43:44 +0100138int lbs_send_specific_ssid_scan(struct lbs_private *priv, u8 *ssid,
Dan Williamsd8efea22007-05-28 23:54:55 -0400139 u8 ssid_len, u8 clear_ssid);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200140
Holger Schurig69f90322007-11-23 15:43:44 +0100141int lbs_scan_networks(struct lbs_private *priv,
Holger Schurig10078322007-11-15 18:05:47 -0500142 const struct lbs_ioctl_user_scan_cfg *puserscanin,
Marcelo Tosatti2be92192007-05-25 00:33:28 -0400143 int full_scan);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200144
145struct ifreq;
146
147struct iw_point;
148struct iw_param;
149struct iw_request_info;
Holger Schurig10078322007-11-15 18:05:47 -0500150int lbs_get_scan(struct net_device *dev, struct iw_request_info *info,
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200151 struct iw_point *dwrq, char *extra);
Holger Schurig10078322007-11-15 18:05:47 -0500152int lbs_set_scan(struct net_device *dev, struct iw_request_info *info,
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200153 struct iw_param *vwrq, char *extra);
154
Holger Schurig10078322007-11-15 18:05:47 -0500155void lbs_scan_worker(struct work_struct *work);
Dan Williams2afc0c52007-08-02 13:19:04 -0400156
Holger Schurig10078322007-11-15 18:05:47 -0500157#endif