From b06390cb17114692a9fd5233d77620b385252480 Mon Sep 17 00:00:00 2001 From: mickeyl Date: Tue, 24 Aug 2004 11:53:43 +0000 Subject: apply megapatch courtesy Holger 'Zecke' Freyther: - bump version to 1.0.3-cvs - fix compile warnings - fix PacketViewer not to scroll, when watching in "real time" - fix appending text to log view - update statistics when tab is getting activated --- (limited to 'noncore/net/wellenreiter') diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp index ae149e2..1670f93 100644 --- a/noncore/net/wellenreiter/gui/configwindow.cpp +++ b/noncore/net/wellenreiter/gui/configwindow.cpp @@ -16,6 +16,7 @@ /* LOCAL */ #include "configwindow.h" #include "mainwindow.h" +#include "protolistview.h" /* OPIE */ #include @@ -184,7 +185,10 @@ bool WellenreiterConfigWindow::isChannelChecked( int channel ) const case 12: return channel12->isOn(); case 13: return channel13->isOn(); case 14: return channel14->isOn(); + default: return false; } + + } @@ -217,19 +221,19 @@ void WellenreiterConfigWindow::synchronizeActionsAndScripts() } -void WellenreiterConfigWindow::changedNetworkAction(int t) +void WellenreiterConfigWindow::changedNetworkAction(int ) { synchronizeActionsAndScripts(); } -void WellenreiterConfigWindow::changedClientAction(int t) +void WellenreiterConfigWindow::changedClientAction(int ) { synchronizeActionsAndScripts(); } -void WellenreiterConfigWindow::changedStationAction(int t) +void WellenreiterConfigWindow::changedStationAction(int ) { synchronizeActionsAndScripts(); } @@ -280,7 +284,6 @@ const QString WellenreiterConfigWindow::gpsHost() const int WellenreiterConfigWindow::gpsPort() const { - bool ok; return useGPS() ? gpsdPort->value() : -1; } @@ -290,7 +293,7 @@ void WellenreiterConfigWindow::performAction( const QString& type, const QString& mac, bool wep, int channel, - int signal + int /* signal */ /* , const GpsLocation& loc */ ) { int action; @@ -317,7 +320,7 @@ void WellenreiterConfigWindow::performAction( const QString& type, return; } - odebug << "for event '" << (const char*) type << "' I'm going to perform action " << action << " (script='" << script << "')" << oendl; + odebug << "for event '" << type << "' I'm going to perform action " << action << " (script='" << script << "')" << oendl; switch( action ) { @@ -404,6 +407,7 @@ void WellenreiterConfigWindow::load() writeCaptureFile->setChecked( c->readBoolEntry( "writeCaptureFile", true ) ); captureFileName->setEnabled( writeCaptureFile->isChecked() ); getCaptureFileName->setEnabled( writeCaptureFile->isChecked() ); + parsePackets->setEnabled( writeCaptureFile->isChecked() ); captureFileName->setText( c->readEntry( "filename", "/tmp/capture" ) ); hexViewBufferUnlimited->setChecked( c->readBoolEntry( "hexViewBufferUnlimited", true ) ); hexViewBufferLimited->setChecked( !c->readBoolEntry( "hexViewBufferUnlimited", true ) ); diff --git a/noncore/net/wellenreiter/gui/graphwindow.cpp b/noncore/net/wellenreiter/gui/graphwindow.cpp index b4174d3..d53421c 100644 --- a/noncore/net/wellenreiter/gui/graphwindow.cpp +++ b/noncore/net/wellenreiter/gui/graphwindow.cpp @@ -19,6 +19,33 @@ #include #include +/* XPM */ +static char * background[] = { +"16 16 6 1", +" c None", +". c #52676E", +"+ c #3F545B", +"@ c #394E56", +"# c #2F454C", +"$ c #364B52", +".+++++++++++++++", +"@###############", +"+$$$$$$$$$$$$$$$", +"@###############", +"+$$$$$$$$$$$$$$$", +"@###############", +"+$$$$$$$$$$$$$$$", +"@###############", +"+$$$$$$$$$$$$$$$", +"@###############", +"+$$$$$$$$$$$$$$$", +"@###############", +"+$$$$$$$$$$$$$$$", +"@###############", +"+$$$$$$$$$$$$$$$", +"@###############"}; + + MFrequencySpectrum::MFrequencySpectrum( int channels, QWidget* parent, const char* name, WFlags f) :QWidget( parent, name,f ), _channels( channels ) { @@ -85,7 +112,7 @@ void MFrequencySpectrum::drawBar( QPainter* p, int x, int y, int width, int heig } -void MFrequencySpectrum::paintEvent( QPaintEvent* e ) +void MFrequencySpectrum::paintEvent( QPaintEvent* ) { QPixmap pm( size() ); QPainter p; @@ -118,7 +145,6 @@ void MFrequencySpectrum::mousePressEvent( QMouseEvent* e ) int xmargin = 5; int ymargin = 2; int y = size().height() - 2 * ymargin; - int x = 0; int width = ( size().width() - 2 * xmargin ) / _channels; QPoint pos = e->pos(); @@ -142,8 +168,6 @@ Legende::Legende( int channels, QWidget* parent, const char* name, WFlags f ) void Legende::drawContents( QPainter* p ) { int xmargin = 5; - int ymargin = 2; - int x = 0; int width = ( contentsRect().width() - 2 * xmargin ) / _channels; for ( int i = 0; i < _channels; ++i ) @@ -170,7 +194,7 @@ void MGraphWindow::testGraph() } -void MGraphWindow::timerEvent( QTimerEvent* e ) +void MGraphWindow::timerEvent( QTimerEvent* ) { for ( int i = 0; i < 14; i++ ) { diff --git a/noncore/net/wellenreiter/gui/graphwindow.h b/noncore/net/wellenreiter/gui/graphwindow.h index fafcab1..392d85b 100644 --- a/noncore/net/wellenreiter/gui/graphwindow.h +++ b/noncore/net/wellenreiter/gui/graphwindow.h @@ -90,32 +90,6 @@ class MGraphWindow : public QVBox }; -/* XPM */ -static char * background[] = { -"16 16 6 1", -" c None", -". c #52676E", -"+ c #3F545B", -"@ c #394E56", -"# c #2F454C", -"$ c #364B52", -".+++++++++++++++", -"@###############", -"+$$$$$$$$$$$$$$$", -"@###############", -"+$$$$$$$$$$$$$$$", -"@###############", -"+$$$$$$$$$$$$$$$", -"@###############", -"+$$$$$$$$$$$$$$$", -"@###############", -"+$$$$$$$$$$$$$$$", -"@###############", -"+$$$$$$$$$$$$$$$", -"@###############", -"+$$$$$$$$$$$$$$$", -"@###############"}; - #endif diff --git a/noncore/net/wellenreiter/gui/logwindow.cpp b/noncore/net/wellenreiter/gui/logwindow.cpp index 714a9a9..a83f700 100644 --- a/noncore/net/wellenreiter/gui/logwindow.cpp +++ b/noncore/net/wellenreiter/gui/logwindow.cpp @@ -30,6 +30,8 @@ MLogWindow::MLogWindow( QWidget * parent, const char * name, WFlags f ) { ledit = new QMultiLineEdit( this ); ledit->setReadOnly( true ); + ledit->setUndoEnabled( false ); + MLogWindow::_instance = this; } @@ -38,13 +40,9 @@ MLogWindow::MLogWindow( QWidget * parent, const char * name, WFlags f ) void MLogWindow::log( QString text ) { QTime time = QTime::currentTime(); - QString line; - line.sprintf( "[%s] %s\n", (const char*) time.toString(), (const char*) text ); - int col; - int row; - ledit->getCursorPosition( &col, &row ); - ledit->insertAt( line, col, row ); - odebug << line << oendl; + QString line = QString( "[%1] %2\n" ).arg(time.toString() ).arg( text ); + ledit->insertLine( line ); + odebug << line << oendl; } diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index ef7ffcf..3e18531 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp @@ -31,9 +31,6 @@ #include #include #endif -using namespace Opie::Core; -using namespace Opie::Net; -using namespace Opie::Ui; /* QT */ #include @@ -57,6 +54,10 @@ using namespace Opie::Ui; /* STD */ #include +using namespace Opie::Core; +using namespace Opie::Net; +using namespace Opie::Ui; + WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) :QMainWindow( parent, name, f ) { @@ -468,7 +469,7 @@ void WellenreiterMainWindow::uploadSession() return; } - int content_length = f.size(); +// int content_length = f.size(); ::memset( &raddr, 0, sizeof (struct sockaddr_in) ); ::memcpy( &raddr. sin_addr, rhost_info-> h_addr, rhost_info-> h_length ); diff --git a/noncore/net/wellenreiter/gui/packetview.cpp b/noncore/net/wellenreiter/gui/packetview.cpp index 69438fa..d71111f 100644 --- a/noncore/net/wellenreiter/gui/packetview.cpp +++ b/noncore/net/wellenreiter/gui/packetview.cpp @@ -71,6 +71,13 @@ PacketView::PacketView( QWidget * parent, const char * name, WFlags f ) void PacketView::add( const OPacket* p, int size ) { + /* + * don't scroll away when somebody views packages + * while scanning + */ + int value = _number->value(); + bool last = (value == static_cast( _packets.count() ) ); + odebug << "PacketView::add() size = " << size << oendl; if ( size == -1 ) // unlimited buffer { @@ -78,16 +85,20 @@ void PacketView::add( const OPacket* p, int size ) } else { // limited buffer, limit = size - while ( _packets.count() >= size ) + while ( _packets.count() >= static_cast( size ) ) { _packets.removeFirst(); + --value; } + + /* check if we lost our packet */ + last = ( value < 1 ); _packets.append( p ); } _number->setMinValue( 1 ); _number->setMaxValue( _packets.count() ); - _number->setValue( _packets.count() ); + _number->setValue( last ? _packets.count() : value ); } void PacketView::showPacket( int number ) @@ -139,6 +150,7 @@ void PacketView::_doHexPacket( const OPacket* p ) const QString PacketView::getLog() const { + return QString::null; } void PacketView::clear() diff --git a/noncore/net/wellenreiter/gui/protolistview.cpp b/noncore/net/wellenreiter/gui/protolistview.cpp index 635e174..1e3d195 100644 --- a/noncore/net/wellenreiter/gui/protolistview.cpp +++ b/noncore/net/wellenreiter/gui/protolistview.cpp @@ -72,11 +72,11 @@ ProtocolListView::~ProtocolListView() void ProtocolListView::addProtocol( const QString& name ) { QHBox* hbox = new QHBox( vbox ); - new QCheckBox( name, hbox, (const char*) name ); + new QCheckBox( name, hbox, name.local8Bit() ); if ( parse ) { - QComboBox* combo = new QComboBox( hbox, (const char*) name ); + QComboBox* combo = new QComboBox( hbox, name.local8Bit() ); #ifdef QWS combo->setFixedWidth( 75 ); #endif @@ -92,7 +92,7 @@ void ProtocolListView::addProtocol( const QString& name ) } else { - QComboBox* combo = new QComboBox( hbox, (const char*) name ); + QComboBox* combo = new QComboBox( hbox, name.local8Bit() ); #ifdef QWS combo->setFixedWidth( 75 ); #endif @@ -104,14 +104,14 @@ void ProtocolListView::addProtocol( const QString& name ) bool ProtocolListView::isProtocolChecked( const QString& name ) { - QCheckBox* box = (QCheckBox*) child( (const char*) name ); + QCheckBox* box = (QCheckBox*) child( name.local8Bit() ); return ( box && box->isOn() ); } QString ProtocolListView::protocolAction( const QString& name ) { - QComboBox* combo = (QComboBox*) child( (const char*) name, "QComboBox" ); + QComboBox* combo = (QComboBox*) child( name.local8Bit(), "QComboBox" ); if ( combo ) return combo->currentText(); else diff --git a/noncore/net/wellenreiter/gui/resource.cpp b/noncore/net/wellenreiter/gui/resource.cpp index cb17f51..13096f2 100644 --- a/noncore/net/wellenreiter/gui/resource.cpp +++ b/noncore/net/wellenreiter/gui/resource.cpp @@ -25,11 +25,11 @@ namespace Resource QPixmap loadPixmap( const QString& pix ) { QString filename; - filename.sprintf( "%s/%s.png", (const char*) PIXMAPPATH, (const char*) pix ); + filename.sprintf( "%s/%s.png", PIXMAPPATH, pix.local8Bit() ); QPixmap pixmap( filename ); if ( pixmap.isNull() ) { - odebug << "Wellenreiter::Resource: can't find pixmap " + filename << oendl; + odebug << "Wellenreiter::Resource: can't find pixmap " + filename << oendl; } return pixmap; }; @@ -37,11 +37,11 @@ QPixmap loadPixmap( const QString& pix ) QIconSet loadIconSet( const QString& pix ) { QString filename; - filename.sprintf( "%s/%s.png", (const char*) PIXMAPPATH, (const char*) pix ); + filename.sprintf( "%s/%s.png", PIXMAPPATH, pix.local8Bit() ); QPixmap pixmap( filename ); if ( pixmap.isNull() ) { - odebug << "Wellenreiter::Resource: can't find pixmap " + filename << oendl; + odebug << "Wellenreiter::Resource: can't find pixmap " + filename << oendl; } return QIconSet( pixmap ); }; diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index 9e907d8..fa1d724 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp @@ -25,9 +25,7 @@ #else #include "resource.h" #endif -using namespace Opie::Core; -using namespace Opie::Ui; -using namespace Opie::Net; + /* QT */ #include @@ -38,6 +36,10 @@ using namespace Opie::Net; /* STD */ #include +using namespace Opie::Core; +using namespace Opie::Ui; +using namespace Opie::Net; + const int col_type = 0; const int col_essid = 0; const int col_sig = 1; @@ -51,6 +53,8 @@ const int col_firstseen = 8; const int col_lastseen = 9; const int col_location = 10; +#define DEBUG + MScanListView::MScanListView( QWidget* parent, const char* name ) :OListView( parent, name ) { @@ -176,7 +180,7 @@ void MScanListView::addNewItem( const QString& type, } else { - s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid ); + s = QString( "(i) New network: ESSID '%1'" ).arg( essid ); MLogWindow::logwindow()->log( s ); network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0, probe ); } @@ -195,11 +199,11 @@ void MScanListView::addNewItem( const QString& type, if ( type == "managed" ) { - s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel ); + s = QString( "(i) New Access Point in '%1' [%2]" ).arg( essid ).arg( channel ); } else { - s.sprintf( "(i) New AdHoc station in '%s' [%d]", (const char*) essid, channel ); + s = QString( "(i) New AdHoc station in '%1' [%2]" ).arg( essid ).arg( channel ); } MLogWindow::logwindow()->log( s ); } @@ -234,11 +238,11 @@ void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& QString s; if ( type == "station" ) { - s.sprintf( "(i) New Station in '%s' [xx]", (const char*) network->text( col_essid ) ); + s = QString( "(i) New Station in '%1' [xx]" ).arg( network->text( col_essid ) ); } else { - s.sprintf( "(i) New Wireless Station in '%s' [xx]", (const char*) network->text( col_essid ) ); + s = QString( "(i) New Wireless Station in '%1' [xx]" ).arg( network->text( col_essid ) ); } MLogWindow::logwindow()->log( s ); } @@ -246,9 +250,9 @@ void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo ) { - odebug << "WDSTraffic: " << (const char*) viaFrom.toString() << " and " << viaTo.toString() << " seem to form a WDS" << oendl; + odebug << "WDSTraffic: " << viaFrom.toString() << " and " << viaTo.toString() << " seem to form a WDS" << oendl; QString s; - MScanListItem* network; +// MScanListItem* network; QListViewItemIterator it( this ); while ( it.current() && @@ -270,10 +274,10 @@ void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, } -void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) +void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& /*to*/, const OMacAddress& via ) { QString s; - MScanListItem* network; +// MScanListItem* network; QListViewItemIterator it( this ); while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; @@ -293,10 +297,10 @@ void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& to, } -void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) +void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& /*to*/, const OMacAddress& via ) { QString s; - MScanListItem* network; +// MScanListItem* network; QListViewItemIterator it( this ); while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; @@ -315,7 +319,7 @@ void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& t } -void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) +void MScanListView::IBSStraffic( const OMacAddress& /*from*/, const OMacAddress& /*to*/, const OMacAddress& /*via*/ ) { owarn << "D'oh! Not yet implemented..." << oendl; MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" ); @@ -324,7 +328,7 @@ void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to, void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) { - odebug << "identify " << (const char*) macaddr.toString() << " = " << ip << "" << oendl; + odebug << "identify " << macaddr.toString() << " = " << ip << "" << oendl; QListViewItemIterator it( this ); for ( ; it.current(); ++it ) @@ -336,14 +340,14 @@ void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) } } odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl; - MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!", - (const char*) macaddr.toString(), (const char*) ip ) ); + MLogWindow::logwindow()->log( QString( "WARNING: Unhandled identification %1 = %2!" ) + .arg( macaddr.toString() ).arg( ip ) ); } void MScanListView::addService( const QString& name, const OMacAddress& macaddr, const QString& ip ) { - odebug << "addService '" << (const char*) name << "', Server = " << (const char*) macaddr.toString() << " = " << ip << "" << oendl; + odebug << "addService '" << name << "', Server = " << macaddr.toString() << " = " << ip << "" << oendl; //TODO: Refactor that out, we need it all over the place. // Best to do it in a more comfortable abstraction in OListView @@ -384,8 +388,8 @@ void MScanListView::addService( const QString& name, const OMacAddress& macaddr, } } odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl; - MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!", - (const char*) macaddr.toString(), (const char*) ip ) ); + MLogWindow::logwindow()->log( QString("WARNING: Unhandled service addition %s = %s!") + .arg( macaddr.toString() ).arg( ip ) ); } @@ -395,12 +399,12 @@ void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, in MScanListItem* itm = static_cast( item ); - odebug << "contextMenuRequested on item '" << (const char*) itm->text(0) << "' (" - << (const char*) itm->type << ") in column: '" << col << "'" << oendl; + odebug << "contextMenuRequested on item '" << itm->text(0) << "' (" + << itm->type << ") in column: '" << col << "'" << oendl; if ( itm->type == "adhoc" || itm->type == "managed" ) { - QString entry = QString().sprintf( "&Join %s Net '%s'...", (const char*) itm->type, (const char*) itm->essid() ); + QString entry = QString( "&Join %1 Net '%2'..." ).arg( itm->type ).arg( itm->essid() ); QPopupMenu m( this ); m.insertItem( entry, 37773, 0 ); @@ -479,8 +483,7 @@ void MScanListItem::serializeFrom( QDataStream& s ) s >> wep; _wep = (wep == 'y'); - QString name; - name.sprintf( "wellenreiter/%s", (const char*) _type ); + QString name = QString( "wellenreiter/"+ _type ); setPixmap( col_type, Resource::loadPixmap( name ) ); if ( _wep ) setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! @@ -490,14 +493,14 @@ void MScanListItem::serializeFrom( QDataStream& s ) void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal, bool probed ) { #ifdef DEBUG - odebug << "decorating scanlist item " << (const char*) type << " / " - << (const char*) essid << " / " << (const char*) macaddr + odebug << "decorating scanlist item " << type << " / " + << essid << " / " << macaddr << "[" << channel << "]" << oendl; #endif // set icon for managed or adhoc mode QString name; - name.sprintf( "wellenreiter/%s", (const char*) type ); + name.sprintf( "wellenreiter/"+ type ); setPixmap( col_type, Resource::loadPixmap( name ) ); // special case for probed networks FIXME: This is ugly at present diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index e801ce7..df8e9c3 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -33,9 +33,6 @@ #include #include #include -using namespace Opie::Core; -using namespace Opie::Net; -using namespace Opie::Ui; /* QT */ #include @@ -60,6 +57,11 @@ using namespace Opie::Ui; #include #include + +using namespace Opie::Core; +using namespace Opie::Net; +using namespace Opie::Ui; + Wellenreiter* Wellenreiter::instance = 0; Wellenreiter::Wellenreiter( QWidget* parent ) @@ -74,8 +76,7 @@ Wellenreiter::Wellenreiter( QWidget* parent ) // #ifdef QWS - QString sys; - sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); + QString sys = QString( "(i) Running on '%1'.").arg( ODevice::inst()->systemString() ); _system = ODevice::inst()->system(); logwindow->log( sys ); #endif @@ -110,6 +111,7 @@ void Wellenreiter::initialTimer() void Wellenreiter::signalHandler( int sig ) { + Q_UNUSED( sig ) oerr << "Aye! Received SIGSEGV or SIGBUS! Trying to exit gracefully..." << oendl; if ( Wellenreiter::instance->sniffing ) { @@ -176,7 +178,7 @@ void Wellenreiter::handleNotification( OPacket* p ) if ( configwindow->parsePackets->isProtocolChecked( name ) ) { QString action = configwindow->parsePackets->protocolAction( name ); - odebug << "parsePacket-action for '" << (const char*) name << "' seems to be '" << action << "'" << oendl; + odebug << "parsePacket-action for '" << name << "' seems to be '" << action << "'" << oendl; doAction( action, name, p ); } else @@ -197,12 +199,12 @@ void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* } -void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* request ) +void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* /* request */ ) { OWaveLanManagementSSID* ssid = static_cast( p->child( "802.11 SSID" ) ); QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString(""); - OWaveLanManagementDS* ds = static_cast( p->child( "802.11 DS" ) ); - int channel = ds ? ds->channel() : -1; +// OWaveLanManagementDS* ds = static_cast( p->child( "802.11 DS" ) ); +// int channel = ds ? ds->channel() : -1; OWaveLanPacket* header = static_cast( p->child( "802.11" ) ); GpsLocation loc( -111, -111 ); @@ -220,12 +222,12 @@ void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManage } -void Wellenreiter::handleManagementFrameProbeResponse( OPacket* p, OWaveLanManagementPacket* response ) +void Wellenreiter::handleManagementFrameProbeResponse( OPacket* /* p */, OWaveLanManagementPacket* /* response */ ) { } -void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) +void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) { QString type; if ( beacon->canIBSS() ) @@ -287,7 +289,7 @@ void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* contro } -void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ) +void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* /* data */ , OMacAddress& from, OMacAddress& to ) { OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); if ( wlan->fromDS() && !wlan->toDS() ) @@ -317,7 +319,7 @@ void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAdd } -void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ) +void Wellenreiter::handleEthernetData( OPacket* /* p */, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ) { from = data->sourceAddress(); to = data->destinationAddress(); @@ -326,7 +328,7 @@ void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAd } -void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest ) +void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& /* source */, OMacAddress& /* dest */ ) { OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); if ( arp ) @@ -345,7 +347,7 @@ void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, } -void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, OMacAddress& dest ) +void Wellenreiter::handleIPData( OPacket* p, OIPPacket* /* ip */, OMacAddress& source, OMacAddress& /* dest */ ) { //TODO: Implement more IP based protocols @@ -355,13 +357,13 @@ void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, odebug << "Received DHCP '" << dhcp->type() << "' packet" << oendl; if ( dhcp->type() == "OFFER" ) { - odebug << "DHCP: '" << (const char*) source.toString() << "' ('" << dhcp->serverAddress().toString() << "') seems to be a DHCP server." << oendl; + odebug << "DHCP: '" << source.toString() << "' ('" << dhcp->serverAddress().toString() << "') seems to be a DHCP server." << oendl; netView()->identify( source, dhcp->serverAddress().toString() ); netView()->addService( "DHCP", source, dhcp->serverAddress().toString() ); } else if ( dhcp->type() == "ACK" ) { - odebug << "DHCP: '" << (const char*) dhcp->clientMacAddress().toString() << "' ('" << dhcp->yourAddress().toString() << "') accepted the offered DHCP address." << oendl; + odebug << "DHCP: '" << dhcp->clientMacAddress().toString() << "' ('" << dhcp->yourAddress().toString() << "') accepted the offered DHCP address." << oendl; netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() ); } } @@ -395,10 +397,10 @@ bool Wellenreiter::checkDumpPacket( OPacket* p ) if ( configwindow->capturePackets->isProtocolChecked( name ) ) { QString action = configwindow->capturePackets->protocolAction( name ); - odebug << "capturePackets-action for '" << (const char*) name << "' seems to be '" << action << "'" << oendl; + odebug << "capturePackets-action for '" << name << "' seems to be '" << action << "'" << oendl; if ( action == "Discard" ) { - logwindow->log( QString().sprintf( "(i) dump-discarding of '%s' packet requested.", (const char*) name ) ); + logwindow->log( QString("(i) dump-discarding of '%1' packet requested." ).arg( name ) ); return false; } } @@ -520,9 +522,7 @@ void Wellenreiter::stopClicked() #warning FIXME: setScreenSaverMode is not operational on the X11 build #endif - // print out statistics - for( QMap::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) - statwindow->updateCounter( it.key(), it.data() ); + updateStatistics(); } @@ -532,7 +532,7 @@ void Wellenreiter::startClicked() const QString& interface = configwindow->interfaceName->currentText(); const int cardtype = configwindow->driverType(); - const int interval = configwindow->hoppingInterval(); +// const int interval = configwindow->hoppingInterval(); if ( ( interface == "" ) || ( cardtype == 0 ) ) { @@ -704,7 +704,7 @@ void Wellenreiter::timerEvent( QTimerEvent* ) } -void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* p ) +void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* /* p */ ) { #ifdef QWS if ( action == "TouchSound" ) @@ -718,10 +718,10 @@ void Wellenreiter::doAction( const QString& action, const QString& protocol, OPa else if ( action == "LedOff" ) ODevice::inst()->setLedState( Led_Mail, Led_Off ); else if ( action == "LogMessage" ) - logwindow->log( QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); + logwindow->log( QString(tr("Got packet with protocol '%1'","Protocol Name" ) ).arg( protocol ) ); else if ( action == "MessageBox" ) QMessageBox::information( this, "Notification!", - QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); + QString(tr( "Got packet with protocol '%1'", "Protocol Name" ) ).arg( protocol ) ); #else #warning Actions do not work with Qt/X11 yet #endif @@ -742,9 +742,9 @@ void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int ch return; } - odebug << "joinNetwork() with Interface " << (const char*) iface->name() - << ": " << (const char*) type << ", " << (const char*) essid - << ", " << channel << ", " << (const char*) macaddr << oendl; + odebug << "joinNetwork() with Interface " << iface->name() + << ": " << type << ", " << essid + << ", " << channel << ", " << macaddr << oendl; QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); int count = 3; @@ -764,3 +764,15 @@ void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int ch } +void Wellenreiter::updateStatistics() +{ + // print out statistics + for( QMap::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) + statwindow->updateCounter( it.key(), it.data() ); +} + +void Wellenreiter::slotTabChanged( QWidget* wid ) +{ + if ( wid == statwindow ) + updateStatistics(); +} diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h index f582a5f..5ac389e 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.h +++ b/noncore/net/wellenreiter/gui/wellenreiter.h @@ -93,7 +93,12 @@ class Wellenreiter : public WellenreiterBase { bool checkDumpPacket( Opie::Net::OPacket* p ); void registerSignalHandler(); + private slots: + void slotTabChanged( QWidget* ); + private: + void updateStatistics(); + #ifdef QWS Opie::Core::OSystem _system; // Opie Operating System identifier #endif diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp index a29d520..0ca0bd7 100644 --- a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp @@ -158,6 +158,8 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f TabWidget->setCurrentTab( tr( "Nets" ) ); #endif + connect(TabWidget, SIGNAL(currentChanged(QWidget*)), + this, SLOT(slotTabChanged(QWidget*))); } /* diff --git a/noncore/net/wellenreiter/opie-wellenreiter.control b/noncore/net/wellenreiter/opie-wellenreiter.control index cbc287a..e7bc25d 100644 --- a/noncore/net/wellenreiter/opie-wellenreiter.control +++ b/noncore/net/wellenreiter/opie-wellenreiter.control @@ -4,7 +4,7 @@ Priority: optional Section: opie/applications Maintainer: Michael 'Mickey' Lauer Architecture: arm -Version: 1.0.3 +Version: 1.0.3-cvs Depends: libqpe1, libpcap0 (>=0.7.2), libopiecore2, libopienet2, libopieui2 Description: A WaveLAN Network Monitor A WaveLAN Network Monitor/Sniffer for the Opie Environment. diff --git a/noncore/net/wellenreiter/wellenreiter.pro b/noncore/net/wellenreiter/wellenreiter.pro index eb60c4a..53b762a 100644 --- a/noncore/net/wellenreiter/wellenreiter.pro +++ b/noncore/net/wellenreiter/wellenreiter.pro @@ -1,4 +1,5 @@ TEMPLATE = subdirs +VERSION = 1.0.3-cvs !contains( platform, x11 ) { message( Configuring Wellenreiter for build on Opie ) -- cgit v0.9.0.2