📄 dot11smeesslib.c
字号:
**************************************************************/ case WIOCSSSID: /* We need a pointer in <data>. Make sure it's not NULL */ if ( (char*)data == NULL) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeEssIoctl: NULL <data> pointer in IOCTL" " 0x%04x\n", cmd, 0, 0, 0, 0, 0)); status = ERROR; break; } status = (pDot11->sme->essJoin)(pDot11, (char *)data); break; /************************************************************** * WIOCGENCRYPTTYPE: Returns the current state of encryption **************************************************************/ case WIOCGENCRYPTTYPE: /* We need a pointer in <data>. Make sure it's not NULL */ if ( (char*)data == NULL) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeEssIoctl: NULL <data> pointer in IOCTL" " 0x%04x\n", cmd, 0, 0, 0, 0, 0)); status = ERROR; break; } *(UINT32 *)data = DOT11_DEFAULT_BSS->multiEncryptType; status = OK; break; /************************************************************** * WIOCSENCRYPTTYPE: Sets the current encryption policy **************************************************************/ case WIOCSENCRYPTTYPE: if ((UINT32)data < DOT11_ENCRYPT_MAX) { taskLock(); DOT11_DEFAULT_BSS->multiEncryptType = (UINT32)data; taskUnlock(); status = OK; } else { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeEssIoctl: Bad encrypt type in" " WIOCSENCRYPTTYPE\n", cmd, 0, 0, 0, 0, 0)); status = ERROR; } break; /******************************************************************** * WIOCSWEPDEFAULTKEY: Sets the default keyslot for TX ********************************************************************/ case WIOCSWEPDEFAULTKEY: /* Make sure <data> is in the allowed range of keys */ if ((UINT32)data >= DOT11_MAX_DEFAULT_KEY) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeEssIoctl: Bad key number in " "WIODSWEPDEFAULTKEY\n",0,0,0,0,0,0)); status = ERROR; break; } taskLock(); DOT11_DEFAULT_BSS->multiEncryptIndex = (UINT32) data; DOT11_DEFAULT_BSS->multiDecryptIndex = (UINT32) data; DOT11_DEFAULT_BSS->multiKeySlot = (UINT32) data; taskUnlock(); status = OK; break; /************************************************************** * WIOCGTXRATE: Gets the current TX rate. **************************************************************/ case WIOCGTXRATE: /* We need a pointer in <data>. Make sure it's not NULL */ if ( (char*)data == NULL) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeEssIoctl: NULL <data> pointer in IOCTL" " 0x%04x\n", cmd, 0, 0, 0, 0, 0)); status = ERROR; break; } if (pEss->pKslAp == NULL) { *(UINT32 *)data = DOT11_DEFAULT_BSS->bcastRate; } else { *(UINT32 *)data = pEss->pKslAp->currentTxRate; } status = OK; break; /************************************************************** * WIOCSTXRATE: Sets the allowed transmit rates **************************************************************/ case WIOCSTXRATE: if ( (char*)data == NULL) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeEssIoctl: NULL <data> pointer in IOCTL" " 0x%04x\n", cmd, 0, 0, 0, 0, 0)); 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; /* Recalculate the actual rates for the current AP based on these rates iff we are associated */ if (pEss->pKslAp != NULL) { if (dot11SmeActualRateCalc(pDot11, &pEss->pKslAp->suppRates, &pDot11->sme->suppRates, &DOT11_DEFAULT_BSS->allowedRates, &pEss->pKslAp->actualRates) != OK) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeEssIoctl: smeActualRateCalc FAILED\n" , 0, 0, 0, 0, 0, 0)); status = ERROR; break; } } /* Trigger a rate re-evaluation */ semGive(pDot11->sme->rcForceUpdate); pDot11->sme->reset(pDot11); taskUnlock(); status = OK; break; /************************************************************** * WIOCGBCASTRATE: **************************************************************/ case WIOCGBCASTRATE: /* We need a pointer in <data>. Make sure it's not NULL */ if ( (char*)data == NULL) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeEssIoctl: NULL <data> pointer in IOCTL" " 0x%04x\n", cmd, 0, 0, 0, 0, 0)); status = ERROR; break; } *(UINT32 *)data = DOT11_DEFAULT_BSS->bcastRate; break; /************************************************************** * WIOCSBCASTRATE: **************************************************************/ case WIOCSBCASTRATE: if ( (char*)data == NULL) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeEssIoctl: NULL <data> pointer in IOCTL" " 0x%04x\n", cmd, 0, 0, 0, 0, 0)); status = ERROR; break; } DOT11_DEFAULT_BSS->desiredBcastRate = (int)data; status = pDot11->sme->txMultiRateSet(pDot11, (int)data, DOT11_DEFAULT_BSS); break; /************************************************************** * WIOCGPWRMAN - Returns the current state of power management **************************************************************/ case WIOCGPWRMAN: /* We need a pointer in <data>. Make sure it's not NULL */ if ( (char*)data == NULL) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeEssIoctl: NULL <data> pointer in IOCTL" " 0x%04x\n", cmd, 0, 0, 0, 0, 0)); status = ERROR; break; } *(UINT32 *)data = pDot11->hdd->pmStateGet(pDot11); status = OK; break; /************************************************************** * WIOCSPWRMAN - Sets the power management state: TRUE or FALSE **************************************************************/ case WIOCSPWRMAN: status = pDot11->hdd->pmStateSet(pDot11, (BOOL)data); if (status == OK) { pDot11->sme->powerManagement = (BOOL)data; } break; /************************************************************** * WIOCGCOMMQUAL: Returns the SSI of the current AP **************************************************************/ case WIOCGCOMMQUAL: /* We need a pointer in <data>. Make sure it's not NULL */ if ( (char*)data == NULL) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeEssIoctl: NULL <data> pointer in IOCTL" " 0x%04x\n", cmd, 0, 0, 0, 0, 0)); status = ERROR; break; } if (pEss->pKslAp == NULL) { *(UINT32 *)data = 0x00; } else { *(UINT32 *)data = pEss->pKslAp->type.ap.ssi; } status = OK; 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; } /* Only return the current channel if we're actually trying to connect to an AP. Otherwise report the desired channel. */ if (pEss->pKslAp != NULL) { *(UINT32 *)data = pDot11->hdd->curChannel; } else { *(UINT32 *)data = pDot11->defaultChannel; } status = OK; break; /************************************************************** * WIOCAACLSTA: Adds a station to the access control list **************************************************************/ case WIOCAACLSTA: /* Not implemented in ESS mode */ status = EINVAL; break; /************************************************************** * WIOCDACLSTA: Removes a station from the access control list **************************************************************/ case WIOCDACLSTA: /* Not implemented in ESS mode */ status = EINVAL; break; /************************************************************** * WIOCGAUTHTYPE - Get authentication protocol **************************************************************/ case WIOCGAUTHTYPE: /* We need a pointer in <data>. Make sure it's not NULL */ if ( (char*)data == NULL) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeEssIoctl: NULL <data> pointer in IOCTL" " 0x%04x\n", cmd, 0, 0, 0, 0, 0)); status = ERROR; break; } *(UINT32 *)data = DOT11_DEFAULT_BSS->authType; status = OK; break; /************************************************************** * WIOCSAUTHTYPE - Set authentication protocol **************************************************************/ case WIOCSAUTHTYPE: /* In an ESS, only one authtype is allowed. Convert from the format the IOCTL uses to IEEE format.*/ if (((UINT32)data == DOT11_AUTH_OPEN + 1) || ((UINT32)data == DOT11_AUTH_SHARED_KEY + 1)) { if (((UINT32)data == DOT11_AUTH_SHARED_KEY + 1) && (DOT11_DEFAULT_BSS->secPol != DOT11_SECPOL_NONE)) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeIoctl: WIOCSAUTHTYPE: SKA not allowed" " when WPA/RSN is enabled\n",0, 0, 0, 0, 0, 0)); return ERROR; } DOT11_DEFAULT_BSS->authType = (UINT32)data - 1; status = OK; } else { status = ERROR; } break; /************************************************************** * WIOCSBEACONRATE: **************************************************************/ case WIOCSBEACONRATE: /* Not implemented in ESS mode */ status = EINVAL; break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -