18d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/*
28d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Driver interface definition
3fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt * Copyright (c) 2003-2014, Jouni Malinen <j@w1.fi>
48d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt *
5c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * This software may be distributed under the terms of the BSD license.
6c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * See README for more details.
78d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt *
88d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This file defines a driver interface used by both %wpa_supplicant and
98d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * hostapd. The first part of the file defines data structures used in various
108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * driver operations. This is followed by the struct wpa_driver_ops that each
118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * driver wrapper will beed to define with callback functions for requesting
128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * driver operations. After this, there are definitions for driver event
138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * reporting with wpa_supplicant_event() and some convenience helper functions
148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * that can be used to report events.
158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */
168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#ifndef DRIVER_H
188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define DRIVER_H
198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_SUPPLICANT_DRIVER_VERSION 4
218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "common/defs.h"
23b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt#include "utils/list.h"
248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define HOSTAPD_CHAN_DISABLED 0x00000001
268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define HOSTAPD_CHAN_PASSIVE_SCAN 0x00000002
278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define HOSTAPD_CHAN_NO_IBSS 0x00000004
288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define HOSTAPD_CHAN_RADAR 0x00000008
298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define HOSTAPD_CHAN_HT40PLUS 0x00000010
308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define HOSTAPD_CHAN_HT40MINUS 0x00000020
318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define HOSTAPD_CHAN_HT40 0x00000040
32391c59f0632df8db1c325da1d31d479b2eedce45Dmitry Shmidt#define HOSTAPD_CHAN_SURVEY_LIST_INITIALIZED 0x00000080
338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
34ea69e84a6f4455c59348485895d3d5e3af77a65bDmitry Shmidt#define HOSTAPD_CHAN_DFS_UNKNOWN 0x00000000
35ea69e84a6f4455c59348485895d3d5e3af77a65bDmitry Shmidt#define HOSTAPD_CHAN_DFS_USABLE 0x00000100
36ea69e84a6f4455c59348485895d3d5e3af77a65bDmitry Shmidt#define HOSTAPD_CHAN_DFS_UNAVAILABLE 0x00000200
37ea69e84a6f4455c59348485895d3d5e3af77a65bDmitry Shmidt#define HOSTAPD_CHAN_DFS_AVAILABLE 0x00000300
38ea69e84a6f4455c59348485895d3d5e3af77a65bDmitry Shmidt#define HOSTAPD_CHAN_DFS_MASK 0x00000300
39ea69e84a6f4455c59348485895d3d5e3af77a65bDmitry Shmidt
4068d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt#define HOSTAPD_CHAN_VHT_10_70 0x00000800
4168d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt#define HOSTAPD_CHAN_VHT_30_50 0x00001000
4268d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt#define HOSTAPD_CHAN_VHT_50_30 0x00002000
4368d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt#define HOSTAPD_CHAN_VHT_70_10 0x00004000
4468d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt
45e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidtenum reg_change_initiator {
46e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt	REGDOM_SET_BY_CORE,
47e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt	REGDOM_SET_BY_USER,
48e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt	REGDOM_SET_BY_DRIVER,
49e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt	REGDOM_SET_BY_COUNTRY_IE,
509767226d8e6a1adaa33beb9f517ef40dddfa460cDmitry Shmidt	REGDOM_BEACON_HINT,
51e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt};
52e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt
537dba0e5708da7276a43a44cf479aa743564e15b9Dmitry Shmidtenum reg_type {
547dba0e5708da7276a43a44cf479aa743564e15b9Dmitry Shmidt	REGDOM_TYPE_UNKNOWN,
557dba0e5708da7276a43a44cf479aa743564e15b9Dmitry Shmidt	REGDOM_TYPE_COUNTRY,
567dba0e5708da7276a43a44cf479aa743564e15b9Dmitry Shmidt	REGDOM_TYPE_WORLD,
577dba0e5708da7276a43a44cf479aa743564e15b9Dmitry Shmidt	REGDOM_TYPE_CUSTOM_WORLD,
587dba0e5708da7276a43a44cf479aa743564e15b9Dmitry Shmidt	REGDOM_TYPE_INTERSECTION,
597dba0e5708da7276a43a44cf479aa743564e15b9Dmitry Shmidt};
607dba0e5708da7276a43a44cf479aa743564e15b9Dmitry Shmidt
618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/**
628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct hostapd_channel_data - Channel information
638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */
648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct hostapd_channel_data {
658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * chan - Channel number (IEEE 802.11)
678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	short chan;
698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * freq - Frequency in MHz
728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
73d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt	int freq;
748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * flag - Channel flags (HOSTAPD_CHAN_*)
778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int flag;
798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
8168d0e3ed07847339aedfac8e02f50db68c702e52Dmitry Shmidt	 * max_tx_power - Regulatory transmit power limit in dBm
828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 max_tx_power;
84b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt
85b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	/*
86b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	 * survey_list - Linked list of surveys
87b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	 */
88b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	struct dl_list survey_list;
89b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt
90b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	/**
91b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	 * min_nf - Minimum observed noise floor, in dBm, based on all
92b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	 * surveyed channel data
93b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	 */
94b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	s8 min_nf;
95391c59f0632df8db1c325da1d31d479b2eedce45Dmitry Shmidt
96391c59f0632df8db1c325da1d31d479b2eedce45Dmitry Shmidt#ifdef CONFIG_ACS
97391c59f0632df8db1c325da1d31d479b2eedce45Dmitry Shmidt	/**
98391c59f0632df8db1c325da1d31d479b2eedce45Dmitry Shmidt	 * interference_factor - Computed interference factor on this
99391c59f0632df8db1c325da1d31d479b2eedce45Dmitry Shmidt	 * channel (used internally in src/ap/acs.c; driver wrappers do not
100391c59f0632df8db1c325da1d31d479b2eedce45Dmitry Shmidt	 * need to set this)
101391c59f0632df8db1c325da1d31d479b2eedce45Dmitry Shmidt	 */
102391c59f0632df8db1c325da1d31d479b2eedce45Dmitry Shmidt	long double interference_factor;
103391c59f0632df8db1c325da1d31d479b2eedce45Dmitry Shmidt#endif /* CONFIG_ACS */
104df5a7e4c5c64890c2425bb47d665bbce4992b676Dmitry Shmidt
105df5a7e4c5c64890c2425bb47d665bbce4992b676Dmitry Shmidt	/* DFS CAC time in milliseconds */
106df5a7e4c5c64890c2425bb47d665bbce4992b676Dmitry Shmidt	unsigned int dfs_cac_ms;
1078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt};
1088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1091f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt#define HOSTAPD_MODE_FLAG_HT_INFO_KNOWN BIT(0)
110c2ebb4b85d69b65f552fee71ac68f44e8d87b39eDmitry Shmidt#define HOSTAPD_MODE_FLAG_VHT_INFO_KNOWN BIT(1)
1111f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt
1128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/**
1138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct hostapd_hw_modes - Supported hardware mode information
1148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */
1158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct hostapd_hw_modes {
1168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
1178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * mode - Hardware mode
1188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
1198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	enum hostapd_hw_mode mode;
1208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
1228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * num_channels - Number of entries in the channels array
1238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
1248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int num_channels;
1258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
1278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * channels - Array of supported channels
1288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
1298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct hostapd_channel_data *channels;
1308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
1328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * num_rates - Number of entries in the rates array
1338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
1348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int num_rates;
1358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
1378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * rates - Array of supported rates in 100 kbps units
1388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
1398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int *rates;
1408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
1428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * ht_capab - HT (IEEE 802.11n) capabilities
1438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
1448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u16 ht_capab;
1458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
1478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * mcs_set - MCS (IEEE 802.11n) rate parameters
1488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
1498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 mcs_set[16];
1508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
1528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * a_mpdu_params - A-MPDU (IEEE 802.11n) parameters
1538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
1548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 a_mpdu_params;
1551f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt
15604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	/**
15704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	 * vht_capab - VHT (IEEE 802.11ac) capabilities
15804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	 */
15904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	u32 vht_capab;
16004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt
16104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	/**
16204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	 * vht_mcs_set - VHT MCS (IEEE 802.11ac) rate parameters
16304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	 */
16404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	u8 vht_mcs_set[8];
16504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt
1661f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	unsigned int flags; /* HOSTAPD_MODE_FLAG_* */
1678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt};
1688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define IEEE80211_MODE_INFRA	0
1718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define IEEE80211_MODE_IBSS	1
1728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define IEEE80211_MODE_AP	2
1738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define IEEE80211_CAP_ESS	0x0001
1758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define IEEE80211_CAP_IBSS	0x0002
1768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define IEEE80211_CAP_PRIVACY	0x0010
1778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
178f86232838cf712377867cb42417c1613ab5dc425Dmitry Shmidt/* DMG (60 GHz) IEEE 802.11ad */
179f86232838cf712377867cb42417c1613ab5dc425Dmitry Shmidt/* type - bits 0..1 */
180f86232838cf712377867cb42417c1613ab5dc425Dmitry Shmidt#define IEEE80211_CAP_DMG_MASK	0x0003
181f86232838cf712377867cb42417c1613ab5dc425Dmitry Shmidt#define IEEE80211_CAP_DMG_IBSS	0x0001 /* Tx by: STA */
182f86232838cf712377867cb42417c1613ab5dc425Dmitry Shmidt#define IEEE80211_CAP_DMG_PBSS	0x0002 /* Tx by: PCP */
183f86232838cf712377867cb42417c1613ab5dc425Dmitry Shmidt#define IEEE80211_CAP_DMG_AP	0x0003 /* Tx by: AP */
184f86232838cf712377867cb42417c1613ab5dc425Dmitry Shmidt
1858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_SCAN_QUAL_INVALID		BIT(0)
1868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_SCAN_NOISE_INVALID		BIT(1)
1878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_SCAN_LEVEL_INVALID		BIT(2)
1888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_SCAN_LEVEL_DBM		BIT(3)
1898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_SCAN_AUTHENTICATED		BIT(4)
1908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_SCAN_ASSOCIATED		BIT(5)
1918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/**
1938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct wpa_scan_res - Scan result for an BSS/IBSS
1948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @flags: information flags about the BSS/IBSS (WPA_SCAN_*)
1958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: BSSID
1968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @freq: frequency of the channel in MHz (e.g., 2412 = channel 1)
1978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @beacon_int: beacon interval in TUs (host byte order)
1988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @caps: capability information field in host byte order
1998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @qual: signal quality
2008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @noise: noise level
2018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @level: signal level
2028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @tsf: Timestamp
2038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @age: Age of the information in milliseconds (i.e., how many milliseconds
2048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * ago the last Beacon or Probe Response frame was received)
2058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ie_len: length of the following IE field in octets
2068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @beacon_ie_len: length of the following Beacon IE field in octets
2078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt *
2088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This structure is used as a generic format for scan results from the
2098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * driver. Each driver interface implementation is responsible for converting
2108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the driver or OS specific scan results into this format.
2118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt *
2128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * If the driver does not support reporting all IEs, the IE data structure is
2138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * constructed of the IEs that are available. This field will also need to
2148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * include SSID in IE format. All drivers are encouraged to be extended to
2158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * report all IEs to make it easier to support future additions.
2168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */
2178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct wpa_scan_res {
2188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	unsigned int flags;
2198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 bssid[ETH_ALEN];
2208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int freq;
2218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u16 beacon_int;
2228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u16 caps;
2238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int qual;
2248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int noise;
2258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int level;
2268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u64 tsf;
2278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	unsigned int age;
2288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	size_t ie_len;
2298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	size_t beacon_ie_len;
2308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/*
2318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * Followed by ie_len octets of IEs from Probe Response frame (or if
2328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * the driver does not indicate source of IEs, these may also be from
2338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * Beacon frame). After the first set of IEs, another set of IEs may
2348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * follow (with beacon_ie_len octets of data) if the driver provides
2358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * both IE sets.
2368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
2378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt};
2388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/**
2408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct wpa_scan_results - Scan results
2418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @res: Array of pointers to allocated variable length scan result entries
2428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @num: Number of entries in the scan result array
243f86232838cf712377867cb42417c1613ab5dc425Dmitry Shmidt * @fetch_time: Time when the results were fetched from the driver
2448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */
2458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct wpa_scan_results {
2468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct wpa_scan_res **res;
2478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	size_t num;
248fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt	struct os_reltime fetch_time;
2498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt};
2508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/**
2528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct wpa_interface_info - Network interface information
2538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @next: Pointer to the next interface or NULL if this is the last one
2548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ifname: Interface name that can be used with init() or init2()
2558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @desc: Human readable adapter description (e.g., vendor/model) or NULL if
2568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt *	not available
2578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @drv_name: struct wpa_driver_ops::name (note: unlike other strings, this one
2588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt *	is not an allocated copy, i.e., get_interfaces() caller will not free
2598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt *	this)
2608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */
2618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct wpa_interface_info {
2628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct wpa_interface_info *next;
2638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	char *ifname;
2648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	char *desc;
2658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const char *drv_name;
2668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt};
2678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2681f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt#define WPAS_MAX_SCAN_SSIDS 16
2698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/**
2718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct wpa_driver_scan_params - Scan parameters
2728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Data for struct wpa_driver_ops::scan2().
2738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */
2748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct wpa_driver_scan_params {
2758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
2768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * ssids - SSIDs to scan for
2778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
2788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct wpa_driver_scan_ssid {
2798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		/**
2808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 * ssid - specific SSID to scan for (ProbeReq)
2818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 * %NULL or zero-length SSID is used to indicate active scan
2828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 * with wildcard SSID.
2838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 */
2848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		const u8 *ssid;
2858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		/**
2868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 * ssid_len: Length of the SSID in octets
2878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		 */
2888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		size_t ssid_len;
2898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	} ssids[WPAS_MAX_SCAN_SSIDS];
2908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
2928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * num_ssids - Number of entries in ssids array
2938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * Zero indicates a request for a passive scan.
2948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
2958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	size_t num_ssids;
2968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
2988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * extra_ies - Extra IE(s) to add into Probe Request or %NULL
2998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
3008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *extra_ies;
3018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
3038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * extra_ies_len - Length of extra_ies in octets
3048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
3058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	size_t extra_ies_len;
3068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
3088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * freqs - Array of frequencies to scan or %NULL for all frequencies
3098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 *
3108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * The frequency is set in MHz. The array is zero-terminated.
3118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
3128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int *freqs;
3138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
3158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * filter_ssids - Filter for reporting SSIDs
3168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 *
3178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * This optional parameter can be used to request the driver wrapper to
3188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * filter scan results to include only the specified SSIDs. %NULL
3198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * indicates that no filtering is to be done. This can be used to
3208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * reduce memory needs for scan results in environments that have large
3218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * number of APs with different SSIDs.
3228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 *
3238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * The driver wrapper is allowed to take this allocated buffer into its
3248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * own use by setting the pointer to %NULL. In that case, the driver
3258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * wrapper is responsible for freeing the buffer with os_free() once it
3268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * is not needed anymore.
3278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
3288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct wpa_driver_scan_filter {
3298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		u8 ssid[32];
3308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		size_t ssid_len;
3318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	} *filter_ssids;
3328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/**
3348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * num_filter_ssids - Number of entries in filter_ssids array
3358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
3368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	size_t num_filter_ssids;
3371f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt
3381f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	/**
33961d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt	 * filter_rssi - Filter by RSSI
34061d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt	 *
34161d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt	 * The driver may filter scan results in firmware to reduce host
34261d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt	 * wakeups and thereby save power. Specify the RSSI threshold in s32
34361d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt	 * dBm.
34461d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt	 */
34561d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt	s32 filter_rssi;
34661d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt
34761d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt	/**
3481f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	 * p2p_probe - Used to disable CCK (802.11b) rates for P2P probes
3491f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	 *
3501f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	 * When set, the driver is expected to remove rates 1, 2, 5.5, and 11
3511f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	 * Mbps from the support rates element(s) in the Probe Request frames
3521f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	 * and not to transmit the frames at any of those rates.
3531f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	 */
3542271d3fdd5982d0e5e81cf9999a861bba933eacbDmitry Shmidt	unsigned int p2p_probe:1;
355fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt
356fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt	/**
357fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt	 * only_new_results - Request driver to report only new results
358fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt	 *
359fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt	 * This is used to request the driver to report only BSSes that have
360fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt	 * been detected after this scan request has been started, i.e., to
361fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt	 * flush old cached BSS entries.
362