📄 zdapi.h
字号:
#ifndef _ZDAPI_H_
#define _ZDAPI_H_
#include "zdtypes.h"
#include "zdsorts.h"
//#define HMAC_DEBUG
#ifdef HMAC_DEBUG
#define FPRINT(string) printk(KERN_DEBUG "%s\n", string)
#define FPRINT_V(string, i) printk(KERN_DEBUG "%s = %x\n", string, i)
#else
#define FPRINT(string)
#define FPRINT_V(string, i)
#define VerAssert(x) printk("Maybe Unsupport mode in %s(%d)",__FILE__,__LINE__);
#define LongPrint(x,y) {int i;for(i=0;i<100*y;i++) printk("%s",x);}
#endif
//#define ZD_DEBUG //debug protocol stack
#ifdef ZD_DEBUG
#define ZDEBUG(string) FPRINT(string)
#define ZDEBUG_V(string, i) FPRINT_V(string, i)
#else
#define ZDEBUG(string) //do {} while (0)
#define ZDEBUG_V(string, i) //do {} while (0)
#endif
//#define PS_DEBUG //debug power save function
#ifdef PS_DEBUG
#define PSDEBUG(string) FPRINT(string)
#define PSDEBUG_V(string, i) FPRINT_V(string, i)
#else
#define PSDEBUG(string) //do {} while (0)
#define PSDEBUG_V(string, i) //do {} while (0)
#endif
//#define HASH_DEBUG //debug hash function
#ifdef HASH_DEBUG
#define HSDEBUG(string) FPRINT(string)
#define HSDEBUG_V(string, i) FPRINT_V(string, i)
#else
#define HSDEBUG(string) //do {} while (0)
#define HSDEBUG_V(string, i) //do {} while (0)
#endif
//#define RATE_DEBUG //debug rate adaption function
#ifdef RATE_DEBUG
#define RATEDEBUG(string) FPRINT(string)
#define RATEDEBUG_V(string, i) FPRINT_V(string, i)
#else
#define RATEDEBUG(string) //do {} while (0)
#define RATEDEBUG_V(string, i) //do {} while (0)
#endif
//#define DEFRAG_DEBUG //debug defrag function
#ifdef DEFRAG_DEBUG
#define DFDEBUG(string) FPRINT(string)
#define DFDEBUG_V(string, i) FPRINT_V(string, i)
#else
#define DFDEBUG(string) //do {} while (0)
#define DFDEBUG_V(string, i) //do {} while (0)
#endif
#ifdef ZDCONF_PORTING_BIGENDIAN
#define zd_cpu_to_le32(x) (((x & 0xff000000) >> 24) | \
((x & 0x00ff0000) >> 8) | \
((x & 0x0000ff00) << 8) | \
((x & 0x000000ff) << 24))
#define zd_le32_to_cpu(x) (((x & 0xff000000) >> 24) | \
((x & 0x00ff0000) >> 8) | \
((x & 0x0000ff00) << 8) | \
((x & 0x000000ff) << 24))
#define zd_le16_to_cpu(x) le16_to_cpu(x)
#define zd_cpu_to_le16(x) cpu_to_le16(x)
#else //host is little endian
#define zd_cpu_to_le32(x) (x)
#define zd_le32_to_cpu(x) (x)
#define zd_cpu_to_le16(x) (x)
#define zd_le16_to_cpu(x) (x)
#endif
#define CMD_RESET_80211 0x0001 //parm1: zd_80211Obj_t *
#define CMD_ENABLE 0x0002 //parm1: None
#define CMD_DISASOC 0x0003 //parm1: U8 *MacAddress, parm2: reasonCode
#define CMD_DEAUTH 0x0004 //parm1: U8 *MacAddress, parm2: reasonCode
#define CMD_PS_POLL 0x0005 //parm1: U8 *MacHeader
#define CMD_PASSIVE_SCAN 0x0006 //parm1: None
#define CMD_DISASOC_ALL 0x0007 //parm1: U8 *MacAddress, parm2: reasonCode
#define CMD_CONNECT 0x0008 //parm1: None, parm2: BssIndex
#define CMD_PROBE_REQ 0x0009 //parm1: None, parm2: WithSSID
#define CMD_DIS_CONNECT 0x000A
#define CMD_FLUSH_QUEUE 0x000B
#define CMD_ROAMING 0x000C
//Event Notify
#define EVENT_TBCN 0x0010
#define EVENT_DTIM_NOTIFY 0x0011
#define EVENT_TX_COMPLETE 0x0012 //parm1: tx status, parm2: msgId, parm3: aid
#define EVENT_TCHAL_TIMEOUT 0x0013
#define EVENT_SCAN_TIMEOUT 0x0014
#define EVENT_UPDATE_TX_RATE 0x0015 //parm1: rate, parm2: aid
#define EVENT_SW_RESET 0x0016
#define EVENT_BUF_RELEASE 0x0017
#define EVENT_ENABLE_PROTECTION 0x0018
#define EVENT_AUTH_TIMEOUT 0x0019
#define EVENT_ASOC_TIMEOUT 0x001A
#define EVENT_PS_CHANGE 0x001B //parm1: PwrState
#define EVENT_MORE_DATA 0x001C
#define EVENT_ENABLE_BARKER 0x001D
#define EVENT_SHORT_SLOT 0x001E
#define DO_CHAL 0x0001
#define DO_SCAN 0x0002
#define DO_AUTH 0x0003
#define DO_ASOC 0x0004
#define SCAN_TIMEOUT 100 //ms
#define HOUSE_KEEPING_PERIOD 100 //ms
#define AUTH_TIMEOUT 512 //3000 //ms
#define ASOC_TIMEOUT 512 //2000 //ms
//reason code
#define ZD_UNSPEC_REASON 1
#define ZD_AUTH_NOT_VALID 2
#define ZD_DEAUTH_LEAVE_BSS 3
#define ZD_INACTIVITY 4
#define ZD_AP_OVERLOAD 5
#define ZD_CLASS2_ERROR 6
#define ZD_CLASS3_ERROR 7
#define ZD_DISAS_LEAVE_CSS 8
#define ZD_ASOC_NOT_AUTH 9
#define ZD_INVALID_IE 13
#define ZD_MIC_FAIL 14
#define ZD_4WAY_SHAKE_TIMEOUT 15
#define ZD_GKEY_UPDATE_TIMEOUT 16
#define ZD_IE_IMCOMPABILITY 17
#define ZD_MC_CIPHER_INVALID 18
#define ZD_UNI_CIPHER_INVALID 19
#define ZD_AKMP_INVALID 20
#define ZD_UNSUP_RSNE_VERSION 21
#define ZD_INVALID_RSNE_CAP 22
#define ZD_8021X_AUTH_FAIL 23
/* association_status_notify() <- status */
#define STA_ASOC_REQ 0x0001
#define STA_REASOC_REQ 0x0002
#define STA_ASSOCIATED 0x0003
#define STA_REASSOCIATED 0x0004
#define STA_DISASSOCIATED 0x0005
#define STA_AUTH_REQ 0x0006
#define STA_DEAUTHED 0x0007
//Tx complete event
#define ZD_TX_CONFIRM 0x0001
#define ZD_RETRY_FAILED 0x0002
//for Dymanic Key
#define DYN_KEY_WEP64 1
#define DYN_KEY_WEP128 2
#define DYN_KEY_TKIP 4
#define DYN_KEY_AES 5
//Rate Defintion
#define RATE_1M 0
#define RATE_2M 1
#define RATE_5M 2
#define RATE_11M 3
#define RATE_16M 4
#define RATE_22M 5
#define RATE_27M 6
#define RATE_33M 7
#define RATE_38M 8
#define RATE_44M 9
#define RATE_49M 10
#define RATE_55M 11
#define RATE_60M 12
#define RATE_6M 0x04
#define RATE_9M 0x05
#define RATE_12M 0x06
#define RATE_18M 0x07
#define RATE_24M 0x08
#define RATE_36M 0x09
#define RATE_48M 0x0a
#define RATE_54M 0x0b
#define NO_WEP 0x0
#define AES 0x4
#define WEP64 0x1
#define WEP128 0x5
#define WEP256 0x6
#define TKIP 0x2
#define NUM_SUPPORTED_RATE 32
// pfrmDesc->ConfigSet
#define INTRA_BSS_SET 0x01
#define EAPOL_FRAME_SET 0x02
#define FORCE_WEP_SET 0x04
//BssType
#define INDEPENDENT_BSS 0x0
#define INFRASTRUCTURE_BSS 0x1
#define PSEUDO_IBSS 0x3
#define AP_BSS 0x4
//RxFilter
#define AP_RX_FILTER 0x0400feff
#define STA_RX_FILTER 0x0000ffff
//pSetting->MacMode
#define MIXED_MODE 0x01
#define PURE_G_MODE 0x02
#define PURE_B_MODE 0x03
#define PURE_A_MODE 0x04
#define CW_SHORT_SLOT 0x7f043f
#define CW_NORMAL_SLOT 0xff043f
#define CW_LONG_SLOT 0x7f047f
//for Rate Adaption
#define RISE_CONDITION_THRESHOLD 5
#define DOWN_CONDITION_THRESHOLD 3
#define LINE1 100
#define LINE2 10
#define LINE3 5
//for CAM
#define CAM_VAP_START_AID 33
#define CAM_VAP_END_AID 39
#define HW_MIC_FINISH 0x55555555
#define CAM_ADDR_NOT_MATCH 40
#define PURE_B_AP 0
#define MIXED_AP 1
#define PURE_G_AP 2
#define PURE_A_AP 3
enum Operation_Mode {
CAM_IBSS = 0,
CAM_AP,
CAM_STA,
CAM_AP_WDS,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -