Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 40 |
1 files changed, 32 insertions, 8 deletions
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 | |||
@@ -34,6 +34,7 @@ using namespace Opie; | |||
34 | #include <qmessagebox.h> | 34 | #include <qmessagebox.h> |
35 | #include <qcombobox.h> | 35 | #include <qcombobox.h> |
36 | #include <qspinbox.h> | 36 | #include <qspinbox.h> |
37 | #include <qtoolbutton.h> | ||
37 | #include <qmainwindow.h> | 38 | #include <qmainwindow.h> |
38 | 39 | ||
39 | // Standard | 40 | // Standard |
@@ -52,7 +53,7 @@ using namespace Opie; | |||
52 | #include "logwindow.h" | 53 | #include "logwindow.h" |
53 | #include "hexwindow.h" | 54 | #include "hexwindow.h" |
54 | #include "configwindow.h" | 55 | #include "configwindow.h" |
55 | 56 | #include "statwindow.h" | |
56 | #include "manufacturers.h" | 57 | #include "manufacturers.h" |
57 | 58 | ||
58 | Wellenreiter::Wellenreiter( QWidget* parent ) | 59 | Wellenreiter::Wellenreiter( QWidget* parent ) |
@@ -217,9 +218,8 @@ void Wellenreiter::receivePacket(OPacket* p) | |||
217 | } | 218 | } |
218 | } | 219 | } |
219 | 220 | ||
220 | void Wellenreiter::startStopClicked() | 221 | |
221 | { | 222 | void Wellenreiter::stopClicked() |
222 | if ( sniffing ) | ||
223 | { | 223 | { |
224 | disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); | 224 | disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); |
225 | disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | 225 | disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); |
@@ -249,9 +249,32 @@ void Wellenreiter::startStopClicked() | |||
249 | 249 | ||
250 | // message the user | 250 | // message the user |
251 | QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." ); | 251 | QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." ); |
252 | |||
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 ) | ||
263 | { | ||
264 | QString left; | ||
265 | left.sprintf( "%s", (const char*) it.key() ); | ||
266 | left = left.leftJustify( 20 ); | ||
267 | left.append( '|' ); | ||
268 | QString right; | ||
269 | right.sprintf( "%d", it.data() ); | ||
270 | right = right.rightJustify( 7 ); | ||
271 | statwindow->log( left + right ); | ||
252 | } | 272 | } |
253 | 273 | ||
254 | else | 274 | } |
275 | |||
276 | |||
277 | void Wellenreiter::startClicked() | ||
255 | { | 278 | { |
256 | // get configuration from config window | 279 | // get configuration from config window |
257 | 280 | ||
@@ -278,9 +301,11 @@ void Wellenreiter::startStopClicked() | |||
278 | case 2: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break; | 301 | case 2: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break; |
279 | case 3: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break; | 302 | case 3: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break; |
280 | case 4: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break; | 303 | case 4: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break; |
281 | default: assert( 0 ); // shouldn't happen | 304 | default: |
305 | QMessageBox::information( this, "Wellenreiter II", "Bring your device into\nmonitor mode now." ); | ||
282 | } | 306 | } |
283 | 307 | ||
308 | if ( cardtype > 0 && cardtype < 5 ) | ||
284 | iface->setMonitorMode( true ); | 309 | iface->setMonitorMode( true ); |
285 | 310 | ||
286 | if ( !iface->monitorMode() ) | 311 | if ( !iface->monitorMode() ) |
@@ -310,6 +335,5 @@ void Wellenreiter::startStopClicked() | |||
310 | 335 | ||
311 | logwindow->log( "(i) Started Scanning." ); | 336 | logwindow->log( "(i) Started Scanning." ); |
312 | sniffing = true; | 337 | sniffing = true; |
313 | 338 | emit( startedSniffing() ); | |
314 | } | ||
315 | } | 339 | } |