1 /*
2  * Copyright (c) 2017 Intel Corporation.
3  * Copyright 2024 NXP
4  * Copyright (c) 2024 Nordic Semiconductor ASA
5  *
6  * SPDX-License-Identifier: Apache-2.0
7  */
8 
9 /**
10  * @file
11  * @brief WiFi L2 stack public header
12  */
13 
14 #ifndef ZEPHYR_INCLUDE_NET_WIFI_MGMT_H_
15 #define ZEPHYR_INCLUDE_NET_WIFI_MGMT_H_
16 
17 #include <zephyr/net/net_mgmt.h>
18 #include <zephyr/net/wifi.h>
19 #include <zephyr/net/ethernet.h>
20 #include <zephyr/net/offloaded_netdev.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 /**
27  * @addtogroup wifi_mgmt
28  * @{
29  */
30 
31 /* Management part definitions */
32 
33 /** @cond INTERNAL_HIDDEN */
34 
35 #define NET_WIFI_LAYER	NET_MGMT_LAYER_L2
36 #define NET_WIFI_CODE	NET_MGMT_LAYER_CODE_WIFI
37 #define NET_WIFI_BASE	(NET_MGMT_IFACE_BIT |			\
38 			 NET_MGMT_LAYER(NET_WIFI_LAYER) |	\
39 			 NET_MGMT_LAYER_CODE(NET_WIFI_CODE))
40 #define NET_WIFI_EVENT	(NET_WIFI_BASE | NET_MGMT_EVENT_BIT)
41 
42 #ifdef CONFIG_WIFI_MGMT_SCAN_SSID_FILT_MAX
43 #define WIFI_MGMT_SCAN_SSID_FILT_MAX CONFIG_WIFI_MGMT_SCAN_SSID_FILT_MAX
44 #else
45 #define WIFI_MGMT_SCAN_SSID_FILT_MAX 1
46 #endif /* CONFIG_WIFI_MGMT_SCAN_SSID_FILT_MAX */
47 
48 #ifdef CONFIG_WIFI_MGMT_SCAN_CHAN_MAX_MANUAL
49 #define WIFI_MGMT_SCAN_CHAN_MAX_MANUAL CONFIG_WIFI_MGMT_SCAN_CHAN_MAX_MANUAL
50 #else
51 #define WIFI_MGMT_SCAN_CHAN_MAX_MANUAL 1
52 #endif /* CONFIG_WIFI_MGMT_SCAN_CHAN_MAX_MANUAL */
53 
54 #ifdef CONFIG_WIFI_ENT_IDENTITY_MAX_USERS
55 #define WIFI_ENT_IDENTITY_MAX_USERS CONFIG_WIFI_ENT_IDENTITY_MAX_USERS
56 #else
57 #define WIFI_ENT_IDENTITY_MAX_USERS 1
58 #endif /* CONFIG_WIFI_ENT_IDENTITY_MAX_USERS */
59 
60 #define WIFI_MGMT_BAND_STR_SIZE_MAX 8
61 #define WIFI_MGMT_SCAN_MAX_BSS_CNT 65535
62 
63 #define WIFI_MGMT_SKIP_INACTIVITY_POLL IS_ENABLED(CONFIG_WIFI_MGMT_AP_STA_SKIP_INACTIVITY_POLL)
64 /** @endcond */
65 
66 /** @brief Wi-Fi management commands */
67 enum net_request_wifi_cmd {
68 	/** Scan for Wi-Fi networks */
69 	NET_REQUEST_WIFI_CMD_SCAN = 1,
70 	/** Connect to a Wi-Fi network */
71 	NET_REQUEST_WIFI_CMD_CONNECT,
72 	/** Disconnect from a Wi-Fi network */
73 	NET_REQUEST_WIFI_CMD_DISCONNECT,
74 	/** Enable AP mode */
75 	NET_REQUEST_WIFI_CMD_AP_ENABLE,
76 	/** Disable AP mode */
77 	NET_REQUEST_WIFI_CMD_AP_DISABLE,
78 	/** Set AP RTS threshold */
79 	NET_REQUEST_WIFI_CMD_AP_RTS_THRESHOLD,
80 	/** Get interface status */
81 	NET_REQUEST_WIFI_CMD_IFACE_STATUS,
82 	/** Set or get 11k status */
83 	NET_REQUEST_WIFI_CMD_11K_CONFIG,
84 	/** Send 11k neighbor request */
85 	NET_REQUEST_WIFI_CMD_11K_NEIGHBOR_REQUEST,
86 	/** Set power save status */
87 	NET_REQUEST_WIFI_CMD_PS,
88 	/** Setup or teardown TWT flow */
89 	NET_REQUEST_WIFI_CMD_TWT,
90 	/** Setup BTWT flow */
91 	NET_REQUEST_WIFI_CMD_BTWT,
92 	/** Get power save config */
93 	NET_REQUEST_WIFI_CMD_PS_CONFIG,
94 	/** Set or get regulatory domain */
95 	NET_REQUEST_WIFI_CMD_REG_DOMAIN,
96 	/** Set or get Mode of operation */
97 	NET_REQUEST_WIFI_CMD_MODE,
98 	/** Set or get packet filter setting for current mode */
99 	NET_REQUEST_WIFI_CMD_PACKET_FILTER,
100 	/** Set or get Wi-Fi channel for Monitor or TX-Injection mode */
101 	NET_REQUEST_WIFI_CMD_CHANNEL,
102 	/** Disconnect a STA from AP */
103 	NET_REQUEST_WIFI_CMD_AP_STA_DISCONNECT,
104 	/** Get Wi-Fi driver and Firmware versions */
105 	NET_REQUEST_WIFI_CMD_VERSION,
106 	/** Get Wi-Fi latest connection parameters */
107 	NET_REQUEST_WIFI_CMD_CONN_PARAMS,
108 	/** Set RTS threshold */
109 	NET_REQUEST_WIFI_CMD_RTS_THRESHOLD,
110 	/** Configure AP parameter */
111 	NET_REQUEST_WIFI_CMD_AP_CONFIG_PARAM,
112 	/** Configure STA parameter */
113 	NET_REQUEST_WIFI_CMD_CONFIG_PARAM,
114 	/** DPP actions */
115 	NET_REQUEST_WIFI_CMD_DPP,
116 	/** BSS transition management query */
117 	NET_REQUEST_WIFI_CMD_BTM_QUERY,
118 	/** Flush PMKSA cache entries */
119 	NET_REQUEST_WIFI_CMD_PMKSA_FLUSH,
120 	/** Set enterprise mode credential */
121 	NET_REQUEST_WIFI_CMD_ENTERPRISE_CREDS,
122 	/** Get RTS threshold */
123 	NET_REQUEST_WIFI_CMD_RTS_THRESHOLD_CONFIG,
124 	/** WPS config */
125 	NET_REQUEST_WIFI_CMD_WPS_CONFIG,
126 #ifdef CONFIG_WIFI_CREDENTIALS_CONNECT_STORED
127 	/** Connect to APs stored using wifi_credentials library. */
128 	NET_REQUEST_WIFI_CMD_CONNECT_STORED,
129 #endif
130 	/** Start roaming */
131 	NET_REQUEST_WIFI_CMD_START_ROAMING,
132 	/** Neighbor report complete */
133 	NET_REQUEST_WIFI_CMD_NEIGHBOR_REP_COMPLETE,
134 	/** Specific scan */
135 	NET_REQUEST_WIFI_CMD_CANDIDATE_SCAN,
136 	/** AP WPS config */
137 	NET_REQUEST_WIFI_CMD_AP_WPS_CONFIG,
138 	/** Configure BSS maximum idle period */
139 	NET_REQUEST_WIFI_CMD_BSS_MAX_IDLE_PERIOD,
140 	/** Configure background scanning */
141 	NET_REQUEST_WIFI_CMD_BGSCAN,
142 	/** @cond INTERNAL_HIDDEN */
143 	NET_REQUEST_WIFI_CMD_MAX
144 	/** @endcond */
145 };
146 
147 /** Request a Wi-Fi scan */
148 #define NET_REQUEST_WIFI_SCAN					\
149 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_SCAN)
150 
151 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_SCAN);
152 
153 /** Request a Wi-Fi connect */
154 #define NET_REQUEST_WIFI_CONNECT				\
155 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_CONNECT)
156 
157 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_CONNECT);
158 
159 /** Request a Wi-Fi disconnect */
160 #define NET_REQUEST_WIFI_DISCONNECT				\
161 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_DISCONNECT)
162 
163 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_DISCONNECT);
164 
165 /** Request a Wi-Fi access point enable */
166 #define NET_REQUEST_WIFI_AP_ENABLE				\
167 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_AP_ENABLE)
168 
169 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_ENABLE);
170 
171 /** Request a Wi-Fi access point disable */
172 #define NET_REQUEST_WIFI_AP_DISABLE				\
173 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_AP_DISABLE)
174 
175 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_DISABLE);
176 
177 /** Request a Wi-Fi RTS threshold */
178 #define NET_REQUEST_WIFI_AP_RTS_THRESHOLD				\
179 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_AP_RTS_THRESHOLD)
180 
181 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_RTS_THRESHOLD);
182 
183 /** Request a Wi-Fi network interface status */
184 #define NET_REQUEST_WIFI_IFACE_STATUS				\
185 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_IFACE_STATUS)
186 
187 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_IFACE_STATUS);
188 
189 #define NET_REQUEST_WIFI_11K_CONFIG				\
190 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_11K_CONFIG)
191 
192 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_11K_CONFIG);
193 
194 #define NET_REQUEST_WIFI_11K_NEIGHBOR_REQUEST			\
195 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_11K_NEIGHBOR_REQUEST)
196 
197 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_11K_NEIGHBOR_REQUEST);
198 
199 /** Request a Wi-Fi power save */
200 #define NET_REQUEST_WIFI_PS					\
201 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_PS)
202 
203 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_PS);
204 
205 /** Request a Wi-Fi TWT */
206 #define NET_REQUEST_WIFI_TWT					\
207 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_TWT)
208 
209 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_TWT);
210 
211 #define NET_REQUEST_WIFI_BTWT			\
212 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_BTWT)
213 
214 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_BTWT);
215 
216 /** Request a Wi-Fi power save configuration */
217 #define NET_REQUEST_WIFI_PS_CONFIG				\
218 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_PS_CONFIG)
219 
220 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_PS_CONFIG);
221 
222 /** Request a Wi-Fi regulatory domain */
223 #define NET_REQUEST_WIFI_REG_DOMAIN				\
224 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_REG_DOMAIN)
225 
226 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_REG_DOMAIN);
227 
228 /** Request current Wi-Fi mode */
229 #define NET_REQUEST_WIFI_MODE					\
230 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_MODE)
231 
232 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_MODE);
233 
234 /** Request Wi-Fi packet filter */
235 #define NET_REQUEST_WIFI_PACKET_FILTER				\
236 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_PACKET_FILTER)
237 
238 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_PACKET_FILTER);
239 
240 /** Request a Wi-Fi channel */
241 #define NET_REQUEST_WIFI_CHANNEL				\
242 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_CHANNEL)
243 
244 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_CHANNEL);
245 
246 /** Request a Wi-Fi access point to disconnect a station */
247 #define NET_REQUEST_WIFI_AP_STA_DISCONNECT			\
248 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_AP_STA_DISCONNECT)
249 
250 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_STA_DISCONNECT);
251 
252 /** Request a Wi-Fi version */
253 #define NET_REQUEST_WIFI_VERSION				\
254 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_VERSION)
255 
256 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_VERSION);
257 
258 /** Request a Wi-Fi connection parameters */
259 #define NET_REQUEST_WIFI_CONN_PARAMS                           \
260 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_CONN_PARAMS)
261 
262 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_CONN_PARAMS);
263 
264 /** Request a Wi-Fi RTS threshold */
265 #define NET_REQUEST_WIFI_RTS_THRESHOLD				\
266 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_RTS_THRESHOLD)
267 
268 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_RTS_THRESHOLD);
269 
270 /** Request a Wi-Fi AP parameters configuration */
271 #define NET_REQUEST_WIFI_AP_CONFIG_PARAM         \
272 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_AP_CONFIG_PARAM)
273 
274 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_CONFIG_PARAM);
275 
276 /** Request a Wi-Fi STA parameters configuration */
277 #define NET_REQUEST_WIFI_CONFIG_PARAM         \
278 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_CONFIG_PARAM)
279 
280 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_CONFIG_PARAM);
281 
282 #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP
283 /** Request a Wi-Fi DPP operation */
284 #define NET_REQUEST_WIFI_DPP			\
285 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_DPP)
286 
287 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_DPP);
288 #endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP */
289 
290 /** Request a Wi-Fi BTM query */
291 #define NET_REQUEST_WIFI_BTM_QUERY (NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_BTM_QUERY)
292 
293 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_BTM_QUERY);
294 
295 /** Request a Wi-Fi PMKSA cache entries flush */
296 #define NET_REQUEST_WIFI_PMKSA_FLUSH                           \
297 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_PMKSA_FLUSH)
298 
299 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_PMKSA_FLUSH);
300 
301 /** Set Wi-Fi enterprise mode CA/client Cert and key */
302 #define NET_REQUEST_WIFI_ENTERPRISE_CREDS                               \
303 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_ENTERPRISE_CREDS)
304 
305 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_ENTERPRISE_CREDS);
306 
307 /** Request a Wi-Fi RTS threshold configuration */
308 #define NET_REQUEST_WIFI_RTS_THRESHOLD_CONFIG				\
309 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_RTS_THRESHOLD_CONFIG)
310 
311 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_RTS_THRESHOLD_CONFIG);
312 
313 #define NET_REQUEST_WIFI_WPS_CONFIG (NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_WPS_CONFIG)
314 
315 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_WPS_CONFIG);
316 #ifdef CONFIG_WIFI_CREDENTIALS_CONNECT_STORED
317 #define NET_REQUEST_WIFI_CONNECT_STORED (NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_CONNECT_STORED)
318 
319 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_CONNECT_STORED);
320 #endif
321 
322 #define NET_REQUEST_WIFI_START_ROAMING				\
323 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_START_ROAMING)
324 
325 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_START_ROAMING);
326 
327 #define NET_REQUEST_WIFI_NEIGHBOR_REP_COMPLETE			\
328 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_NEIGHBOR_REP_COMPLETE)
329 
330 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_NEIGHBOR_REP_COMPLETE);
331 
332 #define NET_REQUEST_WIFI_BSS_MAX_IDLE_PERIOD				\
333 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_BSS_MAX_IDLE_PERIOD)
334 
335 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_BSS_MAX_IDLE_PERIOD);
336 
337 #define NET_REQUEST_WIFI_BGSCAN					\
338 	(NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_BGSCAN)
339 
340 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_BGSCAN);
341 
342 /** @cond INTERNAL_HIDDEN */
343 
344 enum {
345 	NET_EVENT_WIFI_CMD_SCAN_RESULT_VAL,
346 	NET_EVENT_WIFI_CMD_SCAN_DONE_VAL,
347 	NET_EVENT_WIFI_CMD_CONNECT_RESULT_VAL,
348 	NET_EVENT_WIFI_CMD_DISCONNECT_RESULT_VAL,
349 	NET_EVENT_WIFI_CMD_IFACE_STATUS_VAL,
350 	NET_EVENT_WIFI_CMD_TWT_VAL,
351 	NET_EVENT_WIFI_CMD_TWT_SLEEP_STATE_VAL,
352 	NET_EVENT_WIFI_CMD_RAW_SCAN_RESULT_VAL,
353 	NET_EVENT_WIFI_CMD_DISCONNECT_COMPLETE_VAL,
354 	NET_EVENT_WIFI_CMD_SIGNAL_CHANGE_VAL,
355 	NET_EVENT_WIFI_CMD_NEIGHBOR_REP_RECEIVED_VAL,
356 	NET_EVENT_WIFI_CMD_NEIGHBOR_REP_COMPLETE_VAL,
357 	NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT_VAL,
358 	NET_EVENT_WIFI_CMD_AP_DISABLE_RESULT_VAL,
359 	NET_EVENT_WIFI_CMD_AP_STA_CONNECTED_VAL,
360 	NET_EVENT_WIFI_CMD_AP_STA_DISCONNECTED_VAL,
361 	NET_EVENT_WIFI_CMD_SUPPLICANT_VAL,
362 
363 	NET_EVENT_WIFI_CMD_MAX,
364 };
365 
366 BUILD_ASSERT(NET_EVENT_WIFI_CMD_MAX <= NET_MGMT_MAX_COMMANDS,
367 	     "Number of events in net_event_wifi_cmd exceeds the limit");
368 
369 /** @endcond */
370 
371 /** @brief Wi-Fi management events */
372 enum net_event_wifi_cmd {
373 	/** Scan results available */
374 	NET_MGMT_CMD(NET_EVENT_WIFI_CMD_SCAN_RESULT),
375 	/** Scan done */
376 	NET_MGMT_CMD(NET_EVENT_WIFI_CMD_SCAN_DONE),
377 	/** Connect result */
378 	NET_MGMT_CMD(NET_EVENT_WIFI_CMD_CONNECT_RESULT),
379 	/** Disconnect result */
380 	NET_MGMT_CMD(NET_EVENT_WIFI_CMD_DISCONNECT_RESULT),
381 	/** Interface status */
382 	NET_MGMT_CMD(NET_EVENT_WIFI_CMD_IFACE_STATUS),
383 	/** TWT events */
384 	NET_MGMT_CMD(NET_EVENT_WIFI_CMD_TWT),
385 	/** TWT sleep status: awake or sleeping, can be used by application
386 	 * to determine if it can send data or not.
387 	 */
388 	NET_MGMT_CMD(NET_EVENT_WIFI_CMD_TWT_SLEEP_STATE),
389 	/** Raw scan results available */
390 	NET_MGMT_CMD(NET_EVENT_WIFI_CMD_RAW_SCAN_RESULT),
391 	/** Disconnect complete */
392 	NET_MGMT_CMD(NET_EVENT_WIFI_CMD_DISCONNECT_COMPLETE),
393 	/** Signal change event */
394 	NET_MGMT_CMD(NET_EVENT_WIFI_CMD_SIGNAL_CHANGE),
395 	/** Neighbor Report */
396 	NET_MGMT_CMD(NET_EVENT_WIFI_CMD_NEIGHBOR_REP_RECEIVED),
397 	/** Neighbor Report complete */
398 	NET_MGMT_CMD(NET_EVENT_WIFI_CMD_NEIGHBOR_REP_COMPLETE),
399 	/** AP mode enable result */
400 	NET_MGMT_CMD(NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT),
401 	/** AP mode disable result */
402 	NET_MGMT_CMD(NET_EVENT_WIFI_CMD_AP_DISABLE_RESULT),
403 	/** STA connected to AP */
404 	NET_MGMT_CMD(NET_EVENT_WIFI_CMD_AP_STA_CONNECTED),
405 	/** STA disconnected from AP */
406 	NET_MGMT_CMD(NET_EVENT_WIFI_CMD_AP_STA_DISCONNECTED),
407 	/** Supplicant specific event */
408 	NET_MGMT_CMD(NET_EVENT_WIFI_CMD_SUPPLICANT),
409 };
410 
411 /** Event emitted for Wi-Fi scan result */
412 #define NET_EVENT_WIFI_SCAN_RESULT				\
413 	(NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_SCAN_RESULT)
414 
415 /** Event emitted when Wi-Fi scan is done */
416 #define NET_EVENT_WIFI_SCAN_DONE				\
417 	(NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_SCAN_DONE)
418 
419 /** Event emitted for Wi-Fi connect result */
420 #define NET_EVENT_WIFI_CONNECT_RESULT				\
421 	(NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_CONNECT_RESULT)
422 
423 /** Event emitted for Wi-Fi disconnect result */
424 #define NET_EVENT_WIFI_DISCONNECT_RESULT			\
425 	(NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_DISCONNECT_RESULT)
426 
427 /** Event emitted for Wi-Fi network interface status */
428 #define NET_EVENT_WIFI_IFACE_STATUS				\
429 	(NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_IFACE_STATUS)
430 
431 /** Event emitted for Wi-Fi TWT information */
432 #define NET_EVENT_WIFI_TWT					\
433 	(NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_TWT)
434 
435 /** Event emitted for Wi-Fi TWT sleep state */
436 #define NET_EVENT_WIFI_TWT_SLEEP_STATE				\
437 	(NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_TWT_SLEEP_STATE)
438 
439 /** Event emitted for Wi-Fi raw scan result */
440 #define NET_EVENT_WIFI_RAW_SCAN_RESULT                          \
441 	(NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_RAW_SCAN_RESULT)
442 
443 /** Event emitted Wi-Fi disconnect is completed */
444 #define NET_EVENT_WIFI_DISCONNECT_COMPLETE			\
445 	(NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_DISCONNECT_COMPLETE)
446 
447 /** Event signal change of connected AP */
448 #define NET_EVENT_WIFI_SIGNAL_CHANGE				\
449 	(NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_SIGNAL_CHANGE)
450 
451 /** Event Neighbor Report Completed */
452 #define NET_EVENT_WIFI_NEIGHBOR_REP_COMP			\
453 	(NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_NEIGHBOR_REP_COMPLETE)
454 
455 /** Event emitted for Wi-Fi access point enable result */
456 #define NET_EVENT_WIFI_AP_ENABLE_RESULT				\
457 	(NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT)
458 
459 /** Event emitted for Wi-Fi access point disable result */
460 #define NET_EVENT_WIFI_AP_DISABLE_RESULT			\
461 	(NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_AP_DISABLE_RESULT)
462 
463 /** Event emitted when Wi-Fi station is connected in AP mode */
464 #define NET_EVENT_WIFI_AP_STA_CONNECTED				\
465 	(NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_AP_STA_CONNECTED)
466 
467 /** Event emitted Wi-Fi station is disconnected from AP */
468 #define NET_EVENT_WIFI_AP_STA_DISCONNECTED			\
469 	(NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_AP_STA_DISCONNECTED)
470 
471 /** @brief Wi-Fi version */
472 struct wifi_version {
473 	/** Driver version */
474 	const char *drv_version;
475 	/** Firmware version */
476 	const char *fw_version;
477 };
478 
479 /**
480  * @brief Wi-Fi structure to uniquely identify a band-channel pair
481  */
482 struct wifi_band_channel {
483 	/** Frequency band */
484 	uint8_t band;
485 	/** Channel */
486 	uint8_t channel;
487 };
488 
489 /**
490  * @brief Wi-Fi scan parameters structure.
491  * Used to specify parameters which can control how the Wi-Fi scan
492  * is performed.
493  */
494 struct wifi_scan_params {
495 	/** Scan type, see enum wifi_scan_type.
496 	 *
497 	 * The scan_type is only a hint to the underlying Wi-Fi chip for the
498 	 * preferred mode of scan. The actual mode of scan can depend on factors
499 	 * such as the Wi-Fi chip implementation support, regulatory domain
500 	 * restrictions etc.
501 	 */
502 	enum wifi_scan_type scan_type;
503 	/** Bitmap of bands to be scanned.
504 	 *  Refer to ::wifi_frequency_bands for bit position of each band.
505 	 */
506 	uint8_t bands;
507 	/** Active scan dwell time (in ms) on a channel.
508 	 */
509 	uint16_t dwell_time_active;
510 	/** Passive scan dwell time (in ms) on a channel.
511 	 */
512 	uint16_t dwell_time_passive;
513 	/** Array of SSID strings to scan.
514 	 */
515 	const char *ssids[WIFI_MGMT_SCAN_SSID_FILT_MAX];
516 	/** Specifies the maximum number of scan results to return. These results would be the
517 	 * BSSIDS with the best RSSI values, in all the scanned channels. This should only be
518 	 * used to limit the number of returned scan results, and cannot be counted upon to limit
519 	 * the scan time, since the underlying Wi-Fi chip might have to scan all the channels to
520 	 * find the max_bss_cnt number of APs with the best signal strengths. A value of 0
521 	 * signifies that there is no restriction on the number of scan results to be returned.
522 	 */
523 	uint16_t max_bss_cnt;
524 	/** Channel information array indexed on Wi-Fi frequency bands and channels within that
525 	 * band.
526 	 * E.g. to scan channel 6 and 11 on the 2.4 GHz band, channel 36 on the 5 GHz band:
527 	 * @code{.c}
528 	 *     chan[0] = {WIFI_FREQ_BAND_2_4_GHZ, 6};
529 	 *     chan[1] = {WIFI_FREQ_BAND_2_4_GHZ, 11};
530 	 *     chan[2] = {WIFI_FREQ_BAND_5_GHZ, 36};
531 	 * @endcode
532 	 *
533 	 *  This list specifies the channels to be __considered for scan__. The underlying
534 	 *  Wi-Fi chip can silently omit some channels due to various reasons such as channels
535 	 *  not conforming to regulatory restrictions etc. The invoker of the API should
536 	 *  ensure that the channels specified follow regulatory rules.
537 	 */
538 	struct wifi_band_channel band_chan[WIFI_MGMT_SCAN_CHAN_MAX_MANUAL];
539 };
540 
541 /** @brief Wi-Fi scan result, each result is provided to the net_mgmt_event_callback
542  * via its info attribute (see net_mgmt.h)
543  */
544 struct wifi_scan_result {
545 	/** SSID */
546 	uint8_t ssid[WIFI_SSID_MAX_LEN + 1];
547 	/** SSID length */
548 	uint8_t ssid_length;
549 	/** Frequency band */
550 	uint8_t band;
551 	/** Channel */
552 	uint8_t channel;
553 	/** Security type */
554 	enum wifi_security_type security;
555 	/** WPA3 enterprise type */
556 	enum wifi_wpa3_enterprise_type wpa3_ent_type;
557 	/** MFP options */
558 	enum wifi_mfp_options mfp;
559 	/** RSSI */
560 	int8_t rssi;
561 	/** BSSID */
562 	uint8_t mac[WIFI_MAC_ADDR_LEN];
563 	/** BSSID length */
564 	uint8_t mac_length;
565 };
566 
567 /** @brief Wi-Fi connect request parameters */
568 struct wifi_connect_req_params {
569 	/** SSID */
570 	const uint8_t *ssid;
571 	/** SSID length */
572 	uint8_t ssid_length; /* Max 32 */
573 	/** Pre-shared key */
574 	const uint8_t *psk;
575 	/** Pre-shared key length */
576 	uint8_t psk_length; /* Min 8 - Max 64 */
577 	/** SAE password (same as PSK but with no length restrictions), optional */
578 	const uint8_t *sae_password;
579 	/** SAE password length */
580 	uint8_t sae_password_length; /* No length restrictions */
581 	/** Frequency band */
582 	uint8_t band;
583 	/** Channel */
584 	uint8_t channel;
585 	/** Security type */
586 	enum wifi_security_type security;
587 	/** MFP options */
588 	enum wifi_mfp_options mfp;
589 	/** BSSID */
590 	uint8_t bssid[WIFI_MAC_ADDR_LEN];
591 	/** Connect timeout in seconds, SYS_FOREVER_MS for no timeout */
592 	int timeout;
593 	/**
594 	 * Anonymous identity used in EAP authentication (Phase 1) for Wi-Fi Enterprise networks.
595 	 * In EAP methods such as PEAP or TTLS, the anonymous identity is sent in the initial
596 	 * outer authentication exchange to protect the user's real identity (eap_identity).
597 	 * This value is not always required; if not set, the real identity may be exposed.
598 	 * Only used in Phase 1 (outer authentication).
599 	 */
600 	const uint8_t *anon_id;
601 
602 	/** Length of the anonymous identity, maximum 64 bytes. */
603 	uint8_t aid_length;
604 
605 	/**
606 	 * Private key password for Wi-Fi Enterprise authentication.
607 	 * Used when a client certificate and private key are required (e.g., EAP-TLS).
608 	 * This is the password protecting the private key file.
609 	 * Applies to Phase 1 (outer authentication) when client certificates are used.
610 	 */
611 	const uint8_t *key_passwd;
612 
613 	/** Length of the private key password, maximum 128 bytes. */
614 	uint8_t key_passwd_length;
615 
616 	/**
617 	 * Password for a secondary private key, if required by the authentication method.
618 	 * Rarely used; typically only needed for advanced enterprise setups.
619 	 * Applies to Phase 1 (outer authentication) if a second private key is used.
620 	 */
621 	const uint8_t *key2_passwd;
622 
623 	/** Length of the secondary private key password, maximum 128 bytes. */
624 	uint8_t key2_passwd_length;
625 
626 	/**
627 	 * WPA3 Enterprise mode type.
628 	 * Selects the WPA3 Enterprise authentication variant to use.
629 	 * WPA3 Enterprise is a security protocol for Wi-Fi networks, often used in organizations,
630 	 * that provides enhanced security over WPA2. This field is only relevant for enterprise
631 	 * networks.
632 	 * Applies to Phase 1 (outer authentication).
633 	 */
634 	enum wifi_wpa3_enterprise_type wpa3_ent_mode;
635 
636 	/**
637 	 * TLS cipher suite to use for EAP-TLS authentication.
638 	 * This selects the cryptographic algorithms used for the secure connection.
639 	 * Only relevant for enterprise networks using EAP-TLS or similar methods.
640 	 * Applies to Phase 1 (outer authentication).
641 	 */
642 	uint8_t TLS_cipher;
643 
644 	/**
645 	 * EAP (Extensible Authentication Protocol) version to use.
646 	 * EAP is a framework for network authentication, commonly used in enterprise Wi-Fi.
647 	 * This field allows specifying the protocol version if required by the network.
648 	 * Applies to Phase 1 (outer authentication).
649 	 */
650 	int eap_ver;
651 
652 	/**
653 	 * Identity string for EAP authentication (Phase 2, inner authentication).
654 	 * This is the real username or identity presented to the authentication server
655 	 * after the secure tunnel is established (e.g., inside PEAP or TTLS).
656 	 * Required for most enterprise Wi-Fi networks (e.g., WPA2/WPA3 Enterprise).
657 	 * Applies to Phase 2 (inner authentication).
658 	 */
659 	const uint8_t *eap_identity;
660 
661 	/** Length of the EAP identity, maximum 64 bytes. */
662 	uint8_t eap_id_length;
663 
664 	/**
665 	 * Password string for EAP authentication (Phase 2, inner authentication).
666 	 * Used in EAP methods that require a password (e.g., PEAP, TTLS, EAP-FAST).
667 	 * This is the user's password for the enterprise Wi-Fi network.
668 	 * Applies to Phase 2 (inner authentication).
669 	 */
670 	const uint8_t *eap_password;
671 
672 	/** Length of the EAP password, maximum 128 bytes. */
673 	uint8_t eap_passwd_length;
674 
675 	/**
676 	 * Whether to verify the server's certificate authority (CA) during authentication.
677 	 * Set to true to require validation of the server's certificate (recommended for security).
678 	 * Set to false to skip CA verification (not recommended, but sometimes used for testing).
679 	 * Applies to Phase 1 (outer authentication).
680 	 */
681 	bool verify_peer_cert;
682 
683 	/**
684 	 * Indicates if Fast BSS Transition (802.11r) is used.
685 	 * Fast BSS Transition allows seamless roaming between access points in enterprise networks.
686 	 * Applies to the overall connection, not specific to EAP phases.
687 	 */
688 	bool ft_used;
689 
690 	/**
691 	 * Number of EAP user identities provided.
692 	 * Used for advanced enterprise authentication scenarios where multiple user credentials
693 	 * are needed.
694 	 * Applies to Phase 2 (inner authentication).
695 	 */
696 	int nusers;
697 
698 	/**
699 	 * Number of EAP passwords provided.
700 	 * Used in conjunction with multiple user identities for enterprise authentication.
701 	 * Applies to Phase 2 (inner authentication).
702 	 */
703 	uint8_t passwds;
704 
705 	/**
706 	 * Array of pointers to user identity strings for EAP authentication.
707 	 * Used for enterprise Wi-Fi networks that require multiple user identities.
708 	 * Applies to Phase 2 (inner authentication).
709 	 */
710 	const uint8_t *identities[WIFI_ENT_IDENTITY_MAX_USERS];
711 
712 	/**
713 	 * Array of pointers to user password strings for EAP authentication.
714 	 * Used for enterprise Wi-Fi networks that require multiple user passwords.
715 	 * Applies to Phase 2 (inner authentication).
716 	 */
717 	const uint8_t *passwords[WIFI_ENT_IDENTITY_MAX_USERS];
718 	/** Hidden SSID configure
719 	 * 0: disabled (default)
720 	 * 1: send empty (length=0) SSID in beacon and ignore probe request for broadcast SSID
721 	 * 2: clear SSID, but keep the original length and ignore probe request for broadcast SSID
722 	 */
723 	uint8_t ignore_broadcast_ssid;
724 	/** Parameter used for frequency band */
725 	enum wifi_frequency_bandwidths bandwidth;
726 
727 	/** Full domain name to verify in the server certificate */
728 	const uint8_t *server_cert_domain_exact;
729 	/** Length of the server_cert_domain_exact string, maximum 128 bytes */
730 	uint8_t server_cert_domain_exact_len;
731 
732 	/** Domain name suffix to verify in the server certificate */
733 	const uint8_t *server_cert_domain_suffix;
734 	/** Length of the server_cert_domain_suffix string, maximum 64 bytes */
735 	uint8_t server_cert_domain_suffix_len;
736 };
737 
738 /** @brief Wi-Fi disconnect reason codes. To be overlaid on top of \ref wifi_status
739  * in the disconnect result event for detailed reason.
740  */
741 enum wifi_disconn_reason {
742 	/** Success, overload status as reason */
743 	WIFI_REASON_DISCONN_SUCCESS = 0,
744 	/** Unspecified reason */
745 	WIFI_REASON_DISCONN_UNSPECIFIED,
746 	/** Disconnected due to user request */
747 	WIFI_REASON_DISCONN_USER_REQUEST,
748 	/** Disconnected due to AP leaving */
749 	WIFI_REASON_DISCONN_AP_LEAVING,
750 	/** Disconnected due to inactivity */
751 	WIFI_REASON_DISCONN_INACTIVITY,
752 };
753 
754 /** @brief Wi-Fi AP mode result codes. To be overlaid on top of \ref wifi_status
755  * in the AP mode enable or disable result event for detailed status.
756  */
757 enum wifi_ap_status {
758 	/** AP mode enable or disable successful */
759 	WIFI_STATUS_AP_SUCCESS = 0,
760 	/** AP mode enable or disable failed - generic failure */
761 	WIFI_STATUS_AP_FAIL,
762 	/** AP mode enable failed - channel not supported */
763 	WIFI_STATUS_AP_CHANNEL_NOT_SUPPORTED,
764 	/** AP mode enable failed - channel not allowed */
765 	WIFI_STATUS_AP_CHANNEL_NOT_ALLOWED,
766 	/** AP mode enable failed - SSID not allowed */
767 	WIFI_STATUS_AP_SSID_NOT_ALLOWED,
768 	/** AP mode enable failed - authentication type not supported */
769 	WIFI_STATUS_AP_AUTH_TYPE_NOT_SUPPORTED,
770 	/** AP mode enable failed - operation not supported */
771 	WIFI_STATUS_AP_OP_NOT_SUPPORTED,
772 	/** AP mode enable failed - operation not permitted */
773 	WIFI_STATUS_AP_OP_NOT_PERMITTED,
774 };
775 
776 /** @brief Generic Wi-Fi status for commands and events */
777 struct wifi_status {
778 	union {
779 		/** Status value */
780 		int status;
781 		/** Connection status */
782 		enum wifi_conn_status conn_status;
783 		/** Disconnection reason status */
784 		enum wifi_disconn_reason disconn_reason;
785 		/** Access point status */
786 		enum wifi_ap_status ap_status;
787 	};
788 };
789 
790 /** @brief Wi-Fi interface status */
791 struct wifi_iface_status {
792 	/** Interface state, see enum wifi_iface_state */
793 	int state;
794 	/** SSID length */
795 	unsigned int ssid_len;
796 	/** SSID */
797 	char ssid[WIFI_SSID_MAX_LEN + 1];
798 	/** BSSID */
799 	char bssid[WIFI_MAC_ADDR_LEN];
800 	/** Frequency band */
801 	enum wifi_frequency_bands band;
802 	/** Channel */
803 	unsigned int channel;
804 	/** Interface mode, see enum wifi_iface_mode */
805 	enum wifi_iface_mode iface_mode;
806 	/** Link mode, see enum wifi_link_mode */
807 	enum wifi_link_mode link_mode;
808 	/** WPA3 enterprise type */
809 	enum wifi_wpa3_enterprise_type wpa3_ent_type;
810 	/** Security type, see enum wifi_security_type */
811 	enum wifi_security_type security;
812 	/** MFP options, see enum wifi_mfp_options */
813 	enum wifi_mfp_options mfp;
814 	/** RSSI */
815 	int rssi;
816 	/** DTIM period */
817 	unsigned char dtim_period;
818 	/** Beacon interval */
819 	unsigned short beacon_interval;
820 	/** is TWT capable? */
821 	bool twt_capable;
822 	/** The current 802.11 PHY TX data rate (in Mbps) */
823 	float current_phy_tx_rate;
824 };
825 
826 /** @brief Wi-Fi power save parameters */
827 struct wifi_ps_params {
828 	/** Power save state */
829 	enum wifi_ps enabled;
830 	/** Listen interval */
831 	unsigned short listen_interval;
832 	/** Wi-Fi power save wakeup mode */
833 	enum wifi_ps_wakeup_mode wakeup_mode;
834 	/** Wi-Fi power save mode */
835 	enum wifi_ps_mode mode;
836 	/** Wi-Fi power save timeout
837 	 *
838 	 * This is the time out to wait after sending a TX packet
839 	 * before going back to power save (in ms) to receive any replies
840 	 * from the AP. Zero means this feature is disabled.
841 	 *
842 	 * It's a tradeoff between power consumption and latency.
843 	 */
844 	unsigned int timeout_ms;
845 	/** Wi-Fi power save type */
846 	enum wifi_ps_param_type type;
847 	/** Wi-Fi power save fail reason */
848 	enum wifi_config_ps_param_fail_reason fail_reason;
849 	/** Wi-Fi power save exit strategy */
850 	enum wifi_ps_exit_strategy exit_strategy;
851 };
852 
853 #define WIFI_BTWT_AGREEMENT_MAX 5
854 
855 /** @brief Wi-Fi broadcast TWT parameters */
856 struct wifi_btwt_params {
857 	/** Broadcast TWT ID */
858 	uint8_t btwt_id;
859 	/** Broadcast TWT mantissa */
860 	uint16_t btwt_mantissa;
861 	/** Broadcast TWT exponent */
862 	uint8_t btwt_exponent;
863 	/** Broadcast TWT range */
864 	uint8_t btwt_nominal_wake;
865 };
866 
867 /** @brief Wi-Fi TWT parameters */
868 struct wifi_twt_params {
869 	/** TWT operation, see enum wifi_twt_operation */
870 	enum wifi_twt_operation operation;
871 	/** TWT negotiation type, see enum wifi_twt_negotiation_type */
872 	enum wifi_twt_negotiation_type negotiation_type;
873 	/** TWT setup command, see enum wifi_twt_setup_cmd */
874 	enum wifi_twt_setup_cmd setup_cmd;
875 	/** TWT setup response status, see enum wifi_twt_setup_resp_status */
876 	enum wifi_twt_setup_resp_status resp_status;
877 	/** TWT teardown cmd status, see enum wifi_twt_teardown_status */
878 	enum wifi_twt_teardown_status teardown_status;
879 	/** Dialog token, used to map requests to responses */
880 	uint8_t dialog_token;
881 	/** Flow ID, used to map setup with teardown */
882 	uint8_t flow_id;
883 	union {
884 		/** Setup specific parameters */
885 		struct {
886 			/**Interval = Wake up time + Sleeping time */
887 			uint64_t twt_interval;
888 			/** Requestor or responder */
889 			bool responder;
890 			/** Trigger enabled or disabled */
891 			bool trigger;
892 			/** Implicit or explicit */
893 			bool implicit;
894 			/** Announced or unannounced */
895 			bool announce;
896 			/** Wake up time */
897 			uint32_t twt_wake_interval;
898 			/** Wake ahead notification is sent earlier than
899 			 * TWT Service period (SP) start based on this duration.
900 			 * This should give applications ample time to
901 			 * prepare the data before TWT SP starts.
902 			 */
903 			uint32_t twt_wake_ahead_duration;
904 			/** TWT info enabled or disable */
905 			bool twt_info_disable;
906 			/** TWT exponent */
907 			uint8_t twt_exponent;
908 			/** TWT Mantissa Range: [0-sizeof(UINT16)] */
909 			uint16_t twt_mantissa;
910 		} setup;
911 		/** Setup specific parameters */
912 		struct {
913 			/** Broadcast TWT station wait time */
914 			uint8_t btwt_sta_wait;
915 			/** Broadcast TWT offset */
916 			uint16_t btwt_offset;
917 			/** In multiple of 4 beacon interval */
918 			uint8_t btwt_li;
919 			/** Broadcast TWT agreement count */
920 			uint8_t btwt_count;
921 			/** Broadcast TWT agreement sets */
922 			struct wifi_btwt_params btwt_set_cfg[WIFI_BTWT_AGREEMENT_MAX];
923 		} btwt;
924 		/** Teardown specific parameters */
925 		struct {
926 			/** Teardown all flows */
927 			bool teardown_all;
928 		} teardown;
929 	};
930 	/** TWT fail reason, see enum wifi_twt_fail_reason */
931 	enum wifi_twt_fail_reason fail_reason;
932 };
933 
934 /** @cond INTERNAL_HIDDEN */
935 
936 /* Flow ID is only 3 bits */
937 #define WIFI_MAX_TWT_FLOWS 8
938 #define WIFI_MAX_TWT_INTERVAL_US (LONG_MAX - 1)
939 /* 256 (u8) * 1TU */
940 #define WIFI_MAX_TWT_WAKE_INTERVAL_US 262144
941 #define WIFI_MAX_TWT_WAKE_AHEAD_DURATION_US (LONG_MAX - 1)
942 #define WIFI_MAX_TWT_EXPONENT 31
943 
944 /** @endcond */
945 
946 /** @brief Wi-Fi TWT flow information */
947 struct wifi_twt_flow_info {
948 	/** Interval = Wake up time + Sleeping time */
949 	uint64_t  twt_interval;
950 	/** Dialog token, used to map requests to responses */
951 	uint8_t dialog_token;
952 	/** Flow ID, used to map setup with teardown */
953 	uint8_t flow_id;
954 	/** TWT negotiation type, see enum wifi_twt_negotiation_type */
955 	enum wifi_twt_negotiation_type negotiation_type;
956 	/** Requestor or responder */
957 	bool responder;
958 	/** Trigger enabled or disabled */
959 	bool trigger;
960 	/** Implicit or explicit */
961 	bool implicit;
962 	/** Announced or unannounced */
963 	bool announce;
964 	/** Wake up time */
965 	uint32_t twt_wake_interval;
966 	/** Wake ahead duration */
967 	uint32_t twt_wake_ahead_duration;
968 };
969 
970 /** Wi-Fi enterprise mode credentials */
971 struct wifi_enterprise_creds_params {
972 	/** CA certification */
973 	uint8_t *ca_cert;
974 	/** CA certification length */
975 	uint32_t ca_cert_len;
976 	/** Client certification */
977 	uint8_t *client_cert;
978 	/** Client certification length */
979 	uint32_t client_cert_len;
980 	/** Client key */
981 	uint8_t *client_key;
982 	/** Client key length */
983 	uint32_t client_key_len;
984 	/** CA certification of phase2*/
985 	uint8_t *ca_cert2;
986 	/** Phase2 CA certification length */
987 	uint32_t ca_cert2_len;
988 	/** Client certification of phase2*/
989 	uint8_t *client_cert2;
990 	/** Phase2 Client certification length */
991 	uint32_t client_cert2_len;
992 	/** Client key of phase2*/
993 	uint8_t *client_key2;
994 	/** Phase2 Client key length */
995 	uint32_t client_key2_len;
996 	/** Server certification */
997 	uint8_t *server_cert;
998 	/** Server certification length */
999 	uint32_t server_cert_len;
1000 	/** Server key */
1001 	uint8_t *server_key;
1002 	/** Server key length */
1003 	uint32_t server_key_len;
1004 	/** Diffie–Hellman parameter */
1005 	uint8_t *dh_param;
1006 	/** Diffie–Hellman parameter length */
1007 	uint32_t dh_param_len;
1008 };
1009 
1010 /** @brief Wi-Fi power save configuration */
1011 struct wifi_ps_config {
1012 	/** Number of TWT flows */
1013 	char num_twt_flows;
1014 	/** TWT flow details */
1015 	struct wifi_twt_flow_info twt_flows[WIFI_MAX_TWT_FLOWS];
1016 	/** Power save configuration */
1017 	struct wifi_ps_params ps_params;
1018 };
1019 
1020 /** @brief Generic get/set operation for any command*/
1021 enum wifi_mgmt_op {
1022 	/** Get operation */
1023 	WIFI_MGMT_GET = 0,
1024 	/** Set operation */
1025 	WIFI_MGMT_SET = 1,
1026 };
1027 
1028 /** Wi-Fi 11k parameters */
1029 struct wifi_11k_params {
1030 	/** 11k command operation */
1031 	enum wifi_mgmt_op oper;
1032 	/** 11k enable/disable */
1033 	bool enable_11k;
1034 	/** SSID */
1035 	uint8_t ssid[WIFI_SSID_MAX_LEN + 1];
1036 };
1037 
1038 /** Max regulatory channel number */
1039 #define MAX_REG_CHAN_NUM  42
1040 
1041 /** @brief Per-channel regulatory attributes */
1042 struct wifi_reg_chan_info {
1043 	/** Center frequency in MHz */
1044 	unsigned short center_frequency;
1045 	/** Maximum transmission power (in dBm) */
1046 	unsigned short max_power:8;
1047 	/** Is channel supported or not */
1048 	unsigned short supported:1;
1049 	/** Passive transmissions only */
1050 	unsigned short passive_only:1;
1051 	/** Is a DFS channel */
1052 	unsigned short dfs:1;
1053 } __packed;
1054 
1055 /** @brief Regulatory domain information or configuration */
1056 struct wifi_reg_domain {
1057 	/** Regulatory domain operation */
1058 	enum wifi_mgmt_op oper;
1059 	/** Ignore all other regulatory hints over this one, the behavior is
1060 	 * implementation specific.
1061 	 */
1062 	bool force;
1063 	/** Country code: ISO/IEC 3166-1 alpha-2 */
1064 	uint8_t country_code[WIFI_COUNTRY_CODE_LEN];
1065 	/** Number of channels supported */
1066 	unsigned int num_channels;
1067 	/** Channels information */
1068 	struct wifi_reg_chan_info *chan_info;
1069 };
1070 
1071 /** @brief Wi-Fi TWT sleep states */
1072 enum wifi_twt_sleep_state {
1073 	/** TWT sleep state: sleeping */
1074 	WIFI_TWT_STATE_SLEEP = 0,
1075 	/** TWT sleep state: awake */
1076 	WIFI_TWT_STATE_AWAKE = 1,
1077 };
1078 
1079 #if defined(CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS) || defined(__DOXYGEN__)
1080 /** @brief Wi-Fi raw scan result */
1081 struct wifi_raw_scan_result {
1082 	/** RSSI */
1083 	int8_t rssi;
1084 	/** Frame length */
1085 	int frame_length;
1086 	/** Frequency */
1087 	unsigned short frequency;
1088 	/** Raw scan data */
1089 	uint8_t data[CONFIG_WIFI_MGMT_RAW_SCAN_RESULT_LENGTH];
1090 };
1091 #endif /* CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS */
1092 
1093 /** @brief AP mode - connected STA details */
1094 struct wifi_ap_sta_info {
1095 	/** Link mode, see enum wifi_link_mode */
1096 	enum wifi_link_mode link_mode;
1097 	/** MAC address */
1098 	uint8_t mac[WIFI_MAC_ADDR_LEN];
1099 	/** MAC address length */
1100 	uint8_t mac_length;
1101 	/** is TWT capable ? */
1102 	bool twt_capable;
1103 };
1104 
1105 /** @cond INTERNAL_HIDDEN */
1106 
1107 /* for use in max info size calculations */
1108 union wifi_mgmt_events {
1109 	struct wifi_scan_result scan_result;
1110 	struct wifi_status connect_status;
1111 	struct wifi_iface_status iface_status;
1112 #ifdef CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS
1113 	struct wifi_raw_scan_result raw_scan_result;
1114 #endif /* CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS */
1115 	struct wifi_twt_params twt_params;
1116 	struct wifi_ap_sta_info ap_sta_info;
1117 };
1118 
1119 /** @endcond */
1120 
1121 /** @brief Wi-Fi mode setup */
1122 struct wifi_mode_info {
1123 	/** Mode setting for a specific mode of operation */
1124 	uint8_t mode;
1125 	/** Interface index */
1126 	uint8_t if_index;
1127 	/** Get or set operation */
1128 	enum wifi_mgmt_op oper;
1129 };
1130 
1131 /** @brief Wi-Fi filter setting for monitor, prmoiscuous, TX-injection modes */
1132 struct wifi_filter_info {
1133 	/** Filter setting */
1134 	uint8_t filter;
1135 	/** Interface index */
1136 	uint8_t if_index;
1137 	/** Filter buffer size */
1138 	uint16_t buffer_size;
1139 	/** Get or set operation */
1140 	enum wifi_mgmt_op oper;
1141 };
1142 
1143 /** @brief Wi-Fi channel setting for monitor and TX-injection modes */
1144 struct wifi_channel_info {
1145 	/** Channel value to set */
1146 	uint16_t channel;
1147 	/** Interface index */
1148 	uint8_t if_index;
1149 	/** Get or set operation */
1150 	enum wifi_mgmt_op oper;
1151 };
1152 
1153 /** @cond INTERNAL_HIDDEN */
1154 #define WIFI_AP_STA_MAX_INACTIVITY (LONG_MAX - 1)
1155 #define WIFI_AP_IEEE_80211_CAPAB_MAX_LEN 64
1156 /** @endcond */
1157 
1158 /** @brief Wi-Fi AP configuration parameter */
1159 struct wifi_ap_config_params {
1160 	/** Parameter used to identify the different AP parameters */
1161 	enum wifi_ap_config_param type;
1162 	/** Parameter used for setting maximum inactivity duration for stations */
1163 	uint32_t max_inactivity;
1164 	/** Parameter used for setting maximum number of stations */
1165 	uint32_t max_num_sta;
1166 	/** Parameter used for frequency band */
1167 	enum wifi_frequency_bandwidths bandwidth;
1168 #if defined(CONFIG_WIFI_NM_HOSTAPD_AP)
1169 	/** Parameter used for setting HT capabilities */
1170 	char ht_capab[WIFI_AP_IEEE_80211_CAPAB_MAX_LEN + 1];
1171 	/** Parameter used for setting VHT capabilities */
1172 	char vht_capab[WIFI_AP_IEEE_80211_CAPAB_MAX_LEN + 1];
1173 #endif
1174 };
1175 
1176 /** @brief Wi-Fi STA configuration parameter */
1177 struct wifi_config_params {
1178 	/** Parameter used to identify the different STA parameters */
1179 	enum wifi_config_param type;
1180 	/** Parameter used for opportunistic key caching */
1181 	int okc;
1182 };
1183 
1184 #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP
1185 /** @brief Wi-Fi DPP configuration parameter */
1186 /** Wi-Fi DPP QR-CODE in string max len for SHA512 */
1187 #define WIFI_DPP_QRCODE_MAX_LEN 255
1188 
1189 /** Wi-Fi DPP operations */
1190 enum wifi_dpp_op {
1191 	/** Unset invalid operation */
1192 	WIFI_DPP_OP_INVALID = 0,
1193 	/** Add configurator */
1194 	WIFI_DPP_CONFIGURATOR_ADD,
1195 	/** Start DPP auth as configurator or enrollee */
1196 	WIFI_DPP_AUTH_INIT,
1197 	/** Scan qr_code as parameter */
1198 	WIFI_DPP_QR_CODE,
1199 	/** Start DPP chirp to send DPP announcement */
1200 	WIFI_DPP_CHIRP,
1201 	/** Listen on specific frequency */
1202 	WIFI_DPP_LISTEN,
1203 	/** Generate a bootstrap like qrcode */
1204 	WIFI_DPP_BOOTSTRAP_GEN,
1205 	/** Get a bootstrap uri for external device to scan */
1206 	WIFI_DPP_BOOTSTRAP_GET_URI,
1207 	/** Set configurator parameters */
1208 	WIFI_DPP_SET_CONF_PARAM,
1209 	/** Set DPP rx response wait timeout */
1210 	WIFI_DPP_SET_WAIT_RESP_TIME,
1211 	/** Reconfigure DPP network */
1212 	WIFI_DPP_RECONFIG
1213 };
1214 
1215 /** Wi-Fi DPP crypto Elliptic Curves */
1216 enum wifi_dpp_curves {
1217 	/** Unset default use P-256 */
1218 	WIFI_DPP_CURVES_DEFAULT = 0,
1219 	/** prime256v1 */
1220 	WIFI_DPP_CURVES_P_256,
1221 	/** secp384r1 */
1222 	WIFI_DPP_CURVES_P_384,
1223 	/** secp521r1 */
1224 	WIFI_DPP_CURVES_P_512,
1225 	/** brainpoolP256r1 */
1226 	WIFI_DPP_CURVES_BP_256,
1227 	/** brainpoolP384r1 */
1228 	WIFI_DPP_CURVES_BP_384,
1229 	/** brainpoolP512r1 */
1230 	WIFI_DPP_CURVES_BP_512
1231 };
1232 
1233 /** Wi-Fi DPP role */
1234 enum wifi_dpp_role {
1235 	/** Unset role */
1236 	WIFI_DPP_ROLE_UNSET = 0,
1237 	/** Configurator passes AP config to enrollee */
1238 	WIFI_DPP_ROLE_CONFIGURATOR,
1239 	/** Enrollee gets AP config and connect to AP */
1240 	WIFI_DPP_ROLE_ENROLLEE,
1241 	/** Both configurator and enrollee might be chosen */
1242 	WIFI_DPP_ROLE_EITHER
1243 };
1244 
1245 /** Wi-Fi DPP security type
1246  *
1247  * current only support DPP only AKM
1248  */
1249 enum wifi_dpp_conf {
1250 	/** Unset conf */
1251 	WIFI_DPP_CONF_UNSET = 0,
1252 	/** conf=sta-dpp, AKM DPP only for sta */
1253 	WIFI_DPP_CONF_STA,
1254 	/** conf=ap-dpp, AKM DPP only for ap */
1255 	WIFI_DPP_CONF_AP,
1256 	/** conf=query, query for AKM */
1257 	WIFI_DPP_CONF_QUERY
1258 };
1259 
1260 /** Wi-Fi DPP bootstrap type
1261  *
1262  * current default and only support QR-CODE
1263  */
1264 enum wifi_dpp_bootstrap_type {
1265 	/** Unset type */
1266 	WIFI_DPP_BOOTSTRAP_TYPE_UNSET = 0,
1267 	/** qrcode */
1268 	WIFI_DPP_BOOTSTRAP_TYPE_QRCODE,
1269 	/** pkex */
1270 	WIFI_DPP_BOOTSTRAP_TYPE_PKEX,
1271 	/** nfc */
1272 	WIFI_DPP_BOOTSTRAP_TYPE_NFC_URI
1273 };
1274 
1275 /** Params to add DPP configurator */
1276 struct wifi_dpp_configurator_add_params {
1277 	/** ECP curves for private key */
1278 	int curve;
1279 	/** ECP curves for net access key */
1280 	int net_access_key_curve;
1281 };
1282 
1283 /** Params to initiate a DPP auth procedure */
1284 struct wifi_dpp_auth_init_params {
1285 	/** Peer bootstrap id */
1286 	int peer;
1287 	/** Configuration parameter id */
1288 	int configurator;
1289 	/** Role configurator or enrollee */
1290 	int role;
1291 	/** Security type */
1292 	int conf;
1293 	/** SSID in string */
1294 	char ssid[WIFI_SSID_MAX_LEN + 1];
1295 };
1296 
1297 /** Params to do DPP chirp */
1298 struct wifi_dpp_chirp_params {
1299 	/** Own bootstrap id */
1300 	int id;
1301 	/** Chirp on frequency */
1302 	int freq;
1303 };
1304 
1305 /** Params to do DPP listen */
1306 struct wifi_dpp_listen_params {
1307 	/** Listen on frequency */
1308 	int freq;
1309 	/** Role configurator or enrollee */
1310 	int role;
1311 };
1312 
1313 /** Params to generate a DPP bootstrap */
1314 struct wifi_dpp_bootstrap_gen_params {
1315 	/** Bootstrap type */
1316 	int type;
1317 	/** Own operating class */
1318 	int op_class;
1319 	/** Own working channel */
1320 	int chan;
1321 	/** ECP curves */
1322 	int curve;
1323 	/** Own mac address */
1324 	uint8_t mac[WIFI_MAC_ADDR_LEN];
1325 };
1326 
1327 /** Params to set specific DPP configurator */
1328 struct wifi_dpp_configurator_set_params {
1329 	/** Peer bootstrap id */
1330 	int peer;
1331 	/** Configuration parameter id */
1332 	int configurator;
1333 	/** Role configurator or enrollee */
1334 	int role;
1335 	/** Security type */
1336 	int conf;
1337 	/** ECP curves for private key */
1338 	int curve;
1339 	/** ECP curves for net access key */
1340 	int net_access_key_curve;
1341 	/** Own mac address */
1342 	char ssid[WIFI_SSID_MAX_LEN + 1];
1343 };
1344 
1345 /** Wi-Fi DPP params for various operations
1346  */
1347 struct wifi_dpp_params {
1348 	/** Operation enum */
1349 	int action;
1350 	union {
1351 		/** Params to add DPP configurator */
1352 		struct wifi_dpp_configurator_add_params configurator_add;
1353 		/** Params to initiate a DPP auth procedure */
1354 		struct wifi_dpp_auth_init_params auth_init;
1355 		/** Params to do DPP chirp */
1356 		struct wifi_dpp_chirp_params chirp;
1357 		/** Params to do DPP listen */
1358 		struct wifi_dpp_listen_params listen;
1359 		/** Params to generate a DPP bootstrap */
1360 		struct wifi_dpp_bootstrap_gen_params bootstrap_gen;
1361 		/** Params to set specific DPP configurator */
1362 		struct wifi_dpp_configurator_set_params configurator_set;
1363 		/** Bootstrap get uri id */
1364 		int id;
1365 		/** Timeout for DPP frame response rx */
1366 		int dpp_resp_wait_time;
1367 		/** network id for reconfig */
1368 		int network_id;
1369 		/** DPP QR-CODE, max for SHA512 */
1370 		uint8_t dpp_qr_code[WIFI_DPP_QRCODE_MAX_LEN + 1];
1371 		/** Request response reusing request buffer.
1372 		 * So once a request is sent, buffer will be
1373 		 * fulfilled by response
1374 		 */
1375 		char resp[WIFI_DPP_QRCODE_MAX_LEN + 1];
1376 	};
1377 };
1378 #endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP */
1379 
1380 #define WIFI_WPS_PIN_MAX_LEN 8
1381 
1382 /** Operation for WPS */
1383 enum wifi_wps_op {
1384 	/** WPS pbc */
1385 	WIFI_WPS_PBC = 0,
1386 	/** Get WPS pin number */
1387 	WIFI_WPS_PIN_GET = 1,
1388 	/** Set WPS pin number */
1389 	WIFI_WPS_PIN_SET = 2,
1390 };
1391 
1392 /** Wi-Fi wps setup */
1393 struct wifi_wps_config_params {
1394 	/** wps operation */
1395 	enum wifi_wps_op oper;
1396 	/** pin value*/
1397 	char pin[WIFI_WPS_PIN_MAX_LEN + 1];
1398 };
1399 
1400 /** Wi-Fi AP status
1401  */
1402 enum wifi_sap_iface_state {
1403 	WIFI_SAP_IFACE_UNINITIALIZED,
1404 	WIFI_SAP_IFACE_DISABLED,
1405 	WIFI_SAP_IFACE_COUNTRY_UPDATE,
1406 	WIFI_SAP_IFACE_ACS,
1407 	WIFI_SAP_IFACE_HT_SCAN,
1408 	WIFI_SAP_IFACE_DFS,
1409 	WIFI_SAP_IFACE_NO_IR,
1410 	WIFI_SAP_IFACE_ENABLED
1411 };
1412 
1413 #if defined(CONFIG_WIFI_NM_WPA_SUPPLICANT_BGSCAN) || defined(__DOXYGEN__)
1414 /** @brief Wi-Fi background scan implementation */
1415 enum wifi_bgscan_type {
1416 	/** None, background scan is disabled */
1417 	WIFI_BGSCAN_NONE = 0,
1418 	/** Simple, periodic scan based on signal strength */
1419 	WIFI_BGSCAN_SIMPLE,
1420 	/** Learn channels used by the network (experimental) */
1421 	WIFI_BGSCAN_LEARN,
1422 };
1423 
1424 /** @brief Wi-Fi background scan parameters */
1425 struct wifi_bgscan_params {
1426 	/** The type of background scanning */
1427 	enum wifi_bgscan_type type;
1428 	/** Short scan interval in seconds */
1429 	uint16_t short_interval;
1430 	/** Long scan interval in seconds */
1431 	uint16_t long_interval;
1432 	/** Signal strength threshold in dBm */
1433 	int8_t rssi_threshold;
1434 	/** Number of BSS Transition Management (BTM) queries */
1435 	uint16_t btm_queries;
1436 };
1437 #endif
1438 
1439 /* Extended Capabilities */
1440 enum wifi_ext_capab {
1441 	WIFI_EXT_CAPAB_20_40_COEX = 0,
1442 	WIFI_EXT_CAPAB_GLK = 1,
1443 	WIFI_EXT_CAPAB_EXT_CHAN_SWITCH = 2,
1444 	WIFI_EXT_CAPAB_TIM_BROADCAST = 18,
1445 	WIFI_EXT_CAPAB_BSS_TRANSITION = 19,
1446 };
1447 
1448 #include <zephyr/net/net_if.h>
1449 
1450 /** Scan result callback
1451  *
1452  * @param iface Network interface
1453  * @param status Scan result status
1454  * @param entry Scan result entry
1455  */
1456 typedef void (*scan_result_cb_t)(struct net_if *iface, int status,
1457 				 struct wifi_scan_result *entry);
1458 
1459 #ifdef CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS
1460 /** Raw scan result callback
1461  *
1462  * @param iface Network interface
1463  * @param status Raw scan result status
1464  * @param entry Raw scan result entry
1465  */
1466 typedef void (*raw_scan_result_cb_t)(struct net_if *iface, int status,
1467 				     struct wifi_raw_scan_result *entry);
1468 #endif /* CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS */
1469 
1470 /** Wi-Fi management API */
1471 struct wifi_mgmt_ops {
1472 	/** Scan for Wi-Fi networks
1473 	 *
1474 	 * @param dev Pointer to the device structure for the driver instance.
1475 	 * @param params Scan parameters
1476 	 * @param cb Callback to be called for each result
1477 	 *           cb parameter is the cb that should be called for each
1478 	 *           result by the driver. The wifi mgmt part will take care of
1479 	 *           raising the necessary event etc.
1480 	 *
1481 	 * @return 0 if ok, < 0 if error
1482 	 */
1483 	int (*scan)(const struct device *dev,
1484 		    struct wifi_scan_params *params,
1485 		    scan_result_cb_t cb);
1486 	/** Connect to a Wi-Fi network
1487 	 *
1488 	 * @param dev Pointer to the device structure for the driver instance.
1489 	 * @param params Connect parameters
1490 	 *
1491 	 * @return 0 if ok, < 0 if error
1492 	 */
1493 	int (*connect)(const struct device *dev,
1494 		       struct wifi_connect_req_params *params);
1495 	/** Disconnect from a Wi-Fi network
1496 	 *
1497 	 * @param dev Pointer to the device structure for the driver instance.
1498 	 *
1499 	 * @return 0 if ok, < 0 if error
1500 	 */
1501 	int (*disconnect)(const struct device *dev);
1502 	/** Enable AP mode
1503 	 *
1504 	 * @param dev Pointer to the device structure for the driver instance.
1505 	 * @param params AP mode parameters
1506 	 *
1507 	 * @return 0 if ok, < 0 if error
1508 	 */
1509 	int (*ap_enable)(const struct device *dev,
1510 			 struct wifi_connect_req_params *params);
1511 	/** Disable AP mode
1512 	 *
1513 	 * @param dev Pointer to the device structure for the driver instance.
1514 	 *
1515 	 * @return 0 if ok, < 0 if error
1516 	 */
1517 	int (*ap_disable)(const struct device *dev);
1518 	/** Disconnect a STA from AP
1519 	 *
1520 	 * @param dev Pointer to the device structure for the driver instance.
1521 	 * @param mac MAC address of the STA to disconnect
1522 	 *
1523 	 * @return 0 if ok, < 0 if error
1524 	 */
1525 	int (*ap_sta_disconnect)(const struct device *dev, const uint8_t *mac);
1526 	/** Get interface status
1527 	 *
1528 	 * @param dev Pointer to the device structure for the driver instance.
1529 	 * @param status Interface status
1530 	 *
1531 	 * @return 0 if ok, < 0 if error
1532 	 */
1533 	int (*iface_status)(const struct device *dev, struct wifi_iface_status *status);
1534 #if defined(CONFIG_NET_STATISTICS_WIFI) || defined(__DOXYGEN__)
1535 	/** Get Wi-Fi statistics
1536 	 *
1537 	 * @param dev Pointer to the device structure for the driver instance.
1538 	 * @param stats Wi-Fi statistics
1539 	 *
1540 	 * @return 0 if ok, < 0 if error
1541 	 */
1542 	int (*get_stats)(const struct device *dev, struct net_stats_wifi *stats);
1543 	/** Reset  Wi-Fi statistics
1544 	 *
1545 	 * @param dev Pointer to the device structure for the driver instance.
1546 	 *
1547 	 * @return 0 if ok, < 0 if error
1548 	 */
1549 	int (*reset_stats)(const struct device *dev);
1550 #endif /* CONFIG_NET_STATISTICS_WIFI */
1551 	/** Set or get 11K status
1552 	 *
1553 	 * @param dev Pointer to the device structure for the driver instance.
1554 	 * @param params 11k parameters
1555 	 *
1556 	 * @return 0 if ok, < 0 if error
1557 	 */
1558 	int (*cfg_11k)(const struct device *dev, struct wifi_11k_params *params);
1559 	/** Send 11k neighbor request
1560 	 *
1561 	 * @param dev Pointer to the device structure for the driver instance.
1562 	 * @param params 11k parameters
1563 	 *
1564 	 * @return 0 if ok, < 0 if error
1565 	 */
1566 	int (*send_11k_neighbor_request)(const struct device *dev, struct wifi_11k_params *params);
1567 	/** Set power save status
1568 	 *
1569 	 * @param dev Pointer to the device structure for the driver instance.
1570 	 * @param params Power save parameters
1571 	 *
1572 	 * @return 0 if ok, < 0 if error
1573 	 */
1574 	int (*set_power_save)(const struct device *dev, struct wifi_ps_params *params);
1575 	/** Setup or teardown TWT flow
1576 	 *
1577 	 * @param dev Pointer to the device structure for the driver instance.
1578 	 * @param params TWT parameters
1579 	 *
1580 	 * @return 0 if ok, < 0 if error
1581 	 */
1582 	int (*set_twt)(const struct device *dev, struct wifi_twt_params *params);
1583 	/** Setup BTWT flow
1584 	 *
1585 	 * @param dev Pointer to the device structure for the driver instance.
1586 	 * @param params BTWT parameters
1587 	 *
1588 	 * @return 0 if ok, < 0 if error
1589 	 */
1590 	int (*set_btwt)(const struct device *dev, struct wifi_twt_params *params);
1591 	/** Get power save config
1592 	 *
1593 	 * @param dev Pointer to the device structure for the driver instance.
1594 	 * @param config Power save config
1595 	 *
1596 	 * @return 0 if ok, < 0 if error
1597 	 */
1598 	int (*get_power_save_config)(const struct device *dev, struct wifi_ps_config *config);
1599 	/** Set or get regulatory domain
1600 	 *
1601 	 * @param dev Pointer to the device structure for the driver instance.
1602 	 * @param reg_domain Regulatory domain
1603 	 *
1604 	 * @return 0 if ok, < 0 if error
1605 	 */
1606 	int (*reg_domain)(const struct device *dev, struct wifi_reg_domain *reg_domain);
1607 	/** Set or get packet filter settings for monitor and promiscuous modes
1608 	 *
1609 	 * @param dev Pointer to the device structure for the driver instance.
1610 	 * @param packet filter settings
1611 	 *
1612 	 * @return 0 if ok, < 0 if error
1613 	 */
1614 	int (*filter)(const struct device *dev, struct wifi_filter_info *filter);
1615 	/** Set or get mode of operation
1616 	 *
1617 	 * @param dev Pointer to the device structure for the driver instance.
1618 	 * @param mode settings
1619 	 *
1620 	 * @return 0 if ok, < 0 if error
1621 	 */
1622 	int (*mode)(const struct device *dev, struct wifi_mode_info *mode);
1623 	/** Set or get current channel of operation
1624 	 *
1625 	 * @param dev Pointer to the device structure for the driver instance.
1626 	 * @param channel settings
1627 	 *
1628 	 * @return 0 if ok, < 0 if error
1629 	 */
1630 	int (*channel)(const struct device *dev, struct wifi_channel_info *channel);
1631 
1632 	/** Send BTM query
1633 	 *
1634 	 * @param dev Pointer to the device structure for the driver instance.
1635 	 * @param reason query reason
1636 	 *
1637 	 * @return 0 if ok, < 0 if error
1638 	 */
1639 	int (*btm_query)(const struct device *dev, uint8_t reason);
1640 
1641 	/** Check if ap support Neighbor Report or not.
1642 	 * @param dev Pointer to the device structure for the driver instance.
1643 	 *
1644 	 * @return true if support, false if not support
1645 	 */
1646 	bool (*bss_support_neighbor_rep)(const struct device *dev);
1647 
1648 	/** Judge ap whether support the capability
1649 	 *
1650 	 * @param dev Pointer to the device structure for the driver instance.
1651 	 * @param capab is the capability to judge
1652 	 *
1653 	 * @return 1 if support, 0 if not support
1654 	 */
1655 	int (*bss_ext_capab)(const struct device *dev, int capab);
1656 
1657 	/** Send legacy scan
1658 	 *
1659 	 * @param dev Pointer to the device structure for the driver instance.
1660 	 *
1661 	 * @return 0 if ok, < 0 if error
1662 	 */
1663 	int (*legacy_roam)(const struct device *dev);
1664 
1665 	/** Get Version of WiFi driver and Firmware
1666 	 *
1667 	 * The driver that implements the get_version function must not use stack to allocate the
1668 	 * version information pointers that are returned as params struct members.
1669 	 * The version pointer parameters should point to a static memory either in ROM (preferred)
1670 	 * or in RAM.
1671 	 *
1672 	 * @param dev Pointer to the device structure for the driver instance
1673 	 * @param params Version parameters
1674 	 *
1675 	 * @return 0 if ok, < 0 if error
1676 	 */
1677 	int (*get_version)(const struct device *dev, struct wifi_version *params);
1678 	/** Get Wi-Fi connection parameters recently used
1679 	 *
1680 	 * @param dev Pointer to the device structure for the driver instance
1681 	 * @param params the Wi-Fi connection parameters recently used
1682 	 *
1683 	 * @return 0 if ok, < 0 if error
1684 	 */
1685 	int (*get_conn_params)(const struct device *dev, struct wifi_connect_req_params *params);
1686 	/** Set RTS threshold value
1687 	 *
1688 	 * @param dev Pointer to the device structure for the driver instance.
1689 	 * @param RTS threshold value
1690 	 *
1691 	 * @return 0 if ok, < 0 if error
1692 	 */
1693 	int (*set_rts_threshold)(const struct device *dev, unsigned int rts_threshold);
1694 	/** Configure AP parameter
1695 	 *
1696 	 * @param dev Pointer to the device structure for the driver instance.
1697 	 * @param params AP mode parameter configuration parameter info
1698 	 *
1699 	 * @return 0 if ok, < 0 if error
1700 	 */
1701 	int (*ap_config_params)(const struct device *dev, struct wifi_ap_config_params *params);
1702 	/** Configure STA parameter
1703 	 *
1704 	 * @param dev Pointer to the device structure for the driver instance.
1705 	 * @param params STA mode parameter configuration parameter info
1706 	 *
1707 	 * @return 0 if ok, < 0 if error
1708 	 */
1709 	int (*config_params)(const struct device *dev, struct wifi_config_params *params);
1710 #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP
1711 	/** Dispatch DPP operations by action enum, with or without arguments in string format
1712 	 *
1713 	 * @param dev Pointer to the device structure for the driver instance
1714 	 * @param params DPP action enum and parameters in string
1715 	 *
1716 	 * @return 0 if ok, < 0 if error
1717 	 */
1718 	int (*dpp_dispatch)(const struct device *dev, struct wifi_dpp_params *params);
1719 #endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP */
1720 	/** Flush PMKSA cache entries
1721 	 *
1722 	 * @param dev Pointer to the device structure for the driver instance.
1723 	 *
1724 	 * @return 0 if ok, < 0 if error
1725 	 */
1726 	int (*pmksa_flush)(const struct device *dev);
1727 	/** Set Wi-Fi enterprise mode CA/client Cert and key
1728 	 *
1729 	 * @param dev Pointer to the device structure for the driver instance.
1730 	 * @param creds Pointer to the CA/client Cert and key.
1731 	 *
1732 	 * @return 0 if ok, < 0 if error
1733 	 */
1734 #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE
1735 	int (*enterprise_creds)(const struct device *dev,
1736 			struct wifi_enterprise_creds_params *creds);
1737 #endif
1738 	/** Get RTS threshold value
1739 	 *
1740 	 * @param dev Pointer to the device structure for the driver instance.
1741 	 * @param rts_threshold Pointer to the RTS threshold value.
1742 	 *
1743 	 * @return 0 if ok, < 0 if error
1744 	 */
1745 	int (*get_rts_threshold)(const struct device *dev, unsigned int *rts_threshold);
1746 	/** Start a WPS PBC/PIN connection
1747 	 *
1748 	 * @param dev Pointer to the device structure for the driver instance
1749 	 * @param params wps operarion parameters
1750 	 *
1751 	 * @return 0 if ok, < 0 if error
1752 	 */
1753 	int (*wps_config)(const struct device *dev, struct wifi_wps_config_params *params);
1754 	/** Trigger candidate scan
1755 	 *
1756 	 * @param dev Pointer to the device structure for the driver instance
1757 	 * @param params Scan parameters
1758 	 *
1759 	 * @return 0 if ok, < 0 if error
1760 	 */
1761 	int (*candidate_scan)(const struct device *dev, struct wifi_scan_params *params);
1762 	/** Start 11r roaming
1763 	 *
1764 	 * @param dev Pointer to the device structure for the driver instance
1765 	 *
1766 	 * @return 0 if ok, < 0 if error
1767 	 */
1768 	int (*start_11r_roaming)(const struct device *dev);
1769 	/** Set BSS max idle period
1770 	 *
1771 	 * @param dev Pointer to the device structure for the driver instance.
1772 	 * @param BSS max idle period value
1773 	 *
1774 	 * @return 0 if ok, < 0 if error
1775 	 */
1776 	int (*set_bss_max_idle_period)(const struct device *dev,
1777 			unsigned short bss_max_idle_period);
1778 #if defined(CONFIG_WIFI_NM_WPA_SUPPLICANT_BGSCAN) || defined(__DOXYGEN__)
1779 	/** Configure background scanning
1780 	 *
1781 	 * @param dev Pointer to the device structure for the driver instance.
1782 	 * @param params Background scanning configuration parameters
1783 	 *
1784 	 * @return 0 if ok, < 0 if error
1785 	 */
1786 	int (*set_bgscan)(const struct device *dev, struct wifi_bgscan_params *params);
1787 #endif
1788 };
1789 
1790 /** Wi-Fi management offload API */
1791 struct net_wifi_mgmt_offload {
1792 	/**
1793 	 * Mandatory to get in first position.
1794 	 * A network device should indeed provide a pointer on such
1795 	 * net_if_api structure. So we make current structure pointer
1796 	 * that can be casted to a net_if_api structure pointer.
1797 	 */
1798 #if defined(CONFIG_WIFI_USE_NATIVE_NETWORKING) || defined(__DOXYGEN__)
1799 	/** Ethernet API */
1800 	struct ethernet_api wifi_iface;
1801 #else
1802 	/** Offloaded network device API */
1803 	struct offloaded_if_api wifi_iface;
1804 #endif
1805 	/** Wi-Fi management API */
1806 	const struct wifi_mgmt_ops *const wifi_mgmt_api;
1807 
1808 #if defined(CONFIG_WIFI_NM_WPA_SUPPLICANT) || defined(__DOXYGEN__)
1809 	/** Wi-Fi supplicant driver API */
1810 	const void *wifi_drv_ops;
1811 #endif
1812 };
1813 
1814 #if defined(CONFIG_WIFI_NM_WPA_SUPPLICANT)
1815 /* Make sure wifi_drv_ops is after wifi_mgmt_api */
1816 BUILD_ASSERT(offsetof(struct net_wifi_mgmt_offload, wifi_mgmt_api) <
1817 	     offsetof(struct net_wifi_mgmt_offload, wifi_drv_ops));
1818 #endif
1819 
1820 /* Make sure that the network interface API is properly setup inside
1821  * Wifi mgmt offload API struct (it is the first one).
1822  */
1823 BUILD_ASSERT(offsetof(struct net_wifi_mgmt_offload, wifi_iface) == 0);
1824 
1825 /** Wi-Fi management connect result event
1826  *
1827  * @param iface Network interface
1828  * @param status Connect result status
1829  */
1830 void wifi_mgmt_raise_connect_result_event(struct net_if *iface, int status);
1831 
1832 /** Wi-Fi management disconnect result event
1833  *
1834  * @param iface Network interface
1835  * @param status Disconnect result status
1836  */
1837 void wifi_mgmt_raise_disconnect_result_event(struct net_if *iface, int status);
1838 
1839 /** Wi-Fi management interface status event
1840  *
1841  * @param iface Network interface
1842  * @param iface_status Interface status
1843  */
1844 void wifi_mgmt_raise_iface_status_event(struct net_if *iface,
1845 		struct wifi_iface_status *iface_status);
1846 
1847 /** Wi-Fi management TWT event
1848  *
1849  * @param iface Network interface
1850  * @param twt_params TWT parameters
1851  */
1852 void wifi_mgmt_raise_twt_event(struct net_if *iface,
1853 		struct wifi_twt_params *twt_params);
1854 
1855 /** Wi-Fi management TWT sleep state event
1856  *
1857  * @param iface Network interface
1858  * @param twt_sleep_state TWT sleep state
1859  */
1860 void wifi_mgmt_raise_twt_sleep_state(struct net_if *iface, int twt_sleep_state);
1861 
1862 #if defined(CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS) || defined(__DOXYGEN__)
1863 /** Wi-Fi management raw scan result event
1864  *
1865  * @param iface Network interface
1866  * @param raw_scan_info Raw scan result
1867  */
1868 void wifi_mgmt_raise_raw_scan_result_event(struct net_if *iface,
1869 		struct wifi_raw_scan_result *raw_scan_info);
1870 #endif /* CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS */
1871 
1872 /** Wi-Fi management disconnect complete event
1873  *
1874  * @param iface Network interface
1875  * @param status Disconnect complete status
1876  */
1877 void wifi_mgmt_raise_disconnect_complete_event(struct net_if *iface, int status);
1878 
1879 #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_ROAMING
1880 /** Wi-Fi management neighbor reports event
1881  *
1882  * @param iface Network interface
1883  * @param inbuf Input buffer of neighbor reports
1884  * @param buf_len Lenghth of input buffer
1885  */
1886 void wifi_mgmt_raise_neighbor_rep_recv_event(struct net_if *iface,
1887 					     char *inbuf, size_t buf_len);
1888 #endif
1889 
1890 /** Wi-Fi management AP mode enable result event
1891  *
1892  * @param iface Network interface
1893  * @param status AP mode enable result status
1894  */
1895 void wifi_mgmt_raise_ap_enable_result_event(struct net_if *iface, enum wifi_ap_status status);
1896 
1897 /** Wi-Fi management AP mode disable result event
1898  *
1899  * @param iface Network interface
1900  * @param status AP mode disable result status
1901  */
1902 void wifi_mgmt_raise_ap_disable_result_event(struct net_if *iface, enum wifi_ap_status status);
1903 
1904 /** Wi-Fi management AP mode STA connected event
1905  *
1906  * @param iface Network interface
1907  * @param sta_info STA information
1908  */
1909 void wifi_mgmt_raise_ap_sta_connected_event(struct net_if *iface,
1910 		struct wifi_ap_sta_info *sta_info);
1911 
1912 /** Wi-Fi management AP mode STA disconnected event
1913  * @param iface Network interface
1914  * @param sta_info STA information
1915  */
1916 void wifi_mgmt_raise_ap_sta_disconnected_event(struct net_if *iface,
1917 		struct wifi_ap_sta_info *sta_info);
1918 
1919 /**
1920  * @}
1921  */
1922 #ifdef __cplusplus
1923 }
1924 #endif
1925 
1926 #endif /* ZEPHYR_INCLUDE_NET_WIFI_MGMT_H_ */
1927