1 /*
2  * Copyright (c) 2023 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #ifndef __SUPP_MAIN_H_
7 #define __SUPP_MAIN_H_
8 
9 #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE
10 /* At least one of the EAP methods need to be enabled in enterprise mode */
11 #if !defined(CONFIG_EAP_TLS) && !defined(CONFIG_EAP_TTLS) && \
12 	!defined(CONFIG_EAP_PEAP) && !defined(CONFIG_EAP_FAST) && \
13 	!defined(CONFIG_EAP_SIM) && !defined(CONFIG_EAP_AKA) && \
14 	!defined(CONFIG_EAP_MD5) && !defined(CONFIG_EAP_MSCHAPV2) && \
15 	!defined(CONFIG_EAP_PSK) && !defined(CONFIG_EAP_PAX) && \
16 	!defined(CONFIG_EAP_SAKE) && !defined(CONFIG_EAP_GPSK) && \
17 	!defined(CONFIG_EAP_PWD) && !defined(CONFIG_EAP_EKE) && \
18 	!defined(CONFIG_EAP_IKEV2) && !defined(CONFIG_EAP_GTC)
19 #error "At least one of the following EAP methods need to be defined    \
20 	CONFIG_EAP_TLS    \
21 	CONFIG_EAP_TTLS   \
22 	CONFIG_EAP_PEAP   \
23 	CONFIG_EAP_MD5        \
24 	CONFIG_EAP_MSCHAPV2    \
25 	CONFIG_EAP_LEAP    \
26 	CONFIG_EAP_PSK   \
27 	CONFIG_EAP_PAX   \
28 	CONFIG_EAP_SAKE   \
29 	CONFIG_EAP_GPSK   \
30 	CONFIG_EAP_PWD   \
31 	CONFIG_EAP_EKE   \
32 	CONFIG_EAP_IKEV2   \
33 	CONFIG_EAP_SIM   \
34 	CONFIG_EAP_AKA   \
35 	CONFIG_EAP_GTC   \
36 	CONFIG_EAP_ALL "
37 #endif /* EAP METHODS */
38 #endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE */
39 
40 #if !defined(CONFIG_NET_DHCPV4)
net_dhcpv4_start(struct net_if * iface)41 static inline void net_dhcpv4_start(struct net_if *iface)
42 {
43 	ARG_UNUSED(iface);
44 }
net_dhcpv4_stop(struct net_if * iface)45 static inline void net_dhcpv4_stop(struct net_if *iface)
46 {
47 	ARG_UNUSED(iface);
48 }
49 #else
50 #include <zephyr/net/dhcpv4.h>
51 #endif
52 
53 struct wpa_global *zephyr_get_default_supplicant_context(void);
54 struct wpa_supplicant *zephyr_get_handle_by_ifname(const char *ifname);
55 
56 #ifdef CONFIG_WIFI_NM_HOSTAPD_AP
57 #include "common.h"
58 #include "wpa_debug_zephyr.h"
59 
60 struct hostapd_iface *zephyr_get_hapd_handle_by_ifname(const char *ifname);
61 void wpa_supplicant_msg_send(void *ctx, int level, enum wpa_msg_type type, const char *txt,
62 			     size_t len);
63 void hostapd_msg_send(void *ctx, int level, enum wpa_msg_type type, const char *buf, size_t len);
64 #endif
65 
66 struct wpa_supplicant_event_msg {
67 #ifdef CONFIG_WIFI_NM_HOSTAPD_AP
68 	int hostapd;
69 #endif
70 	bool global;
71 	void *ctx;
72 	unsigned int event;
73 	void *data;
74 };
75 int zephyr_wifi_send_event(const struct wpa_supplicant_event_msg *msg);
76 #endif /* __SUPP_MAIN_H_ */
77