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

📄 dot11smelib.c

📁 PNE 3.3 wlan source code, running at more than vxworks6.x version
💻 C
📖 第 1 页 / 共 5 页
字号:
                                  i) >> 3] &=            ~(1 << ((pDot11->sme->bssAddrBits + i) & 7));        }     /* Set up default values for BSSs */    for (i=0; i<DOT11_BSS_MAX; i++)        {        /* All BSSs except zero start out unused */        pDot11->sme->bss[i].inUse = FALSE;                /* Initial value for AuthType */        pDot11->sme->bss[i].authType = DOT11_AUTH_OPEN;        /* Initialize the "allowed" rates to the entire supported rate set */        pDot11->sme->bss[i].allowedRates.length = 0;        /* Initialize the bcastRate to be the lowest of the supported rates */        pDot11->sme->bss[i].bcastRate =             DOT11_RATE_MASK(pDot11->sme->suppRates.rates[0]);        pDot11->sme->bss[i].linkStatus = DOT11_LINK_DOWN;        pDot11->sme->bss[i].showSsidInBeacon = TRUE;        pDot11->sme->bss[i].respondBcastSsid = TRUE;        pDot11->sme->bss[i].assocLimit = DOT11_MAX_ASSOC;                pDot11->sme->bss[i].vlanId = DOT11_NO_VLAN;        pDot11->sme->bss[i].multiEncryptIndex = DOT11_KEYINDEX_NONE;              pDot11->sme->bss[i].multiDecryptIndex = DOT11_KEYINDEX_NONE;              pDot11->sme->bss[i].multiKeySlot = 0;        }    /* All BSSs except zero start out unused */    pDot11->sme->bss[0].inUse = TRUE;    /* Setup security parameters for BSS 0 */    pDot11->sme->bss[0].secPol = pDot11->pBsp->config->secPol;            pDot11->sme->bss[0].authPol = pDot11->pBsp->config->authPol;    pDot11->sme->bss[0].ciphPol = pDot11->pBsp->config->ciphPol;        bcopy((char *)pDot11->pBsp->config->preSharedKey,           (char *)pDot11->sme->bss[0].preSharedKey,          DOT11_PSK_LEN);    pDot11->sme->bss[0].pskValid = TRUE;        if (pDot11->pBsp->config->rsnPassphrase != NULL)        {        bcopy(pDot11->pBsp->config->rsnPassphrase, pDot11->sme->bss[0].rsnPassphrase,               strlen(pDot11->pBsp->config->rsnPassphrase)+1);        }    else        {        bzero(pDot11->sme->bss[0].rsnPassphrase, DOT11_PASSPHRASE_LEN + 1);        }        /* Initialize the "set" and "get" functions for affecting the rate control    module */    pDot11->sme->txMultiRateSet = dot11SmeTxMultiRateSet;    pDot11->sme->txMultiRateGet = dot11SmeTxMultiRateGet;    pDot11->sme->txUniRateSet = dot11SmeTxUniRateSet;    pDot11->sme->txUniRateGet = dot11SmeTxUniRateGet;    /* Allow both passive (snooping beacons) and active (sending probe     requests) scans */    pDot11->sme->activeScan = TRUE;    pDot11->sme->passiveScan = FALSE;    /* Set 802.11d support to be off by default */    pDot11->sme->multiDomainEnabled = FALSE;    pDot11->sme->beaconInterval = 300; /* in 802.11 time units = 1.024 ms */    pDot11->sme->dtimPeriod = 1;       /* in number of BI */    pDot11->sme->aclMode = DOT11_AP_ACL_DISABLED;            /* Set the default power management state */    pDot11->sme->powerManagement = FALSE;    /* Start the rate control task */    if (dot11SmeRCInit(pDot11) != OK)        {        DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_INIT,                  ("dot11SmeInit: Cannot start RC task\n",                       0,0,0,0,0,0));        pDot11->sme->ksl.free(pDot11);        free(pDot11->sme);        return ERROR;        }    /* Set the default radio mode if it hasn't been set, though it should     have been in dot11Parse() */    if (pDot11->radioMode == 0)        {        pDot11->radioMode = DOT11_RADIO_ANY;        }    /* By default the scan list is all of the available channels and radio     modes.  The HDD will have been initialized before this point (see     dot11EndLoad() for verification) and the information is available. */    if (dot11SmeScanListBuild(pDot11) != OK)        {        DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_INIT,                  ("dot11SmeInit: Cannot start RC task\n",                       0,0,0,0,0,0));        dot11SmeRCDestroy(pDot11);        pDot11->sme->ksl.free(pDot11);        free(pDot11->sme);        return ERROR;        }    /* Initialize the RSN module, for processing advanced security features */    if (dot11BspFuncs.rsnInit != NULL)        {        if (dot11BspFuncs.rsnInit(pDot11) != OK)            {            DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_INIT,                      ("dot11SmeInit: Error initializing RSN module\n",                       0,0,0,0,0,0));            dot11SmeRCDestroy(pDot11);            pDot11->sme->ksl.free(pDot11);            free(pDot11->sme);            return ERROR;            }           }    else        {        /* Set all the function pointers to NULL */        pDot11->sme->rsn.free = NULL;        pDot11->sme->rsn.rsnIeCreate = NULL;        pDot11->sme->rsn.ieProcess = NULL;        pDot11->sme->rsn.groupPolicyRecalc = NULL;        pDot11->sme->rsn.eapolPktReceive = NULL;        pDot11->sme->rsn.pmkSet = NULL;        pDot11->sme->rsn.pskSet = NULL;        pDot11->sme->rsn.passphraseSet = NULL;        pDot11->sme->rsn.fourwayStart = NULL;        pDot11->sme->rsn.gtkRecalc = NULL;        pDot11->sme->rsn.micFailureProcess = NULL;                DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_INIT,                  ("dot11SmeInit: 802.11i / WPA module not present. \n",                   0,0,0,0,0,0));        }        return OK;    }/***************************************************************************** dot11SmeFree - Frees anything allocated in the SME common initialization** This routine completes the deinitialization of the SME.  It kills the RC task* and frees all memory associated with the KSL.* * RETURNS: OK or ERROR** ERRNO: N/A*/LOCAL STATUS dot11SmeFree    (    DOT11_FW *  pDot11           /* Pointer to device structure */    )    {    /* Don't bother checking the error conditions, since there's not much we     can do if the deallocation failed */        if (pDot11->sme->rsn.free != NULL)        {        pDot11->sme->rsn.free(pDot11);        }    dot11SmeRCDestroy(pDot11);    pDot11->sme->ksl.free(pDot11);    free(pDot11->sme);    pDot11->sme = NULL;    return OK;    }/***************************************************************************** dot11SmeModeStart - Initializes a particular SME mode, if present** This routine calls the start routine for the given SME mode.  This is called* from the WIOCSDOT11MODE IOCTL call in order to switch SME modes.  Starting* a mode that is not included in the image will result in a debug message and* a return of ERROR** RETURNS: OK or ERROR if mode not present or does not init* * ERRNO: N/A*/LOCAL STATUS dot11SmeModeStart    (    DOT11_FW *    pDot11,          /* Pointer to DOT11 root object */    int dot11Mode                  /* Mode to try and start */    )    {    STATUS status;                 /* Return code */        /* Sanity check */    if (dot11Mode > DOT11_MODE_AP)        {        dot11Mode = DOT11_MODE_NONE;        }    DOT11_LOG(DOT11_DEBUG_INFO, DOT11_AREA_SME,              ("dot11SmeModeStart: Starting %s mode\n",               (int)dot11ModeNames[pDot11->dot11Mode], 0,0,0,0,0));    /* Check to see if the starting SME type is present.  If so, initialize    it, and fill in the SME functions. */    switch(dot11Mode)        {        case DOT11_MODE_ESS:            DOT11_LOG(DOT11_DEBUG_INFO, DOT11_AREA_SME,                  ("dot11SmeInit: Initializing SME as ESS\n",0,0,0,0,0,0));            if (dot11BspFuncs.essInit == NULL)                {                DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_SME,                          ("dot11SmeInit: ESS SME type not included!\n",                           0,0,0,0,0,0));                status = EINVAL;                pDot11->dot11Mode = DOT11_MODE_NONE;                }            else                {                pDot11->dot11Mode = DOT11_MODE_ESS;                status = dot11BspFuncs.essInit(pDot11);                }            break;        case DOT11_MODE_IBSS:            DOT11_LOG(DOT11_DEBUG_INFO, DOT11_AREA_SME,                  ("dot11SmeInit: Initializing SME as IBSS\n",0,0,0,0,0,0));            if (dot11BspFuncs.ibssInit == NULL)                {                DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_SME,                          ("dot11SmeInit: IBSS SME type not included!\n",                           0,0,0,0,0,0));                pDot11->dot11Mode = DOT11_MODE_NONE;                status = EINVAL;                }            else                {                pDot11->dot11Mode = DOT11_MODE_IBSS;                status = dot11BspFuncs.ibssInit(pDot11);                }            break;        case DOT11_MODE_AP:            DOT11_LOG(DOT11_DEBUG_INFO, DOT11_AREA_SME,                  ("dot11SmeInit: Initializing SME as AP\n",0,0,0,0,0,0));            if (dot11BspFuncs.apInit == NULL)                {                DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_SME,                          ("dot11SmeInit: AP SME type not included!\n",                           0,0,0,0,0,0));                pDot11->dot11Mode = DOT11_MODE_NONE;                status = EINVAL;                }            else                {                pDot11->dot11Mode = DOT11_MODE_AP;                status = dot11BspFuncs.apInit(pDot11);                }            break;        case DOT11_MODE_NONE:            DOT11_LOG(DOT11_DEBUG_INFO, DOT11_AREA_SME,                      ("dot11SmeInit: SME mode = NONE\n",                        pDot11->dot11Mode,0,0,0,0,0));            pDot11->dot11Mode = DOT11_MODE_NONE;            status = OK;            break;        default:            DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_SME,                      ("dot11SmeInit: Cannot init SME for type %d\n",                        pDot11->dot11Mode,0,0,0,0,0));            pDot11->dot11Mode = DOT11_MODE_NONE;            status = ERROR;            break;        }    return status;    }/***************************************************************************** dot11SmeModeStop - De-initializes the current SME mode** This routine simply calls the sme->free routine.* ** RETURNS: OK or ERROR* * ERRNO: N/A*/LOCAL STATUS dot11SmeModeStop    (    DOT11_FW *    pDot11           /* Pointer to DOT11 root object */    )    {    int i;    /* Check if there is a mode initialized.   */    if (pDot11->dot11Mode == DOT11_MODE_NONE)        {       DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_SME,                  ("dot11SmeModeStop: Cannot stop - no mode started\n",                       0,0,0,0,0,0));        return ERROR;        }        if (pDot11->sme->modeFree == NULL)        {        DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_SME,                  ("dot11SmeModeStop: Cannot stop - no free routine for "                   "mode %d\n", pDot11->dot11Mode,0,0,0,0,0));        return ERROR;        }        if (pDot11->sme->modeFree(pDot11) != OK)        {        return ERROR;        }    /* Reset the default functions in case they changed */        /* 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;

⌨️ 快捷键说明

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