-rw-r--r-- | noncore/net/wellenreiter/gui/configbase.ui | 8 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/main.cpp | 17 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 9 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/protolistview.cpp | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 16 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.h | 1 |
6 files changed, 45 insertions, 8 deletions
diff --git a/noncore/net/wellenreiter/gui/configbase.ui b/noncore/net/wellenreiter/gui/configbase.ui index 422826a..590ca92 100644 --- a/noncore/net/wellenreiter/gui/configbase.ui +++ b/noncore/net/wellenreiter/gui/configbase.ui | |||
@@ -52,128 +52,132 @@ | |||
52 | <name>name</name> | 52 | <name>name</name> |
53 | <cstring>tab</cstring> | 53 | <cstring>tab</cstring> |
54 | </property> | 54 | </property> |
55 | <attribute> | 55 | <attribute> |
56 | <name>title</name> | 56 | <name>title</name> |
57 | <string>Interface</string> | 57 | <string>Interface</string> |
58 | </attribute> | 58 | </attribute> |
59 | <grid> | 59 | <grid> |
60 | <property stdset="1"> | 60 | <property stdset="1"> |
61 | <name>margin</name> | 61 | <name>margin</name> |
62 | <number>5</number> | 62 | <number>5</number> |
63 | </property> | 63 | </property> |
64 | <property stdset="1"> | 64 | <property stdset="1"> |
65 | <name>spacing</name> | 65 | <name>spacing</name> |
66 | <number>3</number> | 66 | <number>3</number> |
67 | </property> | 67 | </property> |
68 | <widget row="0" column="0" > | 68 | <widget row="0" column="0" > |
69 | <class>QLabel</class> | 69 | <class>QLabel</class> |
70 | <property stdset="1"> | 70 | <property stdset="1"> |
71 | <name>name</name> | 71 | <name>name</name> |
72 | <cstring>TextLabel1_2</cstring> | 72 | <cstring>TextLabel1_2</cstring> |
73 | </property> | 73 | </property> |
74 | <property stdset="1"> | 74 | <property stdset="1"> |
75 | <name>enabled</name> | 75 | <name>enabled</name> |
76 | <bool>true</bool> | 76 | <bool>true</bool> |
77 | </property> | 77 | </property> |
78 | <property stdset="1"> | 78 | <property stdset="1"> |
79 | <name>text</name> | 79 | <name>text</name> |
80 | <string>Name:</string> | 80 | <string>Name:</string> |
81 | </property> | 81 | </property> |
82 | </widget> | 82 | </widget> |
83 | <widget row="1" column="0" > | 83 | <widget row="1" column="0" > |
84 | <class>QLabel</class> | 84 | <class>QLabel</class> |
85 | <property stdset="1"> | 85 | <property stdset="1"> |
86 | <name>name</name> | 86 | <name>name</name> |
87 | <cstring>TextLabel2_3</cstring> | 87 | <cstring>TextLabel2_3</cstring> |
88 | </property> | 88 | </property> |
89 | <property stdset="1"> | 89 | <property stdset="1"> |
90 | <name>enabled</name> | 90 | <name>enabled</name> |
91 | <bool>true</bool> | 91 | <bool>true</bool> |
92 | </property> | 92 | </property> |
93 | <property stdset="1"> | 93 | <property stdset="1"> |
94 | <name>text</name> | 94 | <name>text</name> |
95 | <string>Driver:</string> | 95 | <string>Driver:</string> |
96 | </property> | 96 | </property> |
97 | </widget> | 97 | </widget> |
98 | <widget row="2" column="0" rowspan="1" colspan="4" > | 98 | <widget row="2" column="0" rowspan="1" colspan="4" > |
99 | <class>QCheckBox</class> | 99 | <class>QCheckBox</class> |
100 | <property stdset="1"> | 100 | <property stdset="1"> |
101 | <name>name</name> | 101 | <name>name</name> |
102 | <cstring>prismHeader</cstring> | 102 | <cstring>prismHeader</cstring> |
103 | </property> | 103 | </property> |
104 | <property stdset="1"> | 104 | <property stdset="1"> |
105 | <name>text</name> | 105 | <name>text</name> |
106 | <string>Use additional PRISM header</string> | 106 | <string>Use additional PRISM header</string> |
107 | </property> | 107 | </property> |
108 | </widget> | 108 | </widget> |
109 | <widget row="6" column="0" rowspan="1" colspan="4" > | 109 | <widget row="6" column="0" rowspan="1" colspan="4" > |
110 | <class>QGroupBox</class> | 110 | <class>QGroupBox</class> |
111 | <property stdset="1"> | 111 | <property stdset="1"> |
112 | <name>name</name> | 112 | <name>name</name> |
113 | <cstring>GroupBox1</cstring> | 113 | <cstring>GroupBox1</cstring> |
114 | </property> | 114 | </property> |
115 | <property stdset="1"> | 115 | <property stdset="1"> |
116 | <name>enabled</name> | ||
117 | <bool>false</bool> | ||
118 | </property> | ||
119 | <property stdset="1"> | ||
116 | <name>title</name> | 120 | <name>title</name> |
117 | <string>Scan on channel</string> | 121 | <string>Scan on channel</string> |
118 | </property> | 122 | </property> |
119 | <property> | 123 | <property> |
120 | <name>layoutMargin</name> | 124 | <name>layoutMargin</name> |
121 | </property> | 125 | </property> |
122 | <property> | 126 | <property> |
123 | <name>layoutSpacing</name> | 127 | <name>layoutSpacing</name> |
124 | </property> | 128 | </property> |
125 | <grid> | 129 | <grid> |
126 | <property stdset="1"> | 130 | <property stdset="1"> |
127 | <name>margin</name> | 131 | <name>margin</name> |
128 | <number>4</number> | 132 | <number>4</number> |
129 | </property> | 133 | </property> |
130 | <property stdset="1"> | 134 | <property stdset="1"> |
131 | <name>spacing</name> | 135 | <name>spacing</name> |
132 | <number>2</number> | 136 | <number>2</number> |
133 | </property> | 137 | </property> |
134 | <widget row="1" column="1" > | 138 | <widget row="1" column="1" > |
135 | <class>QCheckBox</class> | 139 | <class>QCheckBox</class> |
136 | <property stdset="1"> | 140 | <property stdset="1"> |
137 | <name>name</name> | 141 | <name>name</name> |
138 | <cstring>channel6</cstring> | 142 | <cstring>channel6</cstring> |
139 | </property> | 143 | </property> |
140 | <property stdset="1"> | 144 | <property stdset="1"> |
141 | <name>text</name> | 145 | <name>text</name> |
142 | <string>6</string> | 146 | <string>6</string> |
143 | </property> | 147 | </property> |
144 | </widget> | 148 | </widget> |
145 | <widget row="1" column="3" > | 149 | <widget row="1" column="3" > |
146 | <class>QCheckBox</class> | 150 | <class>QCheckBox</class> |
147 | <property stdset="1"> | 151 | <property stdset="1"> |
148 | <name>name</name> | 152 | <name>name</name> |
149 | <cstring>channel8</cstring> | 153 | <cstring>channel8</cstring> |
150 | </property> | 154 | </property> |
151 | <property stdset="1"> | 155 | <property stdset="1"> |
152 | <name>text</name> | 156 | <name>text</name> |
153 | <string>8</string> | 157 | <string>8</string> |
154 | </property> | 158 | </property> |
155 | </widget> | 159 | </widget> |
156 | <widget row="0" column="2" > | 160 | <widget row="0" column="2" > |
157 | <class>QCheckBox</class> | 161 | <class>QCheckBox</class> |
158 | <property stdset="1"> | 162 | <property stdset="1"> |
159 | <name>name</name> | 163 | <name>name</name> |
160 | <cstring>channel2</cstring> | 164 | <cstring>channel2</cstring> |
161 | </property> | 165 | </property> |
162 | <property stdset="1"> | 166 | <property stdset="1"> |
163 | <name>text</name> | 167 | <name>text</name> |
164 | <string>2</string> | 168 | <string>2</string> |
165 | </property> | 169 | </property> |
166 | </widget> | 170 | </widget> |
167 | <widget row="1" column="4" > | 171 | <widget row="1" column="4" > |
168 | <class>QCheckBox</class> | 172 | <class>QCheckBox</class> |
169 | <property stdset="1"> | 173 | <property stdset="1"> |
170 | <name>name</name> | 174 | <name>name</name> |
171 | <cstring>channel9</cstring> | 175 | <cstring>channel9</cstring> |
172 | </property> | 176 | </property> |
173 | <property stdset="1"> | 177 | <property stdset="1"> |
174 | <name>text</name> | 178 | <name>text</name> |
175 | <string>9</string> | 179 | <string>9</string> |
176 | </property> | 180 | </property> |
177 | </widget> | 181 | </widget> |
178 | <widget row="0" column="1" > | 182 | <widget row="0" column="1" > |
179 | <class>QCheckBox</class> | 183 | <class>QCheckBox</class> |
@@ -398,128 +402,132 @@ | |||
398 | <cstring>TextLabel1</cstring> | 402 | <cstring>TextLabel1</cstring> |
399 | </property> | 403 | </property> |
400 | <property stdset="1"> | 404 | <property stdset="1"> |
401 | <name>text</name> | 405 | <name>text</name> |
402 | <string>every</string> | 406 | <string>every</string> |
403 | </property> | 407 | </property> |
404 | </widget> | 408 | </widget> |
405 | <widget row="4" column="0" rowspan="1" colspan="2" > | 409 | <widget row="4" column="0" rowspan="1" colspan="2" > |
406 | <class>QCheckBox</class> | 410 | <class>QCheckBox</class> |
407 | <property stdset="1"> | 411 | <property stdset="1"> |
408 | <name>name</name> | 412 | <name>name</name> |
409 | <cstring>hopChannels</cstring> | 413 | <cstring>hopChannels</cstring> |
410 | </property> | 414 | </property> |
411 | <property stdset="1"> | 415 | <property stdset="1"> |
412 | <name>text</name> | 416 | <name>text</name> |
413 | <string>Hop Channels</string> | 417 | <string>Hop Channels</string> |
414 | </property> | 418 | </property> |
415 | <property stdset="1"> | 419 | <property stdset="1"> |
416 | <name>checked</name> | 420 | <name>checked</name> |
417 | <bool>true</bool> | 421 | <bool>true</bool> |
418 | </property> | 422 | </property> |
419 | </widget> | 423 | </widget> |
420 | <widget row="4" column="3" > | 424 | <widget row="4" column="3" > |
421 | <class>QSpinBox</class> | 425 | <class>QSpinBox</class> |
422 | <property stdset="1"> | 426 | <property stdset="1"> |
423 | <name>name</name> | 427 | <name>name</name> |
424 | <cstring>hopInterval</cstring> | 428 | <cstring>hopInterval</cstring> |
425 | </property> | 429 | </property> |
426 | <property stdset="1"> | 430 | <property stdset="1"> |
427 | <name>enabled</name> | 431 | <name>enabled</name> |
428 | <bool>true</bool> | 432 | <bool>true</bool> |
429 | </property> | 433 | </property> |
430 | <property stdset="1"> | 434 | <property stdset="1"> |
431 | <name>suffix</name> | 435 | <name>suffix</name> |
432 | <string> ms</string> | 436 | <string> ms</string> |
433 | </property> | 437 | </property> |
434 | <property stdset="1"> | 438 | <property stdset="1"> |
435 | <name>maxValue</name> | 439 | <name>maxValue</name> |
436 | <number>2000</number> | 440 | <number>2000</number> |
437 | </property> | 441 | </property> |
438 | <property stdset="1"> | 442 | <property stdset="1"> |
439 | <name>minValue</name> | 443 | <name>minValue</name> |
440 | <number>100</number> | 444 | <number>100</number> |
441 | </property> | 445 | </property> |
442 | <property stdset="1"> | 446 | <property stdset="1"> |
443 | <name>lineStep</name> | 447 | <name>lineStep</name> |
444 | <number>100</number> | 448 | <number>100</number> |
445 | </property> | 449 | </property> |
446 | <property stdset="1"> | 450 | <property stdset="1"> |
447 | <name>value</name> | 451 | <name>value</name> |
448 | <number>1000</number> | 452 | <number>1000</number> |
449 | </property> | 453 | </property> |
450 | <property> | 454 | <property> |
451 | <name>whatsThis</name> | 455 | <name>whatsThis</name> |
452 | <string>Choose the channel hop interval.</string> | 456 | <string>Choose the channel hop interval.</string> |
453 | </property> | 457 | </property> |
454 | </widget> | 458 | </widget> |
455 | <widget row="5" column="0" rowspan="1" colspan="4" > | 459 | <widget row="5" column="0" rowspan="1" colspan="4" > |
456 | <class>QCheckBox</class> | 460 | <class>QCheckBox</class> |
457 | <property stdset="1"> | 461 | <property stdset="1"> |
458 | <name>name</name> | 462 | <name>name</name> |
459 | <cstring>adaptiveHopping</cstring> | 463 | <cstring>adaptiveHopping</cstring> |
460 | </property> | 464 | </property> |
461 | <property stdset="1"> | 465 | <property stdset="1"> |
466 | <name>enabled</name> | ||
467 | <bool>false</bool> | ||
468 | </property> | ||
469 | <property stdset="1"> | ||
462 | <name>text</name> | 470 | <name>text</name> |
463 | <string>Use Adaptive(TM) Hop Scheme</string> | 471 | <string>Use Adaptive(TM) Hop Scheme</string> |
464 | </property> | 472 | </property> |
465 | </widget> | 473 | </widget> |
466 | </grid> | 474 | </grid> |
467 | </widget> | 475 | </widget> |
468 | <widget> | 476 | <widget> |
469 | <class>QWidget</class> | 477 | <class>QWidget</class> |
470 | <property stdset="1"> | 478 | <property stdset="1"> |
471 | <name>name</name> | 479 | <name>name</name> |
472 | <cstring>tab</cstring> | 480 | <cstring>tab</cstring> |
473 | </property> | 481 | </property> |
474 | <attribute> | 482 | <attribute> |
475 | <name>title</name> | 483 | <name>title</name> |
476 | <string>Capture</string> | 484 | <string>Capture</string> |
477 | </attribute> | 485 | </attribute> |
478 | <grid> | 486 | <grid> |
479 | <property stdset="1"> | 487 | <property stdset="1"> |
480 | <name>margin</name> | 488 | <name>margin</name> |
481 | <number>5</number> | 489 | <number>5</number> |
482 | </property> | 490 | </property> |
483 | <property stdset="1"> | 491 | <property stdset="1"> |
484 | <name>spacing</name> | 492 | <name>spacing</name> |
485 | <number>3</number> | 493 | <number>3</number> |
486 | </property> | 494 | </property> |
487 | <widget row="2" column="0" rowspan="1" colspan="3" > | 495 | <widget row="2" column="0" rowspan="1" colspan="3" > |
488 | <class>ProtocolListView</class> | 496 | <class>ProtocolListView</class> |
489 | <property stdset="1"> | 497 | <property stdset="1"> |
490 | <name>name</name> | 498 | <name>name</name> |
491 | <cstring>capturePackets</cstring> | 499 | <cstring>capturePackets</cstring> |
492 | </property> | 500 | </property> |
493 | <property stdset="1"> | 501 | <property stdset="1"> |
494 | <name>enabled</name> | 502 | <name>enabled</name> |
495 | <bool>false</bool> | 503 | <bool>false</bool> |
496 | </property> | 504 | </property> |
497 | <property stdset="1"> | 505 | <property stdset="1"> |
498 | <name>sizePolicy</name> | 506 | <name>sizePolicy</name> |
499 | <sizepolicy> | 507 | <sizepolicy> |
500 | <hsizetype>7</hsizetype> | 508 | <hsizetype>7</hsizetype> |
501 | <vsizetype>7</vsizetype> | 509 | <vsizetype>7</vsizetype> |
502 | </sizepolicy> | 510 | </sizepolicy> |
503 | </property> | 511 | </property> |
504 | </widget> | 512 | </widget> |
505 | <widget row="1" column="0" rowspan="1" colspan="3" > | 513 | <widget row="1" column="0" rowspan="1" colspan="3" > |
506 | <class>QLineEdit</class> | 514 | <class>QLineEdit</class> |
507 | <property stdset="1"> | 515 | <property stdset="1"> |
508 | <name>name</name> | 516 | <name>name</name> |
509 | <cstring>captureFileName</cstring> | 517 | <cstring>captureFileName</cstring> |
510 | </property> | 518 | </property> |
511 | <property stdset="1"> | 519 | <property stdset="1"> |
512 | <name>enabled</name> | 520 | <name>enabled</name> |
513 | <bool>false</bool> | 521 | <bool>false</bool> |
514 | </property> | 522 | </property> |
515 | <property stdset="1"> | 523 | <property stdset="1"> |
516 | <name>text</name> | 524 | <name>text</name> |
517 | <string>/tmp/capture</string> | 525 | <string>/tmp/capture</string> |
518 | </property> | 526 | </property> |
519 | </widget> | 527 | </widget> |
520 | <widget row="0" column="2" > | 528 | <widget row="0" column="2" > |
521 | <class>QToolButton</class> | 529 | <class>QToolButton</class> |
522 | <property stdset="1"> | 530 | <property stdset="1"> |
523 | <name>name</name> | 531 | <name>name</name> |
524 | <cstring>getCaptureFileName</cstring> | 532 | <cstring>getCaptureFileName</cstring> |
525 | </property> | 533 | </property> |
diff --git a/noncore/net/wellenreiter/gui/main.cpp b/noncore/net/wellenreiter/gui/main.cpp index 96ebb3f..55a5260 100644 --- a/noncore/net/wellenreiter/gui/main.cpp +++ b/noncore/net/wellenreiter/gui/main.cpp | |||
@@ -1,99 +1,114 @@ | |||
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 "mainwindow.h" | 16 | #include "mainwindow.h" |
17 | #ifdef QWS | 17 | #ifdef QWS |
18 | #include <opie2/oapplication.h> | 18 | #include <opie2/oapplication.h> |
19 | #else | 19 | #else |
20 | #include <qapplication.h> | 20 | #include <qapplication.h> |
21 | #endif | 21 | #endif |
22 | 22 | ||
23 | #include <qmessagebox.h> | 23 | #include <qmessagebox.h> |
24 | #include <qstringlist.h> | 24 | #include <qstringlist.h> |
25 | 25 | ||
26 | // ==> OProcess | 26 | // ==> OProcess |
27 | #include <qdir.h> | 27 | #include <qdir.h> |
28 | #include <qfileinfo.h> | 28 | #include <qfileinfo.h> |
29 | #include <qregexp.h> | 29 | #include <qregexp.h> |
30 | #include <qtextstream.h> | 30 | #include <qtextstream.h> |
31 | 31 | ||
32 | #include <errno.h> | 32 | #include <errno.h> |
33 | #include <signal.h> | 33 | #include <signal.h> |
34 | #include <string.h> | 34 | #include <string.h> |
35 | #include <unistd.h> | 35 | #include <unistd.h> |
36 | 36 | ||
37 | int main( int argc, char **argv ) | 37 | int main( int argc, char **argv ) |
38 | { | 38 | { |
39 | #ifdef QWS | 39 | #ifdef QWS |
40 | OApplication a( argc, argv, "Wellenreiter II" ); | 40 | OApplication a( argc, argv, "Wellenreiter II" ); |
41 | #else | 41 | #else |
42 | QApplication a( argc, argv ); | 42 | QApplication a( argc, argv ); |
43 | #endif | 43 | #endif |
44 | WellenreiterMainWindow* w = new WellenreiterMainWindow(); | 44 | WellenreiterMainWindow* w = new WellenreiterMainWindow(); |
45 | #ifdef QWS | 45 | #ifdef QWS |
46 | a.showMainWidget( w ); | 46 | a.showMainWidget( w ); |
47 | #else | 47 | #else |
48 | a.setMainWidget( w ); | 48 | a.setMainWidget( w ); |
49 | w->setCaption( "Wellenreiter II" ); | ||
49 | w->show(); | 50 | w->show(); |
50 | #endif | 51 | #endif |
51 | 52 | ||
52 | a.processEvents(); // show the window before doing the safety checks | 53 | a.processEvents(); // show the window before doing the safety checks |
53 | int result = -1; | 54 | int result = -1; |
54 | 55 | ||
55 | // root check | 56 | // root check |
56 | if ( getuid() ) | 57 | if ( getuid() ) |
57 | { | 58 | { |
58 | qWarning( QObject::tr( "Wellenreiter: trying to run as non-root!" ) ); | 59 | qWarning( QObject::tr( "Wellenreiter: trying to run as non-root!" ) ); |
59 | result = QMessageBox::warning( w, " - Wellenreiter II - (non-root)", QObject::tr( "You have started Wellenreiter II\n" | 60 | result = QMessageBox::warning( w, " - Wellenreiter II - (non-root)", QObject::tr( "You have started Wellenreiter II\n" |
60 | "as non-root. You will have\nonly limited functionality.\nProceed anyway?" ), | 61 | "as non-root. You will have\nonly limited functionality.\nProceed anyway?" ), |
61 | QMessageBox::Yes, QMessageBox::No ); | 62 | QMessageBox::Yes, QMessageBox::No ); |
62 | if ( result == QMessageBox::No ) return -1; | 63 | if ( result == QMessageBox::No ) return -1; |
63 | } | 64 | } |
64 | 65 | ||
65 | // dhcp check - NOT HERE! This really belongs as a static member to OProcess | 66 | // dhcp check - NOT HERE! This really belongs as a static member to OProcess |
66 | // and I want to call it like that: if ( OProcess::isRunning( QString& ) ) ... | 67 | // and I want to call it like that: if ( OProcess::isRunning( QString& ) ) ... |
67 | 68 | ||
69 | static int killed = false; | ||
70 | |||
68 | QString line; | 71 | QString line; |
69 | QDir d = QDir( "/proc" ); | 72 | QDir d = QDir( "/proc" ); |
70 | QStringList dirs = d.entryList( QDir::Dirs ); | 73 | QStringList dirs = d.entryList( QDir::Dirs ); |
71 | QStringList::Iterator it; | 74 | QStringList::Iterator it; |
72 | for ( it = dirs.begin(); it != dirs.end(); ++it ) | 75 | for ( it = dirs.begin(); it != dirs.end(); ++it ) |
73 | { | 76 | { |
74 | //qDebug( "next entry: %s", (const char*) *it ); | 77 | //qDebug( "next entry: %s", (const char*) *it ); |
75 | QFile file( "/proc/"+*it+"/cmdline" ); | 78 | QFile file( "/proc/"+*it+"/cmdline" ); |
76 | file.open( IO_ReadOnly ); | 79 | file.open( IO_ReadOnly ); |
77 | if ( !file.isOpen() ) continue; | 80 | if ( !file.isOpen() ) continue; |
78 | QTextStream t( &file ); | 81 | QTextStream t( &file ); |
79 | line = t.readLine(); | 82 | line = t.readLine(); |
80 | //qDebug( "cmdline = %s", (const char*) line ); | 83 | //qDebug( "cmdline = %s", (const char*) line ); |
81 | if ( line.contains( "dhcp" ) ) break; | 84 | if ( line.contains( "dhcp" ) ) break; |
82 | } | 85 | } |
83 | if ( line.contains( "dhcp" ) ) | 86 | if ( line.contains( "dhcp" ) ) |
84 | { | 87 | { |
85 | qWarning( "Wellenreiter: found dhcp process #%d", (*it).toInt() ); | 88 | qWarning( "Wellenreiter: found dhcp process #%d", (*it).toInt() ); |
86 | result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "You have a dhcp client running.\n" | 89 | result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "You have a dhcp client running.\n" |
87 | "This can severly limit scanning!\nShould I kill it for you?" ), | 90 | "This can severly limit scanning!\nShould I kill it for you?" ), |
88 | QMessageBox::Yes, QMessageBox::No ); | 91 | QMessageBox::Yes, QMessageBox::No ); |
89 | if ( result == QMessageBox::Yes ) | 92 | if ( result == QMessageBox::Yes ) |
90 | { | 93 | { |
91 | if ( -1 == ::kill( (*it).toInt(), SIGTERM ) ) | 94 | if ( -1 == ::kill( (*it).toInt(), SIGTERM ) ) |
92 | qWarning( "Wellenreiter: can't kill process (%s)", result, strerror( errno ) ); | 95 | qWarning( "Wellenreiter: can't kill process #%d (%s)", result, strerror( errno ) ); |
96 | else | ||
97 | killed = true; | ||
93 | } | 98 | } |
94 | } | 99 | } |
95 | 100 | ||
96 | a.exec(); | 101 | a.exec(); |
102 | |||
103 | if ( killed ) | ||
104 | { | ||
105 | result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "Restart your dhcp client?" ), QMessageBox::Yes, QMessageBox::No ); | ||
106 | if ( result == QMessageBox::Yes ) | ||
107 | { | ||
108 | system( QString().sprintf( "dhclient &; udhcpcd &; dhcpcd &" ) ); | ||
109 | } | ||
110 | } | ||
111 | |||
97 | delete w; | 112 | delete w; |
98 | return 0; | 113 | return 0; |
99 | } | 114 | } |
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index 7241f7a..3e36f5b 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp | |||
@@ -74,208 +74,211 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
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( tr( "&Session..." ), this, SLOT( fileSaveSession() ) ); | 105 | fileSave->insertItem( tr( "&Session..." ), this, SLOT( fileSaveSession() ) ); |
106 | fileSave->insertItem( tr( "&Text Log..." ), this, SLOT( fileSaveLog() ) ); | 106 | fileSave->insertItem( tr( "&Text Log..." ), this, SLOT( fileSaveLog() ) ); |
107 | fileSave->insertItem( tr( "&Hex Log..." ), this, SLOT( fileSaveHex() ) ); | 107 | fileSave->insertItem( tr( "&Hex Log..." ), this, SLOT( fileSaveHex() ) ); |
108 | 108 | ||
109 | QPopupMenu* fileLoad = new QPopupMenu( mb ); | 109 | QPopupMenu* fileLoad = new QPopupMenu( mb ); |
110 | fileLoad->insertItem( tr( "&Session..." ), this, SLOT( fileLoadSession() ) ); | 110 | fileLoad->insertItem( tr( "&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( tr( "&New" ), this, SLOT( fileNew() ) ); | 114 | file->insertItem( tr( "&New" ), this, SLOT( fileNew() ) ); |
115 | id = file->insertItem( tr( "&Load" ), fileLoad ); | 115 | id = file->insertItem( tr( "&Load" ), fileLoad ); |
116 | file->insertItem( tr( "&Save" ), fileSave ); | 116 | file->insertItem( tr( "&Save" ), fileSave ); |
117 | file->insertSeparator(); | 117 | file->insertSeparator(); |
118 | file->insertItem( tr( "&Exit" ), qApp, SLOT( quit() ) ); | 118 | file->insertItem( tr( "&Exit" ), qApp, SLOT( quit() ) ); |
119 | 119 | ||
120 | QPopupMenu* view = new QPopupMenu( mb ); | 120 | QPopupMenu* view = new QPopupMenu( mb ); |
121 | view->insertItem( tr( "&Configure..." ) ); | 121 | view->insertItem( tr( "&Configure..." ) ); |
122 | 122 | ||
123 | QPopupMenu* sniffer = new QPopupMenu( mb ); | 123 | QPopupMenu* sniffer = new QPopupMenu( mb ); |
124 | sniffer->insertItem( tr( "&Configure..." ), this, SLOT( showConfigure() ) ); | 124 | sniffer->insertItem( tr( "&Configure..." ), this, SLOT( showConfigure() ) ); |
125 | sniffer->insertSeparator(); | 125 | sniffer->insertSeparator(); |
126 | startID = sniffer->insertItem( tr( "&Start" ), mw, SLOT( startClicked() ) ); | 126 | startID = sniffer->insertItem( tr( "&Start" ), mw, SLOT( startClicked() ) ); |
127 | sniffer->setItemEnabled( startID, false ); | 127 | sniffer->setItemEnabled( startID, false ); |
128 | stopID = sniffer->insertItem( tr( "Sto&p" ), mw, SLOT( stopClicked() ) ); | 128 | stopID = sniffer->insertItem( tr( "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( tr( "&Add something" ), this, SLOT( demoAddStations() ) ); | 132 | demo->insertItem( tr( "&Add something" ), this, SLOT( demoAddStations() ) ); |
133 | 133 | ||
134 | id = mb->insertItem( tr( "&File" ), file ); | 134 | id = mb->insertItem( tr( "&File" ), file ); |
135 | //id = mb->insertItem( tr( "&View" ), view ); | 135 | //id = mb->insertItem( tr( "&View" ), view ); |
136 | //mb->setItemEnabled( id, false ); | 136 | //mb->setItemEnabled( id, false ); |
137 | id = mb->insertItem( tr( "&Sniffer" ), sniffer ); | 137 | id = mb->insertItem( tr( "&Sniffer" ), sniffer ); |
138 | //id = mb->insertItem( tr( "&Demo" ), demo ); | 138 | |
139 | //mb->setItemEnabled( id, true ); | 139 | id = mb->insertItem( tr( "&Demo" ), demo ); |
140 | mb->setItemEnabled( id, true ); | ||
140 | 141 | ||
141 | #ifdef QWS | 142 | #ifdef QWS |
142 | mb->insertItem( startButton ); | 143 | mb->insertItem( startButton ); |
143 | mb->insertItem( stopButton ); | 144 | mb->insertItem( stopButton ); |
144 | mb->insertItem( c ); | 145 | mb->insertItem( c ); |
145 | mb->insertItem( d ); | 146 | mb->insertItem( d ); |
146 | #else // Qt3 changed the insertion order. It's now totally random :( | 147 | #else // Qt3 changed the insertion order. It's now totally random :( |
147 | mb->insertItem( d ); | 148 | mb->insertItem( d ); |
148 | mb->insertItem( c ); | 149 | mb->insertItem( c ); |
149 | mb->insertItem( stopButton ); | 150 | mb->insertItem( stopButton ); |
150 | mb->insertItem( startButton ); | 151 | mb->insertItem( startButton ); |
151 | #endif | 152 | #endif |
152 | 153 | ||
153 | updateToolButtonState(); | 154 | updateToolButtonState(); |
154 | 155 | ||
155 | // setup status bar (for now only on X11) | 156 | // setup status bar (for now only on X11) |
156 | 157 | ||
157 | #ifndef QWS | 158 | #ifndef QWS |
158 | statusBar()->message( tr( "Ready." ) ); | 159 | statusBar()->message( tr( "Ready." ) ); |
159 | #endif | 160 | #endif |
160 | 161 | ||
161 | connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) ); | 162 | connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) ); |
162 | connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) ); | 163 | connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) ); |
163 | }; | 164 | }; |
164 | 165 | ||
165 | 166 | ||
166 | 167 | ||
167 | void WellenreiterMainWindow::showConfigure() | 168 | void WellenreiterMainWindow::showConfigure() |
168 | { | 169 | { |
169 | qDebug( "show configure..." ); | 170 | qDebug( "show configure..." ); |
170 | cw->setCaption( tr( "Configure" ) ); | 171 | cw->setCaption( tr( "Configure" ) ); |
171 | #ifdef QWS | 172 | #ifdef QWS |
172 | cw->showMaximized(); | 173 | cw->showMaximized(); |
173 | #endif | 174 | #endif |
174 | int result = cw->exec(); | 175 | int result = cw->exec(); |
175 | 176 | ||
176 | if ( result ) updateToolButtonState(); | 177 | if ( result ) updateToolButtonState(); |
177 | } | 178 | } |
178 | 179 | ||
179 | 180 | ||
180 | 181 | ||
181 | void WellenreiterMainWindow::updateToolButtonState() | 182 | void WellenreiterMainWindow::updateToolButtonState() |
182 | { | 183 | { |
183 | const QString& interface = cw->interfaceName->currentText(); | 184 | const QString& interface = cw->interfaceName->currentText(); |
184 | const int cardtype = cw->driverType(); | 185 | const int cardtype = cw->driverType(); |
185 | 186 | ||
186 | if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) | 187 | if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) |
187 | { | 188 | { |
188 | startButton->setEnabled( true ); | 189 | startButton->setEnabled( true ); |
189 | menuBar()->setItemEnabled( startID, true ); | 190 | menuBar()->setItemEnabled( startID, true ); |
190 | } | 191 | } |
191 | else | 192 | else |
192 | { | 193 | { |
193 | startButton->setEnabled( false ); | 194 | startButton->setEnabled( false ); |
194 | menuBar()->setItemEnabled( startID, false ); | 195 | menuBar()->setItemEnabled( startID, false ); |
195 | } | 196 | } |
196 | } | 197 | } |
197 | 198 | ||
198 | 199 | ||
199 | void WellenreiterMainWindow::changedSniffingState() | 200 | void WellenreiterMainWindow::changedSniffingState() |
200 | { | 201 | { |
201 | startButton->setEnabled( !mw->sniffing ); | 202 | startButton->setEnabled( !mw->sniffing ); |
202 | menuBar()->setItemEnabled( startID, !mw->sniffing ); | 203 | menuBar()->setItemEnabled( startID, !mw->sniffing ); |
203 | stopButton->setEnabled( mw->sniffing ); | 204 | stopButton->setEnabled( mw->sniffing ); |
204 | menuBar()->setItemEnabled( stopID, mw->sniffing ); | 205 | menuBar()->setItemEnabled( stopID, mw->sniffing ); |
205 | } | 206 | } |
206 | 207 | ||
207 | 208 | ||
208 | WellenreiterMainWindow::~WellenreiterMainWindow() | 209 | WellenreiterMainWindow::~WellenreiterMainWindow() |
209 | { | 210 | { |
210 | delete infoIconSet; | 211 | delete infoIconSet; |
211 | delete settingsIconSet; | 212 | delete settingsIconSet; |
212 | delete startIconSet; | 213 | delete startIconSet; |
213 | delete stopIconSet; | 214 | delete stopIconSet; |
214 | }; | 215 | }; |
215 | 216 | ||
216 | void WellenreiterMainWindow::demoAddStations() | 217 | void WellenreiterMainWindow::demoAddStations() |
217 | { | 218 | { |
219 | mw = 0; | ||
220 | |||
218 | mw->netView()->addNewItem( "managed", "Vanille", "00:00:20:EF:A6:43", true, 6, 80 ); | 221 | mw->netView()->addNewItem( "managed", "Vanille", "00:00:20:EF:A6:43", true, 6, 80 ); |
219 | mw->netView()->addNewItem( "managed", "Vanille", "00:30:6D:EF:A6:23", true, 11, 10 ); | 222 | mw->netView()->addNewItem( "managed", "Vanille", "00:30:6D:EF:A6:23", true, 11, 10 ); |
220 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:A0:F8:E7:16:22", false, 3, 10 ); | 223 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:A0:F8:E7:16:22", false, 3, 10 ); |
221 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:AA:01:E7:56:62", false, 3, 15 ); | 224 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:AA:01:E7:56:62", false, 3, 15 ); |
222 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:B0:8E:E7:56:E2", false, 3, 20 ); | 225 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:B0:8E:E7:56:E2", false, 3, 20 ); |
223 | } | 226 | } |
224 | 227 | ||
225 | 228 | ||
226 | QString WellenreiterMainWindow::getFileName( bool save ) | 229 | QString WellenreiterMainWindow::getFileName( bool save ) |
227 | { | 230 | { |
228 | QMap<QString, QStringList> map; | 231 | QMap<QString, QStringList> map; |
229 | map.insert( tr("All"), QStringList() ); | 232 | map.insert( tr("All"), QStringList() ); |
230 | QStringList text; | 233 | QStringList text; |
231 | text << "text/*"; | 234 | text << "text/*"; |
232 | map.insert( tr("Text"), text ); | 235 | map.insert( tr("Text"), text ); |
233 | text << "*"; | 236 | text << "*"; |
234 | map.insert( tr("All"), text ); | 237 | map.insert( tr("All"), text ); |
235 | 238 | ||
236 | QString str; | 239 | QString str; |
237 | if ( save ) | 240 | if ( save ) |
238 | { | 241 | { |
239 | #ifdef QWS | 242 | #ifdef QWS |
240 | str = OFileDialog::getSaveFileName( 2, "/", QString::null, map ); | 243 | str = OFileDialog::getSaveFileName( 2, "/", QString::null, map ); |
241 | #else | 244 | #else |
242 | str = QFileDialog::getSaveFileName(); | 245 | str = QFileDialog::getSaveFileName(); |
243 | #endif | 246 | #endif |
244 | if ( str.isEmpty() /*|| QFileInfo(str).isDir()*/ ) | 247 | if ( str.isEmpty() /*|| QFileInfo(str).isDir()*/ ) |
245 | return ""; | 248 | return ""; |
246 | } | 249 | } |
247 | else | 250 | else |
248 | { | 251 | { |
249 | #ifdef QWS | 252 | #ifdef QWS |
250 | str = OFileDialog::getOpenFileName( 2, "/", QString::null, map ); | 253 | str = OFileDialog::getOpenFileName( 2, "/", QString::null, map ); |
251 | #else | 254 | #else |
252 | str = QFileDialog::getOpenFileName(); | 255 | str = QFileDialog::getOpenFileName(); |
253 | #endif | 256 | #endif |
254 | if ( str.isEmpty() || !QFile(str).exists() || QFileInfo(str).isDir() ) | 257 | if ( str.isEmpty() || !QFile(str).exists() || QFileInfo(str).isDir() ) |
255 | return ""; | 258 | return ""; |
256 | } | 259 | } |
257 | return str; | 260 | return str; |
258 | } | 261 | } |
259 | 262 | ||
260 | 263 | ||
261 | void WellenreiterMainWindow::fileSaveLog() | 264 | void WellenreiterMainWindow::fileSaveLog() |
262 | { | 265 | { |
263 | QString fname = getFileName( true ); | 266 | QString fname = getFileName( true ); |
264 | if ( !fname.isEmpty() ) | 267 | if ( !fname.isEmpty() ) |
265 | { | 268 | { |
266 | QFile f( fname ); | 269 | QFile f( fname ); |
267 | if ( f.open(IO_WriteOnly) ) | 270 | if ( f.open(IO_WriteOnly) ) |
268 | { | 271 | { |
269 | QTextStream t( &f ); | 272 | QTextStream t( &f ); |
270 | t << mw->logWindow()->getLog(); | 273 | t << mw->logWindow()->getLog(); |
271 | f.close(); | 274 | f.close(); |
272 | qDebug( "Saved log to file '%s'", (const char*) fname ); | 275 | qDebug( "Saved log to file '%s'", (const char*) fname ); |
273 | } | 276 | } |
274 | else | 277 | else |
275 | { | 278 | { |
276 | qDebug( "Problem saving log to file '%s'", (const char*) fname ); | 279 | qDebug( "Problem saving log to file '%s'", (const char*) fname ); |
277 | } | 280 | } |
278 | } | 281 | } |
279 | } | 282 | } |
280 | 283 | ||
281 | void WellenreiterMainWindow::fileSaveSession() | 284 | void WellenreiterMainWindow::fileSaveSession() |
@@ -298,64 +301,66 @@ void WellenreiterMainWindow::fileSaveSession() | |||
298 | } | 301 | } |
299 | } | 302 | } |
300 | } | 303 | } |
301 | 304 | ||
302 | void WellenreiterMainWindow::fileSaveHex() | 305 | void WellenreiterMainWindow::fileSaveHex() |
303 | { | 306 | { |
304 | QString fname = getFileName( true ); | 307 | QString fname = getFileName( true ); |
305 | if ( !fname.isEmpty() ) | 308 | if ( !fname.isEmpty() ) |
306 | { | 309 | { |
307 | QFile f( fname ); | 310 | QFile f( fname ); |
308 | if ( f.open(IO_WriteOnly) ) | 311 | if ( f.open(IO_WriteOnly) ) |
309 | { | 312 | { |
310 | QTextStream t( &f ); | 313 | QTextStream t( &f ); |
311 | t << mw->hexWindow()->getLog(); | 314 | t << mw->hexWindow()->getLog(); |
312 | f.close(); | 315 | f.close(); |
313 | qDebug( "Saved hex log to file '%s'", (const char*) fname ); | 316 | qDebug( "Saved hex log to file '%s'", (const char*) fname ); |
314 | } | 317 | } |
315 | else | 318 | else |
316 | { | 319 | { |
317 | qDebug( "Problem saving hex log to file '%s'", (const char*) fname ); | 320 | qDebug( "Problem saving hex log to file '%s'", (const char*) fname ); |
318 | } | 321 | } |
319 | } | 322 | } |
320 | } | 323 | } |
321 | 324 | ||
322 | void WellenreiterMainWindow::fileLoadSession() | 325 | void WellenreiterMainWindow::fileLoadSession() |
323 | { | 326 | { |
324 | QString fname = getFileName( false ); | 327 | QString fname = getFileName( false ); |
325 | if ( !fname.isEmpty() ) | 328 | if ( !fname.isEmpty() ) |
326 | { | 329 | { |
327 | QFile f( fname ); | 330 | QFile f( fname ); |
328 | if ( f.open(IO_ReadOnly) ) | 331 | if ( f.open(IO_ReadOnly) ) |
329 | { | 332 | { |
330 | QDataStream t( &f ); | 333 | QDataStream t( &f ); |
331 | t >> *mw->netView(); | 334 | t >> *mw->netView(); |
332 | f.close(); | 335 | f.close(); |
333 | qDebug( "Loaded session from file '%s'", (const char*) fname ); | 336 | qDebug( "Loaded session from file '%s'", (const char*) fname ); |
334 | } | 337 | } |
335 | else | 338 | else |
336 | { | 339 | { |
337 | qDebug( "Problem loading session from file '%s'", (const char*) fname ); | 340 | qDebug( "Problem loading session from file '%s'", (const char*) fname ); |
338 | } | 341 | } |
339 | } | 342 | } |
340 | } | 343 | } |
341 | 344 | ||
342 | void WellenreiterMainWindow::fileNew() | 345 | void WellenreiterMainWindow::fileNew() |
343 | { | 346 | { |
344 | mw->netView()->clear(); | 347 | mw->netView()->clear(); |
345 | mw->logWindow()->clear(); | 348 | mw->logWindow()->clear(); |
346 | mw->hexWindow()->clear(); | 349 | mw->hexWindow()->clear(); |
347 | } | 350 | } |
348 | 351 | ||
349 | void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) | 352 | void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) |
350 | { | 353 | { |
351 | if ( mw->isDaemonRunning() ) | 354 | if ( mw->isDaemonRunning() ) |
352 | { | 355 | { |
353 | QMessageBox::warning( this, "Wellenreiter/Opie", | 356 | QMessageBox::warning( this, "Wellenreiter/Opie", |
354 | tr( "Sniffing in progress!\nPlease stop sniffing before closing." ) ); | 357 | tr( "Sniffing in progress!\nPlease stop sniffing before closing." ) ); |
355 | e->ignore(); | 358 | e->ignore(); |
356 | } | 359 | } |
357 | else | 360 | else |
358 | { | 361 | { |
359 | QMainWindow::closeEvent( e ); | 362 | QMainWindow::closeEvent( e ); |
360 | } | 363 | } |
361 | } | 364 | } |
365 | |||
366 | |||
diff --git a/noncore/net/wellenreiter/gui/protolistview.cpp b/noncore/net/wellenreiter/gui/protolistview.cpp index f4b45d0..daca095 100644 --- a/noncore/net/wellenreiter/gui/protolistview.cpp +++ b/noncore/net/wellenreiter/gui/protolistview.cpp | |||
@@ -23,102 +23,102 @@ | |||
23 | #include <qpalette.h> | 23 | #include <qpalette.h> |
24 | #include <qcolor.h> | 24 | #include <qcolor.h> |
25 | #include <qlabel.h> | 25 | #include <qlabel.h> |
26 | #include <qframe.h> | 26 | #include <qframe.h> |
27 | 27 | ||
28 | ProtocolListView::ProtocolListView( QWidget* parent, const char* name, WFlags f ) | 28 | ProtocolListView::ProtocolListView( QWidget* parent, const char* name, WFlags f ) |
29 | :QScrollView( parent, name, f ) | 29 | :QScrollView( parent, name, f ) |
30 | { | 30 | { |
31 | parse = ( QString( "parsePackets" ) == QString( name ) ); | 31 | parse = ( QString( "parsePackets" ) == QString( name ) ); |
32 | 32 | ||
33 | setMargins( 3, 3, 0, 0 ); | 33 | setMargins( 3, 3, 0, 0 ); |
34 | viewport()->setBackgroundColor( QCheckBox(0).palette().color( QPalette::Active, QColorGroup::Background ) ); | 34 | viewport()->setBackgroundColor( QCheckBox(0).palette().color( QPalette::Active, QColorGroup::Background ) ); |
35 | 35 | ||
36 | vbox = new QVBox( viewport() ); | 36 | vbox = new QVBox( viewport() ); |
37 | vbox->setSpacing( 1 ); | 37 | vbox->setSpacing( 1 ); |
38 | addChild( vbox ); | 38 | addChild( vbox ); |
39 | 39 | ||
40 | QHBox* hbox = new QHBox( vbox ); | 40 | QHBox* hbox = new QHBox( vbox ); |
41 | hbox->setSpacing( 40 ); | 41 | hbox->setSpacing( 40 ); |
42 | new QLabel( tr( "Protocol Family" ), hbox ); | 42 | new QLabel( tr( "Protocol Family" ), hbox ); |
43 | new QLabel( tr( "Perform Action" ), hbox ); | 43 | new QLabel( tr( "Perform Action" ), hbox ); |
44 | QFrame* frame = new QFrame( vbox ); | 44 | QFrame* frame = new QFrame( vbox ); |
45 | frame->setFrameStyle( QFrame::HLine + QFrame::Sunken ); | 45 | frame->setFrameStyle( QFrame::HLine + QFrame::Sunken ); |
46 | 46 | ||
47 | //TODO: hardcoded for now...a protocol database would be nice!? | 47 | //TODO: hardcoded for now...a protocol database would be nice!? |
48 | 48 | ||
49 | //addProtocol( "Ethernet" ); | 49 | //addProtocol( "Ethernet" ); |
50 | addProtocol( "Prism" ); | 50 | addProtocol( "Prism" ); |
51 | //addProtocol( "802.11" ); | 51 | //addProtocol( "802.11" ); |
52 | addProtocol( "802.11 Management" ); | 52 | addProtocol( "802.11 Management" ); |
53 | addProtocol( "802.11 SSID" ); | 53 | addProtocol( "802.11 SSID" ); |
54 | addProtocol( "802.11 Rates" ); | 54 | addProtocol( "802.11 Rates" ); |
55 | addProtocol( "802.11 CF" ); | 55 | addProtocol( "802.11 CF" ); |
56 | addProtocol( "802.11 FH" ); | 56 | addProtocol( "802.11 FH" ); |
57 | addProtocol( "802.11 DS" ); | 57 | addProtocol( "802.11 DS" ); |
58 | addProtocol( "802.11 Tim" ); | 58 | addProtocol( "802.11 Tim" ); |
59 | addProtocol( "802.11 IBSS" ); | 59 | addProtocol( "802.11 IBSS" ); |
60 | addProtocol( "802.11 Challenge" ); | 60 | addProtocol( "802.11 Challenge" ); |
61 | addProtocol( "802.11 Data" ); | 61 | addProtocol( "802.11 Data" ); |
62 | addProtocol( "802.11 LLC" ); | 62 | addProtocol( "802.11 LLC" ); |
63 | addProtocol( "802.11 Data" ); | 63 | addProtocol( "802.11 Data" ); |
64 | addProtocol( "IP" ); | 64 | addProtocol( "IP" ); |
65 | addProtocol( "ARP" ); | 65 | addProtocol( "ARP" ); |
66 | addProtocol( "UDP" ); | 66 | addProtocol( "UDP" ); |
67 | addProtocol( "TCP" ); | 67 | addProtocol( "TCP" ); |
68 | } | 68 | } |
69 | 69 | ||
70 | 70 | ||
71 | ProtocolListView::~ProtocolListView() | 71 | ProtocolListView::~ProtocolListView() |
72 | { | 72 | { |
73 | } | 73 | } |
74 | 74 | ||
75 | 75 | ||
76 | void ProtocolListView::addProtocol( const QString& name ) | 76 | void ProtocolListView::addProtocol( const QString& name ) |
77 | { | 77 | { |
78 | QHBox* hbox = new QHBox( vbox ); | 78 | QHBox* hbox = new QHBox( vbox ); |
79 | new QCheckBox( name, hbox, (const char*) name ); | 79 | new QCheckBox( name, hbox, (const char*) name ); |
80 | 80 | ||
81 | if ( parse ) | 81 | if ( parse ) |
82 | { | 82 | { |
83 | QComboBox* combo = new QComboBox( hbox, (const char*) name ); | 83 | QComboBox* combo = new QComboBox( hbox, (const char*) name ); |
84 | #ifdef QWS | 84 | #ifdef QWS |
85 | combo->setFixedWidth( 75 ); | 85 | combo->setFixedWidth( 75 ); |
86 | #endif | 86 | #endif |
87 | combo->insertItem( "Ignore" ); | 87 | combo->insertItem( "Pass" ); |
88 | combo->insertItem( "Discard!" ); | 88 | combo->insertItem( "Discard!" ); |
89 | combo->insertItem( "TouchSound" ); | 89 | combo->insertItem( "TouchSound" ); |
90 | combo->insertItem( "AlarmSound" ); | 90 | combo->insertItem( "AlarmSound" ); |
91 | combo->insertItem( "KeySound" ); | 91 | combo->insertItem( "KeySound" ); |
92 | combo->insertItem( "LedOn" ); | 92 | combo->insertItem( "LedOn" ); |
93 | combo->insertItem( "LedOff" ); | 93 | combo->insertItem( "LedOff" ); |
94 | combo->insertItem( "LogMessage" ); | 94 | combo->insertItem( "LogMessage" ); |
95 | combo->insertItem( "MessageBox" ); | 95 | combo->insertItem( "MessageBox" ); |
96 | } | 96 | } |
97 | else | 97 | else |
98 | { | 98 | { |
99 | QComboBox* combo = new QComboBox( hbox, (const char*) name ); | 99 | QComboBox* combo = new QComboBox( hbox, (const char*) name ); |
100 | #ifdef QWS | 100 | #ifdef QWS |
101 | combo->setFixedWidth( 75 ); | 101 | combo->setFixedWidth( 75 ); |
102 | #endif | 102 | #endif |
103 | combo->insertItem( "Pass" ); | 103 | combo->insertItem( "Pass" ); |
104 | combo->insertItem( "Discard!" ); | 104 | combo->insertItem( "Discard!" ); |
105 | } | 105 | } |
106 | } | 106 | } |
107 | 107 | ||
108 | 108 | ||
109 | bool ProtocolListView::isProtocolChecked( const QString& name ) | 109 | bool ProtocolListView::isProtocolChecked( const QString& name ) |
110 | { | 110 | { |
111 | QCheckBox* box = (QCheckBox*) child( (const char*) name ); | 111 | QCheckBox* box = (QCheckBox*) child( (const char*) name ); |
112 | return ( box && box->isOn() ); | 112 | return ( box && box->isOn() ); |
113 | } | 113 | } |
114 | 114 | ||
115 | 115 | ||
116 | QString ProtocolListView::protocolAction( const QString& name ) | 116 | QString ProtocolListView::protocolAction( const QString& name ) |
117 | { | 117 | { |
118 | QComboBox* combo = (QComboBox*) child( (const char*) name, "QComboBox" ); | 118 | QComboBox* combo = (QComboBox*) child( (const char*) name, "QComboBox" ); |
119 | if ( combo ) | 119 | if ( combo ) |
120 | return combo->currentText(); | 120 | return combo->currentText(); |
121 | else | 121 | else |
122 | return "<unknown>"; | 122 | return "<unknown>"; |
123 | } | 123 | } |
124 | 124 | ||
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 965f6b0..4257be1 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -342,191 +342,199 @@ void Wellenreiter::receivePacket( OPacket* p ) | |||
342 | } | 342 | } |
343 | 343 | ||
344 | handleNotification( p ); | 344 | handleNotification( p ); |
345 | 345 | ||
346 | } | 346 | } |
347 | 347 | ||
348 | 348 | ||
349 | void Wellenreiter::stopClicked() | 349 | void Wellenreiter::stopClicked() |
350 | { | 350 | { |
351 | if ( iface ) | 351 | if ( iface ) |
352 | { | 352 | { |
353 | disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); | 353 | disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); |
354 | disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | 354 | disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); |
355 | iface->setChannelHopping(); // stop hopping channels | 355 | iface->setChannelHopping(); // stop hopping channels |
356 | } | 356 | } |
357 | else | 357 | else |
358 | killTimers(); | 358 | killTimers(); |
359 | 359 | ||
360 | pcap->close(); | 360 | pcap->close(); |
361 | sniffing = false; | 361 | sniffing = false; |
362 | 362 | ||
363 | if ( iface ) | 363 | if ( iface ) |
364 | { | 364 | { |
365 | // switch off monitor mode | 365 | // switch off monitor mode |
366 | iface->setMonitorMode( false ); | 366 | iface->setMonitorMode( false ); |
367 | // switch off promisc flag | 367 | // switch off promisc flag |
368 | iface->setPromiscuousMode( false ); | 368 | iface->setPromiscuousMode( false ); |
369 | 369 | ||
370 | system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess | 370 | system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess |
371 | } | 371 | } |
372 | 372 | ||
373 | logwindow->log( "(i) Stopped Scanning." ); | 373 | logwindow->log( "(i) Stopped Scanning." ); |
374 | assert( parent() ); | 374 | assert( parent() ); |
375 | ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); | 375 | ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); |
376 | 376 | ||
377 | // message the user | 377 | // message the user |
378 | QMessageBox::information( this, "Wellenreiter II", | 378 | QMessageBox::information( this, "Wellenreiter II", |
379 | tr( "Your wireless card\nshould now be usable again." ) ); | 379 | tr( "Your wireless card\nshould now be usable again." ) ); |
380 | 380 | ||
381 | sniffing = false; | 381 | sniffing = false; |
382 | emit( stoppedSniffing() ); | 382 | emit( stoppedSniffing() ); |
383 | 383 | ||
384 | // print out statistics | 384 | // print out statistics |
385 | for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) | 385 | for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) |
386 | statwindow->updateCounter( it.key(), it.data() ); | 386 | statwindow->updateCounter( it.key(), it.data() ); |
387 | } | 387 | } |
388 | 388 | ||
389 | 389 | ||
390 | void Wellenreiter::startClicked() | 390 | void Wellenreiter::startClicked() |
391 | { | 391 | { |
392 | // get configuration from config window | 392 | // get configuration from config window |
393 | 393 | ||
394 | const QString& interface = configwindow->interfaceName->currentText(); | 394 | const QString& interface = configwindow->interfaceName->currentText(); |
395 | const int cardtype = configwindow->driverType(); | 395 | const int cardtype = configwindow->driverType(); |
396 | const int interval = configwindow->hoppingInterval(); | 396 | const int interval = configwindow->hoppingInterval(); |
397 | 397 | ||
398 | if ( ( interface == "" ) || ( cardtype == 0 ) ) | 398 | if ( ( interface == "" ) || ( cardtype == 0 ) ) |
399 | { | 399 | { |
400 | QMessageBox::information( this, "Wellenreiter II", | 400 | QMessageBox::information( this, "Wellenreiter II", |
401 | tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); | 401 | tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); |
402 | return; | 402 | return; |
403 | } | 403 | } |
404 | 404 | ||
405 | // configure device | 405 | // configure device |
406 | |||
407 | ONetwork* net = ONetwork::instance(); | 406 | ONetwork* net = ONetwork::instance(); |
408 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); | 407 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); |
409 | 408 | ||
410 | // set monitor mode | 409 | // bring device UP |
410 | iface->setUp( true ); | ||
411 | if ( !iface->isUp() ) | ||
412 | { | ||
413 | QMessageBox::warning( this, "Wellenreiter II", | ||
414 | tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) ); | ||
415 | return; | ||
416 | } | ||
411 | 417 | ||
418 | // set monitor mode | ||
412 | bool usePrism = configwindow->usePrismHeader(); | 419 | bool usePrism = configwindow->usePrismHeader(); |
413 | 420 | ||
414 | switch ( cardtype ) | 421 | switch ( cardtype ) |
415 | { | 422 | { |
416 | case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; | 423 | case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; |
417 | case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; | 424 | case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; |
418 | case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; | 425 | case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; |
419 | case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; | 426 | case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; |
420 | case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; | 427 | case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; |
421 | case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; | 428 | case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; |
422 | default: assert( 0 ); // shouldn't reach this | 429 | default: assert( 0 ); // shouldn't reach this |
423 | } | 430 | } |
424 | 431 | ||
425 | // switch device into monitor mode | 432 | // switch device into monitor mode |
426 | if ( cardtype < DEVTYPE_FILE ) | 433 | if ( cardtype < DEVTYPE_FILE ) |
427 | { | 434 | { |
428 | if ( cardtype != DEVTYPE_MANUAL ) | 435 | if ( cardtype != DEVTYPE_MANUAL ) |
429 | iface->setMonitorMode( true ); | 436 | iface->setMonitorMode( true ); |
430 | if ( !iface->monitorMode() ) | 437 | if ( !iface->monitorMode() ) |
431 | { | 438 | { |
432 | QMessageBox::warning( this, "Wellenreiter II", | 439 | QMessageBox::warning( this, "Wellenreiter II", |
433 | tr( "Can't set device into monitor mode." ) ); | 440 | tr( "Can't set interface '%1' into monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) ); |
434 | return; | 441 | return; |
435 | } | 442 | } |
436 | } | 443 | } |
437 | 444 | ||
438 | // open pcap and start sniffing | 445 | // open pcap and start sniffing |
439 | if ( cardtype != DEVTYPE_FILE ) | 446 | if ( cardtype != DEVTYPE_FILE ) |
440 | { | 447 | { |
441 | pcap->open( interface ); | 448 | pcap->open( interface ); |
442 | 449 | ||
443 | if ( configwindow->writeCaptureFile->isOn() ) | 450 | if ( configwindow->writeCaptureFile->isOn() ) |
444 | { | 451 | { |
445 | QString dumpname( configwindow->captureFileName->text() ); | 452 | QString dumpname( configwindow->captureFileName->text() ); |
446 | dumpname.append( '-' ); | 453 | dumpname.append( '-' ); |
447 | dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); | 454 | dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); |
448 | dumpname.append( ".wellenreiter" ); | 455 | dumpname.append( ".wellenreiter" ); |
449 | pcap->openDumpFile( dumpname ); | 456 | pcap->openDumpFile( dumpname ); |
450 | } | 457 | } |
451 | else | 458 | else |
452 | { | 459 | { |
453 | pcap->open( interface ); | 460 | pcap->open( interface ); |
454 | } | 461 | } |
455 | } | 462 | } |
456 | else | 463 | else |
457 | { | 464 | { |
458 | pcap->open( QFile( interface ) ); | 465 | pcap->open( QFile( interface ) ); |
459 | } | 466 | } |
460 | 467 | ||
461 | if ( !pcap->isOpen() ) | 468 | if ( !pcap->isOpen() ) |
462 | { | 469 | { |
463 | QMessageBox::warning( this, "Wellenreiter II", | 470 | QMessageBox::warning( this, "Wellenreiter II", |
464 | tr( "Can't open packet capturer:\n" ) + QString(strerror( errno ) )); | 471 | tr( "Can't open packet capturer for '%1':\n" ).arg( iface->name() ) + QString(strerror( errno ) )); |
465 | return; | 472 | return; |
466 | } | 473 | } |
467 | 474 | ||
468 | // set capturer to non-blocking mode | 475 | // set capturer to non-blocking mode |
469 | pcap->setBlocking( false ); | 476 | pcap->setBlocking( false ); |
470 | 477 | ||
471 | // start channel hopper | 478 | // start channel hopper |
472 | if ( cardtype != DEVTYPE_FILE ) | 479 | if ( cardtype != DEVTYPE_FILE ) |
473 | iface->setChannelHopping( 1000 ); //use interval from config window | 480 | iface->setChannelHopping( 1000 ); //use interval from config window |
474 | 481 | ||
475 | if ( cardtype != DEVTYPE_FILE ) | 482 | if ( cardtype != DEVTYPE_FILE ) |
476 | { | 483 | { |
477 | // connect socket notifier and start channel hopper | 484 | // connect socket notifier and start channel hopper |
478 | connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); | 485 | connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); |
479 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | 486 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); |
480 | } | 487 | } |
481 | else | 488 | else |
482 | { | 489 | { |
483 | // start timer for reading packets | 490 | // start timer for reading packets |
484 | startTimer( 100 ); | 491 | startTimer( 100 ); |
485 | } | 492 | } |
486 | 493 | ||
487 | logwindow->log( "(i) Started Scanning." ); | 494 | logwindow->log( "(i) Started Scanning." ); |
488 | sniffing = true; | 495 | sniffing = true; |
489 | emit( startedSniffing() ); | 496 | emit( startedSniffing() ); |
490 | if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title | 497 | if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title |
491 | else | 498 | else |
492 | { | 499 | { |
493 | assert( parent() ); | 500 | assert( parent() ); |
494 | ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); | 501 | ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); |
495 | } | 502 | } |
496 | } | 503 | } |
497 | 504 | ||
498 | 505 | ||
499 | void Wellenreiter::timerEvent( QTimerEvent* ) | 506 | void Wellenreiter::timerEvent( QTimerEvent* ) |
500 | { | 507 | { |
501 | qDebug( "Wellenreiter::timerEvent()" ); | 508 | qDebug( "Wellenreiter::timerEvent()" ); |
502 | OPacket* p = pcap->next(); | 509 | OPacket* p = pcap->next(); |
503 | if ( !p ) // no more packets available | 510 | if ( !p ) // no more packets available |
504 | { | 511 | { |
505 | stopClicked(); | 512 | stopClicked(); |
506 | } | 513 | } |
507 | else | 514 | else |
508 | { | 515 | { |
509 | receivePacket( p ); | 516 | receivePacket( p ); |
510 | delete p; | 517 | delete p; |
511 | } | 518 | } |
512 | } | 519 | } |
513 | 520 | ||
514 | 521 | ||
515 | void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* p ) | 522 | void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* p ) |
516 | { | 523 | { |
517 | if ( action == "TouchSound" ) | 524 | if ( action == "TouchSound" ) |
518 | ODevice::inst()->touchSound(); | 525 | ODevice::inst()->touchSound(); |
519 | else if ( action == "AlarmSound" ) | 526 | else if ( action == "AlarmSound" ) |
520 | ODevice::inst()->alarmSound(); | 527 | ODevice::inst()->alarmSound(); |
521 | else if ( action == "KeySound" ) | 528 | else if ( action == "KeySound" ) |
522 | ODevice::inst()->keySound(); | 529 | ODevice::inst()->keySound(); |
523 | else if ( action == "LedOn" ) | 530 | else if ( action == "LedOn" ) |
524 | ODevice::inst()->setLedState( Led_Mail, Led_On ); | 531 | ODevice::inst()->setLedState( Led_Mail, Led_On ); |
525 | else if ( action == "LedOff" ) | 532 | else if ( action == "LedOff" ) |
526 | ODevice::inst()->setLedState( Led_Mail, Led_Off ); | 533 | ODevice::inst()->setLedState( Led_Mail, Led_Off ); |
527 | else if ( action == "LogMessage" ) | 534 | else if ( action == "LogMessage" ) |
528 | logwindow->log( QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); | 535 | logwindow->log( QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); |
529 | else if ( action == "MessageBox" ) | 536 | else if ( action == "MessageBox" ) |
530 | QMessageBox::information ( this, "Notification!", | 537 | QMessageBox::information ( this, "Notification!", |
531 | QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); | 538 | QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); |
532 | } | 539 | } |
540 | |||
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h index 37e692c..d776492 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.h +++ b/noncore/net/wellenreiter/gui/wellenreiter.h | |||
@@ -1,90 +1,91 @@ | |||
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> |
23 | using namespace Opie; | 23 | using namespace Opie; |
24 | #endif | 24 | #endif |
25 | 25 | ||
26 | class QTimerEvent; | 26 | class QTimerEvent; |
27 | class QPixmap; | 27 | class QPixmap; |
28 | class OPacket; | 28 | class OPacket; |
29 | class OWaveLanManagementPacket; | 29 | class OWaveLanManagementPacket; |
30 | class OWaveLanDataPacket; | 30 | class OWaveLanDataPacket; |
31 | class OPacketCapturer; | 31 | class OPacketCapturer; |
32 | class OWirelessNetworkInterface; | 32 | class OWirelessNetworkInterface; |
33 | class ManufacturerDB; | 33 | class ManufacturerDB; |
34 | class WellenreiterConfigWindow; | 34 | class WellenreiterConfigWindow; |
35 | class MLogWindow; | 35 | class MLogWindow; |
36 | class MHexWindow; | 36 | class MHexWindow; |
37 | 37 | ||
38 | class Wellenreiter : public WellenreiterBase { | 38 | class Wellenreiter : public WellenreiterBase { |
39 | Q_OBJECT | 39 | Q_OBJECT |
40 | 40 | ||
41 | public: | 41 | public: |
42 | Wellenreiter( QWidget* parent = 0 ); | 42 | Wellenreiter( QWidget* parent = 0 ); |
43 | ~Wellenreiter(); | 43 | ~Wellenreiter(); |
44 | 44 | ||
45 | void setConfigWindow( WellenreiterConfigWindow* cw ); | 45 | void setConfigWindow( WellenreiterConfigWindow* cw ); |
46 | MScanListView* netView() const { return netview; }; | 46 | MScanListView* netView() const { return netview; }; |
47 | MLogWindow* logWindow() const { return logwindow; }; | 47 | MLogWindow* logWindow() const { return logwindow; }; |
48 | MHexWindow* hexWindow() const { return hexwindow; }; | 48 | MHexWindow* hexWindow() const { return hexwindow; }; |
49 | bool isDaemonRunning() const { return sniffing; }; | 49 | bool isDaemonRunning() const { return sniffing; }; |
50 | 50 | ||
51 | public: | ||
51 | bool sniffing; | 52 | bool sniffing; |
52 | 53 | ||
53 | protected: | 54 | protected: |
54 | virtual void timerEvent( QTimerEvent* ); | 55 | virtual void timerEvent( QTimerEvent* ); |
55 | 56 | ||
56 | public slots: | 57 | public slots: |
57 | void channelHopped(int); | 58 | void channelHopped(int); |
58 | void receivePacket(OPacket*); | 59 | void receivePacket(OPacket*); |
59 | void startClicked(); | 60 | void startClicked(); |
60 | void stopClicked(); | 61 | void stopClicked(); |
61 | 62 | ||
62 | signals: | 63 | signals: |
63 | void startedSniffing(); | 64 | void startedSniffing(); |
64 | void stoppedSniffing(); | 65 | void stoppedSniffing(); |
65 | 66 | ||
66 | private: | 67 | private: |
67 | void handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ); | 68 | void handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ); |
68 | void handleData( OPacket* p, OWaveLanDataPacket* data ); | 69 | void handleData( OPacket* p, OWaveLanDataPacket* data ); |
69 | void handleNotification( OPacket* p ); | 70 | void handleNotification( OPacket* p ); |
70 | void doAction( const QString& action, const QString& protocol, OPacket* p ); | 71 | void doAction( const QString& action, const QString& protocol, OPacket* p ); |
71 | QObject* childIfToParse( OPacket* p, const QString& protocol ); | 72 | QObject* childIfToParse( OPacket* p, const QString& protocol ); |
72 | bool checkDumpPacket( OPacket* p ); | 73 | bool checkDumpPacket( OPacket* p ); |
73 | 74 | ||
74 | private: | 75 | private: |
75 | #ifdef QWS | 76 | #ifdef QWS |
76 | OSystem _system; // Opie Operating System identifier | 77 | OSystem _system; // Opie Operating System identifier |
77 | #endif | 78 | #endif |
78 | 79 | ||
79 | OWirelessNetworkInterface* iface; | 80 | OWirelessNetworkInterface* iface; |
80 | OPacketCapturer* pcap; | 81 | OPacketCapturer* pcap; |
81 | ManufacturerDB* manufacturerdb; | 82 | ManufacturerDB* manufacturerdb; |
82 | WellenreiterConfigWindow* configwindow; | 83 | WellenreiterConfigWindow* configwindow; |
83 | 84 | ||
84 | //void readConfig(); | 85 | //void readConfig(); |
85 | //void writeConfig(); | 86 | //void writeConfig(); |
86 | }; | 87 | }; |
87 | 88 | ||
88 | 89 | ||
89 | 90 | ||
90 | #endif | 91 | #endif |