aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-09-18 17:29:20 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:52:59 -0400
commitf97df02e23269c7650869f6192e809f8ac1a4b39 (patch)
treeec94bcf660ff34c51562ac285d2b6fac38cc9059 /include/net
parent75a5f0ccfdbc0151ee40bb742f7b5c8eba493c0e (diff)
[PATCH] wireless networking: move frame inline functions to generic header
These inlines are generally useful, not just with mac80211. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Michael Wu <flamingice@sourmilk.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/mac80211.h60
1 files changed, 0 insertions, 60 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index d2cf734402e3..fcca9c39b9e7 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1399,64 +1399,4 @@ void ieee80211_wake_queues(struct ieee80211_hw *hw);
1399 */ 1399 */
1400void ieee80211_scan_completed(struct ieee80211_hw *hw); 1400void ieee80211_scan_completed(struct ieee80211_hw *hw);
1401 1401
1402/**
1403 * ieee80211_get_SA - get pointer to SA
1404 *
1405 * Given an 802.11 frame, this function returns the offset
1406 * to the source address (SA). It does not verify that the
1407 * header is long enough to contain the address, and the
1408 * header must be long enough to contain the frame control
1409 * field.
1410 *
1411 * @hdr: the frame
1412 */
1413static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr)
1414{
1415 u8 *raw = (u8 *) hdr;
1416 u8 tofrom = (*(raw+1)) & 3; /* get the TODS and FROMDS bits */
1417
1418 switch (tofrom) {
1419 case 2:
1420 return hdr->addr3;
1421 case 3:
1422 return hdr->addr4;
1423 }
1424 return hdr->addr2;
1425}
1426
1427/**
1428 * ieee80211_get_DA - get pointer to DA
1429 *
1430 * Given an 802.11 frame, this function returns the offset
1431 * to the destination address (DA). It does not verify that
1432 * the header is long enough to contain the address, and the
1433 * header must be long enough to contain the frame control
1434 * field.
1435 *
1436 * @hdr: the frame
1437 */
1438static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
1439{
1440 u8 *raw = (u8 *) hdr;
1441 u8 to_ds = (*(raw+1)) & 1; /* get the TODS bit */
1442
1443 if (to_ds)
1444 return hdr->addr3;
1445 return hdr->addr1;
1446}
1447
1448/**
1449 * ieee80211_get_morefrag - determine whether the MOREFRAGS bit is set
1450 *
1451 * This function determines whether the "more fragments" bit is set
1452 * in the frame.
1453 *
1454 * @hdr: the frame
1455 */
1456static inline int ieee80211_get_morefrag(struct ieee80211_hdr *hdr)
1457{
1458 return (le16_to_cpu(hdr->frame_control) &
1459 IEEE80211_FCTL_MOREFRAGS) != 0;
1460}
1461
1462#endif /* MAC80211_H */ 1402#endif /* MAC80211_H */