summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-04-10 15:49:08 (UTC)
committer mickeyl <mickeyl>2003-04-10 15:49:08 (UTC)
commit4e8e3741dca909782e15bb197e5b6a78750536c2 (patch) (unidiff)
tree37285f8d053b3995aee46487277b57248862848c
parent3733471135ea180709fcf4695607cce0c5fc7fb5 (diff)
downloadopie-4e8e3741dca909782e15bb197e5b6a78750536c2.zip
opie-4e8e3741dca909782e15bb197e5b6a78750536c2.tar.gz
opie-4e8e3741dca909782e15bb197e5b6a78750536c2.tar.bz2
Wellenreiter can now open and replay capture files as written by tcpdump, ethereal, etc.
Next task: writing capture files
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/configbase.ui6
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.cpp46
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.h14
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.cpp2
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.h4
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp94
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.h3
7 files changed, 121 insertions, 48 deletions
diff --git a/noncore/net/wellenreiter/gui/configbase.ui b/noncore/net/wellenreiter/gui/configbase.ui
index dda7ba0..3ece270 100644
--- a/noncore/net/wellenreiter/gui/configbase.ui
+++ b/noncore/net/wellenreiter/gui/configbase.ui
@@ -1,460 +1,466 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>WellenreiterConfigBase</class> 2<class>WellenreiterConfigBase</class>
3<widget> 3<widget>
4 <class>QDialog</class> 4 <class>QDialog</class>
5 <property stdset="1"> 5 <property stdset="1">
6 <name>name</name> 6 <name>name</name>
7 <cstring>WellenreiterConfigBase</cstring> 7 <cstring>WellenreiterConfigBase</cstring>
8 </property> 8 </property>
9 <property stdset="1"> 9 <property stdset="1">
10 <name>geometry</name> 10 <name>geometry</name>
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>220</width> 14 <width>220</width>
15 <height>306</height> 15 <height>306</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
19 <name>caption</name> 19 <name>caption</name>
20 <string>Form1</string> 20 <string>Form1</string>
21 </property> 21 </property>
22 <property> 22 <property>
23 <name>layoutMargin</name> 23 <name>layoutMargin</name>
24 </property> 24 </property>
25 <property> 25 <property>
26 <name>layoutSpacing</name> 26 <name>layoutSpacing</name>
27 </property> 27 </property>
28 <vbox> 28 <vbox>
29 <property stdset="1"> 29 <property stdset="1">
30 <name>margin</name> 30 <name>margin</name>
31 <number>3</number> 31 <number>3</number>
32 </property> 32 </property>
33 <property stdset="1"> 33 <property stdset="1">
34 <name>spacing</name> 34 <name>spacing</name>
35 <number>1</number> 35 <number>1</number>
36 </property> 36 </property>
37 <widget> 37 <widget>
38 <class>QLayoutWidget</class> 38 <class>QLayoutWidget</class>
39 <property stdset="1"> 39 <property stdset="1">
40 <name>name</name> 40 <name>name</name>
41 <cstring>Layout5</cstring> 41 <cstring>Layout5</cstring>
42 </property> 42 </property>
43 <property> 43 <property>
44 <name>layoutSpacing</name> 44 <name>layoutSpacing</name>
45 </property> 45 </property>
46 <hbox> 46 <hbox>
47 <property stdset="1"> 47 <property stdset="1">
48 <name>margin</name> 48 <name>margin</name>
49 <number>0</number> 49 <number>0</number>
50 </property> 50 </property>
51 <property stdset="1"> 51 <property stdset="1">
52 <name>spacing</name> 52 <name>spacing</name>
53 <number>2</number> 53 <number>2</number>
54 </property> 54 </property>
55 <widget> 55 <widget>
56 <class>QLabel</class> 56 <class>QLabel</class>
57 <property stdset="1"> 57 <property stdset="1">
58 <name>name</name> 58 <name>name</name>
59 <cstring>TextLabel3_2</cstring> 59 <cstring>TextLabel3_2</cstring>
60 </property> 60 </property>
61 <property stdset="1"> 61 <property stdset="1">
62 <name>sizePolicy</name> 62 <name>sizePolicy</name>
63 <sizepolicy> 63 <sizepolicy>
64 <hsizetype>4</hsizetype> 64 <hsizetype>4</hsizetype>
65 <vsizetype>1</vsizetype> 65 <vsizetype>1</vsizetype>
66 </sizepolicy> 66 </sizepolicy>
67 </property> 67 </property>
68 <property stdset="1"> 68 <property stdset="1">
69 <name>text</name> 69 <name>text</name>
70 <string>Sniffer</string> 70 <string>Sniffer</string>
71 </property> 71 </property>
72 </widget> 72 </widget>
73 <widget> 73 <widget>
74 <class>Line</class> 74 <class>Line</class>
75 <property stdset="1"> 75 <property stdset="1">
76 <name>name</name> 76 <name>name</name>
77 <cstring>Line9</cstring> 77 <cstring>Line9</cstring>
78 </property> 78 </property>
79 <property stdset="1"> 79 <property stdset="1">
80 <name>orientation</name> 80 <name>orientation</name>
81 <enum>Horizontal</enum> 81 <enum>Horizontal</enum>
82 </property> 82 </property>
83 </widget> 83 </widget>
84 </hbox> 84 </hbox>
85 </widget> 85 </widget>
86 <widget> 86 <widget>
87 <class>QLayoutWidget</class> 87 <class>QLayoutWidget</class>
88 <property stdset="1"> 88 <property stdset="1">
89 <name>name</name> 89 <name>name</name>
90 <cstring>Layout7</cstring> 90 <cstring>Layout7</cstring>
91 </property> 91 </property>
92 <property> 92 <property>
93 <name>layoutSpacing</name> 93 <name>layoutSpacing</name>
94 </property> 94 </property>
95 <grid> 95 <grid>
96 <property stdset="1"> 96 <property stdset="1">
97 <name>margin</name> 97 <name>margin</name>
98 <number>0</number> 98 <number>0</number>
99 </property> 99 </property>
100 <property stdset="1"> 100 <property stdset="1">
101 <name>spacing</name> 101 <name>spacing</name>
102 <number>2</number> 102 <number>2</number>
103 </property> 103 </property>
104 <widget row="0" column="0" > 104 <widget row="0" column="0" >
105 <class>QComboBox</class> 105 <class>QComboBox</class>
106 <property stdset="1"> 106 <property stdset="1">
107 <name>name</name> 107 <name>name</name>
108 <cstring>interfaceName</cstring> 108 <cstring>interfaceName</cstring>
109 </property> 109 </property>
110 <property stdset="1"> 110 <property stdset="1">
111 <name>enabled</name> 111 <name>enabled</name>
112 <bool>true</bool> 112 <bool>true</bool>
113 </property> 113 </property>
114 <property> 114 <property>
115 <name>whatsThis</name> 115 <name>whatsThis</name>
116 <string>Choose the interface used for sniffing.</string> 116 <string>Choose the interface used for sniffing.</string>
117 </property> 117 </property>
118 </widget> 118 </widget>
119 <widget row="4" column="0" rowspan="1" colspan="2" > 119 <widget row="4" column="0" rowspan="1" colspan="2" >
120 <class>QCheckBox</class> 120 <class>QCheckBox</class>
121 <property stdset="1"> 121 <property stdset="1">
122 <name>name</name> 122 <name>name</name>
123 <cstring>activeScanning</cstring> 123 <cstring>activeScanning</cstring>
124 </property> 124 </property>
125 <property stdset="1"> 125 <property stdset="1">
126 <name>enabled</name> 126 <name>enabled</name>
127 <bool>false</bool> 127 <bool>false</bool>
128 </property> 128 </property>
129 <property stdset="1"> 129 <property stdset="1">
130 <name>text</name> 130 <name>text</name>
131 <string>Active Scanning (caution!)</string> 131 <string>Active Scanning (caution!)</string>
132 </property> 132 </property>
133 </widget> 133 </widget>
134 <widget row="1" column="0" > 134 <widget row="1" column="0" >
135 <class>QComboBox</class> 135 <class>QComboBox</class>
136 <item> 136 <item>
137 <property> 137 <property>
138 <name>text</name> 138 <name>text</name>
139 <string>&lt;select&gt;</string> 139 <string>&lt;select&gt;</string>
140 </property> 140 </property>
141 </item> 141 </item>
142 <item> 142 <item>
143 <property> 143 <property>
144 <name>text</name> 144 <name>text</name>
145 <string>cisco</string> 145 <string>cisco</string>
146 </property> 146 </property>
147 </item> 147 </item>
148 <item> 148 <item>
149 <property> 149 <property>
150 <name>text</name> 150 <name>text</name>
151 <string>wlan-ng</string> 151 <string>wlan-ng</string>
152 </property> 152 </property>
153 </item> 153 </item>
154 <item> 154 <item>
155 <property> 155 <property>
156 <name>text</name> 156 <name>text</name>
157 <string>hostap</string> 157 <string>hostap</string>
158 </property> 158 </property>
159 </item> 159 </item>
160 <item> 160 <item>
161 <property> 161 <property>
162 <name>text</name> 162 <name>text</name>
163 <string>orinoco</string> 163 <string>orinoco</string>
164 </property> 164 </property>
165 </item> 165 </item>
166 <item> 166 <item>
167 <property> 167 <property>
168 <name>text</name> 168 <name>text</name>
169 <string>&lt;manual&gt;</string> 169 <string>&lt;manual&gt;</string>
170 </property> 170 </property>
171 </item> 171 </item>
172 <item>
173 <property>
174 <name>text</name>
175 <string>&lt;file&gt;</string>
176 </property>
177 </item>
172 <property stdset="1"> 178 <property stdset="1">
173 <name>name</name> 179 <name>name</name>
174 <cstring>deviceType</cstring> 180 <cstring>deviceType</cstring>
175 </property> 181 </property>
176 <property stdset="1"> 182 <property stdset="1">
177 <name>enabled</name> 183 <name>enabled</name>
178 <bool>true</bool> 184 <bool>true</bool>
179 </property> 185 </property>
180 <property> 186 <property>
181 <name>whatsThis</name> 187 <name>whatsThis</name>
182 <string>Choose the type of driver used for sniffing.</string> 188 <string>Choose the type of driver used for sniffing.</string>
183 </property> 189 </property>
184 </widget> 190 </widget>
185 <widget row="3" column="0" rowspan="1" colspan="2" > 191 <widget row="3" column="0" rowspan="1" colspan="2" >
186 <class>QCheckBox</class> 192 <class>QCheckBox</class>
187 <property stdset="1"> 193 <property stdset="1">
188 <name>name</name> 194 <name>name</name>
189 <cstring>additionalInfo</cstring> 195 <cstring>additionalInfo</cstring>
190 </property> 196 </property>
191 <property stdset="1"> 197 <property stdset="1">
192 <name>enabled</name> 198 <name>enabled</name>
193 <bool>false</bool> 199 <bool>false</bool>
194 </property> 200 </property>
195 <property stdset="1"> 201 <property stdset="1">
196 <name>text</name> 202 <name>text</name>
197 <string>Gather Additional Info</string> 203 <string>Gather Additional Info</string>
198 </property> 204 </property>
199 </widget> 205 </widget>
200 <widget row="2" column="0" > 206 <widget row="2" column="0" >
201 <class>QSpinBox</class> 207 <class>QSpinBox</class>
202 <property stdset="1"> 208 <property stdset="1">
203 <name>name</name> 209 <name>name</name>
204 <cstring>hopInterval</cstring> 210 <cstring>hopInterval</cstring>
205 </property> 211 </property>
206 <property stdset="1"> 212 <property stdset="1">
207 <name>enabled</name> 213 <name>enabled</name>
208 <bool>true</bool> 214 <bool>true</bool>
209 </property> 215 </property>
210 <property stdset="1"> 216 <property stdset="1">
211 <name>suffix</name> 217 <name>suffix</name>
212 <string> ms</string> 218 <string> ms</string>
213 </property> 219 </property>
214 <property stdset="1"> 220 <property stdset="1">
215 <name>maxValue</name> 221 <name>maxValue</name>
216 <number>2000</number> 222 <number>2000</number>
217 </property> 223 </property>
218 <property stdset="1"> 224 <property stdset="1">
219 <name>minValue</name> 225 <name>minValue</name>
220 <number>100</number> 226 <number>100</number>
221 </property> 227 </property>
222 <property stdset="1"> 228 <property stdset="1">
223 <name>lineStep</name> 229 <name>lineStep</name>
224 <number>100</number> 230 <number>100</number>
225 </property> 231 </property>
226 <property> 232 <property>
227 <name>whatsThis</name> 233 <name>whatsThis</name>
228 <string>Choose the channel hop interval.</string> 234 <string>Choose the channel hop interval.</string>
229 </property> 235 </property>
230 </widget> 236 </widget>
231 <widget row="2" column="1" > 237 <widget row="2" column="1" >
232 <class>QLabel</class> 238 <class>QLabel</class>
233 <property stdset="1"> 239 <property stdset="1">
234 <name>name</name> 240 <name>name</name>
235 <cstring>TextLabel3_3</cstring> 241 <cstring>TextLabel3_3</cstring>
236 </property> 242 </property>
237 <property stdset="1"> 243 <property stdset="1">
238 <name>enabled</name> 244 <name>enabled</name>
239 <bool>true</bool> 245 <bool>true</bool>
240 </property> 246 </property>
241 <property stdset="1"> 247 <property stdset="1">
242 <name>text</name> 248 <name>text</name>
243 <string>Hop Interval</string> 249 <string>Hop Interval</string>
244 </property> 250 </property>
245 </widget> 251 </widget>
246 <widget row="1" column="1" > 252 <widget row="1" column="1" >
247 <class>QLabel</class> 253 <class>QLabel</class>
248 <property stdset="1"> 254 <property stdset="1">
249 <name>name</name> 255 <name>name</name>
250 <cstring>TextLabel2_3</cstring> 256 <cstring>TextLabel2_3</cstring>
251 </property> 257 </property>
252 <property stdset="1"> 258 <property stdset="1">
253 <name>enabled</name> 259 <name>enabled</name>
254 <bool>true</bool> 260 <bool>true</bool>
255 </property> 261 </property>
256 <property stdset="1"> 262 <property stdset="1">
257 <name>text</name> 263 <name>text</name>
258 <string>Device Type</string> 264 <string>Device Type</string>
259 </property> 265 </property>
260 </widget> 266 </widget>
261 <widget row="0" column="1" > 267 <widget row="0" column="1" >
262 <class>QLabel</class> 268 <class>QLabel</class>
263 <property stdset="1"> 269 <property stdset="1">
264 <name>name</name> 270 <name>name</name>
265 <cstring>TextLabel1_2</cstring> 271 <cstring>TextLabel1_2</cstring>
266 </property> 272 </property>
267 <property stdset="1"> 273 <property stdset="1">
268 <name>enabled</name> 274 <name>enabled</name>
269 <bool>true</bool> 275 <bool>true</bool>
270 </property> 276 </property>
271 <property stdset="1"> 277 <property stdset="1">
272 <name>text</name> 278 <name>text</name>
273 <string>Interface Name</string> 279 <string>Interface Name</string>
274 </property> 280 </property>
275 </widget> 281 </widget>
276 </grid> 282 </grid>
277 </widget> 283 </widget>
278 <widget> 284 <widget>
279 <class>QLayoutWidget</class> 285 <class>QLayoutWidget</class>
280 <property stdset="1"> 286 <property stdset="1">
281 <name>name</name> 287 <name>name</name>
282 <cstring>Layout6</cstring> 288 <cstring>Layout6</cstring>
283 </property> 289 </property>
284 <property> 290 <property>
285 <name>layoutSpacing</name> 291 <name>layoutSpacing</name>
286 </property> 292 </property>
287 <hbox> 293 <hbox>
288 <property stdset="1"> 294 <property stdset="1">
289 <name>margin</name> 295 <name>margin</name>
290 <number>0</number> 296 <number>0</number>
291 </property> 297 </property>
292 <property stdset="1"> 298 <property stdset="1">
293 <name>spacing</name> 299 <name>spacing</name>
294 <number>2</number> 300 <number>2</number>
295 </property> 301 </property>
296 <widget> 302 <widget>
297 <class>QLabel</class> 303 <class>QLabel</class>
298 <property stdset="1"> 304 <property stdset="1">
299 <name>name</name> 305 <name>name</name>
300 <cstring>TextLabel3_2_2</cstring> 306 <cstring>TextLabel3_2_2</cstring>
301 </property> 307 </property>
302 <property stdset="1"> 308 <property stdset="1">
303 <name>sizePolicy</name> 309 <name>sizePolicy</name>
304 <sizepolicy> 310 <sizepolicy>
305 <hsizetype>4</hsizetype> 311 <hsizetype>4</hsizetype>
306 <vsizetype>1</vsizetype> 312 <vsizetype>1</vsizetype>
307 </sizepolicy> 313 </sizepolicy>
308 </property> 314 </property>
309 <property stdset="1"> 315 <property stdset="1">
310 <name>text</name> 316 <name>text</name>
311 <string>GUI</string> 317 <string>GUI</string>
312 </property> 318 </property>
313 </widget> 319 </widget>
314 <widget> 320 <widget>
315 <class>Line</class> 321 <class>Line</class>
316 <property stdset="1"> 322 <property stdset="1">
317 <name>name</name> 323 <name>name</name>
318 <cstring>Line9_2</cstring> 324 <cstring>Line9_2</cstring>
319 </property> 325 </property>
320 <property stdset="1"> 326 <property stdset="1">
321 <name>orientation</name> 327 <name>orientation</name>
322 <enum>Horizontal</enum> 328 <enum>Horizontal</enum>
323 </property> 329 </property>
324 </widget> 330 </widget>
325 </hbox> 331 </hbox>
326 </widget> 332 </widget>
327 <widget> 333 <widget>
328 <class>QCheckBox</class> 334 <class>QCheckBox</class>
329 <property stdset="1"> 335 <property stdset="1">
330 <name>name</name> 336 <name>name</name>
331 <cstring>groupNetworks</cstring> 337 <cstring>groupNetworks</cstring>
332 </property> 338 </property>
333 <property stdset="1"> 339 <property stdset="1">
334 <name>enabled</name> 340 <name>enabled</name>
335 <bool>false</bool> 341 <bool>false</bool>
336 </property> 342 </property>
337 <property stdset="1"> 343 <property stdset="1">
338 <name>text</name> 344 <name>text</name>
339 <string>Group Detected Networks</string> 345 <string>Group Detected Networks</string>
340 </property> 346 </property>
341 </widget> 347 </widget>
342 <widget> 348 <widget>
343 <class>QCheckBox</class> 349 <class>QCheckBox</class>
344 <property stdset="1"> 350 <property stdset="1">
345 <name>name</name> 351 <name>name</name>
346 <cstring>enableActivity</cstring> 352 <cstring>enableActivity</cstring>
347 </property> 353 </property>
348 <property stdset="1"> 354 <property stdset="1">
349 <name>enabled</name> 355 <name>enabled</name>
350 <bool>false</bool> 356 <bool>false</bool>
351 </property> 357 </property>
352 <property stdset="1"> 358 <property stdset="1">
353 <name>text</name> 359 <name>text</name>
354 <string>Enable Activity Display</string> 360 <string>Enable Activity Display</string>
355 </property> 361 </property>
356 </widget> 362 </widget>
357 <widget> 363 <widget>
358 <class>QLayoutWidget</class> 364 <class>QLayoutWidget</class>
359 <property stdset="1"> 365 <property stdset="1">
360 <name>name</name> 366 <name>name</name>
361 <cstring>Layout5</cstring> 367 <cstring>Layout5</cstring>
362 </property> 368 </property>
363 <grid> 369 <grid>
364 <property stdset="1"> 370 <property stdset="1">
365 <name>margin</name> 371 <name>margin</name>
366 <number>0</number> 372 <number>0</number>
367 </property> 373 </property>
368 <property stdset="1"> 374 <property stdset="1">
369 <name>spacing</name> 375 <name>spacing</name>
370 <number>6</number> 376 <number>6</number>
371 </property> 377 </property>
372 <widget row="0" column="1" > 378 <widget row="0" column="1" >
373 <class>QLabel</class> 379 <class>QLabel</class>
374 <property stdset="1"> 380 <property stdset="1">
375 <name>name</name> 381 <name>name</name>
376 <cstring>TextLabel1</cstring> 382 <cstring>TextLabel1</cstring>
377 </property> 383 </property>
378 <property stdset="1"> 384 <property stdset="1">
379 <name>text</name> 385 <name>text</name>
380 <string>sound on new net</string> 386 <string>sound on new net</string>
381 </property> 387 </property>
382 </widget> 388 </widget>
383 <widget row="1" column="0" > 389 <widget row="1" column="0" >
384 <class>QComboBox</class> 390 <class>QComboBox</class>
385 <item> 391 <item>
386 <property> 392 <property>
387 <name>text</name> 393 <name>text</name>
388 <string>Ignore</string> 394 <string>Ignore</string>
389 </property> 395 </property>
390 </item> 396 </item>
391 <item> 397 <item>
392 <property> 398 <property>
393 <name>text</name> 399 <name>text</name>
394 <string>Touch</string> 400 <string>Touch</string>
395 </property> 401 </property>
396 </item> 402 </item>
397 <item> 403 <item>
398 <property> 404 <property>
399 <name>text</name> 405 <name>text</name>
400 <string>Key</string> 406 <string>Key</string>
401 </property> 407 </property>
402 </item> 408 </item>
403 <item> 409 <item>
404 <property> 410 <property>
405 <name>text</name> 411 <name>text</name>
406 <string>Alarm</string> 412 <string>Alarm</string>
407 </property> 413 </property>
408 </item> 414 </item>
409 <property stdset="1"> 415 <property stdset="1">
410 <name>name</name> 416 <name>name</name>
411 <cstring>beaconSound</cstring> 417 <cstring>beaconSound</cstring>
412 </property> 418 </property>
413 </widget> 419 </widget>
414 <widget row="0" column="0" > 420 <widget row="0" column="0" >
415 <class>QComboBox</class> 421 <class>QComboBox</class>
416 <item> 422 <item>
417 <property> 423 <property>
418 <name>text</name> 424 <name>text</name>
419 <string>Ignore</string> 425 <string>Ignore</string>
420 </property> 426 </property>
421 </item> 427 </item>
422 <item> 428 <item>
423 <property> 429 <property>
424 <name>text</name> 430 <name>text</name>
425 <string>Touch</string> 431 <string>Touch</string>
426 </property> 432 </property>
427 </item> 433 </item>
428 <item> 434 <item>
429 <property> 435 <property>
430 <name>text</name> 436 <name>text</name>
431 <string>Key</string> 437 <string>Key</string>
432 </property> 438 </property>
433 </item> 439 </item>
434 <item> 440 <item>
435 <property> 441 <property>
436 <name>text</name> 442 <name>text</name>
437 <string>Alarm</string> 443 <string>Alarm</string>
438 </property> 444 </property>
439 </item> 445 </item>
440 <property stdset="1"> 446 <property stdset="1">
441 <name>name</name> 447 <name>name</name>
442 <cstring>netSound</cstring> 448 <cstring>netSound</cstring>
443 </property> 449 </property>
444 </widget> 450 </widget>
445 <widget row="1" column="1" > 451 <widget row="1" column="1" >
446 <class>QLabel</class> 452 <class>QLabel</class>
447 <property stdset="1"> 453 <property stdset="1">
448 <name>name</name> 454 <name>name</name>
449 <cstring>TextLabel1_3</cstring> 455 <cstring>TextLabel1_3</cstring>
450 </property> 456 </property>
451 <property stdset="1"> 457 <property stdset="1">
452 <name>text</name> 458 <name>text</name>
453 <string>sound on beacon</string> 459 <string>sound on beacon</string>
454 </property> 460 </property>
455 </widget> 461 </widget>
456 </grid> 462 </grid>
457 </widget> 463 </widget>
458 </vbox> 464 </vbox>
459</widget> 465</widget>
460</UI> 466</UI>
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp
index ba1119e..4aca526 100644
--- a/noncore/net/wellenreiter/gui/configwindow.cpp
+++ b/noncore/net/wellenreiter/gui/configwindow.cpp
@@ -1,100 +1,126 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16/* LOCAL */ 16/* LOCAL */
17#include "configwindow.h" 17#include "configwindow.h"
18#include "mainwindow.h"
18 19
19/* QT */ 20/* QT */
21#include <qapplication.h>
20#include <qcombobox.h> 22#include <qcombobox.h>
21#include <qfile.h> 23#include <qfile.h>
22#include <qlayout.h> 24#include <qlayout.h>
23#include <qmap.h> 25#include <qmap.h>
24#include <qpushbutton.h> 26#include <qpushbutton.h>
25#include <qspinbox.h> 27#include <qspinbox.h>
26#include <qtextstream.h> 28#include <qtextstream.h>
27 29
28/* OPIE */ 30/* OPIE */
29#include <opie2/onetwork.h> 31#include <opie2/onetwork.h>
30 32
31WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; 33WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0;
32 34
33WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) 35WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f )
34 :WellenreiterConfigBase( parent, name, true, f ) 36 :WellenreiterConfigBase( parent, name, true, f )
35{ 37{
36 _devicetype[ "cisco" ] = 1; 38 _devicetype[ "cisco" ] = DEVTYPE_CISCO;
37 _devicetype[ "wlan-ng" ] = 2; 39 _devicetype[ "wlan-ng" ] = DEVTYPE_WLAN_NG;
38 _devicetype[ "hostap" ] = 3; 40 _devicetype[ "hostap" ] = DEVTYPE_HOSTAP;
39 _devicetype[ "orinoco" ] = 4; 41 _devicetype[ "orinoco" ] = DEVTYPE_ORINOCO;
40 _devicetype[ "<manual>" ] = 5; 42 _devicetype[ "<manual>" ] = DEVTYPE_MANUAL;
43 _devicetype[ "<file>" ] = DEVTYPE_FILE;
41 44
42 // gather possible interface names from ONetwork 45 // gather possible interface names from ONetwork
43 ONetwork* net = ONetwork::instance(); 46 ONetwork* net = ONetwork::instance();
44 ONetwork::InterfaceIterator it = net->iterator(); 47 ONetwork::InterfaceIterator it = net->iterator();
45 while ( it.current() ) 48 while ( it.current() )
46 { 49 {
47 if ( it.current()->isWireless() ) 50 if ( it.current()->isWireless() )
48 interfaceName->insertItem( it.current()->name() ); 51 interfaceName->insertItem( it.current()->name() );
49 ++it; 52 ++it;
50 } 53 }
51 54
52 // try to guess device type 55 // try to guess device type
53 QFile m( "/proc/modules" ); 56 QFile m( "/proc/modules" );
54 if ( m.open( IO_ReadOnly ) ) 57 if ( m.open( IO_ReadOnly ) )
55 { 58 {
56 int devicetype(0); 59 int devicetype(0);
57 QString line; 60 QString line;
58 QTextStream modules( &m ); 61 QTextStream modules( &m );
59 while( !modules.atEnd() && !devicetype ) 62 while( !modules.atEnd() && !devicetype )
60 { 63 {
61 modules >> line; 64 modules >> line;
62 if ( line.contains( "cisco" ) ) devicetype = 1; 65 if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO;
63 else if ( line.contains( "hostap" ) ) devicetype = 3; 66 else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP;
64 else if ( line.contains( "prism" ) ) devicetype = 2; 67 else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG;
65 else if ( line.contains( "orinoco" ) ) devicetype = 4; 68 else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO;
66 } 69 }
67 if ( devicetype ) 70 if ( devicetype )
68 { 71 {
69 deviceType->setCurrentItem( devicetype ); 72 deviceType->setCurrentItem( devicetype );
70 qDebug( "Wellenreiter: guessed device type to be %d", devicetype ); 73 _guess = devicetype;
74 qDebug( "Wellenreiter: guessed device type to be #%d", devicetype );
71 } 75 }
72 } 76 }
73 77
74 #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here 78 #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here
75 QPushButton* okButton = new QPushButton( "ok", this ); 79 QPushButton* okButton = new QPushButton( "ok", this );
76 okButton->show(); 80 okButton->show();
77 Layout5_2->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui 81 Layout5_2->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui
78 connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); 82 connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
79 #endif 83 #endif
80 84
81 WellenreiterConfigWindow::_instance = this; 85 WellenreiterConfigWindow::_instance = this;
86
87 connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) );
82}; 88};
83 89
90
84int WellenreiterConfigWindow::daemonDeviceType() 91int WellenreiterConfigWindow::daemonDeviceType()
85{ 92{
86 QString name = deviceType->currentText(); 93 QString name = deviceType->currentText();
87 if ( _devicetype.contains( name ) ) 94 if ( _devicetype.contains( name ) )
88 { 95 {
89 return _devicetype[name]; 96 return _devicetype[name];
90 } 97 }
91 else 98 else
92 { 99 {
93 return 0; 100 return 0;
94 } 101 }
95}; 102};
96 103
104
97int WellenreiterConfigWindow::daemonHopInterval() 105int WellenreiterConfigWindow::daemonHopInterval()
98{ 106{
99 return hopInterval->cleanText().toInt(); 107 return hopInterval->cleanText().toInt();
100} 108}
109
110
111void WellenreiterConfigWindow::changedDeviceType(int t)
112{
113 if ( t != DEVTYPE_FILE ) return;
114 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(false);
115 if ( !name.isNull() && QFile::exists( name ) )
116 {
117 interfaceName->insertItem( name );
118 interfaceName->setCurrentItem( interfaceName->count()-1 );
119 }
120 else
121 {
122 deviceType->setCurrentItem( _guess );
123 }
124
125}
126
diff --git a/noncore/net/wellenreiter/gui/configwindow.h b/noncore/net/wellenreiter/gui/configwindow.h
index 5fd0327..7df1a80 100644
--- a/noncore/net/wellenreiter/gui/configwindow.h
+++ b/noncore/net/wellenreiter/gui/configwindow.h
@@ -1,44 +1,56 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#ifndef WELLENREITERCONFIGWINDOW_H 16#ifndef WELLENREITERCONFIGWINDOW_H
17#define WELLENREITERCONFIGWINDOW_H 17#define WELLENREITERCONFIGWINDOW_H
18 18
19#include "configbase.h" 19#include "configbase.h"
20#include <qmap.h> 20#include <qmap.h>
21#include <qcombobox.h> 21#include <qcombobox.h>
22#include <qstring.h> 22#include <qstring.h>
23 23
24const int DEVTYPE_SELECT = 0;
25const int DEVTYPE_CISCO = 1;
26const int DEVTYPE_WLAN_NG = 2;
27const int DEVTYPE_HOSTAP = 3;
28const int DEVTYPE_ORINOCO = 4;
29const int DEVTYPE_MANUAL = 5;
30const int DEVTYPE_FILE = 6;
31
24class WellenreiterConfigWindow; 32class WellenreiterConfigWindow;
25 33
26class WellenreiterConfigWindow : public WellenreiterConfigBase 34class WellenreiterConfigWindow : public WellenreiterConfigBase
27{ 35{
36 Q_OBJECT
28 37
29 public: 38 public:
30 WellenreiterConfigWindow( QWidget * parent = 0, const char * name = "WellenreiterConfigWindow", WFlags f = 0 ); 39 WellenreiterConfigWindow( QWidget * parent = 0, const char * name = "WellenreiterConfigWindow", WFlags f = 0 );
31 int daemonDeviceType(); 40 int daemonDeviceType();
32 int daemonHopInterval(); 41 int daemonHopInterval();
33 const QString soundOnNetwork() const { return netSound->currentText(); }; 42 const QString soundOnNetwork() const { return netSound->currentText(); };
34 const QString soundOnBeacon() const { return beaconSound->currentText(); }; 43 const QString soundOnBeacon() const { return beaconSound->currentText(); };
35 static WellenreiterConfigWindow* instance() { return _instance; }; 44 static WellenreiterConfigWindow* instance() { return _instance; };
36 45
46 public slots:
47 void changedDeviceType(int);
48
37 protected: 49 protected:
38 QMap<QString, int> _devicetype; 50 QMap<QString, int> _devicetype;
39 static WellenreiterConfigWindow* _instance; 51 static WellenreiterConfigWindow* _instance;
52 int _guess;
40 53
41}; 54};
42 55
43#endif 56#endif
44
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp
index 94e3f28..6cd364c 100644
--- a/noncore/net/wellenreiter/gui/mainwindow.cpp
+++ b/noncore/net/wellenreiter/gui/mainwindow.cpp
@@ -1,359 +1,361 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#include "configwindow.h" 16#include "configwindow.h"
17#include "logwindow.h" 17#include "logwindow.h"
18#include "hexwindow.h" 18#include "hexwindow.h"
19#include "mainwindow.h" 19#include "mainwindow.h"
20#include "wellenreiter.h" 20#include "wellenreiter.h"
21#include "scanlist.h" 21#include "scanlist.h"
22 22
23#include <qcombobox.h> 23#include <qcombobox.h>
24#include <qdatastream.h> 24#include <qdatastream.h>
25#include <qfile.h> 25#include <qfile.h>
26#include <qfileinfo.h> 26#include <qfileinfo.h>
27#include <qiconset.h> 27#include <qiconset.h>
28#include <qmenubar.h> 28#include <qmenubar.h>
29#include <qmessagebox.h> 29#include <qmessagebox.h>
30#include <qpopupmenu.h> 30#include <qpopupmenu.h>
31#include <qstatusbar.h> 31#include <qstatusbar.h>
32#include <qtextstream.h> 32#include <qtextstream.h>
33#include <qtoolbutton.h> 33#include <qtoolbutton.h>
34 34
35#ifdef QWS 35#ifdef QWS
36#include <qpe/resource.h> 36#include <qpe/resource.h>
37#include <opie/ofiledialog.h> 37#include <opie/ofiledialog.h>
38#else 38#else
39#include "resource.h" 39#include "resource.h"
40#include <qapplication.h> 40#include <qapplication.h>
41#include <qfiledialog.h> 41#include <qfiledialog.h>
42#endif 42#endif
43 43
44WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) 44WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f )
45 :QMainWindow( parent, name, f ) 45 :QMainWindow( parent, name, f )
46{ 46{
47 cw = new WellenreiterConfigWindow( this ); 47 cw = new WellenreiterConfigWindow( this );
48 mw = new Wellenreiter( this ); 48 mw = new Wellenreiter( this );
49 mw->setConfigWindow( cw ); 49 mw->setConfigWindow( cw );
50 setCentralWidget( mw ); 50 setCentralWidget( mw );
51 51
52 // setup application icon 52 // setup application icon
53 53
54 #ifndef QWS 54 #ifndef QWS
55 setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); 55 setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) );
56 setIconText( "Wellenreiter/X11" ); 56 setIconText( "Wellenreiter/X11" );
57 #endif 57 #endif
58 58
59 // setup icon sets 59 // setup icon sets
60 60
61 infoIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/InfoIcon" ) ); 61 infoIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/InfoIcon" ) );
62 settingsIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SettingsIcon" ) ); 62 settingsIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SettingsIcon" ) );
63 startIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) ); 63 startIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) );
64 stopIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) ); 64 stopIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) );
65 65
66 // setup tool buttons 66 // setup tool buttons
67 67
68 startButton = new QToolButton( 0 ); 68 startButton = new QToolButton( 0 );
69 #ifdef QWS 69 #ifdef QWS
70 startButton->setAutoRaise( true ); 70 startButton->setAutoRaise( true );
71 #endif 71 #endif
72 startButton->setIconSet( *startIconSet ); 72 startButton->setIconSet( *startIconSet );
73 startButton->setEnabled( false ); 73 startButton->setEnabled( false );
74 connect( startButton, SIGNAL( clicked() ), mw, SLOT( startClicked() ) ); 74 connect( startButton, SIGNAL( clicked() ), mw, SLOT( startClicked() ) );
75 75
76 stopButton = new QToolButton( 0 ); 76 stopButton = new QToolButton( 0 );
77 #ifdef QWS 77 #ifdef QWS
78 stopButton->setAutoRaise( true ); 78 stopButton->setAutoRaise( true );
79 #endif 79 #endif
80 stopButton->setIconSet( *stopIconSet ); 80 stopButton->setIconSet( *stopIconSet );
81 stopButton->setEnabled( false ); 81 stopButton->setEnabled( false );
82 connect( stopButton, SIGNAL( clicked() ), mw, SLOT( stopClicked() ) ); 82 connect( stopButton, SIGNAL( clicked() ), mw, SLOT( stopClicked() ) );
83 83
84 QToolButton* c = new QToolButton( 0 ); 84 QToolButton* c = new QToolButton( 0 );
85 #ifdef QWS 85 #ifdef QWS
86 c->setAutoRaise( true ); 86 c->setAutoRaise( true );
87 #endif 87 #endif
88 c->setIconSet( *infoIconSet ); 88 c->setIconSet( *infoIconSet );
89 c->setEnabled( false ); 89 c->setEnabled( false );
90 90
91 QToolButton* d = new QToolButton( 0 ); 91 QToolButton* d = new QToolButton( 0 );
92 #ifdef QWS 92 #ifdef QWS
93 d->setAutoRaise( true ); 93 d->setAutoRaise( true );
94 #endif 94 #endif
95 d->setIconSet( *settingsIconSet ); 95 d->setIconSet( *settingsIconSet );
96 connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); 96 connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) );
97 97
98 // setup menu bar 98 // setup menu bar
99 99
100 int id; 100 int id;
101 101
102 QMenuBar* mb = menuBar(); 102 QMenuBar* mb = menuBar();
103 103
104 QPopupMenu* fileSave = new QPopupMenu( mb ); 104 QPopupMenu* fileSave = new QPopupMenu( mb );
105 fileSave->insertItem( "&Session...", this, SLOT( fileSaveSession() ) ); 105 fileSave->insertItem( "&Session...", this, SLOT( fileSaveSession() ) );
106 fileSave->insertItem( "&Text Log...", this, SLOT( fileSaveLog() ) ); 106 fileSave->insertItem( "&Text Log...", this, SLOT( fileSaveLog() ) );
107 fileSave->insertItem( "&Hex Log...", this, SLOT( fileSaveHex() ) ); 107 fileSave->insertItem( "&Hex Log...", this, SLOT( fileSaveHex() ) );
108 108
109 QPopupMenu* fileLoad = new QPopupMenu( mb ); 109 QPopupMenu* fileLoad = new QPopupMenu( mb );
110 fileLoad->insertItem( "&Session...", this, SLOT( fileLoadSession() ) ); 110 fileLoad->insertItem( "&Session...", this, SLOT( fileLoadSession() ) );
111 //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); 111 //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) );
112 112
113 QPopupMenu* file = new QPopupMenu( mb ); 113 QPopupMenu* file = new QPopupMenu( mb );
114 file->insertItem( "&New", this, SLOT( fileNew() ) ); 114 file->insertItem( "&New", this, SLOT( fileNew() ) );
115 id = file->insertItem( "&Load", fileLoad ); 115 id = file->insertItem( "&Load", fileLoad );
116 file->insertItem( "&Save", fileSave ); 116 file->insertItem( "&Save", fileSave );
117 file->insertSeparator(); 117 file->insertSeparator();
118 file->insertItem( "&Exit", qApp, SLOT( quit() ) ); 118 file->insertItem( "&Exit", qApp, SLOT( quit() ) );
119 119
120 QPopupMenu* view = new QPopupMenu( mb ); 120 QPopupMenu* view = new QPopupMenu( mb );
121 view->insertItem( "&Configure..." ); 121 view->insertItem( "&Configure..." );
122 122
123 QPopupMenu* sniffer = new QPopupMenu( mb ); 123 QPopupMenu* sniffer = new QPopupMenu( mb );
124 sniffer->insertItem( "&Configure...", this, SLOT( showConfigure() ) ); 124 sniffer->insertItem( "&Configure...", this, SLOT( showConfigure() ) );
125 sniffer->insertSeparator(); 125 sniffer->insertSeparator();
126 startID = sniffer->insertItem( "&Start", mw, SLOT( startClicked() ) ); 126 startID = sniffer->insertItem( "&Start", mw, SLOT( startClicked() ) );
127 sniffer->setItemEnabled( startID, false ); 127 sniffer->setItemEnabled( startID, false );
128 stopID = sniffer->insertItem( "Sto&p", mw, SLOT( stopClicked() ) ); 128 stopID = sniffer->insertItem( "Sto&p", mw, SLOT( stopClicked() ) );
129 sniffer->setItemEnabled( stopID, false ); 129 sniffer->setItemEnabled( stopID, false );
130 130
131 QPopupMenu* demo = new QPopupMenu( mb ); 131 QPopupMenu* demo = new QPopupMenu( mb );
132 demo->insertItem( "&Add something", this, SLOT( demoAddStations() ) ); 132 demo->insertItem( "&Add something", this, SLOT( demoAddStations() ) );
133 133
134 id = mb->insertItem( "&File", file ); 134 id = mb->insertItem( "&File", file );
135 id = mb->insertItem( "&View", view ); 135 id = mb->insertItem( "&View", view );
136 mb->setItemEnabled( id, false ); 136 mb->setItemEnabled( id, false );
137 id = mb->insertItem( "&Sniffer", sniffer ); 137 id = mb->insertItem( "&Sniffer", sniffer );
138 id = mb->insertItem( "&Demo", demo ); 138 id = mb->insertItem( "&Demo", demo );
139 mb->setItemEnabled( id, true ); 139 mb->setItemEnabled( id, true );
140 140
141 #ifdef QWS 141 #ifdef QWS
142 mb->insertItem( startButton ); 142 mb->insertItem( startButton );
143 mb->insertItem( stopButton ); 143 mb->insertItem( stopButton );
144 mb->insertItem( c ); 144 mb->insertItem( c );
145 mb->insertItem( d ); 145 mb->insertItem( d );
146 #else // Qt3 changed the insertion order. It's now totally random :( 146 #else // Qt3 changed the insertion order. It's now totally random :(
147 mb->insertItem( d ); 147 mb->insertItem( d );
148 mb->insertItem( c ); 148 mb->insertItem( c );
149 mb->insertItem( stopButton ); 149 mb->insertItem( stopButton );
150 mb->insertItem( startButton ); 150 mb->insertItem( startButton );
151 #endif 151 #endif
152 152
153 updateToolButtonState(); 153 updateToolButtonState();
154 154
155 // setup status bar (for now only on X11) 155 // setup status bar (for now only on X11)
156 156
157 #ifndef QWS 157 #ifndef QWS
158 statusBar()->message( "Ready." ); 158 statusBar()->message( "Ready." );
159 #endif 159 #endif
160 160
161 connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) ); 161 connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) );
162 connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) ); 162 connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) );
163}; 163};
164 164
165 165
166 166
167void WellenreiterMainWindow::showConfigure() 167void WellenreiterMainWindow::showConfigure()
168{ 168{
169 qDebug( "show configure..." ); 169 qDebug( "show configure..." );
170 cw->setCaption( tr( "Configure" ) ); 170 cw->setCaption( tr( "Configure" ) );
171 #ifdef QWS 171 #ifdef QWS
172 cw->showMaximized(); 172 cw->showMaximized();
173 #endif 173 #endif
174 int result = cw->exec(); 174 int result = cw->exec();
175 175
176 if ( result ) updateToolButtonState(); 176 if ( result ) updateToolButtonState();
177} 177}
178 178
179 179
180 180
181void WellenreiterMainWindow::updateToolButtonState() 181void WellenreiterMainWindow::updateToolButtonState()
182{ 182{
183 const QString& interface = cw->interfaceName->currentText(); 183 const QString& interface = cw->interfaceName->currentText();
184 const int cardtype = cw->daemonDeviceType(); 184 const int cardtype = cw->daemonDeviceType();
185 const int interval = cw->daemonHopInterval(); 185 const int interval = cw->daemonHopInterval();
186 186
187 if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) 187 if ( ( interface != "<select>" ) && ( cardtype != 0 ) )
188 { 188 {
189 startButton->setEnabled( true ); 189 startButton->setEnabled( true );
190 menuBar()->setItemEnabled( startID, true ); 190 menuBar()->setItemEnabled( startID, true );
191 } 191 }
192 else 192 else
193 { 193 {
194 startButton->setEnabled( false ); 194 startButton->setEnabled( false );
195 menuBar()->setItemEnabled( startID, false ); 195 menuBar()->setItemEnabled( startID, false );
196 } 196 }
197} 197}
198 198
199 199
200void WellenreiterMainWindow::changedSniffingState() 200void WellenreiterMainWindow::changedSniffingState()
201{ 201{
202 startButton->setEnabled( !mw->sniffing ); 202 startButton->setEnabled( !mw->sniffing );
203 menuBar()->setItemEnabled( startID, !mw->sniffing ); 203 menuBar()->setItemEnabled( startID, !mw->sniffing );
204 stopButton->setEnabled( mw->sniffing ); 204 stopButton->setEnabled( mw->sniffing );
205 menuBar()->setItemEnabled( stopID, mw->sniffing ); 205 menuBar()->setItemEnabled( stopID, mw->sniffing );
206} 206}
207 207
208 208
209WellenreiterMainWindow::~WellenreiterMainWindow() 209WellenreiterMainWindow::~WellenreiterMainWindow()
210{ 210{
211 delete infoIconSet; 211 delete infoIconSet;
212 delete settingsIconSet; 212 delete settingsIconSet;
213 delete startIconSet; 213 delete startIconSet;
214 delete stopIconSet; 214 delete stopIconSet;
215}; 215};
216 216
217void WellenreiterMainWindow::demoAddStations() 217void WellenreiterMainWindow::demoAddStations()
218{ 218{
219 mw->netView()->addNewItem( "managed", "Vanille", "00:00:20:EF:A6:43", true, 6, 80 ); 219 mw->netView()->addNewItem( "managed", "Vanille", "00:00:20:EF:A6:43", true, 6, 80 );
220 mw->netView()->addNewItem( "managed", "Vanille", "00:30:6D:EF:A6:23", true, 11, 10 ); 220 mw->netView()->addNewItem( "managed", "Vanille", "00:30:6D:EF:A6:23", true, 11, 10 );
221 mw->netView()->addNewItem( "adhoc", "ELAN", "00:A0:F8:E7:16:22", false, 3, 10 ); 221 mw->netView()->addNewItem( "adhoc", "ELAN", "00:A0:F8:E7:16:22", false, 3, 10 );
222 mw->netView()->addNewItem( "adhoc", "ELAN", "00:AA:01:E7:56:62", false, 3, 15 ); 222 mw->netView()->addNewItem( "adhoc", "ELAN", "00:AA:01:E7:56:62", false, 3, 15 );
223 mw->netView()->addNewItem( "adhoc", "ELAN", "00:B0:8E:E7:56:E2", false, 3, 20 ); 223 mw->netView()->addNewItem( "adhoc", "ELAN", "00:B0:8E:E7:56:E2", false, 3, 20 );
224} 224}
225 225
226
226QString WellenreiterMainWindow::getFileName( bool save ) 227QString WellenreiterMainWindow::getFileName( bool save )
227{ 228{
228 QMap<QString, QStringList> map; 229 QMap<QString, QStringList> map;
229 map.insert( tr("All"), QStringList() ); 230 map.insert( tr("All"), QStringList() );
230 QStringList text; 231 QStringList text;
231 text << "text/*"; 232 text << "text/*";
232 map.insert(tr("Text"), text ); 233 map.insert(tr("Text"), text );
233 text << "*"; 234 text << "*";
234 map.insert(tr("All"), text ); 235 map.insert(tr("All"), text );
235 236
236 QString str; 237 QString str;
237 if ( save ) 238 if ( save )
238 { 239 {
239 #ifdef QWS 240 #ifdef QWS
240 str = OFileDialog::getSaveFileName( 2, "/", QString::null, map ); 241 str = OFileDialog::getSaveFileName( 2, "/", QString::null, map );
241 #else 242 #else
242 str = QFileDialog::getSaveFileName(); 243 str = QFileDialog::getSaveFileName();
243 #endif 244 #endif
244 if ( str.isEmpty() || QFileInfo(str).isDir() ) 245 if ( str.isEmpty() || QFileInfo(str).isDir() )
245 return ""; 246 return "";
246 } 247 }
247 else 248 else
248 { 249 {
249 #ifdef QWS 250 #ifdef QWS
250 str = OFileDialog::getOpenFileName( 2, "/", QString::null, map ); 251 str = OFileDialog::getOpenFileName( 2, "/", QString::null, map );
251 #else 252 #else
252 str = QFileDialog::getOpenFileName(); 253 str = QFileDialog::getOpenFileName();
253 #endif 254 #endif
254 if ( str.isEmpty() || !QFile(str).exists() || QFileInfo(str).isDir() ) 255 if ( str.isEmpty() || !QFile(str).exists() || QFileInfo(str).isDir() )
255 return ""; 256 return "";
256 } 257 }
257 return str; 258 return str;
258} 259}
259 260
261
260void WellenreiterMainWindow::fileSaveLog() 262void WellenreiterMainWindow::fileSaveLog()
261{ 263{
262 QString fname = getFileName( true ); 264 QString fname = getFileName( true );
263 if ( !fname.isEmpty() ) 265 if ( !fname.isEmpty() )
264 { 266 {
265 QFile f( fname ); 267 QFile f( fname );
266 if ( f.open(IO_WriteOnly) ) 268 if ( f.open(IO_WriteOnly) )
267 { 269 {
268 QTextStream t( &f ); 270 QTextStream t( &f );
269 t << mw->logWindow()->getLog(); 271 t << mw->logWindow()->getLog();
270 f.close(); 272 f.close();
271 qDebug( "Saved log to file '%s'", (const char*) fname ); 273 qDebug( "Saved log to file '%s'", (const char*) fname );
272 } 274 }
273 else 275 else
274 { 276 {
275 qDebug( "Problem saving log to file '%s'", (const char*) fname ); 277 qDebug( "Problem saving log to file '%s'", (const char*) fname );
276 } 278 }
277 } 279 }
278} 280}
279 281
280void WellenreiterMainWindow::fileSaveSession() 282void WellenreiterMainWindow::fileSaveSession()
281{ 283{
282 QString fname = getFileName( true ); 284 QString fname = getFileName( true );
283 if ( !fname.isEmpty() ) 285 if ( !fname.isEmpty() )
284 { 286 {
285 287
286 QFile f( fname ); 288 QFile f( fname );
287 if ( f.open(IO_WriteOnly) ) 289 if ( f.open(IO_WriteOnly) )
288 { 290 {
289 QDataStream t( &f ); 291 QDataStream t( &f );
290 t << *mw->netView(); 292 t << *mw->netView();
291 f.close(); 293 f.close();
292 qDebug( "Saved session to file '%s'", (const char*) fname ); 294 qDebug( "Saved session to file '%s'", (const char*) fname );
293 } 295 }
294 else 296 else
295 { 297 {
296 qDebug( "Problem saving session to file '%s'", (const char*) fname ); 298 qDebug( "Problem saving session to file '%s'", (const char*) fname );
297 } 299 }
298 } 300 }
299} 301}
300 302
301void WellenreiterMainWindow::fileSaveHex() 303void WellenreiterMainWindow::fileSaveHex()
302{ 304{
303 QString fname = getFileName( true ); 305 QString fname = getFileName( true );
304 if ( !fname.isEmpty() ) 306 if ( !fname.isEmpty() )
305 { 307 {
306 QFile f( fname ); 308 QFile f( fname );
307 if ( f.open(IO_WriteOnly) ) 309 if ( f.open(IO_WriteOnly) )
308 { 310 {
309 QTextStream t( &f ); 311 QTextStream t( &f );
310 t << mw->hexWindow()->getLog(); 312 t << mw->hexWindow()->getLog();
311 f.close(); 313 f.close();
312 qDebug( "Saved hex log to file '%s'", (const char*) fname ); 314 qDebug( "Saved hex log to file '%s'", (const char*) fname );
313 } 315 }
314 else 316 else
315 { 317 {
316 qDebug( "Problem saving hex log to file '%s'", (const char*) fname ); 318 qDebug( "Problem saving hex log to file '%s'", (const char*) fname );
317 } 319 }
318 } 320 }
319} 321}
320 322
321void WellenreiterMainWindow::fileLoadSession() 323void WellenreiterMainWindow::fileLoadSession()
322{ 324{
323 QString fname = getFileName( false ); 325 QString fname = getFileName( false );
324 if ( !fname.isEmpty() ) 326 if ( !fname.isEmpty() )
325 { 327 {
326 QFile f( fname ); 328 QFile f( fname );
327 if ( f.open(IO_ReadOnly) ) 329 if ( f.open(IO_ReadOnly) )
328 { 330 {
329 QDataStream t( &f ); 331 QDataStream t( &f );
330 t >> *mw->netView(); 332 t >> *mw->netView();
331 f.close(); 333 f.close();
332 qDebug( "Loaded session from file '%s'", (const char*) fname ); 334 qDebug( "Loaded session from file '%s'", (const char*) fname );
333 } 335 }
334 else 336 else
335 { 337 {
336 qDebug( "Problem loading session from file '%s'", (const char*) fname ); 338 qDebug( "Problem loading session from file '%s'", (const char*) fname );
337 } 339 }
338 } 340 }
339} 341}
340 342
341void WellenreiterMainWindow::fileNew() 343void WellenreiterMainWindow::fileNew()
342{ 344{
343 mw->netView()->clear(); 345 mw->netView()->clear();
344 mw->logWindow()->clear(); 346 mw->logWindow()->clear();
345 mw->hexWindow()->clear(); 347 mw->hexWindow()->clear();
346} 348}
347 349
348void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) 350void WellenreiterMainWindow::closeEvent( QCloseEvent* e )
349{ 351{
350 if ( mw->isDaemonRunning() ) 352 if ( mw->isDaemonRunning() )
351 { 353 {
352 QMessageBox::warning( this, "Wellenreiter/Opie", "Sniffing in progress!\nPlease stop sniffing before closing." ); 354 QMessageBox::warning( this, "Wellenreiter/Opie", "Sniffing in progress!\nPlease stop sniffing before closing." );
353 e->ignore(); 355 e->ignore();
354 } 356 }
355 else 357 else
356 { 358 {
357 QMainWindow::closeEvent( e ); 359 QMainWindow::closeEvent( e );
358 } 360 }
359} 361}
diff --git a/noncore/net/wellenreiter/gui/mainwindow.h b/noncore/net/wellenreiter/gui/mainwindow.h
index 1e191e5..926bb0a 100644
--- a/noncore/net/wellenreiter/gui/mainwindow.h
+++ b/noncore/net/wellenreiter/gui/mainwindow.h
@@ -1,66 +1,64 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#ifndef MAINWINDOW_H 16#ifndef MAINWINDOW_H
17#define MAINWINDOW_H 17#define MAINWINDOW_H
18 18
19#include <qmainwindow.h> 19#include <qmainwindow.h>
20 20
21class Wellenreiter; 21class Wellenreiter;
22class WellenreiterConfigWindow; 22class WellenreiterConfigWindow;
23class QIconSet; 23class QIconSet;
24class QToolButton; 24class QToolButton;
25 25
26class WellenreiterMainWindow: public QMainWindow 26class WellenreiterMainWindow: public QMainWindow
27{ 27{
28 Q_OBJECT 28 Q_OBJECT
29 29
30 public: 30 public:
31 WellenreiterMainWindow( QWidget * parent = 0, const char * name = "mainwindow", WFlags f = 0 ); 31 WellenreiterMainWindow( QWidget * parent = 0, const char * name = "mainwindow", WFlags f = 0 );
32 ~WellenreiterMainWindow(); 32 ~WellenreiterMainWindow();
33 QString getFileName( bool save );
33 34
34 protected: 35 protected:
35 Wellenreiter* mw; 36 Wellenreiter* mw;
36 WellenreiterConfigWindow* cw; 37 WellenreiterConfigWindow* cw;
37 38
38 const QIconSet* startIconSet; 39 const QIconSet* startIconSet;
39 const QIconSet* stopIconSet; 40 const QIconSet* stopIconSet;
40 const QIconSet* infoIconSet; 41 const QIconSet* infoIconSet;
41 const QIconSet* settingsIconSet; 42 const QIconSet* settingsIconSet;
42 43
43 QToolButton* startButton; 44 QToolButton* startButton;
44 QToolButton* stopButton; 45 QToolButton* stopButton;
45 int startID; 46 int startID;
46 int stopID; 47 int stopID;
47 48
48 protected: 49 protected:
49 virtual void closeEvent( QCloseEvent* ); 50 virtual void closeEvent( QCloseEvent* );
50 void updateToolButtonState(); 51 void updateToolButtonState();
51 52
52 private:
53 QString getFileName( bool save );
54
55 public slots: 53 public slots:
56 void showConfigure(); 54 void showConfigure();
57 void demoAddStations(); 55 void demoAddStations();
58 void fileSaveLog(); 56 void fileSaveLog();
59 void fileSaveHex(); 57 void fileSaveHex();
60 void fileSaveSession(); 58 void fileSaveSession();
61 void fileLoadSession(); 59 void fileLoadSession();
62 void fileNew(); 60 void fileNew();
63 void changedSniffingState(); 61 void changedSniffingState();
64}; 62};
65 63
66#endif 64#endif
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 3372883..5c10c3b 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -1,339 +1,365 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14***********************************************************************/ 14***********************************************************************/
15 15
16// Opie 16// Opie
17 17
18#ifdef QWS 18#ifdef QWS
19#include <opie/odevice.h> 19#include <opie/odevice.h>
20using namespace Opie; 20using namespace Opie;
21#endif 21#endif
22 22
23#ifdef QWS 23#ifdef QWS
24#include <opie2/oapplication.h> 24#include <opie2/oapplication.h>
25#else 25#else
26#include <qapplication.h> 26#include <qapplication.h>
27#endif 27#endif
28#include <opie2/onetwork.h> 28#include <opie2/onetwork.h>
29#include <opie2/opcap.h> 29#include <opie2/opcap.h>
30 30
31// Qt 31// Qt
32 32
33#include <qpushbutton.h> 33#include <qpushbutton.h>
34#include <qmessagebox.h> 34#include <qmessagebox.h>
35#include <qcombobox.h> 35#include <qcombobox.h>
36#include <qspinbox.h> 36#include <qspinbox.h>
37#include <qtoolbutton.h> 37#include <qtoolbutton.h>
38#include <qmainwindow.h> 38#include <qmainwindow.h>
39 39
40// Standard 40// Standard
41 41
42#include <assert.h> 42#include <assert.h>
43#include <errno.h> 43#include <errno.h>
44#include <unistd.h> 44#include <unistd.h>
45#include <string.h> 45#include <string.h>
46#include <sys/types.h> 46#include <sys/types.h>
47#include <stdlib.h> 47#include <stdlib.h>
48 48
49// Local 49// Local
50 50
51#include "wellenreiter.h" 51#include "wellenreiter.h"
52#include "scanlist.h" 52#include "scanlist.h"
53#include "logwindow.h" 53#include "logwindow.h"
54#include "hexwindow.h" 54#include "hexwindow.h"
55#include "configwindow.h" 55#include "configwindow.h"
56#include "statwindow.h" 56#include "statwindow.h"
57#include "manufacturers.h" 57#include "manufacturers.h"
58 58
59Wellenreiter::Wellenreiter( QWidget* parent ) 59Wellenreiter::Wellenreiter( QWidget* parent )
60 : WellenreiterBase( parent, 0, 0 ), 60 : WellenreiterBase( parent, 0, 0 ),
61 sniffing( false ), iface( 0 ), manufacturerdb( 0 ), configwindow( 0 ) 61 sniffing( false ), iface( 0 ), manufacturerdb( 0 ), configwindow( 0 )
62{ 62{
63 63
64 // 64 //
65 // construct manufacturer database 65 // construct manufacturer database
66 // 66 //
67 67
68 QString manufile; 68 QString manufile;
69 #ifdef QWS 69 #ifdef QWS
70 manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) QPEApplication::qpeDir() ); 70 manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) QPEApplication::qpeDir() );
71 #else 71 #else
72 manufile.sprintf( "/usr/local/share/wellenreiter/manufacturers.dat" ); 72 manufile.sprintf( "/usr/local/share/wellenreiter/manufacturers.dat" );
73 #endif 73 #endif
74 manufacturerdb = new ManufacturerDB( manufile ); 74 manufacturerdb = new ManufacturerDB( manufile );
75 75
76 logwindow->log( "(i) Wellenreiter has been started." ); 76 logwindow->log( "(i) Wellenreiter has been started." );
77 77
78 // 78 //
79 // detect operating system 79 // detect operating system
80 // 80 //
81 81
82 #ifdef QWS 82 #ifdef QWS
83 QString sys; 83 QString sys;
84 sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); 84 sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() );
85 _system = ODevice::inst()->system(); 85 _system = ODevice::inst()->system();
86 logwindow->log( sys ); 86 logwindow->log( sys );
87 #endif 87 #endif
88 88
89 // setup GUI 89 // setup GUI
90 netview->setColumnWidthMode( 1, QListView::Manual ); 90 netview->setColumnWidthMode( 1, QListView::Manual );
91 91
92 if ( manufacturerdb ) 92 if ( manufacturerdb )
93 netview->setManufacturerDB( manufacturerdb ); 93 netview->setManufacturerDB( manufacturerdb );
94 94
95 pcap = new OPacketCapturer(); 95 pcap = new OPacketCapturer();
96 96
97} 97}
98 98
99 99
100Wellenreiter::~Wellenreiter() 100Wellenreiter::~Wellenreiter()
101{ 101{
102 // no need to delete child widgets, Qt does it all for us 102 // no need to delete child widgets, Qt does it all for us
103 103
104 delete manufacturerdb; 104 delete manufacturerdb;
105 delete pcap; 105 delete pcap;
106} 106}
107 107
108 108
109void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) 109void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw )
110{ 110{
111 configwindow = cw; 111 configwindow = cw;
112} 112}
113 113
114 114
115void Wellenreiter::channelHopped(int c) 115void Wellenreiter::channelHopped(int c)
116{ 116{
117 QString title = "Wellenreiter II -scan- ["; 117 QString title = "Wellenreiter II -scan- [";
118 QString left; 118 QString left;
119 if ( c > 1 ) left.fill( '.', c-1 ); 119 if ( c > 1 ) left.fill( '.', c-1 );
120 title.append( left ); 120 title.append( left );
121 title.append( '|' ); 121 title.append( '|' );
122 if ( c < iface->channels() ) 122 if ( c < iface->channels() )
123 { 123 {
124 QString right; 124 QString right;
125 right.fill( '.', iface->channels()-c ); 125 right.fill( '.', iface->channels()-c );
126 title.append( right ); 126 title.append( right );
127 } 127 }
128 title.append( "]" ); 128 title.append( "]" );
129 //title.append( QString().sprintf( " %02d", c ) ); 129 //title.append( QString().sprintf( " %02d", c ) );
130 assert( parent() ); 130 assert( parent() );
131 ( (QMainWindow*) parent() )->setCaption( title ); 131 ( (QMainWindow*) parent() )->setCaption( title );
132} 132}
133 133
134 134
135void Wellenreiter::receivePacket(OPacket* p) 135void Wellenreiter::receivePacket(OPacket* p)
136{ 136{
137 hexWindow()->log( p->dump( 8 ) ); 137 hexWindow()->log( p->dump( 8 ) );
138 138
139 // check if we received a beacon frame 139 // check if we received a beacon frame
140 OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); 140 OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) );
141 if ( beacon && beacon->managementType() == "Beacon" ) 141 if ( beacon && beacon->managementType() == "Beacon" )
142 { 142 {
143 QString type; 143 QString type;
144 if ( beacon->canIBSS() ) 144 if ( beacon->canIBSS() )
145 { 145 {
146 type = "adhoc"; 146 type = "adhoc";
147 } 147 }
148 else if ( beacon->canESS() ) 148 else if ( beacon->canESS() )
149 { 149 {
150 type = "managed"; 150 type = "managed";
151 } 151 }
152 else 152 else
153 { 153 {
154 qDebug( "Wellenreiter::invalid frame detected: '%s'", (const char*) p->dump( 16 ) ); 154 qDebug( "Wellenreiter::invalid frame detected: '%s'", (const char*) p->dump( 16 ) );
155 return; 155 return;
156 } 156 }
157 157
158 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); 158 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) );
159 QString essid = ssid ? ssid->ID() : QString("<unknown>"); 159 QString essid = ssid ? ssid->ID() : QString("<unknown>");
160 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); 160 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) );
161 int channel = ds ? ds->channel() : -1; 161 int channel = ds ? ds->channel() : -1;
162 162
163 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); 163 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
164 netView()->addNewItem( type, essid, header->macAddress2().toString(), beacon->canPrivacy(), channel, 0 ); 164 netView()->addNewItem( type, essid, header->macAddress2().toString(), beacon->canPrivacy(), channel, 0 );
165 return; 165 return;
166 } 166 }
167 167
168 // check for a data frame 168 // check for a data frame
169 OWaveLanDataPacket* data = static_cast<OWaveLanDataPacket*>( p->child( "802.11 Data" ) ); 169 OWaveLanDataPacket* data = static_cast<OWaveLanDataPacket*>( p->child( "802.11 Data" ) );
170 if ( data ) 170 if ( data )
171 { 171 {
172 OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); 172 OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" );
173 if ( wlan->fromDS() && !wlan->toDS() ) 173 if ( wlan->fromDS() && !wlan->toDS() )
174 { 174 {
175 qDebug( "FromDS traffic: '%s' -> '%s' via '%s'", 175 qDebug( "FromDS traffic: '%s' -> '%s' via '%s'",
176 (const char*) wlan->macAddress3().toString(true), 176 (const char*) wlan->macAddress3().toString(true),
177 (const char*) wlan->macAddress1().toString(true), 177 (const char*) wlan->macAddress1().toString(true),
178 (const char*) wlan->macAddress2().toString(true) ); 178 (const char*) wlan->macAddress2().toString(true) );
179 netView()->traffic( "fromDS", wlan->macAddress3().toString(), 179 netView()->traffic( "fromDS", wlan->macAddress3().toString(),
180 wlan->macAddress1().toString(), 180 wlan->macAddress1().toString(),
181 wlan->macAddress2().toString() ); 181 wlan->macAddress2().toString() );
182 } 182 }
183 else 183 else
184 if ( !wlan->fromDS() && wlan->toDS() ) 184 if ( !wlan->fromDS() && wlan->toDS() )
185 { 185 {
186 qDebug( "ToDS traffic: '%s' -> '%s' via '%s'", 186 qDebug( "ToDS traffic: '%s' -> '%s' via '%s'",
187 (const char*) wlan->macAddress2().toString(true), 187 (const char*) wlan->macAddress2().toString(true),
188 (const char*) wlan->macAddress3().toString(true), 188 (const char*) wlan->macAddress3().toString(true),
189 (const char*) wlan->macAddress1().toString(true) ); 189 (const char*) wlan->macAddress1().toString(true) );
190 netView()->traffic( "toDS", wlan->macAddress2().toString(), 190 netView()->traffic( "toDS", wlan->macAddress2().toString(),
191 wlan->macAddress3().toString(), 191 wlan->macAddress3().toString(),
192 wlan->macAddress1().toString() ); 192 wlan->macAddress1().toString() );
193 } 193 }
194 else 194 else
195 if ( wlan->fromDS() && wlan->toDS() ) 195 if ( wlan->fromDS() && wlan->toDS() )
196 { 196 {
197 qDebug( "WSD(bridge) traffic: '%s' -> '%s' via '%s' and '%s'", 197 qDebug( "WSD(bridge) traffic: '%s' -> '%s' via '%s' and '%s'",
198 (const char*) wlan->macAddress4().toString(true), 198 (const char*) wlan->macAddress4().toString(true),
199 (const char*) wlan->macAddress3().toString(true), 199 (const char*) wlan->macAddress3().toString(true),
200 (const char*) wlan->macAddress1().toString(true), 200 (const char*) wlan->macAddress1().toString(true),
201 (const char*) wlan->macAddress2().toString(true) ); 201 (const char*) wlan->macAddress2().toString(true) );
202 netView()->traffic( "WSD", wlan->macAddress4().toString(), 202 netView()->traffic( "WSD", wlan->macAddress4().toString(),
203 wlan->macAddress3().toString(), 203 wlan->macAddress3().toString(),
204 wlan->macAddress1().toString(), 204 wlan->macAddress1().toString(),
205 wlan->macAddress2().toString() ); 205 wlan->macAddress2().toString() );
206 } 206 }
207 else 207 else
208 { 208 {
209 qDebug( "IBSS(AdHoc) traffic: '%s' -> '%s' (Cell: '%s')'", 209 qDebug( "IBSS(AdHoc) traffic: '%s' -> '%s' (Cell: '%s')'",
210 (const char*) wlan->macAddress2().toString(true), 210 (const char*) wlan->macAddress2().toString(true),
211 (const char*) wlan->macAddress1().toString(true), 211 (const char*) wlan->macAddress1().toString(true),
212 (const char*) wlan->macAddress3().toString(true) ); 212 (const char*) wlan->macAddress3().toString(true) );
213 netView()->traffic( "IBSS", wlan->macAddress2().toString(), 213 netView()->traffic( "IBSS", wlan->macAddress2().toString(),
214 wlan->macAddress1().toString(), 214 wlan->macAddress1().toString(),
215 wlan->macAddress3().toString() ); 215 wlan->macAddress3().toString() );
216 } 216 }
217 return; 217 return;
218 } 218 }
219} 219}
220 220
221 221
222void Wellenreiter::stopClicked() 222void Wellenreiter::stopClicked()
223{ 223{
224 disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); 224 if ( iface )
225 disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); 225 {
226 iface->setChannelHopping(); // stop hopping channels 226 disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
227 disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) );
228 iface->setChannelHopping(); // stop hopping channels
229 }
230 else
231 killTimers();
232
227 pcap->close(); 233 pcap->close();
228 sniffing = false; 234 sniffing = false;
229 #ifdef QWS
230 oApp->setTitle();
231 #else
232 qApp->mainWidget()->setCaption( "Wellenreiter II" );
233 #endif
234 235
235 // get interface name from config window 236 if ( iface )
236 const QString& interface = configwindow->interfaceName->currentText(); 237 {
237 ONetwork* net = ONetwork::instance(); 238 // switch off monitor mode
238 iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); 239 iface->setMonitorMode( false );
240 // switch off promisc flag
241 iface->setPromiscuousMode( false );
239 242
240 // switch off monitor mode 243 system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess
241 iface->setMonitorMode( false ); 244 }
242 // switch off promisc flag
243 iface->setPromiscuousMode( false );
244 245
245 system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess
246 logwindow->log( "(i) Stopped Scanning." ); 246 logwindow->log( "(i) Stopped Scanning." );
247 assert( parent() ); 247 assert( parent() );
248 ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); 248 ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" );
249 249
250 // message the user 250 // message the user
251 QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." ); 251 QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." );
252 252
253 sniffing = false; 253 sniffing = false;
254 emit( stoppedSniffing() ); 254 emit( stoppedSniffing() );
255 255
256 // print out statistics 256 // print out statistics
257 statwindow->log( "-----------------------------------------" ); 257 statwindow->log( "-----------------------------------------" );
258 statwindow->log( "- Wellenreiter II Capturing Statistic -" ); 258 statwindow->log( "- Wellenreiter II Capturing Statistic -" );
259 statwindow->log( "-----------------------------------------" ); 259 statwindow->log( "-----------------------------------------" );
260 statwindow->log( "Packet Type | Receive Count" ); 260 statwindow->log( "Packet Type | Receive Count" );
261 261
262 for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) 262 for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it )
263 { 263 {
264 QString left; 264 QString left;
265 left.sprintf( "%s", (const char*) it.key() ); 265 left.sprintf( "%s", (const char*) it.key() );
266 left = left.leftJustify( 20 ); 266 left = left.leftJustify( 20 );
267 left.append( '|' ); 267 left.append( '|' );
268 QString right; 268 QString right;
269 right.sprintf( "%d", it.data() ); 269 right.sprintf( "%d", it.data() );
270 right = right.rightJustify( 7 ); 270 right = right.rightJustify( 7 );
271 statwindow->log( left + right ); 271 statwindow->log( left + right );
272 } 272 }
273 273
274} 274}
275 275
276 276
277void Wellenreiter::startClicked() 277void Wellenreiter::startClicked()
278{ 278{
279 // get configuration from config window 279 // get configuration from config window
280 280
281 const QString& interface = configwindow->interfaceName->currentText(); 281 const QString& interface = configwindow->interfaceName->currentText();
282 const int cardtype = configwindow->daemonDeviceType(); 282 const int cardtype = configwindow->daemonDeviceType();
283 const int interval = configwindow->daemonHopInterval(); 283 const int interval = configwindow->daemonHopInterval();
284 284
285 if ( ( interface == "" ) || ( cardtype == 0 ) ) 285 if ( ( interface == "" ) || ( cardtype == 0 ) )
286 { 286 {
287 QMessageBox::information( this, "Wellenreiter II", "Your device is not\nproperly configured. Please reconfigure!" ); 287 QMessageBox::information( this, "Wellenreiter II", "Your device is not\nproperly configured. Please reconfigure!" );
288 return; 288 return;
289 } 289 }
290 290
291 // configure device 291 // configure device
292 292
293 ONetwork* net = ONetwork::instance(); 293 ONetwork* net = ONetwork::instance();
294 iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); 294 iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface ));
295 295
296 // set monitor mode 296 // set monitor mode
297 297
298 switch ( cardtype ) 298 switch ( cardtype )
299 { 299 {
300 case 1: iface->setMonitoring( new OCiscoMonitoringInterface( iface ) ); break; 300 case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface ) ); break;
301 case 2: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break; 301 case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break;
302 case 3: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break; 302 case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break;
303 case 4: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break; 303 case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break;
304 default: 304 case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", "Bring your device into\nmonitor mode now." ); break;
305 QMessageBox::information( this, "Wellenreiter II", "Bring your device into\nmonitor mode now." ); 305 case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break;
306 default: assert( 0 ); // shouldn't reach this
306 } 307 }
307 308
308 if ( cardtype > 0 && cardtype < 5 ) 309 // switch device into monitor mode
309 iface->setMonitorMode( true ); 310 if ( cardtype < DEVTYPE_FILE )
310
311 if ( !iface->monitorMode() )
312 { 311 {
313 QMessageBox::warning( this, "Wellenreiter II", "Can't set device into monitor mode." ); 312 if ( cardtype != DEVTYPE_MANUAL )
314 return; 313 iface->setMonitorMode( true );
314 if ( !iface->monitorMode() )
315 {
316 QMessageBox::warning( this, "Wellenreiter II", "Can't set device into monitor mode." );
317 return;
318 }
315 } 319 }
316 320
317 // open pcap and start sniffing 321 // open pcap and start sniffing
318 pcap->open( interface ); 322 if ( cardtype != DEVTYPE_FILE )
323 pcap->open( interface );
324 else
325 pcap->open( QFile( interface ) );
319 326
320 if ( !pcap->isOpen() ) 327 if ( !pcap->isOpen() )
321 { 328 {
322 QMessageBox::warning( this, "Wellenreiter II", "Can't open packet capturer:\n" + QString(strerror( errno ) )); 329 QMessageBox::warning( this, "Wellenreiter II", "Can't open packet capturer:\n" + QString(strerror( errno ) ));
323 return; 330 return;
324 } 331 }
325 332
326 // set capturer to non-blocking mode 333 // set capturer to non-blocking mode
327 pcap->setBlocking( false ); 334 pcap->setBlocking( false );
328 335
329 // start channel hopper 336 // start channel hopper
330 iface->setChannelHopping( 1000 ); //use interval from config window 337 if ( cardtype != DEVTYPE_FILE )
338 iface->setChannelHopping( 1000 ); //use interval from config window
331 339
332 // connect 340 if ( cardtype != DEVTYPE_FILE )
333 connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); 341 {
334 connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); 342 // connect socket notifier and start channel hopper
343 connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
344 connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) );
345 }
346 else
347 {
348 // start timer for reading packets
349 startTimer( 100 );
350 }
335 351
336 logwindow->log( "(i) Started Scanning." ); 352 logwindow->log( "(i) Started Scanning." );
337 sniffing = true; 353 sniffing = true;
338 emit( startedSniffing() ); 354 emit( startedSniffing() );
339} 355}
356
357
358void Wellenreiter::timerEvent( QTimerEvent* )
359{
360 qDebug( "Wellenreiter::timerEvent()" );
361 OPacket* p = pcap->next();
362 receivePacket( p );
363 delete p;
364}
365
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h
index 839c77e..c37a9f2 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.h
+++ b/noncore/net/wellenreiter/gui/wellenreiter.h
@@ -1,78 +1,81 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#ifndef WELLENREITER_H 16#ifndef WELLENREITER_H
17#define WELLENREITER_H 17#define WELLENREITER_H
18 18
19#include "wellenreiterbase.h" 19#include "wellenreiterbase.h"
20 20
21#ifdef QWS 21#ifdef QWS
22#include <opie/odevice.h> 22#include <opie/odevice.h>
23using namespace Opie; 23using namespace Opie;
24#endif 24#endif
25 25
26class QTimerEvent; 26class QTimerEvent;
27class QPixmap; 27class QPixmap;
28class OPacket; 28class OPacket;
29class OPacketCapturer; 29class OPacketCapturer;
30class OWirelessNetworkInterface; 30class OWirelessNetworkInterface;
31 31
32class ManufacturerDB; 32class ManufacturerDB;
33class WellenreiterConfigWindow; 33class WellenreiterConfigWindow;
34class MLogWindow; 34class MLogWindow;
35class MHexWindow; 35class MHexWindow;
36 36
37class Wellenreiter : public WellenreiterBase { 37class Wellenreiter : public WellenreiterBase {
38 Q_OBJECT 38 Q_OBJECT
39 39
40 public: 40 public:
41 Wellenreiter( QWidget* parent = 0 ); 41 Wellenreiter( QWidget* parent = 0 );
42 ~Wellenreiter(); 42 ~Wellenreiter();
43 43
44 void setConfigWindow( WellenreiterConfigWindow* cw ); 44 void setConfigWindow( WellenreiterConfigWindow* cw );
45 MScanListView* netView() const { return netview; }; 45 MScanListView* netView() const { return netview; };
46 MLogWindow* logWindow() const { return logwindow; }; 46 MLogWindow* logWindow() const { return logwindow; };
47 MHexWindow* hexWindow() const { return hexwindow; }; 47 MHexWindow* hexWindow() const { return hexwindow; };
48 bool isDaemonRunning() const { return sniffing; }; 48 bool isDaemonRunning() const { return sniffing; };
49 49
50 bool sniffing; 50 bool sniffing;
51 51
52 protected:
53 virtual void timerEvent( QTimerEvent* );
54
52 public slots: 55 public slots:
53 void channelHopped(int); 56 void channelHopped(int);
54 void receivePacket(OPacket*); 57 void receivePacket(OPacket*);
55 void startClicked(); 58 void startClicked();
56 void stopClicked(); 59 void stopClicked();
57 60
58 signals: 61 signals:
59 void startedSniffing(); 62 void startedSniffing();
60 void stoppedSniffing(); 63 void stoppedSniffing();
61 64
62 private: 65 private:
63 #ifdef QWS 66 #ifdef QWS
64 OSystem _system; // Opie Operating System identifier 67 OSystem _system; // Opie Operating System identifier
65 #endif 68 #endif
66 69
67 OWirelessNetworkInterface* iface; 70 OWirelessNetworkInterface* iface;
68 OPacketCapturer* pcap; 71 OPacketCapturer* pcap;
69 ManufacturerDB* manufacturerdb; 72 ManufacturerDB* manufacturerdb;
70 WellenreiterConfigWindow* configwindow; 73 WellenreiterConfigWindow* configwindow;
71 74
72 //void readConfig(); 75 //void readConfig();
73 //void writeConfig(); 76 //void writeConfig();
74}; 77};
75 78
76 79
77 80
78#endif 81#endif