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

📄 dot11smeesslib.c

📁 PNE 3.3 wlan source code, running at more than vxworks6.x version
💻 C
📖 第 1 页 / 共 5 页
字号:
    */    if (pDot11->desiredSsid[0] != DOT11_SSID_NONE)        {        dot11SmeEssLinkEventNotify(pDot11, DOT11_ESS_JOIN_REQ);        }    return OK;    }/***************************************************************************** dot11SmeEssFree - Deinitializes the SME** This function releases all memory and system resources allocated by the SME* ESS initialization routine.** RETURNS: OK or ERROR** ERRNO: N/A*/LOCAL STATUS dot11SmeEssFree    (    DOT11_FW *  pDot11           /* Pointer to device structure */       )    {    DOT11_ESS_OBJ * pEss;    DOT11_RX_FUNC rxMap[DOT11_RX_MAP_NUM];    STATUS status = OK;    pEss = &pDot11->sme->type.ess;    /* Check if we are currently associated to an AP.  If so, deauth */    if ((pEss->pKslAp != NULL) &&         (pEss->sm.currentState == SME_ESS_CONNECTED))        {        (void) pDot11->sme->assocCallback(pDot11, NULL,                                           DOT1X_CALLBACK_DISASSOC);         pDot11->sme->deauthSend(pDot11, DOT11_DEFAULT_BSS->bssid,                                 DOT11_REASON_DEAUTH_LEAVING,                                DOT11_DEFAULT_BSS);                }    /* Zero out the RX Map so that all received packets are dropped. */    bzero((char *)rxMap, sizeof(DOT11_RX_FUNC) * DOT11_RX_MAP_NUM);    pDot11->hdd->rxMapRegisterInit(pDot11, rxMap);    /* Release any pending timers */    status |= dot11TimerDel(pEss->probationTimer);    status |= dot11TimerDel(pEss->authTimer);        /* Free the state task */    status |= dot11SmeEssStateFree(pDot11);        /* Free that allocated in the scan task */    status |= taskDelete(pEss->scanTaskId);    status |= msgQDelete(pEss->scanMsgQ);        /* De-link the SME specific IOCTL */    pDot11->sme->smeSpecificIoctl = NULL;    /* Clean out the KSL - old entries are not going to do us any good here */    if (pDot11->sme->ksl.flush(pDot11) != OK)        {        DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME,                  ("dot11SmeEssFree: Cannot flush KSL\n",                   0,0,0,0,0,0));        }    pDot11->sme->smeSpecificIoctl = NULL;        pDot11->sme->linkEventNotify = NULL;    pDot11->sme->assocReceive = NULL;    pDot11->sme->disassocReceive = NULL;    pDot11->sme->authReceive = NULL;    pDot11->sme->deauthReceive = NULL;    pDot11->sme->beaconReceive = NULL;    pDot11->sme->nullDataReceive = NULL;    pDot11->sme->pollReceive = NULL;    pDot11->sme->dot11StateGet = NULL;    pDot11->sme->reset = NULL;    pDot11->sme->essJoin = NULL;    return status;    }/***************************************************************************** dot11SmeEssShow - Show routine for ESS specific values** This is the SME specific show routine for the ESS module.  It shows * parameters out of the DOT11_ESS_OBJ module.** RETURNS: OK or ERROR** ERRNO: N/A*/LOCAL STATUS dot11SmeEssShow    (    DOT11_FW *  pDot11           /* Pointer to device structure */       )    {    int i;                       /* Loop variable */    DOT11_ESS_OBJ * pEss;        /* POinter to ESS specific data */    pEss = &pDot11->sme->type.ess;        printf("    ESS: State = %s",            dot11EssStateNames[pEss->sm.currentState]);         if ((DOT11_DEFAULT_BSS->secPol != 0) && (pEss->pKslAp != NULL))        {        printf("   (4-way handshake = %s)",                dot114wayStateNames[pEss->pKslAp->fourWayState]);        }    printf("\n");    if (pEss->pKslAp != NULL)        {        printf("    ESS: AP BSSID = " DOT11_MAC_ADDR_STR "  SSI = %d ",               DOT11_MAC_ADDR(pEss->pKslAp->macAddr),                pEss->pKslAp->type.ap.ssi);;        printf("    ESS: Actual rates = ");        for (i=0; i<pEss->pKslAp->actualRates.length; i++)            {            printf("%s%d%s ",                   DOT11_IS_BRATE(pEss->pKslAp->actualRates.rates[i])?"[":"",                   DOT11_RATE(pEss->pKslAp->actualRates.rates[i]),                    DOT11_IS_BRATE(pEss->pKslAp->actualRates.rates[i])?"]":"");            }        printf("\n");        printf("    ESS: Authentication type = %s  ",                (DOT11_DEFAULT_BSS->authType<4)?(dot11AuthTypeStr[DOT11_DEFAULT_BSS->authType]):               "NEAP");        printf("  PM = %s ",                pDot11->hdd->pmState ? "ENABLED" : "DISABLED");        if (pDot11->hdd->pmState)            {            printf("AID=%d  TIM Offset = %d byte=%d mask = "                   "0x%02x\n",                                       pEss->pKslAp->type.ap.aid,                   pEss->pKslAp->type.ap.timIeOffset,                   pEss->pKslAp->type.ap.timByteOffset,                   pEss->pKslAp->type.ap.timMask);            }        else            {            printf("\n");            }        /* Print the collected security information for this AP if security         policies are enabled */        if (DOT11_DEFAULT_BSS->secPol != 0)            {            printf("    ESS: negSecPol=%s negAuthPol=%s negUniEncrypt=%s\n",                   dot11SecPolNames[pEss->pKslAp->negSecPol],                    dot11AuthPolNames[pEss->pKslAp->negAuthPol],                    dot11EncryptNames[pEss->pKslAp->uniEncryptType]);            printf("    ESS: ApSecPol=%s ApAuthPol=%s ApCiphPol=%s "                   "ApGroupPol=%s\n",                   dot11SecPolNames[pEss->pKslAp->secPol],                    dot11AuthPolNames[pEss->pKslAp->authPol],                    dot11EncryptNames[pEss->pKslAp->ciphPol],                   dot11EncryptNames[pEss->pKslAp->groupPol]);            }                        if (pDot11->hdd->curMode == DOT11_RADIO_11g)            {            printf("     ESS: useProtection=%s useLongPreamble=%s\n",                   pEss->pKslAp->type.ap.useProtection?"TRUE":"FALSE",                    pEss->pKslAp->type.ap.useLongPreamble?"TRUE":"FALSE");                               }        }            return OK;    }/****************************************************************************** dot11SmeEssRxMapInit - Tell the HDD what to do with received packets** This function connects the HDD to the appropriate receive routines in the * DPE and the SME for ESS mode.  Any packet types with a NULL receive routine* will be dropped in the HDD.** RETURNS: OK or ERROR** ERRNO: N/A*/LOCAL STATUS dot11SmeEssRxMapInit    (    DOT11_FW *  pDot11            /* Pointer to device structure */    )    {    DOT11_RX_FUNC rxMap[DOT11_RX_MAP_NUM];    /* zero out all of the non-implemented functions */    bzero((char *)rxMap, sizeof(DOT11_RX_FUNC) * DOT11_RX_MAP_NUM);    rxMap[DOT11_RXMAP_ASSOC_REQ] = NULL;     rxMap[DOT11_RXMAP_ASSOC_RESP] = pDot11->sme->assocReceive;    rxMap[DOT11_RXMAP_REASSOC_REQ] = NULL;    rxMap[DOT11_RXMAP_REASSOC_RESP] = pDot11->sme->assocReceive;    rxMap[DOT11_RXMAP_PROBE_REQ] = pDot11->sme->beaconReceive;    rxMap[DOT11_RXMAP_PROBE_RESP] = pDot11->sme->beaconReceive;    rxMap[DOT11_RXMAP_BEACON] = pDot11->sme->beaconReceive;    rxMap[DOT11_RXMAP_ATIM] = NULL;    rxMap[DOT11_RXMAP_DISASSOC] = pDot11->sme->disassocReceive;    rxMap[DOT11_RXMAP_AUTH] = pDot11->sme->authReceive;    rxMap[DOT11_RXMAP_DEAUTH] = pDot11->sme->deauthReceive;    rxMap[DOT11_RXMAP_PSPOLL] = NULL;    rxMap[DOT11_RXMAP_RTS] = NULL;    rxMap[DOT11_RXMAP_CTS] = NULL;    rxMap[DOT11_RXMAP_ACK] = NULL;    rxMap[DOT11_RXMAP_CFEND] = NULL;    rxMap[DOT11_RXMAP_CFENDACK] = NULL;    rxMap[DOT11_RXMAP_DATA] = pDot11->dpe->endReceive;    rxMap[DOT11_RXMAP_DATA_CFACK] = NULL;    rxMap[DOT11_RXMAP_DATA_CFPOLL] = NULL;    rxMap[DOT11_RXMAP_DATA_CFACKPOLL] = NULL;    rxMap[DOT11_RXMAP_DATA_NULL] = NULL; /* Should probably be SME */    rxMap[DOT11_RXMAP_CF_ACK] = NULL;    rxMap[DOT11_RXMAP_CF_POLL] = NULL;    rxMap[DOT11_RXMAP_CF_ACK_POLL] = NULL;            return (pDot11->hdd->rxMapRegisterInit)(pDot11, rxMap);    }/***************************************************************************** dot11SmeEssReset - Issues a reset request to the card** This routine simply issues a join request to the state machine.  This will* cause the device to re-do any authentication or association.** RETURNS: OK or ERROR** ERRNO: N/A*/LOCAL STATUS dot11SmeEssReset    (    DOT11_FW * pDot11      /* Ptr to dot11 Framework */    )    {    if (pDot11 == NULL)        {        return ERROR;        }        /* Reset the "lastAttemp" field so that we may rejoin the current AP, if    we're resetting while connected */    pDot11->sme->ksl.lastAttemptReset(pDot11);    pDot11->sme->linkEventNotify(pDot11, DOT11_ESS_JOIN_REQ);    return OK;    }/***************************************************************************** dot11SmeEssIoctl - The SME-specific IOCTL routine** This routine contains code to handle all IOCTL routines that required * specific knowledge of the ESS and its private data.** RETURNS: OK or ERROR** ERRNO: N/A*/LOCAL int dot11SmeEssIoctl    (    DOT11_FW * pDot11,     /* Ptr to dot11 Framework */    unsigned int cmd,      /* IOCTL command */    caddr_t data           /* Generic data pointer */    )      {        STATUS status = EINVAL;         /* return value */    DOT11_ESS_OBJ * pEss;           /* ESS specific data */        pEss = &pDot11->sme->type.ess;    /* The pDot11 was already checked in the entrance routine */    switch(cmd)        {       /**************************************************************        * WIOCGLINKSTAT: Returns the current link status        **************************************************************/        case WIOCGLINKSTAT:            /* We need a pointer in <data>.  Make sure it's not NULL */            if ( (char*)data == NULL)                {                status = ERROR;                break;                }            if ((DOT11_DEFAULT_BSS->secPol != 0) &&                 (pDot11->sme->linkStatusGet(pDot11, DOT11_DEFAULT_BSS)                  == DOT11_LINK_UP))                {                if (pEss->pKslAp != NULL)                    {                    if (pEss->pKslAp->fourWayState ==                         DOT11_FOURWAY_ESTABLISHED)                        {                        *(UINT32 *)data = DOT11_LINK_UP;                        }                    else                        {                        *(UINT32 *)data = DOT11_LINK_DOWN;                        }                    }                else                    {                    *(UINT32 *)data = DOT11_LINK_DOWN;                    }                                }            else                {                *(UINT32 *)data = pDot11->sme->linkStatusGet(pDot11, DOT11_DEFAULT_BSS);                }            status = OK;            break;        /**************************************************************        * WIOCSSSID: Sets the current ssid

⌨️ 快捷键说明

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