예제 #1
0
파일: p80211req.c 프로젝트: 383530895/linux
static void p80211req_mibset_mibget(wlandevice_t *wlandev,
				   struct p80211msg_dot11req_mibget *mib_msg,
				   int isget)
{
	p80211itemd_t *mibitem = (p80211itemd_t *) mib_msg->mibattribute.data;
	p80211pstrd_t *pstr = (p80211pstrd_t *) mibitem->data;
	u8 *key = mibitem->data + sizeof(p80211pstrd_t);

	switch (mibitem->did) {
	case DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey0:{
		if (!isget)
			wep_change_key(wlandev, 0, key, pstr->len);
	break;
	}
	case DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey1:{
		if (!isget)
			wep_change_key(wlandev, 1, key, pstr->len);
	break;
	}
	case DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey2:{
		if (!isget)
			wep_change_key(wlandev, 2, key, pstr->len);
	break;
	}
	case DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey3:{
		if (!isget)
			wep_change_key(wlandev, 3, key, pstr->len);
	break;
	}
	case DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID:{
		u32 *data = (u32 *) mibitem->data;

		if (isget) {
			*data = wlandev->hostwep & HOSTWEP_DEFAULTKEY_MASK;
		} else {
			wlandev->hostwep &= ~(HOSTWEP_DEFAULTKEY_MASK);
			wlandev->hostwep |= (*data & HOSTWEP_DEFAULTKEY_MASK);
		}
	break;
	}
	case DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked:{
		u32 *data = (u32 *) mibitem->data;

		if (isget) {
			if (wlandev->hostwep & HOSTWEP_PRIVACYINVOKED)
				*data = P80211ENUM_truth_true;
			else
				*data = P80211ENUM_truth_false;
		} else {
			wlandev->hostwep &= ~(HOSTWEP_PRIVACYINVOKED);
			if (*data == P80211ENUM_truth_true)
				wlandev->hostwep |= HOSTWEP_PRIVACYINVOKED;
		}
	break;
	}
	case DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted:{
		u32 *data = (u32 *) mibitem->data;

		if (isget) {
			if (wlandev->hostwep & HOSTWEP_EXCLUDEUNENCRYPTED)
				*data = P80211ENUM_truth_true;
			else
				*data = P80211ENUM_truth_false;
		} else {
			wlandev->hostwep &= ~(HOSTWEP_EXCLUDEUNENCRYPTED);
			if (*data == P80211ENUM_truth_true)
				wlandev->hostwep |= HOSTWEP_EXCLUDEUNENCRYPTED;
		}
	break;
	}
	}
}
예제 #2
0
파일: p80211req.c 프로젝트: OPSF/uClinux
int p80211req_mibset_mibget(wlandevice_t *wlandev, p80211msg_dot11req_mibget_t *mib_msg, int isget)
{
	p80211itemd_t   *mibitem = (p80211itemd_t *) mib_msg->mibattribute.data;
	p80211pstrd_t  *pstr = (p80211pstrd_t*) mibitem->data;
	UINT8 *key = mibitem->data + sizeof(p80211pstrd_t);

	DBFENTER;

	switch (mibitem->did) {
	case DIDmib_dot11smt_p80211Table_p80211_ifstate: {
		UINT32 *data = (UINT32 *) mibitem->data;
		if (isget)
			switch (wlandev->msdstate) {
			case WLAN_MSD_HWPRESENT:
				*data = P80211ENUM_ifstate_disable;
				break;
			case WLAN_MSD_FWLOAD:
				*data = P80211ENUM_ifstate_fwload;
				break;
			case WLAN_MSD_RUNNING:
				*data = P80211ENUM_ifstate_enable;
				break;
			default:
				*data = P80211ENUM_ifstate_enable;
			}
		break;
	}		
	case DIDmib_dot11phy_dot11PhyOperationTable_dot11ShortPreambleEnabled: {
		UINT32 *data = (UINT32 *) mibitem->data;

		if (isget)
			*data = wlandev->shortpreamble;
		else
			wlandev->shortpreamble = *data;
		break;	
	}
	case DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey0: {
		if (!isget)
			wep_change_key(wlandev, 0, key, pstr->len);
		break;
	}
	case DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey1: {
		if (!isget)
			wep_change_key(wlandev, 1, key, pstr->len);
		break;
	}
	case DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey2: {
		if (!isget)
			wep_change_key(wlandev, 2, key, pstr->len);
		break;
	}
	case DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey3: {
		if (!isget)
			wep_change_key(wlandev, 3, key, pstr->len);
		break;
	}
	case DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID: {
		UINT32 *data = (UINT32 *) mibitem->data;
		
		if (isget) {
			*data = wlandev->hostwep & HOSTWEP_DEFAULTKEY_MASK;
			} else {
				wlandev->hostwep &= ~(HOSTWEP_DEFAULTKEY_MASK);
				
				wlandev->hostwep |= (*data & HOSTWEP_DEFAULTKEY_MASK);
			}
		break;
	}
	case DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked: {
		UINT32 *data = (UINT32 *) mibitem->data;
		
		if (isget) {
			if (wlandev->hostwep & HOSTWEP_PRIVACYINVOKED)
				*data = P80211ENUM_truth_true;
			else
				*data = P80211ENUM_truth_false;
		} else {
				wlandev->hostwep &= ~(HOSTWEP_PRIVACYINVOKED);
				if (*data == P80211ENUM_truth_true)
					wlandev->hostwep |= HOSTWEP_PRIVACYINVOKED;
		}
		break;
	}
	case DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted: {
		UINT32 *data = (UINT32 *) mibitem->data;

		if (isget) {
			if (wlandev->hostwep & HOSTWEP_EXCLUDEUNENCRYPTED)
				*data = P80211ENUM_truth_true;
			else
				*data = P80211ENUM_truth_false;
		} else {			
			wlandev->hostwep &= ~(HOSTWEP_EXCLUDEUNENCRYPTED);
			if (*data == P80211ENUM_truth_true)
				wlandev->hostwep |= HOSTWEP_EXCLUDEUNENCRYPTED;
		}
		break;
	}
	default:
		// XXXX do nothing!
		;
	}

	DBFEXIT;
	return 0;
}