📄 config.c
字号:
return bStatus;
}
/*****************************************************************************
**
** NAME psCFGgetCodeImage
**
** PARAMETERS psCFG Pointer to the Configuration Block context.
** eCodeImage CFG_BOOTLOADER | CFG_UPPER_CPU |
** CFG_LOWER_CPU | CFG_UWA_CPU
**
** RETURNS Pointer to code image structure containing a pointer to a
** memory region and the size of the image.
**
** DESCRIPTION This function should be called to get details of a code image
** required to boot the device.
**
******************************************************************************/
PCFG_CODE_IMAGE
psCFGgetCodeImage(IN PCFG_CONTEXT psCFG, IN CFG_CODE_IMAGE_ID eCodeImage)
{
PCFG_CODE_IMAGE psCodeImage = NULL;
ASSERT (psCFG != NULL);
if ((psCFG != NULL) && (psCFG->asCode[eCodeImage].paucImage != NULL))
{
psCodeImage = &psCFG->asCode[eCodeImage];
}
return psCodeImage;
}
/*****************************************************************************
**
** NAME eCFGgetCodeImage
**
** PARAMETERS psCFG Pointer to the Configuration Block context.
**
** RETURNS CFG_INFRA_STATION | CFG_ADHOC_STATION | CFG_ACCESS_POINT
** CFG_TEST_MAC
**
** DESCRIPTION This function should be called to get details of the selected
** network type.
**
******************************************************************************/
CFG_NETWORK_TYPE
eCFGgetNetworkType(IN PCFG_CONTEXT psCFG)
{
CFG_NETWORK_TYPE eNetworkType = CFG_INFRA_STATION;
ASSERT (psCFG != NULL);
if (psCFG != NULL)
{
eNetworkType = psCFG->eNetworkType;
}
return eNetworkType;
}
/*****************************************************************************
**
** NAME vCFGgetESSID
**
** PARAMETERS psCFG Pointer to the Configuration Block context.
** psESSID Pointer to structure where ESSID should be
** placed.
**
** DESCRIPTION This function should be called to get details of the selected
** ESSID.
**
******************************************************************************/
VOID
vCFGgetESSID(IN PCFG_CONTEXT psCFG, OUT MIB_ESS_ID *psESSID)
{
ASSERT (psCFG != NULL);
ASSERT (psESSID != NULL);
if ((psCFG != NULL) && (psESSID != NULL))
{
OS_MEMCPY(psESSID, &psCFG->sESSID, sizeof(MIB_ESS_ID));
}
}
/*****************************************************************************
**
** NAME vCFGgetBSSIDandChannel
**
** PARAMETERS psCFG Pointer to the Configuration Block context.
** psBSSID Pointer to structure where BSSID should be
** placed.
** pusChannel Pointer to location where channel number
** should be placed.
**
** DESCRIPTION This function should be called to get details of the selected
** BSSID. This function returns a null network ID if the specify
** BSS parameter is set to false.
**
******************************************************************************/
VOID
vCFGgetBSSIDandChannel(IN PCFG_CONTEXT psCFG, OUT IEEE_ADDR *psBSSID,
OUT PUSHORT pusChannel)
{
ASSERT (psCFG != NULL);
ASSERT (psBSSID != NULL);
ASSERT (pusChannel != NULL);
if ((psCFG != NULL) && (psBSSID != NULL))
{
if (psCFG->boManualStart)
{
psBSSID->au8Addr[0] = psCFG->sBSSID.au8Addr[0];
psBSSID->au8Addr[1] = psCFG->sBSSID.au8Addr[1];
psBSSID->au8Addr[2] = psCFG->sBSSID.au8Addr[2];
psBSSID->au8Addr[3] = psCFG->sBSSID.au8Addr[3];
psBSSID->au8Addr[4] = psCFG->sBSSID.au8Addr[4];
psBSSID->au8Addr[5] = psCFG->sBSSID.au8Addr[5];
}
else
{
psBSSID->au8Addr[5] = 0;
psBSSID->au8Addr[4] = 0;
psBSSID->au8Addr[3] = 0;
psBSSID->au8Addr[2] = 0;
psBSSID->au8Addr[1] = 0;
psBSSID->au8Addr[0] = 0;
}
}
/* Always allow restricted channel */
*pusChannel = psCFG->usChannel;
}
/*****************************************************************************
**
** NAME vCFGgetMACID
**
** PARAMETERS psCFG Pointer to the Configuration Block context.
** psMACID Pointer to structure where MACID should be
** placed.
**
** DESCRIPTION This function should be called to get details of the device
** IEEE address.
**
******************************************************************************/
VOID
vCFGgetMACID(IN PCFG_CONTEXT psCFG, OUT IEEE_ADDR *psMACID)
{
ASSERT (psCFG != NULL);
ASSERT (psMACID != NULL);
if ((psCFG != NULL) && (psMACID != NULL))
{
psMACID->au8Addr[0] = psCFG->sMACID.au8Addr[0];
psMACID->au8Addr[1] = psCFG->sMACID.au8Addr[1];
psMACID->au8Addr[2] = psCFG->sMACID.au8Addr[2];
psMACID->au8Addr[3] = psCFG->sMACID.au8Addr[3];
psMACID->au8Addr[4] = psCFG->sMACID.au8Addr[4];
psMACID->au8Addr[5] = psCFG->sMACID.au8Addr[5];
}
}
/*****************************************************************************
**
** NAME boCFGisPowerSavingEnabled
**
** PARAMETERS psCFG Pointer to the Configuration Block context.
**
** RETURNS A boolean indicating whether powersaving is enabled.
**
** DESCRIPTION This function should be called to determine whether power
** saving is currently enabled.
**
******************************************************************************/
BOOLEAN
boCFGisPowerSavingEnabled(IN PCFG_CONTEXT psCFG)
{
BOOLEAN boPowerSaving = FALSE;
ASSERT (psCFG != NULL);
if (psCFG != NULL)
{
boPowerSaving = psCFG->boPowerSaving;
}
return boPowerSaving;
}
/*****************************************************************************
**
** NAME boCFGgetFirstMibItem
**
** PARAMETERS psCFG Pointer to the Configuration Block context.
** pusObjectID Pointer to location where the MIB object ID
** should be placed.
** puValue Pointer to union where MIB value should be
** placed.
**
** RETURNS A boolean indicating whether a MIB item was returned.
**
** DESCRIPTION This function should be called to read the first MIB item to
** be set in the MAC before starting or connecting to a network.
**
******************************************************************************/
BOOLEAN
boCFGgetFirstMibItem(IN PCFG_CONTEXT psCFG, IN PWLAN_CONTEXT psWlan,
OUT PUSHORT pusObjectID, OUT MIB_VALUE *puValue)
{
BOOLEAN boItem = FALSE;
ASSERT (psCFG != NULL);
ASSERT (pusObjectID != NULL);
ASSERT (puValue != NULL);
if ((psCFG != NULL) && (pusObjectID != NULL) && (puValue != NULL))
{
/* Reset item to zero and call the get next item function. */
psCFG->eMibItem = 0;
boItem = boCFGgetNextMibItem(psCFG, psWlan, pusObjectID, puValue);
}
return boItem;
}
/*****************************************************************************
**
** NAME boCFGgetNextMibItem
**
** PARAMETERS psCFG Pointer to the Configuration Block context.
** pusObjectID Pointer to location where the MIB object ID
** should be placed.
** puValue Pointer to union where MIB value should be
** placed.
**
** RETURNS A boolean indicating whether a MIB item was returned. False
** will be returned when all items have been read.
**
** DESCRIPTION This function should be called to read the next MIB item to
** be set in the MAC before starting or connecting to a network.
**
******************************************************************************/
BOOLEAN
boCFGgetNextMibItem(IN PCFG_CONTEXT psCFG, IN PWLAN_CONTEXT psWlan,
OUT PUSHORT pusObjectID, OUT MIB_VALUE *puValue)
{
BOOLEAN boItem = FALSE;
ASSERT (psCFG != NULL);
ASSERT (pusObjectID != NULL);
ASSERT (puValue != NULL);
if ((psCFG != NULL) && (pusObjectID != NULL) && (puValue != NULL))
{
if (psCFG->eMibItem < CFG_NUM_MIB_ITEMS)
{
switch (psCFG->eMibItem)
{
case CFG_IEEE_ADDRESS:
*pusObjectID = MIB_IEEE_ADDRESS;
puValue->au8ListOfu8.au8Elements[0] = psWlan->ucMacAddr[0];
puValue->au8ListOfu8.au8Elements[1] = psWlan->ucMacAddr[1];
puValue->au8ListOfu8.au8Elements[2] = psWlan->ucMacAddr[2];
puValue->au8ListOfu8.au8Elements[3] = psWlan->ucMacAddr[3];
puValue->au8ListOfu8.au8Elements[4] = psWlan->ucMacAddr[4];
puValue->au8ListOfu8.au8Elements[5] = psWlan->ucMacAddr[5];
break;
case CFG_AUTHENTICATION_PREFERENCE:
*pusObjectID = MIB_AUTHENTICATION_MODE;
//puValue->u8Uint8 = (UCHAR)psWlan->ulAuthMode;
if (psWlan->auth_params[IW_AUTH_WPA_VERSION] & IW_AUTH_WPA_VERSION_WPA2)
{
if (psWlan->auth_params[IW_AUTH_KEY_MGMT] & IW_AUTH_KEY_MGMT_PSK)
puValue->u8Uint8 = MIB_AUTHENTICATION_WPA2_PSK;
else
puValue->u8Uint8 = MIB_AUTHENTICATION_WPA2;
}
else if (psWlan->auth_params[IW_AUTH_WPA_VERSION] & IW_AUTH_WPA_VERSION_WPA)
{
if (psWlan->auth_params[IW_AUTH_KEY_MGMT] & IW_AUTH_KEY_MGMT_PSK)
puValue->u8Uint8 = MIB_AUTHENTICATION_WPA_PSK;
else
puValue->u8Uint8 = MIB_AUTHENTICATION_WPA;
}
else // Assume WPA disabled
{
if (psWlan->auth_params[IW_AUTH_80211_AUTH_ALG] & IW_AUTH_ALG_SHARED_KEY)
puValue->u8Uint8 = MIB_AUTHENTICATION_SHARED_KEY;
else // No check for LEAP, not supported at present; assume open
puValue->u8Uint8 = MIB_AUTHENTICATION_OPEN_SYSTEM;
}
break;
case CFG_PRIVACY_INVOKED:
{
// Send the highest cipher supported
UINT32 u32Cipher =
psWlan->auth_params[IW_AUTH_CIPHER_PAIRWISE] |
psWlan->auth_params[IW_AUTH_CIPHER_GROUP];
*pusObjectID = MIB_PRIVACY_STATUS;
if (u32Cipher & IW_AUTH_CIPHER_CCMP)
puValue->u8Uint8 = MIB_PRIVACY_AES_CCMP;
else if (u32Cipher & IW_AUTH_CIPHER_TKIP)
puValue->u8Uint8 = MIB_PRIVACY_TKIP;
else if (u32Cipher & (IW_AUTH_CIPHER_WEP40 | IW_AUTH_CIPHER_WEP104))
puValue->u8Uint8 = MIB_PRIVACY_WEP;
else // Assume disabled
puValue->u8Uint8 = MIB_PRIVACY_DISABLED;
}
break;
case CFG_80211_PROTOCOL:
*pusObjectID = MIB_PROTOCOL_TYPE;
// puValue->u8Uint8 = (UCHAR)psCFG->eProtocolType;
if ( psWlan->ulNetworkTypeInUse == Ndis802_11OFDM5 )
puValue->u8Uint8 = MIB_PROTOCOL_802_11A;
else if ( psWlan->ulNetworkTypeInUse == Ndis802_11DS )
puValue->u8Uint8 = MIB_PROTOCOL_802_11B;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -