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 
21 #ifndef NET_WIFI_H
22 #define NET_WIFI_H
23 
24 #include <inttypes.h>
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
33 #define WIFI_REGION_EUROPE 0
34 
38 #define WIFI_REGION_NORTH_AMERICA 1
39 
43 #define WIFI_REGION_ASIA 2
44 
45 #if !defined(CONFIG_WIFI_REGION) || defined(DOXYGEN)
49 #define CONFIG_WIFI_REGION WIFI_REGION_EUROPE
50 #endif
51 
55 #define WIFI_REGION CONFIG_WIFI_REGION
56 
60 typedef enum {
76 
77 #if WIFI_REGION == WIFI_REGION_EUROPE
81 #define WIFI_2_4_CH_MIN 1
82 
86 #define WIFI_2_4_CH_MAX 13
87 #elif WIFI_REGION == WIFI_REGION_NORTH_AMERICA
88 #define WIFI_2_4_CH_MIN 1
89 #define WIFI_2_4_CH_MAX 11
90 #elif WIFI_REGION == WIFI_REGION_ASIA
91 #define WIFI_2_4_CH_MIN 1
92 #define WIFI_2_4_CH_MAX 14
93 #else
94 #error "WIFI_REGION undefined"
95 #endif
96 
100 #define WIFI_2_4_CH_NUMOF (2 + (WIFI_2_4_CH_MAX - WIFI_2_4_CH_MIN))
101 
105 typedef enum {
111 
115 #define WIFI_SSID_LEN_MAX 32
116 
120 #define WIFI_WPA_PSK_LEN_MAX 63
121 
125 #define WIFI_WEP_PSK_LEN_MAX 16
126 
130 #define WIFI_EAP_USER_LEN_MAX 20
131 
135 #define WIFI_EAP_PWD_LEN_MAX 40
136 
140 typedef struct wifi_security_wpa_psk {
144 
148 typedef struct wifi_security_wep_psk {
152 
161 
162 #ifdef __cplusplus
163 }
164 #endif
165 
166 #endif /* NET_WIFI_H */
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:105
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:125
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:60
#define WIFI_EAP_PWD_LEN_MAX
Maximum password length for WPA2 Enterprise.
Definition: wifi.h:135
#define WIFI_EAP_USER_LEN_MAX
Maximum username length for WPA2 Enterprise.
Definition: wifi.h:130
#define WIFI_WPA_PSK_LEN_MAX
Maximum length of a WPA key.
Definition: wifi.h:120
@ WIFI_SECURITY_MODE_WPA2_ENTERPRISE
AP is protected with WPA2 Enterprise mode.
Definition: wifi.h:109
@ WIFI_SECURITY_MODE_WEP_PSK
AP is protected with WEP.
Definition: wifi.h:107
@ WIFI_SECURITY_MODE_WPA2_PERSONAL
AP is protected with WPA2 Personal mode.
Definition: wifi.h:108
@ WIFI_SECURITY_MODE_OPEN
AP is open.
Definition: wifi.h:106
@ WIFI_2_4_CH_9
2.4 GHz channel 9
Definition: wifi.h:69
@ WIFI_2_4_CH_6
2.4 GHz channel 6
Definition: wifi.h:66
@ WIFI_2_4_CH_5
2.4 GHz channel 5
Definition: wifi.h:65
@ WIFI_2_4_CH_8
2.4 GHz channel 8
Definition: wifi.h:68
@ WIFI_2_4_CH_1
2.4 GHz channel 1
Definition: wifi.h:61
@ WIFI_2_4_CH_2
2.4 GHz channel 2
Definition: wifi.h:62
@ WIFI_2_4_CH_10
2.4 GHz channel 10
Definition: wifi.h:70
@ WIFI_2_4_CH_13
2.4 GHz channel 13
Definition: wifi.h:73
@ WIFI_2_4_CH_14
2.4 GHz channel 14
Definition: wifi.h:74
@ WIFI_2_4_CH_7
2.4 GHz channel 7
Definition: wifi.h:67
@ WIFI_2_4_CH_4
2.4 GHz channel 4
Definition: wifi.h:64
@ WIFI_2_4_CH_3
2.4 GHz channel 3
Definition: wifi.h:63
@ WIFI_2_4_CH_12
2.4 GHz channel 12
Definition: wifi.h:72
@ WIFI_2_4_CH_11
2.4 GHz channel 11
Definition: wifi.h:71
Adds include for missing inttype definitions.
A WEP pre-shared-key.
Definition: wifi.h:148
char psk[WIFI_WEP_PSK_LEN_MAX+1]
Key data.
Definition: wifi.h:150
wifi_security_mode_t sec
WIFI_SECURITY_MODE_WEP_PSK
Definition: wifi.h:149
WPA2 Enterprise credentials.
Definition: wifi.h:156
char user[WIFI_EAP_USER_LEN_MAX+1]
Username.
Definition: wifi.h:158
wifi_security_mode_t sec
WIFI_SECURITY_MODE_WPA2_ENTERPRISE
Definition: wifi.h:157
char pwd[WIFI_EAP_PWD_LEN_MAX+1]
Password.
Definition: wifi.h:159
A WPA pre-shared-key.
Definition: wifi.h:140
char psk[WIFI_WPA_PSK_LEN_MAX+1]
Key data.
Definition: wifi.h:142
wifi_security_mode_t sec
WIFI_SECURITY_MODE_WPA2_PERSONAL
Definition: wifi.h:141