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

📄 cmdsend.c

📁 此压缩包为杰得开发得z228的BSP的源代码,可以实现很多功能,尤其是视频解码有很好的效果.
💻 C
📖 第 1 页 / 共 5 页
字号:
                    DBGPRINT(DBG_CMDRESP, ("Set RSN authentication Suites to WPA\n"));
                    // 802.1X - RADIUS
                    ulAuthSuite = 0x01F25000;
                }
                else
                {
                    // unrecognized RSN suite
                    DBGPRINT(DBG_WARNING, ("WARNING: Unrecognized WPA authentication mode: %d\n",
                                        Adapter->AuthenticationMode));
                    return NDIS_STATUS_FAILURE;
                }

                // copy the authentication suite
                NdisMoveMemory( pAuth->AuthSuites, &ulAuthSuite, 
                        sizeof(ulAuthSuite));


            }
            break;

        case HostCmd_CMD_802_11_PWK_KEY:
            {
                // caller of the command needs to set Adapter->pLastAddedPWK
                // prior to calling
                PHostCmd_DS_802_11_PWK_KEY  pCmdPwk;
                PMRVL_NDIS_WPA_KEY          pKey;
                UCHAR                       ucTmp;
        

                pCmdPwk = (PHostCmd_DS_802_11_PWK_KEY)pCmdPtr;

                pCmdPwk->Action = CmdOption;
                Size = pCmdPwk->Size = sizeof(HostCmd_DS_802_11_PWK_KEY);


                if ( CmdOption == HostCmd_ACT_GET )
                {
                    // done, no more work for query
                    break;
                }

                pKey = (PMRVL_NDIS_WPA_KEY)Adapter->pLastAddedPWK->KeyMaterial;

                // TODO: Check authentication mode for WPANone

                // check bit 28 of the TKIP key, MIC keys are 8 byte long
                ucTmp = pKey->EncryptionKey[3];
                if ( 0xdf & ucTmp )
                {
                    // WPA - authenticator
                    // MICKey1 is RX, MICKey2 is TX
                    NdisMoveMemory(pCmdPwk->TkipRxMicKey, pKey->MICKey1, 8);
                    NdisMoveMemory(pCmdPwk->TkipTxMicKey, pKey->MICKey2, 8);
                }
                else
                {
                    // MICKey1 is TX, MICKey2 is RX
                    NdisMoveMemory(pCmdPwk->TkipRxMicKey, pKey->MICKey2, 8);
                    NdisMoveMemory(pCmdPwk->TkipTxMicKey, pKey->MICKey1, 8);
                }

                // TKIP key is 16 bytes long
                NdisMoveMemory(pCmdPwk->TkipEncryptKey, pKey->EncryptionKey, 16);

                DBGPRINT(DBG_WPA, ("HostCmd_CMD_802_11_PWK_KEY: \n"));
                DBGPRINT(DBG_WPA, ("\tTKIP Key: 0x2%x 0x2%x 0x2%x 0x2%x 0x2%x "
                    "0x2%x 0x2%x 0x2%x - 0x2%x 0x2%x 0x2%x 0x2%x 0x2%x 0x2%x "
                    "0x2%x 0x2%x\n", 
                    pCmdPwk->TkipEncryptKey[0],
                    pCmdPwk->TkipEncryptKey[1],
                    pCmdPwk->TkipEncryptKey[2],
                    pCmdPwk->TkipEncryptKey[3],
                    pCmdPwk->TkipEncryptKey[4],
                    pCmdPwk->TkipEncryptKey[5],
                    pCmdPwk->TkipEncryptKey[6],
                    pCmdPwk->TkipEncryptKey[7],
                    pCmdPwk->TkipEncryptKey[8],
                    pCmdPwk->TkipEncryptKey[9],
                    pCmdPwk->TkipEncryptKey[10],
                    pCmdPwk->TkipEncryptKey[11],
                    pCmdPwk->TkipEncryptKey[12],
                    pCmdPwk->TkipEncryptKey[13],
                    pCmdPwk->TkipEncryptKey[14],
                    pCmdPwk->TkipEncryptKey[15]));

                DBGPRINT(DBG_WPA, ("\tTX MIC Key: 0x2%x 0x2%x 0x2%x 0x2%x "
                    "0x2%x 0x2%x 0x2%x 0x2%x\n",
                    pCmdPwk->TkipTxMicKey[0],
                    pCmdPwk->TkipTxMicKey[1],
                    pCmdPwk->TkipTxMicKey[2],
                    pCmdPwk->TkipTxMicKey[3],
                    pCmdPwk->TkipTxMicKey[4],
                    pCmdPwk->TkipTxMicKey[5],
                    pCmdPwk->TkipTxMicKey[6],
                    pCmdPwk->TkipTxMicKey[7]));

                DBGPRINT(DBG_WPA, ("\tRX MIC Key: 0x2%x 0x2%x 0x2%x 0x2%x "
                    "0x2%x 0x2%x 0x2%x 0x2%x\n",
                    pCmdPwk->TkipRxMicKey[0],
                    pCmdPwk->TkipRxMicKey[1],
                    pCmdPwk->TkipRxMicKey[2],
                    pCmdPwk->TkipRxMicKey[3],
                    pCmdPwk->TkipRxMicKey[4],
                    pCmdPwk->TkipRxMicKey[5],
                    pCmdPwk->TkipRxMicKey[6],
                    pCmdPwk->TkipRxMicKey[7]));
            }
            break;

        case HostCmd_CMD_802_11_GRP_KEY:
            {
                // TODO: This is almost the same as handling PWK command, merge
                // them later

                // caller of the command needs to set Adapter->pLastAddedPWK
                // prior to calling
                PHostCmd_DS_802_11_GRP_KEY  pCmdPwk;
                PMRVL_NDIS_WPA_KEY          pKey;
                UCHAR                       ucTmp;

                pCmdPwk = (PHostCmd_DS_802_11_GRP_KEY)pCmdPtr;

                pCmdPwk->Action = CmdOption;
                Size = pCmdPwk->Size = sizeof(HostCmd_DS_802_11_GRP_KEY);

                if ( CmdOption == HostCmd_ACT_GET )
                {
                    // done, no more work for query
                    break;
                }

                pKey = (PMRVL_NDIS_WPA_KEY)Adapter->pLastAddedGWK->KeyMaterial;

                // TODO: Check authentication mode for WPANone

                // check bit 28 of the TKIP key, MIC keys are 8 byte long
                ucTmp = pKey->EncryptionKey[3];
                if ( 0xdf & ucTmp )
                {
                    // WPA - authenticator
                    // MICKey1 is RX, MICKey2 is TX
                    NdisMoveMemory(pCmdPwk->TkipRxMicKey, pKey->MICKey1, 8);
                    NdisMoveMemory(pCmdPwk->TkipTxMicKey, pKey->MICKey2, 8);
                }
                else
                {
                    // MICKey1 is TX, MICKey2 is RX
                    NdisMoveMemory(pCmdPwk->TkipRxMicKey, pKey->MICKey2, 8);
                    NdisMoveMemory(pCmdPwk->TkipTxMicKey, pKey->MICKey1, 8);
                }

                // TKIP key is 16 bytes long
                NdisMoveMemory(pCmdPwk->TkipEncryptKey, pKey->EncryptionKey, 16);

                DBGPRINT(DBG_WPA, ("HostCmd_CMD_802_11_GRP_KEY: \n"));
                DBGPRINT(DBG_WPA, ("\tTKIP Key: 0x2%x 0x2%x 0x2%x 0x2%x 0x2%x "
                    "0x2%x 0x2%x 0x2%x - 0x2%x 0x2%x 0x2%x 0x2%x 0x2%x 0x2%x "
                    "0x2%x 0x2%x\n", 
                    pCmdPwk->TkipEncryptKey[0],
                    pCmdPwk->TkipEncryptKey[1],
                    pCmdPwk->TkipEncryptKey[2],
                    pCmdPwk->TkipEncryptKey[3],
                    pCmdPwk->TkipEncryptKey[4],
                    pCmdPwk->TkipEncryptKey[5],
                    pCmdPwk->TkipEncryptKey[6],
                    pCmdPwk->TkipEncryptKey[7],
                    pCmdPwk->TkipEncryptKey[8],
                    pCmdPwk->TkipEncryptKey[9],
                    pCmdPwk->TkipEncryptKey[10],
                    pCmdPwk->TkipEncryptKey[11],
                    pCmdPwk->TkipEncryptKey[12],
                    pCmdPwk->TkipEncryptKey[13],
                    pCmdPwk->TkipEncryptKey[14],
                    pCmdPwk->TkipEncryptKey[15]));

                DBGPRINT(DBG_WPA, ("\tTX MIC Key: 0x2%x 0x2%x 0x2%x 0x2%x "
                    "0x2%x 0x2%x 0x2%x 0x2%x\n",
                    pCmdPwk->TkipTxMicKey[0],
                    pCmdPwk->TkipTxMicKey[1],
                    pCmdPwk->TkipTxMicKey[2],
                    pCmdPwk->TkipTxMicKey[3],
                    pCmdPwk->TkipTxMicKey[4],
                    pCmdPwk->TkipTxMicKey[5],
                    pCmdPwk->TkipTxMicKey[6],
                    pCmdPwk->TkipTxMicKey[7]));

                DBGPRINT(DBG_WPA, ("\tRX MIC Key: 0x2%x 0x2%x 0x2%x 0x2%x "
                    "0x2%x 0x2%x 0x2%x 0x2%x\n",
                    pCmdPwk->TkipRxMicKey[0],
                    pCmdPwk->TkipRxMicKey[1],
                    pCmdPwk->TkipRxMicKey[2],
                    pCmdPwk->TkipRxMicKey[3],
                    pCmdPwk->TkipRxMicKey[4],
                    pCmdPwk->TkipRxMicKey[5],
                    pCmdPwk->TkipRxMicKey[6],
                    pCmdPwk->TkipRxMicKey[7]));
            }

            break;

        case HostCmd_CMD_802_11_PAIRWISE_TSC:
            break;

        case HostCmd_CMD_802_11_GROUP_TSC:
            break;

#endif // #ifdef WPA

        // TX and RX commands are the same
        case HostCmd_CMD_TEST_RX_MODE:
        case HostCmd_CMD_TEST_TX_MODE:
            {
                POID_MRVL_DS_TX_MODE        pUserBuffer;
                PHostCmd_DS_CMD_TXRX_MODE   pCmd;

                // set only
                if ( CmdOption != HostCmd_ACT_SET )
                    return NDIS_STATUS_NOT_ACCEPTED;

                // TX and RX mode command does not check for valid mode value
                // Check should be done before calling this function
                pCmd = (PHostCmd_DS_CMD_TXRX_MODE)pCmdPtr;
                pUserBuffer = (POID_MRVL_DS_TX_MODE) InformationBuffer;
                pCmd->Mode = (UCHAR)pUserBuffer->ulMode;
                Size = sizeof(HostCmd_DS_CMD_TXRX_MODE);
            }
            break;

        case HostCmd_CMD_REGION_CODE:
            {
                POID_MRVL_DS_REGION_CODE    pUserBuffer;
                PHostCmd_DS_CMD_REGION_CODE pCmd;

                pCmd = (PHostCmd_DS_CMD_REGION_CODE)pCmdPtr;
                pCmd->Action = CmdOption;

		if(pCmd->Action==HostCmd_ACT_SET)
		{
                 pUserBuffer = (POID_MRVL_DS_REGION_CODE)InformationBuffer;
                 pCmd->RegionCode = (USHORT)(pUserBuffer->usRegionCode);
                 //DBGPRINT(DBG_OID, ("***** 1 PrepareAndSendCommand:HostCmd_CMD_REGION_CODE pCmd->RegionCode=%d\n",pCmd->RegionCode));
              }
               
                Size = sizeof(HostCmd_DS_CMD_REGION_CODE);

		V5DbgMsg( (L"+++ Ready to download region_code cmd\n") );
            }
            break;

        case HostCmd_CMD_MAC_ADDRESS:
            {
                PHostCmd_DS_CMD_MAC_ADDRESS     pCmd;
                POID_MRVL_DS_MAC_ADDRESS    pUserBuffer;

        DBGPRINT(DBG_ALLEN,("***+ HostCmd_CMD_MAC_ADDRES\n"));  
                pCmd = (PHostCmd_DS_CMD_MAC_ADDRESS)pCmdPtr;
                pCmd->Action = CmdOption;
                pUserBuffer = (POID_MRVL_DS_MAC_ADDRESS)InformationBuffer;
                NdisMoveMemory( pCmd->MacAddress,
                                pUserBuffer->EthAddr,
                                MRVDRV_ETH_ADDR_LEN);
                Size = sizeof(HostCmd_DS_CMD_MAC_ADDRESS);       
            }
            break;

        case HostCmd_CMD_BBP_REG_ACCESS:
            {
                PHostCmd_DS_CMD_BBP_REG_ACCESS pCmd;
                POID_MRVL_DS_BBP_REGISTER_ACCESS pUserBuffer;

                pCmd = (PHostCmd_DS_CMD_BBP_REG_ACCESS)pCmdPtr;
                pCmd->Action = CmdOption;

                pUserBuffer = (POID_MRVL_DS_BBP_REGISTER_ACCESS)InformationBuffer;
                pCmd->Offset = pUserBuffer->usOffset;

                // no harm in setting the value if it is a read
                pCmd->Value = (UCHAR)pUserBuffer->ulValue; 

                Size = sizeof(HostCmd_DS_CMD_BBP_REG_ACCESS);
            }

        case HostCmd_CMD_MAC_REG_ACCESS:
            {
                PHostCmd_DS_CMD_MAC_REG_ACCESS pCmd;
                POID_MRVL_DS_MAC_REGISTER_ACCESS pUserBuffer;

                pCmd = (PHostCmd_DS_CMD_MAC_REG_ACCESS)pCmdPtr;
                pCmd->Action = CmdOption;

                pUserBuffer = (POID_MRVL_DS_MAC_REGISTER_ACCESS)InformationBuffer;
                pCmd->Offset = pUserBuffer->usOffset;

                // no harm in setting the value if it is a read
                pCmd->Value = pUserBuffer->ulValue; 

                Size = sizeof(HostCmd_DS_CMD_MAC_REG_ACCESS);  

                //RETAILMSG(1,(L"MAC ACCESS:%x,%x,%x\n\r",pCmd->Offset,pCmd->Value,CmdOption));   

            }

            break;

        case HostCmd_CMD_RF_REG_ACCESS:
            {
                PHostCmd_DS_CMD_RF_REG_ACCESS pCmd;
                POID_MRVL_DS_RF_REGISTER_ACCESS pUserBuffer;

                pCmd = (PHostCmd_DS_CMD_RF_REG_ACCESS)pCmdPtr;
                pCmd->Action = CmdOption;

                pUserBuffer = (POID_MRVL_DS_RF_REGISTER_ACCESS)InformationBuffer;
                pCmd->Offset = pUserBuffer->usOffset;

                // no harm in setting the value if it is a read
                pCmd->Value = (UCHAR)pUserBuffer->ulValue; 

                Size = sizeof(HostCmd_DS_CMD_RF_REG_ACCESS);
            }

            break;
            
    case HostCmd_CMD_802_11_ENABLE_QOS_WME:
      Size = (USHORT)(sizeof(HostCmd_CMD_QOS_WME_ENABLE_STATE));
      {
        PHostCmd_CMD_QOS_WME_ENABLE_STATE pCmd;

        pCmd = (PHostCmd_CMD_QOS_WME_ENABLE_STATE)pCmdPtr;
        
        pCmd->Action = CmdOption;

        if ( pCmd->Action == HostCmd_ACT_SET )
        {
          pCmd->Enabled = (USHORT)Adapter->EnableQOS;
        }
      }

      break;

    case HostCmd_CMD_802_11_WME_AC_PARAMS :
      Size = 
        (USHORT)sizeof(HostCmd_CMD_QOS_WME_ACCESS_CATEGORY_PARAMETERS);
      {

        PHostCmd_CMD_QOS_WME_ACCESS_CATEGORY_PARAMETERS pCmd;

        pCmd = (PHostCmd_CMD_QOS_WME_ACCESS_CATEGORY_PARAMETERS)pCmdPtr;
        pCmd->Action = CmdOption;

⌨️ 快捷键说明

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