linux/drivers/staging/vt6655/iocmd.h
<<
>>
Prefs
   1/*
   2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
   3 * All rights reserved.
   4 *
   5 * This program is free software; you can redistribute it and/or modify
   6 * it under the terms of the GNU General Public License as published by
   7 * the Free Software Foundation; either version 2 of the License, or
   8 * (at your option) any later version.
   9 *
  10 * This program is distributed in the hope that it will be useful,
  11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13 * GNU General Public License for more details.
  14 *
  15 * You should have received a copy of the GNU General Public License along
  16 * with this program; if not, write to the Free Software Foundation, Inc.,
  17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  18 *
  19 * File: iocmd.h
  20 *
  21 * Purpose: Handles the viawget ioctl private interface functions
  22 *
  23 * Author: Lyndon Chen
  24 *
  25 * Date: May 8, 2002
  26 *
  27 */
  28
  29#ifndef __IOCMD_H__
  30#define __IOCMD_H__
  31
  32#include "ttype.h"
  33
  34/*---------------------  Export Definitions -------------------------*/
  35
  36//typedef uint32_t u32;
  37//typedef uint16_t u16;
  38//typedef uint8_t u8;
  39
  40// ioctl Command code
  41#define MAGIC_CODE                       0x3142
  42#define IOCTL_CMD_TEST              (SIOCDEVPRIVATE + 0)
  43#define IOCTL_CMD_SET                       (SIOCDEVPRIVATE + 1)
  44#define IOCTL_CMD_HOSTAPD           (SIOCDEVPRIVATE + 2)
  45#define IOCTL_CMD_WPA               (SIOCDEVPRIVATE + 3)
  46
  47typedef enum tagWMAC_CMD {
  48        WLAN_CMD_BSS_SCAN,
  49        WLAN_CMD_BSS_JOIN,
  50        WLAN_CMD_DISASSOC,
  51        WLAN_CMD_SET_WEP,
  52        WLAN_CMD_GET_LINK,
  53        WLAN_CMD_GET_LISTLEN,
  54        WLAN_CMD_GET_LIST,
  55        WLAN_CMD_GET_MIB,
  56        WLAN_CMD_GET_STAT,
  57        WLAN_CMD_STOP_MAC,
  58        WLAN_CMD_START_MAC,
  59        WLAN_CMD_AP_START,
  60        WLAN_CMD_SET_HOSTAPD,
  61        WLAN_CMD_SET_HOSTAPD_STA,
  62        WLAN_CMD_SET_802_1X,
  63        WLAN_CMD_SET_HOST_WEP,
  64        WLAN_CMD_SET_WPA,
  65        WLAN_CMD_GET_NODE_CNT,
  66        WLAN_CMD_ZONETYPE_SET,
  67        WLAN_CMD_GET_NODE_LIST
  68} WMAC_CMD, *PWMAC_CMD;
  69
  70typedef enum tagWZONETYPE {
  71        ZoneType_USA = 0,
  72        ZoneType_Japan = 1,
  73        ZoneType_Europe = 2
  74} WZONETYPE;
  75
  76#define ADHOC   0
  77#define INFRA   1
  78#define BOTH    2
  79#define AP          3
  80
  81#define ADHOC_STARTED      1
  82#define ADHOC_JOINTED      2
  83
  84#define PHY80211a       0
  85#define PHY80211b       1
  86#define PHY80211g       2
  87
  88#define SSID_ID                0
  89#define SSID_MAXLEN            32
  90#define BSSID_LEN              6
  91#define WEP_NKEYS              4
  92#define WEP_KEYMAXLEN          29
  93#define WEP_40BIT_LEN          5
  94#define WEP_104BIT_LEN         13
  95#define WEP_232BIT_LEN         16
  96
  97// Ioctl interface structure
  98// Command structure
  99//
 100#pragma pack(1)
 101typedef struct tagSCmdRequest {
 102        u8          name[16];
 103        void    *data;
 104        u16         wResult;
 105        u16     wCmdCode;
 106} SCmdRequest, *PSCmdRequest;
 107
 108//
 109// Scan
 110//
 111
 112typedef struct tagSCmdScan {
 113        u8 ssid[SSID_MAXLEN + 2];
 114} SCmdScan, *PSCmdScan;
 115
 116//
 117// BSS Join
 118//
 119
 120typedef struct tagSCmdBSSJoin {
 121        u16         wBSSType;
 122        u16     wBBPType;
 123        u8          ssid[SSID_MAXLEN + 2];
 124        u32         uChannel;
 125        bool bPSEnable;
 126        bool bShareKeyAuth;
 127} SCmdBSSJoin, *PSCmdBSSJoin;
 128
 129//
 130// Zonetype Setting
 131//
 132
 133typedef struct tagSCmdZoneTypeSet {
 134        bool bWrite;
 135        WZONETYPE  ZoneType;
 136} SCmdZoneTypeSet, *PSCmdZoneTypeSet;
 137
 138#ifdef WPA_SM_Transtatus
 139typedef struct tagSWPAResult {
 140        char    ifname[100];
 141        u8 proto;
 142        u8 key_mgmt;
 143        u8 eap_type;
 144        bool authenticated;
 145} SWPAResult, *PSWPAResult;
 146#endif
 147
 148typedef struct tagSCmdStartAP {
 149        u16         wBSSType;
 150        u16     wBBPType;
 151        u8          ssid[SSID_MAXLEN + 2];
 152        u32         uChannel;
 153        u32     uBeaconInt;
 154        bool bShareKeyAuth;
 155        u8      byBasicRate;
 156} SCmdStartAP, *PSCmdStartAP;
 157
 158typedef struct tagSCmdSetWEP {
 159        bool bEnableWep;
 160        u8      byKeyIndex;
 161        u8      abyWepKey[WEP_NKEYS][WEP_KEYMAXLEN];
 162        bool bWepKeyAvailable[WEP_NKEYS];
 163        u32     auWepKeyLength[WEP_NKEYS];
 164} SCmdSetWEP, *PSCmdSetWEP;
 165
 166typedef struct tagSBSSIDItem {
 167        u32         uChannel;
 168        u8      abyBSSID[BSSID_LEN];
 169        u8      abySSID[SSID_MAXLEN + 1];
 170        //2006-1116-01,<Modify> by NomadZhao
 171        //u16       wBeaconInterval;
 172        //u16       wCapInfo;
 173        //u8      byNetType;
 174        u8      byNetType;
 175        u16         wBeaconInterval;
 176        u16         wCapInfo;        // for address of byNetType at align 4
 177
 178        bool bWEPOn;
 179        u32     uRSSI;
 180} SBSSIDItem;
 181
 182typedef struct tagSBSSIDList {
 183        u32                 uItem;
 184        SBSSIDItem      sBSSIDList[0];
 185} SBSSIDList, *PSBSSIDList;
 186
 187typedef struct tagSCmdLinkStatus {
 188        bool bLink;
 189        u16   wBSSType;
 190        u8      byState;
 191        u8      abyBSSID[BSSID_LEN];
 192        u8      abySSID[SSID_MAXLEN + 2];
 193        u32     uChannel;
 194        u32     uLinkRate;
 195} SCmdLinkStatus, *PSCmdLinkStatus;
 196
 197//
 198// 802.11 counter
 199//
 200typedef struct tagSDot11MIBCount {
 201        u32 TransmittedFragmentCount;
 202        u32 MulticastTransmittedFrameCount;
 203        u32 FailedCount;
 204        u32 RetryCount;
 205        u32 MultipleRetryCount;
 206        u32 RTSSuccessCount;
 207        u32 RTSFailureCount;
 208        u32 ACKFailureCount;
 209        u32 FrameDuplicateCount;
 210        u32 ReceivedFragmentCount;
 211        u32 MulticastReceivedFrameCount;
 212        u32 FCSErrorCount;
 213} SDot11MIBCount, *PSDot11MIBCount;
 214
 215//
 216// statistic counter
 217//
 218typedef struct tagSStatMIBCount {
 219        //
 220        // ISR status count
 221        //
 222        u32   dwIsrTx0OK;
 223        u32   dwIsrTx1OK;
 224        u32   dwIsrBeaconTxOK;
 225        u32   dwIsrRxOK;
 226        u32   dwIsrTBTTInt;
 227        u32   dwIsrSTIMERInt;
 228        u32   dwIsrUnrecoverableError;
 229        u32   dwIsrSoftInterrupt;
 230        u32   dwIsrRxNoBuf;
 231        /////////////////////////////////////
 232
 233        u32   dwIsrUnknown;               // unknown interrupt count
 234
 235        // RSR status count
 236        //
 237        u32   dwRsrFrmAlgnErr;
 238        u32   dwRsrErr;
 239        u32   dwRsrCRCErr;
 240        u32   dwRsrCRCOk;
 241        u32   dwRsrBSSIDOk;
 242        u32   dwRsrADDROk;
 243        u32   dwRsrICVOk;
 244        u32   dwNewRsrShortPreamble;
 245        u32   dwRsrLong;
 246        u32   dwRsrRunt;
 247
 248        u32   dwRsrRxControl;
 249        u32   dwRsrRxData;
 250        u32   dwRsrRxManage;
 251
 252        u32   dwRsrRxPacket;
 253        u32   dwRsrRxOctet;
 254        u32   dwRsrBroadcast;
 255        u32   dwRsrMulticast;
 256        u32   dwRsrDirected;
 257        // 64-bit OID
 258        u32   ullRsrOK;
 259
 260        // for some optional OIDs (64 bits) and DMI support
 261        u32   ullRxBroadcastBytes;
 262        u32   ullRxMulticastBytes;
 263        u32   ullRxDirectedBytes;
 264        u32   ullRxBroadcastFrames;
 265        u32   ullRxMulticastFrames;
 266        u32   ullRxDirectedFrames;
 267
 268        u32   dwRsrRxFragment;
 269        u32   dwRsrRxFrmLen64;
 270        u32   dwRsrRxFrmLen65_127;
 271        u32   dwRsrRxFrmLen128_255;
 272        u32   dwRsrRxFrmLen256_511;
 273        u32   dwRsrRxFrmLen512_1023;
 274        u32   dwRsrRxFrmLen1024_1518;
 275
 276        // TSR0,1 status count
 277        //
 278        u32   dwTsrTotalRetry[2];        // total collision retry count
 279        u32   dwTsrOnceRetry[2];         // this packet only occur one collision
 280        u32   dwTsrMoreThanOnceRetry[2]; // this packet occur more than one collision
 281        u32   dwTsrRetry[2];             // this packet has ever occur collision,
 282        // that is (dwTsrOnceCollision0 + dwTsrMoreThanOnceCollision0)
 283        u32   dwTsrACKData[2];
 284        u32   dwTsrErr[2];
 285        u32   dwAllTsrOK[2];
 286        u32   dwTsrRetryTimeout[2];
 287        u32   dwTsrTransmitTimeout[2];
 288
 289        u32   dwTsrTxPacket[2];
 290        u32   dwTsrTxOctet[2];
 291        u32   dwTsrBroadcast[2];
 292        u32   dwTsrMulticast[2];
 293        u32   dwTsrDirected[2];
 294
 295        // RD/TD count
 296        u32   dwCntRxFrmLength;
 297        u32   dwCntTxBufLength;
 298
 299        u8    abyCntRxPattern[16];
 300        u8    abyCntTxPattern[16];
 301
 302        // Software check....
 303        u32   dwCntRxDataErr;             // rx buffer data software compare CRC err count
 304        u32   dwCntDecryptErr;            // rx buffer data software compare CRC err count
 305        u32   dwCntRxICVErr;              // rx buffer data software compare CRC err count
 306        u32    idxRxErrorDesc;             // index for rx data error RD
 307
 308        // 64-bit OID
 309        u32   ullTsrOK[2];
 310
 311        // for some optional OIDs (64 bits) and DMI support
 312        u32   ullTxBroadcastFrames[2];
 313        u32   ullTxMulticastFrames[2];
 314        u32   ullTxDirectedFrames[2];
 315        u32   ullTxBroadcastBytes[2];
 316        u32   ullTxMulticastBytes[2];
 317        u32   ullTxDirectedBytes[2];
 318} SStatMIBCount, *PSStatMIBCount;
 319
 320typedef struct tagSNodeItem {
 321        // STA info
 322        u16            wAID;
 323        u8             abyMACAddr[6];
 324        u16            wTxDataRate;
 325        u16            wInActiveCount;
 326        u16            wEnQueueCnt;
 327        u16            wFlags;
 328        bool bPWBitOn;
 329        u8             byKeyIndex;
 330        u16            wWepKeyLength;
 331        u8            abyWepKey[WEP_KEYMAXLEN];
 332        // Auto rate fallback vars
 333        bool bIsInFallback;
 334        u32            uTxFailures;
 335        u32            uTxAttempts;
 336        u16            wFailureRatio;
 337} SNodeItem;
 338
 339typedef struct tagSNodeList {
 340        u32                 uItem;
 341        SNodeItem       sNodeList[0];
 342} SNodeList, *PSNodeList;
 343
 344typedef struct tagSCmdValue {
 345        u32 dwValue;
 346} SCmdValue,  *PSCmdValue;
 347
 348//
 349// hostapd & viawget ioctl related
 350//
 351
 352// VIAGWET_IOCTL_HOSTAPD ioctl() cmd:
 353enum {
 354        VIAWGET_HOSTAPD_FLUSH = 1,
 355        VIAWGET_HOSTAPD_ADD_STA = 2,
 356        VIAWGET_HOSTAPD_REMOVE_STA = 3,
 357        VIAWGET_HOSTAPD_GET_INFO_STA = 4,
 358        VIAWGET_HOSTAPD_SET_ENCRYPTION = 5,
 359        VIAWGET_HOSTAPD_GET_ENCRYPTION = 6,
 360        VIAWGET_HOSTAPD_SET_FLAGS_STA = 7,
 361        VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR = 8,
 362        VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT = 9,
 363        VIAWGET_HOSTAPD_MLME = 10,
 364        VIAWGET_HOSTAPD_SCAN_REQ = 11,
 365        VIAWGET_HOSTAPD_STA_CLEAR_STATS = 12,
 366};
 367
 368#define VIAWGET_HOSTAPD_GENERIC_ELEMENT_HDR_LEN                         \
 369        ((int)(&((struct viawget_hostapd_param *)0)->u.generic_elem.data))
 370
 371// Maximum length for algorithm names (-1 for nul termination) used in ioctl()
 372
 373struct viawget_hostapd_param {
 374        u32 cmd;
 375        u8 sta_addr[6];
 376        union {
 377                struct {
 378                        u16 aid;
 379                        u16 capability;
 380                        u8 tx_supp_rates;
 381                } add_sta;
 382                struct {
 383                        u32 inactive_sec;
 384                } get_info_sta;
 385                struct {
 386                        u8 alg;
 387                        u32 flags;
 388                        u32 err;
 389                        u8 idx;
 390                        u8 seq[8];
 391                        u16 key_len;
 392                        u8 key[0];
 393                } crypt;
 394                struct {
 395                        u32 flags_and;
 396                        u32 flags_or;
 397                } set_flags_sta;
 398                struct {
 399                        u16 rid;
 400                        u16 len;
 401                        u8 data[0];
 402                } rid;
 403                struct {
 404                        u8 len;
 405                        u8 data[0];
 406                } generic_elem;
 407                struct {
 408                        u16 cmd;
 409                        u16 reason_code;
 410                } mlme;
 411                struct {
 412                        u8 ssid_len;
 413                        u8 ssid[32];
 414                } scan_req;
 415        } u;
 416};
 417
 418//2006-1116-01,<Add> by NomadZhao
 419#pragma pack()
 420
 421/*---------------------  Export Classes  ----------------------------*/
 422
 423/*---------------------  Export Variables  --------------------------*/
 424
 425/*---------------------  Export Types  ------------------------------*/
 426
 427/*---------------------  Export Functions  --------------------------*/
 428
 429#endif //__IOCMD_H__
 430