xref: /freebsd/contrib/wpa/src/drivers/driver_nl80211.h (revision a90b9d0159070121c221b966469c3e36d912bf82)
15b9c547cSRui Paulo /*
25b9c547cSRui Paulo  * Driver interaction with Linux nl80211/cfg80211 - definitions
35b9c547cSRui Paulo  * Copyright (c) 2002-2014, Jouni Malinen <j@w1.fi>
45b9c547cSRui Paulo  * Copyright (c) 2003-2004, Instant802 Networks, Inc.
55b9c547cSRui Paulo  * Copyright (c) 2005-2006, Devicescape Software, Inc.
65b9c547cSRui Paulo  * Copyright (c) 2007, Johannes Berg <johannes@sipsolutions.net>
75b9c547cSRui Paulo  * Copyright (c) 2009-2010, Atheros Communications
85b9c547cSRui Paulo  *
95b9c547cSRui Paulo  * This software may be distributed under the terms of the BSD license.
105b9c547cSRui Paulo  * See README for more details.
115b9c547cSRui Paulo  */
125b9c547cSRui Paulo 
135b9c547cSRui Paulo #ifndef DRIVER_NL80211_H
145b9c547cSRui Paulo #define DRIVER_NL80211_H
155b9c547cSRui Paulo 
165b9c547cSRui Paulo #include "nl80211_copy.h"
175b9c547cSRui Paulo #include "utils/list.h"
185b9c547cSRui Paulo #include "driver.h"
195b9c547cSRui Paulo 
20c1d255d3SCy Schubert #ifndef NL_CAPABILITY_VERSION_3_5_0
21c1d255d3SCy Schubert #define nla_nest_start(msg, attrtype) \
22c1d255d3SCy Schubert 	nla_nest_start(msg, NLA_F_NESTED | (attrtype))
23c1d255d3SCy Schubert #endif
245b9c547cSRui Paulo 
255b9c547cSRui Paulo struct nl80211_global {
26780fb4a2SCy Schubert 	void *ctx;
275b9c547cSRui Paulo 	struct dl_list interfaces;
285b9c547cSRui Paulo 	int if_add_ifindex;
295b9c547cSRui Paulo 	u64 if_add_wdevid;
305b9c547cSRui Paulo 	int if_add_wdevid_set;
315b9c547cSRui Paulo 	struct netlink_data *netlink;
325b9c547cSRui Paulo 	struct nl_cb *nl_cb;
33c1d255d3SCy Schubert 	struct nl_sock *nl;
345b9c547cSRui Paulo 	int nl80211_id;
35*a90b9d01SCy Schubert 	unsigned int nl80211_maxattr;
364b72b91aSCy Schubert 	int nlctrl_id;
375b9c547cSRui Paulo 	int ioctl_sock; /* socket for ioctl() use */
385b9c547cSRui Paulo 
39c1d255d3SCy Schubert 	struct nl_sock *nl_event;
405b9c547cSRui Paulo };
415b9c547cSRui Paulo 
425b9c547cSRui Paulo struct nl80211_wiphy_data {
435b9c547cSRui Paulo 	struct dl_list list;
445b9c547cSRui Paulo 	struct dl_list bsss;
455b9c547cSRui Paulo 	struct dl_list drvs;
465b9c547cSRui Paulo 
47c1d255d3SCy Schubert 	struct nl_sock *nl_beacons;
485b9c547cSRui Paulo 	struct nl_cb *nl_cb;
495b9c547cSRui Paulo 
505b9c547cSRui Paulo 	int wiphy_idx;
515b9c547cSRui Paulo };
525b9c547cSRui Paulo 
53*a90b9d01SCy Schubert #define NL80211_DRV_LINK_ID_NA (-1)
54*a90b9d01SCy Schubert 
55*a90b9d01SCy Schubert struct i802_link {
56*a90b9d01SCy Schubert 	unsigned int beacon_set:1;
57*a90b9d01SCy Schubert 
58*a90b9d01SCy Schubert 	int freq;
59*a90b9d01SCy Schubert 	int bandwidth;
60*a90b9d01SCy Schubert 	u8 addr[ETH_ALEN];
61*a90b9d01SCy Schubert 	void *ctx;
62*a90b9d01SCy Schubert };
63*a90b9d01SCy Schubert 
645b9c547cSRui Paulo struct i802_bss {
655b9c547cSRui Paulo 	struct wpa_driver_nl80211_data *drv;
665b9c547cSRui Paulo 	struct i802_bss *next;
67*a90b9d01SCy Schubert 
68*a90b9d01SCy Schubert 	u16 valid_links;
69*a90b9d01SCy Schubert 	struct i802_link links[MAX_NUM_MLD_LINKS];
70*a90b9d01SCy Schubert 	struct i802_link *flink;
71*a90b9d01SCy Schubert 
725b9c547cSRui Paulo 	int ifindex;
735b9c547cSRui Paulo 	int br_ifindex;
745b9c547cSRui Paulo 	u64 wdev_id;
755b9c547cSRui Paulo 	char ifname[IFNAMSIZ + 1];
765b9c547cSRui Paulo 	char brname[IFNAMSIZ];
775b9c547cSRui Paulo 	unsigned int added_if_into_bridge:1;
7885732ac8SCy Schubert 	unsigned int already_in_bridge:1;
795b9c547cSRui Paulo 	unsigned int added_bridge:1;
805b9c547cSRui Paulo 	unsigned int in_deinit:1;
815b9c547cSRui Paulo 	unsigned int wdev_id_set:1;
825b9c547cSRui Paulo 	unsigned int added_if:1;
835b9c547cSRui Paulo 	unsigned int static_ap:1;
845b9c547cSRui Paulo 
855b9c547cSRui Paulo 	u8 addr[ETH_ALEN];
86*a90b9d01SCy Schubert 	u8 prev_addr[ETH_ALEN];
875b9c547cSRui Paulo 
885b9c547cSRui Paulo 	int if_dynamic;
895b9c547cSRui Paulo 
905b9c547cSRui Paulo 	void *ctx;
91c1d255d3SCy Schubert 	struct nl_sock *nl_preq, *nl_mgmt, *nl_connect;
925b9c547cSRui Paulo 	struct nl_cb *nl_cb;
935b9c547cSRui Paulo 
945b9c547cSRui Paulo 	struct nl80211_wiphy_data *wiphy_data;
955b9c547cSRui Paulo 	struct dl_list wiphy_list;
9685732ac8SCy Schubert 	u8 rand_addr[ETH_ALEN];
975b9c547cSRui Paulo };
985b9c547cSRui Paulo 
99206b73d0SCy Schubert struct drv_nl80211_if_info {
100206b73d0SCy Schubert 	int ifindex;
101206b73d0SCy Schubert 	/* the AP/AP_VLAN iface that is in this bridge */
102206b73d0SCy Schubert 	int reason;
103206b73d0SCy Schubert };
104206b73d0SCy Schubert 
1055b9c547cSRui Paulo struct wpa_driver_nl80211_data {
1065b9c547cSRui Paulo 	struct nl80211_global *global;
1075b9c547cSRui Paulo 	struct dl_list list;
1085b9c547cSRui Paulo 	struct dl_list wiphy_list;
1095b9c547cSRui Paulo 	char phyname[32];
110780fb4a2SCy Schubert 	unsigned int wiphy_idx;
1115b9c547cSRui Paulo 	u8 perm_addr[ETH_ALEN];
1125b9c547cSRui Paulo 	void *ctx;
1135b9c547cSRui Paulo 	int ifindex;
1145b9c547cSRui Paulo 	int if_removed;
1155b9c547cSRui Paulo 	int if_disabled;
1165b9c547cSRui Paulo 	int ignore_if_down_event;
1175b9c547cSRui Paulo 	struct rfkill_data *rfkill;
1185b9c547cSRui Paulo 	struct wpa_driver_capa capa;
1195b9c547cSRui Paulo 	u8 *extended_capa, *extended_capa_mask;
1205b9c547cSRui Paulo 	unsigned int extended_capa_len;
121*a90b9d01SCy Schubert 	struct drv_nl80211_iface_capa {
122780fb4a2SCy Schubert 		enum nl80211_iftype iftype;
123780fb4a2SCy Schubert 		u8 *ext_capa, *ext_capa_mask;
124780fb4a2SCy Schubert 		unsigned int ext_capa_len;
125*a90b9d01SCy Schubert 		u16 eml_capa;
126*a90b9d01SCy Schubert 		u16 mld_capa_and_ops;
127*a90b9d01SCy Schubert 	} iface_capa[NL80211_IFTYPE_MAX];
128*a90b9d01SCy Schubert 	unsigned int num_iface_capa;
129780fb4a2SCy Schubert 
1305b9c547cSRui Paulo 	int has_capability;
131c1d255d3SCy Schubert 	int has_driver_key_mgmt;
1325b9c547cSRui Paulo 
1335b9c547cSRui Paulo 	int operstate;
1345b9c547cSRui Paulo 
1355b9c547cSRui Paulo 	int scan_complete_events;
1365b9c547cSRui Paulo 	enum scan_states {
1375b9c547cSRui Paulo 		NO_SCAN, SCAN_REQUESTED, SCAN_STARTED, SCAN_COMPLETED,
1385b9c547cSRui Paulo 		SCAN_ABORTED, SCHED_SCAN_STARTED, SCHED_SCAN_STOPPED,
1395b9c547cSRui Paulo 		SCHED_SCAN_RESULTS
1405b9c547cSRui Paulo 	} scan_state;
1415b9c547cSRui Paulo 
1425b9c547cSRui Paulo 	u8 auth_bssid[ETH_ALEN];
1435b9c547cSRui Paulo 	u8 auth_attempt_bssid[ETH_ALEN];
1445b9c547cSRui Paulo 	u8 bssid[ETH_ALEN];
1455b9c547cSRui Paulo 	u8 prev_bssid[ETH_ALEN];
1465b9c547cSRui Paulo 	int associated;
147*a90b9d01SCy Schubert 	struct driver_sta_mlo_info sta_mlo_info;
148325151a3SRui Paulo 	u8 ssid[SSID_MAX_LEN];
1495b9c547cSRui Paulo 	size_t ssid_len;
1505b9c547cSRui Paulo 	enum nl80211_iftype nlmode;
1515b9c547cSRui Paulo 	enum nl80211_iftype ap_scan_as_station;
1525b9c547cSRui Paulo 	unsigned int assoc_freq;
1535b9c547cSRui Paulo 
1545b9c547cSRui Paulo 	int monitor_sock;
1555b9c547cSRui Paulo 	int monitor_ifidx;
1565b9c547cSRui Paulo 	int monitor_refcount;
1575b9c547cSRui Paulo 
1585b9c547cSRui Paulo 	unsigned int disabled_11b_rates:1;
1595b9c547cSRui Paulo 	unsigned int pending_remain_on_chan:1;
1605b9c547cSRui Paulo 	unsigned int in_interface_list:1;
1615b9c547cSRui Paulo 	unsigned int device_ap_sme:1;
1625b9c547cSRui Paulo 	unsigned int poll_command_supported:1;
1635b9c547cSRui Paulo 	unsigned int data_tx_status:1;
1645b9c547cSRui Paulo 	unsigned int scan_for_auth:1;
1655b9c547cSRui Paulo 	unsigned int retry_auth:1;
1665b9c547cSRui Paulo 	unsigned int use_monitor:1;
1675b9c547cSRui Paulo 	unsigned int hostapd:1;
168c1d255d3SCy Schubert 	unsigned int start_mode_sta:1;
1695b9c547cSRui Paulo 	unsigned int start_iface_up:1;
1705b9c547cSRui Paulo 	unsigned int test_use_roc_tx:1;
1715b9c547cSRui Paulo 	unsigned int ignore_deauth_event:1;
1725b9c547cSRui Paulo 	unsigned int vendor_cmd_test_avail:1;
1735b9c547cSRui Paulo 	unsigned int roaming_vendor_cmd_avail:1;
1745b9c547cSRui Paulo 	unsigned int dfs_vendor_cmd_avail:1;
1755b9c547cSRui Paulo 	unsigned int have_low_prio_scan:1;
1765b9c547cSRui Paulo 	unsigned int force_connect_cmd:1;
1775b9c547cSRui Paulo 	unsigned int addr_changed:1;
1785b9c547cSRui Paulo 	unsigned int get_features_vendor_cmd_avail:1;
1795b9c547cSRui Paulo 	unsigned int set_rekey_offload:1;
1805b9c547cSRui Paulo 	unsigned int p2p_go_ctwindow_supported:1;
181325151a3SRui Paulo 	unsigned int setband_vendor_cmd_avail:1;
182325151a3SRui Paulo 	unsigned int get_pref_freq_list:1;
183325151a3SRui Paulo 	unsigned int set_prob_oper_freq:1;
184780fb4a2SCy Schubert 	unsigned int scan_vendor_cmd_avail:1;
185780fb4a2SCy Schubert 	unsigned int connect_reassoc:1;
186780fb4a2SCy Schubert 	unsigned int set_wifi_conf_vendor_cmd_avail:1;
18785732ac8SCy Schubert 	unsigned int fetch_bss_trans_status:1;
18885732ac8SCy Schubert 	unsigned int roam_vendor_cmd_avail:1;
189c1d255d3SCy Schubert 	unsigned int add_sta_node_vendor_cmd_avail:1;
190c1d255d3SCy Schubert 	unsigned int control_port_ap:1;
191c1d255d3SCy Schubert 	unsigned int multicast_registrations:1;
192c1d255d3SCy Schubert 	unsigned int no_rrm:1;
193c1d255d3SCy Schubert 	unsigned int get_sta_info_vendor_cmd_avail:1;
194c1d255d3SCy Schubert 	unsigned int fils_discovery:1;
195c1d255d3SCy Schubert 	unsigned int unsol_bcast_probe_resp:1;
196c1d255d3SCy Schubert 	unsigned int qca_do_acs:1;
197c1d255d3SCy Schubert 	unsigned int brcm_do_acs:1;
198*a90b9d01SCy Schubert 	unsigned int uses_6ghz:1;
199*a90b9d01SCy Schubert 	unsigned int uses_s1g:1;
200*a90b9d01SCy Schubert 	unsigned int secure_ranging_ctx_vendor_cmd_avail:1;
201*a90b9d01SCy Schubert 	unsigned int puncturing:1;
202*a90b9d01SCy Schubert 	unsigned int qca_ap_allowed_freqs:1;
203*a90b9d01SCy Schubert 
204*a90b9d01SCy Schubert 	u32 ignore_next_local_disconnect;
205*a90b9d01SCy Schubert 	u32 ignore_next_local_deauth;
2065b9c547cSRui Paulo 
207780fb4a2SCy Schubert 	u64 vendor_scan_cookie;
2085b9c547cSRui Paulo 	u64 remain_on_chan_cookie;
209c1d255d3SCy Schubert 	u64 send_frame_cookie;
210*a90b9d01SCy Schubert 	int send_frame_link_id;
211c1d255d3SCy Schubert #define MAX_SEND_FRAME_COOKIES 20
212c1d255d3SCy Schubert 	u64 send_frame_cookies[MAX_SEND_FRAME_COOKIES];
213c1d255d3SCy Schubert 	unsigned int num_send_frame_cookies;
214c1d255d3SCy Schubert 	u64 eapol_tx_cookie;
215*a90b9d01SCy Schubert 	int eapol_tx_link_id;
2165b9c547cSRui Paulo 
2175b9c547cSRui Paulo 	unsigned int last_mgmt_freq;
2185b9c547cSRui Paulo 
2195b9c547cSRui Paulo 	struct wpa_driver_scan_filter *filter_ssids;
2205b9c547cSRui Paulo 	size_t num_filter_ssids;
2215b9c547cSRui Paulo 
2225b9c547cSRui Paulo 	struct i802_bss *first_bss;
2235b9c547cSRui Paulo 
2245b9c547cSRui Paulo 	int eapol_tx_sock;
2255b9c547cSRui Paulo 
2265b9c547cSRui Paulo 	int eapol_sock; /* socket for EAPOL frames */
2275b9c547cSRui Paulo 
228c1d255d3SCy Schubert 	struct nl_sock *rtnl_sk; /* nl_sock for NETLINK_ROUTE */
2295b9c547cSRui Paulo 
230206b73d0SCy Schubert 	struct drv_nl80211_if_info default_if_indices[16];
231206b73d0SCy Schubert 	struct drv_nl80211_if_info *if_indices;
2325b9c547cSRui Paulo 	int num_if_indices;
2335b9c547cSRui Paulo 
2345b9c547cSRui Paulo 	/* From failed authentication command */
2355b9c547cSRui Paulo 	int auth_freq;
2365b9c547cSRui Paulo 	u8 auth_bssid_[ETH_ALEN];
237325151a3SRui Paulo 	u8 auth_ssid[SSID_MAX_LEN];
2385b9c547cSRui Paulo 	size_t auth_ssid_len;
2395b9c547cSRui Paulo 	int auth_alg;
2405b9c547cSRui Paulo 	u8 *auth_ie;
2415b9c547cSRui Paulo 	size_t auth_ie_len;
242c1d255d3SCy Schubert 	u8 *auth_data;
243c1d255d3SCy Schubert 	size_t auth_data_len;
2445b9c547cSRui Paulo 	u8 auth_wep_key[4][16];
2455b9c547cSRui Paulo 	size_t auth_wep_key_len[4];
2465b9c547cSRui Paulo 	int auth_wep_tx_keyidx;
2475b9c547cSRui Paulo 	int auth_local_state_change;
2485b9c547cSRui Paulo 	int auth_p2p;
249*a90b9d01SCy Schubert 	bool auth_mld;
250*a90b9d01SCy Schubert 	u8 auth_mld_link_id;
251*a90b9d01SCy Schubert 	u8 auth_ap_mld_addr[ETH_ALEN];
252780fb4a2SCy Schubert 
253780fb4a2SCy Schubert 	/*
254780fb4a2SCy Schubert 	 * Tells whether the last scan issued from wpa_supplicant was a normal
255780fb4a2SCy Schubert 	 * scan (NL80211_CMD_TRIGGER_SCAN) or a vendor scan
256780fb4a2SCy Schubert 	 * (NL80211_CMD_VENDOR). 0 if no pending scan request.
257780fb4a2SCy Schubert 	 */
258780fb4a2SCy Schubert 	int last_scan_cmd;
259c1d255d3SCy Schubert #ifdef CONFIG_DRIVER_NL80211_QCA
260c1d255d3SCy Schubert 	bool roam_indication_done;
261c1d255d3SCy Schubert 	u8 *pending_roam_data;
262c1d255d3SCy Schubert 	size_t pending_roam_data_len;
263*a90b9d01SCy Schubert 	u8 *pending_t2lm_data;
264*a90b9d01SCy Schubert 	size_t pending_t2lm_data_len;
265*a90b9d01SCy Schubert 	u8 *pending_link_reconfig_data;
266*a90b9d01SCy Schubert 	size_t pending_link_reconfig_data_len;
267c1d255d3SCy Schubert #endif /* CONFIG_DRIVER_NL80211_QCA */
2685b9c547cSRui Paulo };
2695b9c547cSRui Paulo 
2705b9c547cSRui Paulo struct nl_msg;
2715b9c547cSRui Paulo 
272*a90b9d01SCy Schubert struct nl80211_err_info {
273*a90b9d01SCy Schubert 	int link_id;
274*a90b9d01SCy Schubert };
275*a90b9d01SCy Schubert 
2765b9c547cSRui Paulo void * nl80211_cmd(struct wpa_driver_nl80211_data *drv,
2775b9c547cSRui Paulo 		   struct nl_msg *msg, int flags, uint8_t cmd);
2785b9c547cSRui Paulo struct nl_msg * nl80211_cmd_msg(struct i802_bss *bss, int flags, uint8_t cmd);
2795b9c547cSRui Paulo struct nl_msg * nl80211_drv_msg(struct wpa_driver_nl80211_data *drv, int flags,
2805b9c547cSRui Paulo 				uint8_t cmd);
2815b9c547cSRui Paulo struct nl_msg * nl80211_bss_msg(struct i802_bss *bss, int flags, uint8_t cmd);
282*a90b9d01SCy Schubert 
283*a90b9d01SCy Schubert int send_and_recv(struct nl80211_global *global,
284*a90b9d01SCy Schubert 		  struct nl_sock *nl_handle, struct nl_msg *msg,
2855b9c547cSRui Paulo 		  int (*valid_handler)(struct nl_msg *, void *),
286c1d255d3SCy Schubert 		  void *valid_data,
287c1d255d3SCy Schubert 		  int (*ack_handler_custom)(struct nl_msg *, void *),
288*a90b9d01SCy Schubert 		  void *ack_data,
289*a90b9d01SCy Schubert 		  struct nl80211_err_info *err_info);
290*a90b9d01SCy Schubert 
291*a90b9d01SCy Schubert static inline int
send_and_recv_cmd(struct wpa_driver_nl80211_data * drv,struct nl_msg * msg)292*a90b9d01SCy Schubert send_and_recv_cmd(struct wpa_driver_nl80211_data *drv,
293*a90b9d01SCy Schubert 		  struct nl_msg *msg)
294*a90b9d01SCy Schubert {
295*a90b9d01SCy Schubert 	return send_and_recv(drv->global, drv->global->nl, msg,
296*a90b9d01SCy Schubert 			     NULL, NULL, NULL, NULL, NULL);
297*a90b9d01SCy Schubert }
298*a90b9d01SCy Schubert 
299*a90b9d01SCy Schubert static inline int
send_and_recv_resp(struct wpa_driver_nl80211_data * drv,struct nl_msg * msg,int (* valid_handler)(struct nl_msg *,void *),void * valid_data)300*a90b9d01SCy Schubert send_and_recv_resp(struct wpa_driver_nl80211_data *drv,
301*a90b9d01SCy Schubert 		   struct nl_msg *msg,
302*a90b9d01SCy Schubert 		   int (*valid_handler)(struct nl_msg *, void *),
303*a90b9d01SCy Schubert 		   void *valid_data)
304*a90b9d01SCy Schubert {
305*a90b9d01SCy Schubert 	return send_and_recv(drv->global, drv->global->nl, msg,
306*a90b9d01SCy Schubert 			     valid_handler, valid_data, NULL, NULL, NULL);
307*a90b9d01SCy Schubert }
308*a90b9d01SCy Schubert 
3095b9c547cSRui Paulo int nl80211_create_iface(struct wpa_driver_nl80211_data *drv,
3105b9c547cSRui Paulo 			 const char *ifname, enum nl80211_iftype iftype,
3115b9c547cSRui Paulo 			 const u8 *addr, int wds,
3125b9c547cSRui Paulo 			 int (*handler)(struct nl_msg *, void *),
3135b9c547cSRui Paulo 			 void *arg, int use_existing);
3145b9c547cSRui Paulo void nl80211_remove_iface(struct wpa_driver_nl80211_data *drv, int ifidx);
3155b9c547cSRui Paulo unsigned int nl80211_get_assoc_freq(struct wpa_driver_nl80211_data *drv);
31685732ac8SCy Schubert int nl80211_get_assoc_ssid(struct wpa_driver_nl80211_data *drv, u8 *ssid);
3175b9c547cSRui Paulo enum chan_width convert2width(int width);
3185b9c547cSRui Paulo void nl80211_mark_disconnected(struct wpa_driver_nl80211_data *drv);
3195b9c547cSRui Paulo struct i802_bss * get_bss_ifindex(struct wpa_driver_nl80211_data *drv,
3205b9c547cSRui Paulo 				  int ifindex);
3215b9c547cSRui Paulo int is_ap_interface(enum nl80211_iftype nlmode);
3225b9c547cSRui Paulo int is_sta_interface(enum nl80211_iftype nlmode);
3235b9c547cSRui Paulo int wpa_driver_nl80211_authenticate_retry(struct wpa_driver_nl80211_data *drv);
3245b9c547cSRui Paulo int nl80211_get_link_signal(struct wpa_driver_nl80211_data *drv,
325*a90b9d01SCy Schubert 			    const u8 *bssid,
326*a90b9d01SCy Schubert 			    struct hostap_sta_driver_data *data);
3275b9c547cSRui Paulo int nl80211_get_link_noise(struct wpa_driver_nl80211_data *drv,
3285b9c547cSRui Paulo 			   struct wpa_signal_info *sig_change);
3295b9c547cSRui Paulo int nl80211_get_wiphy_index(struct i802_bss *bss);
3305b9c547cSRui Paulo int wpa_driver_nl80211_set_mode(struct i802_bss *bss,
3315b9c547cSRui Paulo 				enum nl80211_iftype nlmode);
3325b9c547cSRui Paulo int wpa_driver_nl80211_mlme(struct wpa_driver_nl80211_data *drv,
3335b9c547cSRui Paulo 			    const u8 *addr, int cmd, u16 reason_code,
33485732ac8SCy Schubert 			    int local_state_change,
335c1d255d3SCy Schubert 			    struct i802_bss *bss);
3365b9c547cSRui Paulo 
3375b9c547cSRui Paulo int nl80211_create_monitor_interface(struct wpa_driver_nl80211_data *drv);
3385b9c547cSRui Paulo void nl80211_remove_monitor_interface(struct wpa_driver_nl80211_data *drv);
3395b9c547cSRui Paulo int nl80211_send_monitor(struct wpa_driver_nl80211_data *drv,
3405b9c547cSRui Paulo 			 const void *data, size_t len,
3415b9c547cSRui Paulo 			 int encrypt, int noack);
3425b9c547cSRui Paulo 
3435b9c547cSRui Paulo int wpa_driver_nl80211_capa(struct wpa_driver_nl80211_data *drv);
3445b9c547cSRui Paulo struct hostapd_hw_modes *
34585732ac8SCy Schubert nl80211_get_hw_feature_data(void *priv, u16 *num_modes, u16 *flags,
34685732ac8SCy Schubert 			    u8 *dfs_domain);
3475b9c547cSRui Paulo 
3485b9c547cSRui Paulo int process_global_event(struct nl_msg *msg, void *arg);
3495b9c547cSRui Paulo int process_bss_event(struct nl_msg *msg, void *arg);
3505b9c547cSRui Paulo 
351780fb4a2SCy Schubert const char * nl80211_iftype_str(enum nl80211_iftype mode);
352780fb4a2SCy Schubert 
353c1d255d3SCy Schubert void nl80211_restore_ap_mode(struct i802_bss *bss);
354*a90b9d01SCy Schubert struct i802_link * nl80211_get_link(struct i802_bss *bss, s8 link_id);
355*a90b9d01SCy Schubert 
nl80211_link_valid(u16 links,s8 link_id)356*a90b9d01SCy Schubert static inline bool nl80211_link_valid(u16 links, s8 link_id)
357*a90b9d01SCy Schubert {
358*a90b9d01SCy Schubert 	if (link_id < 0 || link_id >= MAX_NUM_MLD_LINKS)
359*a90b9d01SCy Schubert 		return false;
360*a90b9d01SCy Schubert 
361*a90b9d01SCy Schubert 	if (links & BIT(link_id))
362*a90b9d01SCy Schubert 		return true;
363*a90b9d01SCy Schubert 
364*a90b9d01SCy Schubert 	return false;
365*a90b9d01SCy Schubert }
366*a90b9d01SCy Schubert 
367*a90b9d01SCy Schubert 
368*a90b9d01SCy Schubert static inline bool
nl80211_attr_supported(struct wpa_driver_nl80211_data * drv,unsigned int attr)369*a90b9d01SCy Schubert nl80211_attr_supported(struct wpa_driver_nl80211_data *drv, unsigned int attr)
370*a90b9d01SCy Schubert {
371*a90b9d01SCy Schubert 	return attr <= drv->global->nl80211_maxattr;
372*a90b9d01SCy Schubert }
373c1d255d3SCy Schubert 
3745b9c547cSRui Paulo #ifdef ANDROID
375c1d255d3SCy Schubert int android_nl_socket_set_nonblocking(struct nl_sock *handle);
3765b9c547cSRui Paulo int android_pno_start(struct i802_bss *bss,
3775b9c547cSRui Paulo 		      struct wpa_driver_scan_params *params);
3785b9c547cSRui Paulo int android_pno_stop(struct i802_bss *bss);
3795b9c547cSRui Paulo extern int wpa_driver_nl80211_driver_cmd(void *priv, char *cmd, char *buf,
3805b9c547cSRui Paulo 					 size_t buf_len);
381c1d255d3SCy Schubert extern int wpa_driver_nl80211_driver_event(struct wpa_driver_nl80211_data *drv,
382c1d255d3SCy Schubert 					   u32 vendor_id, u32 subcmd,
383c1d255d3SCy Schubert 					   u8 *data, size_t len);
384c1d255d3SCy Schubert 
3855b9c547cSRui Paulo 
3865b9c547cSRui Paulo #ifdef ANDROID_P2P
3875b9c547cSRui Paulo int wpa_driver_set_p2p_noa(void *priv, u8 count, int start, int duration);
3885b9c547cSRui Paulo int wpa_driver_get_p2p_noa(void *priv, u8 *buf, size_t len);
3895b9c547cSRui Paulo int wpa_driver_set_p2p_ps(void *priv, int legacy_ps, int opp_ps, int ctwindow);
3905b9c547cSRui Paulo int wpa_driver_set_ap_wps_p2p_ie(void *priv, const struct wpabuf *beacon,
3915b9c547cSRui Paulo 				 const struct wpabuf *proberesp,
3925b9c547cSRui Paulo 				 const struct wpabuf *assocresp);
3935b9c547cSRui Paulo #endif /* ANDROID_P2P */
3945b9c547cSRui Paulo #endif /* ANDROID */
3955b9c547cSRui Paulo 
3965b9c547cSRui Paulo 
3975b9c547cSRui Paulo /* driver_nl80211_scan.c */
3985b9c547cSRui Paulo 
3995b9c547cSRui Paulo void wpa_driver_nl80211_scan_timeout(void *eloop_ctx, void *timeout_ctx);
4005b9c547cSRui Paulo int wpa_driver_nl80211_scan(struct i802_bss *bss,
4015b9c547cSRui Paulo 			    struct wpa_driver_scan_params *params);
4025b9c547cSRui Paulo int wpa_driver_nl80211_sched_scan(void *priv,
403780fb4a2SCy Schubert 				  struct wpa_driver_scan_params *params);
4045b9c547cSRui Paulo int wpa_driver_nl80211_stop_sched_scan(void *priv);
405*a90b9d01SCy Schubert struct wpa_scan_results * wpa_driver_nl80211_get_scan_results(void *priv,
406*a90b9d01SCy Schubert 							      const u8 *bssid);
4075b9c547cSRui Paulo void nl80211_dump_scan(struct wpa_driver_nl80211_data *drv);
40885732ac8SCy Schubert int wpa_driver_nl80211_abort_scan(void *priv, u64 scan_cookie);
409780fb4a2SCy Schubert int wpa_driver_nl80211_vendor_scan(struct i802_bss *bss,
410780fb4a2SCy Schubert 				   struct wpa_driver_scan_params *params);
411780fb4a2SCy Schubert int nl80211_set_default_scan_ies(void *priv, const u8 *ies, size_t ies_len);
4125b9c547cSRui Paulo 
4135b9c547cSRui Paulo #endif /* DRIVER_NL80211_H */
414