Initial revision
This commit is contained in:
parent
784747ba9e
commit
b6cac7486c
|
@ -0,0 +1,6 @@
|
|||
LINUX = /usr/src/linux
|
||||
PCMCIA = /usr/src/pcmcia-cs-3.0.13
|
||||
MODULES_DIR=/lib/modules/2.2.5-15
|
||||
UTS_RELEASE=2.2.5
|
||||
INST_EXEDIR=/sbin
|
||||
DESTDIR=
|
|
@ -0,0 +1,220 @@
|
|||
/* p80211hdr.h: Macros, types, and functions for handling 802.11 MAC headers
|
||||
* --------------------------------------------------------------------
|
||||
* Linux WLAN
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The initial developer of the original code is Mark S. Mathews
|
||||
* <mark@absoval.com>. Portions created by Mark S. Mathews
|
||||
* are Copyright (C) 1998 AbsoluteValue Software, Inc. All Rights Reserved.
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* This file declares the constants and types used in the interface
|
||||
* between a wlan driver and the user mode utilities.
|
||||
*
|
||||
* Note: Constant values are always in HOST byte order. To assign
|
||||
* values to multi-byte fields they _must_ be converted to
|
||||
* ieee byte order. To retrieve multi-byte values from incoming
|
||||
* frames, they must be converted to host order.
|
||||
*
|
||||
* All functions declared here are implemented in p80211.c
|
||||
* --------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef _P80211HDR_H
|
||||
#define _P80211HDR_H
|
||||
|
||||
#ifndef _WLAN_COMPAT_H
|
||||
#include <wlan/wlan_compat.h>
|
||||
#endif
|
||||
|
||||
|
||||
/*=============================================================*/
|
||||
/*--- Constants -----------------------------------------------*/
|
||||
/*=============================================================*/
|
||||
|
||||
/*--- Sizes -----------------------------------------------*/
|
||||
#define WLAN_ADDR_LEN 6
|
||||
#define WLAN_CRC_LEN 4
|
||||
#define WLAN_BSSID_LEN 6
|
||||
#define WLAN_BSS_TS_LEN 8
|
||||
#define WLAN_HDR_A3_LEN 24
|
||||
#define WLAN_HDR_A4_LEN 30
|
||||
#define WLAN_SSID_MAXLEN 32
|
||||
#define WLAN_DATA_MAXLEN 2312
|
||||
#define WLAN_A3FR_MAXLEN (WLAN_HDR_A3_LEN + WLAN_DATA_MAXLEN + WLAN_CRC_LEN)
|
||||
#define WLAN_BEACON_FR_MAXLEN (WLAN_HDR_A3_LEN + 334)
|
||||
#define WLAN_ATIM_FR_MAXLEN (WLAN_HDR_A3_LEN + 0)
|
||||
#define WLAN_DISASSOC_FR_MAXLEN (WLAN_HDR_A3_LEN + 2)
|
||||
#define WLAN_ASSOCREQ_FR_MAXLEN (WLAN_HDR_A3_LEN + 48)
|
||||
#define WLAN_ASSOCRESP_FR_MAXLEN (WLAN_HDR_A3_LEN + 16)
|
||||
#define WLAN_REASSOCREQ_FR_MAXLEN (WLAN_HDR_A3_LEN + 54)
|
||||
#define WLAN_REASSOCRESP_FR_MAXLEN (WLAN_HDR_A3_LEN + 16)
|
||||
#define WLAN_PROBEREQ_FR_MAXLEN (WLAN_HDR_A3_LEN + 44)
|
||||
#define WLAN_PROBERESP_FR_MAXLEN (WLAN_HDR_A3_LEN + 78)
|
||||
#define WLAN_AUTHEN_FR_MAXLEN (WLAN_HDR_A3_LEN + 261)
|
||||
#define WLAN_DEATHEN_FR_MAXLEN (WLAN_HDR_A3_LEN + 2)
|
||||
#define WLAN_WEP_NKEYS 4
|
||||
#define WLAN_WEP_KEYLEN 5
|
||||
#define WLAN_CHALLENGE_IE_LEN 130
|
||||
#define WLAN_CHALLENGE_LEN 128
|
||||
#define WLAN_WEP_IV_LEN 4
|
||||
#define WLAN_WEP_ICV_LEN 4
|
||||
|
||||
/*--- Frame Control Field -------------------------------------*/
|
||||
/* Frame Types */
|
||||
#define WLAN_FTYPE_MGMT 0x00
|
||||
#define WLAN_FTYPE_CTL 0x01
|
||||
#define WLAN_FTYPE_DATA 0x02
|
||||
|
||||
/* Frame subtypes */
|
||||
/* Management */
|
||||
#define WLAN_FSTYPE_ASSOCREQ 0x00
|
||||
#define WLAN_FSTYPE_ASSOCRESP 0x01
|
||||
#define WLAN_FSTYPE_REASSOCREQ 0x02
|
||||
#define WLAN_FSTYPE_REASSOCRESP 0x03
|
||||
#define WLAN_FSTYPE_PROBEREQ 0x04
|
||||
#define WLAN_FSTYPE_PROBERESP 0x05
|
||||
#define WLAN_FSTYPE_BEACON 0x08
|
||||
#define WLAN_FSTYPE_ATIM 0x09
|
||||
#define WLAN_FSTYPE_DISASSOC 0x0a
|
||||
#define WLAN_FSTYPE_AUTHEN 0x0b
|
||||
#define WLAN_FSTYPE_DEAUTHEN 0x0c
|
||||
|
||||
/* Control */
|
||||
#define WLAN_FSTYPE_PSPOLL 0x0a
|
||||
#define WLAN_FSTYPE_RTS 0x0b
|
||||
#define WLAN_FSTYPE_CTS 0x0c
|
||||
#define WLAN_FSTYPE_ACK 0x0d
|
||||
#define WLAN_FSTYPE_CFEND 0x0e
|
||||
#define WLAN_FSTYPE_CFENDCFACK 0x0f
|
||||
|
||||
/* Data */
|
||||
#define WLAN_FSTYPE_DATAONLY 0x00
|
||||
#define WLAN_FSTYPE_DATA_CFACK 0x01
|
||||
#define WLAN_FSTYPE_DATA_CFPOLL 0x02
|
||||
#define WLAN_FSTYPE_DATA_CFACK_CFPOLL 0x03
|
||||
#define WLAN_FSTYPE_NULL 0x04
|
||||
#define WLAN_FSTYPE_CFACK 0x05
|
||||
#define WLAN_FSTYPE_CFPOLL 0x06
|
||||
#define WLAN_FSTYPE_CFACK_CFPOLL 0x07
|
||||
|
||||
/*--- FC Macros ----------------------------------------------*/
|
||||
/* Macros to get/set the bitfields of the Frame Control Field */
|
||||
/* GET_FC_??? - takes the host byte-order value of an FC */
|
||||
/* and retrieves the value of one of the */
|
||||
/* bitfields and moves that value so its lsb is */
|
||||
/* in bit 0. */
|
||||
/* SET_FC_??? - takes a host order value for one of the FC */
|
||||
/* bitfields and moves it to the proper bit */
|
||||
/* location for ORing into a host order FC. */
|
||||
/* To send the FC produced from SET_FC_???, */
|
||||
/* one must put the bytes in IEEE order. */
|
||||
/* e.g. */
|
||||
/* printf("the frame subtype is %x", */
|
||||
/* GET_FC_FTYPE( ieee2host( rx.fc ))) */
|
||||
/* */
|
||||
/* tx.fc = host2ieee( SET_FC_FTYPE(WLAN_FTYP_CTL) | */
|
||||
/* SET_FC_FSTYPE(WLAN_FSTYPE_RTS) ); */
|
||||
/*------------------------------------------------------------*/
|
||||
|
||||
#define WLAN_GET_FC_PVER(n) (((UINT16)(n)) & (BIT0 | BIT1))
|
||||
#define WLAN_GET_FC_FTYPE(n) ((((UINT16)(n)) & (BIT2 | BIT3)) >> 2)
|
||||
#define WLAN_GET_FC_FSTYPE(n) ((((UINT16)(n)) & (BIT4|BIT5|BIT6|BIT7)) >> 4)
|
||||
#define WLAN_GET_FC_TODS(n) ((((UINT16)(n)) & (BIT8)) >> 8)
|
||||
#define WLAN_GET_FC_FROMDS(n) ((((UINT16)(n)) & (BIT9)) >> 9)
|
||||
#define WLAN_GET_FC_MOREFRAG(n) ((((UINT16)(n)) & (BIT10)) >> 10)
|
||||
#define WLAN_GET_FC_RETRY(n) ((((UINT16)(n)) & (BIT11)) >> 11)
|
||||
#define WLAN_GET_FC_PWRMGT(n) ((((UINT16)(n)) & (BIT12)) >> 12)
|
||||
#define WLAN_GET_FC_MOREDATA(n) ((((UINT16)(n)) & (BIT13)) >> 13)
|
||||
#define WLAN_GET_FC_ISWEP(n) ((((UINT16)(n)) & (BIT14)) >> 14)
|
||||
#define WLAN_GET_FC_ORDER(n) ((((UINT16)(n)) & (BIT15)) >> 15)
|
||||
|
||||
#define WLAN_SET_FC_PVER(n) ((UINT16)(n))
|
||||
#define WLAN_SET_FC_FTYPE(n) (((UINT16)(n)) << 2)
|
||||
#define WLAN_SET_FC_FSTYPE(n) (((UINT16)(n)) << 4)
|
||||
#define WLAN_SET_FC_TODS(n) (((UINT16)(n)) << 8)
|
||||
#define WLAN_SET_FC_FROMDS(n) (((UINT16)(n)) << 9)
|
||||
#define WLAN_SET_FC_MOREFRAG(n) (((UINT16)(n)) << 10)
|
||||
#define WLAN_SET_FC_RETRY(n) (((UINT16)(n)) << 11)
|
||||
#define WLAN_SET_FC_PWRMGT(n) (((UINT16)(n)) << 12)
|
||||
#define WLAN_SET_FC_MOREDATA(n) (((UINT16)(n)) << 13)
|
||||
#define WLAN_SET_FC_ISWEP(n) (((UINT16)(n)) << 14)
|
||||
#define WLAN_SET_FC_ORDER(n) (((UINT16)(n)) << 15)
|
||||
|
||||
/*--- Duration Macros ----------------------------------------*/
|
||||
/* Macros to get/set the bitfields of the Duration Field */
|
||||
/* - the duration value is only valid when bit15 is zero */
|
||||
/* - the firmware handles these values, so I'm not going */
|
||||
/* these macros right now. */
|
||||
/*------------------------------------------------------------*/
|
||||
|
||||
/*--- Sequence Control Macros -------------------------------*/
|
||||
/* Macros to get/set the bitfields of the Sequence Control */
|
||||
/* Field. */
|
||||
/*------------------------------------------------------------*/
|
||||
#define WLAN_GET_SEQ_FRGNUM(n) (((UINT16)(n)) & (BIT0|BIT1|BIT2|BIT3))
|
||||
#define WLAN_GET_SEQ_SEQNUM(n) ((((UINT16)(n)) & (~(BIT0|BIT1|BIT2|BIT3))) >> 4)
|
||||
|
||||
/*--- Data ptr macro -----------------------------------------*/
|
||||
/* Creates a UINT8* to the data portion of a frame */
|
||||
/* Assumes you're passing in a ptr to the beginning of the hdr*/
|
||||
/*------------------------------------------------------------*/
|
||||
#define WLAN_HDR_A3_DATAP(p) (((UINT8*)(p)) + WLAN_HDR_A3_LEN)
|
||||
#define WLAN_HDR_A4_DATAP(p) (((UINT8*)(p)) + WLAN_HDR_A4_LEN)
|
||||
|
||||
/*=============================================================*/
|
||||
/*--- Types and Structures ------------------------------------*/
|
||||
/*=============================================================*/
|
||||
|
||||
/* BSS Timestamp */
|
||||
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__;
|
||||
} 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__;
|
||||
} p80211_hdr_a4_t;
|
||||
__WLAN_PRAGMA_PACKDFLT__
|
||||
|
||||
typedef union p80211_hdr
|
||||
{
|
||||
p80211_hdr_a3_t a3;
|
||||
p80211_hdr_a4_t a4;
|
||||
} p80211_hdr_t;
|
||||
|
||||
/*=============================================================*/
|
||||
/*--- Functions -----------------------------------------------*/
|
||||
/*=============================================================*/
|
||||
|
||||
void p802addr_to_str( char *buf, UINT8 *addr);
|
||||
|
||||
#endif /* _P80211HDR_H */
|
|
@ -0,0 +1,61 @@
|
|||
/* p80211ioctl.h: Declares constants and types for the p80211 ioctls
|
||||
* --------------------------------------------------------------------
|
||||
* Linux WLAN
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The initial developer of the original code is Mark S. Mathews
|
||||
* <mark@absoval.com>. Portions created by Mark S. Mathews
|
||||
* are Copyright (C) 1998 AbsoluteValue Software, Inc. All Rights Reserved.
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* --------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef _P80211IOCTL_H
|
||||
#define _P80211IOCTL_H
|
||||
|
||||
/*====================================================================*/
|
||||
/*----- Constants ----------------------------------------------------*/
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* p80211 ioctl "request" codes. See argument 2 of ioctl(2). */
|
||||
/*--------------------------------------------------------------------*/
|
||||
#define P80211_IFTEST (SIOCDEVPRIVATE + 0)
|
||||
#define P80211_IFREQ (SIOCDEVPRIVATE + 1)
|
||||
|
||||
/*====================================================================*/
|
||||
/*----- Macros -------------------------------------------------------*/
|
||||
|
||||
/*====================================================================*/
|
||||
/*----- Types --------------------------------------------------------*/
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* A ptr to the following structure type is passed as the third */
|
||||
/* argument to the ioctl system call when issuing a request to the */
|
||||
/* p80211 module. */
|
||||
/*--------------------------------------------------------------------*/
|
||||
typedef struct p80211ioctl_req
|
||||
{
|
||||
char name[16] __WLAN_ATTRIB_PACK__;
|
||||
void *data __WLAN_ATTRIB_PACK__;
|
||||
UINT16 result __WLAN_ATTRIB_PACK__;
|
||||
UINT16 len __WLAN_ATTRIB_PACK__;
|
||||
} p80211ioctl_req_t;
|
||||
|
||||
/*====================================================================*/
|
||||
/*----- External Declarations ----------------------------------------*/
|
||||
|
||||
/*====================================================================*/
|
||||
/*----- Function Prototypes ------------------------------------------*/
|
||||
|
||||
#endif /* _P80211IOCTL_H */
|
|
@ -0,0 +1,522 @@
|
|||
/* p80211mgmt.h: Macros, types, and functions to handle 802.11 mgmt frames
|
||||
* --------------------------------------------------------------------
|
||||
* Linux WLAN
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The initial developer of the original code is Mark S. Mathews
|
||||
* <mark@absoval.com>. Portions created by Mark S. Mathews
|
||||
* are Copyright (C) 1998 AbsoluteValue Software, Inc. All Rights Reserved.
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* This file declares the constants and types used in the interface
|
||||
* between a wlan driver and the user mode utilities.
|
||||
*
|
||||
* Note: Constant values are always in HOST byte order. To assign
|
||||
* values to multi-byte fields they _must_ be converted to
|
||||
* ieee byte order. To retrieve multi-byte values from incoming
|
||||
* frames, they must be converted to host order.
|
||||
*
|
||||
* Note: The len member of the frame structure does NOT!!! include
|
||||
* the MAC CRC. Therefore, the len field on rx'd frames should
|
||||
* have 4 subtracted from it.
|
||||
*
|
||||
* All functions declared here are implemented in p80211.c
|
||||
*
|
||||
* The types, macros, and functions defined here are primarily
|
||||
* used for encoding and decoding management frames. They are
|
||||
* designed to follow these patterns of use:
|
||||
*
|
||||
* DECODE:
|
||||
* 1) a frame of length len is received into buffer b
|
||||
* 2) using the hdr structure and macros, we determine the type
|
||||
* 3) an appropriate mgmt frame structure, mf, is allocated and zeroed
|
||||
* 4) mf.hdr = b
|
||||
* mf.buf = b
|
||||
* mf.len = len
|
||||
* 5) call mgmt_decode( mf )
|
||||
* 6) the frame field pointers in mf are now set. Note that any
|
||||
* multi-byte frame field values accessed using the frame field
|
||||
* pointers are in ieee byte order and will have to be converted
|
||||
* to host order.
|
||||
*
|
||||
* ENCODE:
|
||||
* 1) Library client allocates buffer space for maximum length
|
||||
* frame of the desired type
|
||||
* 2) Library client allocates a mgmt frame structure, called mf,
|
||||
* of the desired type
|
||||
* 3) Set the following:
|
||||
* mf.type = <desired type>
|
||||
* mf.buf = <allocated buffer address>
|
||||
* 4) call mgmt_encode( mf )
|
||||
* 5) all of the fixed field pointers and fixed length information element
|
||||
* pointers in mf are now set to their respective locations in the
|
||||
* allocated space (fortunately, all variable length information elements
|
||||
* fall at the end of their respective frames).
|
||||
* 5a) The length field is set to include the last of the fixed and fixed
|
||||
* length fields. It may have to be updated for optional or variable
|
||||
* length information elements.
|
||||
* 6) Optional and variable length information elements are special cases
|
||||
* and must be handled individually by the client code.
|
||||
* --------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef _P80211MGMT_H
|
||||
#define _P80211MGMT_H
|
||||
|
||||
#ifndef _WLAN_COMPAT_H
|
||||
#include <wlan_compat.h>
|
||||
#endif
|
||||
|
||||
#ifndef _P80211HDR_H
|
||||
#include <p80211hdr.h>
|
||||
#endif
|
||||
|
||||
|
||||
/*=============================================================*/
|
||||
/*--- Constants & Macros --------------------------------------*/
|
||||
/*=============================================================*/
|
||||
|
||||
/*== Information Element IDs ====================*/
|
||||
#define WLAN_EID_SSID 0
|
||||
#define WLAN_EID_SUPP_RATES 1
|
||||
#define WLAN_EID_FH_PARMS 2
|
||||
#define WLAN_EID_DS_PARMS 3
|
||||
#define WLAN_EID_CF_PARMS 4
|
||||
#define WLAN_EID_TIM 5
|
||||
#define WLAN_EID_IBSS_PARMS 6
|
||||
/*-- values 7-15 reserved --*/
|
||||
#define WLAN_EID_CHALLENGE 16
|
||||
/*-- values 17-31 reserved for challenge text extension --*/
|
||||
/*-- values 32-255 reserved --*/
|
||||
|
||||
/*== Reason Codes ===============================*/
|
||||
#define WLAN_MGMT_REASON_RSVD 0
|
||||
#define WLAN_MGMT_REASON_UNSPEC 1
|
||||
#define WLAN_MGMT_REASON_PRIOR_AUTH_INVALID 2
|
||||
#define WLAN_MGMT_REASON_DEAUTH_LEAVING 3
|
||||
#define WLAN_MGMT_REASON_DISASSOC_INACTIVE 4
|
||||
#define WLAN_MGMT_REASON_DISASSOC_AP_BUSY 5
|
||||
#define WLAN_MGMT_REASON_CLASS2_NONAUTH 6
|
||||
#define WLAN_MGMT_REASON_CLASS3_NONASSOC 7
|
||||
#define WLAN_MGMT_REASON_DISASSOC_STA_HASLEFT 8
|
||||
#define WLAN_MGMT_REASON_CANT_ASSOC_NONAUTH 9
|
||||
|
||||
/*== Status Codes ===============================*/
|
||||
#define WLAN_MGMT_STATUS_SUCCESS 0
|
||||
#define WLAN_MGMT_STATUS_UNSPEC_FAILURE 1
|
||||
#define WLAN_MGMT_STATUS_CAPS_UNSUPPORTED 10
|
||||
#define WLAN_MGMT_STATUS_REASSOC_NO_ASSOC 11
|
||||
#define WLAN_MGMT_STATUS_ASSOC_DENIED_UNSPEC 12
|
||||
#define WLAN_MGMT_STATUS_UNSUPPORTED_AUTHALG 13
|
||||
#define WLAN_MGMT_STATUS_RX_AUTH_NOSEQ 14
|
||||
#define WLAN_MGMT_STATUS_CHALLENGE_FAIL 15
|
||||
#define WLAN_MGMT_STATUS_AUTH_TIMEOUT 16
|
||||
#define WLAN_MGMT_STATUS_ASSOC_DENIED_BUSY 17
|
||||
#define WLAN_MGMT_STATUS_ASSOC_DENIED_RATES 18
|
||||
|
||||
/*== Capability Field ===========================*/
|
||||
#define WLAN_GET_MGMT_CAP_INFO_ESS(n) ((n) & BIT0)
|
||||
#define WLAN_GET_MGMT_CAP_INFO_IBSS(n) (((n) & BIT1) >> 1)
|
||||
#define WLAN_GET_MGMT_CAP_INFO_CFPOLLABLE(n) (((n) & BIT2) >> 2)
|
||||
#define WLAN_GET_MGMT_CAP_INFO_CFPOLLREQ(n) (((n) & BIT3) >> 3)
|
||||
#define WLAN_GET_MGMT_CAP_INFO_PRIVACY(n) (((n) & BIT4) >> 4)
|
||||
|
||||
#define WLAN_SET_MGMT_CAP_INFO_ESS(n) (n)
|
||||
#define WLAN_SET_MGMT_CAP_INFO_IBSS(n) ((n) << 1)
|
||||
#define WLAN_SET_MGMT_CAP_INFO_CFPOLLABLE(n) ((n) << 2)
|
||||
#define WLAN_SET_MGMT_CAP_INFO_CFPOLLREQ(n) ((n) << 3)
|
||||
#define WLAN_SET_MGMT_CAP_INFO_PRIVACY(n) ((n) << 4)
|
||||
|
||||
/*== Auth Algorithm Field ===========================*/
|
||||
#define WLAN_AUTH_ALG_OPENSYSTEM 0
|
||||
#define WLAN_AUTH_ALG_SHAREDKEY 1
|
||||
|
||||
/*== Management Frame Field Offsets =============*/
|
||||
/* Note: Not all fields are listed because of variable lengths, */
|
||||
/* see the code in p80211.c to see how we search for fields */
|
||||
/* Note: These offsets are from the start of the frame data */
|
||||
|
||||
#define WLAN_BEACON_OFF_TS 0
|
||||
#define WLAN_BEACON_OFF_BCN_INT 8
|
||||
#define WLAN_BEACON_OFF_CAPINFO 10
|
||||
#define WLAN_BEACON_OFF_SSID 12
|
||||
|
||||
#define WLAN_DISASSOC_OFF_REASON 0
|
||||
|
||||
#define WLAN_ASSOCREQ_OFF_CAP_INFO 0
|
||||
#define WLAN_ASSOCREQ_OFF_LISTEN_INT 2
|
||||
#define WLAN_ASSOCREQ_OFF_SSID 4
|
||||
|
||||
#define WLAN_ASSOCRESP_OFF_CAP_INFO 0
|
||||
#define WLAN_ASSOCRESP_OFF_STATUS 2
|
||||
#define WLAN_ASSOCRESP_OFF_AID 4
|
||||
#define WLAN_ASSOCRESP_OFF_SUPP_RATES 6
|
||||
|
||||
#define WLAN_REASSOCREQ_OFF_CAP_INFO 0
|
||||
#define WLAN_REASSOCREQ_OFF_LISTEN_INT 2
|
||||
#define WLAN_REASSOCREQ_OFF_CURR_AP 4
|
||||
#define WLAN_REASSOCREQ_OFF_SSID 10
|
||||
|
||||
#define WLAN_REASSOCRESP_OFF_CAP_INFO 0
|
||||
#define WLAN_REASSOCRESP_OFF_STATUS 2
|
||||
#define WLAN_REASSOCRESP_OFF_AID 4
|
||||
#define WLAN_REASSOCRESP_OFF_SUPP_RATES 6
|
||||
|
||||
#define WLAN_PROBEREQ_OFF_SSID 0
|
||||
|
||||
#define WLAN_PROBERESP_OFF_TS 0
|
||||
#define WLAN_PROBERESP_OFF_BCN_INT 8
|
||||
#define WLAN_PROBERESP_OFF_CAP_INFO 10
|
||||
#define WLAN_PROBERESP_OFF_SSID 12
|
||||
|
||||
#define WLAN_AUTHEN_OFF_AUTH_ALG 0
|
||||
#define WLAN_AUTHEN_OFF_AUTH_SEQ 2
|
||||
#define WLAN_AUTHEN_OFF_STATUS 4
|
||||
#define WLAN_AUTHEN_OFF_CHALLENGE 6
|
||||
|
||||
#define WLAN_DEAUTHEN_OFF_REASON 0
|
||||
|
||||
/*=============================================================*/
|
||||
/*--- Types and Structures ------------------------------------*/
|
||||
/*=============================================================*/
|
||||
|
||||
/*== Information Element Types ====================*/
|
||||
/* prototype structure, all IEs start with these members */
|
||||
__WLAN_PRAGMA_PACK1__
|
||||
typedef struct wlan_ie
|
||||
{
|
||||
UINT8 eid __WLAN_ATTRIB_PACK__;
|
||||
UINT8 len __WLAN_ATTRIB_PACK__;
|
||||
} wlan_ie_t;
|
||||
__WLAN_PRAGMA_PACKDFLT__
|
||||
|
||||
/*-- Service Set Identity (SSID) -----------------*/
|
||||
__WLAN_PRAGMA_PACK1__
|
||||
typedef struct wlan_ie_ssid
|
||||
{
|
||||
UINT8 eid __WLAN_ATTRIB_PACK__;
|
||||
UINT8 len __WLAN_ATTRIB_PACK__;
|
||||
UINT8 ssid[1] __WLAN_ATTRIB_PACK__; /* may be zero, ptrs may overlap */
|
||||
} wlan_ie_ssid_t;
|
||||
__WLAN_PRAGMA_PACKDFLT__
|
||||
|
||||
/*-- Supported Rates -----------------------------*/
|
||||
__WLAN_PRAGMA_PACK1__
|
||||
typedef struct wlan_ie_supp_rates
|
||||
{
|
||||
UINT8 eid __WLAN_ATTRIB_PACK__;
|
||||
UINT8 len __WLAN_ATTRIB_PACK__;
|
||||
UINT8 rates[1] __WLAN_ATTRIB_PACK__; /* had better be at LEAST one! */
|
||||
} wlan_ie_supp_rates_t;
|
||||
__WLAN_PRAGMA_PACKDFLT__
|
||||
|
||||
/*-- FH Parameter Set ----------------------------*/
|
||||
__WLAN_PRAGMA_PACK1__
|
||||
typedef struct wlan_ie_fh_parms
|
||||
{
|
||||
UINT8 eid __WLAN_ATTRIB_PACK__;
|
||||
UINT8 len __WLAN_ATTRIB_PACK__;
|
||||
UINT16 dwell __WLAN_ATTRIB_PACK__;
|
||||
UINT8 hopset __WLAN_ATTRIB_PACK__;
|
||||
UINT8 hoppattern __WLAN_ATTRIB_PACK__;
|
||||
UINT8 hopindex __WLAN_ATTRIB_PACK__;
|
||||
} wlan_ie_fh_parms_t;
|
||||
__WLAN_PRAGMA_PACKDFLT__
|
||||
|
||||
/*-- DS Parameter Set ----------------------------*/
|
||||
__WLAN_PRAGMA_PACK1__
|
||||
typedef struct wlan_ie_ds_parms
|
||||
{
|
||||
UINT8 eid __WLAN_ATTRIB_PACK__;
|
||||
UINT8 len __WLAN_ATTRIB_PACK__;
|
||||
UINT8 curr_ch __WLAN_ATTRIB_PACK__;
|
||||
} wlan_ie_ds_parms_t;
|
||||
__WLAN_PRAGMA_PACKDFLT__
|
||||
|
||||
/*-- CF Parameter Set ----------------------------*/
|
||||
__WLAN_PRAGMA_PACK1__
|
||||
typedef struct wlan_ie_cf_parms
|
||||
{
|
||||
UINT8 eid __WLAN_ATTRIB_PACK__;
|
||||
UINT8 len __WLAN_ATTRIB_PACK__;
|
||||
UINT8 cfp_cnt __WLAN_ATTRIB_PACK__;
|
||||
UINT8 cfp_period __WLAN_ATTRIB_PACK__;
|
||||
UINT16 cfp_maxdur __WLAN_ATTRIB_PACK__;
|
||||
UINT16 cfp_durremaining __WLAN_ATTRIB_PACK__;
|
||||
} wlan_ie_cf_parms_t;
|
||||
__WLAN_PRAGMA_PACKDFLT__
|
||||
|
||||
/*-- TIM ------------------------------------------*/
|
||||
__WLAN_PRAGMA_PACK1__
|
||||
typedef struct wlan_ie_tim
|
||||
{
|
||||
UINT8 eid __WLAN_ATTRIB_PACK__;
|
||||
UINT8 len __WLAN_ATTRIB_PACK__;
|
||||
UINT8 dtim_cnt __WLAN_ATTRIB_PACK__;
|
||||
UINT8 dtim_period __WLAN_ATTRIB_PACK__;
|
||||
UINT8 bitmap_ctl __WLAN_ATTRIB_PACK__;
|
||||
UINT8 virt_bm[1] __WLAN_ATTRIB_PACK__;
|
||||
} wlan_ie_tim_t;
|
||||
__WLAN_PRAGMA_PACKDFLT__
|
||||
|
||||
/*-- IBSS Parameter Set ---------------------------*/
|
||||
__WLAN_PRAGMA_PACK1__
|
||||
typedef struct wlan_ie_ibss_parms
|
||||
{
|
||||
UINT8 eid __WLAN_ATTRIB_PACK__;
|
||||
UINT8 len __WLAN_ATTRIB_PACK__;
|
||||
UINT16 atim_win __WLAN_ATTRIB_PACK__;
|
||||
} wlan_ie_ibss_parms_t;
|
||||
__WLAN_PRAGMA_PACKDFLT__
|
||||
|
||||
/*-- Challenge Text ------------------------------*/
|
||||
__WLAN_PRAGMA_PACK1__
|
||||
typedef struct wlan_ie_challenge
|
||||
{
|
||||
UINT8 eid __WLAN_ATTRIB_PACK__;
|
||||
UINT8 len __WLAN_ATTRIB_PACK__;
|
||||
UINT8 challenge[1] __WLAN_ATTRIB_PACK__;
|
||||
} wlan_ie_challenge_t;
|
||||
__WLAN_PRAGMA_PACKDFLT__
|
||||
|
||||
|
||||
/*=================================================*/
|
||||
/*== Frame Types ==================================*/
|
||||
/* prototype structure, all mgmt frame types will start with these members */
|
||||
typedef struct wlan_fr_mgmt
|
||||
{
|
||||
UINT16 type;
|
||||
UINT16 len; /* DOES NOT include CRC !!!!*/
|
||||
UINT8 *buf;
|
||||
p80211_hdr_t *hdr;
|
||||
void *priv; /* used for target specific data, skb in Linux */
|
||||
/*-- fixed fields -----------*/
|
||||
/*-- info elements ----------*/
|
||||
} wlan_fr_mgmt_t;
|
||||
|
||||
/*-- Beacon ---------------------------------------*/
|
||||
typedef struct wlan_fr_beacon
|
||||
{
|
||||
UINT16 type;
|
||||
UINT16 len;
|
||||
UINT8 *buf;
|
||||
p80211_hdr_t *hdr;
|
||||
void *priv; /* used for target specific data, skb in Linux */
|
||||
/*-- fixed fields -----------*/
|
||||
UINT64 *ts;
|
||||
UINT16 *bcn_int;
|
||||
UINT16 *cap_info;
|
||||
/*-- info elements ----------*/
|
||||
wlan_ie_ssid_t *ssid;
|
||||
wlan_ie_supp_rates_t *supp_rates;
|
||||
wlan_ie_fh_parms_t *fh_parms;
|
||||
wlan_ie_ds_parms_t *ds_parms;
|
||||
wlan_ie_cf_parms_t *cf_parms;
|
||||
wlan_ie_ibss_parms_t *ibss_parms;
|
||||
wlan_ie_tim_t *tim;
|
||||
|
||||
} wlan_fr_beacon_t;
|
||||
|
||||
|
||||
/*-- IBSS ATIM ------------------------------------*/
|
||||
typedef struct wlan_fr_ibssatim
|
||||
{
|
||||
UINT16 type;
|
||||
UINT16 len;
|
||||
UINT8* buf;
|
||||
p80211_hdr_t *hdr;
|
||||
void *priv; /* used for target specific data, skb in Linux */
|
||||
|
||||
/*-- fixed fields -----------*/
|
||||
/*-- info elements ----------*/
|
||||
|
||||
/* this frame type has a null body */
|
||||
|
||||
} wlan_fr_ibssatim_t;
|
||||
|
||||
/*-- Disassociation -------------------------------*/
|
||||
typedef struct wlan_fr_disassoc
|
||||
{
|
||||
UINT16 type;
|
||||
UINT16 len;
|
||||
UINT8 *buf;
|
||||
p80211_hdr_t *hdr;
|
||||
void *priv; /* used for target specific data, skb in Linux */
|
||||
/*-- fixed fields -----------*/
|
||||
UINT16 *reason;
|
||||
|
||||
/*-- info elements ----------*/
|
||||
|
||||
} wlan_fr_disassoc_t;
|
||||
|
||||
/*-- Association Request --------------------------*/
|
||||
typedef struct wlan_fr_assocreq
|
||||
{
|
||||
UINT16 type;
|
||||
UINT16 len;
|
||||
UINT8* buf;
|
||||
p80211_hdr_t *hdr;
|
||||
void *priv; /* used for target specific data, skb in Linux */
|
||||
/*-- fixed fields -----------*/
|
||||
UINT16 *cap_info;
|
||||
UINT16 *listen_int;
|
||||
/*-- info elements ----------*/
|
||||
wlan_ie_ssid_t *ssid;
|
||||
wlan_ie_supp_rates_t *supp_rates;
|
||||
|
||||
} wlan_fr_assocreq_t;
|
||||
|
||||
/*-- Association Response -------------------------*/
|
||||
typedef struct wlan_fr_assocresp
|
||||
{
|
||||
UINT16 type;
|
||||
UINT16 len;
|
||||
UINT8 *buf;
|
||||
p80211_hdr_t *hdr;
|
||||
void *priv; /* used for target specific data, skb in Linux */
|
||||
/*-- fixed fields -----------*/
|
||||
UINT16 *cap_info;
|
||||
UINT16 *status;
|
||||
UINT16 *aid;
|
||||
/*-- info elements ----------*/
|
||||
wlan_ie_supp_rates_t *supp_rates;
|
||||
|
||||
} wlan_fr_assocresp_t;
|
||||
|
||||
/*-- Reassociation Request ------------------------*/
|
||||
typedef struct wlan_fr_reassocreq
|
||||
{
|
||||
UINT16 type;
|
||||
UINT16 len;
|
||||
UINT8 *buf;
|
||||
p80211_hdr_t *hdr;
|
||||
void *priv; /* used for target specific data, skb in Linux */
|
||||
/*-- fixed fields -----------*/
|
||||
UINT16 *cap_info;
|
||||
UINT16 *listen_int;
|
||||
UINT8 *curr_ap;
|
||||
/*-- info elements ----------*/
|
||||
wlan_ie_ssid_t *ssid;
|
||||
wlan_ie_supp_rates_t *supp_rates;
|
||||
|
||||
} wlan_fr_reassocreq_t;
|
||||
|
||||
/*-- Reassociation Response -----------------------*/
|
||||
typedef struct wlan_fr_reassocresp
|
||||
{
|
||||
UINT16 type;
|
||||
UINT16 len;
|
||||
UINT8 *buf;
|
||||
p80211_hdr_t *hdr;
|
||||
void *priv; /* used for target specific data, skb in Linux */
|
||||
/*-- fixed fields -----------*/
|
||||
UINT16 *cap_info;
|
||||
UINT16 *status;
|
||||
UINT16 *aid;
|
||||
/*-- info elements ----------*/
|
||||
wlan_ie_supp_rates_t *supp_rates;
|
||||
|
||||
} wlan_fr_reassocresp_t;
|
||||
|
||||
/*-- Probe Request --------------------------------*/
|
||||
typedef struct wlan_fr_probereq
|
||||
{
|
||||
UINT16 type;
|
||||
UINT16 len;
|
||||
UINT8 *buf;
|
||||
p80211_hdr_t *hdr;
|
||||
void *priv; /* used for target specific data, skb in Linux */
|
||||
/*-- fixed fields -----------*/
|
||||
/*-- info elements ----------*/
|
||||
wlan_ie_ssid_t *ssid;
|
||||
wlan_ie_supp_rates_t *supp_rates;
|
||||
|
||||
} wlan_fr_probereq_t;
|
||||
|
||||
/*-- Probe Response -------------------------------*/
|
||||
typedef struct wlan_fr_proberesp
|
||||
{
|
||||
UINT16 type;
|
||||
UINT16 len;
|
||||
UINT8 *buf;
|
||||
p80211_hdr_t *hdr;
|
||||
void *priv; /* used for target specific data, skb in Linux */
|
||||
/*-- fixed fields -----------*/
|
||||
UINT64 *ts;
|
||||
UINT16 *bcn_int;
|
||||
UINT16 *cap_info;
|
||||
/*-- info elements ----------*/
|
||||
wlan_ie_ssid_t *ssid;
|
||||
wlan_ie_supp_rates_t *supp_rates;
|
||||
wlan_ie_fh_parms_t *fh_parms;
|
||||
wlan_ie_ds_parms_t *ds_parms;
|
||||
wlan_ie_cf_parms_t *cf_parms;
|
||||
wlan_ie_ibss_parms_t *ibss_parms;
|
||||
} wlan_fr_proberesp_t;
|
||||
|
||||
/*-- Authentication -------------------------------*/
|
||||
typedef struct wlan_fr_authen
|
||||
{
|
||||
UINT16 type;
|
||||
UINT16 len;
|
||||
UINT8 *buf;
|
||||
p80211_hdr_t *hdr;
|
||||
void *priv; /* used for target specific data, skb in Linux */
|
||||
/*-- fixed fields -----------*/
|
||||
UINT16 *auth_alg;
|
||||
UINT16 *auth_seq;
|
||||
UINT16 *status;
|
||||
/*-- info elements ----------*/
|
||||
wlan_ie_challenge_t *challenge;
|
||||
|
||||
} wlan_fr_authen_t;
|
||||
|
||||
/*-- Deauthenication -----------------------------*/
|
||||
typedef struct wlan_fr_deauthen
|
||||
{
|
||||
UINT16 type;
|
||||
UINT16 len;
|
||||
UINT8 *buf;
|
||||
p80211_hdr_t *hdr;
|
||||
void *priv; /* used for target specific data, skb in Linux */
|
||||
/*-- fixed fields -----------*/
|
||||
UINT16 *reason;
|
||||
|
||||
/*-- info elements ----------*/
|
||||
|
||||
} wlan_fr_deauthen_t;
|
||||
|
||||
|
||||
void wlan_mgmt_encode_beacon( wlan_fr_beacon_t *f );
|
||||
void wlan_mgmt_decode_beacon( wlan_fr_beacon_t *f );
|
||||
void wlan_mgmt_encode_disassoc( wlan_fr_disassoc_t *f );
|
||||
void wlan_mgmt_decode_disassoc( wlan_fr_disassoc_t *f );
|
||||
void wlan_mgmt_encode_assocreq( wlan_fr_assocreq_t *f );
|
||||
void wlan_mgmt_decode_assocreq( wlan_fr_assocreq_t *f );
|
||||
void wlan_mgmt_encode_assocresp( wlan_fr_assocresp_t *f );
|
||||
void wlan_mgmt_decode_assocresp( wlan_fr_assocresp_t *f );
|
||||
void wlan_mgmt_encode_reassocreq( wlan_fr_reassocreq_t *f );
|
||||
void wlan_mgmt_decode_reassocreq( wlan_fr_reassocreq_t *f );
|
||||
void wlan_mgmt_encode_reassocresp( wlan_fr_reassocresp_t *f );
|
||||
void wlan_mgmt_decode_reassocresp( wlan_fr_reassocresp_t *f );
|
||||
void wlan_mgmt_encode_probereq( wlan_fr_probereq_t *f );
|
||||
void wlan_mgmt_decode_probereq( wlan_fr_probereq_t *f );
|
||||
void wlan_mgmt_encode_proberesp( wlan_fr_proberesp_t *f );
|
||||
void wlan_mgmt_decode_proberesp( wlan_fr_proberesp_t *f );
|
||||
void wlan_mgmt_encode_authen( wlan_fr_authen_t *f );
|
||||
void wlan_mgmt_decode_authen( wlan_fr_authen_t *f );
|
||||
void wlan_mgmt_encode_deauthen( wlan_fr_deauthen_t *f );
|
||||
void wlan_mgmt_decode_deauthen( wlan_fr_deauthen_t *f );
|
||||
|
||||
|
||||
#endif /* _P80211MGMT_H */
|
|
@ -0,0 +1,321 @@
|
|||
/* p80211msg.h: Macros, constants, types, and funcs for req and ind messages
|
||||
* --------------------------------------------------------------------
|
||||
* Linux WLAN
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The initial developer of the original code is Mark S. Mathews
|
||||
* <mark@absoval.com>. Portions created by Mark S. Mathews
|
||||
* are Copyright (C) 1998 AbsoluteValue Software, Inc. All Rights Reserved.
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* Note: Constant values are always in HOST byte order.
|
||||
*
|
||||
* All functions and statics declared here are implemented in p80211msg.c
|
||||
* --------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef _P80211MSG_H
|
||||
#define _P80211MSG_H
|
||||
|
||||
#ifndef _WLAN_COMPAT_H
|
||||
#include <wlan/wlan_compat.h>
|
||||
#endif
|
||||
|
||||
/*====================================================================*/
|
||||
/*----- Macros -------------------------------------------------------*/
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* The following macros are used to manipulate the 'offset' field in */
|
||||
/* the metadata. These are only used when the metadata is for */
|
||||
/* command arguments to determine if the data item is required, and */
|
||||
/* whether the metadata item is for a request command, confirm */
|
||||
/* command or both. Additionally, there's a macro to get the actual */
|
||||
/* offset value of the field. */
|
||||
/*--------------------------------------------------------------------*/
|
||||
|
||||
#define ISREQUIRED (0x80000000UL)
|
||||
#define ISREQUEST (0x40000000UL)
|
||||
#define ISCONFIRM (0x20000000UL)
|
||||
|
||||
#define P80211ITEM_ISREQUIRED(offset) (((UINT32)(offset & ISREQUIRED)) \
|
||||
>> 31 )
|
||||
#define P80211ITEM_ISREQUEST(offset) (((UINT32)(offset & ISREQUEST)) \
|
||||
>> 30 )
|
||||
#define P80211ITEM_ISCONFIRM(offset) (((UINT32)(offset & ISCONFIRM)) \
|
||||
>> 29 )
|
||||
|
||||
#define P80211ITEM_GET_OFFSET(offset) ( ((UINT32)(offset)) & \
|
||||
(~(ISREQUIRED | ISREQUEST | \
|
||||
ISCONFIRM)) )
|
||||
|
||||
#define P80211ITEM_MKOFFSET(d, r, c, offset) ( (d|r|c) | ((UINT32)(offset)) )
|
||||
|
||||
/*====================================================================*/
|
||||
/*----- Constants ----------------------------------------------------*/
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* Request messages */
|
||||
/*--------------------------------------------------------------------*/
|
||||
#define P80211MSG_REQ_MIB_GET 1 /* 802.11 */
|
||||
#define P80211MSG_REQ_MIB_SET 2 /* 802.11 */
|
||||
#define P80211MSG_REQ_POWERMGMT 3 /* 802.11 */
|
||||
#define P80211MSG_REQ_SCAN 4 /* 802.11 */
|
||||
#define P80211MSG_REQ_JOIN 5 /* 802.11 */
|
||||
#define P80211MSG_REQ_AUTHENTICATE 6 /* 802.11 */
|
||||
#define P80211MSG_REQ_DEAUTHENTICATE 7 /* 802.11 */
|
||||
#define P80211MSG_REQ_ASSOCIATE 8 /* 802.11 */
|
||||
#define P80211MSG_REQ_REASSOCIATE 9 /* 802.11 */
|
||||
#define P80211MSG_REQ_DISASSOCIATE 10 /* 802.11 */
|
||||
#define P80211MSG_REQ_RESET 11 /* 802.11 */
|
||||
#define P80211MSG_REQ_START 12 /* 802.11 */
|
||||
/* 13-20 reserved */
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* Indication messages */
|
||||
/*--------------------------------------------------------------------*/
|
||||
#define P80211MSG_IND_AUTHENTICATE 21 /* 802.11 */
|
||||
#define P80211MSG_IND_DEAUTHENTICATE 22 /* 802.11 */
|
||||
#define P80211MSG_IND_ASSOCIATE 23 /* 802.11 */
|
||||
#define P80211MSG_IND_REASSOCIATE 24 /* 802.11 */
|
||||
#define P80211MSG_IND_DISASSOCIATE 25 /* 802.11 */
|
||||
/* 26-40 reserved */
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* Confirm messages */
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* For now, these are embedded in the REQ messages. Just in case, 41-60 reserved */
|
||||
|
||||
|
||||
/*====================================================================*/
|
||||
/*----- Types --------------------------------------------------------*/
|
||||
|
||||
/*====================================================================*/
|
||||
/*----- Message Structure Types --------------------------------------*/
|
||||
|
||||
/* The following structures are definitions for request/confirm */
|
||||
/* messages followed by all the indication definitions. */
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* Request/Confirm structures */
|
||||
/*--------------------------------------------------------------------*/
|
||||
typedef struct p80211msg_req_mib_get
|
||||
{
|
||||
UINT32 msgcode;
|
||||
p80211item_uint32_t mibid;
|
||||
p80211item_uint32_t resultcode;
|
||||
p80211item_coll_t mibvalue;
|
||||
p80211item_uint32_t uint32val;
|
||||
p80211item_pstr255_t pstrval;
|
||||
} p80211msg_req_mib_get_t;
|
||||
|
||||
|
||||
typedef struct p80211msg_req_mib_set
|
||||
{
|
||||
UINT32 msgcode;
|
||||
p80211item_uint32_t mibid;
|
||||
p80211item_uint32_t resultcode;
|
||||
p80211item_coll_t mibvalue;
|
||||
p80211item_uint32_t uint32val;
|
||||
p80211item_pstr255_t pstrval;
|
||||
} p80211msg_req_mib_set_t;
|
||||
|
||||
|
||||
typedef struct p80211msg_req_powermgmt
|
||||
{
|
||||
UINT32 msgcode;
|
||||
p80211item_uint32_t mode;
|
||||
p80211item_uint32_t wakeup;
|
||||
p80211item_uint32_t rxdtims;
|
||||
p80211item_uint32_t resultcode;
|
||||
} p80211msg_req_powermgmt_t;
|
||||
|
||||
#define MAX_BSSDESC 10
|
||||
|
||||
typedef struct p80211msg_req_scan
|
||||
{
|
||||
UINT32 msgcode;
|
||||
p80211item_uint32_t bsstype;
|
||||
p80211item_pstr6_t bssid;
|
||||
p80211item_pstr32_t ssid;
|
||||
p80211item_uint32_t scantype;
|
||||
p80211item_uint32_t probedelay;
|
||||
p80211item_pstr14_t channellist;
|
||||
p80211item_uint32_t minchanneltime;
|
||||
p80211item_uint32_t maxchanneltime;
|
||||
p80211item_uint32_t resultcode;
|
||||
p80211item_bssdesc_t bssdesc[MAX_BSSDESC];
|
||||
} p80211msg_req_scan_t;
|
||||
|
||||
typedef struct p80211msg_req_join
|
||||
{
|
||||
UINT32 msgcode;
|
||||
p80211item_pstr6_t bssid;
|
||||
p80211item_uint32_t joinfailtimeout;
|
||||
p80211item_uint32_t basicrate1;
|
||||
p80211item_uint32_t basicrate2;
|
||||
p80211item_uint32_t basicrate3;
|
||||
p80211item_uint32_t basicrate4;
|
||||
p80211item_uint32_t basicrate5;
|
||||
p80211item_uint32_t basicrate6;
|
||||
p80211item_uint32_t basicrate7;
|
||||
p80211item_uint32_t basicrate8;
|
||||
p80211item_uint32_t operationalrate1;
|
||||
p80211item_uint32_t operationalrate2;
|
||||
p80211item_uint32_t operationalrate3;
|
||||
p80211item_uint32_t operationalrate4;
|
||||
p80211item_uint32_t operationalrate5;
|
||||
p80211item_uint32_t operationalrate6;
|
||||
p80211item_uint32_t operationalrate7;
|
||||
p80211item_uint32_t operationalrate8;
|
||||
p80211item_uint32_t resultcode;
|
||||
} p80211msg_req_join_t;
|
||||
|
||||
typedef struct p80211msg_req_authenticate
|
||||
{
|
||||
UINT32 msgcode;
|
||||
p80211item_pstr6_t peerstaaddr;
|
||||
p80211item_uint32_t authtype;
|
||||
p80211item_uint32_t authfailtimeout;
|
||||
p80211item_uint32_t resultcode;
|
||||
} p80211msg_req_authenticate_t;
|
||||
|
||||
typedef struct p80211msg_req_deauthenticate
|
||||
{
|
||||
UINT32 msgcode;
|
||||
p80211item_pstr6_t peerstaaddr;
|
||||
p80211item_uint32_t reasoncode;
|
||||
p80211item_uint32_t resultcode;
|
||||
} p80211msg_req_deauthenticate_t;
|
||||
|
||||
typedef struct p80211msg_req_associate
|
||||
{
|
||||
UINT32 msgcode;
|
||||
p80211item_pstr6_t peerstaaddr;
|
||||
p80211item_uint32_t assocfailtimeout;
|
||||
p80211item_uint32_t cfpollable;
|
||||
p80211item_uint32_t cfpollreq;
|
||||
p80211item_uint32_t privacy;
|
||||
p80211item_uint32_t listeninterval;
|
||||
p80211item_uint32_t resultcode;
|
||||
} p80211msg_req_associate_t;
|
||||
|
||||
typedef struct p80211msg_req_reassociate
|
||||
{
|
||||
UINT32 msgcode;
|
||||
p80211item_pstr6_t newapaddr;
|
||||
p80211item_uint32_t reassocfailtimeout;
|
||||
p80211item_uint32_t cfpollable;
|
||||
p80211item_uint32_t cfpollreq;
|
||||
p80211item_uint32_t privacy;
|
||||
p80211item_uint32_t listeninterval;
|
||||
p80211item_uint32_t resultcode;
|
||||
} p80211msg_req_reassociate_t;
|
||||
|
||||
typedef struct p80211msg_req_disassociate
|
||||
{
|
||||
UINT32 msgcode;
|
||||
p80211item_pstr6_t peerstaaddr;
|
||||
p80211item_uint32_t reasoncode;
|
||||
p80211item_uint32_t resultcode;
|
||||
} p80211msg_req_disassociate_t;
|
||||
|
||||
typedef struct p80211msg_req_reset
|
||||
{
|
||||
UINT32 msgcode;
|
||||
p80211item_pstr6_t peerstaaddr;
|
||||
p80211item_uint32_t setdefaultmib;
|
||||
p80211item_uint32_t resultcode;
|
||||
} p80211msg_req_reset_t;
|
||||
|
||||
typedef struct p80211msg_req_start
|
||||
{
|
||||
UINT32 msgcode;
|
||||
p80211item_pstr32_t ssid;
|
||||
p80211item_uint32_t bsstype;
|
||||
p80211item_uint32_t beaconperiod;
|
||||
p80211item_uint32_t dtimperiod;
|
||||
p80211item_uint32_t cfpperiod;
|
||||
p80211item_uint32_t cfpmaxdur;
|
||||
p80211item_uint32_t fhdwelltime;
|
||||
p80211item_uint32_t fhhopset;
|
||||
p80211item_uint32_t fhhoppattern;
|
||||
p80211item_uint32_t dschannel;
|
||||
p80211item_uint32_t ibssatimwin;
|
||||
p80211item_uint32_t probedelay;
|
||||
p80211item_uint32_t cfpollable;
|
||||
p80211item_uint32_t cfpollreq;
|
||||
p80211item_uint32_t basicrate1;
|
||||
p80211item_uint32_t basicrate2;
|
||||
p80211item_uint32_t basicrate3;
|
||||
p80211item_uint32_t basicrate4;
|
||||
p80211item_uint32_t basicrate5;
|
||||
p80211item_uint32_t basicrate6;
|
||||
p80211item_uint32_t basicrate7;
|
||||
p80211item_uint32_t basicrate8;
|
||||
p80211item_uint32_t operationalrate1;
|
||||
p80211item_uint32_t operationalrate2;
|
||||
p80211item_uint32_t operationalrate3;
|
||||
p80211item_uint32_t operationalrate4;
|
||||
p80211item_uint32_t operationalrate5;
|
||||
p80211item_uint32_t operationalrate6;
|
||||
p80211item_uint32_t operationalrate7;
|
||||
p80211item_uint32_t operationalrate8;
|
||||
p80211item_uint32_t resultcode;
|
||||
} p80211msg_req_start_t;
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* Indication structures */
|
||||
/*--------------------------------------------------------------------*/
|
||||
|
||||
typedef struct p80211msg_ind_authenticate
|
||||
{
|
||||
UINT32 msgcode;
|
||||
p80211item_pstr6_t peerstaaddr;
|
||||
p80211item_uint32_t authtype;
|
||||
} p80211msg_ind_authenticate_t;
|
||||
|
||||
typedef struct p80211msg_ind_deauthenticate
|
||||
{
|
||||
UINT32 msgcode;
|
||||
p80211item_pstr6_t peerstaaddr;
|
||||
p80211item_uint32_t reasoncode;
|
||||
} p80211msg_ind_deauthenticate_t;
|
||||
|
||||
typedef struct p80211msg_ind_associate
|
||||
{
|
||||
UINT32 msgcode;
|
||||
p80211item_pstr6_t peerstaaddr;
|
||||
} p80211msg_ind_associate_t;
|
||||
|
||||
typedef struct p80211msg_ind_reassociate
|
||||
{
|
||||
UINT32 msgcode;
|
||||
p80211item_pstr6_t peerstaaddr;
|
||||
} p80211msg_ind_reassociate_t;
|
||||
|
||||
typedef struct p80211msg_ind_disassociate
|
||||
{
|
||||
UINT32 msgcode;
|
||||
p80211item_pstr6_t peerstaaddr;
|
||||
p80211item_uint32_t reasoncode;
|
||||
} p80211msg_ind_disassociate_t;
|
||||
|
||||
/*====================================================================*/
|
||||
/*----- External Declarations ----------------------------------------*/
|
||||
|
||||
|
||||
/*====================================================================*/
|
||||
/*----- Function Prototypes ------------------------------------------*/
|
||||
|
||||
|
||||
#endif /* _P80211MSG_H */
|
||||
|
|
@ -0,0 +1,613 @@
|
|||
/* p80211types.h: Macros, constants, types, and funcs for p80211 data types
|
||||
* --------------------------------------------------------------------
|
||||
* Linux WLAN
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The initial developer of the original code is Mark S. Mathews
|
||||
* <mark@absoval.com>. Portions created by Mark S. Mathews
|
||||
* are Copyright (C) 1998 AbsoluteValue Software, Inc. All Rights Reserved.
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* This file declares some of the constants and types used in various
|
||||
* parts of the linux-wlan system.
|
||||
*
|
||||
* Note: Constant values are always in HOST byte order.
|
||||
*
|
||||
* All functions and statics declared here are implemented in p80211types.c
|
||||
* --------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef _P80211TYPES_H
|
||||
#define _P80211TYPES_H
|
||||
|
||||
#ifndef _WLAN_COMPAT_H
|
||||
#include <wlan/wlan_compat.h>
|
||||
#endif
|
||||
|
||||
/*====================================================================*/
|
||||
/*----- Constants ----------------------------------------------------*/
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* p80211 data type codes, used for MIB items and message arguments. */
|
||||
/* the various metadata structures provide additional information */
|
||||
/* about these types. */
|
||||
/*--------------------------------------------------------------------*/
|
||||
|
||||
#define P80211_TYPE_OCTETSTR 1 /* pascal array of bytes */
|
||||
#define P80211_TYPE_DISPLAYSTR 2 /* pascal array of bytes containing ascii */
|
||||
#define P80211_TYPE_BOUNDEDINT 3 /* UINT32 w/ min and max values */
|
||||
#define P80211_TYPE_INT 4 /* UINT32 min and max limited by 32 bits */
|
||||
#define P80211_TYPE_ENUMINT 5 /* UINT32 holding a numeric code that can be mapped to a textual name */
|
||||
#define P80211_TYPE_COLLECTION 6 /* Data item containing other data items */
|
||||
#define P80211_TYPE_MIBITEM 7 /* Data item containing a MIB value, requires the MIB DID for conversion and validation */
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* p80211 DID field codes for represent access type and is_table */
|
||||
/* status. */
|
||||
/*--------------------------------------------------------------------*/
|
||||
#define P80211DID_ACCESS_READONLY 0
|
||||
#define P80211DID_ACCESS_READWRITE 1
|
||||
#define P80211DID_ISTABLE_FALSE 0
|
||||
#define P80211DID_ISTABLE_TRUE 1
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* p80211 enumeration constants. The value to text mappings for */
|
||||
/* these is in p80211types.c. These defines were generated from the */
|
||||
/* mappings. */
|
||||
/*--------------------------------------------------------------------*/
|
||||
#define P80211ENUM_truth_false 0
|
||||
#define P80211ENUM_truth_true 1
|
||||
#define P80211ENUM_powermgmt_active 1
|
||||
#define P80211ENUM_powermgmt_powersave 2
|
||||
#define P80211ENUM_bsstype_infrastructure 1
|
||||
#define P80211ENUM_bsstype_independent 2
|
||||
#define P80211ENUM_bsstype_any 3
|
||||
#define P80211ENUM_authalg_opensystem 1
|
||||
#define P80211ENUM_authalg_sharedkey 2
|
||||
#define P80211ENUM_phytype_fhss 1
|
||||
#define P80211ENUM_phytype_dsss 2
|
||||
#define P80211ENUM_phytype_irbaseband 3
|
||||
#define P80211ENUM_temptype_commercial 1
|
||||
#define P80211ENUM_temptype_industrial 2
|
||||
#define P80211ENUM_regdomain_fcc 16
|
||||
#define P80211ENUM_regdomain_doc 32
|
||||
#define P80211ENUM_regdomain_etsi 48
|
||||
#define P80211ENUM_regdomain_spain 49
|
||||
#define P80211ENUM_regdomain_france 50
|
||||
#define P80211ENUM_regdomain_mkk 64
|
||||
#define P80211ENUM_ccamode_edonly 1
|
||||
#define P80211ENUM_ccamode_csonly 2
|
||||
#define P80211ENUM_ccamode_edandcs 4
|
||||
#define P80211ENUM_diversity_fixedlist 1
|
||||
#define P80211ENUM_diversity_notsupported 2
|
||||
#define P80211ENUM_diversity_dynamic 3
|
||||
#define P80211ENUM_scantype_active 1
|
||||
#define P80211ENUM_scantype_passive 2
|
||||
#define P80211ENUM_resultcode_success 1
|
||||
#define P80211ENUM_resultcode_invalid_parameters 2
|
||||
#define P80211ENUM_resultcode_not_supported 3
|
||||
#define P80211ENUM_resultcode_timeout 4
|
||||
#define P80211ENUM_resultcode_too_many_req 5
|
||||
#define P80211ENUM_resultcode_refused 6
|
||||
#define P80211ENUM_resultcode_bss_already 7
|
||||
#define P80211ENUM_resultcode_invalid_access 8
|
||||
#define P80211ENUM_reason_unspec_reason 1
|
||||
#define P80211ENUM_reason_auth_not_valid 2
|
||||
#define P80211ENUM_reason_deauth_lv_ss 3
|
||||
#define P80211ENUM_reason_inactivity 4
|
||||
#define P80211ENUM_reason_ap_overload 5
|
||||
#define P80211ENUM_reason_class23_err 6
|
||||
#define P80211ENUM_reason_class3_err 7
|
||||
#define P80211ENUM_reason_disas_lv_ss 8
|
||||
#define P80211ENUM_reason_asoc_not_auth 9
|
||||
#define P80211ENUM_status_successful 0
|
||||
#define P80211ENUM_status_unspec_failure 1
|
||||
#define P80211ENUM_status_unsup_cap 10
|
||||
#define P80211ENUM_status_reasoc_no_asoc 11
|
||||
#define P80211ENUM_status_fail_other 12
|
||||
#define P80211ENUM_status_unspt_alg 13
|
||||
#define P80211ENUM_status_auth_seq_fail 14
|
||||
#define P80211ENUM_status_chlng_fail 15
|
||||
#define P80211ENUM_status_auth_timeout 16
|
||||
#define P80211ENUM_status_ap_full 17
|
||||
#define P80211ENUM_status_unsup_rate 18
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* p80211 maximum length constants for the different pascal strings. */
|
||||
/*--------------------------------------------------------------------*/
|
||||
|
||||
#define MAXLEN_PSTR6 (6) /* pascal array of 6 bytes */
|
||||
#define MAXLEN_PSTR14 (14) /* pascal array of 14 bytes */
|
||||
#define MAXLEN_PSTR32 (32) /* pascal array of 32 bytes */
|
||||
#define MAXLEN_PSTR255 (255) /* pascal array of 255 bytes */
|
||||
|
||||
/*====================================================================*/
|
||||
/*----- Macros -------------------------------------------------------*/
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* The following macros are used to ensure consistent naming */
|
||||
/* conventions for all the different metadata lists. */
|
||||
/*--------------------------------------------------------------------*/
|
||||
|
||||
#define MKREQMETANAME(name) p80211meta_ ## req ## _ ## name
|
||||
#define MKCOLLMETANAME(name) p80211meta_ ## coll ## _ ## name
|
||||
#define MKINDMETANAME(name) p80211meta_ ## ind ## _ ## name
|
||||
#define MKMIBMETANAME(name) p80211meta_ ## mib ## _ ## name
|
||||
#define MKGRPMETANAME(name) p80211meta_ ## grp ## _ ## name
|
||||
|
||||
#define MKREQMETASIZE(name) p80211meta_ ## req ## _ ## name ## _ ## size
|
||||
#define MKCOLLMETASIZE(name) p80211meta_ ## coll ## _ ## name ## _ ## size
|
||||
#define MKINDMETASIZE(name) p80211meta_ ## ind ## _ ## name ## _ ## size
|
||||
#define MKMIBMETASIZE(name) p80211meta_ ## mib ## _ ## name ## _ ## size
|
||||
#define MKGRPMETASIZE(name) p80211meta_ ## grp ## _ ## name ## _ ## size
|
||||
|
||||
#define GETMETASIZE(aptr) (**((UINT32**)(aptr)))
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* The following ifdef depends on the following defines */
|
||||
/* P80211_NOINCLUDESTRINGS - ifdef, all metadata name fields */
|
||||
/* are empty strings */
|
||||
/*--------------------------------------------------------------------*/
|
||||
|
||||
#ifdef P80211_NOINCLUDESTRINGS
|
||||
#define MKITEMNAME(s) ("")
|
||||
#else
|
||||
#define MKITEMNAME(s) (s)
|
||||
#endif
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* The following macro creates a name for an enum */
|
||||
/*--------------------------------------------------------------------*/
|
||||
#define MKENUMNAME(name) p80211enum_ ## name
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* The following macros are used to construct and deconstruct the */
|
||||
/* Data ID codes. */
|
||||
/*--------------------------------------------------------------------*/
|
||||
|
||||
#define P80211DID_LSB_SECTION (0)
|
||||
#define P80211DID_LSB_GROUP (6)
|
||||
#define P80211DID_LSB_ITEM (12)
|
||||
#define P80211DID_LSB_INDEX (18)
|
||||
#define P80211DID_LSB_ISTABLE (26)
|
||||
#define P80211DID_LSB_ACCESS (27)
|
||||
#define P80211DID_LSB_TYPE (28)
|
||||
|
||||
#define P80211DID_MASK_SECTION (0x0000003fUL)
|
||||
#define P80211DID_MASK_GROUP (0x0000003fUL)
|
||||
#define P80211DID_MASK_ITEM (0x0000003fUL)
|
||||
#define P80211DID_MASK_INDEX (0x000000ffUL)
|
||||
#define P80211DID_MASK_ISTABLE (0x00000001UL)
|
||||
#define P80211DID_MASK_ACCESS (0x00000001UL)
|
||||
#define P80211DID_MASK_TYPE (0x00000007UL)
|
||||
|
||||
|
||||
#define P80211DID_MK(a,m,l) ((((UINT32)(a)) & (m)) << (l))
|
||||
|
||||
#define P80211DID_MKSECTION(a) P80211DID_MK(a, \
|
||||
P80211DID_MASK_SECTION, \
|
||||
P80211DID_LSB_SECTION )
|
||||
#define P80211DID_MKGROUP(a) P80211DID_MK(a, \
|
||||
P80211DID_MASK_GROUP, \
|
||||
P80211DID_LSB_GROUP )
|
||||
#define P80211DID_MKITEM(a) P80211DID_MK(a, \
|
||||
P80211DID_MASK_ITEM, \
|
||||
P80211DID_LSB_ITEM )
|
||||
#define P80211DID_MKINDEX(a) P80211DID_MK(a, \
|
||||
P80211DID_MASK_INDEX, \
|
||||
P80211DID_LSB_INDEX )
|
||||
#define P80211DID_MKISTABLE(a) P80211DID_MK(a, \
|
||||
P80211DID_MASK_ISTABLE, \
|
||||
P80211DID_LSB_ISTABLE )
|
||||
#define P80211DID_MKACCESS(a) P80211DID_MK(a, \
|
||||
P80211DID_MASK_ACCESS, \
|
||||
P80211DID_LSB_ACCESS )
|
||||
#define P80211DID_MKTYPE(a) P80211DID_MK(a, \
|
||||
P80211DID_MASK_TYPE, \
|
||||
P80211DID_LSB_TYPE )
|
||||
|
||||
|
||||
#define P80211DID_MKID(s,g,i,n,t,a,d) (P80211DID_MKSECTION(s) | \
|
||||
P80211DID_MKGROUP(g) | \
|
||||
P80211DID_MKITEM(i) | \
|
||||
P80211DID_MKINDEX(n) | \
|
||||
P80211DID_MKISTABLE(t) | \
|
||||
P80211DID_MKACCESS(a) | \
|
||||
P80211DID_MKTYPE(d) )
|
||||
|
||||
|
||||
#define P80211DID_GET(a,m,l) ((((UINT32)(a)) >> (l)) & (m))
|
||||
|
||||
#define P80211DID_SECTION(a) P80211DID_GET(a, \
|
||||
P80211DID_MASK_SECTION, \
|
||||
P80211DID_LSB_SECTION)
|
||||
#define P80211DID_GROUP(a) P80211DID_GET(a, \
|
||||
P80211DID_MASK_GROUP, \
|
||||
P80211DID_LSB_GROUP)
|
||||
#define P80211DID_ITEM(a) P80211DID_GET(a, \
|
||||
P80211DID_MASK_ITEM, \
|
||||
P80211DID_LSB_ITEM)
|
||||
#define P80211DID_INDEX(a) P80211DID_GET(a, \
|
||||
P80211DID_MASK_INDEX, \
|
||||
P80211DID_LSB_INDEX)
|
||||
#define P80211DID_ISTABLE(a) P80211DID_GET(a, \
|
||||
P80211DID_MASK_ISTABLE, \
|
||||
P80211DID_LSB_ISTABLE)
|
||||
#define P80211DID_ACCESS(a) P80211DID_GET(a, \
|
||||
P80211DID_MASK_ACCESS, \
|
||||
P80211DID_LSB_ACCESS)
|
||||
#define P80211DID_TYPE(a) P80211DID_GET(a, \
|
||||
P80211DID_MASK_TYPE, \
|
||||
P80211DID_LSB_TYPE)
|
||||
|
||||
/*====================================================================*/
|
||||
/*----- Types --------------------------------------------------------*/
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* The following structure types are used for the represenation of */
|
||||
/* ENUMINT type metadata. */
|
||||
/*--------------------------------------------------------------------*/
|
||||
typedef struct p80211enumpair
|
||||
{
|
||||
UINT32 val;
|
||||
char *name;
|
||||
} p80211enumpair_t;
|
||||
|
||||
typedef struct p80211enum
|
||||
{
|
||||
INT nitems;
|
||||
p80211enumpair_t *list;
|
||||
} p80211enum_t;
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* The following structure types are used to store data items in */
|
||||
/* messages. */
|
||||
/*--------------------------------------------------------------------*/
|
||||
|
||||
/* Maximum pascal string */
|
||||
typedef struct p80211pstr255
|
||||
{
|
||||
UINT8 len;
|
||||
UINT8 data[MAXLEN_PSTR255];
|
||||
} p80211pstr255_t;
|
||||
|
||||
/* pascal string for macaddress and bssid */
|
||||
typedef struct p80211pstr6
|
||||
{
|
||||
UINT8 len;
|
||||
UINT8 data[MAXLEN_PSTR6];
|
||||
} p80211pstr6_t;
|
||||
|
||||
/* pascal string for channel list */
|
||||
typedef struct p80211pstr14
|
||||
{
|
||||
UINT8 len;
|
||||
UINT8 data[MAXLEN_PSTR14];
|
||||
} p80211pstr14_t;
|
||||
|
||||
/* pascal string for ssid */
|
||||
typedef struct p80211pstr32
|
||||
{
|
||||
UINT8 len;
|
||||
UINT8 data[MAXLEN_PSTR32];
|
||||
} p80211pstr32_t;
|
||||
|
||||
/* prototype template */
|
||||
typedef struct p80211item
|
||||
{
|
||||
UINT32 did;
|
||||
UINT32 len;
|
||||
} p80211item_t;
|
||||
|
||||
/* message data iteem for COLLECTION */
|
||||
typedef struct p80211item_coll
|
||||
{
|
||||
UINT32 did;
|
||||
UINT32 len;
|
||||
} p80211item_coll_t;
|
||||
|
||||
/* message data item for INT, BOUNDEDINT, ENUMINT */
|
||||
typedef struct p80211item_uint32
|
||||
{
|
||||
UINT32 did;
|
||||
UINT32 len;
|
||||
UINT32 data;
|
||||
} p80211item_uint32_t;
|
||||
|
||||
/* message data item for OCTETSTR, DISPLAYSTR */
|
||||
typedef struct p80211item_pstr6
|
||||
{
|
||||
UINT32 did;
|
||||
UINT32 len;
|
||||
p80211pstr6_t data;
|
||||
}p80211item_pstr6_t;
|
||||
|
||||
/* message data item for OCTETSTR, DISPLAYSTR */
|
||||
typedef struct p80211item_pstr14
|
||||
{
|
||||
UINT32 did;
|
||||
UINT32 len;
|
||||
p80211pstr14_t data;
|
||||
}p80211item_pstr14_t;
|
||||
|
||||
/* message data item for OCTETSTR, DISPLAYSTR */
|
||||
typedef struct p80211item_pstr32
|
||||
{
|
||||
UINT32 did;
|
||||
UINT32 len;
|
||||
p80211pstr32_t data;
|
||||
}p80211item_pstr32_t;
|
||||
|
||||
/* message data item for OCTETSTR, DISPLAYSTR */
|
||||
typedef struct p80211item_pstr255
|
||||
{
|
||||
UINT32 did;
|
||||
UINT32 len;
|
||||
p80211pstr255_t data;
|
||||
}p80211item_pstr255_t;
|
||||
|
||||
/* message data item for the collection in the BSSDescription argument */
|
||||
/* in the SCAN msg */
|
||||
|
||||
typedef struct p80211item_coll_bssdesc
|
||||
{
|
||||
p80211item_pstr6_t bssid;
|
||||
p80211item_pstr32_t ssid;
|
||||
p80211item_uint32_t bsstype;
|
||||
p80211item_uint32_t beaconperiod;
|
||||
p80211item_uint32_t dtimperiod;
|
||||
p80211item_uint32_t timestamp;
|
||||
p80211item_uint32_t localtime;
|
||||
p80211item_uint32_t fhdwelltime;
|
||||
p80211item_uint32_t fhhopset;
|
||||
p80211item_uint32_t fhhoppattern;
|
||||
p80211item_uint32_t fhhopindex;
|
||||
p80211item_uint32_t dschannel;
|
||||
p80211item_uint32_t cfpcount;
|
||||
p80211item_uint32_t cfpperiod;
|
||||
p80211item_uint32_t cfpmaxdur;
|
||||
p80211item_uint32_t cfpdurremain;
|
||||
p80211item_uint32_t ibssatimwin;
|
||||
p80211item_uint32_t cfpollable;
|
||||
p80211item_uint32_t cfpollreq;
|
||||
p80211item_uint32_t privacy;
|
||||
p80211item_uint32_t basicrate1;
|
||||
p80211item_uint32_t basicrate2;
|
||||
p80211item_uint32_t basicrate3;
|
||||
p80211item_uint32_t basicrate4;
|
||||
p80211item_uint32_t basicrate5;
|
||||
p80211item_uint32_t basicrate6;
|
||||
p80211item_uint32_t basicrate7;
|
||||
p80211item_uint32_t basicrate8;
|
||||
}p80211item_coll_bssdesc_t;
|
||||
|
||||
/* message data item for the BSSDescription argument in the SCAN msg */
|
||||
|
||||
typedef struct p80211item_bssdesc
|
||||
{
|
||||
UINT32 did;
|
||||
UINT32 len;
|
||||
p80211item_coll_bssdesc_t data;
|
||||
} p80211item_bssdesc_t;
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* The following structure type is used to represent all of the */
|
||||
/* metadata items. Some components may choose to use more, less or */
|
||||
/* different metadata items. */
|
||||
/*--------------------------------------------------------------------*/
|
||||
|
||||
typedef struct p80211meta
|
||||
{
|
||||
char *name; /* data item name */
|
||||
UINT32 did; /* partial did */
|
||||
UINT32 msgoffset; /* offset of this item in data item structure */
|
||||
UINT32 min; /* min value of a BOUNDEDINT */
|
||||
UINT32 max; /* max value of a BOUNDEDINT */
|
||||
UINT32 maxlen; /* maxlen of a OCTETSTR or DISPLAYSTR */
|
||||
p80211enum_t *enumptr; /* ptr to the enum type for ENUMINT */
|
||||
struct p80211meta *collptr; /* ptr to array of COLLECTION subitems */
|
||||
void (*totextptr)(void); /* ptr to totext conversion function */
|
||||
void (*fromtextptr)(void); /* ptr to totext conversion function */
|
||||
void (*validfunptr)(void); /* ptr to totext conversion function */
|
||||
} p80211meta_t;
|
||||
|
||||
|
||||
|
||||
/*====================================================================*/
|
||||
/*----- External Declarations ----------------------------------------*/
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* Enumeration Lists */
|
||||
/* The following are the external declarations for all enumerations */
|
||||
/*--------------------------------------------------------------------*/
|
||||
|
||||
extern p80211enum_t MKENUMNAME(truth);
|
||||
extern p80211enum_t MKENUMNAME(powermgmt);
|
||||
extern p80211enum_t MKENUMNAME(bsstype);
|
||||
extern p80211enum_t MKENUMNAME(authalg);
|
||||
extern p80211enum_t MKENUMNAME(phytype);
|
||||
extern p80211enum_t MKENUMNAME(temptype);
|
||||
extern p80211enum_t MKENUMNAME(regdomain);
|
||||
extern p80211enum_t MKENUMNAME(ccamode);
|
||||
extern p80211enum_t MKENUMNAME(diversity);
|
||||
extern p80211enum_t MKENUMNAME(scantype);
|
||||
extern p80211enum_t MKENUMNAME(resultcode);
|
||||
extern p80211enum_t MKENUMNAME(reason);
|
||||
extern p80211enum_t MKENUMNAME(status);
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* Metadata Lists */
|
||||
/* The following are the external declarations for all the metadata */
|
||||
/* lists. */
|
||||
/*--------------------------------------------------------------------*/
|
||||
|
||||
/*------------- Extern for the collection metadata lists -------------*/
|
||||
/*------------- defined in p80211metamib.c ----------------------------*/
|
||||
extern p80211meta_t **p80211meta_slist[];
|
||||
|
||||
/*------------- Extern(s) for the mib metadata group(s) --------------*/
|
||||
/*------------- defined in p80211metamib.c ----------------------------*/
|
||||
extern p80211meta_t *MKGRPMETANAME(dot11smt)[];
|
||||
extern p80211meta_t *MKGRPMETANAME(dot11mac)[];
|
||||
extern p80211meta_t *MKGRPMETANAME(dot11phy)[];
|
||||
|
||||
/*------------- Extern(s) for the msg metadata group(s) --------------*/
|
||||
/*------------- defined in p80211msg.c --------------------------------*/
|
||||
extern p80211meta_t *MKGRPMETANAME(msg)[];
|
||||
|
||||
/*------------- Externs for the msg collection metadata lists --------*/
|
||||
/*------------- defined in p80211msg.c --------------------------------*/
|
||||
extern p80211meta_t MKCOLLMETANAME(bssdesc)[];
|
||||
extern UINT32 MKCOLLMETASIZE(bssdesc);
|
||||
|
||||
/*------------- Externs for the command metadata lists ---------------*/
|
||||
/*------------- defined in p80211msg.c --------------------------------*/
|
||||
extern p80211meta_t MKREQMETANAME(mib_get)[];
|
||||
extern UINT32 MKREQMETASIZE(mib_get);
|
||||
extern p80211meta_t MKREQMETANAME(mib_set)[];
|
||||
extern UINT32 MKREQMETASIZE(mib_set);
|
||||
extern p80211meta_t MKREQMETANAME(powermgmt)[];
|
||||
extern UINT32 MKREQMETASIZE(powermgmt);
|
||||
extern p80211meta_t MKREQMETANAME(scan)[];
|
||||
extern UINT32 MKREQMETASIZE(scan);
|
||||
extern p80211meta_t MKREQMETANAME(join)[];
|
||||
extern UINT32 MKREQMETASIZE(join);
|
||||
extern p80211meta_t MKREQMETANAME(authenticate)[];
|
||||
extern UINT32 MKREQMETASIZE(authenticate);
|
||||
extern p80211meta_t MKREQMETANAME(deauthenticate)[];
|
||||
extern UINT32 MKREQMETASIZE(deauthenticate);
|
||||
extern p80211meta_t MKREQMETANAME(associate)[];
|
||||
extern UINT32 MKREQMETASIZE(associate);
|
||||
extern p80211meta_t MKREQMETANAME(reassociate)[];
|
||||
extern UINT32 MKREQMETASIZE(reassociate);
|
||||
extern p80211meta_t MKREQMETANAME(disassociate)[];
|
||||
extern UINT32 MKREQMETASIZE(disassociate);
|
||||
extern p80211meta_t MKREQMETANAME(reset)[];
|
||||
extern UINT32 MKREQMETASIZE(reset);
|
||||
extern p80211meta_t MKREQMETANAME(start)[];
|
||||
extern UINT32 MKREQMETASIZE(start);
|
||||
|
||||
/*------------- Externs for the indication metadata lists ------------*/
|
||||
/*------------- defined in p80211msg.c --------------------------------*/
|
||||
extern p80211meta_t MKINDMETANAME(authenticate)[];
|
||||
extern UINT32 MKINDMETASIZE(authenticate);
|
||||
extern p80211meta_t MKINDMETANAME(deauthenticate)[];
|
||||
extern UINT32 MKINDMETASIZE(deauthenticate);
|
||||
extern p80211meta_t MKINDMETANAME(associate)[];
|
||||
extern UINT32 MKINDMETASIZE(associate);
|
||||
extern p80211meta_t MKINDMETANAME(reassociate)[];
|
||||
extern UINT32 MKINDMETASIZE(reassociate);
|
||||
extern p80211meta_t MKINDMETANAME(disassociate)[];
|
||||
extern UINT32 MKINDMETASIZE(disassociate);
|
||||
|
||||
|
||||
/*====================================================================*/
|
||||
/*----- Function Prototypes ------------------------------------------*/
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* The following declare functions that perform validation and text */
|
||||
/* to binary conversions based on the metadata for interface and */
|
||||
/* MIB data items. */
|
||||
/*--------------------------------------------------------------------*/
|
||||
|
||||
/*-- DISPLAYSTR ------------------------------------------------------*/
|
||||
/* pstr ==> cstr */
|
||||
void p80211_totext_displaystr( void );
|
||||
|
||||
/* cstr ==> pstr */
|
||||
void p80211_fromtext_displaystr( void );
|
||||
|
||||
/* function that checks validity of a displaystr binary value */
|
||||
void p80211_isvalid_displaystr( void );
|
||||
|
||||
/*-- OCTETSTR --------------------------------------------------------*/
|
||||
/* pstr ==> "xx:xx:...." */
|
||||
void p80211_totext_octetstr( void );
|
||||
|
||||
/* "xx:xx:...." ==> pstr */
|
||||
void p80211_fromtext_octetstr( void );
|
||||
|
||||
/* function that checks validity of an octetstr binary value */
|
||||
void p80211_isvalid_octetstr( void );
|
||||
|
||||
/*-- BOUNDEDINT ------------------------------------------------------*/
|
||||
/* UINT32 ==> %d */
|
||||
void p80211_totext_boundedint( void );
|
||||
|
||||
/* %d ==> UINT32 */
|
||||
void p80211_fromtext_boundedint( void );
|
||||
|
||||
/* function that checks validity of a boundedint's binary value */
|
||||
void p80211_isvalid_boundedint( void );
|
||||
|
||||
/*-- INT -------------------------------------------------------------*/
|
||||
/* UINT32 ==> %d */
|
||||
void p80211_totext_int( void );
|
||||
|
||||
/* %d ==> UINT32 */
|
||||
void p80211_fromtext_int( void );
|
||||
|
||||
/* function that checks validity of an int's binary value (always successful) */
|
||||
void p80211_isvalid_int( void );
|
||||
|
||||
/*-- ENUMINT ---------------------------------------------------------*/
|
||||
/* UINT32 ==> <valuename> */
|
||||
void p80211_totext_enumint( void );
|
||||
|
||||
/* <valuename> ==> UINT32 */
|
||||
void p80211_fromtext_enumint( void );
|
||||
|
||||
/* function that checks validity of an enum's binary value */
|
||||
void p80211_isvalid_enumint( void );
|
||||
|
||||
/*-- COLLECTION ------------------------------------------------------*/
|
||||
/* <collection> ==> <list of item text elements> */
|
||||
void p80211_totext_collection( void );
|
||||
|
||||
/* <list of item text elements> ==> <collection> */
|
||||
void p80211_fromtext_collection( void );
|
||||
|
||||
/* function that checks validity of a collection's binary value */
|
||||
void p80211_isvalid_collection( void );
|
||||
|
||||
/*-- MIBITEM ---------------------------------------------------------*/
|
||||
/* <mibvalue> ==> <textual representation identified in MIB metadata> */
|
||||
void p80211_totext_mibitem( void );
|
||||
|
||||
/* <textual representation identified in MIB metadata> ==> <mibvalue> */
|
||||
void p80211_fromtext_mibitem( void );
|
||||
|
||||
/* function that checks validity of a mibitem's binary value */
|
||||
void p80211_isvalid_mibitem( void );
|
||||
|
||||
/*-- MIBDID ----------------------------------------------------------*/
|
||||
/* <mib DID> ==> <mib item name> */
|
||||
void p80211_totext_mibdid( void );
|
||||
|
||||
/* <mib item name> ==> <mib DID> */
|
||||
void p80211_fromtext_mibdid( void );
|
||||
|
||||
/* function that checks validity of a mibdid's binary value */
|
||||
void p80211_isvalid_mibdid( void );
|
||||
|
||||
/*-- MIBCOLLECTION ---------------------------------------------------*/
|
||||
/* <mibvalue collection> ==> <text> */
|
||||
void p80211_totext_mibcollection( void );
|
||||
|
||||
/* <text> ==> <mibvalue collection> */
|
||||
void p80211_fromtext_mibcollection( void );
|
||||
|
||||
/* function that checks validity of a mibcollection binary value */
|
||||
void p80211_isvalid_mibcollection( void );
|
||||
|
||||
#endif /* _P80211TYPES_H */
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
#define WLAN_RELEASE "0.5.1"
|
||||
#define WLAN_RELEASE_CODE 0x000501
|
|
@ -0,0 +1,487 @@
|
|||
/* wlan_compat.h: Types and macros to aid in portability
|
||||
* --------------------------------------------------------------------
|
||||
* Linux WLAN
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The initial developer of the original code is Mark S. Mathews
|
||||
* <mark@absoval.com>. Portions created by Mark S. Mathews
|
||||
* are Copyright (C) 1998 AbsoluteValue Software, Inc. All Rights Reserved.
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* --------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef _WLAN_COMPAT_H
|
||||
#define _WLAN_COMPAT_H
|
||||
|
||||
/*=============================================================*/
|
||||
/*------ Establish Platform Identity --------------------------*/
|
||||
/*=============================================================*/
|
||||
/* Key macros: */
|
||||
/* WLAN_CPU_FAMILY */
|
||||
#define WLAN_Ix86 1
|
||||
#define WLAN_PPC 2
|
||||
#define WLAN_Ix96 3
|
||||
/* WLAN_CPU_CORE */
|
||||
#define WLAN_I386CORE 1
|
||||
#define WLAN_PPCCORE 2
|
||||
#define WLAN_I296 3
|
||||
/* WLAN_CPU_PART */
|
||||
#define WLAN_I386PART 1
|
||||
#define WLAN_MPC860 2
|
||||
#define WLAN_MPC850 3
|
||||
#define WLAN_I296SA 4
|
||||
#define WLAN_PPCPART 5
|
||||
/* WLAN_SYSARCH */
|
||||
#define WLAN_PCAT 1
|
||||
#define WLAN_MBX 2
|
||||
#define WLAN_RPX 3
|
||||
#define WLAN_LWARCH 4
|
||||
#define WLAN_PMAC 5
|
||||
/* WLAN_OS */
|
||||
#define WLAN_LINUX_KERNEL 1
|
||||
#define WLAN_LINUX_USER 2
|
||||
#define WLAN_LWOS 3
|
||||
#define WLAN_QNX4 4
|
||||
/* WLAN_COMPILER */
|
||||
#define WLAN_GNUC 1
|
||||
#define WLAN_DIAB 2
|
||||
|
||||
#if defined(__LINUX_WLAN__) && defined(__KERNEL__)
|
||||
#define WLAN_OS WLAN_LINUX_KERNEL
|
||||
#define WLAN_COMPILER WLAN_GNUC
|
||||
#if defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__)
|
||||
#define WLAN_CPU_FAMILY WLAN_Ix86
|
||||
#define WLAN_CPU_CORE WLAN_I386CORE
|
||||
#define WLAN_CPU_PART WLAN_I386PART
|
||||
#define WLAN_SYSARCH WLAN_PCAT
|
||||
#elif defined(CONFIG_PPC)
|
||||
#define WLAN_CPU_FAMILY WLAN_PPC
|
||||
#define WLAN_CPU_CORE WLAN_PPCCORE
|
||||
#if defined(CONFIG_MBX)
|
||||
#define WLAN_CPU_PART WLAN_MPC860
|
||||
#define WLAN_SYSARCH WLAN_MBX
|
||||
#elif defined(CONFIG_RPX)
|
||||
#define WLAN_CPU_PART WLAN_MPC850
|
||||
#define WLAN_SYSARCH WLAN_RPX
|
||||
#else
|
||||
#define WLAN_CPU_PART WLAN_PPCPART
|
||||
#define WLAN_SYSARCH WLAN_PMAC
|
||||
#endif
|
||||
#endif
|
||||
#elif defined(__LINUX_WLAN__) && !defined(__KERNEL__)
|
||||
#define WLAN_OS WLAN_LINUX_USER
|
||||
#define WLAN_COMPILER WLAN_GNUC
|
||||
#if defined(__I386__)
|
||||
#define WLAN_CPU_FAMILY WLAN_Ix86
|
||||
#define WLAN_CPU_CORE WLAN_I386CORE
|
||||
#define WLAN_CPU_PART WLAN_I386PART
|
||||
#define WLAN_SYSARCH WLAN_PCAT
|
||||
#elif defined(CONFIG_PPC)
|
||||
#define WLAN_CPU_FAMILY WLAN_PPC
|
||||
#define WLAN_CPU_CORE WLAN_PPCCORE
|
||||
#if defined(CONFIG_MBX)
|
||||
#define WLAN_CPU_PART WLAN_MPC860
|
||||
#define WLAN_SYSARCH WLAN_MBX
|
||||
#elif defined(CONFIG_RPX)
|
||||
#define WLAN_CPU_PART WLAN_MPC850
|
||||
#define WLAN_SYSARCH WLAN_RPX
|
||||
#else
|
||||
#define WLAN_CPU_PART WLAN_PPCPART
|
||||
#define WLAN_SYSARCH WLAN_PMAC
|
||||
#endif
|
||||
#endif
|
||||
#elif defined(LW) || defined(LW_HDW_ISDN) || defined(LW_HDW_SERIAL)
|
||||
#define WLAN_OS WLAN_LWOS
|
||||
#define WLAN_COMPILER WLAN_DIAB
|
||||
#define WLAN_CPU_FAMILY WLAN_PPC
|
||||
#define WLAN_CPU_CORE WLAN_PPCCORE
|
||||
#define WLAN_CPU_PART WLAN_MPC860
|
||||
#define WLAN_SYSARCH WLAN_LWARCH
|
||||
#elif defined(MBX)
|
||||
#define WLAN_OS WLAN_LWOS
|
||||
#define WLAN_COMPILER WLAN_DIAB
|
||||
#define WLAN_CPU_FAMILY WLAN_PPC
|
||||
#define WLAN_CPU_CORE WLAN_PPCCORE
|
||||
#define WLAN_CPU_PART WLAN_MPC860
|
||||
#define WLAN_SYSARCH WLAN_MBX
|
||||
#endif
|
||||
|
||||
/*=============================================================*/
|
||||
/*------ Bit settings -----------------------------------------*/
|
||||
/*=============================================================*/
|
||||
|
||||
#define BIT0 0x00000001
|
||||
#define BIT1 0x00000002
|
||||
#define BIT2 0x00000004
|
||||
#define BIT3 0x00000008
|
||||
#define BIT4 0x00000010
|
||||
#define BIT5 0x00000020
|
||||
#define BIT6 0x00000040
|
||||
#define BIT7 0x00000080
|
||||
#define BIT8 0x00000100
|
||||
#define BIT9 0x00000200
|
||||
#define BIT10 0x00000400
|
||||
#define BIT11 0x00000800
|
||||
#define BIT12 0x00001000
|
||||
#define BIT13 0x00002000
|
||||
#define BIT14 0x00004000
|
||||
#define BIT15 0x00008000
|
||||
#define BIT16 0x00010000
|
||||
#define BIT17 0x00020000
|
||||
#define BIT18 0x00040000
|
||||
#define BIT19 0x00080000
|
||||
#define BIT20 0x00100000
|
||||
#define BIT21 0x00200000
|
||||
#define BIT22 0x00400000
|
||||
#define BIT23 0x00800000
|
||||
#define BIT24 0x01000000
|
||||
#define BIT25 0x02000000
|
||||
#define BIT26 0x04000000
|
||||
#define BIT27 0x08000000
|
||||
#define BIT28 0x10000000
|
||||
#define BIT29 0x20000000
|
||||
#define BIT30 0x40000000
|
||||
#define BIT31 0x80000000
|
||||
|
||||
#define MOTO_BIT31 0x00000001
|
||||
#define MOTO_BIT30 0x00000002
|
||||
#define MOTO_BIT29 0x00000004
|
||||
#define MOTO_BIT28 0x00000008
|
||||
#define MOTO_BIT27 0x00000010
|
||||
#define MOTO_BIT26 0x00000020
|
||||
#define MOTO_BIT25 0x00000040
|
||||
#define MOTO_BIT24 0x00000080
|
||||
#define MOTO_BIT23 0x00000100
|
||||
#define MOTO_BIT22 0x00000200
|
||||
#define MOTO_BIT21 0x00000400
|
||||
#define MOTO_BIT20 0x00000800
|
||||
#define MOTO_BIT19 0x00001000
|
||||
#define MOTO_BIT18 0x00002000
|
||||
#define MOTO_BIT17 0x00004000
|
||||
#define MOTO_BIT16 0x00008000
|
||||
#define MOTO_BIT15 0x00010000
|
||||
#define MOTO_BIT14 0x00020000
|
||||
#define MOTO_BIT13 0x00040000
|
||||
#define MOTO_BIT12 0x00080000
|
||||
#define MOTO_BIT11 0x00100000
|
||||
#define MOTO_BIT10 0x00200000
|
||||
#define MOTO_BIT9 0x00400000
|
||||
#define MOTO_BIT8 0x00800000
|
||||
#define MOTO_BIT7 0x01000000
|
||||
#define MOTO_BIT6 0x02000000
|
||||
#define MOTO_BIT5 0x04000000
|
||||
#define MOTO_BIT4 0x08000000
|
||||
#define MOTO_BIT3 0x10000000
|
||||
#define MOTO_BIT2 0x20000000
|
||||
#define MOTO_BIT1 0x40000000
|
||||
#define MOTO_BIT0 0x80000000
|
||||
|
||||
typedef unsigned char UINT8;
|
||||
typedef unsigned short UINT16;
|
||||
typedef unsigned long UINT32;
|
||||
|
||||
typedef signed char INT8;
|
||||
typedef signed short INT16;
|
||||
typedef signed long INT32;
|
||||
|
||||
typedef unsigned int UINT;
|
||||
typedef signed int INT;
|
||||
|
||||
#if (WLAN_COMPILER == WLAN_GNUC)
|
||||
typedef unsigned long long UINT64;
|
||||
typedef signed long long INT64;
|
||||
#else
|
||||
typedef UINT8 UINT64[8];
|
||||
#endif
|
||||
|
||||
#define UINT8_MAX (0xffUL)
|
||||
#define UINT16_MAX (0xffffUL)
|
||||
#define UINT32_MAX (0xffffffffUL)
|
||||
|
||||
#define INT8_MAX (0x7fL)
|
||||
#define INT16_MAX (0x7fffL)
|
||||
#define INT32_MAX (0x7fffffffL)
|
||||
|
||||
/*=============================================================*/
|
||||
/*------ Compiler Portability Macros --------------------------*/
|
||||
/*=============================================================*/
|
||||
#if (WLAN_COMPILER == WLAN_GNUC)
|
||||
#define __WLAN_ATTRIB_PACK__ __attribute__ ((packed))
|
||||
#define __WLAN_PRAGMA_PACK1__
|
||||
#define __WLAN_PRAGMA_PACKDFLT__
|
||||
#define __WLAN_INLINE__ inline
|
||||
#elif (WLAN_COMPILER == WLAN_DIAB)
|
||||
#define __WLAN_ATTRIB_PACK__
|
||||
#define __WLAN_PRAGMA_PACK1__ #pragma pack
|
||||
#define __WLAN_PRAGMA_PACKDFLT__ #pragma pack()
|
||||
#define __WLAN_INLINE__ inline
|
||||
#else
|
||||
#error "Unknown compiler"
|
||||
#endif
|
||||
|
||||
/*=============================================================*/
|
||||
/*------ OS Portability Macros --------------------------------*/
|
||||
/*=============================================================*/
|
||||
|
||||
#if (WLAN_OS == WLAN_LINUX_KERNEL)
|
||||
#define WLAN_LOG_ERROR0(s) printk(KERN_ERR s);
|
||||
#define WLAN_LOG_ERROR1(s,n) printk(KERN_ERR s, (n));
|
||||
#define WLAN_LOG_ERROR2(s,n1,n2) printk(KERN_ERR s, (n1), (n2));
|
||||
#define WLAN_LOG_ERROR3(s,n1,n2,n3) printk(KERN_ERR s, (n1), (n2), (n3));
|
||||
#define WLAN_LOG_ERROR4(s,n1,n2,n3,n4) printk(KERN_ERR ": " s, (n1), (n2), (n3), (n4));
|
||||
|
||||
#define WLAN_LOG_WARNING0(s) printk(KERN_WARNING s);
|
||||
#define WLAN_LOG_WARNING1(s,n) printk(KERN_WARNING s, (n));
|
||||
#define WLAN_LOG_WARNING2(s,n1,n2) printk(KERN_WARNING s, (n1), (n2));
|
||||
#define WLAN_LOG_WARNING3(s,n1,n2,n3) printk(KERN_WARNING s, (n1), (n2), (n3));
|
||||
#define WLAN_LOG_WARNING4(s,n1,n2,n3,n4) printk(KERN_WARNING ": " s, (n1), (n2), (n3), (n4));
|
||||
|
||||
#define WLAN_LOG_NOTICE0(s) printk(KERN_NOTICE s);
|
||||
#define WLAN_LOG_NOTICE1(s,n) printk(KERN_NOTICE s, (n));
|
||||
#define WLAN_LOG_NOTICE2(s,n1,n2) printk(KERN_NOTICE s, (n1), (n2));
|
||||
#define WLAN_LOG_NOTICE3(s,n1,n2,n3) printk(KERN_NOTICE s, (n1), (n2), (n3));
|
||||
#define WLAN_LOG_NOTICE4(s,n1,n2,n3,n4) printk(KERN_NOTICE s, (n1), (n2), (n3), (n4));
|
||||
|
||||
#if defined(WLAN_INCLUDE_DEBUG)
|
||||
#define WLAN_ASSERT(c) if ((!(c)) && wlan_debug >= 1) { \
|
||||
WLAN_LOG_DEBUG0(1, "Assertion failure!\n"); }
|
||||
#define WLAN_HEX_DUMP( l, s, p, n) if( wlan_debug >= (l) ){ int i; \
|
||||
printk(KERN_DEBUG s ":"); \
|
||||
for( i=0; i < (n); i++) printk( " %02x", ((UINT8*)(p))[i]); \
|
||||
printk("\n"); }
|
||||
|
||||
#define DBFENTER { if ( wlan_debug >= 4 ){ WLAN_LOG_DEBUG0(3,"Enter\n"); } }
|
||||
#define DBFEXIT { if ( wlan_debug >= 4 ){ WLAN_LOG_DEBUG0(3,"Exit\n"); } }
|
||||
|
||||
#define WLAN_LOG_INFO0(s) printk(KERN_INFO __FUNCTION__": " s);
|
||||
#define WLAN_LOG_INFO1(s,n) printk(KERN_INFO __FUNCTION__": " s, (n));
|
||||
#define WLAN_LOG_INFO2(s,n1,n2) printk(KERN_INFO __FUNCTION__": " s, (n1), (n2));
|
||||
#define WLAN_LOG_INFO3(s,n1,n2,n3) printk(KERN_INFO __FUNCTION__": " s, (n1), (n2), (n3));
|
||||
#define WLAN_LOG_INFO4(s,n1,n2,n3,n4) printk(KERN_INFO __FUNCTION__": " s, (n1), (n2), (n3), (n4));
|
||||
|
||||
#define WLAN_LOG_DEBUG0(l, s) if ( wlan_debug >= (l)) printk(KERN_DEBUG __FUNCTION__": " s);
|
||||
#define WLAN_LOG_DEBUG1(l, s,n) if ( wlan_debug >= (l)) printk(KERN_DEBUG __FUNCTION__": " s, (n));
|
||||
#define WLAN_LOG_DEBUG2(l, s,n1,n2) if ( wlan_debug >= (l)) printk(KERN_DEBUG __FUNCTION__": " s, (n1), (n2));
|
||||
#define WLAN_LOG_DEBUG3(l, s,n1,n2,n3) if ( wlan_debug >= (l)) printk(KERN_DEBUG __FUNCTION__": " s, (n1), (n2), (n3));
|
||||
#define WLAN_LOG_DEBUG4(l, s,n1,n2,n3,n4) if ( wlan_debug >= (l)) printk(KERN_DEBUG __FUNCTION__": " s, (n1), (n2), (n3), (n4));
|
||||
#else
|
||||
#define WLAN_ASSERT(c)
|
||||
#define WLAN_HEX_DUMP( l, s, p, n)
|
||||
|
||||
#define DBFENTER
|
||||
#define DBFEXIT
|
||||
|
||||
#define WLAN_LOG_INFO0(s)
|
||||
#define WLAN_LOG_INFO1(s,n)
|
||||
#define WLAN_LOG_INFO2(s,n1,n2)
|
||||
#define WLAN_LOG_INFO3(s,n1,n2,n3)
|
||||
#define WLAN_LOG_INFO4(s,n1,n2,n3,n4)
|
||||
|
||||
#define WLAN_LOG_DEBUG0(l, s)
|
||||
#define WLAN_LOG_DEBUG1(l, s,n)
|
||||
#define WLAN_LOG_DEBUG2(l, s,n1,n2)
|
||||
#define WLAN_LOG_DEBUG3(l, s,n1,n2,n3)
|
||||
#define WLAN_LOG_DEBUG4(l, s,n1,n2,n3,n4)
|
||||
#endif
|
||||
#elif (WLAN_OS == WLAN_LWOS)
|
||||
#define KERN_ERR
|
||||
#define KERN_WARNING
|
||||
#define KERN_NOTICE
|
||||
#define KERN_INFO
|
||||
#define KERN_DEBUG
|
||||
#define __FUNCTION__
|
||||
|
||||
#define WLAN_LOG_ERROR0(s) kprintf(KERN_ERR s);
|
||||
#define WLAN_LOG_ERROR1(s,n) kprintf(KERN_ERR s, (n));
|
||||
#define WLAN_LOG_ERROR2(s,n1,n2) kprintf(KERN_ERR s, (n1), (n2));
|
||||
#define WLAN_LOG_ERROR3(s,n1,n2,n3) kprintf(KERN_ERR s, (n1), (n2), (n3));
|
||||
#define WLAN_LOG_ERROR4(s,n1,n2,n3,n4) kprintf(KERN_ERR ": " s, (n1), (n2), (n3), (n4));
|
||||
|
||||
#define WLAN_LOG_WARNING0(s) kprintf(KERN_WARNING s);
|
||||
#define WLAN_LOG_WARNING1(s,n) kprintf(KERN_WARNING s, (n));
|
||||
#define WLAN_LOG_WARNING2(s,n1,n2) kprintf(KERN_WARNING s, (n1), (n2));
|
||||
#define WLAN_LOG_WARNING3(s,n1,n2,n3) kprintf(KERN_WARNING s, (n1), (n2), (n3));
|
||||
#define WLAN_LOG_WARNING4(s,n1,n2,n3,n4) kprintf(KERN_WARNING ": " s, (n1), (n2), (n3), (n4));
|
||||
|
||||
#define WLAN_LOG_NOTICE0(s) kprintf(KERN_NOTICE s);
|
||||
#define WLAN_LOG_NOTICE1(s,n) kprintf(KERN_NOTICE s, (n));
|
||||
#define WLAN_LOG_NOTICE2(s,n1,n2) kprintf(KERN_NOTICE s, (n1), (n2));
|
||||
#define WLAN_LOG_NOTICE3(s,n1,n2,n3) kprintf(KERN_NOTICE s, (n1), (n2), (n3));
|
||||
#define WLAN_LOG_NOTICE4(s,n1,n2,n3,n4) kprintf(KERN_NOTICE s, (n1), (n2), (n3), (n4));
|
||||
|
||||
#if defined(WLAN_INCLUDE_DEBUG)
|
||||
#define WLAN_ASSERT(c) if ((!(c)) && wlan_debug >= 1) \
|
||||
{WLAN_LOG_DEBUG0(1, "Assertion failure!\n");}
|
||||
#define WLAN_HEX_DUMP( l, s, p, n) if( wlan_debug >= (l) ){ int i; \
|
||||
kprintf(KERN_DEBUG s ":"); \
|
||||
for( i=0; i < (n); i++) kprintf( " %02x", ((UINT8*)(p))[i]); \
|
||||
kprintf("\n"); }
|
||||
|
||||
#define DBFENTER { if ( wlan_debug >= 4 ){ WLAN_LOG_DEBUG0(3,"Enter\n"); } }
|
||||
#define DBFEXIT { if ( wlan_debug >= 4 ){ WLAN_LOG_DEBUG0(3,"Exit\n"); } }
|
||||
|
||||
#define WLAN_LOG_INFO0(s) kprintf(KERN_INFO __FUNCTION__": " s);
|
||||
#define WLAN_LOG_INFO1(s,n) kprintf(KERN_INFO __FUNCTION__": " s, (n));
|
||||
#define WLAN_LOG_INFO2(s,n1,n2) kprintf(KERN_INFO __FUNCTION__": " s, (n1), (n2));
|
||||
#define WLAN_LOG_INFO3(s,n1,n2,n3) kprintf(KERN_INFO __FUNCTION__": " s, (n1), (n2), (n3));
|
||||
#define WLAN_LOG_INFO4(s,n1,n2,n3,n4) kprintf(KERN_INFO __FUNCTION__": " s, (n1), (n2), (n3), (n4));
|
||||
|
||||
#define WLAN_LOG_DEBUG0(l, s) if ( wlan_debug >= (l)) kprintf(KERN_DEBUG __FUNCTION__": " s);
|
||||
#define WLAN_LOG_DEBUG1(l, s,n) if ( wlan_debug >= (l)) kprintf(KERN_DEBUG __FUNCTION__": " s, (n));
|
||||
#define WLAN_LOG_DEBUG2(l, s,n1,n2) if ( wlan_debug >= (l)) kprintf(KERN_DEBUG __FUNCTION__": " s, (n1), (n2));
|
||||
#define WLAN_LOG_DEBUG3(l, s,n1,n2,n3) if ( wlan_debug >= (l)) kprintf(KERN_DEBUG __FUNCTION__": " s, (n1), (n2), (n3));
|
||||
#define WLAN_LOG_DEBUG4(l, s,n1,n2,n3,n4) if ( wlan_debug >= (l)) kprintf(KERN_DEBUG __FUNCTION__": " s, (n1), (n2), (n3), (n4));
|
||||
#else
|
||||
#define WLAN_ASSERT(c)
|
||||
#define WLAN_HEX_DUMP( l, s, p, n)
|
||||
|
||||
#define DBFENTER
|
||||
#define DBFEXIT
|
||||
|
||||
#define WLAN_LOG_INFO0(s)
|
||||
#define WLAN_LOG_INFO1(s,n)
|
||||
#define WLAN_LOG_INFO2(s,n1,n2)
|
||||
#define WLAN_LOG_INFO3(s,n1,n2,n3)
|
||||
#define WLAN_LOG_INFO4(s,n1,n2,n3,n4)
|
||||
|
||||
#define WLAN_LOG_DEBUG0(l, s)
|
||||
#define WLAN_LOG_DEBUG1(l, s,n)
|
||||
#define WLAN_LOG_DEBUG2(l, s,n1,n2)
|
||||
#define WLAN_LOG_DEBUG3(l, s,n1,n2,n3)
|
||||
#define WLAN_LOG_DEBUG4(l, s,n1,n2,n3,n4)
|
||||
#endif
|
||||
#else
|
||||
#define WLAN_LOG_ERROR0(s)
|
||||
#define WLAN_LOG_ERROR1(s,n)
|
||||
#define WLAN_LOG_ERROR2(s,n1,n2)
|
||||
#define WLAN_LOG_ERROR3(s,n1,n2,n3)
|
||||
#define WLAN_LOG_ERROR4(s,n1,n2,n3,n4)
|
||||
|
||||
#define WLAN_LOG_WARNING0(s)
|
||||
#define WLAN_LOG_WARNING1(s,n)
|
||||
#define WLAN_LOG_WARNING2(s,n1,n2)
|
||||
#define WLAN_LOG_WARNING3(s,n1,n2,n3)
|
||||
#define WLAN_LOG_WARNING4(s,n1,n2,n3,n4)
|
||||
|
||||
#define WLAN_LOG_NOTICE0(s)
|
||||
#define WLAN_LOG_NOTICE1(s,n)
|
||||
#define WLAN_LOG_NOTICE2(s,n1,n2)
|
||||
#define WLAN_LOG_NOTICE3(s,n1,n2,n3)
|
||||
#define WLAN_LOG_NOTICE4(s,n1,n2,n3,n4)
|
||||
|
||||
#define WLAN_ASSERT(c)
|
||||
#define WLAN_HEX_DUMP( l, s, p, n)
|
||||
|
||||
#define DBFENTER
|
||||
#define DBFEXIT
|
||||
|
||||
#define WLAN_LOG_INFO0(s)
|
||||
#define WLAN_LOG_INFO1(s,n)
|
||||
#define WLAN_LOG_INFO2(s,n1,n2)
|
||||
#define WLAN_LOG_INFO3(s,n1,n2,n3)
|
||||
#define WLAN_LOG_INFO4(s,n1,n2,n3,n4)
|
||||
|
||||
#define WLAN_LOG_DEBUG0(l, s)
|
||||
#define WLAN_LOG_DEBUG1(l, s,n)
|
||||
#define WLAN_LOG_DEBUG2(l, s,n1,n2)
|
||||
#define WLAN_LOG_DEBUG3(l, s,n1,n2,n3)
|
||||
#define WLAN_LOG_DEBUG4(l, s,n1,n2,n3,n4)
|
||||
#endif
|
||||
|
||||
#if (WLAN_OS == WLAN_LINUX_KERNEL)
|
||||
#define wlan_ticks_per_sec HZ
|
||||
#define wlan_ms_per_tick (1000UL / (wlan_ticks_per_sec))
|
||||
#define wlan_ms_to_ticks(n) ( (n) / (wlan_ms_per_tick))
|
||||
#define WLAN_INT_DISABLE(n) { save_flags((n)); cli(); }
|
||||
#define WLAN_INT_ENABLE(n) { sti(); restore_flags((n)); }
|
||||
|
||||
#elif (WLAN_OS == WLAN_LWOS)
|
||||
#define atomic_t UINT32
|
||||
#define jiffies (sNumTicks)
|
||||
#define wlan_ticks_per_sec ((kTicksPerTenth) * 10UL)
|
||||
#define HZ (wlan_ticks_per_sec)
|
||||
#define wlan_ms_per_tick (1000UL / (wlan_ticks_per_sec))
|
||||
#define wlan_ms_to_ticks(n) ( (n) / (wlan_ms_per_tick))
|
||||
#define udelay(n) { int i, j=0; for( i = (n)*10; i > 0; i--) j++; }
|
||||
#define outb_p(v, a) (*((UINT8*)(a))) = (v);
|
||||
#define outb(v, a) (*((UINT8*)(a))) = (v);
|
||||
#define inb_p(a) (*((UINT8*)(a)))
|
||||
#define inb(a) (*((UINT8*)(a)))
|
||||
#define readb(a) (*((UINT8*)(a)))
|
||||
#define writeb(byte, dest) ((*((UINT8*)(dest))) = ((UINT8)(byte)))
|
||||
#define test_and_set_bit(b, p) \
|
||||
(((*(UINT32*)(p)) & ((BIT0) << (b))) ? \
|
||||
(1) : (((*(UINT32*)(p)) | ((BIT0) << (b))), (0)) )
|
||||
#define clear_bit(b, p) ((*((UINT32*)(p))) |= ((BIT0) << (b)))
|
||||
|
||||
#define kmalloc(l,d) malloc((l))
|
||||
#define kfree_s(p,l) free((p))
|
||||
#define GFP_KERNEL 0
|
||||
#define GFP_ATOMIC 0
|
||||
#define WLAN_INT_DISABLE(n) { IntDisable(&(n)); }
|
||||
#define WLAN_INT_ENABLE(n) { IntRestore(&(n)); }
|
||||
#endif
|
||||
|
||||
/*=============================================================*/
|
||||
/*------ Hardware Portability Macros --------------------------*/
|
||||
/*=============================================================*/
|
||||
|
||||
#if (WLAN_CPU_FAMILY == WLAN_Ix86)
|
||||
#define ieee2host16(n) (n)
|
||||
#define ieee2host32(n) (n)
|
||||
#define host2ieee16(n) (n)
|
||||
#define host2ieee32(n) (n)
|
||||
#elif (WLAN_CPU_FAMILY == WLAN_PPC)
|
||||
#define ieee2host16(n) (__swab16((n)))
|
||||
#define ieee2host32(n) (__swab32((n)))
|
||||
#define host2ieee16(n) (__swab16((n)))
|
||||
#define host2ieee32(n) (__swab32((n)))
|
||||
#endif
|
||||
|
||||
#if (WLAN_OS == WLAN_LWOS)
|
||||
#define __swab16(n) \
|
||||
((UINT16) ( \
|
||||
((((UINT16)(n)) & ((UINT16)0x00ffU)) << 8 ) | \
|
||||
((((UINT16)(n)) & ((UINT16)0xff00U)) >> 8 ) ))
|
||||
#define __swab32(n) \
|
||||
((UINT32) ( \
|
||||
((((UINT32)(n)) & ((UINT32)0x000000ffUL)) << 24 ) | \
|
||||
((((UINT32)(n)) & ((UINT32)0x0000ff00UL)) << 8 ) | \
|
||||
((((UINT32)(n)) & ((UINT32)0x00ff0000UL)) >> 8 ) | \
|
||||
((((UINT32)(n)) & ((UINT32)0xff000000UL)) >> 24 ) ))
|
||||
|
||||
#define htons(n) (n)
|
||||
#define ntohs(n) (n)
|
||||
#endif
|
||||
|
||||
/*=============================================================*/
|
||||
/*--- General Macros ------------------------------------------*/
|
||||
/*=============================================================*/
|
||||
|
||||
#define wlan_max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#define wlan_min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
|
||||
/*=============================================================*/
|
||||
/*--- Variables -----------------------------------------------*/
|
||||
/*=============================================================*/
|
||||
|
||||
extern int wlan_debug;
|
||||
extern int wlan_ethconv; /* What's the default ethconv? */
|
||||
|
||||
/*=============================================================*/
|
||||
/*--- Functions -----------------------------------------------*/
|
||||
/*=============================================================*/
|
||||
|
||||
#endif /* _WLAN_COMPAT_H */
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,405 @@
|
|||
/* p80211types.c: Defines globally used types in linux-wlan
|
||||
* --------------------------------------------------------------------
|
||||
*
|
||||
* Written 1997-99 by Mark Mathews mark@absoval.com
|
||||
*
|
||||
* Copyright (c) 1999 AbsoluteValue Software, Inc.
|
||||
* http://www.absoval.com
|
||||
*
|
||||
* This software may be used and distributed according to the terms
|
||||
* of the GNU Public License, incoporated herein by reference.
|
||||
*
|
||||
* The author may be reached as mark@absoval.com, or C/O AbsoluteValue
|
||||
* Software Inc., P.O. Box 941149, Maitland, FL, 32794-1149
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* Note: Constant values are always in HOST byte order.
|
||||
*
|
||||
* --------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <wlan/wlan_compat.h>
|
||||
#include <wlan/p80211types.h>
|
||||
#include <wlan/p80211msg.h>
|
||||
|
||||
|
||||
/*====================================================================*/
|
||||
/* Item Metadata */
|
||||
/* The following array contains pointers to the metadata sections. */
|
||||
/* Each section is an array of groups, each group is an array of */
|
||||
/* metadata items. */
|
||||
/*====================================================================*/
|
||||
|
||||
extern UINT32 p80211meta_slist_size;
|
||||
|
||||
p80211meta_t **p80211meta_slist[] =
|
||||
{
|
||||
(p80211meta_t**)&p80211meta_slist_size,
|
||||
MKGRPMETANAME(dot11smt),
|
||||
MKGRPMETANAME(dot11mac),
|
||||
MKGRPMETANAME(dot11phy),
|
||||
MKGRPMETANAME(msg)
|
||||
|
||||
/* ,
|
||||
MKGRPMETANAME(linux),
|
||||
MKGRPMETANAME(am930),
|
||||
MKGRPMETANAME(hfa384x)
|
||||
*/
|
||||
};
|
||||
|
||||
UINT32 p80211meta_slist_size = sizeof(p80211meta_slist)/sizeof(p80211meta_t**);
|
||||
|
||||
|
||||
/*====================================================================*/
|
||||
/* Item enumerations */
|
||||
/* The following arrays list the numbers and names for each of the */
|
||||
/* enumerations present in the 802.11 MIB and MLME. */
|
||||
/*====================================================================*/
|
||||
|
||||
/* the following depends on the following defines:
|
||||
P80211_NOINCLUDESTRINGS - ifdef, all metadata name fields are empty strings
|
||||
*/
|
||||
|
||||
#define MKENUM(name) \
|
||||
p80211enum_t MKENUMNAME(name) = \
|
||||
{ \
|
||||
sizeof((p80211enumpair_ ## name)) / sizeof(p80211enumpair_t), \
|
||||
(p80211enumpair_ ## name) \
|
||||
}
|
||||
|
||||
#ifdef P80211_NOINCLUDESTRINGS
|
||||
#define MKENUMPAIR(n,s) { (n), ("") }
|
||||
#else
|
||||
#define MKENUMPAIR(n,s) { (n), (s) }
|
||||
#endif
|
||||
|
||||
#define MKENUMPAIRLIST(name) p80211enumpair_t p80211enumpair_ ## name [] =
|
||||
|
||||
|
||||
MKENUMPAIRLIST(truth)
|
||||
{
|
||||
MKENUMPAIR( 0, "false" ),
|
||||
MKENUMPAIR( 1, "true")
|
||||
};
|
||||
MKENUM(truth);
|
||||
|
||||
MKENUMPAIRLIST(powermgmt)
|
||||
{
|
||||
MKENUMPAIR( 1, "active" ),
|
||||
MKENUMPAIR( 2, "powersave" )
|
||||
};
|
||||
MKENUM(powermgmt);
|
||||
|
||||
MKENUMPAIRLIST(bsstype)
|
||||
{
|
||||
MKENUMPAIR( 1, "infrastructure" ),
|
||||
MKENUMPAIR( 2, "independent" ),
|
||||
MKENUMPAIR( 3, "any" )
|
||||
};
|
||||
MKENUM(bsstype);
|
||||
|
||||
MKENUMPAIRLIST(authalg)
|
||||
{
|
||||
MKENUMPAIR( 1, "opensystem" ),
|
||||
MKENUMPAIR( 2, "sharedkey" )
|
||||
};
|
||||
MKENUM(authalg);
|
||||
|
||||
MKENUMPAIRLIST(phytype)
|
||||
{
|
||||
MKENUMPAIR( 1, "fhss" ),
|
||||
MKENUMPAIR( 2, "dsss" ),
|
||||
MKENUMPAIR( 3, "irbaseband" )
|
||||
};
|
||||
MKENUM(phytype);
|
||||
|
||||
MKENUMPAIRLIST(temptype)
|
||||
{
|
||||
MKENUMPAIR( 1, "commercial" ),
|
||||
MKENUMPAIR( 2, "industrial" )
|
||||
};
|
||||
MKENUM(temptype);
|
||||
|
||||
MKENUMPAIRLIST(regdomain)
|
||||
{
|
||||
MKENUMPAIR( 0x10, "fcc" ),
|
||||
MKENUMPAIR( 0x20, "doc" ),
|
||||
MKENUMPAIR( 0x30, "etsi" ),
|
||||
MKENUMPAIR( 0x31, "spain" ),
|
||||
MKENUMPAIR( 0x32, "france" ),
|
||||
MKENUMPAIR( 0x40, "mkk" )
|
||||
};
|
||||
MKENUM(regdomain);
|
||||
|
||||
MKENUMPAIRLIST(ccamode)
|
||||
{
|
||||
MKENUMPAIR( 0x01, "edonly" ),
|
||||
MKENUMPAIR( 0x02, "csonly" ),
|
||||
MKENUMPAIR( 0x04, "edandcs" )
|
||||
};
|
||||
MKENUM(ccamode);
|
||||
|
||||
MKENUMPAIRLIST(diversity)
|
||||
{
|
||||
MKENUMPAIR( 1, "fixedlist" ),
|
||||
MKENUMPAIR( 2, "notsupported" ),
|
||||
MKENUMPAIR( 3, "dynamic" )
|
||||
};
|
||||
MKENUM(diversity);
|
||||
|
||||
MKENUMPAIRLIST(scantype)
|
||||
{
|
||||
MKENUMPAIR( 1, "active" ),
|
||||
MKENUMPAIR( 2, "passive" ),
|
||||
};
|
||||
MKENUM(scantype);
|
||||
|
||||
MKENUMPAIRLIST(resultcode)
|
||||
{
|
||||
MKENUMPAIR( 1, "success" ),
|
||||
MKENUMPAIR( 2, "invalid_parameters" ),
|
||||
MKENUMPAIR( 3, "not_supported" ),
|
||||
MKENUMPAIR( 4, "timeout" ),
|
||||
MKENUMPAIR( 5, "too_many_req" ),
|
||||
MKENUMPAIR( 6, "refused" ),
|
||||
MKENUMPAIR( 7, "bss_already" ),
|
||||
MKENUMPAIR( 8, "invalid_access" )
|
||||
};
|
||||
MKENUM(resultcode);
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* Note: the following names are from the 802.11 SDL, the comment */
|
||||
/* lists the 802.11 Chapter 7 description. */
|
||||
/*--------------------------------------------------------------------*/
|
||||
MKENUMPAIRLIST(reason)
|
||||
{
|
||||
MKENUMPAIR( 1, "unspec_reason" ),
|
||||
/* Unspecified Reason */
|
||||
MKENUMPAIR( 2, "auth_not_valid" ),
|
||||
/* Previous authentication no longer valid */
|
||||
MKENUMPAIR( 3, "deauth_lv_ss" ),
|
||||
/* Deauthenticated because sending station is leaving (has left) IBSS or ESS */
|
||||
MKENUMPAIR( 4, "inactivity" ),
|
||||
/* Disassociated due to inactivity */
|
||||
MKENUMPAIR( 5, "ap_overload" ),
|
||||
/* Disassociated because AP is unable to handle all currently associated stations */
|
||||
MKENUMPAIR( 6, "class23_err" ),
|
||||
/* Class 2 or 3 frame received from nonauthenticated station */
|
||||
MKENUMPAIR( 7, "class3_err" ),
|
||||
/* Class 3 frame received from nonassociated station */
|
||||
MKENUMPAIR( 8, "disas_lv_ss" ),
|
||||
/* Disassociated because sending station is leaving (has left BSS) */
|
||||
MKENUMPAIR( 9, "asoc_not_auth" )
|
||||
/* Station requesting (re)association is not authenticated with responding station */
|
||||
};
|
||||
MKENUM(reason);
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* Note: the following names are from the 802.11 SDL, the comment */
|
||||
/* lists the 802.11 Chapter 7 description. */
|
||||
/*--------------------------------------------------------------------*/
|
||||
MKENUMPAIRLIST(status)
|
||||
{
|
||||
MKENUMPAIR( 0, "successful" ),
|
||||
/* Successful */
|
||||
MKENUMPAIR( 1, "unspec_failure" ),
|
||||
/* Unspecified failure */
|
||||
MKENUMPAIR( 10, "unsup_cap" ),
|
||||
/* Cannot support all requested capabilities in Capability Information field */
|
||||
MKENUMPAIR( 11, "reasoc_no_asoc" ),
|
||||
/* Reassociation denied due to inability to confirm that association exists */
|
||||
MKENUMPAIR( 12, "fail_other" ),
|
||||
/* Association denied due to to reason outside scope of this standard */
|
||||
MKENUMPAIR( 13, "unspt_alg" ),
|
||||
/* Responding station does not support the specified authentication algorithm */
|
||||
MKENUMPAIR( 14, "auth_seq_fail" ),
|
||||
/* Received and authentication frame with authentication transaction sequence number out of expected sequence */
|
||||
MKENUMPAIR( 15, "chlng_fail" ),
|
||||
/* Authentication rejected because of challenge failure */
|
||||
MKENUMPAIR( 16, "auth_timeout" ),
|
||||
/* Authentication rejected due to timeout waiting for next frame in sequence */
|
||||
MKENUMPAIR( 17, "ap_full" ),
|
||||
/* Association denied because AP is unable to handle additional associated stations */
|
||||
MKENUMPAIR( 18, "unsup_rate" )
|
||||
/* Association denied due to requesting station not supporting all of the data rates in the BSSBasicRateSet parameter */
|
||||
};
|
||||
MKENUM(status);
|
||||
|
||||
|
||||
MKENUMPAIRLIST(msgcode)
|
||||
{
|
||||
MKENUMPAIR( P80211MSG_REQ_MIB_GET, "mibget"),
|
||||
MKENUMPAIR( P80211MSG_REQ_MIB_SET, "mibset"),
|
||||
MKENUMPAIR( P80211MSG_REQ_POWERMGMT, "powermgmt"),
|
||||
MKENUMPAIR( P80211MSG_REQ_SCAN, "scan"),
|
||||
MKENUMPAIR( P80211MSG_REQ_JOIN, "join"),
|
||||
MKENUMPAIR( P80211MSG_REQ_AUTHENTICATE, "authenticate"),
|
||||
MKENUMPAIR( P80211MSG_REQ_DEAUTHENTICATE, "deauthenticate"),
|
||||
MKENUMPAIR( P80211MSG_REQ_ASSOCIATE, "associate"),
|
||||
MKENUMPAIR( P80211MSG_REQ_REASSOCIATE, "reassociate"),
|
||||
MKENUMPAIR( P80211MSG_REQ_DISASSOCIATE, "disassociate"),
|
||||
MKENUMPAIR( P80211MSG_REQ_RESET, "reset"),
|
||||
MKENUMPAIR( P80211MSG_REQ_START, "start"),
|
||||
|
||||
MKENUMPAIR( P80211MSG_IND_AUTHENTICATE, "authenticate.ind"),
|
||||
MKENUMPAIR( P80211MSG_IND_DEAUTHENTICATE, "deauthenticate.ind"),
|
||||
MKENUMPAIR( P80211MSG_IND_ASSOCIATE, "associate.ind"),
|
||||
MKENUMPAIR( P80211MSG_IND_REASSOCIATE, "reassociate.ind"),
|
||||
MKENUMPAIR( P80211MSG_IND_DISASSOCIATE, "disassociate.ind"),
|
||||
};
|
||||
MKENUM(msgcode);
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* The following function definitions are for functions that */
|
||||
/* functions that convert MIB items binary represenations to/from */
|
||||
/* their textual representations. */
|
||||
/*--------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*-- DISPLAYSTR ------------------------------------------------------*/
|
||||
/* pstr ==> cstr */
|
||||
void p80211_totext_displaystr( void )
|
||||
{
|
||||
}
|
||||
|
||||
/* cstr ==> pstr */
|
||||
void p80211_fromtext_displaystr( void )
|
||||
{
|
||||
}
|
||||
|
||||
/* function that checks validity of data item's value */
|
||||
void p80211_isvalid_displaystr( void )
|
||||
{
|
||||
}
|
||||
|
||||
/*-- OCTETSTR --------------------------------------------------------*/
|
||||
/* pstr ==> "xx:xx:...." */
|
||||
void p80211_totext_octetstr( void )
|
||||
{
|
||||
}
|
||||
|
||||
/* "xx:xx:...." ==> pstr */
|
||||
void p80211_fromtext_octetstr( void )
|
||||
{
|
||||
}
|
||||
|
||||
/* function that checks validity of data item's value */
|
||||
void p80211_isvalid_octetstr( void )
|
||||
{
|
||||
}
|
||||
|
||||
/*-- BOUNDEDINT ------------------------------------------------------*/
|
||||
/* UINT32 ==> %d */
|
||||
void p80211_totext_boundedint( void )
|
||||
{
|
||||
}
|
||||
|
||||
/* %d ==> UINT32 */
|
||||
void p80211_fromtext_boundedint( void )
|
||||
{
|
||||
}
|
||||
|
||||
/* function that checks validity of data item's value */
|
||||
void p80211_isvalid_boundedint( void )
|
||||
{
|
||||
}
|
||||
|
||||
/*-- INT -------------------------------------------------------------*/
|
||||
/* UINT32 ==> %d */
|
||||
void p80211_totext_int( void )
|
||||
{
|
||||
}
|
||||
|
||||
/* %d ==> UINT32 */
|
||||
void p80211_fromtext_int( void )
|
||||
{
|
||||
}
|
||||
|
||||
/* function that checks validity of data item's value */
|
||||
void p80211_isvalid_int( void )
|
||||
{
|
||||
}
|
||||
|
||||
/*-- ENUMINT ---------------------------------------------------------*/
|
||||
/* UINT32 ==> <valuename> */
|
||||
void p80211_totext_enumint( void )
|
||||
{
|
||||
}
|
||||
|
||||
/* <valuename> ==> UINT32 */
|
||||
void p80211_fromtext_enumint( void )
|
||||
{
|
||||
}
|
||||
|
||||
/* function that checks validity of data item's value */
|
||||
void p80211_isvalid_enumint( void )
|
||||
{
|
||||
}
|
||||
|
||||
/*-- COLLECTION ------------------------------------------------------*/
|
||||
/* UINT32 ==> <valuename> */
|
||||
void p80211_totext_collection( void )
|
||||
{
|
||||
}
|
||||
|
||||
/* <valuename> ==> UINT32 */
|
||||
void p80211_fromtext_collection( void )
|
||||
{
|
||||
}
|
||||
|
||||
/* function that checks validity of data item's value */
|
||||
void p80211_isvalid_collection( void )
|
||||
{
|
||||
}
|
||||
|
||||
/*-- MIBITEM ---------------------------------------------------------*/
|
||||
/* function that checks validity of a mibitem's binary value */
|
||||
void p80211_isvalid_mibitem( void )
|
||||
{
|
||||
}
|
||||
|
||||
/* <mibvalue> ==> <textual representation identified in MIB metadata> */
|
||||
void p80211_totext_mibitem( void )
|
||||
{
|
||||
}
|
||||
|
||||
/* <textual representation identified in MIB metadata> ==> <mibvalue> */
|
||||
void p80211_fromtext_mibitem( void )
|
||||
{
|
||||
}
|
||||
|
||||
/*-- MIBDID ----------------------------------------------------------*/
|
||||
/* function that checks validity of a mibdid's binary value */
|
||||
void p80211_isvalid_mibdid( void )
|
||||
{
|
||||
}
|
||||
|
||||
/* <mib DID> ==> <mib item name> */
|
||||
void p80211_totext_mibdid( void )
|
||||
{
|
||||
}
|
||||
|
||||
/* <mib item name> ==> <mib DID> */
|
||||
void p80211_fromtext_mibdid( void )
|
||||
{
|
||||
}
|
||||
|
||||
/*-- MIBCOLLECTION ---------------------------------------------------*/
|
||||
/* function that checks validity of a mibcollection binary value */
|
||||
void p80211_isvalid_mibcollection( void )
|
||||
{
|
||||
}
|
||||
|
||||
/* <mibvalue collection> ==> <text> */
|
||||
void p80211_totext_mibcollection( void )
|
||||
{
|
||||
}
|
||||
|
||||
/* <text> ==> <mibvalue collection> */
|
||||
void p80211_fromtext_mibcollection( void )
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
all : tstmeta
|
||||
|
||||
SRCS= ../shared/p80211types.c \
|
||||
../shared/p80211metamsg.c \
|
||||
../shared/p80211metamib.c \
|
||||
tstmeta.c
|
||||
|
||||
tstmeta : ../include/wlan/p80211types.h \
|
||||
../include/wlan/p80211msg.h \
|
||||
$(SRCS)
|
||||
cc -I ../include -D__LINUX_WLAN__ -o tstmeta $(SRCS)
|
Binary file not shown.
|
@ -0,0 +1,126 @@
|
|||
/* p80211 metadata test program */
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <wlan/wlan_compat.h>
|
||||
#include <wlan/p80211types.h>
|
||||
#include <wlan/p80211msg.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int s, g, i, n, k;
|
||||
UINT32 offset;
|
||||
UINT32 nenumargs;
|
||||
UINT32 ncollargs;
|
||||
|
||||
if ( argc > 1 )
|
||||
k = atoi(argv[1]);
|
||||
else
|
||||
k = 1;
|
||||
|
||||
for ( s=k; s < GETMETASIZE(p80211meta_slist); s++)
|
||||
{
|
||||
if ( p80211meta_slist[s] != NULL )
|
||||
{
|
||||
for ( g=1; g < GETMETASIZE(p80211meta_slist[s]); g++)
|
||||
{
|
||||
if ( p80211meta_slist[s][g] != NULL )
|
||||
{
|
||||
for ( i=1; i < GETMETASIZE(p80211meta_slist[s][g]); i++)
|
||||
{
|
||||
offset = p80211meta_slist[s][g][i].msgoffset;
|
||||
printf(" name=%s\n", p80211meta_slist[s][g][i].name);
|
||||
printf(" did=0x%x\n", p80211meta_slist[s][g][i].did);
|
||||
printf(" msgoffset value=0x%x\n", offset );
|
||||
printf(" is required?=0x%x\n", P80211ITEM_ISREQUIRED(offset));
|
||||
printf(" is request?=0x%x\n", P80211ITEM_ISREQUEST(offset));
|
||||
printf(" is confirm?=0x%x\n", P80211ITEM_ISCONFIRM(offset));
|
||||
printf(" actual offset=%lu\n", P80211ITEM_GET_OFFSET(offset));
|
||||
printf(" min=%lu\n", p80211meta_slist[s][g][i].min);
|
||||
printf(" max=%lu\n", p80211meta_slist[s][g][i].max);
|
||||
printf(" maxlen=%lu\n", p80211meta_slist[s][g][i].maxlen);
|
||||
|
||||
/******* IF there's an ENUM LIST, print it *********/
|
||||
if ( P80211DID_TYPE(p80211meta_slist[s][g][i].did) == P80211_TYPE_ENUMINT )
|
||||
{
|
||||
printf(" enum list:\n");
|
||||
|
||||
nenumargs= p80211meta_slist[s][g][i].enumptr->nitems;
|
||||
|
||||
printf(" nenumargs=%lu\n", nenumargs);
|
||||
|
||||
for ( n = 0; n < nenumargs; n++)
|
||||
{
|
||||
printf(" enum value: %lu\n", p80211meta_slist[s][g][i].enumptr->list[n].val);
|
||||
printf(" enum name: %s\n", p80211meta_slist[s][g][i].enumptr->list[n].name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( p80211meta_slist[s][g][i].enumptr == NULL )
|
||||
printf(" enum list = NULL\n");
|
||||
else
|
||||
printf(" ERROR: type is not ENUMINT, yet enumptr not NULL\n");
|
||||
}
|
||||
|
||||
/******* IF there's a COLLECTION SUB-ITEM LIST, print it *********/
|
||||
if ( P80211DID_TYPE(p80211meta_slist[s][g][i].did)==P80211_TYPE_COLLECTION)
|
||||
{
|
||||
printf(" collection list:\n");
|
||||
|
||||
ncollargs = GETMETASIZE(p80211meta_slist[s][g][i].collptr);
|
||||
|
||||
printf(" ncollargs=%lu\n", ncollargs);
|
||||
|
||||
for ( n = 1; n < ncollargs; n++)
|
||||
{
|
||||
offset = p80211meta_slist[s][g][i].collptr[n].msgoffset;
|
||||
printf(" name: %s\n", p80211meta_slist[s][g][i].collptr[n].name);
|
||||
printf(" did: 0x%x\n", p80211meta_slist[s][g][i].collptr[n].did);
|
||||
printf(" msgoffset value=0x%x\n", offset );
|
||||
printf(" is required?=0x%x\n", P80211ITEM_ISREQUIRED(offset));
|
||||
printf(" is request?=0x%x\n", P80211ITEM_ISREQUEST(offset));
|
||||
printf(" is confirm?=0x%x\n", P80211ITEM_ISCONFIRM(offset));
|
||||
printf(" actual offset=%lu\n", P80211ITEM_GET_OFFSET(offset));
|
||||
printf(" min=%lu\n", p80211meta_slist[s][g][i].collptr[n].min);
|
||||
printf(" max=%lu\n", p80211meta_slist[s][g][i].collptr[n].max);
|
||||
printf(" maxlen=%lu\n", p80211meta_slist[s][g][i].collptr[n].maxlen);
|
||||
|
||||
/******* item in COLLECTION SUB-ITEM LIST is an ENUMINT type *********/
|
||||
if ( P80211DID_TYPE(p80211meta_slist[s][g][i].collptr[n].did) == P80211_TYPE_ENUMINT )
|
||||
{
|
||||
printf(" enum list:\n");
|
||||
|
||||
nenumargs= p80211meta_slist[s][g][i].collptr[n].enumptr->nitems;
|
||||
|
||||
printf(" nenumargs=%lu\n", nenumargs);
|
||||
|
||||
for ( k = 0; k < nenumargs; k++)
|
||||
{
|
||||
printf(" enum value: %lu\n", p80211meta_slist[s][g][i].collptr[n].enumptr->list[k].val);
|
||||
printf(" enum name: %s\n", p80211meta_slist[s][g][i].collptr[n].enumptr->list[k].name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( p80211meta_slist[s][g][i].collptr[n].enumptr == NULL )
|
||||
printf(" enum list = NULL\n");
|
||||
else
|
||||
printf(" ERROR: type is not ENUMINT, yet enumptr not NULL\n");
|
||||
}
|
||||
|
||||
if ( p80211meta_slist[s][g][i].collptr[n].collptr != NULL )
|
||||
{
|
||||
printf(" ERROR: it looks as though you have an embedded\n");
|
||||
printf(" collection; not expected\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
# makefile for the PRISM/AMD79C930 configuration utility
|
||||
|
||||
include ../config.mk
|
||||
|
||||
ifndef CFLAGS
|
||||
CFLAGS = -O2 -Wall -Wstrict-prototypes -Winline -pipe -D__LINUX_WLAN__
|
||||
endif
|
||||
|
||||
CPPFLAGS = -I../include -I$(LINUX)/include
|
||||
|
||||
|
||||
SRCS = main.c prmib.c
|
||||
|
||||
|
||||
wlanctl: main.o prmib.o
|
||||
cc -o wlanctl main.o prmib.o
|
||||
|
||||
install:
|
||||
cp -p wlanctl $(INST_EXEDIR)
|
||||
|
||||
clean:
|
||||
rm -f core core.* *.o .*.o *.s *.a .depend tmp_make *~
|
||||
|
|
@ -0,0 +1,744 @@
|
|||
/* main.c: Entry point for the wlanctl program
|
||||
* --------------------------------------------------------------------
|
||||
* Linux WLAN
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The initial developer of the original code is Mark S. Mathews
|
||||
* <mark@absoval.com>. Portions created by Mark S. Mathews
|
||||
* are Copyright (C) 1998 AbsoluteValue Software, Inc. All Rights Reserved.
|
||||
* Copyright (c) 1999 AbsoluteValue Software, Inc.
|
||||
* http://www.absoval.com
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* --------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Ugly hack for LinuxPPC R4, don't have time to figure it out right now */
|
||||
#if defined(_ARCH_PPC)
|
||||
#undef __GLIBC__
|
||||
#endif
|
||||
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <wlan/version.h>
|
||||
#include <wlan/wlan_compat.h>
|
||||
#include <wlan/am930mib.h>
|
||||
#include <wlan/wlan_ioctl.h>
|
||||
#include "wlanctl.h"
|
||||
#include "prmib.h"
|
||||
|
||||
int getmib( int fd, char *interface, UINT32 mibcode );
|
||||
void pr_netlist(wlan_netlist_t *list);
|
||||
int process_bsscreate( int fd, int argc, char **argv );
|
||||
int process_bssjoin( int fd, int argc, char **argv );
|
||||
int process_getmib( int fd, int argc, char **argv );
|
||||
int process_netlist( int fd, int argc, char **argv );
|
||||
int process_scan( int fd, int argc, char **argv );
|
||||
void strtoUINT48( UINT8 *a, char *s );
|
||||
void usage(void);
|
||||
|
||||
char appname[MAX_APPNAME_LEN + 1];
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int result = 0;
|
||||
int fd;
|
||||
wlan_req_t req;
|
||||
|
||||
strcpy( appname, APPNAME );
|
||||
|
||||
if ( argc >= 2 )
|
||||
{
|
||||
|
||||
if ( strcasecmp(argv[1], "version") == 0 )
|
||||
{
|
||||
printf("%s version " WLAN_RELEASE "\n", appname);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* get a socket */
|
||||
fd = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if ( fd != -1 )
|
||||
{
|
||||
/* Test that there is a card */
|
||||
strcpy( req.name, argv[1]);
|
||||
req.result = 0;
|
||||
req.data = NULL;
|
||||
req.len = 0;
|
||||
result = ioctl( fd, WLAN_TEST, &req);
|
||||
|
||||
if (result < 0)
|
||||
{
|
||||
fprintf(stderr, "%s: ioctl failed testing interface \'%s\'\n",
|
||||
appname, argv[1]);
|
||||
fprintf(stderr, "interface \'%s\' is probably an invalid wireless network interface name\n", argv[1] );
|
||||
fprintf(stderr, "OR a wireless card is not inserted in the specified interface\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( req.result == 0xf0f0 )
|
||||
{
|
||||
/* now, what does the user want? */
|
||||
if ( argc > 2 )
|
||||
{
|
||||
/* ok, there's more arguments */
|
||||
if ( strcasecmp(argv[2], SCAN) == 0 )
|
||||
{
|
||||
result = process_scan(fd, argc, argv);
|
||||
}
|
||||
else if ( strcasecmp(argv[2], NETLIST) == 0 )
|
||||
{
|
||||
result = process_netlist(fd, argc, argv);
|
||||
}
|
||||
else if ( strcasecmp(argv[2], BSSCREATE) == 0 )
|
||||
{
|
||||
result = process_bsscreate(fd, argc, argv);
|
||||
}
|
||||
else if ( strcasecmp(argv[2], BSSJOIN) == 0 )
|
||||
{
|
||||
result = process_bssjoin(fd, argc, argv);
|
||||
}
|
||||
else if ( strcasecmp(argv[2], GETMIB) == 0 )
|
||||
{
|
||||
result = process_getmib(fd, argc, argv);
|
||||
}
|
||||
else if ( strcasecmp(argv[2], "getmibitem") == 0 )
|
||||
{
|
||||
fprintf(stderr, "%s: cmd currently unsupported\n",
|
||||
appname);
|
||||
}
|
||||
else if ( strcasecmp(argv[2], "setmibitem") == 0 )
|
||||
{
|
||||
fprintf(stderr, "%s: cmd currently unsupported\n",
|
||||
appname);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "%s: %s is an invalid command\n",
|
||||
appname, argv[2]);
|
||||
usage();
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* ok, we just want a general status msg */
|
||||
/* maybe some stats, joined?, ESSID, BSSID etc. */
|
||||
printf("some general stats\n");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr,"%s: ioctl successful but driver not responding!\n", appname);
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "%s: No appropriate sockets!\n", appname);
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
usage();
|
||||
result = 1;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------
|
||||
* getmib
|
||||
*
|
||||
* Called by process_getmib when the user has specified the 'getmib'
|
||||
* command on the command line.
|
||||
*
|
||||
* This function does the actual read the contents of one or more Managment
|
||||
* Information Block (MIB) structures from the specified wireless
|
||||
* network device and display the values. Issuing just the getmib
|
||||
* command to wlanctl displays ALL MIB's. Otherwise, a particular
|
||||
* MIB is specified following the getmib command.
|
||||
*
|
||||
* Valid MIB values are:
|
||||
* 0x00 for local mib
|
||||
* 0x02 for address mib
|
||||
* 0x03 for mac (media access control) mib
|
||||
* 0x04 for statistics mib
|
||||
* 0x05 for managment mib
|
||||
* 0x07 for physical mib
|
||||
* Arguments:
|
||||
* fd - socket file descriptor
|
||||
* argc - the argument count passed to main
|
||||
* argv - the argument list passed to main
|
||||
*
|
||||
* returns: 0 if successful, not 0 otherwise
|
||||
*
|
||||
----------------------------------------------------------------*/
|
||||
int getmib( int fd, char *interface, UINT32 mibcode )
|
||||
{
|
||||
wlan_req_t req;
|
||||
wlan_getmib_t mib;
|
||||
int result;
|
||||
|
||||
strcpy( req.name, interface);
|
||||
req.len = sizeof(wlan_getmib_t);
|
||||
req.data = &mib;
|
||||
req.result = 0;
|
||||
mib.mibcode = mibcode;
|
||||
|
||||
result = 0;
|
||||
|
||||
switch (mibcode)
|
||||
{
|
||||
case SUMIB_LOCAL:
|
||||
if ( (result = ioctl( fd, WLAN_GETMIB, &req)) == 0 )
|
||||
{
|
||||
prlocalmib( &mib.data.local );
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "%s: ioctl failed for mibcode 0x%02lx.\n", appname, mibcode);
|
||||
}
|
||||
break;
|
||||
case SUMIB_ADDR:
|
||||
if ( (result = ioctl( fd, WLAN_GETMIB, &req)) == 0 )
|
||||
{
|
||||
praddrmib( &mib.data.addr );
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "%s: ioctl failed for mibcode 0x%02lx.\n", appname, mibcode);
|
||||
}
|
||||
break;
|
||||
case SUMIB_MAC:
|
||||
if ( (result = ioctl( fd, WLAN_GETMIB, &req)) == 0 )
|
||||
{
|
||||
prmacmib( &mib.data.mac );
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "%s: ioctl failed for mibcode 0x%02lx.\n", appname, mibcode);
|
||||
}
|
||||
break;
|
||||
case SUMIB_STAT:
|
||||
if ( (result = ioctl( fd, WLAN_GETMIB, &req)) == 0 )
|
||||
{
|
||||
prstatsmib( &mib.data.stats );
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "%s: ioctl failed for mibcode 0x%02lx.\n", appname, mibcode);
|
||||
}
|
||||
break;
|
||||
case SUMIB_MGMT:
|
||||
if ( (result = ioctl( fd, WLAN_GETMIB, &req)) == 0 )
|
||||
{
|
||||
prmgmtmib( &mib.data.mgmt );
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "%s: ioctl failed for mibcode 0x%02lx.\n", appname, mibcode);
|
||||
}
|
||||
break;
|
||||
case SUMIB_PHY:
|
||||
if ( (result = ioctl( fd, WLAN_GETMIB, &req)) == 0 )
|
||||
{
|
||||
prphymib( &mib.data.phy );
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "%s: ioctl failed for mibcode 0x%02lx.\n", appname, mibcode);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "%s: invalid mibcode of 0x%02lx.\n", appname, mibcode);
|
||||
result = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------
|
||||
* usage
|
||||
*
|
||||
* This function displays the proper syntax of the wlanctl utility.
|
||||
*
|
||||
* Arguments:
|
||||
* no arguments
|
||||
*
|
||||
* returns: function doesn't return anything
|
||||
*
|
||||
----------------------------------------------------------------*/
|
||||
void usage(void)
|
||||
{
|
||||
printf("\n%s : control utility for am79C930 based DS wlan cards\n", appname);
|
||||
printf(" usage: %s interface|version [cmd [cmdarg ...]]\n\n", appname);
|
||||
printf(" where \"interface\" is the name of a wireless\n");
|
||||
printf(" network interface. Running 'ifconfig' will list\n");
|
||||
printf(" all network interfaces.\n\n");
|
||||
printf(" Refer to wlanctl man page for more details.\n\n");
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------
|
||||
* strtoUINT48
|
||||
*
|
||||
* This function converts a character string that represents an
|
||||
* IEEE 802 address into an unsigned 48 bit number.
|
||||
*
|
||||
* Arguments:
|
||||
* a - IEEE 802 48 bit address
|
||||
* s - character string representing a 48 bit IEEE 802 address
|
||||
*
|
||||
* returns: function doesn't return anything
|
||||
*
|
||||
----------------------------------------------------------------*/
|
||||
void strtoUINT48( UINT8 *a, char *s )
|
||||
{
|
||||
char *p;
|
||||
int i;
|
||||
UINT val;
|
||||
|
||||
for ( i = 0; i < 5; i++)
|
||||
{
|
||||
p = strchr( s, ':');
|
||||
if ( p == NULL )
|
||||
{
|
||||
fprintf(stderr, "%s: UINT48 format error!\n", appname);
|
||||
exit(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
*p = '\0';
|
||||
sscanf( s, "%x", &val);
|
||||
a[i] = (UINT8)val;
|
||||
s = p+1;
|
||||
}
|
||||
}
|
||||
sscanf( s, "%x", &val);
|
||||
a[i] = (UINT8)val;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------
|
||||
* pr_netlist
|
||||
*
|
||||
* Called when the user has requested the 'netlist' command at the
|
||||
* command line.
|
||||
*
|
||||
* This function will traverse the list of BSS's in the network
|
||||
* list and print the channel, the bssid, the beacon interval,
|
||||
* the capabilities information, and the ssid for each BSS.
|
||||
*
|
||||
* Arguments:
|
||||
* list - network list containing all current BSS's
|
||||
*
|
||||
*
|
||||
* returns: function doesn't return anything
|
||||
*
|
||||
----------------------------------------------------------------*/
|
||||
void pr_netlist(wlan_netlist_t *list)
|
||||
{
|
||||
int i;
|
||||
char buf[80];
|
||||
wlan_ie_ssid_t *ie;
|
||||
|
||||
for ( i = 0; i < list->nitems; i++)
|
||||
{
|
||||
printf("ch bssid bcn cap_info ssid\n");
|
||||
printf("------------------------------------------------------\n");
|
||||
printf("%02d ", list->netlist[i].channel);
|
||||
mac2str( list->netlist[i].bssid, buf);
|
||||
printf("%s ", buf);
|
||||
printf("%04d ", list->netlist[i].bcn_int);
|
||||
printf("0x%04x ", list->netlist[i].cap_info);
|
||||
ie = (wlan_ie_ssid_t*)list->netlist[i].ssid;
|
||||
memcpy(buf, ie->ssid, ie->len);
|
||||
buf[ie->len] = '\0';
|
||||
printf("%s\n", buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------
|
||||
* process_scan
|
||||
*
|
||||
* Called when the user has requested the 'scan' command at the
|
||||
* command line.
|
||||
*
|
||||
* This function will scan the range of channels beginning and
|
||||
* ending with "start" channel and "end" channel repsectively
|
||||
* for the specified basic service set id (BSSID). The user
|
||||
* must specify the starting and ending channels to scan, how
|
||||
* long to scan on each channel, what BSS to scan for, the BSS
|
||||
* type and the scan type.
|
||||
*
|
||||
* When complete, issuing the "netlist" command will display the
|
||||
* list of BSS's found as a result of the scan.
|
||||
*
|
||||
* Arguments:
|
||||
* fd - socket file descriptor
|
||||
* argc - the argument count passed to main
|
||||
* argv - the argument list passed to main
|
||||
*
|
||||
* The arguments for the wlanctl scan command as they should appear
|
||||
* on the command line in the following order are:
|
||||
* name - name of wireless network interface
|
||||
* cmd - wlanctl command being called, in this case, it is 'scan'
|
||||
* startch - first channel to start scan
|
||||
* endch - last channel to scan
|
||||
* timech - time, in microseconds, to scan each channel
|
||||
* bssid - a colon separated IEEE 802 address indicating which
|
||||
* bss to scan for. An address of ff:ff:ff:ff:ff:ff
|
||||
* scans for ALL bss's.
|
||||
* bsstype - specifies the type of bss to scan for. Valid values
|
||||
* are "ind", "infr" or both, where "ind" is an independent
|
||||
* bss, namely funtioning in ad-hoc mode, and "infr" is
|
||||
* an infrastructure bss, namely we're scanning for access points.
|
||||
* Note that both "ind" and "infr" bss's can be operable
|
||||
* simultaneously; hence, the scan for "both".
|
||||
* scantype - specifies the type of scan to perform: active or passive
|
||||
* active - sends out probe requests expecting a probe response
|
||||
* passive - listens for beacons without sending probe requests
|
||||
*
|
||||
* returns: 0 if successful, not 0 otherwise
|
||||
*
|
||||
----------------------------------------------------------------*/
|
||||
int process_scan( int fd, int argc, char **argv )
|
||||
{
|
||||
int result;
|
||||
|
||||
result = 0;
|
||||
|
||||
if ( argc < 9 )
|
||||
{
|
||||
fprintf(stderr, "%s: not enough arguments for scan command; ",
|
||||
appname);
|
||||
fprintf(stderr, "see wlanctl man page.\n");
|
||||
usage();
|
||||
}
|
||||
else
|
||||
{
|
||||
wlan_req_t req;
|
||||
wlan_scan_t cmd;
|
||||
|
||||
strcpy( req.name, argv[1]);
|
||||
req.result = 0;
|
||||
req.data = &cmd;
|
||||
req.len = sizeof(cmd);
|
||||
cmd.startch = atoi( argv[3] );
|
||||
cmd.endch = atoi( argv[4] );
|
||||
cmd.timech = atoi( argv[5] );
|
||||
strtoUINT48( cmd.bssid, argv[6] );
|
||||
|
||||
if (strcmp(argv[7], "both") == 0 )
|
||||
{
|
||||
cmd.bsstype = BSSTYPE_IND | BSSTYPE_INFRA;
|
||||
}
|
||||
else if ( strcmp(argv[7], "independent") == 0 )
|
||||
{
|
||||
cmd.bsstype = BSSTYPE_IND;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd.bsstype = BSSTYPE_INFRA;
|
||||
}
|
||||
|
||||
if ( strcmp( argv[8], "active") == 0 )
|
||||
{
|
||||
cmd.scantype = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd.scantype = 1;
|
||||
}
|
||||
|
||||
result = ioctl( fd, WLAN_SCAN, &req);
|
||||
|
||||
switch( req.result)
|
||||
{
|
||||
case 0:
|
||||
printf("%s: scan begun\n", appname);
|
||||
break;
|
||||
case 1:
|
||||
fprintf(stderr, "%s: command discarded, driver is already scanning\n", appname);
|
||||
break;
|
||||
case 2:
|
||||
fprintf(stderr, "%s: h/w scan command failed!\n", appname);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "%s: unknown error.\n", appname);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------
|
||||
* process_getmib
|
||||
*
|
||||
* Called when the user has requested the 'getmib' command at the
|
||||
* command line.
|
||||
*
|
||||
* This function calls getmib to read the contents of one or more
|
||||
* Managment Information Block (MIB) structures from the specified
|
||||
* wireless network device and display the values. Issuing just the
|
||||
* getmib command to wlanctl displays ALL MIB's. Otherwise, a
|
||||
* particular MIB(s) is specified following the getmib command.
|
||||
*
|
||||
* Valid MIB values are:
|
||||
* 0x00 for local mib
|
||||
* 0x02 for address mib
|
||||
* 0x03 for mac (media access control) mib
|
||||
* 0x04 for statistics mib
|
||||
* 0x05 for managment mib
|
||||
* 0x07 for physical mib
|
||||
* Arguments:
|
||||
* fd - socket file descriptor
|
||||
* argc - the argument count passed to main
|
||||
* argv - the argument list passed to main
|
||||
*
|
||||
* returns: 0 if successful, not 0 otherwise
|
||||
*
|
||||
----------------------------------------------------------------*/
|
||||
int process_getmib( int fd, int argc, char **argv )
|
||||
{
|
||||
int result;
|
||||
|
||||
result = 0;
|
||||
|
||||
/* ok, which mib's? */
|
||||
if ( argc >= 4 )
|
||||
{
|
||||
int i;
|
||||
UINT32 mibcode;
|
||||
|
||||
for ( i = 3; i < argc; i++ )
|
||||
{
|
||||
mibcode = atoi(argv[i]);
|
||||
result = getmib( fd, argv[1], mibcode );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* OK, print them all */
|
||||
result = getmib( fd, argv[1], SUMIB_LOCAL);
|
||||
result = getmib( fd, argv[1], SUMIB_ADDR);
|
||||
result = getmib( fd, argv[1], SUMIB_MAC);
|
||||
result = getmib( fd, argv[1], SUMIB_STAT);
|
||||
result = getmib( fd, argv[1], SUMIB_MGMT);
|
||||
result = getmib( fd, argv[1], SUMIB_PHY);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------
|
||||
* process_netlist
|
||||
*
|
||||
* Called when the user has requested the 'netlist' command at the
|
||||
* command line.
|
||||
*
|
||||
* This function prints all the BSS's in the current list of BSS's
|
||||
* generated from the last scan.
|
||||
*
|
||||
* Arguments:
|
||||
* fd - socket file descriptor
|
||||
* argc - the argument count passed to main
|
||||
* argv - the argument list passed to main
|
||||
*
|
||||
* returns: 0 if successful, not 0 otherwise
|
||||
*
|
||||
----------------------------------------------------------------*/
|
||||
int process_netlist( int fd, int argc, char **argv )
|
||||
{
|
||||
int result;
|
||||
wlan_req_t req;
|
||||
wlan_netlist_len_t cmd1;
|
||||
wlan_netlist_t *cmd2;
|
||||
|
||||
result = 0;
|
||||
strcpy( req.name, argv[1]);
|
||||
req.result = 0;
|
||||
req.data = &cmd1;
|
||||
req.len = sizeof(cmd1);
|
||||
result = ioctl( fd, WLAN_NETLIST_LEN, &req);
|
||||
|
||||
if ( result || req.result )
|
||||
{
|
||||
fprintf(stderr,"%s: ioctl failed in netlist_len command.\n", appname);
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd2 = malloc( sizeof(wlan_netlist_t) + (cmd1.nitems * sizeof(netitem_t)));
|
||||
cmd2->nitems = cmd1.nitems;
|
||||
req.result = 0;
|
||||
req.data = cmd2;
|
||||
req.len = sizeof(wlan_netlist_t) + (cmd1.nitems * sizeof(netitem_t));
|
||||
result = ioctl( fd, WLAN_NETLIST, &req);
|
||||
|
||||
if ( result || req.result )
|
||||
{
|
||||
fprintf(stderr,"%s: ioctl failed in netlist command\n", appname);
|
||||
}
|
||||
else
|
||||
{
|
||||
pr_netlist( cmd2 );
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------
|
||||
* process_bsscreate
|
||||
*
|
||||
* Called when the user has requested the 'bsscreate' command at the
|
||||
* command line.
|
||||
*
|
||||
* This function creates a BSS based on the arguments passed to the
|
||||
* command. The arguments are in the order that follows:
|
||||
* channel - the channel number to establish the bss on.
|
||||
* beacon interval - time (in microseconds) between the
|
||||
* transmission of beacon frames in the new BSS.
|
||||
* atim window - "Announcement Traffic Indication Message"
|
||||
* The atim window is the period of time following a target
|
||||
* beacon transmission time (TBTT) that power saving MAC
|
||||
* entities should remain awake listening for atim frames.
|
||||
* Units for the atim window are 1024 microseconds.
|
||||
* ssid - "Service Set Identifier": a string (with a maximum
|
||||
* length of 15 characters) that identifies the new BSS.
|
||||
* This is not to be confused with the BSSID, namely the
|
||||
* IEEE 802 48 bit address.
|
||||
*
|
||||
* Arguments:
|
||||
* fd - socket file descriptor
|
||||
* argc - the argument count passed to main
|
||||
* argv - the argument list passed to main
|
||||
*
|
||||
* returns: 0 if successful, not 0 otherwise
|
||||
*
|
||||
----------------------------------------------------------------*/
|
||||
int process_bsscreate( int fd, int argc, char **argv )
|
||||
{
|
||||
int result;
|
||||
|
||||
result = 0;
|
||||
|
||||
if (argc < 7)
|
||||
{
|
||||
fprintf(stderr,"%s: not enough arguments for bsscreate command; ",
|
||||
appname);
|
||||
fprintf(stderr, "see wlanctl man page.\n");
|
||||
usage();
|
||||
}
|
||||
else
|
||||
{
|
||||
wlan_req_t req;
|
||||
wlan_bsscreate_t cmd;
|
||||
|
||||
strcpy( req.name, argv[1]);
|
||||
req.result = 0;
|
||||
req.data = &cmd;
|
||||
req.len = sizeof(cmd);
|
||||
cmd.channel = atoi(argv[3]);
|
||||
cmd.beacon_int = atoi(argv[4]);
|
||||
cmd.atim_win = atoi(argv[5]);
|
||||
cmd.ssid[0] = WLAN_EID_SSID;
|
||||
cmd.ssid[1] = strlen(argv[6]);
|
||||
strcpy( &(cmd.ssid[2]), argv[6]);
|
||||
result = ioctl( fd, WLAN_BSSCREATE, &req);
|
||||
|
||||
if ( result )
|
||||
{
|
||||
fprintf(stderr,"%s: ioctl failed for bsscreate command.\n",
|
||||
appname);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------
|
||||
* process_bssjoin
|
||||
*
|
||||
* Called when the user has requested the 'bssjoin' command at the
|
||||
* command line.
|
||||
*
|
||||
* This function forces the wireless network device to join
|
||||
* (syncronize) with the named BSS. The named BSS provided as an
|
||||
* argument to the bssjoin command must be a valid BSS in the
|
||||
* network list.
|
||||
*
|
||||
* Arguments:
|
||||
* fd - socket file descriptor
|
||||
* argc - the argument count passed to main
|
||||
* argv - the argument list passed to main
|
||||
*
|
||||
* returns: 0 if successful, not 0 otherwise
|
||||
*
|
||||
----------------------------------------------------------------*/
|
||||
int process_bssjoin( int fd, int argc, char **argv )
|
||||
{
|
||||
int result;
|
||||
wlan_req_t req;
|
||||
wlan_bssjoin_t cmd;
|
||||
|
||||
result = 0;
|
||||
|
||||
if ( argc < 4 )
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: not enough arguments for the bssjoin command; ", appname);
|
||||
fprintf(stderr, "see wlanctl man page.\n");
|
||||
usage();
|
||||
result = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy( req.name, argv[1]);
|
||||
req.result = 0;
|
||||
req.data = &cmd;
|
||||
req.len = sizeof(cmd);
|
||||
strtoUINT48( cmd.bssid, argv[3] );
|
||||
|
||||
result = ioctl( fd, WLAN_BSSJOIN, &req);
|
||||
|
||||
if ( req.result )
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: Either the bssid was invalid or the sync command failed.\n",
|
||||
appname);
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
|
@ -0,0 +1,335 @@
|
|||
/*
|
||||
|
||||
|
||||
Linux WLAN
|
||||
|
||||
The contents of this file are subject to the Mozilla Public
|
||||
License Version 1.0 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
The initial developer of the original code is Mark S. Mathews
|
||||
<mark@absoval.com>. Portions created by Mark S. Mathews
|
||||
are Copyright (C) 1998 AbsoluteValue Software, Inc. All Rights Reserved.
|
||||
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <wlan/wlan_compat.h>
|
||||
#include <wlan/am930mib.h>
|
||||
#include <wlan/wlan_ioctl.h>
|
||||
#include "prmib.h"
|
||||
|
||||
void mac2str( UINT8 *ma, char *str)
|
||||
{
|
||||
sprintf( str, "%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
ma[0], ma[1], ma[2], ma[3], ma[4], ma[5]);
|
||||
}
|
||||
|
||||
void prlocalmib( su_mib_local_t *mib )
|
||||
{
|
||||
char tmp[18];
|
||||
printf("LOCAL MIB:\n");
|
||||
sprintf( tmp, "0x%02x", mib->frag_disable);
|
||||
printf("%20s: %-16s ", "frag_dis", tmp);
|
||||
sprintf( tmp, "0x%02x", mib->add_plcp_disable);
|
||||
printf("%20s: %-16s\n", "add_plcp_dis", tmp);
|
||||
|
||||
sprintf( tmp, "0x%02x", mib->add_plcp_disable);
|
||||
printf("%20s: %-16s ", "add_plcp_disable", tmp);
|
||||
sprintf( tmp, "0x%02x", mib->mac_hdr_preserve);
|
||||
printf("%20s: %-16s\n", "mac_hdr_preserve", tmp);
|
||||
|
||||
sprintf( tmp, "0x%02x", mib->rx_mgmt_q_enable);
|
||||
printf("%20s: %-16s ", "rx_mgmt_q_enable", tmp);
|
||||
|
||||
sprintf( tmp, "0x%02x", mib->reassembly_disable);
|
||||
printf("%20s: %-16s ", "reassembly_disable", tmp);
|
||||
sprintf( tmp, "0x%02x", mib->strip_plcp_disable);
|
||||
printf("%20s: %-16s\n", "strip_plcp_disable", tmp);
|
||||
|
||||
sprintf( tmp, "0x%02x", mib->rx_error_disable);
|
||||
printf("%20s: %-16s ", "rx_error_disable", tmp);
|
||||
sprintf( tmp, "0x%02x", mib->power_save_mode_disable);
|
||||
printf("%20s: %-16s\n", "pwr_save_mode_dis", tmp);
|
||||
|
||||
sprintf( tmp, "0x%02x", mib->accept_all_multicast_disable);
|
||||
printf("%20s: %-16s ", "accept_all_multi_dis", tmp);
|
||||
sprintf( tmp, "0x%02x", mib->check_seq_cntl_disable);
|
||||
printf("%20s: %-16s\n", "chk_seq_cntl_dis", tmp);
|
||||
|
||||
/* sprintf( tmp, "0x%02x", mib->loopback);
|
||||
printf("%20s: %-16s ", "loopback", tmp);
|
||||
*/
|
||||
sprintf( tmp, "0x%02x", mib->network_mode);
|
||||
printf("%20s: %-16s\n", "network_mode", tmp);
|
||||
|
||||
sprintf( tmp, "0x%02x", mib->pwd_level);
|
||||
printf("%20s: %-16s ", "pwd_level", tmp);
|
||||
/* sprintf( tmp, "0x%02x", mib->phy_type);
|
||||
printf("%20s: %-16s\n", "phy_type", tmp);
|
||||
*/
|
||||
sprintf( tmp, "0x%04lx", mib->tx_buffer_offset);
|
||||
printf("%20s: %-16s ", "tx_buffer_offset", tmp);
|
||||
sprintf( tmp, "0x%04lx", mib->tx_buffer_size);
|
||||
printf("%20s: %-16s\n", "tx_buffer_size", tmp);
|
||||
|
||||
sprintf( tmp, "0x%04lx", mib->rx_buffer_offset);
|
||||
printf("%20s: %-16s ", "rx_buffer_offset", tmp);
|
||||
sprintf( tmp, "0x%04lx", mib->rx_buffer_size);
|
||||
printf("%20s: %-16s\n", "rx_buffer_size", tmp);
|
||||
}
|
||||
|
||||
void prstatsmib( su_mib_mac_statistics_t *mib )
|
||||
{
|
||||
char tmp[18];
|
||||
printf("STATISTICS MIB:\n");
|
||||
sprintf( tmp, "%lud", mib->tx_mpdu_cnt);
|
||||
printf("%20s: %-16s ", "tx_mpdu_cnt", tmp);
|
||||
sprintf( tmp, "%lud", mib->tx_msdu_cnt);
|
||||
printf("%20s: %-16s\n", "tx_msdu_cnt", tmp);
|
||||
|
||||
sprintf( tmp, "%lud", mib->tx_octets_cnt);
|
||||
printf("%20s: %-16s ", "tx_octets_cnt", tmp);
|
||||
sprintf( tmp, "%ud", mib->tx_multicast_cnt);
|
||||
printf("%20s: %-16s\n", "tx_multicast_cnt", tmp);
|
||||
|
||||
sprintf( tmp, "%ud", mib->tx_broadcast_cnt);
|
||||
printf("%20s: %-16s ", "tx_broadcast_cnt", tmp);
|
||||
sprintf( tmp, "%lud", mib->failed_cnt);
|
||||
printf("%20s: %-16s\n", "failed_cnt", tmp);
|
||||
|
||||
sprintf( tmp, "%lud", mib->retry_cnt);
|
||||
printf("%20s: %-16s ", "retry_cnt", tmp);
|
||||
sprintf( tmp, "%lud", mib->multiple_retry_cnt);
|
||||
printf("%20s: %-16s\n", "multiple_retry_cnt", tmp);
|
||||
|
||||
sprintf( tmp, "%lud", mib->frame_dup_cnt);
|
||||
printf("%20s: %-16s ", "frame_dup_cnt", tmp);
|
||||
sprintf( tmp, "%lud", mib->rts_success_cnt);
|
||||
printf("%20s: %-16s\n", "rts_success_cnt", tmp);
|
||||
|
||||
sprintf( tmp, "%lud", mib->rts_failure_cnt);
|
||||
printf("%20s: %-16s ", "rts_failure_cnt", tmp);
|
||||
sprintf( tmp, "%lud", mib->ack_failure_cnt);
|
||||
printf("%20s: %-16s\n", "ack_failure_cnt", tmp);
|
||||
|
||||
sprintf( tmp, "%lud", mib->rx_frame_cnt);
|
||||
printf("%20s: %-16s ", "rx_frame_cnt", tmp);
|
||||
sprintf( tmp, "%lud", mib->rx_octets_cnt);
|
||||
printf("%20s: %-16s\n", "rx_octets_cnt", tmp);
|
||||
|
||||
sprintf( tmp, "%ud", mib->rx_multicast_cnt);
|
||||
printf("%20s: %-16s ", "rx_multicast_cnt", tmp);
|
||||
sprintf( tmp, "%ud", mib->rx_broadcast_cnt);
|
||||
printf("%20s: %-16s\n", "rx_broadcast_cnt", tmp);
|
||||
|
||||
sprintf( tmp, "%lud", mib->fcs_error_cnt);
|
||||
printf("%20s: %-16s ", "fcs_error_cnt", tmp);
|
||||
sprintf( tmp, "%lud", mib->error_cnt);
|
||||
printf("%20s: %-16s\n", "error_cnt", tmp);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void praddrmib( su_mib_mac_addr_stat_grp_t *mib )
|
||||
{
|
||||
char tmp[40];
|
||||
int i;
|
||||
|
||||
printf("ADDRESS MIB:\n");
|
||||
|
||||
mac2str( mib->mac_address, tmp);
|
||||
printf("%20s: %-16s\n", "mac_address", tmp);
|
||||
for ( i = 0; i < SUMIB_MAX_GRP_ADDR; i+=2)
|
||||
{
|
||||
mac2str( mib->group_addresses[i], tmp);
|
||||
printf("%17s[%1d]: %-16s ", "grp_addr", i, tmp);
|
||||
mac2str( mib->group_addresses[i+1], tmp);
|
||||
printf("%17s[%1d]: %-16s\n", "grp_addr", i + 1, tmp);
|
||||
}
|
||||
sprintf(tmp, "0x%02x", mib->tx_enable_status);
|
||||
printf("%20s: %-16s\n", "tx_ena_status", tmp);
|
||||
/* sprintf(tmp, "0x%02x", mib->promisc);
|
||||
printf("%20s: %-16s\n", "promiscuous_status", tmp);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void prmacmib( su_mib_mac_t *mib )
|
||||
{
|
||||
char tmp[80];
|
||||
|
||||
printf("MAC MIB:\n");
|
||||
|
||||
/*
|
||||
sprintf(tmp, "%ud", mib->rate_factor);
|
||||
printf( "%20s: %-16s ", "rate_factor", tmp);
|
||||
sprintf(tmp, "%ud", mib->handshake_overhead);
|
||||
printf( "%20s: %-16s\n", "handshake_overhead", tmp);
|
||||
*/
|
||||
|
||||
sprintf(tmp, "%ud", mib->rts_threshold);
|
||||
printf( "%20s: %-16s ", "rts_threshold", tmp);
|
||||
sprintf(tmp, "%ud", mib->cw_max);
|
||||
printf( "%20s: %-16s\n", "cw_max", tmp);
|
||||
|
||||
sprintf(tmp, "%ud", mib->cw_min);
|
||||
printf("%20s: %-16s ", "cw_min", tmp);
|
||||
/* sprintf(tmp, "%ud", mib->cts_time);
|
||||
printf("%20s: %-16s\n", "cts_time", tmp);
|
||||
*/
|
||||
|
||||
/*
|
||||
sprintf(tmp, "%ud", mib->ack_time);
|
||||
printf("%20s: %-16s ", "ack_time", tmp);
|
||||
sprintf(tmp, "%ud", mib->ack_timeout);
|
||||
printf("%20s: %-16s\n", "ack_timeout", tmp);
|
||||
|
||||
sprintf(tmp, "%ud", mib->cts_timeout);
|
||||
printf("%20s: %-16s ", "cts_timeout", tmp);
|
||||
*/
|
||||
sprintf(tmp, "%ud", mib->short_retry_limit);
|
||||
printf("%20s: %-16s\n", "short_retry_limit", tmp);
|
||||
|
||||
sprintf(tmp, "%ud", mib->long_retry_limit);
|
||||
printf("%20s: %-16s ", "long_retry_limit", tmp);
|
||||
sprintf(tmp, "%ud", mib->max_frame_length);
|
||||
printf("%20s: %-16s\n", "max_frame_length", tmp);
|
||||
|
||||
sprintf(tmp, "%ud", mib->fragmentation_threshold);
|
||||
printf("%20s: %-16s ", "frag_threshold", tmp);
|
||||
sprintf(tmp, "%ud", mib->probe_delay);
|
||||
printf("%20s: %-16s\n", "probe_delay", tmp);
|
||||
|
||||
sprintf(tmp, "%ud", mib->min_probe_response_time);
|
||||
printf("%20s: %-16s ", "min_probe_resp_time", tmp);
|
||||
sprintf(tmp, "%ud", mib->max_probe_response_time);
|
||||
printf("%20s: %-16s\n", "max_probe_resp_time", tmp);
|
||||
|
||||
sprintf(tmp, "%lud", mib->max_tx_msdu_lifetime);
|
||||
printf("%20s: %-16s ", "max_tx_msdu_lifetime", tmp);
|
||||
sprintf(tmp, "%lud", mib->max_rx_msdu_lifetime);
|
||||
printf("%20s: %-16s\n", "max_rx_msdu_lifetime", tmp);
|
||||
|
||||
sprintf(tmp, "%ud", mib->sta_basic_rate);
|
||||
printf("%20s: %-16s\n", "sta_basic_rate", tmp);
|
||||
|
||||
strncpy( tmp, &mib->desired_essid[2], mib->desired_essid[1]);
|
||||
tmp[mib->desired_essid[1]] = '\0';
|
||||
printf("%20s: %s\n", "desired_essid", tmp);
|
||||
}
|
||||
|
||||
|
||||
void prmgmtmib( su_mib_mac_mgmt_t *mib )
|
||||
{
|
||||
char tmp[80];
|
||||
|
||||
printf("MAC MGMT MIB:\n");
|
||||
|
||||
sprintf(tmp, "0x%x", mib->pwr_mgmt_mode);
|
||||
printf("%20s: %-16s ", "pwr_mgmt_mode", tmp);
|
||||
sprintf(tmp, "0x%x", mib->scan_mode);
|
||||
printf("%20s: %-16s\n", "scan_mode", tmp);
|
||||
|
||||
sprintf(tmp, "0x%x", mib->scan_state);
|
||||
printf("%20s: %-16s ", "scan_state", tmp);
|
||||
sprintf(tmp, "0x%x", mib->dtim_period);
|
||||
printf("%20s: %-16s\n", "dtim_period", tmp);
|
||||
|
||||
sprintf(tmp, "0x%x", mib->atim_window);
|
||||
printf("%20s: %-16s ", "atim_window", tmp);
|
||||
sprintf(tmp, "0x%x", mib->beacon_period);
|
||||
printf("%20s: %-16s\n", "beacon_period", tmp);
|
||||
|
||||
sprintf(tmp, "0x%x", mib->passive_scan_duration);
|
||||
printf("%20s: %-16s ", "passive_scan_dur", tmp);
|
||||
sprintf(tmp, "0x%x", mib->listen_interval);
|
||||
printf("%20s: %-16s\n", "listen_interval", tmp);
|
||||
|
||||
sprintf(tmp, "0x%x", mib->med_occupancy_limit);
|
||||
printf("%20s: %-16s ", "med_occupancy_limit", tmp);
|
||||
sprintf(tmp, "0x%x", mib->max_mpdu_time);
|
||||
printf("%20s: %-16s\n", "max_mpdu_time", tmp);
|
||||
|
||||
sprintf(tmp, "0x%x", mib->cfp_max_duration);
|
||||
printf("%20s: %-16s ", "cfp_max_duration", tmp);
|
||||
sprintf(tmp, "0x%x", mib->cfp_rate);
|
||||
printf("%20s: %-16s\n", "cfp_rate", tmp);
|
||||
|
||||
sprintf(tmp, "0x%x", mib->station_id);
|
||||
printf("%20s: %-16s ", "station_id", tmp);
|
||||
mac2str(mib->current_bssid, tmp);
|
||||
printf("%20s: %-16s\n", "current_bssid", tmp);
|
||||
|
||||
strncpy( tmp, &mib->current_essid[2], mib->current_essid[1]);
|
||||
|
||||
{
|
||||
int i;
|
||||
|
||||
for ( i = 0; i < (WLAN_SSID_MAXLEN + 2); i++ )
|
||||
printf("mib->current_essid[%d] = %lu, 0x%02lx, %c\n", i,
|
||||
(unsigned long)mib->current_essid[i],
|
||||
(unsigned long)mib->current_essid[i],
|
||||
(char)mib->current_essid[i]);
|
||||
}
|
||||
/*
|
||||
tmp[mib->current_essid[1]] = '\0';
|
||||
printf("%20s: %s\n", "current_essid", tmp);
|
||||
*/
|
||||
}
|
||||
|
||||
void prdrvrmib( su_mib_drvr_mac_mgmt_t *mib )
|
||||
{
|
||||
printf("DRVR MAC MGMT MIB:\n");
|
||||
printf(" Currently unsupported\n\n");
|
||||
}
|
||||
|
||||
|
||||
void prphymib( su_mib_phy_t *mib )
|
||||
{
|
||||
char tmp[40];
|
||||
printf("PHY MIB:\n");
|
||||
|
||||
sprintf(tmp, "%ud", mib->slot_time);
|
||||
printf("%20s: %-16s ", "slot_time", tmp);
|
||||
sprintf(tmp, "%ud", mib->sifs);
|
||||
printf("%20s: %-16s\n", "sifs", tmp);
|
||||
|
||||
sprintf(tmp, "%ud", mib->mpdu_max);
|
||||
printf("%20s: %-16s ", "mpdu_max", tmp);
|
||||
sprintf(tmp, "%ud", mib->hop_time);
|
||||
printf("%20s: %-16s\n", "hop_time", tmp);
|
||||
|
||||
sprintf(tmp, "%ud", mib->preamble_length);
|
||||
printf("%20s: %-16s ", "preamble_length", tmp);
|
||||
sprintf(tmp, "%ud", mib->plcp_hdr_length);
|
||||
printf("%20s: %-16s\n", "plcp_hdr_length", tmp);
|
||||
|
||||
sprintf(tmp, "0x%x", mib->current_reg_domain);
|
||||
printf("%20s: %-16s\n", "current_reg_domain", tmp);
|
||||
|
||||
sprintf(tmp, "0x%02x, 0x%02x, 0x%02x, 0x%02x",
|
||||
mib->supported_data_rates[0],
|
||||
mib->supported_data_rates[1],
|
||||
mib->supported_data_rates[2],
|
||||
mib->supported_data_rates[3] );
|
||||
printf("%20s: %-16s\n", "supp_data_rates", tmp);
|
||||
|
||||
sprintf(tmp, "%ud, %ud, %ud, %ud", mib->pwr_up_time[0],
|
||||
mib->pwr_up_time[1], mib->pwr_up_time[2], mib->pwr_up_time[3] );
|
||||
printf("%20s: %-16s\n", "pwr_up_times", tmp);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
|
||||
Linux WLAN
|
||||
|
||||
The contents of this file are subject to the Mozilla Public
|
||||
License Version 1.0 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
The initial developer of the original code is Mark S. Mathews
|
||||
<mark@absoval.com>. Portions created by Mark S. Mathews
|
||||
are Copyright (C) 1998 AbsoluteValue Software, Inc. All Rights Reserved.
|
||||
|
||||
*/
|
||||
|
||||
void mac2str( UINT8 *ma, char *str);
|
||||
void prlocalmib( su_mib_local_t *mib );
|
||||
void prstatsmib( su_mib_mac_statistics_t *mib );
|
||||
void praddrmib( su_mib_mac_addr_stat_grp_t *mib );
|
||||
void prmacmib( su_mib_mac_t *mib );
|
||||
void prmgmtmib( su_mib_mac_mgmt_t *mib );
|
||||
void prdrvrmib( su_mib_drvr_mac_mgmt_t *mib );
|
||||
void prphymib( su_mib_phy_t *mib );
|
||||
|
Binary file not shown.
|
@ -0,0 +1,15 @@
|
|||
#ifndef _WLANCTL_H
|
||||
#define _WLANCTL_H
|
||||
|
||||
#define APPNAME "wlanctl"
|
||||
#define BSSCREATE "bsscreate"
|
||||
#define BSSJOIN "bssjoin"
|
||||
#define GETMIB "getmib"
|
||||
#define GETMIBITEM "getmibitem"
|
||||
#define MAX_APPNAME_LEN (20)
|
||||
#define NETLIST "netlist"
|
||||
#define SCAN "scan"
|
||||
#define SETMIBITEM "setmibitem"
|
||||
|
||||
#endif /* _WLANCTL_H */
|
||||
|
Loading…
Reference in New Issue