a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* src/include/wlan/p80211hdr.h
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync*
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* Macros, types, and functions for handling 802.11 MAC headers
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync*
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved.
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* --------------------------------------------------------------------
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync*
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* linux-wlan
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync*
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* The contents of this file are subject to the Mozilla Public
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* License Version 1.1 (the "License"); you may not use this file
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* except in compliance with the License. You may obtain a copy of
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* the License at http://www.mozilla.org/MPL/
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync*
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* Software distributed under the License is distributed on an "AS
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* implied. See the License for the specific language governing
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* rights and limitations under the License.
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync*
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* Alternatively, the contents of this file may be used under the
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* terms of the GNU Public License version 2 (the "GPL"), in which
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* case the provisions of the GPL are applicable instead of the
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* above. If you wish to allow the use of your version of this file
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* only under the terms of the GPL and not to allow others to use
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* your version of this file under the MPL, indicate your decision
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* by deleting the provisions above and replace them with the notice
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* and other provisions required by the GPL. If you do not delete
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* the provisions above, a recipient may use your version of this
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* file under either the MPL or the GPL.
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync*
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* --------------------------------------------------------------------
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync*
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* Inquiries regarding the linux-wlan Open Source project can be
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* made directly to:
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync*
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* AbsoluteValue Systems Inc.
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* info@linux-wlan.com
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* http://www.linux-wlan.com
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync*
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* --------------------------------------------------------------------
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync*
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* Portions of the development of this software were funded by
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* Intersil Corporation as part of PRISM(R) chipset product development.
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync*
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* --------------------------------------------------------------------
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync*
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* This file declares the constants and types used in the interface
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* between a wlan driver and the user mode utilities.
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync*
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* Note:
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* - Constant values are always in HOST byte order. To assign
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* values to multi-byte fields they _must_ be converted to
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* ieee byte order. To retrieve multi-byte values from incoming
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* frames, they must be converted to host order.
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync*
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* All functions declared here are implemented in p80211.c
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* --------------------------------------------------------------------
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync*/
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsyncFILE_LICENCE ( GPL2_ONLY );
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#ifndef _P80211HDR_H
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define _P80211HDR_H
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/*================================================================*/
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* System Includes */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/*================================================================*/
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Project Includes */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#ifndef _WLAN_COMPAT_H
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#include <wlan/wlan_compat.h>
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#endif
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/*================================================================*/
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Constants */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/*--- Sizes -----------------------------------------------*/
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_ADDR_LEN 6
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_CRC_LEN 4
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_BSSID_LEN 6
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_BSS_TS_LEN 8
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_HDR_A3_LEN 24
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_HDR_A4_LEN 30
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_SSID_MAXLEN 32
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_DATA_MAXLEN 2312
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_A3FR_MAXLEN (WLAN_HDR_A3_LEN + WLAN_DATA_MAXLEN + WLAN_CRC_LEN)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_A4FR_MAXLEN (WLAN_HDR_A4_LEN + WLAN_DATA_MAXLEN + WLAN_CRC_LEN)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_BEACON_FR_MAXLEN (WLAN_HDR_A3_LEN + 334)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_ATIM_FR_MAXLEN (WLAN_HDR_A3_LEN + 0)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_DISASSOC_FR_MAXLEN (WLAN_HDR_A3_LEN + 2)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_ASSOCREQ_FR_MAXLEN (WLAN_HDR_A3_LEN + 48)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_ASSOCRESP_FR_MAXLEN (WLAN_HDR_A3_LEN + 16)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_REASSOCREQ_FR_MAXLEN (WLAN_HDR_A3_LEN + 54)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_REASSOCRESP_FR_MAXLEN (WLAN_HDR_A3_LEN + 16)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_PROBEREQ_FR_MAXLEN (WLAN_HDR_A3_LEN + 44)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_PROBERESP_FR_MAXLEN (WLAN_HDR_A3_LEN + 78)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_AUTHEN_FR_MAXLEN (WLAN_HDR_A3_LEN + 261)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_DEAUTHEN_FR_MAXLEN (WLAN_HDR_A3_LEN + 2)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_WEP_NKEYS 4
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_WEP_MAXKEYLEN 13
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_CHALLENGE_IE_LEN 130
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_CHALLENGE_LEN 128
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_WEP_IV_LEN 4
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_WEP_ICV_LEN 4
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/*--- Frame Control Field -------------------------------------*/
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Frame Types */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FTYPE_MGMT 0x00
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FTYPE_CTL 0x01
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FTYPE_DATA 0x02
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Frame subtypes */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Management */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FSTYPE_ASSOCREQ 0x00
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FSTYPE_ASSOCRESP 0x01
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FSTYPE_REASSOCREQ 0x02
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FSTYPE_REASSOCRESP 0x03
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FSTYPE_PROBEREQ 0x04
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FSTYPE_PROBERESP 0x05
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FSTYPE_BEACON 0x08
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FSTYPE_ATIM 0x09
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FSTYPE_DISASSOC 0x0a
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FSTYPE_AUTHEN 0x0b
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FSTYPE_DEAUTHEN 0x0c
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Control */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FSTYPE_BLOCKACKREQ 0x8
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FSTYPE_BLOCKACK 0x9
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FSTYPE_PSPOLL 0x0a
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FSTYPE_RTS 0x0b
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FSTYPE_CTS 0x0c
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FSTYPE_ACK 0x0d
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FSTYPE_CFEND 0x0e
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FSTYPE_CFENDCFACK 0x0f
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Data */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FSTYPE_DATAONLY 0x00
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FSTYPE_DATA_CFACK 0x01
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FSTYPE_DATA_CFPOLL 0x02
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FSTYPE_DATA_CFACK_CFPOLL 0x03
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FSTYPE_NULL 0x04
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FSTYPE_CFACK 0x05
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FSTYPE_CFPOLL 0x06
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FSTYPE_CFACK_CFPOLL 0x07
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/*================================================================*/
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Macros */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/*--- FC Macros ----------------------------------------------*/
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Macros to get/set the bitfields of the Frame Control Field */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* GET_FC_??? - takes the host byte-order value of an FC */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* and retrieves the value of one of the */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* bitfields and moves that value so its lsb is */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* in bit 0. */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* SET_FC_??? - takes a host order value for one of the FC */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* bitfields and moves it to the proper bit */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* location for ORing into a host order FC. */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* To send the FC produced from SET_FC_???, */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* one must put the bytes in IEEE order. */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* e.g. */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* printf("the frame subtype is %x", */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* GET_FC_FTYPE( ieee2host( rx.fc ))) */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* tx.fc = host2ieee( SET_FC_FTYPE(WLAN_FTYP_CTL) | */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* SET_FC_FSTYPE(WLAN_FSTYPE_RTS) ); */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/*------------------------------------------------------------*/
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_GET_FC_PVER(n) (((UINT16)(n)) & (BIT0 | BIT1))
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_GET_FC_FTYPE(n) ((((UINT16)(n)) & (BIT2 | BIT3)) >> 2)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_GET_FC_FSTYPE(n) ((((UINT16)(n)) & (BIT4|BIT5|BIT6|BIT7)) >> 4)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_GET_FC_TODS(n) ((((UINT16)(n)) & (BIT8)) >> 8)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_GET_FC_FROMDS(n) ((((UINT16)(n)) & (BIT9)) >> 9)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_GET_FC_MOREFRAG(n) ((((UINT16)(n)) & (BIT10)) >> 10)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_GET_FC_RETRY(n) ((((UINT16)(n)) & (BIT11)) >> 11)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_GET_FC_PWRMGT(n) ((((UINT16)(n)) & (BIT12)) >> 12)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_GET_FC_MOREDATA(n) ((((UINT16)(n)) & (BIT13)) >> 13)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_GET_FC_ISWEP(n) ((((UINT16)(n)) & (BIT14)) >> 14)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_GET_FC_ORDER(n) ((((UINT16)(n)) & (BIT15)) >> 15)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_SET_FC_PVER(n) ((UINT16)(n))
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_SET_FC_FTYPE(n) (((UINT16)(n)) << 2)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_SET_FC_FSTYPE(n) (((UINT16)(n)) << 4)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_SET_FC_TODS(n) (((UINT16)(n)) << 8)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_SET_FC_FROMDS(n) (((UINT16)(n)) << 9)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_SET_FC_MOREFRAG(n) (((UINT16)(n)) << 10)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_SET_FC_RETRY(n) (((UINT16)(n)) << 11)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_SET_FC_PWRMGT(n) (((UINT16)(n)) << 12)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_SET_FC_MOREDATA(n) (((UINT16)(n)) << 13)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_SET_FC_ISWEP(n) (((UINT16)(n)) << 14)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_SET_FC_ORDER(n) (((UINT16)(n)) << 15)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/*--- Duration Macros ----------------------------------------*/
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Macros to get/set the bitfields of the Duration Field */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* - the duration value is only valid when bit15 is zero */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* - the firmware handles these values, so I'm not going */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* these macros right now. */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/*------------------------------------------------------------*/
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/*--- Sequence Control Macros -------------------------------*/
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Macros to get/set the bitfields of the Sequence Control */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Field. */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/*------------------------------------------------------------*/
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_GET_SEQ_FRGNUM(n) (((UINT16)(n)) & (BIT0|BIT1|BIT2|BIT3))
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_GET_SEQ_SEQNUM(n) ((((UINT16)(n)) & (~(BIT0|BIT1|BIT2|BIT3))) >> 4)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/*--- Data ptr macro -----------------------------------------*/
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Creates a UINT8* to the data portion of a frame */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Assumes you're passing in a ptr to the beginning of the hdr*/
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/*------------------------------------------------------------*/
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_HDR_A3_DATAP(p) (((UINT8*)(p)) + WLAN_HDR_A3_LEN)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_HDR_A4_DATAP(p) (((UINT8*)(p)) + WLAN_HDR_A4_LEN)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define DOT11_RATE5_ISBASIC_GET(r) (((UINT8)(r)) & BIT7)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/*================================================================*/
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Types */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* BSS Timestamp */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsynctypedef UINT8 wlan_bss_ts_t[WLAN_BSS_TS_LEN];
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Generic 802.11 Header types */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsynctypedef struct p80211_hdr_a3
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync{
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync UINT16 fc;
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync UINT16 dur;
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync UINT8 a1[WLAN_ADDR_LEN];
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync UINT8 a2[WLAN_ADDR_LEN];
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync UINT8 a3[WLAN_ADDR_LEN];
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync UINT16 seq;
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync} __WLAN_ATTRIB_PACK__ p80211_hdr_a3_t;
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsynctypedef struct p80211_hdr_a4
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync{
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync UINT16 fc;
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync UINT16 dur;
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync UINT8 a1[WLAN_ADDR_LEN];
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync UINT8 a2[WLAN_ADDR_LEN];
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync UINT8 a3[WLAN_ADDR_LEN];
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync UINT16 seq;
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync UINT8 a4[WLAN_ADDR_LEN];
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync} __WLAN_ATTRIB_PACK__ p80211_hdr_a4_t;
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsynctypedef union p80211_hdr
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync{
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync p80211_hdr_a3_t a3;
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync p80211_hdr_a4_t a4;
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync} __WLAN_ATTRIB_PACK__ p80211_hdr_t;
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/*================================================================*/
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Extern Declarations */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/*================================================================*/
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Function Declarations */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Frame and header lenght macros */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_CTL_FRAMELEN(fstype) (\
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync (fstype) == WLAN_FSTYPE_BLOCKACKREQ ? 24 : \
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync (fstype) == WLAN_FSTYPE_BLOCKACK ? 152 : \
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync (fstype) == WLAN_FSTYPE_PSPOLL ? 20 : \
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync (fstype) == WLAN_FSTYPE_RTS ? 20 : \
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync (fstype) == WLAN_FSTYPE_CTS ? 14 : \
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync (fstype) == WLAN_FSTYPE_ACK ? 14 : \
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync (fstype) == WLAN_FSTYPE_CFEND ? 20 : \
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync (fstype) == WLAN_FSTYPE_CFENDCFACK ? 20 : 4)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_FCS_LEN 4
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* ftcl in HOST order */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsyncinline static UINT16 p80211_headerlen(UINT16 fctl)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync{
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync UINT16 hdrlen = 0;
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync switch ( WLAN_GET_FC_FTYPE(fctl) ) {
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync case WLAN_FTYPE_MGMT:
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync hdrlen = WLAN_HDR_A3_LEN;
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync break;
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync case WLAN_FTYPE_DATA:
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync hdrlen = WLAN_HDR_A3_LEN;
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync if ( WLAN_GET_FC_TODS(fctl) && WLAN_GET_FC_FROMDS(fctl) ) {
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync hdrlen += WLAN_ADDR_LEN;
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync }
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync break;
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync case WLAN_FTYPE_CTL:
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync hdrlen = WLAN_CTL_FRAMELEN(WLAN_GET_FC_FSTYPE(fctl)) -
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync WLAN_FCS_LEN;
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync break;
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync default:
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync hdrlen = WLAN_HDR_A3_LEN;
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync }
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync return hdrlen;
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync}
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#endif /* _P80211HDR_H */