?? dot11lib.c
字號:
/* dot11Lib.c - Implements muxLoad, etc for Wireless Framework *//* * Copyright (c) 2004-2006 Wind River Systems, Inc. * * The right to copy, distribute, modify or otherwise make use * of this software may be licensed only pursuant to the terms * of an applicable Wind River license agreement. *//* Modification History--------------------02z,16mar06,rb Fix Coverity issues (SPR 119148)02y,21dec05,rb Fix reported radio modes in dot11Show()02x,19dec05,rb Corrected version number for 2.1.2 release03k,28feb06,rb Merge from 2.1.2 SPR branch03j,27feb06,rb Changes from code inspection03i,17feb06,rb Code cleanup and warning removal03h,11nov05,rb Added mSSID feature03g,07oct05,rb Corrected version number for 2.2 release03f,03oct05,rb Fix to bug B0226 - build errors during production build (no DEBUG)03e,28sep05,rb Update header comments and copyright03d,28sep05,rb Fix APIGEN Errors03c,28sep05,rb Fix for B0139: Error messages when rebooting target03b,23sep05,rb Add debugging info for multicast TKIP03a,09sep05,rb Added APIs to modify scanTypes, country code by default02z,02sep05,rb Modified show routine to show current country02y,30aug05,rb Added docs for WIOCDPAIRWISEKEY02x,19aug05,rb Added descriptions for turbo modes02w,18aug05,rb Changed version number for 2.1.1 release02v,04aug05,rb Added documentation for WIOCGCHANNELLIST02u,03aug05,rb Revised documentation for addition of WIOCSUSERAUTHCALLBACK02t,29jul05,rb Add TSN to show routine02s,29jul05,rb Added dot11PoolShow()02r,21jun05,rb Modified version number for post FCS development02q,20may05,rb Minor comment changes to make online docs consistent with printed docs02p,06may05,rb Updated version number02o,27apr05,rb Updated show routine to show new statistics for SPR 10801702n,27apr05,rb Updated external routines with KERNEL tags02m,25apr05,rb Improved IOCTL descriptions02l,14apr05,rb Added support for Transmit Power Scaling (WIOCSTXPOWERSCALE)02k,23mar05,rb Minor show routine changes02j,09mar05,rb Added IOCTLs for retry limits, HW config string02i,07mar05,rb Added names for fourway states02h,02feb05,rb Resolved vxWorks 6.0 compatibility issues02g,25jan05,rb Made security components optionally buildable02f,20jan05,rb Added new security statistics, MIC countermeasures02e,17jan05,rb Updated IOCTL documentation02d,10jan05,rb Changes to the 802.1X authentication callback & port control functions02c,01nov04,rb Added configuration of security policies02b,07oct04,rb Incremented version number for 2.0.1 release02a,23aug04,rb Wind River Wireless Ethernet Driver 2.0 FCS*//*DESCRIPTIONThis file implements the muxLoad(), muxUnload(), muxStart() and muxStop()routines for the Wireless Framework. Any other methods that belong to the high level DOT11_FW object will also be set up here. The muxLoad routine sets up the wireless framework, allocates memory for theother system objects and calls the low level driver's initialize routine. INITIALIZATION STRINGThe init string passed to dot11Load() must contain a single memory addressthat is a pointer to a AR521X_BSP_INFO structure. This structure will containall te necessary information for the driver to run. Function pointers tosupport routines that the BSP is required to provoide are also included.DEBUG ROUTINESIf the driver was compiled with DOT11_DEBUG_GLOBAL defined, then debug messagesmay be printed as the driver executes. There are several different levels ofdebug messages: 1 DOT11_DEBUG_FATAL Show non-recoverable errors only 2 DOT11_DEBUG_ERROR Show all errors affecting device operation 3 DOT11_DEBUG_INFO Show diagnostic messages detailing device function 4 DOT11_DEBUG_FLOOD Many diagnostic messages, often on a per-packet basis 5 DOT11_DEBUG_NONE Do not show any debug messagesThere are also several different debug areas. Each area can have the level ofmessages set independently: 0 DOT11_AREA_ALL All areas below 1 DOT11_AREA_INIT Device initialization. Covers all of the below. 2 DOT11_AREA_SME SME : Device state and management 3 DOT11_AREA_DPE DPE : Device DataPath 4 DOT11_AREA_HDD HDD : Low-level hardware routines 5 DOT11_AREA_INT INT : Interrupt service rouineTo change the level of messages printed, you can use the routine dot11DebugLevelSet(). Note that debiug messages are printed on a global basis, not per-interface.for example, to show diagnostic messages for all areas: -> dot11DebugLevelSet 0,3MANAGEMENT ROUTINES (IOCTL COMMANDS)The driver is managed through a number of IOCTL commands. The IOCTL commands are separated into two categories, SME specific routines and common routines. As the name suggests, the SME specific routines are those that change depending on the WLAN mode - ESS, IBSS or AP. They are defined in the WLAN mode specific file, dot11SmeXXXLib.cThe following is a list of all Management routines, followed by a detailed description of each:\tsCommand | Description | Data Type ------------------------------------------------------------------------WIOCGSTATS | Get Card Statistics | DOT11_STATS *WIOCGLINKSTAT | Get Link Status | UINT32 *WIOCGDESIREDSSID | Get Wireless Network Name | char *WIOCSSSID | Set Wireless Network Name | const char *WIOCGCONNECTEDSSID | Get current BSS | char *WIOCGCONNECTEDBSSID | Get connected BSSID | UINT32 *WIOCGCOMMQUAL | Get current link quality [ESS] | UINT32 *WIOCSDOT11MODE | Change the mode of the SME | UINT32WIOCGDOT11MODE | Get the curremt mode of the SME | UINT32 *WIOCGRADIOMODE | Get the current radio mode | UINT32 *WIOCSRADIOMODE | Set the current radio mode | UINT32WIOCGTXRATE | Get current transmit rate | UINT32 *WIOCSTXRATE | Set Transmit Speed (Unicast) | DOT11_RATES *WIOCSBCASTRATE | Set Transmit Speed (Multi & broad) | UINT32WIOCGBCASTRATE | Get Transmit Speed (Multi & broad) | UINT32 *WIOCGPWRMAN | Get Power Management Status | UINT32 *WIOCSPWRMAN | Set Power Management Status | UINT32WIOCGCARDTYPE | Get Card Type | UINT32 *WIOCGCHANNEL | Get Channel | UINT32 *WIOCSCHANNEL | Set Channel | UINT32 WIOCGWEPAVAIL | Get WEP Availability | UINT32 *WIOCSWEPKEY0 | Set value for WEP KEY 0 | UINT8 *WIOCSWEPKEY1 | Set value for WEP KEY 1 | UINT8 *WIOCSWEPKEY2 | Set value for WEP KEY 2 | UINT8 *WIOCSWEPKEY3 | Set value for WEP KEY 3 | UINT8 *WIOCSWEPDEFAULTKEY | Set WEP default key | UINT32WIOCGENCRYPTTYPE | Get encryption type | UINT32 *WIOCSENCRYPTTYPE | Set encryption type | UINT32 WIOCAACLSTA | Add a STA to AP authentication list | UINT32 *WIOCDACLSTA | Delete a STA from AP auth list | UINT32 *WIOCSEXUNENCRYPT | Set exclude unencrypted | UINT32WIOCGEXUNENCRYPT | Get exclude unencrypted | UINT32 *WIOCGAUTHTYPE | Get Authentication protocol | UINT32 *WIOCSAUTHTYPE | Set Authentication protocol | UINT32 WIOCSAUTHCALLBACK | Register authentication callback | FUNCPTRWIOCSUSERAUTHCALLBACK| Register user authentication callback | FUNCPTRWIOCSBEACONRATE | Set rate for AP beaconing | UINT32WIOCGBEACONRATE | Get rate for AP beaconing | UINT32 *WIOCGMAC | Get MAC address | UNIT32 *WIOCSCTSRTS | Set CTS/RTS | UINT32WIOCGCTSRTS | Get CTS/RTS | UINT32 *WIOCSSHORTRETRY | Set short retry limit | UINT32WIOCGSHORTRETRY | Get short retry limit | UINT32 *WIOCSLONGRETRY | Set long retry limit | UINT32WIOCGLONGRETRY | Get long retry limit | UINT32 *WIOCSFRAGTHRESH | Set Fragmentation threshold | UINT32WIOCGFRAGTHRESH | Get Fragmentation threshold | UINT32 *WIOCSADVSECURITY | Set advanced security options | UINT32WIOCGADVSECURITY | Get advanced security options | UINT32 *WIOCSDTIMRATE | Set DTIM rate | UINT32 WIOCGDTIMRATE | Get DTIM rate | UINT32 *WIOCGSUPPTXRATE | Get Supported Tx rates | DOT11_RATES *WIOCGSUPPRXRATE | Get Supported Rx Rates | DOT11_RATES *WIOCSACLMODE | Set Access Control List mode | UINT32WIOCGACLMODE | Get Access Control List mode | UINT32 *WIOCBSSSCAN | Perform BSS scan and wait for res. | DOT11_SCAN_REQ *WIOCSSECPOL | Set current WPA/RSN security policy | UINT32 WIOCGSECPOL | Get current WPA/RSN security policy | UINT32 *WIOCSAUTHPOL | Set current WPA/RSN authentication pol| UINT32 WIOCGAUTHPOL | Get current WPA/RSN authentication pol| UINT32 *WIOCSCIPHPOL | Set current WPA/RSN cipher policy | UINT32 WIOCGCIPHPOL | Get current WPA/RSN cipher policy | UINT32 *WIOCSPASSPHRASE | Set WPA/RSN passphrase for PSK | char *WIOCSPSK | Set WPA/RSN pre-shared key | UINT8 *WIOCSPMK | <Internal> Set WPA/RSN PMK directly | UINT8 *WIOCSAUTHCALLBACK | <Internal> Set association callback | FUNCPTRWIOCSDOT1XPORTSTATUS | <Internal> Set 802.1X status of pKsl | <other>WIOCSCOUNTRYCODE | Set 802.11d country code | UINT32WIOCGCOUNTRYCODE | Get 802.11d country code | UINT32 *WIOCS80211D | Enable / disable 802.11d mode | BOOLWIOCG80211D | return status of 802.11d mode | BOOL *WIOCGHWVERS | Return hardware version info | char *EIOCGADDR | Get MAC address of device | UINT8 *EIOCSADDR | Set MAC address of device | UINT8 *WIOCSTXPOWERSCALE | Sets the transmit power scaling factor| UINT32WIOCGTXPOWERSCALE | Gets the transmit power scaling factor| UINT32 *WIOCGCHANNELLIST | Gets a list of the supported channels | DOT11_CHANNEL_LIST *WIOCSSCANTYPE | Sets the allowed scan: passive or act.| UINT32WIOCGSCANTYPE | Gets currently allowed scan types | UINT32 *WIOCSBSS | Set the current BSS being configured | UINT32WIOCGBSS | Get the current BSS being configured | UINT32 *WIOCABSS | Create a new BSS and return it's num | UINT32 *WIOCDBSS | Delete the specified BSS | UINT32 WIOCSMBSSADDRBITS | Set the bits used for mBSSIDs | UINT32WIOCSVLAN | Sets the status of VLAN mode | UINT32WIOCGVLAN | Gets the current status of VLAN mode | UINT32 *\te \is\i WIOCGSTATS : Get Card StatisticsReturns the current values of the card counters. <data> is a pointer to a DOT11_STATS structure, which is defined in: %WIND_BASE%/target/h/drv/wlan/dot11Lib.h\i WIOCGLINKSTAT : Get Link StatusReturns the current link status of the card. <data> should be a pointer toa UINT32, which will be filled in with one of the following values, defined indot11Lib.h 0 'DOT11_LINK_DOWN' - The card is not connected to a wireless network and data packets will be dropped. 1 'DOT11_LINK_UP' - The card is connected to a wireless network and data packets will be sent immediately. If this is a station in ESS mode aand WPA/RSN is enabled, then the 4way handshake has also succeeded. 2 'DOT11_LINK_SLEEP' - The card is connected to a wireless network but is currently asleep. Data packets will be sent as soon as the card wakes up.\i WIOCGDESIREDSSID: Get Wireless Network NameReturns the network name as set by EIOCSDESIREDSSID as a NULL terminated string. Note that this is not necessarily the currently connected BSS name, just the <desired> BSS name. <data> should be a pointer to a string of at least DOT11_SSID_LEN + 1 (33) bytes.\i WIOCSSSID : Set Desired Wireless Network NameSets the desired network name to the specified value. <data> is a pointer toa string of at most DOT11_SSID_LEN + 1 (33) byte. An empty string "" directs the card to join the nearest wireless network that accepts the broadcast SSID\i WIOCGCONNECTEDSSID: Get current SSIDReturns the name of the wireless network that the WLAN card is currently connected to. This may be different than the desired SSID if the desired SSIDis the ANY SSID (""). If no BSS is currently connected to (Out of range of AP,etc) a string is returned stating the fact. <data> should be a pointer to a string of minimum length DOT11_SSID_LEN (32).\i WIOCGCONNECTEDBSSID : Get connected BSSIDReturns the BSSID of the currently connected AP. This is a six byte field that is usually the MAC address of the wireless card in the AP. Data shouldbe a pointer to a byte array of six bytes. ie. UINT8[6]\i WIOCGCOMMQUAL : Returns the communications quality.Returns the signal strength of the currently connected access point. ThisIOCTL is only valid in ESS mode. <data> is a pointer to a UINT32 into whichthe signal strength, in a range from 0 to 255 will be placed\i WIOCSDOT11MODESets/changes the mode of the SME to be one of the following. If a mode wasset previously, it is deinitialized before the new mode is initialized. Somesettings may be lost when de-initializing a mode. It is recommended that anynon-standard settings be reapplied when DOT11_MODE_NONE 0 DOT11_MODE_ESS 1 DOT11_MODE_IBSS 2 DOT11_MODE_AP 3Note: this IOCTL replaces the EIOCSIBSSMODE\i WIOCGDOT11MODEReturns the current DOT11 mode. The values returned are the same as those used in WIOCSDOT11MODE. <data> should be a pointer to a UINT32, where the dot11Mode will be placed.Note: This IOCTL replaces EIOCGIBSSMODE and EIOCGMODE \i WIOCGRADIOMODE : Get the radio typeReturns the radio type currently set by WIOCSRADIOTYPE\i WIOCSRADIOMODE : Sets the radio type Sets the radio type that determines the available rates and channels. Usingthe "any supported" radio type will allow the card to search all availablechannels for an SSID, regardless of mode\ts value | radio mode-------------------- 1 | a 2 | b 4 | g 6 | b/g 7 | any supported\te\i WIOCSBCASTRATE : Set Transmit Speed (Multi & broad)Sets the speed at which broadcast and multicast packets are sent. If thisis set to 0, the largest rate that is a "basic" rate will be chosen. <data> should contain the rate in 802.11 format, ie in units of 500 kb/s. For example, 11 Mbps == 0x16 \i WIOCGBCASTRATE : Get Transmit Speed (Multi & broad)Returns the actual rate at which broadcast and multicast packets are currently sent, in IEEE format (units of 500 kb/s)\i WIOCGTXRATE : Get current transmit rateReturns the last used transmit rate of the card. This is expressed in IEEE format (units of 500 kb/s). This IOCTL is only applicable in ESS mode, wherethe station is sending to a single point, the AP. In an IBSS or AP, the device may be sending to many different stations, each with a different transmit rate.\i WIOCSTXRATE : Set Transmit SpeedSets the allowed transmit speeds of the card. A DOT11_RATES * is passed inthat contains the list of rates that the card is allowed to use. The rates should be in IEEE 802.11 format. (units of 500 kb/s) The IOCTLwill fail if there is not at least one intersection between the supported rates of the card and the transmit rates specified. The exception is an emptyrate set, one with the length of zero. An empty rate set places no restrictionon the transmit rate - the card is allowed to use all available rates.\i WIOCGPWRMAN : Get Power Management StatusReturns the power management setting. This is a boolean value specifingwhether Power Management is enabled, <data> should be a pointer to a UINT32.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -