📄 cmdsend.c
字号:
}
pCmdMultipleDtim->Size=sizeof(HostCmd_DS_CMD_802_11_MULTIPLE_DTIM);//(USHORT)0xe;
pCmdMultipleDtim->Action=(USHORT)HostCmd_ACT_SET;
DBGPRINT(DBG_OID, ("***** 1 PrepareAndSendCommand:HostCmd_CMD_802_11_MULTIPLE_DTIM pCmdMultipleDtim->DTIMNum=%d\n",pCmdMultipleDtim->DtimNum));
DBGPRINT(DBG_OID, ("1 PrepareAndSendCommand:HostCmd_CMD_802_11_MULTIPLE_DTIM: CmdOption=0x%x, size=0x%x,pCmdMultipleDtim->Size=0x%x\n ", CmdOption,Size,pCmdMultipleDtim->Size ));
//DBGPRINT(DBG_OID, ("HostCmd_CMD_802_11_MULTIPLE_DTIM:pCmdMultipleDtim->Command=0x%x\n,pCmdMultipleDtim->Size=0x%x\n,pCmdMultipleDtim->SeqNum=0x%x\n,pCmdMultipleDtim->Result=0x%x\n,pCmdMultipleDtim->Action=0x%x\n,pCmdMultipleDtim->PowerMode=0x%x\n,pCmdMultipleDtim->DtimNum=0x%x\n", pCmdMultipleDtim->Command,pCmdMultipleDtim->Size,pCmdMultipleDtim->SeqNum,pCmdMultipleDtim->Result,pCmdMultipleDtim->Action,pCmdMultipleDtim->PowerMode,pCmdMultipleDtim->DtimNum));
}
#else
pOIDMultipleDtim = (POID_MRVL_DS_MULTIPLE_DTIM)InformationBuffer;
pCmdMultipleDtim->DtimNum = pOIDMultipleDtim->DtimNum;
#endif
break;
}
#ifdef WPA
case HostCmd_CMD_802_11_ENABLE_RSN:
{
// Adapter->EnableWPA contains whether
// wpa should be enabled or disabled
PHostCmd_DS_802_11_ENABLE_RSN pEnableRSNDS;
pEnableRSNDS = (PHostCmd_DS_802_11_ENABLE_RSN)pCmdPtr;
if ( Adapter->WPAEnabled == TRUE )
{
// enable WPA
pEnableRSNDS->Enable = HostCmd_ENABLE_RSN;
}
else
{
// disable WPA
pEnableRSNDS->Enable = HostCmd_DISABLE_RSN;
}
Size = sizeof(HostCmd_DS_802_11_ENABLE_RSN);
pEnableRSNDS->Action = CmdOption;
break;
}
case HostCmd_CMD_802_11_CONFIG_RSN:
break;
case HostCmd_CMD_802_11_MCAST_CIPHER:
{
PHostCmd_DS_802_11_MCAST_CIPHER pMcastCiper;
ULONG ulMcastCipher;
pMcastCiper = (PHostCmd_DS_802_11_MCAST_CIPHER)pCmdPtr;
pMcastCiper->Action = CmdOption;
Size = pMcastCiper->Size = sizeof(HostCmd_DS_802_11_MCAST_CIPHER);
if( Adapter->EncryptionStatus == Ndis802_11Encryption2KeyAbsent)
{
DBGPRINT(DBG_CMDRESP, ("Set MCAST_CIPHER to WPA-PSK\n"));
// TKIP
//ulMcastCipher = 0x0050F202;
ulMcastCipher = 0x02F25000;
}
else
{
// unrecognized RSN suite
DBGPRINT(DBG_WARNING, ("WARNING: Unrecognized WPA encryption status: %d\n",
Adapter->EncryptionStatus));
return NDIS_STATUS_FAILURE;
}
// copy the authentication suite
NdisMoveMemory( pMcastCiper->McastCipher, &ulMcastCipher, sizeof(ulMcastCipher));
break;
}
case HostCmd_CMD_802_11_UNICAST_CIPHER:
{
PHostCmd_DS_802_11_UNICAST_CIPHER pUnicastCiper;
ULONG ulUnicastCipher;
pUnicastCiper = (PHostCmd_DS_802_11_UNICAST_CIPHER)pCmdPtr;
pUnicastCiper->Action = CmdOption;
Size = pUnicastCiper->Size = sizeof(HostCmd_DS_802_11_UNICAST_CIPHER);
if( Adapter->EncryptionStatus == Ndis802_11Encryption2KeyAbsent)
{
DBGPRINT(DBG_CMDRESP, ("Set UNICAST_CIPHER to WPA-PSK\n"));
// TKIP
//ulUnicastCipher = 0x0050F202;
ulUnicastCipher = 0x02F25000;
}
else
{
// unrecognized RSN suite
DBGPRINT(DBG_WARNING, ("WARNING: Unrecognized WPA encryption status: %d\n",
Adapter->EncryptionStatus));
return NDIS_STATUS_FAILURE;
}
// copy the authentication suite
NdisMoveMemory( pUnicastCiper->UnicastCipher, &ulUnicastCipher, sizeof(ulUnicastCipher));
break;
}
case HostCmd_CMD_802_11_RSN_AUTH_SUITES:
{
PHostCmd_DS_802_11_RSN_AUTH_SUITES pAuth;
ULONG ulAuthSuite;
pAuth = (PHostCmd_DS_802_11_RSN_AUTH_SUITES)pCmdPtr;
pAuth->Action = CmdOption;
Size = pAuth->Size = sizeof(HostCmd_DS_802_11_RSN_AUTH_SUITES);
if ( Adapter->AuthenticationMode == Ndis802_11AuthModeWPAPSK )
{
DBGPRINT(DBG_CMDRESP, ("Set RSN authentication Suites to WPA-PSK\n"));
// PSK
ulAuthSuite = 0x02F25000;
}
else if (Adapter->AuthenticationMode == Ndis802_11AuthModeWPA )
{
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;
PNDIS_802_11_KEY pNdisKey;
pNdisKey = (PNDIS_802_11_KEY)InformationBuffer;
pCmdPwk = (PHostCmd_DS_802_11_PWK_KEY)pCmdPtr;
pCmdPwk->Action = CmdOption;
Size = pCmdPwk->Size = sizeof(HostCmd_DS_802_11_PWK_KEY);
#ifdef ADHOCAES
if (CmdOption == HostCmd_ACT_SET_AES)
{
/*UCHAR temp[16];
AsciiToHex(temp, (UCHAR *)InformationBuffer+sizeof(ULONG), 16);
NdisMoveMemory(pCmdPwk->TkipEncryptKey, temp, 16);
*/
NdisMoveMemory(pCmdPwk->TkipEncryptKey, (UCHAR *)InformationBuffer+sizeof(ULONG), 16);
break;
}
if (CmdOption == HostCmd_ACT_GET_AES || CmdOption == HostCmd_ACT_REMOVE_AES)
{
break;
}
#endif
if ( CmdOption == HostCmd_ACT_GET )
{
// done, no more work for query
break;
}
pKey = (PMRVL_NDIS_WPA_KEY)pNdisKey->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;
PNDIS_802_11_KEY pNdisKey;
pNdisKey = (PNDIS_802_11_KEY)InformationBuffer;
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)pNdisKey->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_802_11_TX_MODE:
case HostCmd_CMD_802_11_TX_CONTROL_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:
{
#ifndef ENABLE_802_11D
POID_MRVL_DS_REGION_CODE pUserBuffer;
PHostCmd_DS_CMD_REGION_CODE pCmd;
pCmd = (PHostCmd_DS_CMD_REGION_CODE)pCmdPtr;
pCmd->Action = CmdOption;
pUserBuffer = (POID_MRVL_DS_REGION_CODE)InformationBuffer;
pCmd->RegionCode = (USHORT)pUserBuffer->ulRegionCode;
/*
DBGPRINT(DBG_OID, ("region code = %d\n",pCmd->RegionCode));
HexDump(DBG_OID, "RegionCode CMD:", (PUCHAR)pCmd, s
izeof(HostCmd_DS_CMD_REGION_CODE));
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -