⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dot11smelib.c

📁 PNE 3.3 wlan source code, running at more than vxworks6.x version
💻 C
📖 第 1 页 / 共 5 页
字号:
/* dot11SmeLib.c - Implements SME framework and mode independent management *//*  * 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--------------------03x,17mar06,rb  Fix for SPR 119095 - dot11SmeMCastAddrAdd should return 0                 instead of error if address already in the multicast list03w,17mar06,rb  Fix for SPR 119080 - Inconsistent BSS scan results03v,15mar06,rb  Fix for SPR 118966 - ACL and WPA/RSN do not work together03u,26jan06,rb  Fix for SPR 117213 - WPAv2 should allow AES03t,05jan06,rb  Fix for SPR 116443 - Framentation threshold max value is                 incorrect03s,14dec05,rb  Fix to SPR 115957 - Invalid authentications not rejected                 properly03r,13dec05,rb  Fix to SPR 115265 - Variables reset on AP reset03q,12dec05,rb  Fix for SPR 115951 - Broadcom interoperability problem04i,01mar06,rb  Merge from 2.1.2 SPR branch04h,27feb06,rb  Changes from code inspection04g,17feb06,rb  Code cleanup and warning removal04f,14feb06,rb  Implemented VLAN END IOCTLs04e,09feb06,rb  Implemented WIOCDOT1XINT04d,11nov05,rb  Added mSSID feature04c,25oct05,rb  Fix for SPR 114170 - Crash when changing to mode that doesn't                 exist04b,05oct05,rb  Fix to B0229 - WIOCSRADIOMODE crashes AP04a,28sep05,rb  Update header comments and copyright03z,28sep05,rb  Fix for B0161 - Legacy supplicant gives errors on success03y,23sep05,rb  Fix to B0174 - Station does not leave RSN/WPA cleanly03x,23sep05,rb  Fix for B0171 - AP keyslot corruption03w,21sep05,rb  Fix for SPR 110082 - WIOCBSSSCAN crashes in RTP03v,20sep05,rb  Fix to B0120 - extra message from Supplicant03u,09sep05,rb  Added APIs to modify scanTypes, country code by default03t,08sep05,rb  Fix to country code setting03s,25aug05,rb  802.11d implementation03s,30aug05,rb  Added WIOCDPAIRWISEKEY03r,24aug05,rb  Tweak the user authentication callback to call when WPA auth.                 is complete03q,24aug05,rb  Added support for IFF_ALLMULTI flag03p,19aug05,rb  Rebuild scan list after setting channel03o,04aug05,rb  Added WIOCGCHANNELLIST03n,04aug05,rb  Turn passive scan off by default to increase rate of scanning03m,03aug05,rb  Implemented user authentication callback03l,21jul05,rb  Fix for problems with setting radioMode in DOT11_MODE_NONE03k,14jul05,rb  Added better DOT11_MODE_NONE configuration support03j,04jul05,rb  Fix error03i,29jun05,rb  Fix for SPR 110084 : SKA not disallowed when WPA/RSN enabled03h,28jun05,rb  Fix for SPR 110403 - WEP does not work with keyIndex > 003g,28jun05,rb  Fix for SPR 110114 - 802.11 auth setting not preserved when                 ESS started03f,10jun05,rb  Added RSN passphrase caching03e,20may05,rb  Further fix for B0386 - Setting ciphPol returns error03d,19may05,rb  Added WIOCSAUTHTYPE for all modes03c,19may05,rb  Fix for bug B0387: setting WIOCRADIOMODE will crash the kerne03b,18may05,rb  Fix for bug B0267 - TSN does not work on Sta03a,17may05,rb  Fix for EAR customer feedback02z,06may05,rb  Fix for SPR 108873: WIOCSTXRATE does not have predicatable                 bahaviour02y,06may05,rb  Fix EIOCSWEPKEY002x,27apr05,rb  Updated routines with APIGEN tags02w,22apr05,rb  Changed to new authCallback.02v,14apr05,rb  Added support for Transmit Power Scaling (WIOCSTXPOWERSCALE)02u,07apr05,rb  Implemented vxWorks6.0 mem cheking for WIOCBSSSCAN02t,09mar05,rb  Added IOCTLs for retry limits, HW config string02s,03mar05,rb  Security code review changes02r,21feb05,rb  Fix vxWorks 6.1 compile errors02q,04feb05,rb  Added B/G compatibility mode02p,27jan05,rb  Enforce 802.11i rules on SKA (not allowed)02o,27jan05,rb  Fixed problems with SKA - SPR 10567602n,25jan05,rb  Made security components optionally buildable02m,24jan05,rb  Implemented EIOCSADDR - to set MAC address at runtime02l,24jan05,rb  Need to change sme->channelList with country Code02k,21jan05,rb  Added WIOCSCOUNTRYCODE02j,19jan05,rb  Fixed dot1x integration problem02i,07jan05,rb  Implement 802.1X Authentication02h,05jan05,rb  Fix for SPR 103854 - Need to update reference in TXD to use                 MBlks02g,04jan05,rb  Fixed WIOCSPMK to not reset if we're in dynamic key mode02f,01nov04,rb  Added configuration of security policies02e,27oct04,rb  Implemented WEP Key Mapping Table02d,07oct04,rb  Fix for SPR 102354: Station under PM cannot ping02c,24sep04,rb  Fix message: PROBLEM invalid rate index 102b,17sep04,rb  Fix for SPR 101848: Supplicant 1.1.1 does not work with                 Wireless Ethernet 2.002a,23aug04,rb  Wind River Wireless Ethernet Driver 2.0 FCS*//*DESCRIPTIONThe Station Management Entity is responsible for link management and allassociated protocol functions.  It is split into a generic SME framework and several SME modules that implement specific functionality for different network roles (Access Point, Station in an ESS, Station in a IBSS)This module implements the generic SME framework. This contains all functionsthat execute similarly, regardless of the SME module (ESS, IBSS, AP, NONE).SEE ALSOWind Net 802.11 Station 2.0 High Level Design Document\NOMANUAL*/#include <vxWorks.h>#include <endLib.h>#include <stdio.h>#include <muxLib.h>#include <tickLib.h>#include <etherMultiLib.h>#include "drv/wlan/dot11Lib.h"#include "drv/wlan/dot11SmeLib.h"#include "drv/wlan/dot11TimerLib.h"/* Needed for vxWorks 6.x memory checking */#if defined(_WRS_VXWORKS_MAJOR) && (_WRS_VXWORKS_MAJOR >= 6) && defined(_WRS_KERNEL)#include <scMemVal.h>#endif/* Forward declarations */LOCAL STATUS dot11SmeFree(DOT11_FW * pDot11);LOCAL STATUS dot11SmeModeStart(DOT11_FW * pDot11, int dot11Mode);LOCAL STATUS dot11SmeModeStop(DOT11_FW * pDot11);LOCAL int dot11SmeRateFind(DOT11_RATES * pRates,int rate);LOCAL int dot11SmeBRateFind(DOT11_RATES * pRates,int rate);LOCAL STATUS dot11SmeRCInit(DOT11_FW * pDot11);LOCAL STATUS dot11SmeRCDestroy(DOT11_FW * pDot11);LOCAL void dot11SmeRCTask(DOT11_FW * pDot11);LOCAL INT32 dot11SmeBssScanDo(DOT11_FW * pDot11, char * ssid,                                 DOT11_SCAN_RESULTS * pResults,                                   int maxResults);LOCAL STATUS dot11SmeTxMultiRateSet(DOT11_FW * pDot11, UINT32 rate,                                     DOT11_BSS * pBss);LOCAL UINT32 dot11SmeTxMultiRateGet(DOT11_FW * pDot11, DOT11_BSS * pBss);LOCAL STATUS dot11SmeTxUniRateSet(DOT11_FW * pDot11,                                   DOT11_RATES *pRates, DOT11_BSS * pBss);LOCAL STATUS dot11SmeTxUniRateGet(DOT11_FW * pDot11,                                   DOT11_RATES *pRates, DOT11_BSS * pBss);LOCAL int dot11SmeIoctl(END_OBJ* pEnd, unsigned int cmd, caddr_t data);LOCAL int dot11SmeCommonIoctl(DOT11_FW * pDot11, unsigned int cmd,                               caddr_t data);LOCAL STATUS dot11SmeScanListBuild(DOT11_FW * pDot11);LOCAL STATUS dot11SmeMCastAddrGet(END_OBJ* pEnd,MULTI_TABLE* pTable);LOCAL STATUS dot11SmeMCastAddrAdd(END_OBJ* pEnd, char * address);LOCAL STATUS dot11SmeMCastAddrDel(END_OBJ* pEnd, char * address);LOCAL STATUS dot11SmeScanReceive(DOT11_FW * pDot11, M_BLK_ID pMblk,                                  UINT32 rate, UINT8 ssi);LOCAL STATUS dot11SmeNullDataSend(DOT11_FW * pDot11, UINT8 * pDstAddr,                                   BOOL toDs, DOT11_BSS * pBss);LOCAL STATUS dot11SmeProbeReqSend(DOT11_FW * pDot11, DOT11_IE_SSID * pSsid,                                  DOT11_RATES * pRates, DOT11_BSS * pBss);LOCAL STATUS dot11SmeAuthSend(DOT11_FW * pDot11, UINT8 * pDstMacAddr,                               UINT16 authAlg,                              UINT16 authSeq, UINT16 status, int chalLen,                               UINT8 * pChallenge, DOT11_BSS * pBss);LOCAL STATUS dot11SmeAssocReqSend(DOT11_FW * pDot11, UINT8 * pDstMacAddr,                            DOT11_CAPABILITIES * pCap, UINT16 listenInt,                            DOT11_IE_SSID *pSsid, DOT11_RATES * pRates,                                  DOT11_BSS * pBss);LOCAL STATUS dot11SmeDeauthSend(DOT11_FW * pDot11, UINT8 * pDstAddr,                                 UINT16 reason, DOT11_BSS * pBss);LOCAL STATUS dot11SmeDisassocSend(DOT11_FW * pDot11, UINT8 * pDstAddr,                                   UINT16 reason, DOT11_BSS * pBss);LOCAL STATUS dot11SmeAssocRspSend(DOT11_FW * pDot11, UINT8 * pDstMacAddr,                            DOT11_CAPABILITIES * pCap, UINT16 status,                            UINT16 aid, DOT11_RATES * pRates, DOT11_BSS * pBss);LOCAL UINT32 dot11SmeLinkStatusGet(DOT11_FW * pDot11, DOT11_BSS * pBss);LOCAL UINT32 dot11SmeAssocCallback(DOT11_FW * pDot11, DOT11_KSL_ENTRY * pKsl,                                    UINT32 event);LOCAL VOID dot11SmeIoctlModeStart(DOT11_FW * pDot11, UINT32 dot11Mode);LOCAL VOID dot11SmeIoctlModeStartTimer(DOT11_FW * pDot11, UINT32 dot11Mode);LOCAL INT32 dot11SmeBssAdd(DOT11_FW * pDot11);LOCAL STATUS dot11SmeBssDel(DOT11_FW * pDot11, UINT32 bssNum);LOCAL STATUS dot11SmeBssAddrBitsSet(DOT11_FW * pDot11, UINT32 bssAddrBits);LOCAL STATUS dot11SmeBssAssocLimitSet(DOT11_FW * pDot11, UINT32 bssAddrBits);LOCAL STATUS dot11SmeAclAdd(DOT11_FW * pDot11, UINT8 * macAddr);LOCAL STATUS dot11SmeAclRemove(DOT11_FW * pDot11, UINT8 * macAddr);LOCAL STATUS dot11SmeAclSet(DOT11_FW * pDot11, UINT32 aclMode);/***************************************************************************** dot11SmeInit - Initialize the SME structure, and the SME variant if possible** This function configures the SME for use.  If the default SME type * (configured in coinfiglette or BSP) is included in this image, then start * it as well.  If not, then still configure the rest of the SME so that a call* to WIOCSMODE will still succeed in the future.  Note that a return of* EINVAL indicates that the SME was initialized, but the desired SME* module wasn't found.** This call must come after the HDD has been initialized, since it uses* HDD functions to retrieve the rate list and the channel list** RETURNS: OK, EINVAL, or ERROR** ERRNO: N/A*/STATUS dot11SmeInit    (    DOT11_FW *  pDot11           /* Pointer to device structure */    )    {    int i;    if (pDot11->sme != NULL)        {        DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_INIT,                  ("dot11SmeInit: SME already allocated\n", 0, 0,                    0, 0, 0, 0));        return ERROR;        }    /* Allocate the memory for the SME structure */    if ((pDot11->sme = (SME_OBJ * )calloc (1, sizeof(SME_OBJ))) == NULL)        {        DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_INIT,                  ("dot11SmeInit: Error allocating SME_OBJ\n", 0, 0,                    0, 0, 0, 0));        return ERROR;        }        /* Fill in the generic SME functions to the default values. If an SME     module changes these functions, it is responsible for changing them back    when it de-initializes. */    pDot11->sme->free = dot11SmeFree;    /* Setup the generic SME send routines - these routines will spit out the     desired packet regardless of what SME type is initialized */    pDot11->sme->nullDataSend = dot11SmeNullDataSend;    pDot11->sme->authSend = dot11SmeAuthSend;    pDot11->sme->deauthSend = dot11SmeDeauthSend;    pDot11->sme->disassocSend = dot11SmeDisassocSend;    pDot11->sme->assocReqSend = dot11SmeAssocReqSend;    pDot11->sme->assocRspSend = dot11SmeAssocRspSend;    pDot11->sme->probeReqSend = dot11SmeProbeReqSend;    /* Init some utility functions that also work regardless of what SME type     is initialized */    pDot11->sme->bssScanDo = dot11SmeBssScanDo;    pDot11->sme->linkStatusGet = dot11SmeLinkStatusGet;    pDot11->sme->scanListBuild = dot11SmeScanListBuild;    pDot11->sme->linkStatusGet = dot11SmeLinkStatusGet;    /* Hook up the IOCTL routines so we can manage this */    pDot11->sme->endIoctl = dot11SmeIoctl;    pDot11->sme->smeCommonIoctl = dot11SmeCommonIoctl;    pDot11->sme->endMCastAddrGet = dot11SmeMCastAddrGet;    pDot11->sme->endMCastAddrAdd = dot11SmeMCastAddrAdd;    pDot11->sme->endMCastAddrDel = dot11SmeMCastAddrDel;    /* Setup the timeout values for authentication and association.  These     affect different SME modes in different manners. */    pDot11->sme->authTimeout = DOT11_DEFAULT_AUTH_TIMEOUT;    pDot11->sme->assocTimeout = DOT11_DEFAULT_ASSOC_TIMEOUT;    /* Setyup the association callback wrapper.  This will call the    802.1X authentication callback if appropriate */    pDot11->sme->assocCallback = dot11SmeAssocCallback;    /* Start the KSL */    if (dot11KslInit(pDot11) != OK)        {        DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_INIT,                  ("dot11SmeInit: Cannot init KSL\n",                       0,0,0,0,0,0));        free(pDot11->sme);        return ERROR;        }        /* Setup the pointer to initialize the SME module when ready */    pDot11->sme->modeStart = dot11SmeModeStart;    pDot11->sme->modeStop = dot11SmeModeStop;        /* Get the channel list for the current mode */    pDot11->sme->channelList.numChannels =         pDot11->hdd->channelListGet(pDot11,                                    &pDot11->sme->channelList.channels[0]);        /* Get the supported rates from the HDD (which is initialized earlier in    the init sequence than the SME */    if (pDot11->hdd->suppRatesGet(pDot11, &pDot11->sme->suppRates) != OK)        {        DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_INIT,                  ("dot11SmeInit: Cannot init supp rates\n",                       0,0,0,0,0,0));        pDot11->sme->ksl.free(pDot11);        free(pDot11->sme);        return ERROR;        }    /* Sort the rates list into ascending order */    if (dot11SmeRateSort(&pDot11->sme->suppRates) != OK)        {        DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_INIT,                  ("dot11SmeInit: Cannot sort supp rates\n",                       0,0,0,0,0,0));        pDot11->sme->ksl.free(pDot11);        free(pDot11->sme);        return ERROR;        }        /* Set the BSS under configuration to the default */    pDot11->sme->curConfigBss = 0;        /* This is the offset into the MAC address where the mBSS bits will be     applied */    pDot11->sme->bssAddrBits = 2;    /* Setup the BSS mask */    bfill((char *)pDot11->sme->bssAddrMask, DOT11_ADDR_LEN, 0xff);    pDot11->sme->bssAddrMask[0] = 0xfd;    /* 'i + bssAddrBits' is the bit we're tweaking currently in    the MACAddr */    for (i = 0; (1 << i) < DOT11_BSS_MAX; i++)        {        /* Clear the relevant bit */        pDot11->sme->bssAddrMask[(pDot11->sme->bssAddrBits +

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -