nRF Connect SDK API 2.8.0
Loading...
Searching...
No Matches
wifi_credentials.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
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
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24/* this entry contains a BSSID */
25#define WIFI_CREDENTIALS_FLAG_BSSID BIT(0)
26/* this entry is to be preferred over others */
27#define WIFI_CREDENTIALS_FLAG_FAVORITE BIT(1)
28/* this entry can use the 2.4 GHz band */
29#define WIFI_CREDENTIALS_FLAG_2_4GHz BIT(2)
30/* this entry can use the 5 GHz band */
31#define WIFI_CREDENTIALS_FLAG_5GHz BIT(3)
32/* this entry can use the 6 GHz band */
33#define WIFI_CREDENTIALS_FLAG_6GHz BIT(4)
34/* this entry requires management frame protection */
35#define WIFI_CREDENTIALS_FLAG_MFP_REQUIRED BIT(5)
36/* this entry disables management frame protection */
37#define WIFI_CREDENTIALS_FLAG_MFP_DISABLED BIT(6)
38/* this entry has anonymous identity configured */
39#define WIFI_CREDENTIALS_FLAG_ANONYMOUS_IDENTITY BIT(7)
40/* this entry has key password configured */
41#define WIFI_CREDENTIALS_FLAG_KEY_PASSWORD BIT(8)
42
43#define WIFI_CREDENTIALS_MAX_PASSWORD_LEN\
44 MAX(WIFI_PSK_MAX_LEN, CONFIG_WIFI_CREDENTIALS_SAE_PASSWORD_LENGTH)
45
55 enum wifi_security_type type;
56 char ssid[WIFI_SSID_MAX_LEN];
57 size_t ssid_len;
58 uint8_t bssid[WIFI_MAC_ADDR_LEN];
59 uint32_t flags;
60 uint8_t channel;
61 uint32_t timeout;
62 char anon_id[16];
63 uint8_t aid_length;
64 char key_passwd[16];
66};
67
81
96
118 const char *ssid,
119 size_t ssid_len,
120 enum wifi_security_type *type,
121 uint8_t *bssid_buf,
122 size_t bssid_buf_len,
123 char *password_buf,
124 size_t password_buf_len,
125 size_t *password_len,
126 uint32_t *flags,
127 uint8_t *channel,
128 uint32_t *timeout
129);
130
151 const char *ssid,
152 size_t ssid_len,
153 enum wifi_security_type type,
154 const uint8_t *bssid,
155 size_t bssid_len,
156 const char *password,
157 size_t password_len,
158 uint32_t flags,
159 uint8_t channel,
160 uint32_t timeout
161);
162
176 struct wifi_credentials_personal *buf);
177
189
200
207
217
225typedef void (*wifi_credentials_ssid_cb)(void *cb_arg, const char *ssid, size_t ssid_len);
226
234
235#ifdef __cplusplus
236}
237#endif
238
241#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:225
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:43
size_t client_cert_len
Definition wifi_credentials.h:92
struct wifi_credentials_header header
Definition wifi_credentials.h:87
size_t ca_cert_len
Definition wifi_credentials.h:91
size_t private_key_len
Definition wifi_credentials.h:93
size_t anonymous_identity_len
Definition wifi_credentials.h:89
size_t identity_len
Definition wifi_credentials.h:88
size_t private_key_pw_len
Definition wifi_credentials.h:94
size_t password_len
Definition wifi_credentials.h:90
Wi-Fi Enterprise credentials entry.
Definition wifi_credentials.h:86
uint8_t bssid[WIFI_MAC_ADDR_LEN]
Definition wifi_credentials.h:58
uint8_t aid_length
Definition wifi_credentials.h:63
char ssid[WIFI_SSID_MAX_LEN]
Definition wifi_credentials.h:56
uint32_t flags
Definition wifi_credentials.h:59
enum wifi_security_type type
Definition wifi_credentials.h:55
uint8_t key_passwd_length
Definition wifi_credentials.h:65
char key_passwd[16]
Definition wifi_credentials.h:64
uint8_t channel
Definition wifi_credentials.h:60
size_t ssid_len
Definition wifi_credentials.h:57
uint32_t timeout
Definition wifi_credentials.h:61
char anon_id[16]
Definition wifi_credentials.h:62
Wi-Fi credentials entry header.
Definition wifi_credentials.h:54
struct wifi_credentials_header header
Definition wifi_credentials.h:77
char password[MAX(WIFI_PSK_MAX_LEN, CONFIG_WIFI_CREDENTIALS_SAE_PASSWORD_LENGTH)]
Definition wifi_credentials.h:78
size_t password_len
Definition wifi_credentials.h:79
Wi-Fi Personal credentials entry.
Definition wifi_credentials.h:76