wifi.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2023 Fabian Hüßler ML!PA Consulting GmbH
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser General
5  * Public License v2.1. See the file LICENSE in the top level directory for
6  * more details.
7  */
8 
9 #pragma once
10 
23 #include <inttypes.h>
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
32 #define WIFI_REGION_EUROPE 0
33 
37 #define WIFI_REGION_NORTH_AMERICA 1
38 
42 #define WIFI_REGION_ASIA 2
43 
44 #if !defined(CONFIG_WIFI_REGION) || defined(DOXYGEN)
48 #define CONFIG_WIFI_REGION WIFI_REGION_EUROPE
49 #endif
50 
54 #define WIFI_REGION CONFIG_WIFI_REGION
55 
59 typedef enum {
75 
76 #if WIFI_REGION == WIFI_REGION_EUROPE
80 #define WIFI_2_4_CH_MIN 1
81 
85 #define WIFI_2_4_CH_MAX 13
86 #elif WIFI_REGION == WIFI_REGION_NORTH_AMERICA
87 #define WIFI_2_4_CH_MIN 1
88 #define WIFI_2_4_CH_MAX 11
89 #elif WIFI_REGION == WIFI_REGION_ASIA
90 #define WIFI_2_4_CH_MIN 1
91 #define WIFI_2_4_CH_MAX 14
92 #else
93 #error "WIFI_REGION undefined"
94 #endif
95 
99 #define WIFI_2_4_CH_NUMOF (2 + (WIFI_2_4_CH_MAX - WIFI_2_4_CH_MIN))
100 
104 typedef enum {
110 
114 #define WIFI_SSID_LEN_MAX 32
115 
119 #define WIFI_WPA_PSK_LEN_MAX 63
120 
124 #define WIFI_WEP_PSK_LEN_MAX 16
125 
129 #define WIFI_EAP_USER_LEN_MAX 20
130 
134 #define WIFI_EAP_PWD_LEN_MAX 40
135 
139 typedef struct wifi_security_wpa_psk {
143 
147 typedef struct wifi_security_wep_psk {
151 
160 
161 #ifdef __cplusplus
162 }
163 #endif
164 
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:104
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:124
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:59
#define WIFI_EAP_PWD_LEN_MAX
Maximum password length for WPA2 Enterprise.
Definition: wifi.h:134
#define WIFI_EAP_USER_LEN_MAX
Maximum username length for WPA2 Enterprise.
Definition: wifi.h:129
#define WIFI_WPA_PSK_LEN_MAX
Maximum length of a WPA key.
Definition: wifi.h:119
@ WIFI_SECURITY_MODE_WPA2_ENTERPRISE
AP is protected with WPA2 Enterprise mode.
Definition: wifi.h:108
@ WIFI_SECURITY_MODE_WEP_PSK
AP is protected with WEP.
Definition: wifi.h:106
@ WIFI_SECURITY_MODE_WPA2_PERSONAL
AP is protected with WPA2 Personal mode.
Definition: wifi.h:107
@ WIFI_SECURITY_MODE_OPEN
AP is open.
Definition: wifi.h:105
@ WIFI_2_4_CH_9
2.4 GHz channel 9
Definition: wifi.h:68
@ WIFI_2_4_CH_6
2.4 GHz channel 6
Definition: wifi.h:65
@ WIFI_2_4_CH_5
2.4 GHz channel 5
Definition: wifi.h:64
@ WIFI_2_4_CH_8
2.4 GHz channel 8
Definition: wifi.h:67
@ WIFI_2_4_CH_1
2.4 GHz channel 1
Definition: wifi.h:60
@ WIFI_2_4_CH_2
2.4 GHz channel 2
Definition: wifi.h:61
@ WIFI_2_4_CH_10
2.4 GHz channel 10
Definition: wifi.h:69
@ WIFI_2_4_CH_13
2.4 GHz channel 13
Definition: wifi.h:72
@ WIFI_2_4_CH_14
2.4 GHz channel 14
Definition: wifi.h:73
@ WIFI_2_4_CH_7
2.4 GHz channel 7
Definition: wifi.h:66
@ WIFI_2_4_CH_4
2.4 GHz channel 4
Definition: wifi.h:63
@ WIFI_2_4_CH_3
2.4 GHz channel 3
Definition: wifi.h:62
@ WIFI_2_4_CH_12
2.4 GHz channel 12
Definition: wifi.h:71
@ WIFI_2_4_CH_11
2.4 GHz channel 11
Definition: wifi.h:70
Adds include for missing inttype definitions.
A WEP pre-shared-key.
Definition: wifi.h:147
char psk[WIFI_WEP_PSK_LEN_MAX+1]
Key data.
Definition: wifi.h:149
wifi_security_mode_t sec
WIFI_SECURITY_MODE_WEP_PSK
Definition: wifi.h:148
WPA2 Enterprise credentials.
Definition: wifi.h:155
char user[WIFI_EAP_USER_LEN_MAX+1]
Username.
Definition: wifi.h:157
wifi_security_mode_t sec
WIFI_SECURITY_MODE_WPA2_ENTERPRISE
Definition: wifi.h:156
char pwd[WIFI_EAP_PWD_LEN_MAX+1]
Password.
Definition: wifi.h:158
A WPA pre-shared-key.
Definition: wifi.h:139
char psk[WIFI_WPA_PSK_LEN_MAX+1]
Key data.
Definition: wifi.h:141
wifi_security_mode_t sec
WIFI_SECURITY_MODE_WPA2_PERSONAL
Definition: wifi.h:140