Added support for Group Addresses to mibset_mibget.

This commit is contained in:
joellen 2000-01-25 22:11:49 +00:00
parent d66346a0e8
commit 6e4562bffe
2 changed files with 182 additions and 12 deletions

View File

@ -157,8 +157,10 @@ void prism2mgmt_GetOperationalRateSet(UINT16 *rate, p80211pstrd_t *pstr);
void prism2mgmt_SetOperationalRateSet(UINT16 *rate, p80211pstrd_t *pstr);
/* functions to convert Group Addresses */
void prism2mgmt_GetGroupAddress(UINT32 did, UINT8 *buf, char **groups);
void prism2mgmt_SetGroupAddress(UINT32 did, UINT8 *buf, char **groups);
void prism2mgmt_GetGroupAddress(UINT32 did, p80211pstrd_t *pstr, prism2sta_priv_t *priv );
void prism2mgmt_SetGroupAddress(UINT32 did, UINT8 *prism2buf,
p80211pstrd_t *pstr, prism2sta_priv_t *priv );
int GetGroupAddressIndex( UINT32 did );
/*=============================================================*/
/*--- Inline Function Definitions (if supported) --------------*/

View File

@ -550,12 +550,11 @@ int prism2mgmt_mibset_mibget(wlandevice_t *wlandev, void *msgp)
/*TODO: change this code to call support functions
for handling group addresses */
if ( isget ) {
result = hfa384x_drvr_getconfig( hw, HFA384x_RID_GROUPADDR,
bytebuf, HFA384x_RID_GROUPADDR_LEN);
prism2mgmt_bytearea2pstr(bytebuf, pstr,
HFA384x_RID_GROUPADDR_LEN);
prism2mgmt_GetGroupAddress(mibitem->did,
pstr, priv );
} else {
prism2mgmt_pstr2bytearea(bytebuf, pstr);
prism2mgmt_SetGroupAddress(mibitem->did, bytebuf,
pstr, priv );
result = hfa384x_drvr_setconfig( hw, HFA384x_RID_GROUPADDR,
bytebuf, HFA384x_RID_GROUPADDR_LEN);
}
@ -1587,19 +1586,31 @@ void prism2mgmt_SetOperationalRateSet(UINT16 *rate, p80211pstrd_t *pstr)
/*----------------------------------------------------------------
* prism2mgmt_GetGroupAddress
*
* Convert the wlan octet string into an hfa384x bit area.
* Retrieves a particular group address from the list of
* group addresses.
*
* Arguments:
* did mibitem did
* buf
* groups
* pstr wlan octet string
* priv prism2 driver private data structure
*
* Returns:
* Nothing
*
----------------------------------------------------------------*/
void prism2mgmt_GetGroupAddress(UINT32 did, UINT8 *buf, char **groups)
void prism2mgmt_GetGroupAddress(UINT32 did, p80211pstrd_t *pstr,
prism2sta_priv_t *priv )
{
int index;
index = GetGroupAddressIndex(did);
if ( index >= 0 ) {
pstr->len = WLAN_ADDR_LEN;
memcpy(pstr->data, priv->GroupAddresses[index],
WLAN_ADDR_LEN);
}
return;
}
@ -1619,7 +1630,164 @@ void prism2mgmt_GetGroupAddress(UINT32 did, UINT8 *buf, char **groups)
* Nothing
*
----------------------------------------------------------------*/
void prism2mgmt_SetGroupAddress(UINT32 did, UINT8 *buf, char **groups)
void prism2mgmt_SetGroupAddress(UINT32 did, UINT8 *prism2buf,
p80211pstrd_t *pstr, prism2sta_priv_t *priv )
{
UINT8 no_addr[WLAN_ADDR_LEN];
int i;
int index;
memset(no_addr, 0, WLAN_ADDR_LEN);
if ( memcmp(no_addr, pstr->data, WLAN_ADDR_LEN) != 0) {
for ( i = 0; i < priv->grpcnt; i++ ) {
if ( memcmp(priv->GroupAddresses[i], pstr->data, WLAN_ADDR_LEN) != 0) {
memcpy( priv->GroupAddresses[i],
pstr->data,
WLAN_ADDR_LEN);
}
}
priv->grpcnt += 1;
} else {
index = GetGroupAddressIndex(did);
if ( index >= 0 ) {
priv->grpcnt -= 1;
/* shift all the addresses following
the one to delete */
memcpy( priv->GroupAddresses[index],
priv->GroupAddresses[index + 1],
((priv->grpcnt)-index) * WLAN_ADDR_LEN);
/* erase the last address that now appears
twice */
memcpy( priv->GroupAddresses[priv->grpcnt],
no_addr, WLAN_ADDR_LEN);
}
}
memcpy( prism2buf, priv->GroupAddresses[0],
(16 * WLAN_ADDR_LEN));
return;
}
/*----------------------------------------------------------------
* prism2mgmt_GetGroupAddressIndex
*
* Gets the index in the group address list based on the did.
*
* Arguments:
* did mibitem did
*
* Returns:
* >= 0 If valid did
* < 0 If not valid did
*
----------------------------------------------------------------*/
int GetGroupAddressIndex( UINT32 did )
{
int index;
index = -1;
switch (did) {
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address1:
index = 0;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address2:
index = 1;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address3:
index = 2;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address4:
index = 3;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address5:
index = 4;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address6:
index = 5;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address7:
index = 6;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address8:
index = 7;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address9:
index = 8;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address10:
index = 9;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address11:
index = 10;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address12:
index = 11;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address13:
index = 12;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address14:
index = 13;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address15:
index = 14;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address16:
index = 15;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address17:
index = 16;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address18:
index = 17;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address19:
index = 18;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address20:
index = 19;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address21:
index = 20;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address22:
index = 21;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address23:
index = 22;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address24:
index = 23;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address25:
index = 24;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address26:
index = 25;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address27:
index = 26;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address28:
index = 27;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address29:
index = 28;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address30:
index = 29;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address31:
index = 30;
break;
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address32:
index = 31;
break;
}
return index;
}