forked from nrfconnect/sdk-zephyr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwifi.h
701 lines (625 loc) · 20 KB
/
wifi.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
/*
* Copyright (c) 2018 Texas Instruments, Incorporated
* Copyright (c) 2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief IEEE 802.11 protocol and general Wi-Fi definitions.
*/
/**
* @brief Wi-Fi Management API.
* @defgroup wifi_mgmt Wi-Fi Management
* @since 1.12
* @version 0.8.0
* @ingroup networking
* @{
*/
#ifndef ZEPHYR_INCLUDE_NET_WIFI_H_
#define ZEPHYR_INCLUDE_NET_WIFI_H_
#include <zephyr/sys/util.h> /* for ARRAY_SIZE */
/** Length of the country code string */
#define WIFI_COUNTRY_CODE_LEN 2
/** @cond INTERNAL_HIDDEN */
#define WIFI_LISTEN_INTERVAL_MIN 0
#define WIFI_LISTEN_INTERVAL_MAX 65535
/** @endcond */
#ifdef __cplusplus
extern "C" {
#endif
/** @brief IEEE 802.11 security types. */
enum wifi_security_type {
/** No security. */
WIFI_SECURITY_TYPE_NONE = 0,
/** WPA2-PSK security. */
WIFI_SECURITY_TYPE_PSK,
/** WPA2-PSK-SHA256 security. */
WIFI_SECURITY_TYPE_PSK_SHA256,
/** WPA3-SAE security. */
WIFI_SECURITY_TYPE_SAE,
/** WPA3-SAE security with hunting-and-pecking loop. */
WIFI_SECURITY_TYPE_SAE_HNP = WIFI_SECURITY_TYPE_SAE,
/** WPA3-SAE security with hash-to-element. */
WIFI_SECURITY_TYPE_SAE_H2E,
/** WPA3-SAE security with both hunting-and-pecking loop and hash-to-element enabled. */
WIFI_SECURITY_TYPE_SAE_AUTO,
/** GB 15629.11-2003 WAPI security. */
WIFI_SECURITY_TYPE_WAPI,
/** EAP security - Enterprise. */
WIFI_SECURITY_TYPE_EAP,
/** EAP TLS security - Enterprise. */
WIFI_SECURITY_TYPE_EAP_TLS = WIFI_SECURITY_TYPE_EAP,
/** WEP security. */
WIFI_SECURITY_TYPE_WEP,
/** WPA-PSK security. */
WIFI_SECURITY_TYPE_WPA_PSK,
/** WPA/WPA2/WPA3 PSK security. */
WIFI_SECURITY_TYPE_WPA_AUTO_PERSONAL,
/** DPP security */
WIFI_SECURITY_TYPE_DPP,
/** EAP PEAP MSCHAPV2 security - Enterprise. */
WIFI_SECURITY_TYPE_EAP_PEAP_MSCHAPV2,
/** EAP PEAP GTC security - Enterprise. */
WIFI_SECURITY_TYPE_EAP_PEAP_GTC,
/** EAP TTLS MSCHAPV2 security - Enterprise. */
WIFI_SECURITY_TYPE_EAP_TTLS_MSCHAPV2,
/** EAP PEAP security - Enterprise. */
WIFI_SECURITY_TYPE_EAP_PEAP_TLS,
/** FT-PSK security */
WIFI_SECURITY_TYPE_FT_PSK,
/** FT-SAE security */
WIFI_SECURITY_TYPE_FT_SAE,
/** FT-EAP security */
WIFI_SECURITY_TYPE_FT_EAP,
/** FT-EAP-SHA384 security */
WIFI_SECURITY_TYPE_FT_EAP_SHA384,
/** @cond INTERNAL_HIDDEN */
__WIFI_SECURITY_TYPE_AFTER_LAST,
WIFI_SECURITY_TYPE_MAX = __WIFI_SECURITY_TYPE_AFTER_LAST - 1,
WIFI_SECURITY_TYPE_UNKNOWN
/** @endcond */
};
/** @brief EPA method Types. */
enum wifi_eap_type {
/** No EPA security. */
WIFI_EAP_TYPE_NONE = 0,
/** EPA GTC security, refer to rfc3748 chapter 5. */
WIFI_EAP_TYPE_GTC = 6,
/** EPA TLS security, refer to rfc5216. */
WIFI_EAP_TYPE_TLS = 13,
/** EPA TTLS security, refer to rfc5281. */
WIFI_EAP_TYPE_TTLS = 21,
/** EPA PEAP security, refer to draft-josefsson-pppext-eap-tls-eap-06.txt. */
WIFI_EAP_TYPE_PEAP = 25,
/** EPA MSCHAPV2 security, refer to draft-kamath-pppext-eap-mschapv2-00.txt. */
WIFI_EAP_TYPE_MSCHAPV2 = 26,
};
/** @brief Enterprise security WPA3 suiteb types. */
enum wifi_suiteb_type {
/** suiteb. */
WIFI_SUITEB = 1,
/** suiteb-192. */
WIFI_SUITEB_192,
};
enum wifi_eap_tls_cipher_type {
/** EAP TLS with NONE */
WIFI_EAP_TLS_NONE,
/** EAP TLS with ECDH & ECDSA with p384 */
WIFI_EAP_TLS_ECC_P384,
/** EAP TLS with ECDH & RSA with > 3K */
WIFI_EAP_TLS_RSA_3K,
};
/** @brief Group cipher and pairwise cipher types. */
enum wifi_cipher_type {
/** AES in counter mode with CBC-MAC (CCMP-128). */
WPA_CAPA_ENC_CCMP,
/** 128-bit Galois/Counter Mode Protocol. */
WPA_CAPA_ENC_GCMP,
/** 256-bit Galois/Counter Mode Protocol. */
WPA_CAPA_ENC_GCMP_256,
};
/** @brief group mgmt cipher types. */
enum wifi_group_mgmt_cipher_type {
/** 128-bit Broadcast/Multicast Integrity Protocol
* Cipher-based Message Authentication Code .
*/
WPA_CAPA_ENC_BIP,
/** 128-bit Broadcast/Multicast Integrity Protocol
* Galois Message Authentication Code .
*/
WPA_CAPA_ENC_BIP_GMAC_128,
/** 256-bit Broadcast/Multicast Integrity Protocol
* Galois Message Authentication Code .
*/
WPA_CAPA_ENC_BIP_GMAC_256,
};
struct wifi_cipher_desc {
/** Cipher capability. */
unsigned int capa;
/** Cipher name string. */
char *name;
};
struct wifi_eap_cipher_config {
/** Key management type string. */
char *key_mgmt;
/** OpenSSL cipher string. */
char *openssl_ciphers;
/** Group cipher cipher string. */
char *group_cipher;
/** Pairwise_cipher cipher string. */
char *pairwise_cipher;
/** Group management cipher string. */
char *group_mgmt_cipher;
/** Used to confiure TLS features. */
char *tls_flags;
};
struct wifi_eap_config {
/** Security type. */
unsigned int type;
/** EPA method type of phase1. */
enum wifi_eap_type eap_type_phase1;
/** EPA method type of phase2. */
enum wifi_eap_type eap_type_phase2;
/** EPA method string. */
char *method;
/** Phase2 setting string. */
char *phase2;
};
/** Helper function to get user-friendly security type name. */
const char *wifi_security_txt(enum wifi_security_type security);
/** @brief IEEE 802.11w - Management frame protection. */
enum wifi_mfp_options {
/** MFP disabled. */
WIFI_MFP_DISABLE = 0,
/** MFP optional. */
WIFI_MFP_OPTIONAL,
/** MFP required. */
WIFI_MFP_REQUIRED,
/** @cond INTERNAL_HIDDEN */
__WIFI_MFP_AFTER_LAST,
WIFI_MFP_MAX = __WIFI_MFP_AFTER_LAST - 1,
WIFI_MFP_UNKNOWN
/** @endcond */
};
/** Helper function to get user-friendly MFP name.*/
const char *wifi_mfp_txt(enum wifi_mfp_options mfp);
/**
* @brief IEEE 802.11 operational frequency bands (not exhaustive).
*/
enum wifi_frequency_bands {
/** 2.4 GHz band. */
WIFI_FREQ_BAND_2_4_GHZ = 0,
/** 5 GHz band. */
WIFI_FREQ_BAND_5_GHZ,
/** 6 GHz band (Wi-Fi 6E, also extends to 7GHz). */
WIFI_FREQ_BAND_6_GHZ,
/** Number of frequency bands available. */
__WIFI_FREQ_BAND_AFTER_LAST,
/** Highest frequency band available. */
WIFI_FREQ_BAND_MAX = __WIFI_FREQ_BAND_AFTER_LAST - 1,
/** Invalid frequency band */
WIFI_FREQ_BAND_UNKNOWN
};
/** Helper function to get user-friendly frequency band name. */
const char *wifi_band_txt(enum wifi_frequency_bands band);
/**
* @brief IEEE 802.11 operational frequency bandwidths (not exhaustive).
*/
enum wifi_frequency_bandwidths {
/** 20 MHz. */
WIFI_FREQ_BANDWIDTH_20MHZ = 1,
/** 40 MHz. */
WIFI_FREQ_BANDWIDTH_40MHZ,
/** 80 MHz. */
WIFI_FREQ_BANDWIDTH_80MHZ,
/** Number of frequency bandwidths available. */
__WIFI_FREQ_BANDWIDTH_AFTER_LAST,
/** Highest frequency bandwidth available. */
WIFI_FREQ_BANDWIDTH_MAX = __WIFI_FREQ_BANDWIDTH_AFTER_LAST - 1,
/** Invalid frequency bandwidth */
WIFI_FREQ_BANDWIDTH_UNKNOWN
};
const char *const wifi_bandwidth_txt(enum wifi_frequency_bandwidths bandwidth);
/** Max SSID length */
#define WIFI_SSID_MAX_LEN 32
/** Minimum PSK length */
#define WIFI_PSK_MIN_LEN 8
/** Maximum PSK length */
#define WIFI_PSK_MAX_LEN 64
/** Max SAW password length */
#define WIFI_SAE_PSWD_MAX_LEN 128
/** MAC address length */
#define WIFI_MAC_ADDR_LEN 6
/** Max enterprise identity length */
#define WIFI_ENT_IDENTITY_MAX_LEN 64
/** Max enterprise password length */
#define WIFI_ENT_PSWD_MAX_LEN 128
/** Minimum channel number */
#define WIFI_CHANNEL_MIN 1
/** Maximum channel number */
#define WIFI_CHANNEL_MAX 233
/** Any channel number */
#define WIFI_CHANNEL_ANY 255
/** @brief Wi-Fi interface states.
*
* Based on https://w1.fi/wpa_supplicant/devel/defs_8h.html#a4aeb27c1e4abd046df3064ea9756f0bc
*/
enum wifi_iface_state {
/** Interface is disconnected. */
WIFI_STATE_DISCONNECTED = 0,
/** Interface is disabled (administratively). */
WIFI_STATE_INTERFACE_DISABLED,
/** No enabled networks in the configuration. */
WIFI_STATE_INACTIVE,
/** Interface is scanning for networks. */
WIFI_STATE_SCANNING,
/** Authentication with a network is in progress. */
WIFI_STATE_AUTHENTICATING,
/** Association with a network is in progress. */
WIFI_STATE_ASSOCIATING,
/** Association with a network completed. */
WIFI_STATE_ASSOCIATED,
/** 4-way handshake with a network is in progress. */
WIFI_STATE_4WAY_HANDSHAKE,
/** Group Key exchange with a network is in progress. */
WIFI_STATE_GROUP_HANDSHAKE,
/** All authentication completed, ready to pass data. */
WIFI_STATE_COMPLETED,
/** @cond INTERNAL_HIDDEN */
__WIFI_STATE_AFTER_LAST,
WIFI_STATE_MAX = __WIFI_STATE_AFTER_LAST - 1,
WIFI_STATE_UNKNOWN
/** @endcond */
};
/* We rely on the strict order of the enum values, so, let's check it */
BUILD_ASSERT(WIFI_STATE_DISCONNECTED < WIFI_STATE_INTERFACE_DISABLED &&
WIFI_STATE_INTERFACE_DISABLED < WIFI_STATE_INACTIVE &&
WIFI_STATE_INACTIVE < WIFI_STATE_SCANNING &&
WIFI_STATE_SCANNING < WIFI_STATE_AUTHENTICATING &&
WIFI_STATE_AUTHENTICATING < WIFI_STATE_ASSOCIATING &&
WIFI_STATE_ASSOCIATING < WIFI_STATE_ASSOCIATED &&
WIFI_STATE_ASSOCIATED < WIFI_STATE_4WAY_HANDSHAKE &&
WIFI_STATE_4WAY_HANDSHAKE < WIFI_STATE_GROUP_HANDSHAKE &&
WIFI_STATE_GROUP_HANDSHAKE < WIFI_STATE_COMPLETED);
/** Helper function to get user-friendly interface state name. */
const char *wifi_state_txt(enum wifi_iface_state state);
/** @brief Wi-Fi interface modes.
*
* Based on https://w1.fi/wpa_supplicant/devel/defs_8h.html#a4aeb27c1e4abd046df3064ea9756f0bc
*/
enum wifi_iface_mode {
/** Infrastructure station mode. */
WIFI_MODE_INFRA = 0,
/** IBSS (ad-hoc) station mode. */
WIFI_MODE_IBSS = 1,
/** AP mode. */
WIFI_MODE_AP = 2,
/** P2P group owner mode. */
WIFI_MODE_P2P_GO = 3,
/** P2P group formation mode. */
WIFI_MODE_P2P_GROUP_FORMATION = 4,
/** 802.11s Mesh mode. */
WIFI_MODE_MESH = 5,
/** @cond INTERNAL_HIDDEN */
__WIFI_MODE_AFTER_LAST,
WIFI_MODE_MAX = __WIFI_MODE_AFTER_LAST - 1,
WIFI_MODE_UNKNOWN
/** @endcond */
};
/** Helper function to get user-friendly interface mode name. */
const char *wifi_mode_txt(enum wifi_iface_mode mode);
/** @brief Wi-Fi link operating modes
*
* As per https://en.wikipedia.org/wiki/Wi-Fi#Versions_and_generations.
*/
enum wifi_link_mode {
/** 802.11 (legacy). */
WIFI_0 = 0,
/** 802.11b. */
WIFI_1,
/** 802.11a. */
WIFI_2,
/** 802.11g. */
WIFI_3,
/** 802.11n. */
WIFI_4,
/** 802.11ac. */
WIFI_5,
/** 802.11ax. */
WIFI_6,
/** 802.11ax 6GHz. */
WIFI_6E,
/** 802.11be. */
WIFI_7,
/** @cond INTERNAL_HIDDEN */
__WIFI_LINK_MODE_AFTER_LAST,
WIFI_LINK_MODE_MAX = __WIFI_LINK_MODE_AFTER_LAST - 1,
WIFI_LINK_MODE_UNKNOWN
/** @endcond */
};
/** Helper function to get user-friendly link mode name. */
const char *wifi_link_mode_txt(enum wifi_link_mode link_mode);
/** @brief Wi-Fi scanning types. */
enum wifi_scan_type {
/** Active scanning (default). */
WIFI_SCAN_TYPE_ACTIVE = 0,
/** Passive scanning. */
WIFI_SCAN_TYPE_PASSIVE,
};
/** @brief Wi-Fi power save states. */
enum wifi_ps {
/** Power save disabled. */
WIFI_PS_DISABLED = 0,
/** Power save enabled. */
WIFI_PS_ENABLED,
};
/** Helper function to get user-friendly ps name. */
const char *wifi_ps_txt(enum wifi_ps ps_name);
/** @brief Wi-Fi power save modes. */
enum wifi_ps_mode {
/** Legacy power save mode. */
WIFI_PS_MODE_LEGACY = 0,
/* This has to be configured before connecting to the AP,
* as support for ADDTS action frames is not available.
*/
/** WMM power save mode. */
WIFI_PS_MODE_WMM,
};
/** Helper function to get user-friendly ps mode name. */
const char *wifi_ps_mode_txt(enum wifi_ps_mode ps_mode);
/** Network interface index min value */
#define WIFI_INTERFACE_INDEX_MIN 1
/** Network interface index max value */
#define WIFI_INTERFACE_INDEX_MAX 255
/** @brief Wifi operational mode */
enum wifi_operational_modes {
/** STA mode setting enable */
WIFI_STA_MODE = BIT(0),
/** Monitor mode setting enable */
WIFI_MONITOR_MODE = BIT(1),
/** TX injection mode setting enable */
WIFI_TX_INJECTION_MODE = BIT(2),
/** Promiscuous mode setting enable */
WIFI_PROMISCUOUS_MODE = BIT(3),
/** AP mode setting enable */
WIFI_AP_MODE = BIT(4),
/** Softap mode setting enable */
WIFI_SOFTAP_MODE = BIT(5),
};
/** @brief Mode filter settings */
enum wifi_filter {
/** Support management, data and control packet sniffing */
WIFI_PACKET_FILTER_ALL = BIT(0),
/** Support only sniffing of management packets */
WIFI_PACKET_FILTER_MGMT = BIT(1),
/** Support only sniffing of data packets */
WIFI_PACKET_FILTER_DATA = BIT(2),
/** Support only sniffing of control packets */
WIFI_PACKET_FILTER_CTRL = BIT(3),
};
/** @brief Wi-Fi Target Wake Time (TWT) operations. */
enum wifi_twt_operation {
/** TWT setup operation */
WIFI_TWT_SETUP = 0,
/** TWT teardown operation */
WIFI_TWT_TEARDOWN,
};
/** Helper function to get user-friendly twt operation name. */
const char *wifi_twt_operation_txt(enum wifi_twt_operation twt_operation);
/** @brief Wi-Fi Target Wake Time (TWT) negotiation types. */
enum wifi_twt_negotiation_type {
/** TWT individual negotiation */
WIFI_TWT_INDIVIDUAL = 0,
/** TWT broadcast negotiation */
WIFI_TWT_BROADCAST,
/** TWT wake TBTT negotiation */
WIFI_TWT_WAKE_TBTT
};
/** Helper function to get user-friendly twt negotiation type name. */
const char *wifi_twt_negotiation_type_txt(enum wifi_twt_negotiation_type twt_negotiation);
/** @brief Wi-Fi Target Wake Time (TWT) setup commands. */
enum wifi_twt_setup_cmd {
/** TWT setup request */
WIFI_TWT_SETUP_CMD_REQUEST = 0,
/** TWT setup suggest (parameters can be changed by AP) */
WIFI_TWT_SETUP_CMD_SUGGEST,
/** TWT setup demand (parameters can not be changed by AP) */
WIFI_TWT_SETUP_CMD_DEMAND,
/** TWT setup grouping (grouping of TWT flows) */
WIFI_TWT_SETUP_CMD_GROUPING,
/** TWT setup accept (parameters accepted by AP) */
WIFI_TWT_SETUP_CMD_ACCEPT,
/** TWT setup alternate (alternate parameters suggested by AP) */
WIFI_TWT_SETUP_CMD_ALTERNATE,
/** TWT setup dictate (parameters dictated by AP) */
WIFI_TWT_SETUP_CMD_DICTATE,
/** TWT setup reject (parameters rejected by AP) */
WIFI_TWT_SETUP_CMD_REJECT,
};
/** Helper function to get user-friendly twt setup cmd name. */
const char *wifi_twt_setup_cmd_txt(enum wifi_twt_setup_cmd twt_setup);
/** @brief Wi-Fi Target Wake Time (TWT) negotiation status. */
enum wifi_twt_setup_resp_status {
/** TWT response received for TWT request */
WIFI_TWT_RESP_RECEIVED = 0,
/** TWT response not received for TWT request */
WIFI_TWT_RESP_NOT_RECEIVED,
};
/** @brief Target Wake Time (TWT) error codes. */
enum wifi_twt_fail_reason {
/** Unspecified error */
WIFI_TWT_FAIL_UNSPECIFIED,
/** Command execution failed */
WIFI_TWT_FAIL_CMD_EXEC_FAIL,
/** Operation not supported */
WIFI_TWT_FAIL_OPERATION_NOT_SUPPORTED,
/** Unable to get interface status */
WIFI_TWT_FAIL_UNABLE_TO_GET_IFACE_STATUS,
/** Device not connected to AP */
WIFI_TWT_FAIL_DEVICE_NOT_CONNECTED,
/** Peer not HE (802.11ax/Wi-Fi 6) capable */
WIFI_TWT_FAIL_PEER_NOT_HE_CAPAB,
/** Peer not TWT capable */
WIFI_TWT_FAIL_PEER_NOT_TWT_CAPAB,
/** A TWT flow is already in progress */
WIFI_TWT_FAIL_OPERATION_IN_PROGRESS,
/** Invalid negotiated flow id */
WIFI_TWT_FAIL_INVALID_FLOW_ID,
/** IP address not assigned or configured */
WIFI_TWT_FAIL_IP_NOT_ASSIGNED,
/** Flow already exists */
WIFI_TWT_FAIL_FLOW_ALREADY_EXISTS,
};
/** @brief Wi-Fi Target Wake Time (TWT) teradown status. */
enum wifi_twt_teardown_status {
/** TWT teardown success */
WIFI_TWT_TEARDOWN_SUCCESS = 0,
/** TWT teardown failure */
WIFI_TWT_TEARDOWN_FAILED,
};
/** @cond INTERNAL_HIDDEN */
static const char * const wifi_twt_err_code_tbl[] = {
[WIFI_TWT_FAIL_UNSPECIFIED] = "Unspecified",
[WIFI_TWT_FAIL_CMD_EXEC_FAIL] = "Command Execution failed",
[WIFI_TWT_FAIL_OPERATION_NOT_SUPPORTED] =
"Operation not supported",
[WIFI_TWT_FAIL_UNABLE_TO_GET_IFACE_STATUS] =
"Unable to get iface status",
[WIFI_TWT_FAIL_DEVICE_NOT_CONNECTED] =
"Device not connected",
[WIFI_TWT_FAIL_PEER_NOT_HE_CAPAB] = "Peer not HE capable",
[WIFI_TWT_FAIL_PEER_NOT_TWT_CAPAB] = "Peer not TWT capable",
[WIFI_TWT_FAIL_OPERATION_IN_PROGRESS] =
"Operation already in progress",
[WIFI_TWT_FAIL_INVALID_FLOW_ID] =
"Invalid negotiated flow id",
[WIFI_TWT_FAIL_IP_NOT_ASSIGNED] =
"IP address not assigned",
[WIFI_TWT_FAIL_FLOW_ALREADY_EXISTS] =
"Flow already exists",
};
/** @endcond */
/** Helper function to get user-friendly TWT error code name. */
static inline const char *wifi_twt_get_err_code_str(int16_t err_no)
{
if ((err_no) < (int16_t)ARRAY_SIZE(wifi_twt_err_code_tbl)) {
return wifi_twt_err_code_tbl[err_no];
}
return "<unknown>";
}
/** @brief Wi-Fi power save parameters. */
enum wifi_ps_param_type {
/** Power save state. */
WIFI_PS_PARAM_STATE,
/** Power save listen interval (units: (short) beacon intervals). */
WIFI_PS_PARAM_LISTEN_INTERVAL,
/** Power save wakeup mode. */
WIFI_PS_PARAM_WAKEUP_MODE,
/** Power save mode. */
WIFI_PS_PARAM_MODE,
/** Power save exit strategy. */
WIFI_PS_PARAM_EXIT_STRATEGY,
/** Power save timeout. */
WIFI_PS_PARAM_TIMEOUT,
};
/** @brief Wi-Fi power save modes. */
enum wifi_ps_wakeup_mode {
/** DTIM based wakeup. */
WIFI_PS_WAKEUP_MODE_DTIM = 0,
/** Listen interval based wakeup. */
WIFI_PS_WAKEUP_MODE_LISTEN_INTERVAL,
};
/** Helper function to get user-friendly ps wakeup mode name. */
const char *wifi_ps_wakeup_mode_txt(enum wifi_ps_wakeup_mode ps_wakeup_mode);
/**
* @brief Wi-Fi power save exit strategy
*/
enum wifi_ps_exit_strategy {
/** PS-Poll frame based */
WIFI_PS_EXIT_CUSTOM_ALGO = 0,
/** QoS NULL frame based */
WIFI_PS_EXIT_EVERY_TIM,
/** @cond INTERNAL_HIDDEN */
WIFI_PS_EXIT_LAST,
WIFI_PS_EXIT_MAX = WIFI_PS_EXIT_LAST - 1,
/** @endcond */
};
/** Helper function to get user-friendly ps exit strategy name. */
const char *wifi_ps_exit_strategy_txt(enum wifi_ps_exit_strategy ps_exit_strategy);
/** @brief Wi-Fi power save error codes. */
enum wifi_config_ps_param_fail_reason {
/** Unspecified error */
WIFI_PS_PARAM_FAIL_UNSPECIFIED,
/** Command execution failed */
WIFI_PS_PARAM_FAIL_CMD_EXEC_FAIL,
/** Parameter not supported */
WIFI_PS_PARAM_FAIL_OPERATION_NOT_SUPPORTED,
/** Unable to get interface status */
WIFI_PS_PARAM_FAIL_UNABLE_TO_GET_IFACE_STATUS,
/** Device not connected to AP */
WIFI_PS_PARAM_FAIL_DEVICE_NOT_CONNECTED,
/** Device already connected to AP */
WIFI_PS_PARAM_FAIL_DEVICE_CONNECTED,
/** Listen interval out of range */
WIFI_PS_PARAM_LISTEN_INTERVAL_RANGE_INVALID,
/** Invalid exit strategy */
WIFI_PS_PARAM_FAIL_INVALID_EXIT_STRATEGY,
};
/** @cond INTERNAL_HIDDEN */
static const char * const wifi_ps_param_config_err_code_tbl[] = {
[WIFI_PS_PARAM_FAIL_UNSPECIFIED] = "Unspecified",
[WIFI_PS_PARAM_FAIL_CMD_EXEC_FAIL] = "Command Execution failed",
[WIFI_PS_PARAM_FAIL_OPERATION_NOT_SUPPORTED] =
"Operation not supported",
[WIFI_PS_PARAM_FAIL_UNABLE_TO_GET_IFACE_STATUS] =
"Unable to get iface status",
[WIFI_PS_PARAM_FAIL_DEVICE_NOT_CONNECTED] =
"Cannot set parameters while device not connected",
[WIFI_PS_PARAM_FAIL_DEVICE_CONNECTED] =
"Cannot set parameters while device connected",
[WIFI_PS_PARAM_LISTEN_INTERVAL_RANGE_INVALID] =
"Parameter out of range",
};
/** @endcond */
#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_WNM
/** IEEE 802.11v BTM (BSS transition management) Query reasons.
* Refer to IEEE Std 802.11v-2011 - Table 7-43x-Transition and Transition Query reasons table.
*/
enum wifi_btm_query_reason {
/** Unspecified. */
WIFI_BTM_QUERY_REASON_UNSPECIFIED = 0,
/** Low RSSI. */
WIFI_BTM_QUERY_REASON_LOW_RSSI = 16,
/** Leaving ESS. */
WIFI_BTM_QUERY_REASON_LEAVING_ESS = 20,
};
#endif
/** Helper function to get user-friendly power save error code name. */
static inline const char *wifi_ps_get_config_err_code_str(int16_t err_no)
{
if ((err_no) < (int16_t)ARRAY_SIZE(wifi_ps_param_config_err_code_tbl)) {
return wifi_ps_param_config_err_code_tbl[err_no];
}
return "<unknown>";
}
/** @brief Wi-Fi AP mode configuration parameter */
enum wifi_ap_config_param {
/** Used for AP mode configuration parameter ap_max_inactivity */
WIFI_AP_CONFIG_PARAM_MAX_INACTIVITY = BIT(0),
/** Used for AP mode configuration parameter max_num_sta */
WIFI_AP_CONFIG_PARAM_MAX_NUM_STA = BIT(1),
/** Used for AP mode configuration parameter bandwidth */
WIFI_AP_CONFIG_PARAM_BANDWIDTH = BIT(2),
/** Used for AP mode configuration parameter ht_capab */
WIFI_AP_CONFIG_PARAM_HT_CAPAB = BIT(3),
/** Used for AP mode configuration parameter vht_capab */
WIFI_AP_CONFIG_PARAM_VHT_CAPAB = BIT(4),
};
#ifdef __cplusplus
}
#endif
/**
* @}
*/
#endif /* ZEPHYR_INCLUDE_NET_WIFI_H_ */