1111#include <zephyr/net/wifi.h>
1212#include <zephyr/kernel.h>
1313
14+ #ifdef __cplusplus
15+ extern "C" {
16+ #endif
17+
1418/**
19+ * @brief Library that provides a way to store and load Wi-Fi credentials.
1520 * @defgroup wifi_credentials Wi-Fi credentials library
1621 * @ingroup networking
1722 * @since 4.0
1823 * @version 0.1.0
1924 * @{
20- * @brief Library that provides a way to store and load Wi-Fi credentials.
2125 */
2226
23- #ifdef __cplusplus
24- extern "C" {
25- #endif
2627
2728/* this entry contains a BSSID */
2829#define WIFI_CREDENTIALS_FLAG_BSSID BIT(0)
@@ -37,6 +38,7 @@ extern "C" {
3738/* this entry disables management frame protection */
3839#define WIFI_CREDENTIALS_FLAG_MFP_DISABLED BIT(5)
3940
41+ /* Maximum length of the password */
4042#define WIFI_CREDENTIALS_MAX_PASSWORD_LEN \
4143 MAX(WIFI_PSK_MAX_LEN, CONFIG_WIFI_CREDENTIALS_SAE_PASSWORD_LENGTH)
4244
@@ -49,13 +51,26 @@ extern "C" {
4951 *
5052 */
5153struct wifi_credentials_header {
52- enum wifi_security_type type ; /**< Wi-Fi security type */
53- char ssid [WIFI_SSID_MAX_LEN ]; /**< SSID (Service Set Identifier) */
54- size_t ssid_len ; /**< Length of the SSID */
55- uint32_t flags ; /**< Flags for controlling detail settings */
56- uint32_t timeout ; /**< Timeout for connecting to the network */
57- uint8_t bssid [WIFI_MAC_ADDR_LEN ]; /**< BSSID (Basic Service Set Identifier) */
58- uint8_t channel ; /**< Channel on which the network operates */
54+ /** Wi-Fi security type */
55+ enum wifi_security_type type ;
56+
57+ /** SSID (Service Set Identifier) */
58+ char ssid [WIFI_SSID_MAX_LEN ];
59+
60+ /** Length of the SSID */
61+ size_t ssid_len ;
62+
63+ /** Flags for controlling detail settings */
64+ uint32_t flags ;
65+
66+ /** Timeout for connecting to the network */
67+ uint32_t timeout ;
68+
69+ /** BSSID (Basic Service Set Identifier) */
70+ uint8_t bssid [WIFI_MAC_ADDR_LEN ];
71+
72+ /** Channel on which the network operates */
73+ uint8_t channel ;
5974};
6075
6176/**
@@ -67,24 +82,44 @@ struct wifi_credentials_header {
6782 *
6883 */
6984struct wifi_credentials_personal {
70- struct wifi_credentials_header header ; /**< Header */
71- char password [WIFI_CREDENTIALS_MAX_PASSWORD_LEN ]; /**< Password/PSK */
72- size_t password_len ; /**< Length of the password */
85+ /** Header */
86+ struct wifi_credentials_header header ;
87+
88+ /** Password/PSK */
89+ char password [WIFI_CREDENTIALS_MAX_PASSWORD_LEN ];
90+
91+ /** Length of the password */
92+ size_t password_len ;
7393};
7494
7595/**
7696 * @brief Wi-Fi Enterprise credentials entry
7797 * @note This functionality is not yet implemented.
7898 */
7999struct wifi_credentials_enterprise {
80- struct wifi_credentials_header header ; /**< Header */
81- size_t identity_len ; /**< Length of the identity */
82- size_t anonymous_identity_len ; /**< Length of the anonymous identity */
83- size_t password_len ; /**< Length of the password */
84- size_t ca_cert_len ; /**< Length of the CA certificate */
85- size_t client_cert_len ; /**< Length of the client certificate */
86- size_t private_key_len ; /**< Length of the private key */
87- size_t private_key_pw_len ; /**< Length of the private key password */
100+ /** Header */
101+ struct wifi_credentials_header header ;
102+
103+ /** Length of the identity */
104+ size_t identity_len ;
105+
106+ /** Length of the anonymous identity */
107+ size_t anonymous_identity_len ;
108+
109+ /** Length of the password */
110+ size_t password_len ;
111+
112+ /** Length of the CA certificate */
113+ size_t ca_cert_len ;
114+
115+ /** Length of the client certificate */
116+ size_t client_cert_len ;
117+
118+ /** Length of the private key */
119+ size_t private_key_len ;
120+
121+ /** Length of the private key password */
122+ size_t private_key_pw_len ;
88123};
89124
90125/**
@@ -194,6 +229,7 @@ int wifi_credentials_delete_all(void);
194229
195230/**
196231 * @brief Callback type for wifi_credentials_for_each_ssid.
232+ *
197233 * @param[in] cb_arg arguments for the callback function. Appropriate cb_arg is
198234 * transferred by wifi_credentials_for_each_ssid.
199235 * @param[in] ssid SSID
0 commit comments