11
11
#include <zephyr/net/wifi.h>
12
12
#include <zephyr/kernel.h>
13
13
14
+ #ifdef __cplusplus
15
+ extern "C" {
16
+ #endif
17
+
14
18
/**
19
+ * @brief Library that provides a way to store and load Wi-Fi credentials.
15
20
* @defgroup wifi_credentials Wi-Fi credentials library
16
21
* @ingroup networking
17
22
* @since 4.0
18
23
* @version 0.1.0
19
24
* @{
20
- * @brief Library that provides a way to store and load Wi-Fi credentials.
21
25
*/
22
26
23
- #ifdef __cplusplus
24
- extern "C" {
25
- #endif
26
27
27
28
/* this entry contains a BSSID */
28
29
#define WIFI_CREDENTIALS_FLAG_BSSID BIT(0)
@@ -37,6 +38,7 @@ extern "C" {
37
38
/* this entry disables management frame protection */
38
39
#define WIFI_CREDENTIALS_FLAG_MFP_DISABLED BIT(5)
39
40
41
+ /* Maximum length of the password */
40
42
#define WIFI_CREDENTIALS_MAX_PASSWORD_LEN \
41
43
MAX(WIFI_PSK_MAX_LEN, CONFIG_WIFI_CREDENTIALS_SAE_PASSWORD_LENGTH)
42
44
@@ -49,13 +51,26 @@ extern "C" {
49
51
*
50
52
*/
51
53
struct 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 ;
59
74
};
60
75
61
76
/**
@@ -67,24 +82,44 @@ struct wifi_credentials_header {
67
82
*
68
83
*/
69
84
struct 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 ;
73
93
};
74
94
75
95
/**
76
96
* @brief Wi-Fi Enterprise credentials entry
77
97
* @note This functionality is not yet implemented.
78
98
*/
79
99
struct 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 ;
88
123
};
89
124
90
125
/**
@@ -194,6 +229,7 @@ int wifi_credentials_delete_all(void);
194
229
195
230
/**
196
231
* @brief Callback type for wifi_credentials_for_each_ssid.
232
+ *
197
233
* @param[in] cb_arg arguments for the callback function. Appropriate cb_arg is
198
234
* transferred by wifi_credentials_for_each_ssid.
199
235
* @param[in] ssid SSID
0 commit comments