1 /*
2  * Copyright (c) 2024 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /**
8  * @brief Header containing WPA supplicant interface specific declarations for
9  * the Zephyr OS layer of the Wi-Fi driver.
10  */
11 
12 #ifndef __ZEPHYR_WPA_SUPP_IF_H__
13 #define __ZEPHYR_WPA_SUPP_IF_H__
14 
15 
16 #define RPU_RESP_EVENT_TIMEOUT  5000
17 #ifdef CONFIG_NRF70_STA_MODE
18 #include <drivers/driver_zephyr.h>
19 
20 void *nrf_wifi_wpa_supp_dev_init(void *supp_drv_if_ctx, const char *iface_name,
21 				 struct zep_wpa_supp_dev_callbk_fns *supp_callbk_fns);
22 
23 void nrf_wifi_wpa_supp_dev_deinit(void *if_priv);
24 
25 int nrf_wifi_wpa_supp_scan2(void *if_priv, struct wpa_driver_scan_params *params);
26 
27 int nrf_wifi_wpa_supp_scan_abort(void *if_priv);
28 
29 int nrf_wifi_wpa_supp_scan_results_get(void *if_priv);
30 
31 int nrf_wifi_wpa_supp_deauthenticate(void *if_priv, const char *addr, unsigned short reason_code);
32 
33 int nrf_wifi_wpa_supp_authenticate(void *if_priv, struct wpa_driver_auth_params *params,
34 			   struct wpa_bss *curr_bss);
35 
36 int nrf_wifi_wpa_supp_associate(void *if_priv, struct wpa_driver_associate_params *params);
37 
38 int nrf_wifi_wpa_set_supp_port(void *if_priv, int authorized, char *bssid);
39 
40 int nrf_wifi_wpa_supp_signal_poll(void *if_priv, struct wpa_signal_info *si,
41 				 unsigned char *bssid);
42 
43 int nrf_wifi_nl80211_send_mlme(void *if_priv, const u8 *data, size_t data_len, int noack,
44 			       unsigned int freq, int no_cck, int offchanok, unsigned int wait_time,
45 			       int cookie);
46 
47 int nrf_wifi_supp_get_wiphy(void *if_priv);
48 
49 int nrf_wifi_supp_register_frame(void *if_priv,
50 			u16 type, const u8 *match, size_t match_len,
51 			bool multicast);
52 
53 int nrf_wifi_wpa_supp_set_key(void *if_priv,
54 			   const unsigned char *ifname,
55 			   enum wpa_alg alg,
56 			   const unsigned char *addr,
57 			   int key_idx,
58 			   int set_tx,
59 			   const unsigned char *seq,
60 			   size_t seq_len,
61 			   const unsigned char *key,
62 			   size_t key_len,
63 			   enum key_flag key_flag);
64 
65 void nrf_wifi_wpa_supp_event_proc_scan_start(void *if_priv);
66 
67 void nrf_wifi_wpa_supp_event_proc_scan_done(void *if_priv,
68 					struct nrf_wifi_umac_event_trigger_scan *scan_done_event,
69 					unsigned int event_len,
70 					int aborted);
71 
72 void nrf_wifi_wpa_supp_event_proc_scan_res(void *if_priv,
73 					struct nrf_wifi_umac_event_new_scan_results *scan_res,
74 					unsigned int event_len,
75 					bool more_res);
76 
77 void nrf_wifi_wpa_supp_event_proc_auth_resp(void *if_priv,
78 					    struct nrf_wifi_umac_event_mlme *auth_resp,
79 					    unsigned int event_len);
80 
81 void nrf_wifi_wpa_supp_event_proc_assoc_resp(void *if_priv,
82 					     struct nrf_wifi_umac_event_mlme *assoc_resp,
83 					     unsigned int event_len);
84 
85 void nrf_wifi_wpa_supp_event_proc_deauth(void *if_priv,
86 					 struct nrf_wifi_umac_event_mlme *deauth,
87 					 unsigned int event_len);
88 
89 void nrf_wifi_wpa_supp_event_proc_disassoc(void *if_priv,
90 					   struct nrf_wifi_umac_event_mlme *disassoc,
91 					   unsigned int event_len);
92 
93 void nrf_wifi_wpa_supp_event_proc_get_sta(void *if_priv,
94 					   struct nrf_wifi_umac_event_new_station *info,
95 					   unsigned int event_len);
96 
97 void nrf_wifi_wpa_supp_event_proc_get_if(void *if_priv,
98 					   struct nrf_wifi_interface_info *info,
99 					   unsigned int event_len);
100 
101 void nrf_wifi_wpa_supp_event_mgmt_tx_status(void *if_priv,
102 						struct nrf_wifi_umac_event_mlme *mlme_event,
103 						unsigned int event_len);
104 
105 
106 void nrf_wifi_wpa_supp_event_proc_unprot_mgmt(void *if_priv,
107 						struct nrf_wifi_umac_event_mlme *unprot_mgmt,
108 						unsigned int event_len);
109 
110 void nrf_wifi_wpa_supp_event_get_wiphy(void *if_priv,
111 						struct nrf_wifi_event_get_wiphy *get_wiphy,
112 						unsigned int event_len);
113 
114 void nrf_wifi_wpa_supp_event_mgmt_rx_callbk_fn(void *if_priv,
115 						struct nrf_wifi_umac_event_mlme *mgmt_rx_event,
116 						unsigned int event_len);
117 
118 int nrf_wifi_supp_get_capa(void *if_priv, struct wpa_driver_capa *capa);
119 
120 void nrf_wifi_wpa_supp_event_mac_chgd(void *if_priv);
121 int nrf_wifi_supp_get_conn_info(void *if_priv, struct wpa_conn_info *info);
122 
123 void nrf_wifi_supp_event_proc_get_conn_info(void *os_vif_ctx,
124 					    struct nrf_wifi_umac_event_conn_info *info,
125 					    unsigned int event_len);
126 int nrf_wifi_supp_set_country(void *if_priv, const char *alpha2);
127 int nrf_wifi_supp_get_country(void *if_priv, char *alpha2);
128 
129 #endif /* CONFIG_NRF70_STA_MODE */
130 #ifdef CONFIG_NRF70_AP_MODE
131 int nrf_wifi_wpa_supp_init_ap(void *if_priv, struct wpa_driver_associate_params *params);
132 int nrf_wifi_wpa_supp_start_ap(void *if_priv, struct wpa_driver_ap_params *params);
133 int nrf_wifi_wpa_supp_change_beacon(void *if_priv, struct wpa_driver_ap_params *params);
134 int nrf_wifi_wpa_supp_stop_ap(void *if_priv);
135 int nrf_wifi_wpa_supp_deinit_ap(void *if_priv);
136 int nrf_wifi_wpa_supp_sta_add(void *if_priv, struct hostapd_sta_add_params *params);
137 int nrf_wifi_wpa_supp_sta_remove(void *if_priv, const u8 *addr);
138 int nrf_wifi_supp_register_mgmt_frame(void *if_priv,
139 	u16 frame_type, size_t match_len, const u8 *match);
140 int nrf_wifi_wpa_supp_sta_set_flags(void *if_priv, const u8 *addr,
141 			unsigned int total_flags, unsigned int flags_or,
142 			unsigned int flags_and);
143 int nrf_wifi_wpa_supp_sta_get_inact_sec(void *if_priv, const u8 *addr);
144 #endif /* CONFIG_NRF70_AP_MODE */
145 #endif /*  __ZEPHYR_WPA_SUPP_IF_H__ */
146