WPS: Add support for external Registrars using UPnP transport
[wpasupplicant] / hostapd / driver_test.c
index 667ed98..74b80df 100644 (file)
 #include "driver.h"
 #include "sha1.h"
 #include "eloop.h"
-#include "ieee802_1x.h"
-#include "sta_info.h"
 #include "wpa.h"
-#include "accounting.h"
-#include "radius/radius.h"
 #include "l2_packet/l2_packet.h"
-#include "ieee802_11.h"
 #include "hw_features.h"
 #include "wps_hostapd.h"
+#include "ieee802_11_defs.h"
 
 
 struct test_client_socket {
@@ -321,7 +317,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;
@@ -522,24 +518,12 @@ static void test_driver_disassoc(struct test_driver_data *drv,
                                 struct sockaddr_un *from, socklen_t fromlen)
 {
        struct test_client_socket *cli;
-       struct sta_info *sta;
 
        cli = test_driver_get_cli(drv, from, fromlen);
        if (!cli)
                return;
 
-       hostapd_logger(drv->hapd, cli->addr, HOSTAPD_MODULE_IEEE80211,
-                      HOSTAPD_LEVEL_INFO, "disassociated");
-
-       sta = ap_get_sta(drv->hapd, cli->addr);
-       if (sta != NULL) {
-               sta->flags &= ~WLAN_STA_ASSOC;
-               wpa_auth_sm_event(sta->wpa_sm, WPA_DISASSOC);
-               sta->acct_terminate_cause =
-                       RADIUS_ACCT_TERMINATE_CAUSE_USER_REQUEST;
-               ieee802_1x_notify_port_enabled(sta->eapol_sm, 0);
-               ap_free_sta(drv->hapd, sta);
-       }
+       hostapd_notif_disassoc(drv->hapd, cli->addr);
 }
 
 
@@ -549,12 +533,11 @@ static void test_driver_eapol(struct test_driver_data *drv,
 {
        struct test_client_socket *cli;
        if (datalen > 14) {
-               u8 *proto = data + 2 * ETH_ALEN;
                /* Skip Ethernet header */
                wpa_printf(MSG_DEBUG, "test_driver: dst=" MACSTR " src="
                           MACSTR " proto=%04x",
                           MAC2STR(data), MAC2STR(data + ETH_ALEN),
-                          WPA_GET_BE16(proto));
+                          WPA_GET_BE16(data + 2 * ETH_ALEN));
                data += 14;
                datalen -= 14;
        }
@@ -564,7 +547,7 @@ static void test_driver_eapol(struct test_driver_data *drv,
                hapd = test_driver_get_hapd(drv, cli->bss);
                if (hapd == NULL)
                        return;
-               ieee802_1x_receive(hapd, cli->addr, data, datalen);
+               hostapd_eapol_receive(hapd, cli->addr, data, datalen);
        } else {
                wpa_printf(MSG_DEBUG, "test_socket: EAPOL from unknown "
                           "client");
@@ -627,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);
 }