]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Add wpa_bss_get_max_rate() to match with old scan_res helpers
authorJouni Malinen <j@w1.fi>
Sun, 27 Dec 2009 23:09:32 +0000 (01:09 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 27 Dec 2009 23:09:32 +0000 (01:09 +0200)
wpa_supplicant/bss.c
wpa_supplicant/bss.h

index 96ab955ac9eec12f4b9b96147bf9bd45fc4440a0..3d2a13b5c4d06e346f25ee2c00765747e8582568 100644 (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;
+}
index e861e8a3e1e3bf905b3a9769ac975551976836ca..8eaeb584ffcea4f93bf7b756d17183e945a9c112 100644 (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 */