wifi.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2023 Fabian Hüßler ML!PA Consulting GmbH
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
20 #include <inttypes.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
29 #define WIFI_REGION_EUROPE 0
30 
34 #define WIFI_REGION_NORTH_AMERICA 1
35 
39 #define WIFI_REGION_ASIA 2
40 
41 #if !defined(CONFIG_WIFI_REGION) || defined(DOXYGEN)
45 #define CONFIG_WIFI_REGION WIFI_REGION_EUROPE
46 #endif
47 
51 #define WIFI_REGION CONFIG_WIFI_REGION
52 
56 typedef enum {
72 
73 #if WIFI_REGION == WIFI_REGION_EUROPE
77 #define WIFI_2_4_CH_MIN 1
78 
82 #define WIFI_2_4_CH_MAX 13
83 #elif WIFI_REGION == WIFI_REGION_NORTH_AMERICA
84 #define WIFI_2_4_CH_MIN 1
85 #define WIFI_2_4_CH_MAX 11
86 #elif WIFI_REGION == WIFI_REGION_ASIA
87 #define WIFI_2_4_CH_MIN 1
88 #define WIFI_2_4_CH_MAX 14
89 #else
90 #error "WIFI_REGION undefined"
91 #endif
92 
96 #define WIFI_2_4_CH_NUMOF (2 + (WIFI_2_4_CH_MAX - WIFI_2_4_CH_MIN))
97 
101 typedef enum {
107 
111 #define WIFI_SSID_LEN_MAX 32
112 
116 #define WIFI_WPA_PSK_LEN_MAX 63
117 
121 #define WIFI_WEP_PSK_LEN_MAX 16
122 
126 #define WIFI_EAP_USER_LEN_MAX 20
127 
131 #define WIFI_EAP_PWD_LEN_MAX 40
132 
136 typedef struct wifi_security_wpa_psk {
140 
144 typedef struct wifi_security_wep_psk {
148 
157 
158 #ifdef __cplusplus
159 }
160 #endif
161 
struct wifi_security_wpa_psk wifi_security_wpa_psk_t
A WPA pre-shared-key.
wifi_security_mode_t
Type to express a Wi-Fi security mode.
Definition: wifi.h:101
struct wifi_security_wpa_enterprise wifi_security_wpa_enterprise_t
WPA2 Enterprise credentials.
#define WIFI_WEP_PSK_LEN_MAX
Maximum length of a WEP key.
Definition: wifi.h:121
struct wifi_security_wep_psk wifi_security_wep_psk_t
A WEP pre-shared-key.
wifi_2_4_channel_t
2.4 GHz Channels
Definition: wifi.h:56
#define WIFI_EAP_PWD_LEN_MAX
Maximum password length for WPA2 Enterprise.
Definition: wifi.h:131
#define WIFI_EAP_USER_LEN_MAX
Maximum username length for WPA2 Enterprise.
Definition: wifi.h:126
#define WIFI_WPA_PSK_LEN_MAX
Maximum length of a WPA key.
Definition: wifi.h:116
@ WIFI_SECURITY_MODE_WPA2_ENTERPRISE
AP is protected with WPA2 Enterprise mode.
Definition: wifi.h:105
@ WIFI_SECURITY_MODE_WEP_PSK
AP is protected with WEP.
Definition: wifi.h:103
@ WIFI_SECURITY_MODE_WPA2_PERSONAL
AP is protected with WPA2 Personal mode.
Definition: wifi.h:104
@ WIFI_SECURITY_MODE_OPEN
AP is open.
Definition: wifi.h:102
@ WIFI_2_4_CH_9
2.4 GHz channel 9
Definition: wifi.h:65
@ WIFI_2_4_CH_6
2.4 GHz channel 6
Definition: wifi.h:62
@ WIFI_2_4_CH_5
2.4 GHz channel 5
Definition: wifi.h:61
@ WIFI_2_4_CH_8
2.4 GHz channel 8
Definition: wifi.h:64
@ WIFI_2_4_CH_1
2.4 GHz channel 1
Definition: wifi.h:57
@ WIFI_2_4_CH_2
2.4 GHz channel 2
Definition: wifi.h:58
@ WIFI_2_4_CH_10
2.4 GHz channel 10
Definition: wifi.h:66
@ WIFI_2_4_CH_13
2.4 GHz channel 13
Definition: wifi.h:69
@ WIFI_2_4_CH_14
2.4 GHz channel 14
Definition: wifi.h:70
@ WIFI_2_4_CH_7
2.4 GHz channel 7
Definition: wifi.h:63
@ WIFI_2_4_CH_4
2.4 GHz channel 4
Definition: wifi.h:60
@ WIFI_2_4_CH_3
2.4 GHz channel 3
Definition: wifi.h:59
@ WIFI_2_4_CH_12
2.4 GHz channel 12
Definition: wifi.h:68
@ WIFI_2_4_CH_11
2.4 GHz channel 11
Definition: wifi.h:67
Adds include for missing inttype definitions.
A WEP pre-shared-key.
Definition: wifi.h:144
char psk[WIFI_WEP_PSK_LEN_MAX+1]
Key data.
Definition: wifi.h:146
wifi_security_mode_t sec
WIFI_SECURITY_MODE_WEP_PSK
Definition: wifi.h:145
WPA2 Enterprise credentials.
Definition: wifi.h:152
char user[WIFI_EAP_USER_LEN_MAX+1]
Username.
Definition: wifi.h:154
wifi_security_mode_t sec
WIFI_SECURITY_MODE_WPA2_ENTERPRISE
Definition: wifi.h:153
char pwd[WIFI_EAP_PWD_LEN_MAX+1]
Password.
Definition: wifi.h:155
A WPA pre-shared-key.
Definition: wifi.h:136
char psk[WIFI_WPA_PSK_LEN_MAX+1]
Key data.
Definition: wifi.h:138
wifi_security_mode_t sec
WIFI_SECURITY_MODE_WPA2_PERSONAL
Definition: wifi.h:137