summaryrefslogtreecommitdiffstats
path: root/src/drivers/net/p80211hdr.h
diff options
context:
space:
mode:
authorMarty Connor2007-07-05 01:47:01 +0200
committerMarty Connor2007-07-05 01:47:01 +0200
commite5950283ec6e07f6bf646adf35ce3d06c184d623 (patch)
treec641ed70c5f1d020509482caf3dbdfd63abf9070 /src/drivers/net/p80211hdr.h
parentMerge branch 'master' of /pub/scm/gpxe (diff)
downloadipxe-e5950283ec6e07f6bf646adf35ce3d06c184d623.tar.gz
ipxe-e5950283ec6e07f6bf646adf35ce3d06c184d623.tar.xz
ipxe-e5950283ec6e07f6bf646adf35ce3d06c184d623.zip
Purge warnings from prism2 drivers
Diffstat (limited to 'src/drivers/net/p80211hdr.h')
-rw-r--r--src/drivers/net/p80211hdr.h77
1 files changed, 57 insertions, 20 deletions
diff --git a/src/drivers/net/p80211hdr.h b/src/drivers/net/p80211hdr.h
index 50d92796..d9a8bbbe 100644
--- a/src/drivers/net/p80211hdr.h
+++ b/src/drivers/net/p80211hdr.h
@@ -124,6 +124,8 @@
#define WLAN_FSTYPE_DEAUTHEN 0x0c
/* Control */
+#define WLAN_FSTYPE_BLOCKACKREQ 0x8
+#define WLAN_FSTYPE_BLOCKACK 0x9
#define WLAN_FSTYPE_PSPOLL 0x0a
#define WLAN_FSTYPE_RTS 0x0b
#define WLAN_FSTYPE_CTS 0x0c
@@ -218,35 +220,32 @@
typedef UINT8 wlan_bss_ts_t[WLAN_BSS_TS_LEN];
/* Generic 802.11 Header types */
-__WLAN_PRAGMA_PACK1__
+
typedef struct p80211_hdr_a3
{
- UINT16 fc __WLAN_ATTRIB_PACK__;
- UINT16 dur __WLAN_ATTRIB_PACK__;
- UINT8 a1[WLAN_ADDR_LEN] __WLAN_ATTRIB_PACK__;
- UINT8 a2[WLAN_ADDR_LEN] __WLAN_ATTRIB_PACK__;
- UINT8 a3[WLAN_ADDR_LEN] __WLAN_ATTRIB_PACK__;
- UINT16 seq __WLAN_ATTRIB_PACK__;
+ UINT16 fc;
+ UINT16 dur;
+ UINT8 a1[WLAN_ADDR_LEN];
+ UINT8 a2[WLAN_ADDR_LEN];
+ UINT8 a3[WLAN_ADDR_LEN];
+ UINT16 seq;
} __WLAN_ATTRIB_PACK__ p80211_hdr_a3_t;
-__WLAN_PRAGMA_PACKDFLT__
-__WLAN_PRAGMA_PACK1__
typedef struct p80211_hdr_a4
{
- UINT16 fc __WLAN_ATTRIB_PACK__;
- UINT16 dur __WLAN_ATTRIB_PACK__;
- UINT8 a1[WLAN_ADDR_LEN] __WLAN_ATTRIB_PACK__;
- UINT8 a2[WLAN_ADDR_LEN] __WLAN_ATTRIB_PACK__;
- UINT8 a3[WLAN_ADDR_LEN] __WLAN_ATTRIB_PACK__;
- UINT16 seq __WLAN_ATTRIB_PACK__;
- UINT8 a4[WLAN_ADDR_LEN] __WLAN_ATTRIB_PACK__;
+ UINT16 fc;
+ UINT16 dur;
+ UINT8 a1[WLAN_ADDR_LEN];
+ UINT8 a2[WLAN_ADDR_LEN];
+ UINT8 a3[WLAN_ADDR_LEN];
+ UINT16 seq;
+ UINT8 a4[WLAN_ADDR_LEN];
} __WLAN_ATTRIB_PACK__ p80211_hdr_a4_t;
-__WLAN_PRAGMA_PACKDFLT__
typedef union p80211_hdr
{
- p80211_hdr_a3_t a3 __WLAN_ATTRIB_PACK__;
- p80211_hdr_a4_t a4 __WLAN_ATTRIB_PACK__;
+ p80211_hdr_a3_t a3;
+ p80211_hdr_a4_t a4;
} __WLAN_ATTRIB_PACK__ p80211_hdr_t;
@@ -257,6 +256,44 @@ typedef union p80211_hdr
/*================================================================*/
/* Function Declarations */
-void p802addr_to_str( char *buf, UINT8 *addr);
+/* Frame and header lenght macros */
+
+#define WLAN_CTL_FRAMELEN(fstype) (\
+ (fstype) == WLAN_FSTYPE_BLOCKACKREQ ? 24 : \
+ (fstype) == WLAN_FSTYPE_BLOCKACK ? 152 : \
+ (fstype) == WLAN_FSTYPE_PSPOLL ? 20 : \
+ (fstype) == WLAN_FSTYPE_RTS ? 20 : \
+ (fstype) == WLAN_FSTYPE_CTS ? 14 : \
+ (fstype) == WLAN_FSTYPE_ACK ? 14 : \
+ (fstype) == WLAN_FSTYPE_CFEND ? 20 : \
+ (fstype) == WLAN_FSTYPE_CFENDCFACK ? 20 : 4)
+
+#define WLAN_FCS_LEN 4
+
+/* ftcl in HOST order */
+inline static UINT16 p80211_headerlen(UINT16 fctl)
+{
+ UINT16 hdrlen = 0;
+
+ switch ( WLAN_GET_FC_FTYPE(fctl) ) {
+ case WLAN_FTYPE_MGMT:
+ hdrlen = WLAN_HDR_A3_LEN;
+ break;
+ case WLAN_FTYPE_DATA:
+ hdrlen = WLAN_HDR_A3_LEN;
+ if ( WLAN_GET_FC_TODS(fctl) && WLAN_GET_FC_FROMDS(fctl) ) {
+ hdrlen += WLAN_ADDR_LEN;
+ }
+ break;
+ case WLAN_FTYPE_CTL:
+ hdrlen = WLAN_CTL_FRAMELEN(WLAN_GET_FC_FSTYPE(fctl)) -
+ WLAN_FCS_LEN;
+ break;
+ default:
+ hdrlen = WLAN_HDR_A3_LEN;
+ }
+
+ return hdrlen;
+}
#endif /* _P80211HDR_H */