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

📄 prism2sta.c

📁 uClinux2.6上兼容PRISM2.0芯片组的USB设备驱动程序.
💻 C
📖 第 1 页 / 共 5 页
字号:
			** updated.  Choose the list which is currently okay.			** See "prism2mib_priv_accessallow()" for details.			*/			if (hw->allow.modify == 0) {				cnt  = hw->allow.cnt;				addr = hw->allow.addr[0];			} else {				cnt  = hw->allow.cnt1;				addr = hw->allow.addr1[0];			}			for (i = 0; i < cnt; i++, addr += WLAN_ADDR_LEN)				if (memcmp(rec.address, addr, WLAN_ADDR_LEN) == 0) {					rec.status = P80211ENUM_status_successful;					break;				}			break;		case WLAN_ACCESS_DENY:			/*			** Allow the authentication UNLESS the MAC address is			** in the list of denied addresses.			**			** Since this is the interrupt handler, we may be here			** while the access list is in the middle of being			** updated.  Choose the list which is currently okay.			** See "prism2mib_priv_accessdeny()" for details.			*/			if (hw->deny.modify == 0) {				cnt  = hw->deny.cnt;				addr = hw->deny.addr[0];			} else {				cnt  = hw->deny.cnt1;				addr = hw->deny.addr1[0];			}			rec.status = P80211ENUM_status_successful;			for (i = 0; i < cnt; i++, addr += WLAN_ADDR_LEN)				if (memcmp(rec.address, addr, WLAN_ADDR_LEN) == 0) {					rec.status = P80211ENUM_status_unspec_failure;					break;				}			break;	}	/*	** If the authentication is okay, then add the MAC address to the list	** of authenticated stations.  Don't add the address if it is already in	** the list.  (802.11b does not seem to disallow a station from issuing	** an authentication request when the station is already authenticated.	** Does this sort of thing ever happen?  We might as well do the check	** just in case.)	*/	added = 0;	if (rec.status == P80211ENUM_status_successful) {		for (i = 0; i < hw->authlist.cnt; i++)			if (memcmp(rec.address, hw->authlist.addr[i], WLAN_ADDR_LEN) == 0)				break;		if (i >= hw->authlist.cnt) {			if (hw->authlist.cnt >= WLAN_AUTH_MAX) {				rec.status = P80211ENUM_status_ap_full;			} else {				memcpy(hw->authlist.addr[hw->authlist.cnt],					rec.address, WLAN_ADDR_LEN);				hw->authlist.cnt++;				added = 1;			}		}	}	/*	** Send back the results of the authentication.  If this doesn't work,	** then make sure to remove the address from the authenticated list if	** it was added.	*/	rec.status = host2hfa384x_16(rec.status);	rec.algorithm = inf->info.authreq.algorithm;	result = hfa384x_drvr_setconfig(hw, HFA384x_RID_AUTHENTICATESTA,							&rec, sizeof(rec));	if (result) {		if (added) hw->authlist.cnt--;		WLAN_LOG_ERROR("setconfig(authenticatestation) failed, result=%d\n", result);	}	DBFEXIT;	return;}/*----------------------------------------------------------------* prism2sta_inf_psusercnt** Handles the receipt of a PowerSaveUserCount info frame. Should * be present in APs only.** Arguments:*	wlandev		wlan device structure*	inf		ptr to info frame (contents in hfa384x order)** Returns: *	nothing** Side effects:** Call context:*	interrupt----------------------------------------------------------------*/void prism2sta_inf_psusercnt( wlandevice_t *wlandev, hfa384x_InfFrame_t *inf){        hfa384x_t               *hw = (hfa384x_t *)wlandev->priv;	DBFENTER;	hw->psusercount = hfa384x2host_16(inf->info.psusercnt.usercnt);	DBFEXIT;	return;}/*----------------------------------------------------------------* prism2sta_ev_dtim** Handles the DTIM early warning event.** Arguments:*	wlandev		wlan device structure** Returns: *	nothing** Side effects:** Call context:*	interrupt----------------------------------------------------------------*/void prism2sta_ev_dtim(wlandevice_t *wlandev){#if 0        hfa384x_t               *hw = (hfa384x_t *)wlandev->priv;#endif	DBFENTER;	WLAN_LOG_DEBUG(3, "DTIM event, currently unhandled.\n");	DBFEXIT;	return;}/*----------------------------------------------------------------* prism2sta_ev_infdrop** Handles the InfDrop event.** Arguments:*	wlandev		wlan device structure** Returns: *	nothing** Side effects:** Call context:*	interrupt----------------------------------------------------------------*/void prism2sta_ev_infdrop(wlandevice_t *wlandev){#if 0        hfa384x_t               *hw = (hfa384x_t *)wlandev->priv;#endif	DBFENTER;	WLAN_LOG_DEBUG(3, "Info frame dropped due to card mem low.\n");	DBFEXIT;	return;}/*----------------------------------------------------------------* prism2sta_ev_info** Handles the Info event.** Arguments:*	wlandev		wlan device structure*	inf		ptr to a generic info frame** Returns: *	nothing** Side effects:** Call context:*	interrupt----------------------------------------------------------------*/void prism2sta_ev_info(wlandevice_t *wlandev, hfa384x_InfFrame_t *inf){	DBFENTER;	inf->infotype = hfa384x2host_16(inf->infotype);	/* Dispatch */	switch ( inf->infotype ) {		case HFA384x_IT_HANDOVERADDR:			prism2sta_inf_handover(wlandev, inf);			break;		case HFA384x_IT_COMMTALLIES:			prism2sta_inf_tallies(wlandev, inf);			break;               case HFA384x_IT_HOSTSCANRESULTS:                        prism2sta_inf_hostscanresults(wlandev, inf);                        break;		case HFA384x_IT_SCANRESULTS:			prism2sta_inf_scanresults(wlandev, inf);			break;		case HFA384x_IT_CHINFORESULTS:			prism2sta_inf_chinforesults(wlandev, inf);			break;		case HFA384x_IT_LINKSTATUS:			prism2sta_inf_linkstatus(wlandev, inf);			break;		case HFA384x_IT_ASSOCSTATUS:			prism2sta_inf_assocstatus(wlandev, inf);			break;		case HFA384x_IT_AUTHREQ:			prism2sta_inf_authreq(wlandev, inf);			break;		case HFA384x_IT_PSUSERCNT:			prism2sta_inf_psusercnt(wlandev, inf);			break;	        case HFA384x_IT_KEYIDCHANGED:			WLAN_LOG_WARNING("Unhandled IT_KEYIDCHANGED\n");			break;	        case HFA384x_IT_ASSOCREQ:			WLAN_LOG_WARNING("Unhandled IT_ASSOCREQ\n");			break;	        case HFA384x_IT_MICFAILURE:			WLAN_LOG_WARNING("Unhandled IT_MICFAILURE\n");			break;		default:			WLAN_LOG_WARNING(				"Unknown info type=0x%02x\n", inf->infotype);			break;	}	DBFEXIT;	return;}/*----------------------------------------------------------------* prism2sta_ev_txexc** Handles the TxExc event.  A Transmit Exception event indicates* that the MAC's TX process was unsuccessful - so the packet did* not get transmitted.** Arguments:*	wlandev		wlan device structure*	status		tx frame status word** Returns: *	nothing** Side effects:** Call context:*	interrupt----------------------------------------------------------------*/void prism2sta_ev_txexc(wlandevice_t *wlandev, UINT16 status){	DBFENTER;	WLAN_LOG_DEBUG(3, "TxExc status=0x%x.\n", status);	DBFEXIT;	return;}/*----------------------------------------------------------------* prism2sta_ev_tx** Handles the Tx event.** Arguments:*	wlandev		wlan device structure*	status		tx frame status word* Returns: *	nothing** Side effects:** Call context:*	interrupt----------------------------------------------------------------*/void prism2sta_ev_tx(wlandevice_t *wlandev, UINT16 status){	DBFENTER;	WLAN_LOG_DEBUG(4, "Tx Complete, status=0x%04x\n", status);	/* update linux network stats */	wlandev->linux_stats.tx_packets++;	DBFEXIT;	return;}/*----------------------------------------------------------------* prism2sta_ev_rx** Handles the Rx event.** Arguments:*	wlandev		wlan device structure** Returns: *	nothing** Side effects:** Call context:*	interrupt----------------------------------------------------------------*/void prism2sta_ev_rx(wlandevice_t *wlandev, struct sk_buff *skb){	DBFENTER;	p80211netdev_rx(wlandev, skb);	DBFEXIT;	return;}/*----------------------------------------------------------------* prism2sta_ev_alloc** Handles the Alloc event.** Arguments:*	wlandev		wlan device structure** Returns: *	nothing** Side effects:** Call context:*	interrupt----------------------------------------------------------------*/void prism2sta_ev_alloc(wlandevice_t *wlandev){	DBFENTER;	p80211netdev_wake_queue(wlandev);	DBFEXIT;	return;}#if (WLAN_HOSTIF == WLAN_PLX || WLAN_HOSTIF == WLAN_PCI)#ifdef CONFIG_PMstatic int prism2sta_suspend_pci(struct pci_dev *pdev, pm_message_t state){       	wlandevice_t		*wlandev;	wlandev = (wlandevice_t *) pci_get_drvdata(pdev);	/* reset hardware */	if (wlandev) {		prism2sta_ifstate(wlandev, P80211ENUM_ifstate_disable);		p80211_suspend(wlandev);	}	// call a netif_device_detach(wlandev->netdev) ?	return 0;}static int prism2sta_resume_pci (struct pci_dev *pdev){       	wlandevice_t		*wlandev;	wlandev = (wlandevice_t *) pci_get_drvdata(pdev);	if (wlandev) {		prism2sta_ifstate(wlandev, P80211ENUM_ifstate_disable);		p80211_resume(wlandev);	}		        return 0;}#endif#endif/*----------------------------------------------------------------* create_wlan** Called at module init time.  This creates the wlandevice_t structure* and initializes it with relevant bits.** Arguments:*	none** Returns: *	the created wlandevice_t structure.** Side effects:* 	also allocates the priv/hw structures.** Call context:*	process thread*----------------------------------------------------------------*/static wlandevice_t *create_wlan(void){        wlandevice_t    *wlandev = NULL;	hfa384x_t	*hw = NULL;      	/* Alloc our structures */	wlandev =	kmalloc(sizeof(wlandevice_t), GFP_KERNEL);	hw =		kmalloc(sizeof(hfa384x_t), GFP_KERNEL);	if (!wlandev || !hw) {		WLAN_LOG_ERROR("%s: Memory allocation failure.\n", dev_info);		if (wlandev)	kfree(wlandev);		if (hw)		kfree(hw);		return NULL;	}	/* Clear all the structs */	memset(wlandev, 0, sizeof(wlandevice_t));	memset(hw, 0, sizeof(hfa384x_t));	/* Initialize the network device object. */	wlandev->nsdname = dev_info;	wlandev->msdstate = WLAN_MSD_HWPRESENT_PENDING;	wlandev->priv = hw;	wlandev->open = prism2sta_open;	wlandev->close = prism2sta_close;	wlandev->reset = prism2sta_reset;#ifdef CONFIG_PROC_FS	wlandev->nsd_proc_read = prism2sta_proc_read;#endif	wlandev->txframe = prism2sta_txframe;	wlandev->mlmerequest = prism2sta_mlmerequest;	wlandev->set_multicast_list = prism2sta_setmulticast;	wlandev->tx_timeout = hfa384x_tx_timeout;	wlandev->nsdcaps = P80211_NSDCAP_HWFRAGMENT | 	                   P80211_NSDCAP_AUTOJOIN;	/* Initialize the device private data stucture. */        hw->dot11_desired_bss_type = 1;	return wlandev;}#ifdef CONFIG_PRO

⌨️ 快捷键说明

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