sta->last_rx_updated = 0; 
sta->last_rx_updated = IW_QUAL_DBM; 
static int prism2_ap_translate_scan(struct net_device *dev, char *buffer){	struct hostap_interface *iface;	local_info_t *local;	struct ap_data *ap;	struct list_head *ptr;	struct iw_event iwe;	char *current_ev = buffer;	char *end_buf = buffer + IW_SCAN_MAX_DATA;#if !defined(PRISM2_NO_KERNEL_IEEE80211_MGMT)	char buf[64];#endif	iface = netdev_priv(dev);	local = iface->local;	ap = local->ap;	spin_lock_bh(&ap->sta_table_lock);	for (ptr = ap->sta_list.next; ptr != NULL && ptr != &ap->sta_list;	     ptr = ptr->next) {		struct sta_info *sta = (struct sta_info *) ptr;		/* First entry *MUST* be the AP MAC address */		memset(&iwe, 0, sizeof(iwe));		iwe.cmd = SIOCGIWAP;		iwe.u.ap_addr.sa_family = ARPHRD_ETHER;		memcpy(iwe.u.ap_addr.sa_data, sta->addr, ETH_ALEN);		iwe.len = IW_EV_ADDR_LEN;		current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe,						  IW_EV_ADDR_LEN);		/* Use the mode to indicate if it's a station or		 * an Access Point */		memset(&iwe, 0, sizeof(iwe));		iwe.cmd = SIOCGIWMODE;		if (sta->ap)			iwe.u.mode = IW_MODE_MASTER;		else			iwe.u.mode = IW_MODE_INFRA;		iwe.len = IW_EV_UINT_LEN;		current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe,						  IW_EV_UINT_LEN);		/* Some quality */		memset(&iwe, 0, sizeof(iwe));		iwe.cmd = IWEVQUAL;		if (sta->last_rx_silence == 0)			iwe.u.qual.qual = sta->last_rx_signal < 27 ?				0 : (sta->last_rx_signal - 27) * 92 / 127;		else			iwe.u.qual.qual = sta->last_rx_signal -				sta->last_rx_silence - 35;		iwe.u.qual.level = HFA384X_LEVEL_TO_dBm(sta->last_rx_signal);		iwe.u.qual.noise = HFA384X_LEVEL_TO_dBm(sta->last_rx_silence);		iwe.u.qual.updated = sta->last_rx_updated;		iwe.len = IW_EV_QUAL_LEN;		current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe,						  IW_EV_QUAL_LEN);#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT		if (sta->ap) {			memset(&iwe, 0, sizeof(iwe));			iwe.cmd = SIOCGIWESSID;			iwe.u.data.length = sta->u.ap.ssid_len;			iwe.u.data.flags = 1;			current_ev = iwe_stream_add_point(current_ev, end_buf,							  &iwe,							  sta->u.ap.ssid);			memset(&iwe, 0, sizeof(iwe));			iwe.cmd = SIOCGIWENCODE;			if (sta->capability & WLAN_CAPABILITY_PRIVACY)				iwe.u.data.flags =					IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;			else				iwe.u.data.flags = IW_ENCODE_DISABLED;			current_ev = iwe_stream_add_point(current_ev, end_buf,							  &iwe,							  sta->u.ap.ssid							  /* 0 byte memcpy */);			if (sta->u.ap.channel > 0 &&			    sta->u.ap.channel <= FREQ_COUNT) {				memset(&iwe, 0, sizeof(iwe));				iwe.cmd = SIOCGIWFREQ;				iwe.u.freq.m = freq_list[sta->u.ap.channel - 1]					* 100000;				iwe.u.freq.e = 1;				current_ev = iwe_stream_add_event(					current_ev, end_buf, &iwe,					IW_EV_FREQ_LEN);			}			memset(&iwe, 0, sizeof(iwe));			iwe.cmd = IWEVCUSTOM;			sprintf(buf, "beacon_interval=%d",				sta->listen_interval);			iwe.u.data.length = strlen(buf);			current_ev = iwe_stream_add_point(current_ev, end_buf,							  &iwe, buf);		}#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */		sta->last_rx_updated = 0;		/* To be continued, we should make good use of IWEVCUSTOM */	}	spin_unlock_bh(&ap->sta_table_lock);	return current_ev - buffer;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/c28df16ed70d1b6cefd12135e3c68bfccd1bb635/hostap_ap.c/buggy/drivers/net/wireless/hostap/hostap_ap.c