Add wpa_bss_get_max_rate() to match with old scan_res helpers

This commit is contained in:
Jouni Malinen 2009-12-28 01:09:32 +02:00
parent 332d630a44
commit 99a6a63f25
2 changed files with 23 additions and 0 deletions

View File

@ -356,3 +356,25 @@ struct wpabuf * wpa_bss_get_vendor_ie_multi(const struct wpa_bss *bss,
return buf;
}
int wpa_bss_get_max_rate(const struct wpa_bss *bss)
{
int rate = 0;
const u8 *ie;
int i;
ie = wpa_bss_get_ie(bss, WLAN_EID_SUPP_RATES);
for (i = 0; ie && i < ie[1]; i++) {
if ((ie[i + 2] & 0x7f) > rate)
rate = ie[i + 2] & 0x7f;
}
ie = wpa_bss_get_ie(bss, WLAN_EID_EXT_SUPP_RATES);
for (i = 0; ie && i < ie[1]; i++) {
if ((ie[i + 2] & 0x7f) > rate)
rate = ie[i + 2] & 0x7f;
}
return rate;
}

View File

@ -79,5 +79,6 @@ const u8 * wpa_bss_get_ie(const struct wpa_bss *bss, u8 ie);
const u8 * wpa_bss_get_vendor_ie(const struct wpa_bss *bss, u32 vendor_type);
struct wpabuf * wpa_bss_get_vendor_ie_multi(const struct wpa_bss *bss,
u32 vendor_type);
int wpa_bss_get_max_rate(const struct wpa_bss *bss);
#endif /* BSS_H */