LCOV - code coverage report
Current view: top level - zephyr/net - wifi_mgmt.h Hit Total Coverage
Test: new.info Lines: 290 301 96.3 %
Date: 2024-12-22 00:14:23

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

Generated by: LCOV version 1.14