Moved TX status processing for STA entries away from driver_*.c

Driver wrappers should not need to know about this level of core hostapd
details.
This commit is contained in:
Jouni Malinen 2009-01-09 15:33:36 +02:00 committed by Jouni Malinen
parent 76e2592190
commit 8607f4c31f
6 changed files with 24 additions and 25 deletions

View File

@ -213,5 +213,7 @@ struct wpa_driver_ops {
void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
int reassoc); int reassoc);
void hostapd_tx_status(struct hostapd_data *hapd, const u8 *addr,
const u8 *buf, size_t len, int ack);
#endif /* DRIVER_H */ #endif /* DRIVER_H */

View File

@ -143,7 +143,6 @@ static void handle_tx_callback(struct hostap_driver_data *drv, u8 *buf,
{ {
struct ieee80211_hdr *hdr; struct ieee80211_hdr *hdr;
u16 fc, type, stype; u16 fc, type, stype;
struct sta_info *sta;
hdr = (struct ieee80211_hdr *) buf; hdr = (struct ieee80211_hdr *) buf;
fc = le_to_host16(hdr->frame_control); 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: case WLAN_FC_TYPE_DATA:
wpa_printf(MSG_DEBUG, "DATA (TX callback) %s", wpa_printf(MSG_DEBUG, "DATA (TX callback) %s",
ok ? "ACK" : "fail"); ok ? "ACK" : "fail");
sta = ap_get_sta(drv->hapd, hdr->addr1); hostapd_tx_status(drv->hapd, hdr->addr1, buf, len, ok);
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);
break; break;
default: default:
printf("unknown TX callback frame type %d\n", type); printf("unknown TX callback frame type %d\n", type);

View File

@ -1661,7 +1661,6 @@ static void handle_tx_callback(struct hostapd_data *hapd, u8 *buf, size_t len,
{ {
struct ieee80211_hdr *hdr; struct ieee80211_hdr *hdr;
u16 fc, type, stype; u16 fc, type, stype;
struct sta_info *sta;
hdr = (struct ieee80211_hdr *) buf; hdr = (struct ieee80211_hdr *) buf;
fc = le_to_host16(hdr->frame_control); 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: case WLAN_FC_TYPE_DATA:
wpa_printf(MSG_DEBUG, "DATA (TX callback) %s", wpa_printf(MSG_DEBUG, "DATA (TX callback) %s",
ok ? "ACK" : "fail"); ok ? "ACK" : "fail");
sta = ap_get_sta(hapd, hdr->addr1); hostapd_tx_status(hapd, hdr->addr1, buf, len, ok);
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);
break; break;
default: default:
printf("unknown TX callback frame type %d\n", type); printf("unknown TX callback frame type %d\n", type);

View 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 #ifdef EAP_SERVER
static int hostapd_sim_db_cb_sta(struct hostapd_data *hapd, static int hostapd_sim_db_cb_sta(struct hostapd_data *hapd,
struct sta_info *sta, void *ctx) struct sta_info *sta, void *ctx)

View 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, 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 ieee80211_hdr *hdr;
struct ieee802_1x_hdr *xhdr; struct ieee802_1x_hdr *xhdr;

View File

@ -62,7 +62,7 @@ int ieee802_1x_reconfig(struct hostapd_data *hapd,
struct hostapd_config *oldconf, struct hostapd_config *oldconf,
struct hostapd_bss_config *oldbss); struct hostapd_bss_config *oldbss);
int ieee802_1x_tx_status(struct hostapd_data *hapd, struct sta_info *sta, 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_identity(struct eapol_state_machine *sm, size_t *len);
u8 * ieee802_1x_get_radius_class(struct eapol_state_machine *sm, size_t *len, u8 * ieee802_1x_get_radius_class(struct eapol_state_machine *sm, size_t *len,
int idx); int idx);