Moved TX status processing for STA entries away from driver_*.c
authorJouni Malinen <jouni.malinen@atheros.com>
Fri, 9 Jan 2009 13:33:36 +0000 (15:33 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 9 Jan 2009 13:33:36 +0000 (15:33 +0200)
Driver wrappers should not need to know about this level of core hostapd
details.

hostapd/driver.h
hostapd/driver_hostap.c
hostapd/driver_nl80211.c
hostapd/hostapd.c
hostapd/ieee802_1x.c
hostapd/ieee802_1x.h

index 36f5b2b..12fb897 100644 (file)
@@ -213,5 +213,7 @@ struct wpa_driver_ops {
 
 void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
                           int reassoc);
+void hostapd_tx_status(struct hostapd_data *hapd, const u8 *addr,
+                      const u8 *buf, size_t len, int ack);
 
 #endif /* DRIVER_H */
index 045909c..65e0b28 100644 (file)
@@ -143,7 +143,6 @@ static void handle_tx_callback(struct hostap_driver_data *drv, u8 *buf,
 {
        struct ieee80211_hdr *hdr;
        u16 fc, type, stype;
-       struct sta_info *sta;
 
        hdr = (struct ieee80211_hdr *) buf;
        fc = le_to_host16(hdr->frame_control);
@@ -164,17 +163,7 @@ static void handle_tx_callback(struct hostap_driver_data *drv, u8 *buf,
        case WLAN_FC_TYPE_DATA:
                wpa_printf(MSG_DEBUG, "DATA (TX callback) %s",
                           ok ? "ACK" : "fail");
-               sta = ap_get_sta(drv->hapd, hdr->addr1);
-               if (sta && sta->flags & WLAN_STA_PENDING_POLL) {
-                       wpa_printf(MSG_DEBUG, "STA " MACSTR
-                                  " %s pending activity poll",
-                                  MAC2STR(sta->addr),
-                                  ok ? "ACKed" : "did not ACK");
-                       if (ok)
-                               sta->flags &= ~WLAN_STA_PENDING_POLL;
-               }
-               if (sta)
-                       ieee802_1x_tx_status(drv->hapd, sta, buf, len, ok);
+               hostapd_tx_status(drv->hapd, hdr->addr1, buf, len, ok);
                break;
        default:
                printf("unknown TX callback frame type %d\n", type);
index eb9dd2f..b7f47fc 100644 (file)
@@ -1661,7 +1661,6 @@ static void handle_tx_callback(struct hostapd_data *hapd, u8 *buf, size_t len,
 {
        struct ieee80211_hdr *hdr;
        u16 fc, type, stype;
-       struct sta_info *sta;
 
        hdr = (struct ieee80211_hdr *) buf;
        fc = le_to_host16(hdr->frame_control);
@@ -1682,16 +1681,7 @@ static void handle_tx_callback(struct hostapd_data *hapd, u8 *buf, size_t len,
        case WLAN_FC_TYPE_DATA:
                wpa_printf(MSG_DEBUG, "DATA (TX callback) %s",
                           ok ? "ACK" : "fail");
-               sta = ap_get_sta(hapd, hdr->addr1);
-               if (sta && sta->flags & WLAN_STA_PENDING_POLL) {
-                       wpa_printf(MSG_DEBUG, "STA " MACSTR " %s pending "
-                                  "activity poll", MAC2STR(sta->addr),
-                                  ok ? "ACKed" : "did not ACK");
-                       if (ok)
-                               sta->flags &= ~WLAN_STA_PENDING_POLL;
-               }
-               if (sta)
-                       ieee802_1x_tx_status(hapd, sta, buf, len, ok);
+               hostapd_tx_status(hapd, hdr->addr1, buf, len, ok);
                break;
        default:
                printf("unknown TX callback frame type %d\n", type);
index 35b8edd..13124a0 100644 (file)
@@ -260,6 +260,24 @@ void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
 }
 
 
+void hostapd_tx_status(struct hostapd_data *hapd, const u8 *addr,
+                      const u8 *buf, size_t len, int ack)
+{
+       struct sta_info *sta;
+
+       sta = ap_get_sta(hapd, addr);
+       if (sta && sta->flags & WLAN_STA_PENDING_POLL) {
+               wpa_printf(MSG_DEBUG, "STA " MACSTR " %s pending "
+                          "activity poll", MAC2STR(sta->addr),
+                          ack ? "ACKed" : "did not ACK");
+               if (ack)
+                       sta->flags &= ~WLAN_STA_PENDING_POLL;
+       }
+       if (sta)
+               ieee802_1x_tx_status(hapd, sta, buf, len, ack);
+}
+
+
 #ifdef EAP_SERVER
 static int hostapd_sim_db_cb_sta(struct hostapd_data *hapd,
                                 struct sta_info *sta, void *ctx)
index b3118df..d8ebb16 100644 (file)
@@ -1754,7 +1754,7 @@ int ieee802_1x_reconfig(struct hostapd_data *hapd,
 
 
 int ieee802_1x_tx_status(struct hostapd_data *hapd, struct sta_info *sta,
-                        u8 *buf, size_t len, int ack)
+                        const u8 *buf, size_t len, int ack)
 {
        struct ieee80211_hdr *hdr;
        struct ieee802_1x_hdr *xhdr;
index 94cff93..5f4e60d 100644 (file)
@@ -62,7 +62,7 @@ int ieee802_1x_reconfig(struct hostapd_data *hapd,
                        struct hostapd_config *oldconf,
                        struct hostapd_bss_config *oldbss);
 int ieee802_1x_tx_status(struct hostapd_data *hapd, struct sta_info *sta,
-                        u8 *buf, size_t len, int ack);
+                        const u8 *buf, size_t len, int ack);
 u8 * ieee802_1x_get_identity(struct eapol_state_machine *sm, size_t *len);
 u8 * ieee802_1x_get_radius_class(struct eapol_state_machine *sm, size_t *len,
                                 int idx);