xref: /freebsd/contrib/wpa/wpa_supplicant/wnm_sta.h (revision 71e72c9e91c4b8007a4292e09669e8b549c29e97)
1 /*
2  * IEEE 802.11v WNM related functions and structures
3  * Copyright (c) 2011-2012, Qualcomm Atheros, Inc.
4  *
5  * This software may be distributed under the terms of the BSD license.
6  * See README for more details.
7  */
8 
9 #ifndef WNM_STA_H
10 #define WNM_STA_H
11 
12 struct measurement_pilot {
13 	u8 measurement_pilot;
14 	u8 subelem_len;
15 	u8 subelems[255];
16 };
17 
18 struct multiple_bssid {
19 	u8 max_bssid_indicator;
20 	u8 subelem_len;
21 	u8 subelems[255];
22 };
23 
24 struct neighbor_report {
25 	u8 bssid[ETH_ALEN];
26 	u8 mld_addr[ETH_ALEN];
27 	u16 mld_links; /* may be zero if no link IDs were specified */
28 	u32 bssid_info;
29 	u8 regulatory_class;
30 	u8 channel_number;
31 	u8 phy_type;
32 	u8 preference; /* valid if preference_present=1 */
33 	u16 tsf_offset; /* valid if tsf_present=1 */
34 	u16 beacon_int; /* valid if tsf_present=1 */
35 	char country[2]; /* valid if country_present=1 */
36 	u8 rm_capab[5]; /* valid if rm_capab_present=1 */
37 	u16 bearing; /* valid if bearing_present=1 */
38 	u16 rel_height; /* valid if bearing_present=1 */
39 	u32 distance; /* valid if bearing_present=1 */
40 	u64 bss_term_tsf; /* valid if bss_term_present=1 */
41 	u16 bss_term_dur; /* valid if bss_term_present=1 */
42 	unsigned int disassoc_imminent:1;
43 	unsigned int preference_present:1;
44 	unsigned int tsf_present:1;
45 	unsigned int country_present:1;
46 	unsigned int rm_capab_present:1;
47 	unsigned int bearing_present:1;
48 	unsigned int bss_term_present:1;
49 #ifdef CONFIG_MBO
50 	unsigned int drv_mbo_reject:1;
51 #endif /* CONFIG_MBO */
52 	struct measurement_pilot *meas_pilot;
53 	struct multiple_bssid *mul_bssid;
54 	int freq;
55 };
56 
57 
58 int ieee802_11_send_wnmsleep_req(struct wpa_supplicant *wpa_s,
59 				 u8 action, u16 intval, struct wpabuf *tfs_req);
60 
61 void ieee802_11_rx_wnm_action(struct wpa_supplicant *wpa_s,
62 			      const struct ieee80211_mgmt *mgmt, size_t len);
63 
64 int wnm_send_bss_transition_mgmt_query(struct wpa_supplicant *wpa_s,
65 				       u8 query_reason,
66 				       const char *btm_candidates,
67 				       int cand_list);
68 
69 int wnm_send_coloc_intf_report(struct wpa_supplicant *wpa_s, u8 dialog_token,
70 			       const struct wpabuf *elems);
71 void wnm_set_coloc_intf_elems(struct wpa_supplicant *wpa_s,
72 			      struct wpabuf *elems);
73 
74 int wnm_btm_resp_tx_status(struct wpa_supplicant *wpa_s, const u8 *data,
75 			   size_t data_len);
76 
77 #ifdef CONFIG_WNM
78 
79 int wnm_scan_process(struct wpa_supplicant *wpa_s, bool pre_scan_check);
80 void wnm_clear_coloc_intf_reporting(struct wpa_supplicant *wpa_s);
81 
82 bool wnm_is_bss_excluded(struct wpa_supplicant *wpa_s, struct wpa_bss *bss);
83 
84 void wnm_btm_reset(struct wpa_supplicant *wpa_s);
85 
wnm_active_bss_trans_mgmt(struct wpa_supplicant * wpa_s)86 static inline bool wnm_active_bss_trans_mgmt(struct wpa_supplicant *wpa_s)
87 {
88 	return !!wpa_s->wnm_dialog_token;
89 }
90 
91 #else /* CONFIG_WNM */
92 
wnm_scan_process(struct wpa_supplicant * wpa_s,int reply_on_fail)93 static inline int wnm_scan_process(struct wpa_supplicant *wpa_s,
94 				   int reply_on_fail)
95 {
96 	return 0;
97 }
98 
wnm_clear_coloc_intf_reporting(struct wpa_supplicant * wpa_s)99 static inline void wnm_clear_coloc_intf_reporting(struct wpa_supplicant *wpa_s)
100 {
101 }
102 
103 static inline bool
wnm_is_bss_excluded(struct wpa_supplicant * wpa_s,struct wpa_bss * bss)104 wnm_is_bss_excluded(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
105 {
106 	return false;
107 }
108 
wnm_btm_reset(struct wpa_supplicant * wpa_s)109 static inline void wnm_btm_reset(struct wpa_supplicant *wpa_s)
110 {
111 }
112 
wnm_active_bss_trans_mgmt(struct wpa_supplicant * wpa_s)113 static inline bool wnm_active_bss_trans_mgmt(struct wpa_supplicant *wpa_s)
114 {
115 	return false;
116 }
117 
118 #endif /* CONFIG_WNM */
119 
120 #endif /* WNM_STA_H */
121