author | mickeyl <mickeyl> | 2003-04-09 21:40:31 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-04-09 21:40:31 (UTC) |
commit | cf029a4007ea344c530d8a71cd0b012393ebd7ba (patch) (side-by-side diff) | |
tree | e9f584885299548b9316a6da05ad31845487e6d9 /noncore/net/wellenreiter/gui/wellenreiter.cpp | |
parent | b055856776807f0a459a86b1e1f62902d2d3a9c3 (diff) | |
download | opie-cf029a4007ea344c530d8a71cd0b012393ebd7ba.zip opie-cf029a4007ea344c530d8a71cd0b012393ebd7ba.tar.gz opie-cf029a4007ea344c530d8a71cd0b012393ebd7ba.tar.bz2 |
- improve keyboard handling
- enable sniffer-menu
- fix handling of start/stop button
- add simple statistic window, fancy will follow ;-)
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 @@ -31,12 +31,13 @@ using namespace Opie; // Qt #include <qpushbutton.h> #include <qmessagebox.h> #include <qcombobox.h> #include <qspinbox.h> +#include <qtoolbutton.h> #include <qmainwindow.h> // Standard #include <assert.h> #include <errno.h> @@ -49,13 +50,13 @@ using namespace Opie; #include "wellenreiter.h" #include "scanlist.h" #include "logwindow.h" #include "hexwindow.h" #include "configwindow.h" - +#include "statwindow.h" #include "manufacturers.h" Wellenreiter::Wellenreiter( QWidget* parent ) : WellenreiterBase( parent, 0, 0 ), sniffing( false ), iface( 0 ), manufacturerdb( 0 ), configwindow( 0 ) { @@ -214,15 +215,14 @@ void Wellenreiter::receivePacket(OPacket* p) wlan->macAddress3().toString() ); } return; } } -void Wellenreiter::startStopClicked() -{ - if ( sniffing ) + +void Wellenreiter::stopClicked() { disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); iface->setChannelHopping(); // stop hopping channels pcap->close(); sniffing = false; @@ -246,15 +246,38 @@ void Wellenreiter::startStopClicked() logwindow->log( "(i) Stopped Scanning." ); assert( parent() ); ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); // message the user QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." ); + + sniffing = false; + emit( stoppedSniffing() ); + + // print out statistics + statwindow->log( "-----------------------------------------" ); + statwindow->log( "- Wellenreiter II Capturing Statistic -" ); + statwindow->log( "-----------------------------------------" ); + statwindow->log( "Packet Type | Receive Count" ); + + for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) + { + QString left; + left.sprintf( "%s", (const char*) it.key() ); + left = left.leftJustify( 20 ); + left.append( '|' ); + QString right; + right.sprintf( "%d", it.data() ); + right = right.rightJustify( 7 ); + statwindow->log( left + right ); } - else +} + + +void Wellenreiter::startClicked() { // get configuration from config window const QString& interface = configwindow->interfaceName->currentText(); const int cardtype = configwindow->daemonDeviceType(); const int interval = configwindow->daemonHopInterval(); @@ -275,15 +298,17 @@ void Wellenreiter::startStopClicked() switch ( cardtype ) { case 1: iface->setMonitoring( new OCiscoMonitoringInterface( iface ) ); break; case 2: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break; case 3: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break; case 4: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break; - default: assert( 0 ); // shouldn't happen + default: + QMessageBox::information( this, "Wellenreiter II", "Bring your device into\nmonitor mode now." ); } + if ( cardtype > 0 && cardtype < 5 ) iface->setMonitorMode( true ); if ( !iface->monitorMode() ) { QMessageBox::warning( this, "Wellenreiter II", "Can't set device into monitor mode." ); return; @@ -307,9 +332,8 @@ void Wellenreiter::startStopClicked() // connect connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); logwindow->log( "(i) Started Scanning." ); sniffing = true; - - } + emit( startedSniffing() ); } |