aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2009-12-13 21:05:39 (GMT)
committerJouni Malinen <j@w1.fi>2009-12-13 21:05:39 (GMT)
commitf8b1f695617c8f00e733064f2f7570ed78719da9 (patch)
tree692355b9a0cd64fb57724d583787786a10bc487a /wpa_supplicant
parent1b648c7e1ab9712576394242c35939768c4d4d24 (diff)
downloadhostap-f8b1f695617c8f00e733064f2f7570ed78719da9.zip
hostap-f8b1f695617c8f00e733064f2f7570ed78719da9.tar.gz
hostap-f8b1f695617c8f00e733064f2f7570ed78719da9.tar.bz2
Use generic driver events for TX status and RX reporting
Replace driver wrapper calls to hostapd_tx_status(), hostapd_rx_from_unknown_sta(), hostapd_mgmt_rx(), and hostapd_mgmt_tx_cb() with new generic driver events EVENT_TX_STATUS, EVENT_RX_FROM_UNKNOWN, and EVENT_RX_MGMT. This cleans up lot of the driver wrapper code to be less dependent on whether it is being used within wpa_supplicant AP mode or hostapd.
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/ap.c21
-rw-r--r--wpa_supplicant/ap.h7
-rw-r--r--wpa_supplicant/events.c33
3 files changed, 54 insertions, 7 deletions
diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index 039e64f..2e0882a 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -484,33 +484,40 @@ void wpa_supplicant_ap_deinit(struct wpa_supplicant *wpa_s)
void ap_tx_status(void *ctx, const u8 *addr,
const u8 *buf, size_t len, int ack)
{
+#ifdef NEED_AP_MLME
struct wpa_supplicant *wpa_s = ctx;
hostapd_tx_status(wpa_s->ap_iface->bss[0], addr, buf, len, ack);
+#endif /* NEED_AP_MLME */
}
-void ap_rx_from_unknown_sta(void *ctx, struct ieee80211_hdr *hdr, size_t len)
+void ap_rx_from_unknown_sta(void *ctx, const struct ieee80211_hdr *hdr,
+ size_t len)
{
+#ifdef NEED_AP_MLME
struct wpa_supplicant *wpa_s = ctx;
- hostapd_rx_from_unknown_sta(wpa_s->ap_iface->bss[0], hdr, len);
+ ieee802_11_rx_from_unknown(wpa_s->ap_iface->bss[0], hdr->addr2);
+#endif /* NEED_AP_MLME */
}
-#ifdef NEED_AP_MLME
-void ap_mgmt_rx(void *ctx, u8 *buf, size_t len, u16 stype,
+void ap_mgmt_rx(void *ctx, u8 *buf, size_t len,
struct hostapd_frame_info *fi)
{
+#ifdef NEED_AP_MLME
struct wpa_supplicant *wpa_s = ctx;
- ieee802_11_mgmt(wpa_s->ap_iface->bss[0], buf, len, stype, fi);
+ ieee802_11_mgmt(wpa_s->ap_iface->bss[0], buf, len, fi);
+#endif /* NEED_AP_MLME */
}
-void ap_mgmt_tx_cb(void *ctx, u8 *buf, size_t len, u16 stype, int ok)
+void ap_mgmt_tx_cb(void *ctx, const u8 *buf, size_t len, u16 stype, int ok)
{
+#ifdef NEED_AP_MLME
struct wpa_supplicant *wpa_s = ctx;
ieee802_11_mgmt_cb(wpa_s->ap_iface->bss[0], buf, len, stype, ok);
-}
#endif /* NEED_AP_MLME */
+}
void wpa_supplicant_ap_rx_eapol(struct wpa_supplicant *wpa_s,
diff --git a/wpa_supplicant/ap.h b/wpa_supplicant/ap.h
index 91dca8e..487de45 100644
--- a/wpa_supplicant/ap.h
+++ b/wpa_supplicant/ap.h
@@ -32,5 +32,12 @@ int ap_ctrl_iface_sta_next(struct wpa_supplicant *wpa_s, const char *txtaddr,
char *buf, size_t buflen);
int ap_ctrl_iface_wpa_get_status(struct wpa_supplicant *wpa_s, char *buf,
size_t buflen, int verbose);
+void ap_tx_status(void *ctx, const u8 *addr,
+ const u8 *buf, size_t len, int ack);
+void ap_rx_from_unknown_sta(void *ctx, const struct ieee80211_hdr *hdr,
+ size_t len);
+void ap_mgmt_rx(void *ctx, u8 *buf, size_t len,
+ struct hostapd_frame_info *fi);
+void ap_mgmt_tx_cb(void *ctx, const u8 *buf, size_t len, u16 stype, int ok);
#endif /* AP_H */
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index c528390..f8141eb 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -35,6 +35,7 @@
#include "ibss_rsn.h"
#include "sme.h"
#include "bgscan.h"
+#include "ap.h"
static int wpa_supplicant_select_config(struct wpa_supplicant *wpa_s)
@@ -1433,6 +1434,38 @@ void wpa_supplicant_event(void *ctx, wpa_event_type event,
case EVENT_ASSOC_TIMED_OUT:
sme_event_assoc_timed_out(wpa_s, data);
break;
+#ifdef CONFIG_AP
+ case EVENT_TX_STATUS:
+ if (wpa_s->ap_iface == NULL)
+ break;
+ switch (data->tx_status.type) {
+ case WLAN_FC_TYPE_MGMT:
+ ap_mgmt_tx_cb(wpa_s, data->tx_status.data,
+ data->tx_status.data_len,
+ data->tx_status.stype,
+ data->tx_status.ack);
+ break;
+ case WLAN_FC_TYPE_DATA:
+ ap_tx_status(wpa_s, data->tx_status.dst,
+ data->tx_status.data,
+ data->tx_status.data_len,
+ data->tx_status.ack);
+ break;
+ }
+ break;
+ case EVENT_RX_FROM_UNKNOWN:
+ if (wpa_s->ap_iface == NULL)
+ break;
+ ap_rx_from_unknown_sta(wpa_s, data->rx_from_unknown.hdr,
+ data->rx_from_unknown.len);
+ break;
+ case EVENT_RX_MGMT:
+ if (wpa_s->ap_iface == NULL)
+ break;
+ ap_mgmt_rx(wpa_s, data->rx_mgmt.frame,
+ data->rx_mgmt.frame_len, data->rx_mgmt.fi);
+ break;
+#endif /* CONFIG_AP */
default:
wpa_printf(MSG_INFO, "Unknown event %d", event);
break;