Browse Source

Add wrapper functions for IEEE 802.11 driver calls into driver.h

These functions allow the driver_*.c wrappers not to include
ieee802_11.h.
Jouni Malinen 16 years ago
parent
commit
649d8890b1

+ 1 - 0
hostapd/ap_list.c

@@ -23,6 +23,7 @@
 #include "ap_list.h"
 #include "hw_features.h"
 #include "beacon.h"
+#include "driver.h"
 
 
 struct ieee80211_frame_info {

+ 15 - 0
hostapd/driver.h

@@ -222,4 +222,19 @@ void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
 void hostapd_eapol_receive(struct hostapd_data *hapd, const u8 *sa,
 			   const u8 *buf, size_t len);
 
+struct hostapd_frame_info {
+	u32 phytype;
+	u32 channel;
+	u32 datarate;
+	u32 ssi_signal;
+
+	unsigned int passive_scan:1;
+};
+
+void hostapd_mgmt_rx(struct hostapd_data *hapd, u8 *buf, size_t len,
+		     u16 stype, struct hostapd_frame_info *fi);
+void hostapd_mgmt_tx_cb(struct hostapd_data *hapd, u8 *buf, size_t len,
+			u16 stype, int ok);
+void hostapd_michael_mic_failure(struct hostapd_data *hapd, const u8 *addr);
+
 #endif /* DRIVER_H */

+ 1 - 2
hostapd/driver_bsd.c

@@ -36,7 +36,6 @@
 #include "l2_packet/l2_packet.h"
 
 #include "eapol_sm.h"
-#include "ieee802_11.h"
 #include "common.h"
 
 struct bsd_driver_data {
@@ -585,7 +584,7 @@ bsd_wireless_event_receive(int sock, void *ctx, void *sock_ctx)
 				"Michael MIC failure wireless event: "
 				"keyix=%u src_addr=" MACSTR, mic->iev_keyix,
 				MAC2STR(mic->iev_src));
-			ieee80211_michael_mic_failure(hapd, mic->iev_src, 1);
+			hostapd_michael_mic_failure(hapd, mic->iev_src);
 			break;
 		}
 		break;

+ 3 - 4
hostapd/driver_hostap.c

@@ -36,7 +36,6 @@
 #include "driver.h"
 #include "eloop.h"
 #include "priv_netlink.h"
-#include "ieee802_11.h"
 #include "hostap_common.h"
 #include "hw_features.h"
 
@@ -138,7 +137,7 @@ static void handle_tx_callback(struct hostap_driver_data *drv, u8 *buf,
 	case WLAN_FC_TYPE_MGMT:
 		wpa_printf(MSG_DEBUG, "MGMT (TX callback) %s",
 			   ok ? "ACK" : "fail");
-		ieee802_11_mgmt_cb(drv->hapd, buf, len, stype, ok);
+		hostapd_mgmt_tx_cb(drv->hapd, buf, len, stype, ok);
 		break;
 	case WLAN_FC_TYPE_CTRL:
 		wpa_printf(MSG_DEBUG, "CTRL (TX callback) %s",
@@ -209,7 +208,7 @@ static void handle_frame(struct hostap_driver_data *drv, u8 *buf, size_t len)
 	case WLAN_FC_TYPE_MGMT:
 		if (stype != WLAN_FC_STYPE_BEACON)
 			wpa_printf(MSG_MSGDUMP, "MGMT");
-		ieee802_11_mgmt(drv->hapd, buf, data_len, stype, NULL);
+		hostapd_mgmt_rx(drv->hapd, buf, data_len, stype, NULL);
 		break;
 	case WLAN_FC_TYPE_CTRL:
 		wpa_printf(MSG_DEBUG, "CTRL");
@@ -844,7 +843,7 @@ hostapd_wireless_event_wireless_custom(struct hostap_driver_data *drv,
 		}
 		pos += 5;
 		if (hwaddr_aton(pos, addr) == 0) {
-			ieee80211_michael_mic_failure(drv->hapd, addr, 1);
+			hostapd_michael_mic_failure(drv->hapd, addr);
 		} else {
 			wpa_printf(MSG_DEBUG,
 				   "MLME-MICHAELMICFAILURE.indication "

+ 1 - 2
hostapd/driver_madwifi.c

@@ -61,7 +61,6 @@
 #include "priv_netlink.h"
 #include "l2_packet/l2_packet.h"
 
-#include "ieee802_11.h"
 #include "common.h"
 #include "wps_hostapd.h"
 
@@ -902,7 +901,7 @@ madwifi_wireless_event_wireless_custom(struct madwifi_driver_data *drv,
 		}
 		pos += 5;
 		if (hwaddr_aton(pos, addr) == 0) {
-			ieee80211_michael_mic_failure(drv->hapd, addr, 1);
+			hostapd_michael_mic_failure(drv->hapd, addr);
 		} else {
 			wpa_printf(MSG_DEBUG,
 				   "MLME-MICHAELMICFAILURE.indication "

+ 4 - 5
hostapd/driver_nl80211.c

@@ -32,7 +32,6 @@
 #include "hostapd.h"
 #include "driver.h"
 #include "eloop.h"
-#include "ieee802_11.h"
 #include "hw_features.h"
 #include "mlme.h"
 #include "radiotap.h"
@@ -1650,7 +1649,7 @@ static void handle_tx_callback(struct hostapd_data *hapd, u8 *buf, size_t len,
 	case WLAN_FC_TYPE_MGMT:
 		wpa_printf(MSG_DEBUG, "MGMT (TX callback) %s",
 			   ok ? "ACK" : "fail");
-		ieee802_11_mgmt_cb(hapd, buf, len, stype, ok);
+		hostapd_mgmt_tx_cb(hapd, buf, len, stype, ok);
 		break;
 	case WLAN_FC_TYPE_CTRL:
 		wpa_printf(MSG_DEBUG, "CTRL (TX callback) %s",
@@ -1767,10 +1766,10 @@ static void handle_frame(struct i802_driver_data *drv,
 			wpa_printf(MSG_MSGDUMP, "MGMT");
 		if (broadcast_bssid) {
 			for (i = 0; i < iface->num_bss; i++)
-				ieee802_11_mgmt(iface->bss[i], buf, data_len,
+				hostapd_mgmt_rx(iface->bss[i], buf, data_len,
 						stype, hfi);
 		} else
-			ieee802_11_mgmt(hapd, buf, data_len, stype, hfi);
+			hostapd_mgmt_rx(hapd, buf, data_len, stype, hfi);
 		break;
 	case WLAN_FC_TYPE_CTRL:
 		/* can only get here with PS-Poll frames */
@@ -2122,7 +2121,7 @@ hostapd_wireless_event_wireless_custom(struct i802_driver_data *drv,
 		}
 		pos += 5;
 		if (hwaddr_aton(pos, addr) == 0) {
-			ieee80211_michael_mic_failure(drv->hapd, addr, 1);
+			hostapd_michael_mic_failure(drv->hapd, addr);
 		} else {
 			wpa_printf(MSG_DEBUG,
 				   "MLME-MICHAELMICFAILURE.indication "

+ 2 - 3
hostapd/driver_test.c

@@ -22,7 +22,6 @@
 #include "eloop.h"
 #include "wpa.h"
 #include "l2_packet/l2_packet.h"
-#include "ieee802_11.h"
 #include "hw_features.h"
 #include "wps_hostapd.h"
 
@@ -317,7 +316,7 @@ static int test_driver_send_mgmt_frame(void *priv, const void *buf,
 
 	hdr = (struct ieee80211_hdr *) buf;
 	fc = le_to_host16(hdr->frame_control);
-	ieee802_11_mgmt_cb(drv->hapd, (u8 *) buf, len, WLAN_FC_GET_STYPE(fc),
+	hostapd_mgmt_tx_cb(drv->hapd, (u8 *) buf, len, WLAN_FC_GET_STYPE(fc),
 			   ret >= 0);
 
 	return ret;
@@ -611,7 +610,7 @@ static void test_driver_mlme(struct test_driver_data *drv,
 			   __func__);
 		return;
 	}
-	ieee802_11_mgmt(drv->hapd, data, datalen, WLAN_FC_GET_STYPE(fc), NULL);
+	hostapd_mgmt_rx(drv->hapd, data, datalen, WLAN_FC_GET_STYPE(fc), NULL);
 }
 
 

+ 20 - 0
hostapd/hostapd.c

@@ -397,6 +397,26 @@ void hostapd_eapol_receive(struct hostapd_data *hapd, const u8 *sa,
 }
 
 
+void hostapd_mgmt_rx(struct hostapd_data *hapd, u8 *buf, size_t len,
+		     u16 stype, struct hostapd_frame_info *fi)
+{
+	ieee802_11_mgmt(hapd, buf, len, stype, fi);
+}
+
+
+void hostapd_mgmt_tx_cb(struct hostapd_data *hapd, u8 *buf, size_t len,
+			u16 stype, int ok)
+{
+	ieee802_11_mgmt_cb(hapd, buf, len, stype, ok);
+}
+
+
+void hostapd_michael_mic_failure(struct hostapd_data *hapd, const u8 *addr)
+{
+	ieee80211_michael_mic_failure(hapd, addr, 1);
+}
+
+
 #ifdef EAP_SERVER
 static int hostapd_sim_db_cb_sta(struct hostapd_data *hapd,
 				 struct sta_info *sta, void *ctx)

+ 1 - 9
hostapd/ieee802_11.h

@@ -19,18 +19,10 @@
 #include "ieee802_11_defs.h"
 #include "ieee802_11_common.h"
 
-struct hostapd_frame_info {
-	u32 phytype;
-	u32 channel;
-	u32 datarate;
-	u32 ssi_signal;
-
-	unsigned int passive_scan:1;
-};
-
 struct hostapd_iface;
 struct hostapd_data;
 struct sta_info;
+struct hostapd_frame_info;
 
 void ieee802_11_send_deauth(struct hostapd_data *hapd, u8 *addr, u16 reason);
 void ieee802_11_mgmt(struct hostapd_data *hapd, u8 *buf, size_t len,