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