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

📄 dot11smeibsslib.c

📁 PNE 3.3 wlan source code, running at more than vxworks6.x version
💻 C
📖 第 1 页 / 共 5 页
字号:
    return (pDot11->hdd->rxMapRegisterInit)(pDot11, rxMap);    }/***************************************************************************** dot11SmeIbssIoctl - The SME-specific IOCTL routine** This routine contains code to handle all IOCTL calls that have different * bahaviour for differnt dot11Modes.** RETURNS: OK or ERROR** ERRNO: N/A*/LOCAL int dot11SmeIbssIoctl    (    DOT11_FW * pDot11,     /* Ptr to dot11 Framework */    unsigned int cmd,      /* IOCTL command */    caddr_t data           /* Generic data pointer */    )      {    STATUS status = EINVAL;    DOT11_IBSS_OBJ * pIbss;        pIbss = &pDot11->sme->type.ibss;    /* The pDot11 was already checked in the entrance routine */    switch(cmd)        {        /********************************************************************        * WIOCSRADIOMODE - Sets the current radio mode        ********************************************************************/        case WIOCSRADIOMODE:            if ((UINT32)data > DOT11_RADIO_MAX)                {                DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME,                          ("dot11SmeIoctl: Invalid radio type \n",                           0,0,0,0,0,0));                status = ERROR;                break;                }            pDot11->radioMode = (UINT32)data;                        /* Build the scan list - we will only scan channels the             match the current mode */            status = pDot11->sme->scanListBuild(pDot11);                        /* Implement the change by joining the ESS again */            status |= dot11SmeIbssLinkEventNotify(pDot11, DOT11_IBSS_EV_JOIN_REQ);            break;        /**************************************************************        * WIOCSSSID: Sets the SSID to the value in data and sends a join_req        **************************************************************/        case WIOCSSSID:             /* We need a pointer in <data>.  Make sure it's not NULL */            if ( (char*)data == NULL)                {                status = ERROR;                break;                }                        strncpy(pDot11->desiredSsid, data, DOT11_SSID_LEN);            pDot11->desiredSsid[min(DOT11_SSID_LEN, strlen((char *)data))] = 0;                        status = dot11SmeIbssLinkEventNotify(pDot11, DOT11_IBSS_EV_JOIN_REQ);            break;        /**************************************************************        * WIOCGTXRATE: Not implemented; IBSS has more than one partnet        **************************************************************/        case WIOCGTXRATE:            /* We need a pointer in <data>.  Make sure it's not NULL */            if ( (char*)data == NULL)                {                status = ERROR;                break;                }                        break;        /**************************************************************        * WIOCSTXRATE: Sets the range of allowed transmit rates         **************************************************************/        case WIOCSTXRATE:            {            DOT11_KSL_ENTRY * pKsl;            int i;                        if ( (char*)data == NULL)                {                status = ERROR;                break;                }                        taskLock();            /* Copy the new allowed rates over */            bcopy((char*)((DOT11_RATES *)data)->rates,                   (char*)DOT11_DEFAULT_BSS->allowedRates.rates,                   min(((DOT11_RATES *)data)->length, DOT11_MAX_RATES));            DOT11_DEFAULT_BSS->allowedRates.length =                 ((DOT11_RATES *)data)->length;            taskUnlock();                        /* Get the lock on the KSL */            if (pDot11->sme->ksl.lock(pDot11) != OK)                {                DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME,                          ("dot11SmeIbssIoctl: Cannot get KSL lock\n",                           0,0,0,0,0,0));                dot11SmeIbssLinkEventNotify(pDot11, DOT11_IBSS_EV_RESET);                return ERROR;                }            /* Recalculate the actual rates for the current IBSS sta */            for (i=0; i < DOT11_KSL_MAX_HASH; i++)                {                pKsl = pDot11->sme->ksl.list[i];                                /* Loop through all entries in this hash bucket */                while (pKsl != NULL)                    {                    if (dot11SmeActualRateCalc(pDot11,                                                &pKsl->suppRates,                                                &pDot11->sme->suppRates,                                               &DOT11_DEFAULT_BSS->allowedRates,                                               &pKsl->actualRates)                        != OK)                        {                        DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME,                                  ("dot11SmeIbssIoctl: smeActualRateCalc "                                   "FAILED for " DOT11_MAC_ADDR_STR "\n"                                   , DOT11_MAC_ADDR(pKsl->macAddr)));                        /* If the actual calculation failed, go with our default rates */                        bcopy((char *)&pDot11->sme->suppRates,                               (char *)&pKsl->actualRates,                               pDot11->sme->suppRates.length + sizeof(int));                        }                    pKsl = pKsl->pNext;                    }                }            /* Free the lock on the KSL */            if (pDot11->sme->ksl.lock(pDot11) != OK)                {                DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME,                          ("dot11SmeIbssIoctl: Cannot free KSL lock\n",                           0,0,0,0,0,0));                dot11SmeIbssLinkEventNotify(pDot11, DOT11_IBSS_EV_RESET);                return ERROR;                }            /* Trigger a rate re-evaluation */            semGive(pDot11->sme->rcForceUpdate);            status = OK;            }            break;        /**************************************************************        * WIOCGBCASTRATE: Returns the rate at which broadcast packets are        *                 transmitted,        **************************************************************/        case WIOCGBCASTRATE:            /* We need a pointer in <data>.  Make sure it's not NULL */            if ( (char*)data == NULL)                {                status = ERROR;                break;                }                        *(UINT32 *)data = DOT11_DEFAULT_BSS->bcastRate;                       status = OK;            break;        /**************************************************************        * WIOCSBCASTRATE: Sets the current bcast rate        **************************************************************/        case WIOCSBCASTRATE:            DOT11_DEFAULT_BSS->desiredBcastRate = (int)data;            pDot11->sme->txMultiRateSet(pDot11, (int)data, DOT11_DEFAULT_BSS);                        status = OK;            break;        /**************************************************************        * WIOCGPWRMAN - Returns the current state of power management.  This        *               is not implemented in an IBSS.        **************************************************************/        case WIOCGPWRMAN:            /* We need a pointer in <data>.  Make sure it's not NULL */            if ( (char*)data == NULL)                {                status = ERROR;                break;                }            *(UINT32 *)data = FALSE;                        status = OK;            break;        /**************************************************************        * WIOCSPWRMAN - Sets the power management state.  Not implemented.        **************************************************************/        case WIOCSPWRMAN:            status = ERROR;            break;        /**************************************************************        * WIOCGCOMMQUAL: Not implemented for IBSS mode        **************************************************************/        case WIOCGCOMMQUAL:            /* We need a pointer in <data>.  Make sure it's not NULL */            if ( (char*)data == NULL)                {                status = ERROR;                break;                }            status = EINVAL;            break;        /**************************************************************        * WIOCGCHANNEL - Get channel used        **************************************************************/        case WIOCGCHANNEL:            /* We need a pointer in <data>.  Make sure it's not NULL */            if ( (char*)data == NULL)                {                status = ERROR;                break;                }            *(UINT32 *)data = pDot11->hdd->curChannel;            status = OK;            break;        /**************************************************************        * WIOCSCHANNEL - Set channel used for the IBSS        **************************************************************/        case WIOCSCHANNEL:                /* Setting the channel involves changing to the physical             channel */            status = pDot11->hdd->channelSet(pDot11, (int)data,                                              pDot11->radioMode );                        if (status == OK)                {                pDot11->defaultChannel = (UINT32)data;                }                        status |= dot11SmeIbssLinkEventNotify(pDot11,                                                   DOT11_IBSS_EV_JOIN_REQ);            break;        /**************************************************************        * WIOCGAUTHTYPE - Not implemented.  There is no auth in IBSS        **************************************************************/        case WIOCGAUTHTYPE:               status = EINVAL;            break;        /**************************************************************        * WIOCSAUTHTYPE - Not implemented.  There is no auth in IBSS        **************************************************************/        case WIOCSAUTHTYPE:               status = EINVAL;            break;        /**************************************************************        * WIOCSBEACONRATE - Sets the rate at which beacons are sent        **************************************************************/        case WIOCSBEACONRATE:            pDot11->sme->beaconInterval = (UINT32)data;            /* Reset the connection so that the beacon will be regenerated            with the new info */            status = dot11SmeIbssLinkEventNotify(pDot11,                                                   DOT11_IBSS_EV_JOIN_REQ);            break;        /**************************************************************        * WIOCGBEACONRATE - Gets the rate at which beacons are sent.        **************************************************************/        case WIOCGBEACONRATE:            {            /* We need a pointer in <data>.  Make sure it's not NULL */            if ((INT32*)data == NULL)                {                status = ERROR;                break;                }            /* Get the driver data and pass it back to the callee */            *(volatile UINT32*)data = (UINT32)pDot11->sme->beaconInterval;            /* Set the return status */            status = OK;            }            break;        default:            status = EINVAL;            break;        }    return status;    }/***************************************************************************** dot11SmeIbssStateTaskInit - Initialize the IBSS state task** This routine initializes the IBSS state task.  This involves spawning the * state task itself and creating the message queue used to communicate with it** RETURNS: OK or ERROR** ERRNO: N/A*/LOCAL STATUS dot11SmeIbssStateTaskInit    (    DOT11_FW * pDot11                   /* Ptr to DOT11 framework root obj */    )    {    char taskName[32];                  /* Buffer for forming task name */    DOT11_IBSS_OBJ * pIbss;        pIbss = &pDot11->sme->type.ibss;    if ((pIbss->stateMsgQ = msgQCreate(DOT11_IBSS_STATE_MAX_MSGS,                                        sizeof(DOT11_IBSS_EV),                                       MSG_Q_FIFO)) == NULL)        {        DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_SME,                  ("dot11SmeIbssStateTaskInit: Can't init msgQ",0,0,0,0,0,0));        return ERROR;        }    /* Add the unit number to the end of the task name so that there is one    unique task per instance */    sprintf(taskName, DOT11_IBSS_STATE_TASK_NAME, pDot11->unitNum);    if ((pIbss->stateTid = taskSpawn (taskName, DOT11_IBSS_STATE_TASK_PRI,                                      0, DOT11_IBSS_STATE_TASK_STACK,                                      (FUNCPTR)dot11SmeIbssStateTask,                                      (int)pDot11,1,2,3,4,5,6,7,8,9)) == ERROR)        {        DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_SME,                  ("dot11SmeIbssStateTaskInit: Can't spawn task",0,0,0,0,0,0));        msgQDelete(pIbss->stateMsgQ);        return ERROR;        }    return OK;    }

⌨️ 快捷键说明

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