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

📄 dot11smeesslib.c

📁 PNE 3.3 wlan source code, running at more than vxworks6.x version
💻 C
📖 第 1 页 / 共 5 页
字号:
/* dot11SmeEssLib.c - Implements Station Management Entity for ESS *//*  * 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--------------------03k,16mar06,rb  Fix Coverity issues (SPR 119148)03j,15feb06,rb  Fix to SPR 117476 : SSID of 32 bytes crashes STA03t,01mar06,rb  Merge from 2.1.2 bugfix branch03s,11nov05,rb  Added mSSID feature03r,28sep05,rb  Remove warnings03q,28sep05,rb  Update header comments and copyright03p,23sep05,rb  Fix to B0174 - Station does not leave RSN/WPA cleanly03o,23sep05,rb  Fix for B0171 - AP keyslot corruption03n,15sep05,rb  Fix for Fall05-B0111 - data abort during dot11Show()03m,12sep05,rb  Fix minor problem making it seem as though SPR 110079 was back03l,09sep05,rb  Added APIs to modify scanTypes, country code by default03k,25aug05,rb  802.11d implementation03j,24aug05,rb  Minor tweak to prevent continual re-auth when AP changes                 secPol03i,19aug05,rb  Fix for SPR 111327 - Invalids keys after Link Probation03h,05aug05,rb  Fix for flipper B0075 - WPA/PSK failing03g,03aug05,rb  Fix for TSR 451632 - "Cannot send to msg Q" in MODE_NONE03f,25jul05,rb  Fixed minor flaw in power management startup03e,21jul05,rb  Fix for TSR 447078 - STA not disassociating when shutting down03d,21jul05,rb  Fix for SPR 110809 - txRates not advertised correctly03c,21jul05,rb  Fix to problem with fourway handshake timers firing                 erratically03b,20jul05,rb  Fix for SPR 110788 - cannot connect to the broadcast SSID03a,20jul05,rb  Flush KSL pool on mode exit02z,14jul05,rb  Added better DOT11_MODE_NONE configuration support02y,29jun05,rb  Fix for SPR 110084 : SKA not disallowed when WPA/RSN enabled02x,29jun05,rb  Fix to ensure EAPOL timers are shut down before exiting mode02w,28jun05,rb  Fix for SPR 110114 - 802.11 auth setting not preserved when                 ESS started02v,10jun05,rb  Added RSN passphrase caching02u,02jun05,rb  Fix for B0465 - message "dot11SmeEssBssDiscoveredProcess:                 cannot set channgel"02t,20may05,rb  Fix for bug B0395 - SKA does not work in ESS mode02s,18may05,rb  Fix for bug B0367 - TSN does not work on station02r,17may05,rb  Fix for EAR customer feedback02q,06may05,rb  Fix for SPR 108873: WIOCSTXRATE does not have predicatable                 bahaviour02p,29apr05,rb  Fix for bug B0285: 802.1X won't start due to disabled WEP in                 driver02o,27apr05,rb  Updated routines with APIGEN tags02n,22apr05,rb  Changed to new authCallback.02m,23mar05,rb  Fix for bug B0159 - Need to reset pKsl->dot1x* after assoc02l,03mar05,rb  Security code review changes02k,04feb05,rb  Added B/G compatibility mode02j,28jan05,rb  Fix for various bugs: ESS reponds to all disassoc/deauth                 messages02i,25jan05,rb  Made security component optionally buildable02h,19jan05,rb  Filled in auth callback02g,10jan05,rb  Moved WIOCSAUTHCALLBACK to dot11SmeLib.c02f,05jan05,rb  Fix for SPR 103854 - Need to update reference in TXD to use                 MBlks02e,04jan05,rb  Adding RSN 802.1X Support, WIOCSPMK call02d,20dec04,rb  Improved TSN Handling02c,04nov04,rb  Added RSN/WPA IE Processing02c,08nov04,rjh  fix for SPR 10388202b,07oct04,rb  Fix for SPR 102354: Station under PM cannot ping02a,23aug04,rb  Wind River Wireless Ethernet Driver 2.0 FCS*//*DESCRIPTIONThe ESS SME implements an SME for a Station connecting to an Access Point.ESS STATE MACHINEThe ESS State Machine is an event driven state machine - it switches states solely upon external input such as user requests, ingress packets, timeouts.The ESS State Machine has six states:    SME_ESS_NOESS             Base initialized state.  Not operational    SME_ESS_SCANNING          Looking for a specific ESS or any ESS     SME_ESS_AUTHENTICATING    Chose an ESS - sent auth seq 1     SME_ESS_ASSOCIATING       Authenticated.  Send Assoc Req.     SME_ESS_CONNECTED         Authenticated and associated.  Fully connected    SME_ESS_LINK_PROB         Looking for better AP. Still connectect to oldThe transitions between these states are triggered by fourteen events:RESET_REQ - can be called from any state.  Will bring the device back to     the NO_ESS stateJOIN_REQ - called from any state.  Used to join a new BSS.  Will move the     SM to the SEARCHING state BSS_DISCOVERED - generated from the SCANNING or LINK_PROB states when a new    BSS matching the scanning criteria has been found AUTH_SUCCESS - Generated from the AUTHENTICATING state when the     authentication was successfulTIMEOUT - Generated from the AUTHENTICATING or ASSOCIATING states when the    station failed to complete assoc or auth in the specified timeAUTH_FAIL - Generated by the AUTHENTICATING state when the AP denies the     station authenticationASSOC_SUCCESS - Generated by the ASSOCIATING state when the station     completes association successfullyASSOC_FAIL - Generated by the ASSOCIATING state when the station is denied    association DEAUTH - Generated in response to a user request to de-authenticate the     station.  If associated, a deassociation occurs before the actual     deauthentication packet is sent out.DISASSOC - Generated in response to a user request to deassociate the     station.LQ_NO_SIGNAL - Generated in the CONNECTED state when the station has not    received a packet (or beacon) from the AP in a set time period.LQ_PROBATION - Generated in the CONNECTED state when the average signal    level drops below a set thresholdLQ_MAKE_DO - Generated in the LINK_PROB state when a stronger AP in the ESS    cannot be foundThe station should spend most of its time in the SCANNING and CONNECTED states.It initially starts in the NOESS state.  When the user selects an ESS (or if one is selected by default) then the state machine moves to the SCANNING state.In this state, a BSS Scan (active, passive, or both as configured in the SME)is performed by a background task which generates a BSS_DISCOVERED eventwhen an appropriate BSS is found.  The BSS_DISCOVERED event moves the statemachine to the AUTHENTICATING state, where an Auth(1) packet is sent.  When anAuth(2) packet is received (with a status of success), the station either sends an association request and moves to the ASSOCIATING state, or sends an Auth(3) packet and moves to the AUTH3 state, depending on the auth algorithm in use.  When the station receives a AssocResp (with a status of success) it moves to the CONNECTED state, where normal data transmission is possible.From the CONNECTED state, the HDD can signal a change in the link by issuing aLQ_NO_SIGNAL or LQ_PROBATION event.  The LQ_NO_SIGNAL event, issued when the APhas not been heard from in a set seriod of time, causes the station to goback to the SCANNING state and look for another AP matching the desiredSsid.The LQ_PROBATION event is issued when the SSI of received beacons is lowerthan a threshold.  The station then goes into the PROBATION state, where itissues a power management packet to the AP informing it that the station is going into sleep mode.  Instead of turning off the radio to conserve power, the station can now go off to other channels to look for a better AP, returning before the AP expects it to be back.SEE ALSOWind Net 802.11 Station 2.0 High Level Design Document\NOMANUAL*/#include <vxWorks.h>#include <muxLib.h>#include <stdio.h>#include <drv/wlan/dot11Lib.h>#include <drv/wlan/dot11SmeLib.h>#include <drv/wlan/dot11TimerLib.h>#include <endLib.h>#include <end.h>#include <tickLib.h>/* These are names for the states defined in dot11SmeEssLib.h that are usedin the show routine */const char * dot11EssStateNames[] = {"NOESS","SCANNING","AUTHENTICATING",                                     "AUTH_WAIT3", "ASSOCIATING","CONNECTED",                                     "LINK_PROB"};/* LOCAL Prototypes */LOCAL STATUS dot11SmeEssFree(DOT11_FW *  pDot11);LOCAL STATUS dot11SmeEssShow(DOT11_FW *  pDot11);LOCAL STATUS dot11SmeEssRxMapInit(DOT11_FW * pDot11);LOCAL STATUS dot11SmeEssReset(DOT11_FW * pDot11);LOCAL int dot11SmeEssIoctl(DOT11_FW * pDot11, unsigned int cmd, caddr_t data);LOCAL STATUS dot11SmeEssAssocReceive(DOT11_FW * pDot11, M_BLK_ID pMblk,                                      UINT32 rate, UINT8 ssi);LOCAL STATUS dot11SmeEssAuthReceive(DOT11_FW * pDot11, M_BLK_ID pMblk,                                      UINT32 rate, UINT8 ssi);LOCAL STATUS dot11SmeEssScanReceive(DOT11_FW * pDot11, M_BLK_ID pMblk,                                             UINT32 rate, UINT8 ssi);LOCAL STATUS dot11SmeEssBeaconPMReceive(DOT11_FW * pDot11, M_BLK_ID pMblk,                                          UINT32 rate, UINT8 ssi);LOCAL DOT11_KSL_ENTRY * dot11SmeEssKslApUpdate(DOT11_FW * pDot11,                                                UINT8 * macAddr,                                               DOT11_CAPABILITIES * pCap,                                                DOT11_IE_SSID * pSsid,                                               DOT11_IE_SUPP_RATES* pRates,                                               DOT11_IE_EXT_RATES * pExt);LOCAL STATUS dot11SmeEssDeauthReceive(DOT11_FW * pDot11,M_BLK_ID pMblk,                                       UINT32 rate, UINT8 SSI);/* State machine locals */LOCAL STATUS dot11SmeEssStateInit(DOT11_FW * pDot11);LOCAL STATUS dot11SmeEssStateFree(DOT11_FW * pDot11);LOCAL STATUS dot11SmeEssResetReqProcess(DOT11_FW * pDot11);LOCAL STATUS dot11SmeEssJoinReqProcess(DOT11_FW * pDot11);LOCAL STATUS dot11SmeEssBssDiscoveredProcess(DOT11_FW * pDot11);LOCAL STATUS dot11SmeEssAuthSuccessProcess(DOT11_FW * pDot11);LOCAL STATUS dot11SmeEssAuthTimeoutProcess(DOT11_FW * pDot11);LOCAL STATUS dot11SmeEssAuthFailProcess(DOT11_FW * pDot11);LOCAL STATUS dot11SmeEssAssocSuccessProcess(DOT11_FW * pDot11);LOCAL STATUS dot11SmeEssAssocTimeoutProcess(DOT11_FW * pDot11);LOCAL STATUS dot11SmeEssAssocFailProcess(DOT11_FW * pDot11);LOCAL STATUS dot11SmeEssDeauthProcess(DOT11_FW * pDot11);LOCAL STATUS dot11SmeEssDisassocProcess(DOT11_FW * pDot11);LOCAL STATUS dot11SmeEssLqNoSignalProcess(DOT11_FW * pDot11);LOCAL STATUS dot11SmeEssLqProbationProcess(DOT11_FW * pDot11);LOCAL STATUS dot11SmeEssLqMakeDoProcess(DOT11_FW * pDot11);LOCAL STATUS dot11SmeEssSharedKeyProcess(DOT11_FW * pDot11);LOCAL VOID dot11SmeEssStateTask(DOT11_FW * pDot11);LOCAL VOID dot11SmeEssLinkEventNotify(DOT11_FW*pDot11,int event);LOCAL STATUS dot11SmeEssJoin(DOT11_FW * pDot11, char * pSsid);LOCAL INT32 dot11SmeEssStateGet(DOT11_FW * pDot11);LOCAL STATUS dot11SmeEssScanTaskInit (DOT11_FW * pDot11);LOCAL VOID dot11SmeEssScanTask (DOT11_FW * pDot11);LOCAL STATUS dot11SmeEssProbationWakeup(DOT11_FW * pDot11);LOCAL STATUS dot11SmeEssAuthExpire(DOT11_FW * pDot11);LOCAL STATUS dot11SmeEssAssocExpire(DOT11_FW * pDot11);LOCAL STATUS dot11SmeEssApLeave(DOT11_FW * pDot11, DOT11_KSL_ENTRY * pKsl);LOCAL STATUS dot11SmeEssApChoose(DOT11_FW * pDot11, BOOL probation,                                 UINT32 oldChannel, UINT32 oldMode);LOCAL BOOL dot11SmeEssNextChannel(DOT11_FW * pDot11, int index,                                   BOOL dot11dSpecial);LOCAL STATUS dot11SmeEssCcChoose(DOT11_FW * pDot11);LOCAL INT32 dot11SmeEssChannelIndexGet(int channel, DOT11_CHANNEL_LIST*pCList);/***************************************************************************** dot11SmeEssInit - Initialize the SME structure for an ESS** This routine initializes the device to operate as a station in ESS mode. It* fills in the function pointers necessary to bind to the SME.  It also * spawns and initializes the state machine.** RETURNS: OK or ERROR** ERRNO: N/A*/STATUS dot11SmeEssInit    (    DOT11_FW *  pDot11           /* Pointer to device structure */    )    {    DOT11_ESS_OBJ * pEss;        /* ESS specific parameters */    DOT11_LOG(DOT11_DEBUG_INFO, DOT11_AREA_INIT,              ("dot11SmeEssInit: Called\n", 0,0, 0, 0, 0, 0));        if ((pDot11 == NULL) || (pDot11->sme == NULL))        {        DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_INIT,                  ("dot11SmeEssInit: SME not allocated!\n", 0, 0,                    0, 0, 0, 0));        return ERROR;        }    /* Set up the ESS specific routines. */    pEss = &pDot11->sme->type.ess;    pDot11->sme->smeSpecificIoctl = dot11SmeEssIoctl;        pDot11->sme->modeFree = dot11SmeEssFree;    pDot11->sme->modeShow = dot11SmeEssShow;        pDot11->sme->linkEventNotify = dot11SmeEssLinkEventNotify;    pDot11->sme->assocReceive = dot11SmeEssAssocReceive;    pDot11->sme->disassocReceive = dot11SmeEssDeauthReceive;    pDot11->sme->authReceive = dot11SmeEssAuthReceive;    pDot11->sme->deauthReceive = dot11SmeEssDeauthReceive;    pDot11->sme->beaconReceive = dot11SmeEssScanReceive;    pDot11->sme->nullDataReceive = NULL;    pDot11->sme->pollReceive = NULL;    pDot11->sme->dot11StateGet = dot11SmeEssStateGet;    pDot11->sme->reset = dot11SmeEssReset;    pDot11->sme->essJoin = dot11SmeEssJoin;    /* Set the current BSS under configuration to be BSS0, since this is the     only BSS supported in this mode */    pDot11->sme->curConfigBss = 0;    /* Initialize the state machine.  Set the initial state to "NOESS" - the     device is quiet, not scanning, etc. */    if (dot11SmeEssStateInit(pDot11) != OK)        {        DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_INIT,                  ("dot11SmeEssInit: Error in state task init\n",                   0,0,0,0,0,0));        return ERROR;        }    if (dot11SmeEssScanTaskInit(pDot11) != OK)        {        dot11SmeEssStateFree(pDot11);        DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_INIT,                  ("dot11SmeEssInit: Error in scan task init \n",                   0,0,0,0,0,0));        return ERROR;        }        /* Set the pKslAp pointer to be NULL.  When CONNECTED, this is a pointer    to the KSL entry of the AP to which we are connected */    pEss->pKslAp = NULL;    /* Connect the SME and DPE receive functions to the HDD */    if (dot11SmeEssRxMapInit(pDot11) != OK)        {        DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_INIT,                  ("dot11SmeEssInit: Error in dot11RxMap init\n",                   0,0,0,0,0,0));        dot11SmeEssFree(pDot11);        return ERROR;        }    /* Now that everything's up and going, start the first event; send a link    event JOIN_REQ if an ssid already exists (was set up by boot-time config) 

⌨️ 快捷键说明

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