LCOV - code coverage report
Current view: top level - zephyr/net - wifi_mgmt.h Coverage Total Hit
Test: new.info Lines: 95.9 % 319 306
Test Date: 2025-09-05 22:20:39

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

Generated by: LCOV version 2.0-1