Zephyr Project API 4.1.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
wifi_credentials.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef WIFI_CREDENTIALS_H__
8#define WIFI_CREDENTIALS_H__
9
10#include <zephyr/types.h>
11#include <zephyr/net/wifi.h>
12#include <zephyr/kernel.h>
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
28/* this entry contains a BSSID */
29#define WIFI_CREDENTIALS_FLAG_BSSID BIT(0)
30/* this entry is to be preferred over others */
31#define WIFI_CREDENTIALS_FLAG_FAVORITE BIT(1)
32/* this entry can use the 2.4 GHz band */
33#define WIFI_CREDENTIALS_FLAG_2_4GHz BIT(2)
34/* this entry can use the 5 GHz band */
35#define WIFI_CREDENTIALS_FLAG_5GHz BIT(3)
36/* this entry can use the 6 GHz band */
37#define WIFI_CREDENTIALS_FLAG_6GHz BIT(4)
38/* this entry requires management frame protection */
39#define WIFI_CREDENTIALS_FLAG_MFP_REQUIRED BIT(5)
40/* this entry disables management frame protection */
41#define WIFI_CREDENTIALS_FLAG_MFP_DISABLED BIT(6)
42/* this entry has anonymous identity configured */
43#define WIFI_CREDENTIALS_FLAG_ANONYMOUS_IDENTITY BIT(7)
44/* this entry has key password configured */
45#define WIFI_CREDENTIALS_FLAG_KEY_PASSWORD BIT(8)
46
47/* Maximum length of the password */
48#define WIFI_CREDENTIALS_MAX_PASSWORD_LEN \
49 MAX(WIFI_PSK_MAX_LEN, CONFIG_WIFI_CREDENTIALS_SAE_PASSWORD_LENGTH)
50
93
112
142
165 size_t bssid_buf_len, char *password_buf,
166 size_t password_buf_len, size_t *password_len,
168
189 const uint8_t *bssid, size_t bssid_len, const char *password,
190 size_t password_len, uint32_t flags, uint8_t channel,
192
206 struct wifi_credentials_personal *buf);
207
219
230
237
247
256typedef void (*wifi_credentials_ssid_cb)(void *cb_arg, const char *ssid, size_t ssid_len);
257
265
266#ifdef __cplusplus
267}
268#endif
269
272#endif /* WIFI_CREDENTIALS_H__ */
int wifi_credentials_set_personal_struct(const struct wifi_credentials_personal *creds)
Set credentials for given SSID by struct.
int wifi_credentials_set_personal(const char *ssid, size_t ssid_len, enum wifi_security_type type, const uint8_t *bssid, size_t bssid_len, const char *password, size_t password_len, uint32_t flags, uint8_t channel, uint32_t timeout)
Set credentials for given SSID.
void(* wifi_credentials_ssid_cb)(void *cb_arg, const char *ssid, size_t ssid_len)
Callback type for wifi_credentials_for_each_ssid.
Definition wifi_credentials.h:256
void wifi_credentials_for_each_ssid(wifi_credentials_ssid_cb cb, void *cb_arg)
Call callback for each registered SSID.
int wifi_credentials_get_by_ssid_personal_struct(const char *ssid, size_t ssid_len, struct wifi_credentials_personal *buf)
Get credentials for given SSID by struct.
bool wifi_credentials_is_empty(void)
Check if credentials storage is empty.
int wifi_credentials_get_by_ssid_personal(const char *ssid, size_t ssid_len, enum wifi_security_type *type, uint8_t *bssid_buf, size_t bssid_buf_len, char *password_buf, size_t password_buf_len, size_t *password_len, uint32_t *flags, uint8_t *channel, uint32_t *timeout)
Get credentials for given SSID.
int wifi_credentials_delete_by_ssid(const char *ssid, size_t ssid_len)
Delete credentials for given SSID.
int wifi_credentials_delete_all(void)
Deletes all stored Wi-Fi credentials.
#define WIFI_CREDENTIALS_MAX_PASSWORD_LEN
Definition wifi_credentials.h:48
#define WIFI_MAC_ADDR_LEN
MAC address length.
Definition wifi.h:309
#define WIFI_SSID_MAX_LEN
Max SSID length.
Definition wifi.h:301
wifi_security_type
IEEE 802.11 security types.
Definition wifi.h:69
Public kernel APIs.
flags
Definition parser.h:97
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Wi-Fi Enterprise credentials entry.
Definition wifi_credentials.h:117
size_t client_cert_len
Length of the client certificate.
Definition wifi_credentials.h:134
struct wifi_credentials_header header
Header.
Definition wifi_credentials.h:119
size_t ca_cert_len
Length of the CA certificate.
Definition wifi_credentials.h:131
size_t private_key_len
Length of the private key.
Definition wifi_credentials.h:137
size_t anonymous_identity_len
Length of the anonymous identity.
Definition wifi_credentials.h:125
size_t identity_len
Length of the identity.
Definition wifi_credentials.h:122
size_t private_key_pw_len
Length of the private key password.
Definition wifi_credentials.h:140
size_t password_len
Length of the password.
Definition wifi_credentials.h:128
Wi-Fi credentials entry header.
Definition wifi_credentials.h:59
uint8_t bssid[WIFI_MAC_ADDR_LEN]
BSSID (Basic Service Set Identifier)
Definition wifi_credentials.h:76
uint8_t aid_length
Length of the Anonymous identifier.
Definition wifi_credentials.h:85
char ssid[WIFI_SSID_MAX_LEN]
SSID (Service Set Identifier)
Definition wifi_credentials.h:64
uint32_t flags
Flags for controlling detail settings.
Definition wifi_credentials.h:70
enum wifi_security_type type
Wi-Fi security type.
Definition wifi_credentials.h:61
uint8_t key_passwd_length
Length of the Password.
Definition wifi_credentials.h:91
char key_passwd[16]
Password/PSK (Limited to 16 bytes due to settings subsystem overflow)
Definition wifi_credentials.h:88
uint8_t channel
Channel on which the network operates.
Definition wifi_credentials.h:79
size_t ssid_len
Length of the SSID.
Definition wifi_credentials.h:67
uint32_t timeout
Timeout for connecting to the network.
Definition wifi_credentials.h:73
char anon_id[16]
Anonymous identifier (Limited to 16 bytes due to settings subsystem overflow)
Definition wifi_credentials.h:82
Wi-Fi Personal credentials entry.
Definition wifi_credentials.h:102
struct wifi_credentials_header header
Header.
Definition wifi_credentials.h:104
char password[MAX(WIFI_PSK_MAX_LEN, CONFIG_WIFI_CREDENTIALS_SAE_PASSWORD_LENGTH)]
Password/PSK.
Definition wifi_credentials.h:107
size_t password_len
Length of the password.
Definition wifi_credentials.h:110
IEEE 802.11 protocol and general Wi-Fi definitions.