]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Move get_hdr_bssid() to make it easier to share for other uses
authorJohannes Berg <johannes.berg@intel.com>
Thu, 20 Oct 2011 18:50:23 +0000 (21:50 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 20 Oct 2011 18:50:23 +0000 (21:50 +0300)
src/ap/drv_callbacks.c
src/common/ieee802_11_common.c
src/common/ieee802_11_common.h

index 2dbf6ea7337d77255ed1718328bfe1d3e5951a83..10315adb626c0a8495bbf76b2a9cc57d4406b8ed 100644 (file)
@@ -297,46 +297,6 @@ int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa, const u8 *da,
 
 #ifdef NEED_AP_MLME
 
-static const u8 * get_hdr_bssid(const struct ieee80211_hdr *hdr, size_t len)
-{
-       u16 fc, type, stype;
-
-       /*
-        * PS-Poll frames are 16 bytes. All other frames are
-        * 24 bytes or longer.
-        */
-       if (len < 16)
-               return NULL;
-
-       fc = le_to_host16(hdr->frame_control);
-       type = WLAN_FC_GET_TYPE(fc);
-       stype = WLAN_FC_GET_STYPE(fc);
-
-       switch (type) {
-       case WLAN_FC_TYPE_DATA:
-               if (len < 24)
-                       return NULL;
-               switch (fc & (WLAN_FC_FROMDS | WLAN_FC_TODS)) {
-               case WLAN_FC_FROMDS | WLAN_FC_TODS:
-               case WLAN_FC_TODS:
-                       return hdr->addr1;
-               case WLAN_FC_FROMDS:
-                       return hdr->addr2;
-               default:
-                       return NULL;
-               }
-       case WLAN_FC_TYPE_CTRL:
-               if (stype != WLAN_FC_STYPE_PSPOLL)
-                       return NULL;
-               return hdr->addr1;
-       case WLAN_FC_TYPE_MGMT:
-               return hdr->addr3;
-       default:
-               return NULL;
-       }
-}
-
-
 #define HAPD_BROADCAST ((struct hostapd_data *) -1)
 
 static struct hostapd_data * get_hapd_bssid(struct hostapd_iface *iface,
index ee41b3a6e7e06bccdf1952c670134cc109e8eb02..8b89f9d8381d3d40b2a2bd011a9c7a5dacfb08de 100644 (file)
@@ -345,3 +345,43 @@ struct wpabuf * ieee802_11_vendor_ie_concat(const u8 *ies, size_t ies_len,
 
        return buf;
 }
+
+
+const u8 * get_hdr_bssid(const struct ieee80211_hdr *hdr, size_t len)
+{
+       u16 fc, type, stype;
+
+       /*
+        * PS-Poll frames are 16 bytes. All other frames are
+        * 24 bytes or longer.
+        */
+       if (len < 16)
+               return NULL;
+
+       fc = le_to_host16(hdr->frame_control);
+       type = WLAN_FC_GET_TYPE(fc);
+       stype = WLAN_FC_GET_STYPE(fc);
+
+       switch (type) {
+       case WLAN_FC_TYPE_DATA:
+               if (len < 24)
+                       return NULL;
+               switch (fc & (WLAN_FC_FROMDS | WLAN_FC_TODS)) {
+               case WLAN_FC_FROMDS | WLAN_FC_TODS:
+               case WLAN_FC_TODS:
+                       return hdr->addr1;
+               case WLAN_FC_FROMDS:
+                       return hdr->addr2;
+               default:
+                       return NULL;
+               }
+       case WLAN_FC_TYPE_CTRL:
+               if (stype != WLAN_FC_STYPE_PSPOLL)
+                       return NULL;
+               return hdr->addr1;
+       case WLAN_FC_TYPE_MGMT:
+               return hdr->addr3;
+       default:
+               return NULL;
+       }
+}
index 0c90fa47c36660feefad0d12b0752d50338d4882..1c728fc6d4f0dfa7cdc3bb0938bf1ddc7ddc4a33 100644 (file)
@@ -77,5 +77,7 @@ ParseRes ieee802_11_parse_elems(const u8 *start, size_t len,
 int ieee802_11_ie_count(const u8 *ies, size_t ies_len);
 struct wpabuf * ieee802_11_vendor_ie_concat(const u8 *ies, size_t ies_len,
                                            u32 oui_type);
+struct ieee80211_hdr;
+const u8 * get_hdr_bssid(const struct ieee80211_hdr *hdr, size_t len);
 
 #endif /* IEEE802_11_COMMON_H */