summaryrefslogtreecommitdiffstats
path: root/sys/net80211/ieee80211_var.h
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2004-12-31 20:56:32 +0000
committersam <sam@FreeBSD.org>2004-12-31 20:56:32 +0000
commit83e6bc999053beb4fac9cca316ef40fc42c9d2a8 (patch)
tree8d25456171300bd8b0348f16b78527a47c7d44a0 /sys/net80211/ieee80211_var.h
parent886a744d99602259fd5a6f098cb28a5c42776ad3 (diff)
downloadFreeBSD-src-83e6bc999053beb4fac9cca316ef40fc42c9d2a8.zip
FreeBSD-src-83e6bc999053beb4fac9cca316ef40fc42c9d2a8.tar.gz
add ieee80211_hdrspace and ieee80211_anyhdrspace to calculate the space
for an ieee80211 header taking into account padding requirements
Diffstat (limited to 'sys/net80211/ieee80211_var.h')
-rw-r--r--sys/net80211/ieee80211_var.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h
index ad98613..372452f 100644
--- a/sys/net80211/ieee80211_var.h
+++ b/sys/net80211/ieee80211_var.h
@@ -282,6 +282,36 @@ ieee80211_key_update_end(struct ieee80211com *ic)
ic->ic_crypto.cs_key_update_end(ic);
}
+/*
+ * XXX these need to be here for IEEE80211_F_DATAPAD
+ */
+
+/*
+ * Return the space occupied by the 802.11 header and any
+ * padding required by the driver. This works for a
+ * management or data frame.
+ */
+static __inline int
+ieee80211_hdrspace(struct ieee80211com *ic, const void *data)
+{
+ int size = ieee80211_hdrsize(data);
+ if (ic->ic_flags & IEEE80211_F_DATAPAD)
+ size = roundup(size, sizeof(u_int32_t));
+ return size;
+}
+
+/*
+ * Like ieee80211_hdrspace, but handles any type of frame.
+ */
+static __inline int
+ieee80211_anyhdrspace(struct ieee80211com *ic, const void *data)
+{
+ int size = ieee80211_anyhdrsize(data);
+ if (ic->ic_flags & IEEE80211_F_DATAPAD)
+ size = roundup(size, sizeof(u_int32_t));
+ return size;
+}
+
#define IEEE80211_MSG_DEBUG 0x40000000 /* IFF_DEBUG equivalent */
#define IEEE80211_MSG_DUMPPKTS 0x20000000 /* IFF_LINK2 equivalant */
#define IEEE80211_MSG_CRYPTO 0x10000000 /* crypto work */
OpenPOWER on IntegriCloud