summaryrefslogtreecommitdiff
blob: 30470f44e1e0986f3eaa2b1857eaa53382d0db5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
--- trunk/ndiswrapper/driver/iw_ndis.c	2008/05/18 04:27:22	2663
+++ trunk/ndiswrapper/driver/iw_ndis.c	2008/07/10 15:17:50	2668
@@ -1015,7 +1015,16 @@
 	return 0;
 }
 
-static char *ndis_translate_scan(struct net_device *dev, char *event,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27) && !defined(IW_REQUEST_FLAG_COMPAT)
+#define	iwe_stream_add_event(a, b, c, d, e)	iwe_stream_add_event(b, c, d, e)
+#define	iwe_stream_add_point(a, b, c, d, e)	iwe_stream_add_point(b, c, d, e)
+#define	iwe_stream_add_value(a, b, c, d, e, f)	\
+	iwe_stream_add_value(b, c, d, e, f)
+#define	iwe_stream_lcp_len(a)			IW_EV_LCP_LEN
+#endif
+
+static char *ndis_translate_scan(struct net_device *dev,
+				 struct iw_request_info *info, char *event,
 				 char *end_buf, void *item)
 {
 	struct iw_event iwe;
@@ -1034,7 +1043,8 @@
 	iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
 	iwe.len = IW_EV_ADDR_LEN;
 	memcpy(iwe.u.ap_addr.sa_data, bssid->mac, ETH_ALEN);
-	event = iwe_stream_add_event(event, end_buf, &iwe, IW_EV_ADDR_LEN);
+	event = iwe_stream_add_event(info, event, end_buf, &iwe,
+				     IW_EV_ADDR_LEN);
 
 	/* add essid */
 	memset(&iwe, 0, sizeof(iwe));
@@ -1044,13 +1054,15 @@
 		iwe.u.data.length = IW_ESSID_MAX_SIZE;
 	iwe.u.data.flags = 1;
 	iwe.len = IW_EV_POINT_LEN + iwe.u.data.length;
-	event = iwe_stream_add_point(event, end_buf, &iwe, bssid->ssid.essid);
+	event = iwe_stream_add_point(info, event, end_buf, &iwe,
+				     bssid->ssid.essid);
 
 	/* add protocol name */
 	memset(&iwe, 0, sizeof(iwe));
 	iwe.cmd = SIOCGIWNAME;
 	strncpy(iwe.u.name, network_type_to_name(bssid->net_type), IFNAMSIZ);
-	event = iwe_stream_add_event(event, end_buf, &iwe, IW_EV_CHAR_LEN);
+	event = iwe_stream_add_event(info, event, end_buf, &iwe,
+				     IW_EV_CHAR_LEN);
 
 	/* add mode */
 	memset(&iwe, 0, sizeof(iwe));
@@ -1061,7 +1073,8 @@
 		iwe.u.mode = IW_MODE_INFRA;
 	else // if (bssid->mode == Ndis802_11AutoUnknown)
 		iwe.u.mode = IW_MODE_AUTO;
-	event = iwe_stream_add_event(event, end_buf, &iwe, IW_EV_UINT_LEN);
+	event = iwe_stream_add_event(info, event, end_buf, &iwe,
+				     IW_EV_UINT_LEN);
 
 	/* add freq */
 	memset(&iwe, 0, sizeof(iwe));
@@ -1076,7 +1089,8 @@
 	/* convert from kHz to Hz */
 	iwe.u.freq.e += 3;
 	iwe.len = IW_EV_FREQ_LEN;
-	event = iwe_stream_add_event(event, end_buf, &iwe, IW_EV_FREQ_LEN);
+	event = iwe_stream_add_event(info, event, end_buf, &iwe,
+				     IW_EV_FREQ_LEN);
 
 	/* add qual */
 	memset(&iwe, 0, sizeof(iwe));
@@ -1090,7 +1104,8 @@
 	iwe.u.qual.noise = WL_NOISE;
 	iwe.u.qual.qual  = i;
 	iwe.len = IW_EV_QUAL_LEN;
-	event = iwe_stream_add_event(event, end_buf, &iwe, IW_EV_QUAL_LEN);
+	event = iwe_stream_add_event(info, event, end_buf, &iwe,
+				     IW_EV_QUAL_LEN);
 
 	/* add key info */
 	memset(&iwe, 0, sizeof(iwe));
@@ -1101,11 +1116,12 @@
 		iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
 	iwe.u.data.length = 0;
 	iwe.len = IW_EV_POINT_LEN;
-	event = iwe_stream_add_point(event, end_buf, &iwe, bssid->ssid.essid);
+	event = iwe_stream_add_point(info, event, end_buf, &iwe,
+				     bssid->ssid.essid);
 
 	/* add rate */
 	memset(&iwe, 0, sizeof(iwe));
-	current_val = event + IW_EV_LCP_LEN;
+	current_val = event + iwe_stream_lcp_len(info);
 	iwe.cmd = SIOCGIWRATE;
 	if (bssid->length > sizeof(*bssid))
 		nrates = NDIS_MAX_RATES_EX;
@@ -1115,26 +1131,27 @@
 		if (bssid->rates[i] & 0x7f) {
 			iwe.u.bitrate.value = ((bssid->rates[i] & 0x7f) *
 					       500000);
-			current_val = iwe_stream_add_value(event, current_val,
+			current_val = iwe_stream_add_value(info, event,
+							   current_val,
 							   end_buf, &iwe,
 							   IW_EV_PARAM_LEN);
 		}
 	}
 
-	if ((current_val - event) > IW_EV_LCP_LEN)
+	if ((current_val - event) > iwe_stream_lcp_len(info))
 		event = current_val;
 
 	memset(&iwe, 0, sizeof(iwe));
 	iwe.cmd = IWEVCUSTOM;
 	sprintf(buf, "bcn_int=%d", bssid->config.beacon_period);
 	iwe.u.data.length = strlen(buf);
-	event = iwe_stream_add_point(event, end_buf, &iwe, buf);
+	event = iwe_stream_add_point(info, event, end_buf, &iwe, buf);
 
 	memset(&iwe, 0, sizeof(iwe));
 	iwe.cmd = IWEVCUSTOM;
 	sprintf(buf, "atim=%u", bssid->config.atim_window);
 	iwe.u.data.length = strlen(buf);
-	event = iwe_stream_add_point(event, end_buf, &iwe, buf);
+	event = iwe_stream_add_point(info, event, end_buf, &iwe, buf);
 
 	TRACE2("%d, %u", bssid->length, (unsigned int)sizeof(*bssid));
 	if (bssid->length > sizeof(*bssid)) {
@@ -1155,8 +1172,9 @@
 				memset(&iwe, 0, sizeof(iwe));
 				iwe.cmd = IWEVGENIE;
 				iwe.u.data.length = ielen;
-				event = iwe_stream_add_point(event, end_buf,
-							     &iwe, iep);
+				event = iwe_stream_add_point(info, event,
+							     end_buf, &iwe,
+							     iep);
 			}
 			iep += ielen;
 		}
@@ -1236,7 +1254,7 @@
 	TRACE2("%d", bssid_list->num_items);
 	cur_item = &bssid_list->bssid[0];
 	for (i = 0; i < bssid_list->num_items; i++) {
-		event = ndis_translate_scan(dev, event,
+		event = ndis_translate_scan(dev, info, event,
 					    extra + IW_SCAN_MAX_DATA, cur_item);
 		cur_item = (struct ndis_wlan_bssid *)((char *)cur_item +
 						      cur_item->length);