Logo Search packages:      
Sourcecode: uaputl version File versions  Download package

uaputl.h

Go to the documentation of this file.
/** @file  uaputl.h
 *
 *  @brief Header file for uaputl application
 * 
 * Copyright (C) 2008-2009, Marvell International Ltd. 
 *
 * This software file (the "File") is distributed by Marvell International 
 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 
 * (the "License").  You may use, redistribute and/or modify this File in 
 * accordance with the terms and conditions of the License, a copy of which 
 * is available along with the File in the gpl.txt file or by writing to 
 * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 
 * 02111-1307 or on the worldwide web at http://www.gnu.org/licenses/gpl.txt.
 *
 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE 
 * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE 
 * ARE EXPRESSLY DISCLAIMED.  The License provides additional details about 
 * this warranty disclaimer.
 *
 */
/************************************************************************
Change log:
    03/01/08: Initial creation
************************************************************************/

#ifndef _UAP_H
#define _UAP_H

#if (BYTE_ORDER == LITTLE_ENDIAN)
#undef BIG_ENDIAN
#endif

/** 16 bits byte swap */
00034 #define swap_byte_16(x) \
  ((u16)((((u16)(x) & 0x00ffU) << 8) | \
         (((u16)(x) & 0xff00U) >> 8)))

/** 32 bits byte swap */
00039 #define swap_byte_32(x) \
  ((u32)((((u32)(x) & 0x000000ffUL) << 24) | \
         (((u32)(x) & 0x0000ff00UL) <<  8) | \
         (((u32)(x) & 0x00ff0000UL) >>  8) | \
         (((u32)(x) & 0xff000000UL) >> 24)))

/** 64 bits byte swap */
00046 #define swap_byte_64(x) \
  ((u64)((u64)(((u64)(x) & 0x00000000000000ffULL) << 56) | \
         (u64)(((u64)(x) & 0x000000000000ff00ULL) << 40) | \
         (u64)(((u64)(x) & 0x0000000000ff0000ULL) << 24) | \
         (u64)(((u64)(x) & 0x00000000ff000000ULL) <<  8) | \
         (u64)(((u64)(x) & 0x000000ff00000000ULL) >>  8) | \
         (u64)(((u64)(x) & 0x0000ff0000000000ULL) >> 24) | \
         (u64)(((u64)(x) & 0x00ff000000000000ULL) >> 40) | \
         (u64)(((u64)(x) & 0xff00000000000000ULL) >> 56) ))

#ifdef BIG_ENDIAN
/** Convert from 16 bit little endian format to CPU format */
#define uap_le16_to_cpu(x) swap_byte_16(x)
/** Convert from 32 bit little endian format to CPU format */
#define uap_le32_to_cpu(x) swap_byte_32(x)
/** Convert from 64 bit little endian format to CPU format */
#define uap_le64_to_cpu(x) swap_byte_64(x)
/** Convert to 16 bit little endian format from CPU format */
#define uap_cpu_to_le16(x) swap_byte_16(x)
/** Convert to 32 bit little endian format from CPU format */
#define uap_cpu_to_le32(x) swap_byte_32(x)
/** Convert to 64 bit little endian format from CPU format */
#define uap_cpu_to_le64(x) swap_byte_64(x)

/** Convert APCMD header to little endian format from CPU format */
#define endian_convert_request_header(x);               \
    {                                                   \
        (x)->CmdCode = uap_cpu_to_le16((x)->CmdCode);   \
        (x)->Size = uap_cpu_to_le16((x)->Size);         \
        (x)->SeqNum = uap_cpu_to_le16((x)->SeqNum);     \
        (x)->Result = uap_cpu_to_le16((x)->Result);     \
    }

/** Convert APCMD header from little endian format to CPU format */
#define endian_convert_response_header(x);              \
    {                                                   \
        (x)->CmdCode = uap_le16_to_cpu((x)->CmdCode);   \
        (x)->Size = uap_le16_to_cpu((x)->Size);         \
        (x)->SeqNum = uap_le16_to_cpu((x)->SeqNum);     \
        (x)->Result = uap_le16_to_cpu((x)->Result);     \
    }

/** Convert TLV header to little endian format from CPU format */
#define endian_convert_tlv_header_out(x);           \
    {                                               \
        (x)->Tag = uap_cpu_to_le16((x)->Tag);       \
        (x)->Length = uap_cpu_to_le16((x)->Length); \
    }

/** Convert TLV header from little endian format to CPU format */
#define endian_convert_tlv_header_in(x);            \
    {                                               \
        (x)->Tag = uap_le16_to_cpu((x)->Tag);       \
        (x)->Length = uap_le16_to_cpu((x)->Length); \
    }

#else /* BIG_ENDIAN */
/** Do nothing */
00104 #define uap_le16_to_cpu(x) x
/** Do nothing */
00106 #define uap_le32_to_cpu(x) x
/** Do nothing */
00108 #define uap_le64_to_cpu(x) x
/** Do nothing */
00110 #define uap_cpu_to_le16(x) x
/** Do nothing */
00112 #define uap_cpu_to_le32(x) x
/** Do nothing */
00114 #define uap_cpu_to_le64(x) x

/** Do nothing */
00117 #define endian_convert_request_header(x)
/** Do nothing */
00119 #define endian_convert_response_header(x)
/** Do nothing */
00121 #define endian_convert_tlv_header_out(x)
/** Do nothing */
00123 #define endian_convert_tlv_header_in(x)
#endif /* BIG_ENDIAN */

/** uAP application version string */
00127 #define UAP_VERSION         "1.12"
/** Host Command ioctl number */
00129 #define UAPHOSTCMD          (SIOCDEVPRIVATE + 1)
/** Private command ID to Power Mode */
00131 #define     UAP_POWER_MODE        (SIOCDEVPRIVATE + 3)

/** Default device name */
00134 #define DEFAULT_DEV_NAME    "uap0"

/** Success */
00137 #define UAP_SUCCESS     1
/** Failure */
00139 #define UAP_FAILURE     0
/** MAC BROADCAST */
00141 #define UAP_RET_MAC_BROADCAST   0x1FF
/** MAC MULTICAST */
00143 #define UAP_RET_MAC_MULTICAST   0x1FE

/** Command is successful */
00146 #define CMD_SUCCESS     0
/** Command fails */
00148 #define CMD_FAILURE     -1

/** BSS start error : Invalid parameters */
00151 #define BSS_FAILURE_START_INVAL     -2
/** BSS start error : BSS already started */
00153 #define BSS_FAILURE_START_REDUNDANT -3

/** BSS stop error : BSS already stopped */
00156 #define BSS_FAILURE_STOP_REDUNDANT  -2
/** BSS stop error : No active BSS */
00158 #define BSS_FAILURE_STOP_INVAL      -3

/** Maximum line length for config file */
00161 #define MAX_LINE_LENGTH         240
/** Maximum command length */
00163 #define MAX_CMD_LENGTH          100
/** Size of command buffer */
00165 #define MRVDRV_SIZE_OF_CMD_BUFFER       (2 * 1024)
/** Maximum number of clients supported by AP */
00167 #define MAX_NUM_CLIENTS         16
/** Maximum number of MAC addresses for one-shot filter modifications */
00169 #define MAX_MAC_ONESHOT_FILTER  16
/** Maximum SSID length */
00171 #define MAX_SSID_LENGTH         32
/** Maximum SSID length */
00173 #define MIN_SSID_LENGTH         1
/** Maximum WPA passphrase length */
00175 #define MAX_WPA_PASSPHRASE_LENGTH   64
/** Minimum WPA passphrase length */
00177 #define MIN_WPA_PASSPHRASE_LENGTH   8
/** Maximum data rates */
00179 #define MAX_DATA_RATES          14
/** Maximum length of lines in configuration file */
00181 #define MAX_CONFIG_LINE         240
/** MSB bit is set if its a basic rate */
00183 #define BASIC_RATE_SET_BIT     0x80
/** Maximum group key timer */
00185 #define MAX_GRP_TIMER   86400
/** Maximum Retry Limit */
00187 #define MAX_RETRY_LIMIT       14

/** Maximum TX Power Limit */
00190 #define MAX_TX_POWER    20
/** Minimum TX Power Limit */
00192 #define MIN_TX_POWER    0

/** Maximum channels */
00195 #define MAX_CHANNELS    14
/** Maximum RTS threshold */
00197 #define MAX_RTS_THRESHOLD   2347

/** Maximum fragmentation threshold */
00200 #define MAX_FRAG_THRESHOLD 2346
/** Minimum fragmentation threshold */
00202 #define MIN_FRAG_THRESHOLD 256

/** Maximum stage out time */
00205 #define MAX_STAGE_OUT_TIME  864000
/** Minimum stage out time */
00207 #define MIN_STAGE_OUT_TIME  300

/** Maximum DTIM period */
00210 #define MAX_DTIM_PERIOD 100

/** Maximum BEACON period */
00213 #define MAX_BEACON_PERIOD 4000

/** Minimum BEACON period */
00216 #define MIN_BEACON_PERIOD 50

/** Maximum IE buffer length */
00219 #define MAX_IE_BUFFER_LEN 256

/** Maximum custom IE count */
00222 #define MAX_CUSTOM_IE_COUNT 4

/** Maximum number of rates allowed at a time */
00225 #define MAX_RATES               12

/** Default wait period in seconds */
00228 #define DEFAULT_WAIT_TIME       3

#ifdef __GNUC__
/** Structure packing begins */
#define PACK_START
/** Structure packeing end */
#define PACK_END  __attribute__ ((packed))
#else
/** Structure packing begins */
00237 #define PACK_START   __packed
/** Structure packeing end */
00239 #define PACK_END
#endif

#ifndef ETH_ALEN
/** MAC address length */
00244 #define ETH_ALEN    6
#endif

/** Action field value : get */
00248 #define ACTION_GET  0
/** Action field value : set */
00250 #define ACTION_SET  1
/**
 * Hex or Decimal to Integer 
 * @param   num string to convert into decimal or hex
 */
00255 #define A2HEXDECIMAL(num)  \
    (strncasecmp("0x", (num), 2)?(unsigned int) strtoll((num),NULL,0):a2hex((num)))\

/**
 * Check of decimal or hex string
 * @param   num string
 */
00262 #define IS_HEX_OR_DIGIT(num) \
    (strncasecmp("0x", (num), 2)?ISDIGIT((num)):ishexstring((num)))\

/** Find minimum value */
#ifndef MIN
00267 #define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif /* MIN */

/** Character, 1 byte */
00271 typedef char s8;
/** Unsigned character, 1 byte */
00273 typedef unsigned char u8;

/** Short integer */
00276 typedef signed short s16;
/** Unsigned short integer */
00278 typedef unsigned short u16;

/** Long integer */
00281 typedef signed long s32;
/** Unsigned long integer */
00283 typedef unsigned long u32;

/** Valid Input Commands */
00286 typedef enum
{
    RDEEPROM,
    SCANCHANNELS,
    TXPOWER,
    PROTOCOL,
    CHANNEL,
    RATE,
    BROADCASTSSID,
    RTSTHRESH,
    FRAGTHRESH,
    DTIMPERIOD,
    RADIOCONTROL,
    TXDATARATE,
    MCBCDATARATE,
    PKTFWD,
    STAAGEOUTTIMER,
    AUTHMODE,
    GROUPREKEYTIMER,
    MAXSTANUM,
    BEACONPERIOD,
    RETRYLIMIT,
    RSNREPLAYPROT,
    COEX_COMM_BITMAP,
    COEX_PROTECTION,
    COEX_SCO_ACL_FREQ,
    COEX_ACL_ENABLED,
    COEX_ACL_BT_TIME,
    COEX_ACL_WLAN_TIME,
} valid_inputs;

/** Message verbosity level */
enum
{ MSG_NONE, MSG_DEBUG, MSG_ALL };

/** oids_table */
00322 typedef struct
{
    /** oid type */
00325     u16 type;
    /** oid len */
00327     u16 len;
    /** oid name */
00329     char *name;
} oids_table;

/** 4 byte header to store buf len*/
00333 #define BUF_HEADER_SIZE 4

/** AP CMD header */
00336 #define APCMDHEADER     /** Buf Size */                         \
                  u32 BufSize;                            \
                  /** CmdCode */                          \
                  u16 CmdCode;                      \
                  /** Size */                       \
                        u16 Size;                           \
                  /** SeqNum */                           \
                        u16 SeqNum;                       \
                  /** Result */                           \
                        s16 Result

/** TLV header */
00348 #define TLVHEADER       /** Tag */                        \
                  u16 Tag;                            \
                  /** Length */                           \
                        u16 Length

/* TLV Definitions */

/** TLV buffer header*/
00356 typedef PACK_START struct _TLVBUF_HEADER
{
    /** Header type */
00359     u16 Type;
    /** Header length */
00361     u16 Len;
    /** Data */
00363     u8 Data[0];
} PACK_END TLVBUF_HEADER;

/** Band config ACS mode */
00367 #define BAND_CONFIG_ACS_MODE    0x40

/** TLV buffer : Channel Config */
00370 typedef PACK_START struct _TLVBUF_CHANNEL_CONFIG
{
    /** Header */
00373     TLVHEADER;
    /** Band Configuration 
     *
     * [7-6] Channel Selection Mode; 00 manual, 01 ACS
     * [3-2] Channel Width; 00 20 MHz
     * [1-0] Band Info; 00 2.4 GHz
     */
00380     u8 BandConfigType;
    /** Channel number */
00382     u8 ChanNumber;
} PACK_END TLVBUF_CHANNEL_CONFIG;

/** Channel List Entry */
00386 typedef PACK_START struct _CHANNEL_LIST
{
    /** Band Config */
00389     u8 BandConfigType;
    /** Channel Number */
00391     u8 ChanNumber;
    /** Reserved */
00393     u8 Reserved1;
    /** Reserved */
00395     u16 Reserved2;
    /** Reserved */
00397     u16 Reserved3;
} PACK_END CHANNEL_LIST;

/** TLV buffer : Channel List */
00401 typedef PACK_START struct _TLVBUF_CHANNEL_LIST
{
    /** Header */
00404     TLVHEADER;
    /** Channel List */
00406     CHANNEL_LIST ChanList[0];
} PACK_END TLVBUF_CHANNEL_LIST;

/** TLV buffer : AP MAC address */
00410 typedef PACK_START struct _TLVBUF_AP_MAC_ADDRESS
{
    /** Header */
00413     TLVHEADER;
    /** AP MAC address */
00415     u8 ApMacAddr[ETH_ALEN];
} PACK_END TLVBUF_AP_MAC_ADDRESS;

/** TLV buffer : SSID */
00419 typedef PACK_START struct _TLVBUF_SSID
{
    /** Header */
00422     TLVHEADER;
    /** SSID */
00424     u8 Ssid[0];
} PACK_END TLVBUF_SSID;

/** TLV buffer : Beacon period */
00428 typedef PACK_START struct _TLVBUF_BEACON_PERIOD
{
    /** Header */
00431     TLVHEADER;
    /** Beacon period */
00433     u16 BeaconPeriod_ms;
} PACK_END TLVBUF_BEACON_PERIOD;

/** TLV buffer : DTIM period */
00437 typedef PACK_START struct _TLVBUF_DTIM_PERIOD
{
    /** Header */
00440     TLVHEADER;
    /** DTIM period */
00442     u8 DtimPeriod;
} PACK_END TLVBUF_DTIM_PERIOD;

/** TLV buffer : Channel */
00446 typedef PACK_START struct _TLVBUF_PHYPARAMDSSET
{
    /** Header */
00449     TLVHEADER;
    /** Channel */
00451     u8 Channel;
} PACK_END TLVBUF_PHYPARAMDSSET;

/** TLV buffer : Operational rates */
00455 typedef PACK_START struct _TLVBUF_RATES
{
    /** Header */
00458     TLVHEADER;
    /** Operational rates */
00460     u8 OperationalRates[0];
} PACK_END TLVBUF_RATES;

/** TLV buffer : Tx power */
00464 typedef PACK_START struct _TLVBUF_TX_POWER
{
    /** Header */
00467     TLVHEADER;
    /** Tx power in dBm */
00469     u8 TxPower_dBm;
} PACK_END TLVBUF_TX_POWER;

/** TLV buffer : SSID broadcast control */
00473 typedef PACK_START struct _TLVBUF_BCAST_SSID_CTL
{
    /** Header */
00476     TLVHEADER;
    /** SSID broadcast control flag */
00478     u8 BcastSsidCtl;
} PACK_END TLVBUF_BCAST_SSID_CTL;

/** TLV buffer : RSN replay protection */
00482 typedef PACK_START struct _tlvbuf_rsn_replay_prot
{
    /** Header */
00485     TLVHEADER;
    /** RSN replay protection control flag */
00487     u8 rsn_replay_prot;
} PACK_END tlvbuf_rsn_replay_prot;

/** TLV buffer : Preamble control */
00491 typedef PACK_START struct _TLVBUF_PREAMBLE_CTL
{
    /** Header */
00494     TLVHEADER;
    /** Preamble type */
00496     u8 PreambleType;
} PACK_END TLVBUF_PREAMBLE_CTL;

/** TLV buffer : Antenna control */
00500 typedef PACK_START struct _TLVBUF_ANTENNA_CTL
{
    /** Header */
00503     TLVHEADER;
    /** Antenna type */
00505     u8 WhichAntenna;
    /** Antenna mode */
00507     u8 AntennaMode;
} PACK_END TLVBUF_ANTENNA_CTL;

/** TLV buffer : RTS threshold */
00511 typedef PACK_START struct _TLVBUF_RTS_THRESHOLD
{
    /** Header */
00514     TLVHEADER;
    /** RTS threshold */
00516     u16 RtsThreshold;
} PACK_END TLVBUF_RTS_THRESHOLD;

/** TLV buffer : Radio control */
00520 typedef PACK_START struct _TLVBUF_RADIO_CTL
{
    /** Header */
00523     TLVHEADER;
    /** Radio control flag */
00525     u8 RadioCtl;
} PACK_END TLVBUF_RADIO_CTL;

/** TLV buffer : Tx data rate */
00529 typedef PACK_START struct _TLVBUF_TX_DATA_RATE
{
    /** Header */
00532     TLVHEADER;
    /** Tx data rate */
00534     u16 TxDataRate;
} PACK_END TLVBUF_TX_DATA_RATE;

/** TLV buffer : MCBC Data Rate */
00538 typedef PACK_START struct _TLVBUF_MCBC_DATA_RATE
{
    /** Header */
00541     TLVHEADER;
    /** MCBC data rate */
00543     u16 MCBCdatarate;
} PACK_END TLVBUF_MCBC_DATA_RATE;

/** TLV buffer : Packet forward control */
00547 typedef PACK_START struct _TLVBUF_PKT_FWD_CTL
{
    /** Header */
00550     TLVHEADER;
    /** Packet forwarding control flag */
00552     u8 PktFwdCtl;
} PACK_END TLVBUF_PKT_FWD_CTL;

/** TLV buffer : STA information */
00556 typedef PACK_START struct _TLVBUF_STA_INFO
{
    /** Header */
00559     TLVHEADER;
    /** STA MAC address */
00561     u8 MacAddress[ETH_ALEN];
    /** Power mfg status */
00563     u8 PowerMfgStatus;
    /** RSSI */
00565     s8 Rssi;
} PACK_END TLVBUF_STA_INFO;

/** TLV buffer : STA MAC address filtering control */
00569 typedef PACK_START struct _TLVBUF_STA_MAC_ADDR_FILTER
{
    /** Header */
00572     TLVHEADER;
    /** Filter mode */
00574     u8 FilterMode;
    /** Number of STA MACs */
00576     u8 Count;
    /** STA MAC addresses buffer */
00578     u8 MacAddress[0];
} PACK_END TLVBUF_STA_MAC_ADDR_FILTER;

/** TLV buffer : STA ageout timer */
00582 typedef PACK_START struct _TLVBUF_STA_AGEOUT_TIMER
{
    /** Header */
00585     TLVHEADER;
    /** STA ageout timer in ms */
00587     u32 StaAgeoutTimer_ms;
} PACK_END TLVBUF_STA_AGEOUT_TIMER;

/** TLV buffer : max station number */
00591 typedef PACK_START struct _TLVBUF_MAX_STA_NUM
{
    /** Header */
00594     TLVHEADER;
    /** max station number */
00596     u16 Max_sta_num;
} PACK_END TLVBUF_MAX_STA_NUM;

/** TLV buffer : retry limit */
00600 typedef PACK_START struct _TLVBUF_RETRY_LIMIT
{
    /** Header */
00603     TLVHEADER;
    /** retry limit */
00605     u8 retry_limit;
} PACK_END TLVBUF_RETRY_LIMIT;

/* Bitmap for protocol to use */
/** No security */
00610 #define PROTOCOL_NO_SECURITY              1
/** Static WEP */
00612 #define PROTOCOL_STATIC_WEP           2
/** WPA */
00614 #define PROTOCOL_WPA                  8
/** WPA2 */
00616 #define PROTOCOL_WPA2                     32
/** WP2 Mixed */
00618 #define PROTOCOL_WPA2_MIXED               40

/* Bitmap for unicast/bcast cipher type */
/** None */
00622 #define CIPHER_NONE                 0
/** WEP 40 */
00624 #define CIPHER_WEP_40                     1
/** WEP 104 */
00626 #define CIPHER_WEP_104              2
/** TKIP */
00628 #define CIPHER_TKIP                   4
/** AES CCMP */
00630 #define CIPHER_AES_CCMP                   8
/** valid cipher bitmap */
00632 #define CIPHER_BITMAP               0x0c

/** TLV buffer : Authentication Mode */
00635 typedef PACK_START struct _TLVBUF_AUTH_MODE
{
    /** Header */
00638     TLVHEADER;
    /** Authentication Mode */
00640     u8 AuthMode;
} PACK_END TLVBUF_AUTH_MODE;

/** TLV buffer : Security Protocol */
00644 typedef PACK_START struct _TLVBUF_PROTOCOL
{
    /** Header */
00647     TLVHEADER;
    /** Security protocol */
00649     u16 Protocol;
} PACK_END TLVBUF_PROTOCOL;

/** TLV buffer : cipher */
00653 typedef PACK_START struct _TLVBUF_CIPHER
{
    /** Header */
00656     TLVHEADER;
    /** Pairwise cipher */
00658     u8 PairwiseCipher;
    /** Group cipher */
00660     u8 GroupCipher;
} PACK_END TLVBUF_CIPHER;

/** TLV buffer : Group re-key time */
00664 typedef PACK_START struct _TLVBUF_GROUP_REKEY_TIMER
{
    /** Header */
00667     TLVHEADER;
    /** Group rekey time in seconds */
00669     u32 GroupRekeyTime_sec;
} PACK_END TLVBUF_GROUP_REKEY_TIMER;

/** Key_mgmt_psk */
00673 #define KEY_MGMT_NONE   0x04
/** Key_mgmt_none */
00675 #define KEY_MGMT_PSK    0x02

/** TLV buffer : KeyMgmt */
00678 typedef PACK_START struct _TLVBUF_AKMP
{
    /** Header */
00681     TLVHEADER;
    /** KeyMgmt */
00683     u16 KeyMgmt;
} PACK_END TLVBUF_AKMP;

/** TLV buffer : Single WEP key */
00687 typedef PACK_START struct _TLVBUF_WEP_KEY
{
    /** Header */
00690     TLVHEADER;
    /** Key index */
00692     u8 KeyIndex;
    /** Default key flag */
00694     u8 IsDefault;
    /** Key */
00696     u8 Key[0];
} PACK_END TLVBUF_WEP_KEY;

/** custom IE */
00700 typedef PACK_START struct _custom_ie
{
    /** IE Index */
00703     u16 ie_index;
    /** Mgmt Subtype Mask */
00705     u16 mgmt_subtype_mask;
    /** IE Length */
00707     u16 ie_length;
    /** IE buffer */
00709     u8 ie_buffer[0];
} PACK_END custom_ie;

/** TLV buffer : custom IE */
00713 typedef PACK_START struct _tlvbuf_custom_ie
{
    /** Header */
00716     TLVHEADER;
    /** custom IE data */
00718     custom_ie ie_data[0];
} PACK_END tlvbuf_custom_ie;

/** TLV buffer : WPA passphrase */
00722 typedef PACK_START struct _TLVBUF_WPA_PASSPHRASE
{
    /** Header */
00725     TLVHEADER;
    /** WPA passphrase */
00727     u8 Passphrase[0];
} PACK_END TLVBUF_WPA_PASSPHRASE;

/** TLV buffer : Fragmentation threshold */
00731 typedef PACK_START struct _TLVBUF_FRAG_THRESHOLD
{
    /** Header */
00734     TLVHEADER;
    /** Fragmentation threshold */
00736     u16 FragThreshold;
} PACK_END TLVBUF_FRAG_THRESHOLD;

/* APCMD definitions */
/** APCMD buffer */
00741 typedef PACK_START struct _APCMDBUF
{
    /** Header */
00744     APCMDHEADER;
}
PACK_END APCMDBUF;

/** APCMD header length */
00749 #define APCMDHEADERLEN  (sizeof(APCMDBUF))

/** APCMD buffer : sys_info request */
00752 typedef PACK_START struct _APCMDBUF_SYS_INFO_REQUEST
{
    /** Header */
00755     APCMDHEADER;
} PACK_END APCMDBUF_SYS_INFO_REQUEST;

/** APCMD buffer : sys_info response */
00759 typedef PACK_START struct _APCMDBUF_SYS_INFO_RESPONSE
{
    /** Header */
00762     APCMDHEADER;
    /** System information buffer */
00764     u8 SysInfo[64];
} PACK_END APCMDBUF_SYS_INFO_RESPONSE;

/** APCMD buffer : sys_reset */
00768 typedef PACK_START struct _APCMDBUF_SYS_RESET
{
    /** Header */
00771     APCMDHEADER;
} PACK_END APCMDBUF_SYS_RESET;

/** APCMD buffer : sys_configure */
00775 typedef PACK_START struct _APCMDBUF_SYS_CONFIGURE
{
    /** Header */
00778     APCMDHEADER;
    /** Action : GET or SET */
00780     u16 Action;
} PACK_END APCMDBUF_SYS_CONFIGURE;

/** APCMD buffer : SNMP MIB */
00784 typedef PACK_START struct _APCMDBUF_SNMP_MIB
{
    /** Header */
00787     APCMDHEADER;
    /** Action : GET or SET */
00789     u16 Action;
} PACK_END APCMDBUF_SNMP_MIB;
/** APCMD buffer : bss_start */
00792 typedef PACK_START struct _APCMDBUF_BSS_START
{
    /** Header */
00795     APCMDHEADER;
} PACK_END APCMDBUF_BSS_START;

/** APCMD buffer : bss_stop */
00799 typedef PACK_START struct _APCMDBUF_BSS_STOP
{
    /** Header */
00802     APCMDHEADER;
} PACK_END APCMDBUF_BSS_STOP;

/** APCMD buffer : sta_list request */
00806 typedef PACK_START struct _APCMDBUF_STA_LIST_REQUEST
{
    /** Header */
00809     APCMDHEADER;
} PACK_END APCMDBUF_STA_LIST_REQUEST;

/** APCMD buffer : sta_list response */
00813 typedef PACK_START struct _APCMDBUF_STA_LIST_RESPONSE
{
    /** Header */
00816     APCMDHEADER;
    /** Number of STAs */
00818     u16 StaCount;
    /** STA information TLVs */
00820     TLVBUF_STA_INFO StaList[0];
} PACK_END APCMDBUF_STA_LIST_RESPONSE;

/** APCMD buffer : sta_deauth */
00824 typedef PACK_START struct _APCMDBUF_STA_DEAUTH
{
    /** Header */
00827     APCMDHEADER;
    /** STA MAC address to deauthenticate */
00829     u8 StaMacAddress[ETH_ALEN];
    /** Reason Code */
00831     u16 ReasonCode;
} PACK_END APCMDBUF_STA_DEAUTH;

/** TLV : BT Coex common configuration */
00835 typedef PACK_START struct _tlvbuf_coex_common_cfg
{
    /** Header */
00838     TLVHEADER;
    /** Configuration bitmap */
00840     u32 config_bitmap;
    /** Reserved */
00842     u32 reserved[4];
} PACK_END tlvbuf_coex_common_cfg;

/** TLV : BT Coex SCO configuration */
00846 typedef PACK_START struct _tlvbuf_coex_sco_cfg
{
    /** Header */
00849     TLVHEADER;
    /** Qtime protection */
00851     u16 protection_qtime[4];
    /** Rate protection */
00853     u16 protection_rate;
    /** ACL frequency */
00855     u16 acl_frequency;
    /** Reserved */
00857     u32 reserved[4];
} PACK_END tlvbuf_coex_sco_cfg;

/** TLV : BT Coex ACL configuration */
00861 typedef PACK_START struct _tlvbuf_coex_acl_cfg
{
    /** Header */
00864     TLVHEADER;
    /** Enabled or not */
00866     u16 enabled;
    /** BT time */
00868     u16 bt_time;
    /** Wlan time */
00870     u16 wlan_time;
    /** Rate protection */
00872     u16 protection_rate;
    /** Reserved */
00874     u32 reserved[4];
} PACK_END tlvbuf_coex_acl_cfg;

/** TLV : BT Coex statistics */
00878 typedef PACK_START struct _tlvbuf_coex_stats
{
    /** Header */
00881     TLVHEADER;
    /** Null not sent */
00883     u32 null_not_sent;
    /** Null queued */
00885     u32 null_queued;
    /** Null not queued */
00887     u32 null_not_queued;
    /** CF end queued */
00889     u32 cf_end_queued;
    /** CF end not queued */
00891     u32 cf_end_not_queued;
    /** Null allocation failures */
00893     u32 null_alloc_fail;
    /** CF end allocation failures */
00895     u32 cf_end_alloc_fail;
    /** Reserved */
00897     u32 reserved[8];
} PACK_END tlvbuf_coex_stats;

/** APCMD buffer : BT Coex API extension */
00901 typedef PACK_START struct _apcmdbuf_coex_config
{
    /** Header */
00904     APCMDHEADER;
    /** Action : GET or SET */
00906     u16 action;
    /** Reserved for alignment */
00908     u16 coex_reserved;
    /** TLV buffer */
00910     u8 tlv_buffer[0];
} PACK_END apcmdbuf_coex_config;

/** Reg TYPE*/
00914 enum reg_commands
{
    CMD_MAC = 0,
    CMD_BBP,
    CMD_RF
};

/** APCMD buffer: Regrdwr */
00922 typedef PACK_START struct _APCMDBUF_REG_RDWR
{
   /** Header */
00925     APCMDHEADER;
   /** Read or Write */
00927     u16 Action;
   /** Register offset */
00929     u16 Offset;
   /** Value */
00931     u32 Value;
} PACK_END APCMDBUF_REG_RDWR;

/** sub-band type */
00935 typedef PACK_START struct _IEEEtypes_SubbandSet
{
00937     u8 FirstChan;       /**< First channel */
00938     u8 NoOfChan;        /**< Number of channels */
00939     u8 MaxTxPwr;        /**< Maximum Tx power */
} PACK_END IEEEtypes_SubbandSet_t;

/** country code length  used for 802.11D */
00943 #define COUNTRY_CODE_LEN    3

/** MAX domain SUB-BAND*/
00946 #define MAX_SUB_BANDS 40

/** Max Multi Domain Entries for G */
00949 #define MaxMultiDomainCapabilityEntryG 1

/** Max Multi Domain Entries for A */
00952 #define MaxMultiDomainCapabilityEntryA 31

/** Country code and Sub-band */
00955 typedef PACK_START struct domain_param
{
    TLVHEADER;
00958     u8 CountryCode[COUNTRY_CODE_LEN];           /**< Country code */
00959     IEEEtypes_SubbandSet_t Subband[0];          /**< Set of subbands */
} PACK_END domain_param_t;

/** HostCmd_CFG_80211D */
00963 typedef PACK_START struct _APCMDBUF_CFG_80211D
{
    /** Header */
00966     APCMDHEADER;
    /** Action */
00968     u16 Action;                 /* 0 = ACT_GET; 1 = ACT_SET; */
    /** Domain parameters */
00970     domain_param_t Domain;
} PACK_END APCMDBUF_CFG_80211D;

/** HostCmd_MEM_ACCESS */
00974 typedef PACK_START struct _APCMDBUF_MEM_ACCESS
{
    /** Header */
00977     APCMDHEADER;
    /** Action */
00979     u16 Action;                 /* 0 = ACT_GET; 1 = ACT_SET; */
    /** Reserved field */
00981     u16 Reserved;
    /** Address */
00983     u32 Address;
    /** Value */
00985     u32 Value;
} PACK_END APCMDBUF_MEM_ACCESS;

/** HostCmd_EEPROM_ACCESS */
00989 typedef PACK_START struct _APCMDBUF_EEPROM_ACCESS
{
    /** Header */
00992     APCMDHEADER;
    /** Action */
00994     u16 Action;                 /* 0 = ACT_GET; */
    /** Reserved field */
00996     u16 Offset;                 /* Multiples of 4 */
    /** Address */
00998     u16 ByteCount;              /* Multiples of 4 */
    /** Value */
01000     u8 Value[1];
} PACK_END APCMDBUF_EEPROM_ACCESS;

/** Max EEPROM length */
01004 #define MAX_EEPROM_LEN         20

/**subcmd id for glbal flag */
01007 #define DEBUG_SUBCOMMAND_GMODE            1
/**subcmd id for Majorid mask */
01009 #define DEBUG_SUBCOMMAND_MAJOREVTMASK     2
/**subcmd id to trigger a scan */
01011 #define DEBUG_SUBCOMMAND_CHANNEL_SCAN   3

/** Channel scan entry for each channel */
01014 typedef PACK_START struct _CHANNEL_SCAN_ENTRY_T
{
    /** Channel Number */
01017     u8 chan_num;
    /** Number of APs */
01019     u8 num_of_aps;
    /** CCA count */
01021     u32 CCA_count;
    /** Duration */
01023     u32 duration;
    /** Channel weight */
01025     u32 channel_weight;
} PACK_END CHANNEL_SCAN_ENTRY_T;

/** Channel scan entry */
01029 typedef PACK_START struct _CHANNEL_SCAN_ENTRY
{
    /** Number of channels */
01032     u8 numChannels;
    /** Channel scan entry */
01034     CHANNEL_SCAN_ENTRY_T cst[0];
} PACK_END CHANNEL_SCAN_ENTRY;

/** debugConfig_t */
typedef PACK_START union
{
        /** used in all new debug commands */
01041     u32 value;
        /** used in DEBUG_SUBCOMMAND_GMODE */
01043     u8 globalDebugMode;
        /** used in DEBUG_SUBCOMMAND_MAJOREVTMASK */
01045     u32 debugMajorIdMask;
        /** used in DEBUG_SUBCOMMAND_CHANNEL_SCAN */
01047     CHANNEL_SCAN_ENTRY cs_entry;
} PACK_END debugConfig_t;

/** HostCmd_SYS_DEBUG */
01051 typedef PACK_START struct _APCMDBUF_SYS_DEBUG
{
    /** Header */
01054     APCMDHEADER;
    /** Action */
01056     u16 Action;                 /* 0 = ACT_GET; 1 = ACT_SET; */
    /** Sub command */
01058     u32 subcmd;
    /** debug parameter */
01060     debugConfig_t debugConfig;
} PACK_END APCMDBUF_SYS_DEBUG;

/** HostCmd_CFG_DATA */
01064 typedef PACK_START struct _APCMDBUF_CFG_DATA
{
    /** Header */
01067     APCMDHEADER;
    /** Action */
01069     u16 action;
    /** Type */
01071     u16 type;
    /** Data length */
01073     u16 data_len;
    /** Data */
01075     u8 data[0];
} PACK_END APCMDBUF_CFG_DATA;

/** Maximum size of set/get configurations */
01079 #define MAX_CFG_DATA_SIZE           2000    /* less than
                                                   MRVDRV_SIZE_OF_CMD_BUFFER */

/** Host Command ID bit mask (bit 11:0) */
01083 #define HostCmd_CMD_ID_MASK             0x0fff
/** APCMD response check */
01085 #define APCMD_RESP_CHECK            0x8000

/* AP CMD IDs */
/** APCMD : sys_info */
01089 #define APCMD_SYS_INFO              0x00ae
/** APCMD : sys_reset */
01091 #define APCMD_SYS_RESET             0x00af
/** APCMD : sys_configure */
01093 #define APCMD_SYS_CONFIGURE         0x00b0
/** APCMD : bss_start */
01095 #define APCMD_BSS_START             0x00b1
/** APCMD : bss_stop */
01097 #define APCMD_BSS_STOP              0x00b2
/** APCMD : sta_list */
01099 #define APCMD_STA_LIST              0x00b3
/** APCMD : sta_deauth */
01101 #define APCMD_STA_DEAUTH            0x00b5
/** SNMP MIB SET/GET */
01103 #define HostCmd_SNMP_MIB            0x0016
/** Read/Write Mac register */
01105 #define HostCmd_CMD_MAC_REG_ACCESS  0x0019
/** Read/Write BBP register */
01107 #define HostCmd_CMD_BBP_REG_ACCESS  0x001a
/** Read/Write RF register */
01109 #define HostCmd_CMD_RF_REG_ACCESS   0x001b
/** Host Command ID : EEPROM access */
01111 #define HostCmd_EEPROM_ACCESS       0x0059
/** Host Command ID : Memory access */
01113 #define HostCmd_CMD_MEM_ACCESS      0x0086
/** Host Command ID : 802.11D configuration */
01115 #define HostCmd_CMD_802_11D_DOMAIN_INFO      0x005b
/** Host Command ID : Configuration data */
01117 #define HostCmd_CMD_CFG_DATA        0x008f
/** Host Command ID:  SYS_DEBUG */
01119 #define APCMD_SYS_DEBUG           0x00db

/** Host Command ID:  ROBUST_COEX */
01122 #define HostCmd_ROBUST_COEX              0x00e0

/** Oid for 802.11D enable/disable */
01125 #define OID_80211D_ENABLE           0x0009

/* TLV IDs */
/** TLV : Base */
01129 #define PROPRIETARY_TLV_BASE_ID         0x0100

/**TLV: Domain type */
01132 #define TLV_TYPE_DOMAIN                 0x0007

/** TLV : SSID */
01135 #define MRVL_SSID_TLV_ID                0x0000
/** TLV : Operational rates */
01137 #define MRVL_RATES_TLV_ID           0x0001
/** TLV : Channel */
01139 #define MRVL_PHYPARAMDSSET_TLV_ID       0x0003
/** TLV type : Scan Channels list */
01141 #define MRVL_CHANNELLIST_TLV_ID       (PROPRIETARY_TLV_BASE_ID + 1)
/** TLV type : Authentication type */
01143 #define MRVL_AUTH_TLV_ID              (PROPRIETARY_TLV_BASE_ID + 31)
/** TLV Id : Channel Config */
01145 #define MRVL_CHANNELCONFIG_TLV_ID       (PROPRIETARY_TLV_BASE_ID + 42)
/** TLV : AP MAC address */
01147 #define MRVL_AP_MAC_ADDRESS_TLV_ID      (PROPRIETARY_TLV_BASE_ID + 43)
/** TLV : Beacon period */
01149 #define MRVL_BEACON_PERIOD_TLV_ID       (PROPRIETARY_TLV_BASE_ID + 44)
/** TLV : DTIM period */
01151 #define MRVL_DTIM_PERIOD_TLV_ID         (PROPRIETARY_TLV_BASE_ID + 45)
/** TLV : Tx power */
01153 #define MRVL_TX_POWER_TLV_ID            (PROPRIETARY_TLV_BASE_ID + 47)
/** TLV : SSID broadcast control */
01155 #define MRVL_BCAST_SSID_CTL_TLV_ID      (PROPRIETARY_TLV_BASE_ID + 48)
/** TLV : Preamble control */
01157 #define MRVL_PREAMBLE_CTL_TLV_ID        (PROPRIETARY_TLV_BASE_ID + 49)
/** TLV : Antenna control */
01159 #define MRVL_ANTENNA_CTL_TLV_ID         (PROPRIETARY_TLV_BASE_ID + 50)
/** TLV : RTS threshold */
01161 #define MRVL_RTS_THRESHOLD_TLV_ID       (PROPRIETARY_TLV_BASE_ID + 51)
/** TLV : Radio control */
01163 #define MRVL_RADIO_CTL_TLV_ID           (PROPRIETARY_TLV_BASE_ID + 52)
/** TLV : Tx data rate */
01165 #define MRVL_TX_DATA_RATE_TLV_ID        (PROPRIETARY_TLV_BASE_ID + 53)
/** TLV : Packet forwarding control */
01167 #define MRVL_PKT_FWD_CTL_TLV_ID         (PROPRIETARY_TLV_BASE_ID + 54)
/** TLV : STA information */
01169 #define MRVL_STA_INFO_TLV_ID            (PROPRIETARY_TLV_BASE_ID + 55)
/** TLV : STA MAC address filter */
01171 #define MRVL_STA_MAC_ADDR_FILTER_TLV_ID (PROPRIETARY_TLV_BASE_ID + 56)
/** TLV : STA ageout timer */
01173 #define MRVL_STA_AGEOUT_TIMER_TLV_ID    (PROPRIETARY_TLV_BASE_ID + 57)
/** TLV : WEP keys */
01175 #define MRVL_WEP_KEY_TLV_ID             (PROPRIETARY_TLV_BASE_ID + 59)
/** TLV : WPA passphrase */
01177 #define MRVL_WPA_PASSPHRASE_TLV_ID      (PROPRIETARY_TLV_BASE_ID + 60)
/** TLV type : protocol TLV */
01179 #define MRVL_PROTOCOL_TLV_ID            (PROPRIETARY_TLV_BASE_ID + 64)
/** TLV type : AKMP TLV */
01181 #define MRVL_AKMP_TLV_ID                  (PROPRIETARY_TLV_BASE_ID + 65)
/** TLV type : Cipher TLV */
01183 #define MRVL_CIPHER_TLV_ID                (PROPRIETARY_TLV_BASE_ID + 66)
/** TLV : Fragment threshold */
01185 #define MRVL_FRAG_THRESHOLD_TLV_ID      (PROPRIETARY_TLV_BASE_ID + 70)
/** TLV : Group rekey timer */
01187 #define MRVL_GRP_REKEY_TIME_TLV_ID  (PROPRIETARY_TLV_BASE_ID + 71)
/**TLV: Max Station number */
01189 #define MRVL_MAX_STA_CNT_TLV_ID     (PROPRIETARY_TLV_BASE_ID + 85)
/**TLV: Retry limit */
01191 #define MRVL_RETRY_LIMIT_TLV_ID     (PROPRIETARY_TLV_BASE_ID + 93)
/**TLV: MCBC data rate */
01193 #define MRVL_MCBC_DATA_RATE_TLV_ID        (PROPRIETARY_TLV_BASE_ID + 98)
/**TLV: RSN replay protection */
01195 #define MRVL_RSN_REPLAY_PROT_TLV_ID       (PROPRIETARY_TLV_BASE_ID + 100)
/** TLV: Management IE list */
01197 #define MRVL_MGMT_IE_LIST_TLV_ID          (PROPRIETARY_TLV_BASE_ID + 105)
/** TLV : Coex common configuration */
01199 #define MRVL_BT_COEX_COMMON_CFG_TLV_ID    (PROPRIETARY_TLV_BASE_ID + 108)
/** TLV : Coex SCO configuration */
01201 #define MRVL_BT_COEX_SCO_CFG_TLV_ID       (PROPRIETARY_TLV_BASE_ID + 109)
/** TLV : Coex ACL configuration */
01203 #define MRVL_BT_COEX_ACL_CFG_TLV_ID       (PROPRIETARY_TLV_BASE_ID + 110)
/** TLV : Coex stats configuration */
01205 #define MRVL_BT_COEX_STATS_TLV_ID         (PROPRIETARY_TLV_BASE_ID + 111)

/** sleep_param */
01208 typedef struct _ps_sleep_param
{
    /** control bitmap */
01211     u32 ctrl_bitmap;
    /** minimum sleep period (micro second) */
01213     u32 min_sleep;
    /** maximum sleep period (micro second) */
01215     u32 max_sleep;
} ps_sleep_param;

/** inactivity sleep_param */
01219 typedef struct _inact_sleep_param
{
    /** inactivity timeout (micro second) */
01222     u32 inactivity_to;
    /** miniumu awake period (micro second) */
01224     u32 min_awake;
    /** maximum awake period (micro second) */
01226     u32 max_awake;
} inact_sleep_param;

/** flag for ps mode */
01230 #define PS_FLAG_PS_MODE                 1
/** flag for sleep param */
01232 #define PS_FLAG_SLEEP_PARAM             2
/** flag for inactivity sleep param */
01234 #define PS_FLAG_INACT_SLEEP_PARAM       4

/** Disable power mode */
01237 #define PS_MODE_DISABLE                      0
/** Enable periodic dtim ps */
01239 #define PS_MODE_PERIODIC_DTIM                1
/** Enable inactivity ps */
01241 #define PS_MODE_INACTIVITY                   2

/** sleep parameter */
01244 #define SLEEP_PARAMETER                     1
/** inactivity sleep parameter */
01246 #define INACTIVITY_SLEEP_PARAMETER          2

/** sleep parameter : lower limit in micro-sec */
01249 #define PS_SLEEP_PARAM_MIN                  5000
/** sleep parameter : upper limit in micro-sec */
01251 #define PS_SLEEP_PARAM_MAX                  32000
/** power save awake period minimum value in micro-sec */
01253 #define PS_AWAKE_PERIOD_MIN                 10

/** ps_mgmt */
01256 typedef struct _ps_mgmt
{
    /** flags for valid field */
01259     u16 flags;
    /** power mode */
01261     u16 ps_mode;
    /** sleep param */
01263     ps_sleep_param sleep_param;
    /** inactivity sleep param */
01265     inact_sleep_param inact_param;
} ps_mgmt;

/** Function Prototype Declaration */
int mac2raw(char *mac, u8 * raw);
void print_mac(u8 * raw);
int uap_ioctl(u8 * cmd, u16 * size, u16 buf_size);
void print_auth(TLVBUF_AUTH_MODE * tlv);
void print_tlv(u8 * buf, u16 len);
void print_cipher(TLVBUF_CIPHER * tlv);
void print_rate(TLVBUF_RATES * tlv);
int string2raw(char *str, unsigned char *raw);
void print_mac_filter(TLVBUF_STA_MAC_ADDR_FILTER * tlv);
int ishexstring(void *hex);
inline int ISDIGIT(char *x);
unsigned int a2hex(char *s);
int fparse_for_hex(FILE * fp, u8 * dst);
int is_input_valid(valid_inputs cmd, int argc, char *argv[]);
int is_cipher_valid(int pairwisecipher, int groupcipher);
int get_sys_cfg_rates(u8 * rates);
int is_tx_rate_valid(u8 rate);
int is_mcbc_rate_valid(u8 rate);
void hexdump_data(char *prompt, void *p, int len, char delim);
unsigned char hexc2bin(char chr);
#endif /* _UAP_H */

Generated by  Doxygen 1.6.0   Back to index