a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* Macros, types, and functions for handling 802.11 MAC headers
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved.
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* --------------------------------------------------------------------
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* linux-wlan
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* 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* 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* Inquiries regarding the linux-wlan Open Source project can be
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* made directly to:
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* AbsoluteValue Systems Inc.
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* info@linux-wlan.com
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* This file declares the constants and types used in the interface
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* between a wlan driver and the user mode utilities.
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* All functions declared here are implemented in p80211.c
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync* --------------------------------------------------------------------
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/*================================================================*/
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* System Includes */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/*================================================================*/
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Project Includes */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/*================================================================*/
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Constants */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/*--- Sizes -----------------------------------------------*/
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_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/*--- Frame Control Field -------------------------------------*/
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Frame Types */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Frame subtypes */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Management */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Control */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/*================================================================*/
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Macros */
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/* printf("the frame subtype is %x", */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* GET_FC_FTYPE( ieee2host( rx.fc ))) */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* tx.fc = host2ieee( SET_FC_FTYPE(WLAN_FTYP_CTL) | */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* SET_FC_FSTYPE(WLAN_FSTYPE_RTS) ); */
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#define WLAN_SET_FC_MOREFRAG(n) (((UINT16)(n)) << 10)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#define WLAN_SET_FC_MOREDATA(n) (((UINT16)(n)) << 13)
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/*--- 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/*--- 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#define DOT11_RATE5_ISBASIC_GET(r) (((UINT8)(r)) & BIT7)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/*================================================================*/
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* BSS Timestamp */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Generic 802.11 Header types */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/*================================================================*/
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Extern Declarations */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/*================================================================*/
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Function Declarations */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* Frame and header lenght macros */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync/* ftcl in HOST order */
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync if ( WLAN_GET_FC_TODS(fctl) && WLAN_GET_FC_FROMDS(fctl) ) {
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync hdrlen = WLAN_CTL_FRAMELEN(WLAN_GET_FC_FSTYPE(fctl)) -
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync#endif /* _P80211HDR_H */