Diffstat (limited to 'noncore/net/wellenreiter/gui') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/gui.pro | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 99 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.h | 12 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/statwindow.cpp | 45 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/statwindow.h | 40 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 178 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.h | 10 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiterbase.cpp | 21 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiterbase.h | 4 |
9 files changed, 278 insertions, 133 deletions
diff --git a/noncore/net/wellenreiter/gui/gui.pro b/noncore/net/wellenreiter/gui/gui.pro index 5970b01..08eb18a 100644 --- a/noncore/net/wellenreiter/gui/gui.pro +++ b/noncore/net/wellenreiter/gui/gui.pro | |||
@@ -12,2 +12,3 @@ HEADERS = wellenreiterbase.h \ | |||
12 | hexwindow.h \ | 12 | hexwindow.h \ |
13 | statwindow.h \ | ||
13 | configwindow.h \ | 14 | configwindow.h \ |
@@ -22,2 +23,3 @@ SOURCES = main.cpp \ | |||
22 | hexwindow.cpp \ | 23 | hexwindow.cpp \ |
24 | statwindow.cpp \ | ||
23 | configwindow.cpp \ | 25 | configwindow.cpp \ |
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index 69d2b3a..94e3f28 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp | |||
@@ -62,10 +62,4 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
62 | settingsIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SettingsIcon" ) ); | 62 | settingsIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SettingsIcon" ) ); |
63 | #ifdef QWS | 63 | startIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) ); |
64 | searchIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) ); | 64 | stopIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) ); |
65 | cancelIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) ); | ||
66 | #else | ||
67 | startStopIconSet = new QIconSet(); | ||
68 | startStopIconSet->setPixmap( Resource::loadPixmap( "wellenreiter/SearchIcon" ), QIconSet::Automatic, QIconSet::Normal, QIconSet::Off ); | ||
69 | startStopIconSet->setPixmap( Resource::loadPixmap( "wellenreiter/CancelIcon" ), QIconSet::Automatic, QIconSet::Normal, QIconSet::On ); | ||
70 | #endif | ||
71 | 65 | ||
@@ -73,15 +67,17 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
73 | 67 | ||
74 | startStopButton = new QToolButton( 0 ); | 68 | startButton = new QToolButton( 0 ); |
75 | #ifdef QWS | 69 | #ifdef QWS |
76 | startStopButton->setAutoRaise( true ); | 70 | startButton->setAutoRaise( true ); |
77 | #endif | 71 | #endif |
72 | startButton->setIconSet( *startIconSet ); | ||
73 | startButton->setEnabled( false ); | ||
74 | connect( startButton, SIGNAL( clicked() ), mw, SLOT( startClicked() ) ); | ||
75 | |||
76 | stopButton = new QToolButton( 0 ); | ||
78 | #ifdef QWS | 77 | #ifdef QWS |
79 | startStopButton->setOnIconSet( *cancelIconSet ); | 78 | stopButton->setAutoRaise( true ); |
80 | startStopButton->setOffIconSet( *searchIconSet ); | ||
81 | #else | ||
82 | startStopButton->setIconSet( *startStopIconSet ); | ||
83 | #endif | 79 | #endif |
84 | startStopButton->setToggleButton( true ); | 80 | stopButton->setIconSet( *stopIconSet ); |
85 | connect( startStopButton, SIGNAL( clicked() ), mw, SLOT( startStopClicked() ) ); | 81 | stopButton->setEnabled( false ); |
86 | startStopButton->setEnabled( false ); | 82 | connect( stopButton, SIGNAL( clicked() ), mw, SLOT( stopClicked() ) ); |
87 | 83 | ||
@@ -127,4 +123,8 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
127 | QPopupMenu* sniffer = new QPopupMenu( mb ); | 123 | QPopupMenu* sniffer = new QPopupMenu( mb ); |
128 | sniffer->insertItem( "&Configure..." ); | 124 | sniffer->insertItem( "&Configure...", this, SLOT( showConfigure() ) ); |
129 | sniffer->insertSeparator(); | 125 | sniffer->insertSeparator(); |
126 | startID = sniffer->insertItem( "&Start", mw, SLOT( startClicked() ) ); | ||
127 | sniffer->setItemEnabled( startID, false ); | ||
128 | stopID = sniffer->insertItem( "Sto&p", mw, SLOT( stopClicked() ) ); | ||
129 | sniffer->setItemEnabled( stopID, false ); | ||
130 | 130 | ||
@@ -137,3 +137,2 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
137 | id = mb->insertItem( "&Sniffer", sniffer ); | 137 | id = mb->insertItem( "&Sniffer", sniffer ); |
138 | mb->setItemEnabled( id, false ); | ||
139 | id = mb->insertItem( "&Demo", demo ); | 138 | id = mb->insertItem( "&Demo", demo ); |
@@ -142,3 +141,4 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
142 | #ifdef QWS | 141 | #ifdef QWS |
143 | mb->insertItem( startStopButton ); | 142 | mb->insertItem( startButton ); |
143 | mb->insertItem( stopButton ); | ||
144 | mb->insertItem( c ); | 144 | mb->insertItem( c ); |
@@ -148,5 +148,8 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
148 | mb->insertItem( c ); | 148 | mb->insertItem( c ); |
149 | mb->insertItem( startStopButton ); | 149 | mb->insertItem( stopButton ); |
150 | mb->insertItem( startButton ); | ||
150 | #endif | 151 | #endif |
151 | 152 | ||
153 | updateToolButtonState(); | ||
154 | |||
152 | // setup status bar (for now only on X11) | 155 | // setup status bar (for now only on X11) |
@@ -157,4 +160,8 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
157 | 160 | ||
161 | connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) ); | ||
162 | connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) ); | ||
158 | }; | 163 | }; |
159 | 164 | ||
165 | |||
166 | |||
160 | void WellenreiterMainWindow::showConfigure() | 167 | void WellenreiterMainWindow::showConfigure() |
@@ -168,16 +175,22 @@ void WellenreiterMainWindow::showConfigure() | |||
168 | 175 | ||
169 | if ( result ) | 176 | if ( result ) updateToolButtonState(); |
170 | { | 177 | } |
171 | // check configuration from config window | ||
172 | 178 | ||
173 | const QString& interface = cw->interfaceName->currentText(); | ||
174 | const int cardtype = cw->daemonDeviceType(); | ||
175 | const int interval = cw->daemonHopInterval(); | ||
176 | 179 | ||
177 | if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) | 180 | |
178 | startStopButton->setEnabled( true ); | 181 | void WellenreiterMainWindow::updateToolButtonState() |
179 | //TODO ... | 182 | { |
180 | else | 183 | const QString& interface = cw->interfaceName->currentText(); |
181 | startStopButton->setEnabled( false ); | 184 | const int cardtype = cw->daemonDeviceType(); |
182 | //TODO ... | 185 | const int interval = cw->daemonHopInterval(); |
186 | |||
187 | if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) | ||
188 | { | ||
189 | startButton->setEnabled( true ); | ||
190 | menuBar()->setItemEnabled( startID, true ); | ||
191 | } | ||
192 | else | ||
193 | { | ||
194 | startButton->setEnabled( false ); | ||
195 | menuBar()->setItemEnabled( startID, false ); | ||
183 | } | 196 | } |
@@ -185,14 +198,18 @@ void WellenreiterMainWindow::showConfigure() | |||
185 | 198 | ||
186 | WellenreiterMainWindow::~WellenreiterMainWindow() | 199 | |
200 | void WellenreiterMainWindow::changedSniffingState() | ||
187 | { | 201 | { |
202 | startButton->setEnabled( !mw->sniffing ); | ||
203 | menuBar()->setItemEnabled( startID, !mw->sniffing ); | ||
204 | stopButton->setEnabled( mw->sniffing ); | ||
205 | menuBar()->setItemEnabled( stopID, mw->sniffing ); | ||
206 | } | ||
188 | 207 | ||
208 | |||
209 | WellenreiterMainWindow::~WellenreiterMainWindow() | ||
210 | { | ||
189 | delete infoIconSet; | 211 | delete infoIconSet; |
190 | delete settingsIconSet; | 212 | delete settingsIconSet; |
191 | #ifdef QWS | 213 | delete startIconSet; |
192 | delete searchIconSet; | 214 | delete stopIconSet; |
193 | delete cancelIconSet; | ||
194 | #else | ||
195 | delete startStopIconSet; | ||
196 | #endif | ||
197 | |||
198 | }; | 215 | }; |
diff --git a/noncore/net/wellenreiter/gui/mainwindow.h b/noncore/net/wellenreiter/gui/mainwindow.h index 1b08c5b..1e191e5 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.h +++ b/noncore/net/wellenreiter/gui/mainwindow.h | |||
@@ -37,9 +37,11 @@ class WellenreiterMainWindow: public QMainWindow | |||
37 | 37 | ||
38 | QIconSet* startStopIconSet; | 38 | const QIconSet* startIconSet; |
39 | const QIconSet* searchIconSet; | 39 | const QIconSet* stopIconSet; |
40 | const QIconSet* infoIconSet; | 40 | const QIconSet* infoIconSet; |
41 | const QIconSet* settingsIconSet; | 41 | const QIconSet* settingsIconSet; |
42 | const QIconSet* cancelIconSet; | ||
43 | 42 | ||
44 | QToolButton* startStopButton; | 43 | QToolButton* startButton; |
44 | QToolButton* stopButton; | ||
45 | int startID; | ||
46 | int stopID; | ||
45 | 47 | ||
@@ -47,2 +49,3 @@ class WellenreiterMainWindow: public QMainWindow | |||
47 | virtual void closeEvent( QCloseEvent* ); | 49 | virtual void closeEvent( QCloseEvent* ); |
50 | void updateToolButtonState(); | ||
48 | 51 | ||
@@ -59,2 +62,3 @@ class WellenreiterMainWindow: public QMainWindow | |||
59 | void fileNew(); | 62 | void fileNew(); |
63 | void changedSniffingState(); | ||
60 | }; | 64 | }; |
diff --git a/noncore/net/wellenreiter/gui/statwindow.cpp b/noncore/net/wellenreiter/gui/statwindow.cpp new file mode 100644 index 0000000..07d34ef --- a/dev/null +++ b/noncore/net/wellenreiter/gui/statwindow.cpp | |||
@@ -0,0 +1,45 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Opie Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | **********************************************************************/ | ||
15 | |||
16 | #include "statwindow.h" | ||
17 | #include <qmultilineedit.h> | ||
18 | |||
19 | MStatWindow::MStatWindow( QWidget * parent, const char * name, WFlags f ) | ||
20 | :QVBox( parent, name, f ) | ||
21 | { | ||
22 | ledit = new QMultiLineEdit( this ); | ||
23 | ledit->setFont( QFont( "fixed", 10 ) ); | ||
24 | |||
25 | // FIXME: Set properties( font, read-only, etc...) | ||
26 | |||
27 | }; | ||
28 | |||
29 | void MStatWindow::log( QString text ) | ||
30 | { | ||
31 | |||
32 | ledit->append( text ); | ||
33 | |||
34 | }; | ||
35 | |||
36 | const QString MStatWindow::getLog() const | ||
37 | { | ||
38 | return ledit->text(); | ||
39 | } | ||
40 | |||
41 | void MStatWindow::clear() | ||
42 | { | ||
43 | ledit->clear(); | ||
44 | } | ||
45 | |||
diff --git a/noncore/net/wellenreiter/gui/statwindow.h b/noncore/net/wellenreiter/gui/statwindow.h new file mode 100644 index 0000000..bbdf777 --- a/dev/null +++ b/noncore/net/wellenreiter/gui/statwindow.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Opie Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | **********************************************************************/ | ||
15 | |||
16 | #ifndef STATWINDOW_H | ||
17 | #define STATWINDOW_H | ||
18 | |||
19 | #include <qvbox.h> | ||
20 | |||
21 | class QString; | ||
22 | class QMultiLineEdit; | ||
23 | |||
24 | class MStatWindow: public QVBox | ||
25 | { | ||
26 | |||
27 | public: | ||
28 | MStatWindow( QWidget * parent = 0, const char * name = "MStatWindow", WFlags f = 0 ); | ||
29 | |||
30 | void log( QString text ); | ||
31 | const QString getLog() const; | ||
32 | void clear(); | ||
33 | |||
34 | protected: | ||
35 | QMultiLineEdit* ledit; | ||
36 | |||
37 | }; | ||
38 | |||
39 | #endif | ||
40 | |||
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 0bfc8e9..3372883 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -36,2 +36,3 @@ using namespace Opie; | |||
36 | #include <qspinbox.h> | 36 | #include <qspinbox.h> |
37 | #include <qtoolbutton.h> | ||
37 | #include <qmainwindow.h> | 38 | #include <qmainwindow.h> |
@@ -54,3 +55,3 @@ using namespace Opie; | |||
54 | #include "configwindow.h" | 55 | #include "configwindow.h" |
55 | 56 | #include "statwindow.h" | |
56 | #include "manufacturers.h" | 57 | #include "manufacturers.h" |
@@ -219,97 +220,120 @@ void Wellenreiter::receivePacket(OPacket* p) | |||
219 | 220 | ||
220 | void Wellenreiter::startStopClicked() | 221 | |
222 | void Wellenreiter::stopClicked() | ||
221 | { | 223 | { |
222 | if ( sniffing ) | 224 | disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); |
225 | disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | ||
226 | iface->setChannelHopping(); // stop hopping channels | ||
227 | pcap->close(); | ||
228 | sniffing = false; | ||
229 | #ifdef QWS | ||
230 | oApp->setTitle(); | ||
231 | #else | ||
232 | qApp->mainWidget()->setCaption( "Wellenreiter II" ); | ||
233 | #endif | ||
234 | |||
235 | // get interface name from config window | ||
236 | const QString& interface = configwindow->interfaceName->currentText(); | ||
237 | ONetwork* net = ONetwork::instance(); | ||
238 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); | ||
239 | |||
240 | // switch off monitor mode | ||
241 | iface->setMonitorMode( false ); | ||
242 | // switch off promisc flag | ||
243 | iface->setPromiscuousMode( false ); | ||
244 | |||
245 | system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess | ||
246 | logwindow->log( "(i) Stopped Scanning." ); | ||
247 | assert( parent() ); | ||
248 | ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); | ||
249 | |||
250 | // message the user | ||
251 | QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." ); | ||
252 | |||
253 | sniffing = false; | ||
254 | emit( stoppedSniffing() ); | ||
255 | |||
256 | // print out statistics | ||
257 | statwindow->log( "-----------------------------------------" ); | ||
258 | statwindow->log( "- Wellenreiter II Capturing Statistic -" ); | ||
259 | statwindow->log( "-----------------------------------------" ); | ||
260 | statwindow->log( "Packet Type | Receive Count" ); | ||
261 | |||
262 | for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) | ||
223 | { | 263 | { |
224 | disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); | 264 | QString left; |
225 | disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | 265 | left.sprintf( "%s", (const char*) it.key() ); |
226 | iface->setChannelHopping(); // stop hopping channels | 266 | left = left.leftJustify( 20 ); |
227 | pcap->close(); | 267 | left.append( '|' ); |
228 | sniffing = false; | 268 | QString right; |
229 | #ifdef QWS | 269 | right.sprintf( "%d", it.data() ); |
230 | oApp->setTitle(); | 270 | right = right.rightJustify( 7 ); |
231 | #else | 271 | statwindow->log( left + right ); |
232 | qApp->mainWidget()->setCaption( "Wellenreiter II" ); | ||
233 | #endif | ||
234 | |||
235 | // get interface name from config window | ||
236 | const QString& interface = configwindow->interfaceName->currentText(); | ||
237 | ONetwork* net = ONetwork::instance(); | ||
238 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); | ||
239 | |||
240 | // switch off monitor mode | ||
241 | iface->setMonitorMode( false ); | ||
242 | // switch off promisc flag | ||
243 | iface->setPromiscuousMode( false ); | ||
244 | |||
245 | system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess | ||
246 | logwindow->log( "(i) Stopped Scanning." ); | ||
247 | assert( parent() ); | ||
248 | ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); | ||
249 | |||
250 | // message the user | ||
251 | QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." ); | ||
252 | } | 272 | } |
253 | 273 | ||
254 | else | 274 | } |
255 | { | ||
256 | // get configuration from config window | ||
257 | 275 | ||
258 | const QString& interface = configwindow->interfaceName->currentText(); | ||
259 | const int cardtype = configwindow->daemonDeviceType(); | ||
260 | const int interval = configwindow->daemonHopInterval(); | ||
261 | 276 | ||
262 | if ( ( interface == "" ) || ( cardtype == 0 ) ) | 277 | void Wellenreiter::startClicked() |
263 | { | 278 | { |
264 | QMessageBox::information( this, "Wellenreiter II", "Your device is not\nproperly configured. Please reconfigure!" ); | 279 | // get configuration from config window |
265 | return; | ||
266 | } | ||
267 | 280 | ||
268 | // configure device | 281 | const QString& interface = configwindow->interfaceName->currentText(); |
282 | const int cardtype = configwindow->daemonDeviceType(); | ||
283 | const int interval = configwindow->daemonHopInterval(); | ||
269 | 284 | ||
270 | ONetwork* net = ONetwork::instance(); | 285 | if ( ( interface == "" ) || ( cardtype == 0 ) ) |
271 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); | 286 | { |
287 | QMessageBox::information( this, "Wellenreiter II", "Your device is not\nproperly configured. Please reconfigure!" ); | ||
288 | return; | ||
289 | } | ||
272 | 290 | ||
273 | // set monitor mode | 291 | // configure device |
274 | 292 | ||
275 | switch ( cardtype ) | 293 | ONetwork* net = ONetwork::instance(); |
276 | { | 294 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); |
277 | case 1: iface->setMonitoring( new OCiscoMonitoringInterface( iface ) ); break; | ||
278 | case 2: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break; | ||
279 | case 3: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break; | ||
280 | case 4: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break; | ||
281 | default: assert( 0 ); // shouldn't happen | ||
282 | } | ||
283 | 295 | ||
284 | iface->setMonitorMode( true ); | 296 | // set monitor mode |
285 | 297 | ||
286 | if ( !iface->monitorMode() ) | 298 | switch ( cardtype ) |
287 | { | 299 | { |
288 | QMessageBox::warning( this, "Wellenreiter II", "Can't set device into monitor mode." ); | 300 | case 1: iface->setMonitoring( new OCiscoMonitoringInterface( iface ) ); break; |
289 | return; | 301 | case 2: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break; |
290 | } | 302 | case 3: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break; |
303 | case 4: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break; | ||
304 | default: | ||
305 | QMessageBox::information( this, "Wellenreiter II", "Bring your device into\nmonitor mode now." ); | ||
306 | } | ||
291 | 307 | ||
292 | // open pcap and start sniffing | 308 | if ( cardtype > 0 && cardtype < 5 ) |
293 | pcap->open( interface ); | 309 | iface->setMonitorMode( true ); |
294 | 310 | ||
295 | if ( !pcap->isOpen() ) | 311 | if ( !iface->monitorMode() ) |
296 | { | 312 | { |
297 | QMessageBox::warning( this, "Wellenreiter II", "Can't open packet capturer:\n" + QString(strerror( errno ) )); | 313 | QMessageBox::warning( this, "Wellenreiter II", "Can't set device into monitor mode." ); |
298 | return; | 314 | return; |
299 | } | 315 | } |
300 | 316 | ||
301 | // set capturer to non-blocking mode | 317 | // open pcap and start sniffing |
302 | pcap->setBlocking( false ); | 318 | pcap->open( interface ); |
303 | 319 | ||
304 | // start channel hopper | 320 | if ( !pcap->isOpen() ) |
305 | iface->setChannelHopping( 1000 ); //use interval from config window | 321 | { |
322 | QMessageBox::warning( this, "Wellenreiter II", "Can't open packet capturer:\n" + QString(strerror( errno ) )); | ||
323 | return; | ||
324 | } | ||
306 | 325 | ||
307 | // connect | 326 | // set capturer to non-blocking mode |
308 | connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); | 327 | pcap->setBlocking( false ); |
309 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | ||
310 | 328 | ||
311 | logwindow->log( "(i) Started Scanning." ); | 329 | // start channel hopper |
312 | sniffing = true; | 330 | iface->setChannelHopping( 1000 ); //use interval from config window |
313 | 331 | ||
314 | } | 332 | // connect |
333 | connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); | ||
334 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | ||
335 | |||
336 | logwindow->log( "(i) Started Scanning." ); | ||
337 | sniffing = true; | ||
338 | emit( startedSniffing() ); | ||
315 | } | 339 | } |
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h index 85f889b..839c77e 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.h +++ b/noncore/net/wellenreiter/gui/wellenreiter.h | |||
@@ -49,2 +49,4 @@ class Wellenreiter : public WellenreiterBase { | |||
49 | 49 | ||
50 | bool sniffing; | ||
51 | |||
50 | public slots: | 52 | public slots: |
@@ -52,3 +54,8 @@ class Wellenreiter : public WellenreiterBase { | |||
52 | void receivePacket(OPacket*); | 54 | void receivePacket(OPacket*); |
53 | void startStopClicked(); | 55 | void startClicked(); |
56 | void stopClicked(); | ||
57 | |||
58 | signals: | ||
59 | void startedSniffing(); | ||
60 | void stoppedSniffing(); | ||
54 | 61 | ||
@@ -59,3 +66,2 @@ class Wellenreiter : public WellenreiterBase { | |||
59 | 66 | ||
60 | bool sniffing; | ||
61 | OWirelessNetworkInterface* iface; | 67 | OWirelessNetworkInterface* iface; |
diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp index 3a703bc..245b9fc 100644 --- a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp | |||
@@ -32,2 +32,3 @@ | |||
32 | #include "scanlist.h" | 32 | #include "scanlist.h" |
33 | #include "statwindow.h" | ||
33 | 34 | ||
@@ -42,4 +43,4 @@ | |||
42 | 43 | ||
43 | /* | 44 | /* |
44 | * Constructs a WellenreiterBase which is a child of 'parent', with the | 45 | * Constructs a WellenreiterBase which is a child of 'parent', with the |
45 | * name 'name' and widget flags set to 'f' | 46 | * name 'name' and widget flags set to 'f' |
@@ -80,3 +81,2 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f | |||
80 | 81 | ||
81 | |||
82 | //--------- LOG TAB -------------- | 82 | //--------- LOG TAB -------------- |
@@ -85,3 +85,2 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f | |||
85 | 85 | ||
86 | |||
87 | //--------- HEX TAB -------------- | 86 | //--------- HEX TAB -------------- |
@@ -90,2 +89,6 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f | |||
90 | 89 | ||
90 | //--------- STAT TAB -------------- | ||
91 | |||
92 | statwindow = new MStatWindow( TabWidget, "Stat" ); | ||
93 | |||
91 | //--------- ABOUT TAB -------------- | 94 | //--------- ABOUT TAB -------------- |
@@ -127,5 +130,6 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f | |||
127 | #ifdef QWS | 130 | #ifdef QWS |
128 | TabWidget->addTab( ap, "wellenreiter/networks", tr( "Networks" ) ); | 131 | TabWidget->addTab( ap, "wellenreiter/networks", tr( "Nets" ) ); |
129 | TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) ); | 132 | TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) ); |
130 | TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) ); | 133 | TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) ); |
134 | TabWidget->addTab( statwindow, "wellenreiter/stat", tr( "Stats" ) ); | ||
131 | TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) ); | 135 | TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) ); |
@@ -135,2 +139,3 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f | |||
135 | TabWidget->addTab( hexwindow, /* "wellenreiter/hex", */ tr( "Hex" ) ); | 139 | TabWidget->addTab( hexwindow, /* "wellenreiter/hex", */ tr( "Hex" ) ); |
140 | TabWidget->addTab( statwindow, /* "wellenreiter/hex", */ tr( "Stat" ) ); | ||
136 | TabWidget->addTab( about, /* "wellenreiter/about", */ tr( "About" ) ); | 141 | TabWidget->addTab( about, /* "wellenreiter/about", */ tr( "About" ) ); |
@@ -138,5 +143,5 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f | |||
138 | WellenreiterBaseLayout->addWidget( TabWidget ); | 143 | WellenreiterBaseLayout->addWidget( TabWidget ); |
139 | 144 | ||
140 | #ifdef QWS | 145 | #ifdef QWS |
141 | TabWidget->setCurrentTab( tr( "Networks" ) ); | 146 | TabWidget->setCurrentTab( tr( "Nets" ) ); |
142 | #endif | 147 | #endif |
@@ -145,3 +150,3 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f | |||
145 | 150 | ||
146 | /* | 151 | /* |
147 | * Destroys the object and frees any allocated resources | 152 | * Destroys the object and frees any allocated resources |
diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.h b/noncore/net/wellenreiter/gui/wellenreiterbase.h index 1fa1ea3..ad2e96c 100644 --- a/noncore/net/wellenreiter/gui/wellenreiterbase.h +++ b/noncore/net/wellenreiter/gui/wellenreiterbase.h | |||
@@ -29,2 +29,3 @@ class MLogWindow; | |||
29 | class MHexWindow; | 29 | class MHexWindow; |
30 | class MStatWindow; | ||
30 | 31 | ||
@@ -53,2 +54,3 @@ public: | |||
53 | MHexWindow* hexwindow; | 54 | MHexWindow* hexwindow; |
55 | MStatWindow* statwindow; | ||
54 | QWidget* about; | 56 | QWidget* about; |
@@ -68,3 +70,3 @@ protected: | |||
68 | 70 | ||
69 | 71 | ||
70 | }; | 72 | }; |