diff mbox series

hostapd: Rename event handling functions in hostapd for

Message ID PAXPR04MB9139F27885A571C2D834CAFFE3C12@PAXPR04MB9139.eurprd04.prod.outlook.com
State New
Headers show
Series hostapd: Rename event handling functions in hostapd for | expand

Commit Message

Hui Bai June 13, 2024, 6:32 a.m. UTC
On Zephyr, both wpa_supplicant and hostapd are supported. One compilation error was found due to function name conflict.
Both wpa_supplicant and hostapd has its own global event and event handlers with same name:
wpa_supplicant_event
wpa_supplicant_event_global

To fix the compilation error, rename above functions in hostapd for Zephyr as below:
hostapd_event
hostapd_event_global

Signed-off-by: Hui Bai <mailto:hui.bai@nxp.com>
---
src/ap/drv_callbacks.c | 10 ++++++++++
src/drivers/driver.h   | 30 ++++++++++++++++++++++++++++++
2 files changed, 40 insertions(+)
diff mbox series

Patch

diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c
index ad06e6a3f..29836cc73 100644
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -2409,8 +2409,13 @@  static void hostapd_event_color_change(struct hostapd_data *hapd, bool success)
#endif  /* CONFIG_IEEE80211AX */

 
+#ifdef __ZEPHYR__
+void hostapd_event(void *ctx, enum wpa_event_type event,
+                  union wpa_event_data *data)
+#else
void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
                          union wpa_event_data *data)
+#endif
{
       struct hostapd_data *hapd = ctx;
       struct sta_info *sta;
@@ -2761,8 +2766,13 @@  void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
}

 
+#ifdef __ZEPHYR__
+void hostapd_event_global(void *ctx, enum wpa_event_type event,
+                          union wpa_event_data *data)
+#else
void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
                                  union wpa_event_data *data)
+#endif
{
       struct hapd_interfaces *interfaces = ctx;
       struct hostapd_data *hapd;
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 204694dd4..d86bf403a 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -6846,6 +6846,21 @@  union wpa_event_data {
void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
                          union wpa_event_data *data);

+#ifdef __ZEPHYR__
+/**
+ * hostapd_event - Report a driver event for hostapd
+ * @ctx: Context pointer (wpa_s); this is the ctx variable registered
+ *      with struct wpa_driver_ops::init()
+ * @event: event type (defined above)
+ * @data: possible extra data for the event
+ *
+ * Driver wrapper code should call this function whenever an event is received
+ * from the driver.
+ */
+void hostapd_event(void *ctx, enum wpa_event_type event,
+                  union wpa_event_data *data);
+#endif
+
/**
  * wpa_supplicant_event_global - Report a driver event for wpa_supplicant
  * @ctx: Context pointer (wpa_s); this is the ctx variable registered
@@ -6859,6 +6874,21 @@  void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
                                  union wpa_event_data *data);

+#ifdef __ZEPHYR__
+/**
+ * hostapd_event_global - Report a driver event for hostapd
+ * @ctx: Context pointer (wpa_s); this is the ctx variable registered
+ *      with struct wpa_driver_ops::init()
+ * @event: event type (defined above)
+ * @data: possible extra data for the event
+ *
+ * Same as wpa_supplicant_event(), but we search for the interface in
+ * wpa_global.
+ */
+void hostapd_event_global(void *ctx, enum wpa_event_type event,
+                          union wpa_event_data *data);
+#endif
+
/*
  * The following inline functions are provided for convenience to simplify
  * event indication for some of the common events.