📄 airo.c
字号:
/* This is redundant for x86 archs, but it seems necessary for ARM */#pragma pack(1)/* This structure came from an email sent to me from an engineer at aironet for inclusion into this driver */typedef struct { u16 len; u16 kindex; u8 mac[ETH_ALEN]; u16 klen; u8 key[16];} WepKeyRid;/* These structures are from the Aironet's PC4500 Developers Manual */typedef struct { u16 len; u8 ssid[32];} Ssid;typedef struct { u16 len; Ssid ssids[3];} SsidRid;typedef struct { u16 len; u16 modulation;#define MOD_DEFAULT 0#define MOD_CCK 1#define MOD_MOK 2} ModulationRid;typedef struct { u16 len; /* sizeof(ConfigRid) */ u16 opmode; /* operating mode */#define MODE_STA_IBSS 0#define MODE_STA_ESS 1#define MODE_AP 2#define MODE_AP_RPTR 3#define MODE_ETHERNET_HOST (0<<8) /* rx payloads converted */#define MODE_LLC_HOST (1<<8) /* rx payloads left as is */#define MODE_AIRONET_EXTEND (1<<9) /* enable Aironet extenstions */#define MODE_AP_INTERFACE (1<<10) /* enable ap interface extensions */#define MODE_ANTENNA_ALIGN (1<<11) /* enable antenna alignment */#define MODE_ETHER_LLC (1<<12) /* enable ethernet LLC */#define MODE_LEAF_NODE (1<<13) /* enable leaf node bridge */#define MODE_CF_POLLABLE (1<<14) /* enable CF pollable */#define MODE_MIC (1<<15) /* enable MIC */ u16 rmode; /* receive mode */#define RXMODE_BC_MC_ADDR 0#define RXMODE_BC_ADDR 1 /* ignore multicasts */#define RXMODE_ADDR 2 /* ignore multicast and broadcast */#define RXMODE_RFMON 3 /* wireless monitor mode */#define RXMODE_RFMON_ANYBSS 4#define RXMODE_LANMON 5 /* lan style monitor -- data packets only */#define RXMODE_DISABLE_802_3_HEADER (1<<8) /* disables 802.3 header on rx */#define RXMODE_NORMALIZED_RSSI (1<<9) /* return normalized RSSI */ u16 fragThresh; u16 rtsThres; u8 macAddr[ETH_ALEN]; u8 rates[8]; u16 shortRetryLimit; u16 longRetryLimit; u16 txLifetime; /* in kusec */ u16 rxLifetime; /* in kusec */ u16 stationary; u16 ordering; u16 u16deviceType; /* for overriding device type */ u16 cfpRate; u16 cfpDuration; u16 _reserved1[3]; /*---------- Scanning/Associating ----------*/ u16 scanMode;#define SCANMODE_ACTIVE 0#define SCANMODE_PASSIVE 1#define SCANMODE_AIROSCAN 2 u16 probeDelay; /* in kusec */ u16 probeEnergyTimeout; /* in kusec */ u16 probeResponseTimeout; u16 beaconListenTimeout; u16 joinNetTimeout; u16 authTimeout; u16 authType;#define AUTH_OPEN 0x1#define AUTH_ENCRYPT 0x101#define AUTH_SHAREDKEY 0x102#define AUTH_ALLOW_UNENCRYPTED 0x200 u16 associationTimeout; u16 specifiedApTimeout; u16 offlineScanInterval; u16 offlineScanDuration; u16 linkLossDelay; u16 maxBeaconLostTime; u16 refreshInterval;#define DISABLE_REFRESH 0xFFFF u16 _reserved1a[1]; /*---------- Power save operation ----------*/ u16 powerSaveMode;#define POWERSAVE_CAM 0#define POWERSAVE_PSP 1#define POWERSAVE_PSPCAM 2 u16 sleepForDtims; u16 listenInterval; u16 fastListenInterval; u16 listenDecay; u16 fastListenDelay; u16 _reserved2[2]; /*---------- Ap/Ibss config items ----------*/ u16 beaconPeriod; u16 atimDuration; u16 hopPeriod; u16 channelSet; u16 channel; u16 dtimPeriod; u16 bridgeDistance; u16 radioID; /*---------- Radio configuration ----------*/ u16 radioType;#define RADIOTYPE_DEFAULT 0#define RADIOTYPE_802_11 1#define RADIOTYPE_LEGACY 2 u8 rxDiversity; u8 txDiversity; u16 txPower;#define TXPOWER_DEFAULT 0 u16 rssiThreshold;#define RSSI_DEFAULT 0 u16 modulation;#define PREAMBLE_AUTO 0#define PREAMBLE_LONG 1#define PREAMBLE_SHORT 2 u16 preamble; u16 homeProduct; u16 radioSpecific; /*---------- Aironet Extensions ----------*/ u8 nodeName[16]; u16 arlThreshold; u16 arlDecay; u16 arlDelay; u16 _reserved4[1]; /*---------- Aironet Extensions ----------*/ u8 magicAction;#define MAGIC_ACTION_STSCHG 1#define MACIC_ACTION_RESUME 2#define MAGIC_IGNORE_MCAST (1<<8)#define MAGIC_IGNORE_BCAST (1<<9)#define MAGIC_SWITCH_TO_PSP (0<<10)#define MAGIC_STAY_IN_CAM (1<<10) u8 magicControl; u16 autoWake;} ConfigRid;typedef struct { u16 len; u8 mac[ETH_ALEN]; u16 mode; u16 errorCode; u16 sigQuality; u16 SSIDlen; char SSID[32]; char apName[16]; u8 bssid[4][ETH_ALEN]; u16 beaconPeriod; u16 dimPeriod; u16 atimDuration; u16 hopPeriod; u16 channelSet; u16 channel; u16 hopsToBackbone; u16 apTotalLoad; u16 generatedLoad; u16 accumulatedArl; u16 signalQuality; u16 currentXmitRate; u16 apDevExtensions; u16 normalizedSignalStrength; u16 shortPreamble; u8 apIP[4]; u8 noisePercent; /* Noise percent in last second */ u8 noisedBm; /* Noise dBm in last second */ u8 noiseAvePercent; /* Noise percent in last minute */ u8 noiseAvedBm; /* Noise dBm in last minute */ u8 noiseMaxPercent; /* Highest noise percent in last minute */ u8 noiseMaxdBm; /* Highest noise dbm in last minute */ u16 load; u8 carrier[4]; u16 assocStatus;#define STAT_NOPACKETS 0#define STAT_NOCARRIERSET 10#define STAT_GOTCARRIERSET 11#define STAT_WRONGSSID 20#define STAT_BADCHANNEL 25#define STAT_BADBITRATES 30#define STAT_BADPRIVACY 35#define STAT_APFOUND 40#define STAT_APREJECTED 50#define STAT_AUTHENTICATING 60#define STAT_DEAUTHENTICATED 61#define STAT_AUTHTIMEOUT 62#define STAT_ASSOCIATING 70#define STAT_DEASSOCIATED 71#define STAT_ASSOCTIMEOUT 72#define STAT_NOTAIROAP 73#define STAT_ASSOCIATED 80#define STAT_LEAPING 90#define STAT_LEAPFAILED 91#define STAT_LEAPTIMEDOUT 92#define STAT_LEAPCOMPLETE 93} StatusRid;typedef struct { u16 len; u16 spacer; u32 vals[100];} StatsRid;typedef struct { u16 len; u8 ap[4][ETH_ALEN];} APListRid;typedef struct { u16 len; char oui[3]; char zero; u16 prodNum; char manName[32]; char prodName[16]; char prodVer[8]; char factoryAddr[ETH_ALEN]; char aironetAddr[ETH_ALEN]; u16 radioType; u16 country; char callid[ETH_ALEN]; char supportedRates[8]; char rxDiversity; char txDiversity; u16 txPowerLevels[8]; u16 hardVer; u16 hardCap; u16 tempRange; u16 softVer; u16 softSubVer; u16 interfaceVer; u16 softCap; u16 bootBlockVer; u16 requiredHard; u16 extSoftCap;} CapabilityRid;typedef struct { u16 len; u16 index; /* First is 0 and 0xffff means end of list */#define RADIO_FH 1 /* Frequency hopping radio type */#define RADIO_DS 2 /* Direct sequence radio type */#define RADIO_TMA 4 /* Proprietary radio used in old cards (2500) */ u16 radioType; u8 bssid[ETH_ALEN]; /* Mac address of the BSS */ u8 zero; u8 ssidLen; u8 ssid[32]; u16 rssi;#define CAP_ESS (1<<0)#define CAP_IBSS (1<<1)#define CAP_PRIVACY (1<<4)#define CAP_SHORTHDR (1<<5) u16 cap; u16 beaconInterval; u8 rates[8]; /* Same as rates for config rid */ struct { /* For frequency hopping only */ u16 dwell; u8 hopSet; u8 hopPattern; u8 hopIndex; u8 fill; } fh; u16 dsChannel; u16 atimWindow;} BSSListRid;typedef struct { u8 rssipct; u8 rssidBm;} tdsRssiEntry;typedef struct { u16 len; tdsRssiEntry x[256];} tdsRssiRid;typedef struct { u16 len; u16 state; u16 multicastValid; u8 multicast[16]; u16 unicastValid; u8 unicast[16];} MICRid;typedef struct { u16 typelen; union { u8 snap[8]; struct { u8 dsap; u8 ssap; u8 control; u8 orgcode[3]; u8 fieldtype[2]; } llc; } u; u32 mic; u32 seq;} MICBuffer;typedef struct { u8 da[ETH_ALEN]; u8 sa[ETH_ALEN];} etherHead;#pragma pack()#define TXCTL_TXOK (1<<1) /* report if tx is ok */#define TXCTL_TXEX (1<<2) /* report if tx fails */#define TXCTL_802_3 (0<<3) /* 802.3 packet */#define TXCTL_802_11 (1<<3) /* 802.11 mac packet */#define TXCTL_ETHERNET (0<<4) /* payload has ethertype */#define TXCTL_LLC (1<<4) /* payload is llc */#define TXCTL_RELEASE (0<<5) /* release after completion */#define TXCTL_NORELEASE (1<<5) /* on completion returns to host */#define BUSY_FID 0x10000#ifdef CISCO_EXT#define AIROMAGIC 0xa55a/* Warning : SIOCDEVPRIVATE may disapear during 2.5.X - Jean II */#ifdef SIOCIWFIRSTPRIV#ifdef SIOCDEVPRIVATE#define AIROOLDIOCTL SIOCDEVPRIVATE#define AIROOLDIDIFC AIROOLDIOCTL + 1#endif /* SIOCDEVPRIVATE */#else /* SIOCIWFIRSTPRIV */#define SIOCIWFIRSTPRIV SIOCDEVPRIVATE#endif /* SIOCIWFIRSTPRIV *//* This may be wrong. When using the new SIOCIWFIRSTPRIV range, we probably * should use only "GET" ioctls (last bit set to 1). "SET" ioctls are root * only and don't return the modified struct ifreq to the application which * is usually a problem. - Jean II */#define AIROIOCTL SIOCIWFIRSTPRIV#define AIROIDIFC AIROIOCTL + 1/* Ioctl constants to be used in airo_ioctl.command */#define AIROGCAP 0 // Capability rid#define AIROGCFG 1 // USED A LOT#define AIROGSLIST 2 // System ID list#define AIROGVLIST 3 // List of specified AP's#define AIROGDRVNAM 4 // NOTUSED#define AIROGEHTENC 5 // NOTUSED#define AIROGWEPKTMP 6#define AIROGWEPKNV 7#define AIROGSTAT 8#define AIROGSTATSC32 9#define AIROGSTATSD32 10#define AIROGMICRID 11#define AIROGMICSTATS 12#define AIROGFLAGS 13#define AIRORRID 15/* Leave gap of 40 commands after AIROGSTATSD32 for future */#define AIROPCAP AIROGSTATSD32 + 40#define AIROPVLIST AIROPCAP + 1#define AIROPSLIST AIROPVLIST + 1#define AIROPCFG AIROPSLIST + 1#define AIROPSIDS AIROPCFG + 1#define AIROPAPLIST AIROPSIDS + 1#define AIROPMACON AIROPAPLIST + 1 /* Enable mac */#define AIROPMACOFF AIROPMACON + 1 /* Disable mac */#define AIROPSTCLR AIROPMACOFF + 1#define AIROPWEPKEY AIROPSTCLR + 1#define AIROPWEPKEYNV AIROPWEPKEY + 1#define AIROPLEAPPWD AIROPWEPKEYNV + 1#define AIROPLEAPUSR AIROPLEAPPWD + 1/* Flash codes */#define AIROFLSHRST AIROPWEPKEYNV + 40#define AIROFLSHGCHR AIROFLSHRST + 1#define AIROFLSHSTFL AIROFLSHGCHR + 1#define AIROFLSHPCHR AIROFLSHSTFL + 1#define AIROFLPUTBUF AIROFLSHPCHR + 1#define AIRORESTART AIROFLPUTBUF + 1#define FLASHSIZE 32768typedef struct aironet_ioctl { unsigned short command; // What to do unsigned short len; // Len of data unsigned char *data; // d-data} aironet_ioctl;#endif /* CISCO_EXT */#define NUM_MODULES 2#define MIC_MSGLEN_MAX 2400#define EMMH32_MSGLEN_MAX MIC_MSGLEN_MAXtypedef struct { u32 size; // size u8 enabled; // MIC enabled or not u32 rxSuccess; // successful packets received u32 rxIncorrectMIC; // pkts dropped due to incorrect MIC comparison u32 rxNotMICed; // pkts dropped due to not being MIC'd u32 rxMICPlummed; // pkts dropped due to not having a MIC plummed u32 rxWrongSequence; // pkts dropped due to sequence number violation u32 reserve[32];} mic_statistics;typedef struct { u32 coeff[((EMMH32_MSGLEN_MAX)+3)>>2]; u64 accum; // accumulated mic, reduced to u32 in final() int position; // current position (byte offset) in message union { u8 d8[4]; u32 d32; } part; // saves partial message word across update() calls} emmh32_context;typedef struct { emmh32_context seed; // Context - the seed u32 rx; // Received sequence number u32 tx; // Tx sequence number u32 window; // Start of window u8 valid; // Flag to say if context is valid or not u8 key[16];} miccntx;typedef struct { miccntx mCtx; // Multicast context miccntx uCtx; // Unicast context} mic_module;#ifdef WIRELESS_EXT// Frequency list (map channels to frequencies)static const long frequency_list[] = { 2412, 2417, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462, 2467, 2472, 2484 };// A few details needed for WEP (Wireless Equivalent Privacy)#define MAX_KEY_SIZE 13 // 128 (?) bits#define MIN_KEY_SIZE 5 // 40 bits RC4 - WEPtypedef struct wep_key_t { u16 len; u8 key[16]; /* 40-bit and 104-bit keys */} wep_key_t;/* Backward compatibility */#ifndef IW_ENCODE_NOKEY#define IW_ENCODE_NOKEY 0x0800 /* Key is write only, so not present */#define IW_ENCODE_MODE (IW_ENCODE_DISABLED | IW_ENCODE_RESTRICTED | IW_ENCODE_OPEN)#endif /* IW_ENCODE_NOKEY */#if WIRELESS_EXT > 12/* List of Wireless Handlers (new API) */static const struct iw_handler_def airo_handler_def;#else /* WIRELESS_EXT > 12 *//* More Wireless Extensions backward compatibility *//* Part of iw_handler prototype we need (apart that we don't need it) */struct iw_request_info {};#endif /* WIRELESS_EXT > 12 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -