📄 intprismioctl.c
字号:
/* intPrismIoctl.c - management functions for WLAN driver *//* Copyright 2001-2003 Wind River Systems, Inc. *//*modification history--------------------02p,09may03,rb Removed warnings caused by IPv6 integration02o,22apr03,ss updated to use intPrismTertAp.h02n,26feb03,ss Fixed diab compiler warnings02m,17may02,rb Fixed comments around unicast key support02l,16may02,rb Implemented new IOCTLs for CTS/RTS, Fragmentation, Preamble Length, AuthRespTO, UNI & MULTI key slots; prevented reset from being called on changing WEP keys for oneXMode02k,13may02,dxb Removed static values for taskDelay().02j,08may02,dxb Added reset to 3Com card when changing SSID.02i,03may02,rb Updated comments as per doc review02h,15apr02,rb Fixed comments describing IOCTLs02g,08apr02,ss Update to use pWlanDev and WLAN_BASE_ADDR everywhere02f,04apr02,dxb Added Prism 3 support.02e,18mar02,ss Update to use WLAN_CARDTYPE_INTERSIL_2 and _2_502d,08mar02,rb Put correct values for EIOCGLINKSTAT02c,21feb02,rb Added STA and AP MIB hooks, moved functionality to intPrismMibIoctl.c02b,11feb02,rb Added IOCTL support for STA MIB; Added BEACONRATE IOCTLs02a,08feb02,rb Added check for NULL data in EIOCGAUTHTYPE01z,07feb02,rb Made IOCTLs compatible with definitions in wlanEnd.h01y,28jan02,rb Added consistent interface for EIOCSRATE/GRATE across all cards.01x,23jan02,rb Added 802.1x extension Ioctls01w,14jan02,dxb Updated comments for EIOCGCARDTYPE to include 3COM and CISCO.01v,12nov01,rb Fix SPR 71525 - Power Management on 3Com doesn't work01u,06nov01,rb Fix for bug w/ EIOCGIBSSMODE (SPR 71502)01t,05nov01,rb Changed API's wlan->intPrism01s,02nov01,dxb Updated with new file name.01r,31oct01,rb Fixed bug in EIOCGWEPTYPE that always returned 6401q,25oct01,rb Added WEP and IBSS support for 3Com cards. Revised IBSS for all cards. Added EIOCSIBSSMODE. Added new option to AUTHTYPE01p,19oct01,rb Fixed endianness bug in EIOCGDESIREDSSID01o,17oct01,rb Fixed spelling mistakes in comments01n,16oct01,rb Changed IOCTL names for SSID manipulation01m,03oct01,rb Re-fixed bug in GNETNAME01l,01oct01,rb Added shared-key support. Added keysize IOCTL. Added channel IOCTLs. Changed IBSS behavious for Intersil. Fixed byte-swap problem in GNETNAME.01k,19sep01,rb Added support for big-endian architectures - MIPs01j,11sep01,rb Fixed bug in EIOCSWEPDEFAULTKEY - wlanReset is now before the 'break'01i,29aug01,rb Fixed bug in EIOCSPWRMAN - need to reset card after changing setting01i,29aug01,ss Added ioctl's for adding/removing STA's from authentication list01h,27aug01,rb Removed warnings01g,24aug01,ss Added ioctl's for AP01f,22aug01,rb Fix bug #6 - debugging code not taken out in EIOCSTXRATE01e,16aug01,rb Added correct path to wlan.h01d,16aug01,rb Added support for 3com NIC to security and IBSS01c,18jul01,rb Added IBSS support for Intersil cards; fixed EIOCGBSSNAME01b,12jul01,rb Changes from code review01a,11jun01,rb Created*//*DESCRIPTIONThis file contains the private WLAN IOCTL that handles card management. It iscalled by the intPrismIoctl() routine in intPrismEnd.c when intPrismIoctl() is passed a command that it does not recognise. If intPrismManage() does not recognize it either, then EINVAL is returned, as specified in the NPT: User's Guide.The command constants (such as EIOCGLINKSTAT) are defined starting at 0x200 - well outside the range (0-128) reserved for MUX system IOCTLs. They are defined in wlanEnd.hThe commands available for card management are shown in the table below:\tsCommand | Description | Data Type ------------------------------------------------------------------------EIOCGSTATS | Get Card Statistics | WLAN_STATS *EIOCGLINKSTAT | Get Link Status | UINT16 *EIOCGDESIREDSSID | Get Wireless Network Name | char *EIOCSSSID | Set Wireless Network Name | const char *EIOCGCONNECTEDSSID | Get current BSS | char *EIOCGSTNNAME | Get Station Name | char *EIOCSSTNNAME | Set Station Name | const char *EIOCGTXRATE | Get current transmit rate | UINT16 *EIOCSTXRATE | Set Transmit Speed | UINT16EIOCGPWRMAN | Get Power Management Status | UINT16 *EIOCSPWRMAN | Set Power Management Status | UINT16EIOCGCOMMQUAL | Get Communications Quality | UINT16 *EIOCSPROMISC | Set Promiscuous Mode | UINT16EIOCGCARDTYPE | Get Card Type | UINT16 *EIOCGWEPAVAIL | Get WEP Availability | UINT16 *EIOCGWEPSTATUS | Get WEP Status | UINT16 *EIOCSWEP | Enable/Disable WEP | UINT16EIOCSWEPKEY0 | Set value for WEP KEY 0 | UINT8 *EIOCSWEPKEY1 | Set value for WEP KEY 1 | UINT8 *EIOCSWEPKEY2 | Set value for WEP KEY 2 | UINT8 *EIOCSWEPKEY3 | Set value for WEP KEY 3 | UINT8 *EIOCSWEPDEFAULTKEY | Set WEP default key | UINT16EIOCGMODE | Get the Card Mode | UINT16EIOCSAPMODE | Set Card into Tert. AP mode | UINT16EIOCASTA | Add a STA to AP authentication list| UINT16 *EIOCDSTA | Delete a STA from AP auth list | UINT16 *EIOCGCHANNEL | Get Channel used to create IBSS | UINT16 *EIOCSCHANNEL | Set Channel used to create IBSS | UINT16 EIOCGWEPTYPE | Get WEP type - 64 bit or 128 bit | UINT16 *EIOCSWEPTYPE | Set WEP type - 128 bit or 128 bit | UINT16 EIOCGAUTHTYPE | Get Authentication protocol | UINT16 *EIOCSAUTHTYPE | Set Authentication protocol | UINT16 EIOCGCONNECTEDBSSID| Get connected BSSID | UINT16 *EIOCSIBSSMODE | Set IBSS Mode | UINT16 EIOCGIBSSMODE | Get IBSS Mode | UINT16 *EIOCSAUTHCALLBACK | Register authentication callback | FUNCPTREIOCS802DOT1XMODE | Set 802.1x mode | UINT16EIOCG802DOT1XMODE | Get 802.1x mode status | UINT16 *EIOCSBEACONRATE | Set rate for AP beaconing | UINT16EIOCGBEACONRATE | Get rate for AP beaconing | UINT16 *EIOCSCTSRTS | Set CTS/RTS | UINT16EIOCGCTSRTS | Get CTS/RTS | UINT16 *EIOCSFRAGTHRESH | Set Fragmentation threshold | UINT16EIOCGFRAGTHRESH | Get Fragmentation threshold | UINT16 *EIOCSPREAMBLE | Set preamble length | UINT16EIOCGPREAMBLE | Get preamble length | UINT16 *EIOCSAUTHRESPTO | Set Authentication response timeout| UINT16EIOCGAUTHRESPTO | Get Authentication response timeout| UINT16 * EIOCSUNICASTKEYNUM | Set unicast key slot | UINT16EIOCGUNICASTKEYNUM | Get unicast key slot | UINT16 *EIOCSMULTICASTKEYNUM|Set multicast key slot | UINT16EIOCGMULTICASTKEYNUM|Get multicast key slot | UINT16 *EIOCSADVSECURITY | Set advanced security options | UINT16EIOCGADVSECURITY | Get advanced security options | UINT16 *\te SEE ALSOintPrismEnd.c intPrismHw.h wlanEnd.h*/ #include <vxWorks.h>#include <string.h>#include <ioLib.h>#include <logLib.h>#include <taskLib.h>#include <stdio.h>#include <intLib.h>#include <sysLib.h>#include "wrn/wlan/wlanEnd.h"#include "wrn/wlan/intPrismHw.h"#include "wrn/wlan/intPrismTertAp.h"#include "wrn/wlan/snmp802dot11.h"IMPORT STATUS sysWlanCfgParamGet(UINT32 cmd, INT32 data);STATUS intPrismWepKeyAdd(WLAN_DEV * pWlanDev, int keyNum, UINT8* pKey);int intPrismMibIoctl(WLAN_DEV * pWlanDev, int cmd, caddr_t data);/****************************************************************************** intPrismManage - WLAN IOCTL handler** The intPrismIoctl() routine passes any IOCTL calls that are not standard END* calls to this routine. Any private WLAN calls to modify 802.11 behaviour* are handled here.** WLAN IOCTL CALLS* \is* \i EIOCGSTATS : Get Card Statistics* Returns the current values of the card counters. <data> is to be a pointer* to a WLAN_STATS structure, or an array of 20 unsigned longs.** \i EIOCGLINKSTAT : Get Link Status* Returns the current link status of the card. <data> should be a pointer to* a UINT16. If <data> is NULL, then the link status will be printed to the* console at error level DEBUG_ERROR (if debugging is on). The return values * are defined as:* 1 - Disabled* 2 - Searching for initial connection* 3 - Connected to IBSS* 4 - Connected to ESS* 5 - Out of range (in ESS)* 6 - Connected to WDS* 8 - In host-AP mode* Note : EIOCGLINKSTAT is not valid for cards in tertiary AP mode** \i EIOCGDESIREDSSID: Get Wireless Network Name* Returns the network name as set by EIOCSDESIREDSSID. Note that this is not* necessarily the current BSS name, just the <desired> BSS name. <data> * should be a pointer to a string of at least BSS_NAME_MAX** \i EIOCSSSID : Set Wireless Network Name* Sets the desired network name to the specified value. <data> is a pointer to* a string of length less that BSS_NAME_MAX** \i EIOCGCONNECTEDSSID: Get current BSS* Returns the name of the BSS that the WLAN card is currently connected to. 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 length* BSS_NAME_MAX** \i EIOCGSTNNAME : Get Station Name* Returns the Station Name assigned to the card. This is for diagnostic and * management purposes only, and does not affect the card's behaviour in any * way. <data> is a pointer to a string of at least length BSS_NAME_MAX* * \i EIOCSSTNNAME : Set Station Name* Sets the stations anem for the WLAN card. <Data> is a pointer to the string* containing the name** \i EIOCGTXRATE : Get current transmit rate* Returns the last used transmit rate of the card. This is a bitmask with* one of the following bits set:* \ts* Bit | Speed | Macro* --------------------------------* 0 | 1 Mbps | WLAN_1_MBIT* 1 | 2 Mbps | WLAN_2_MBIT* 2 | 5.5 Mbps | WLAN_5_MBIT* 3 | 11 Mbps | WLAN_11_MBIT* \te* Note that this is not the current setting for the card as set by EIOCSTXRATE* but rather the speed at which the last packet transmitted was sent at.* <data> should be a pointer to a UINT16** \i EIOCSTXRATE : Set Transmit Speed* Sets the allowed transmnit speeds of the card. The rate is a bitmask * in the same format as EIOCGTXRATE, except that more than one may be * specified.** \i EIOCGPWRMAN : Get Power Management Status* Returns the power management setting. This is a value specifing* whether Power Management is enabled, WLAN_PMANAGE_ENABLED or * WLAN_PMANAGE_DISABLED* <data> should be a pointer to a UINT16** \i EIOCSPWRMAN : Set Power Management Status* <data> = WLAN_PMANAGE_ENABLED , Turn power management ON* <data> = WLAN_PMANAGE_DISABLED , Turn power management OFF** \i EIOCGCOMMQUAL : Get Communications Quality* Returns the communications quality related to the currently connected BSS. * This is an integer from 0 (disconnected) to 92 (perfect signal), although * the exactl range returned may vary on different cards. <Data> * should be a pointer to a UINT16* * \i EIOCSPROMISC : Set Promiscuous Mode* A boolean flag setting the state of the card. If <data> is TRUE, all packets* presented to the interface will be passed to the network stack. If <data>* is false, only broadcast and unicast packets directed at this station will* be passed to the network stack.* * \i EIOCGCARDTYPE : Get Card Type* Returns the detected card type. <data> is a pointer to a UINT16. The * following card types are returned.* \ts* value | Card Type* --------------------------------------* -1 | Unknown card* 0 | Card not present* 1 | Lucent Wavelan / Orinoco* 2 | 3Com AirConnect* 3 | Cisco Aironet* 4 | Intersil Prism-2 based card* 5 | Intersil Prism-2.5 based card* 6 | Intersil Prism-3 based card** \te** \i EIOCGWEPAVAIL : Get WEP Availability* Returns a boolean value indicating whether or not WEP is available on this* card. <data> should be a pointer to a UINT16** \i EIOCGWEPSTATUS : Get WEP Status* Returns a boolean value indicating whether or not WEP is enabled on this* card. <data> should be a pointer to a UINT16** \i EIOCSWEP : Enable/Disable WEP * <data> is a boolean value indicating whether to enable or disable WEP** \i EIOCSWEPKEY0 : Set value for WEP KEY 0 * Sets the value for KEY0. This value is 5 bytes in length for 40/64 bit * encryption, and 13 bytes for 128 bit. This length is controlled via the* WLAN_WEP_MAX_KEYSIZE macro in intPrismEnd.h or by calling EIOCSWEPTYPE. Data is a pointer to an array of* UINT8** \i EIOCSWEPKEY1 : Set value for WEP KEY 1 * Sets the value for key 1. See EIOCSWEPKEY0 for description** \i EIOCSWEPKEY2 : Set value for WEP KEY 2 * Sets the value for key 1. See EIOCSWEPKEY0 for description** \i EIOCSWEPKEY3 : Set value for WEP KEY 3 * Sets the value for key 1. See EIOCSWEPKEY0 for description** \i EIOCSWEPDEFAULTKEY : Set WEP default key* Chooses which key to use when encryting data. <data> is an integer** \i EIOCGMODE : Get the current mode of the Card* Returns an UINT16 representing card mode. <data> should be a ptr. to a UINT16** \i EIOCSAPMODE : Sets the card into Tertiary AP mode* The card is placed into AP Mode, provided a compatible Tertiary F/W module * is available for the card. <data> is a ptr. to a AP_PARAMS struct that * contains the necessary configuration information for the operation** \i EIOCASTA : Adds a Station to the AP authentication list* Only Stations on the list will be authenticated, unless the list is empty, in* which case all STA's are authenticated by the AP. Data is a pointer to an
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -