Diffstat (limited to 'noncore/net/wellenreiter/gui') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.cpp | 30 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/gps.cpp | 12 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/logwindow.cpp | 8 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/main.cpp | 15 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 57 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/packetview.cpp | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/resource.cpp | 4 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 77 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 74 |
9 files changed, 140 insertions, 139 deletions
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp index da39113..bfdb20a 100644 --- a/noncore/net/wellenreiter/gui/configwindow.cpp +++ b/noncore/net/wellenreiter/gui/configwindow.cpp @@ -18,42 +18,38 @@ #include "mainwindow.h" /* OPIE */ #include <opie2/onetwork.h> #ifdef QWS #include <opie2/oapplication.h> #include <opie2/oconfig.h> #include <opie2/odevice.h> -using namespace Opie; +#include <opie2/odebug.h> +using namespace Opie::Core; +using namespace Opie::Net; #endif /* QT */ #include <qapplication.h> #include <qcheckbox.h> #include <qcombobox.h> #include <qfile.h> #include <qlineedit.h> #include <qlayout.h> #include <qmap.h> #include <qpushbutton.h> #include <qtabwidget.h> #include <qtoolbutton.h> #include <qspinbox.h> #include <qtextstream.h> -/* POSIX */ +/* STD */ #include <assert.h> -using namespace Opie::Core; -using namespace Opie::Net; -using namespace Opie::Core; -using namespace Opie::Net; -using namespace Opie::Core; -using namespace Opie::Net; WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) :WellenreiterConfigBase( parent, name, true, f ) { _devicetype[ "cisco" ] = DEVTYPE_CISCO; _devicetype[ "wlan-ng" ] = DEVTYPE_WLAN_NG; _devicetype[ "hostap" ] = DEVTYPE_HOSTAP; @@ -111,17 +107,17 @@ WellenreiterConfigWindow::~WellenreiterConfigWindow() void WellenreiterConfigWindow::performAutodetection() { //TODO: insert modal splash screen here // and sleep a second, so that it looks // like we're actually doing something fancy... ;-) - qDebug( "WellenreiterConfigWindow::performAutodetection()" ); + odebug << "WellenreiterConfigWindow::performAutodetection()" << oendl; // try to guess device type QFile m( "/proc/modules" ); if ( m.open( IO_ReadOnly ) ) { int devicetype(0); QString line; QTextStream modules( &m ); @@ -132,17 +128,17 @@ void WellenreiterConfigWindow::performAutodetection() else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP; else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG; else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO; } if ( devicetype ) { deviceType->setCurrentItem( devicetype ); _guess = devicetype; - qDebug( "Wellenreiter: guessed device type to be #%d", devicetype ); + odebug << "Wellenreiter: guessed device type to be #" << devicetype << "" << oendl; } } } int WellenreiterConfigWindow::driverType() const { QString name = deviceType->currentText(); @@ -236,17 +232,17 @@ void WellenreiterConfigWindow::changedStationAction(int t) { synchronizeActionsAndScripts(); } void WellenreiterConfigWindow::getCaptureFileNameClicked() { QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true); - qDebug( "name = %s", (const char*) name ); + odebug << "name = " << (const char*) name << "" << oendl; if ( !name.isEmpty() ) { captureFileName->setText( name ); } } void WellenreiterConfigWindow::channelAllClicked(int state) @@ -311,21 +307,21 @@ void WellenreiterConfigWindow::performAction( const QString& type, } else if ( type == "station" ) { action = newStationAction->currentItem(); script = newStationScript->text(); } else { - qWarning( "WellenreiterConfigWindow::performAction(): unknown type '%s'", (const char*) type ); + owarn << "WellenreiterConfigWindow::performAction(): unknown type '" << (const char*) type << "'" << oendl; return; } - qDebug( "for event '%s' I'm going to perform action %d (script='%s')", (const char*) type, action, (const char*) script ); + odebug << "for event '" << (const char*) type << "' I'm going to perform action " << action << " (script='" << (const char*) script << "')" << oendl; switch( action ) { case 0: /* Ignore */ return; case 1: /* Play Alarm */ ODevice::inst()->playAlarmSound(); return; case 2: /* Play Click */ ODevice::inst()->playTouchSound(); return; case 3: /* Blink LED */ break; //FIXME: Implement this case 4: /* Run Script */ @@ -340,33 +336,33 @@ void WellenreiterConfigWindow::performAction( const QString& type, * $CHAN = Channel * **/ script = script.replace( QRegExp( "$SSID" ), essid ); script = script.replace( QRegExp( "$MAC" ), mac ); script = script.replace( QRegExp( "$WEP" ), wep ? QString( "true" ) : QString( "false" ) ); script = script.replace( QRegExp( "$CHAN" ), QString::number( channel ) ); - qDebug( "going to call script '%s'", (const char*) script ); + odebug << "going to call script '" << (const char*) script << "'" << oendl; ::system( script ); - qDebug( "script returned." ); + odebug << "script returned." << oendl; return; } default: assert( false ); } } void WellenreiterConfigWindow::load() { #ifdef Q_WS_X11 #warning Persistent Configuration not yet implemented for standalone X11 build performAutodetection(); #else - qDebug( "loading configuration settings..." ); + odebug << "loading configuration settings..." << oendl; /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ OConfig* c = oApp->config(); c->setGroup( "Interface" ); QString interface = c->readEntry( "name", "<none>" ); @@ -434,17 +430,17 @@ void WellenreiterConfigWindow::load() } void WellenreiterConfigWindow::save() { #ifdef Q_WS_X11 #warning Persistent Configuration not yet implemented for standalone X11 build #else - qDebug( "saving configuration settings..." ); + odebug << "saving configuration settings..." << oendl; /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ OConfig* c = oApp->config(); c->setGroup( "Interface" ); c->writeEntry( "name", interfaceName->currentText() ); c->writeEntry( "type", deviceType->currentText() ); diff --git a/noncore/net/wellenreiter/gui/gps.cpp b/noncore/net/wellenreiter/gui/gps.cpp index a47b4ec..bd91e35 100644 --- a/noncore/net/wellenreiter/gui/gps.cpp +++ b/noncore/net/wellenreiter/gui/gps.cpp @@ -10,34 +10,38 @@ ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** **********************************************************************/ #include "gps.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + /* QT */ #include <qtextstream.h> /* STD */ #include <stdlib.h> #include <unistd.h> GPS::GPS( QObject* parent, const char * name ) :QObject( parent, name ) { - qDebug( "GPS::GPS()" ); + odebug << "GPS::GPS()" << oendl; _socket = new QSocket( this, "gpsd commsock" ); } GPS::~GPS() { - qDebug( "GPS::~GPS()" ); + odebug << "GPS::~GPS()" << oendl; } bool GPS::open( const QString& host, int port ) { _socket->connectToHost( host, port ); } @@ -48,25 +52,25 @@ GpsLocation GPS::position() const double lat = -111.0; double lon = -111.0; int result = _socket->writeBlock( "p\r\n", 3 ); _socket->flush(); if ( result ) { int numAvail = _socket->bytesAvailable(); - qDebug( "GPS write succeeded, %d bytes available for reading...", numAvail ); + odebug << "GPS write succeeded, " << numAvail << " bytes available for reading..." << oendl; if ( numAvail ) { int numRead = _socket->readBlock( &buf[0], sizeof buf ); int numScan = ::sscanf( &buf[0], "GPSD,P=%lg %lg", &lat, &lon); if ( numRead < 7 || numScan != 2 ) { - qDebug( "GPS read %d bytes succeeded, invalid response: '%s'", numRead, &buf[0] ); + odebug << "GPS read " << numRead << " bytes succeeded, invalid response: '" << &buf[0] << "'" << oendl; return GpsLocation( -111, -111 ); } else { return GpsLocation( lat, lon ); } } } diff --git a/noncore/net/wellenreiter/gui/logwindow.cpp b/noncore/net/wellenreiter/gui/logwindow.cpp index 1c72cf4..714a9a9 100644 --- a/noncore/net/wellenreiter/gui/logwindow.cpp +++ b/noncore/net/wellenreiter/gui/logwindow.cpp @@ -9,16 +9,22 @@ ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** **********************************************************************/ #include "logwindow.h" + +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ #include <qmultilineedit.h> #include <qdatetime.h> MLogWindow* MLogWindow::_instance; MLogWindow::MLogWindow( QWidget * parent, const char * name, WFlags f ) :QVBox( parent, name, f ) { @@ -33,17 +39,17 @@ 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 ); - qDebug( line ); + odebug << line << oendl; } void MLogWindow::clear() { ledit->clear(); } diff --git a/noncore/net/wellenreiter/gui/main.cpp b/noncore/net/wellenreiter/gui/main.cpp index 6bbc39b..62db967 100644 --- a/noncore/net/wellenreiter/gui/main.cpp +++ b/noncore/net/wellenreiter/gui/main.cpp @@ -9,34 +9,37 @@ ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** **********************************************************************/ #include "mainwindow.h" + #ifdef QWS +#include <opie2/odebug.h> #include <opie2/oapplication.h> #include <opie2/oprocess.h> #else #include <qapplication.h> #endif +/* QT */ #include <qmessagebox.h> #include <qstringlist.h> +/* STD */ #include <errno.h> #include <signal.h> #include <string.h> #include <unistd.h> using namespace Opie::Core; -using namespace Opie::Core; -using namespace Opie::Core; + int main( int argc, char **argv ) { #ifdef QWS OApplication a( argc, argv, "Wellenreiter II" ); #else QApplication a( argc, argv ); #endif WellenreiterMainWindow* w = new WellenreiterMainWindow(); @@ -50,48 +53,48 @@ int main( int argc, char **argv ) a.processEvents(); // show the window before doing the safety checks int result = -1; static int killed = false; bool check = true; for ( int i = 1; i < argc; ++i ) { - qDebug( "Wellenreiter::main() parsing argument %d = '%s'", i, argv[i] ); + odebug << "Wellenreiter::main() parsing argument " << i << " = '" << argv[i] << "'" << oendl; if ( !strcmp( "-nocheck", argv[i] ) ) { - qDebug( "-nocheck found" ); + odebug << "-nocheck found" << oendl; check = false; break; } } if ( check ) { // root check if ( getuid() ) { - qWarning( QObject::tr( "Wellenreiter: trying to run as non-root!" ) ); + owarn << QObject::tr( "Wellenreiter: trying to run as non-root!" ) << oendl; result = QMessageBox::warning( w, " - Wellenreiter II - (non-root)", QObject::tr( "You have started Wellenreiter II\n" "as non-root. You will have\nonly limited functionality.\nProceed anyway?" ), QMessageBox::Yes, QMessageBox::No ); if ( result == QMessageBox::No ) return -1; } int dhcpid = OProcess::processPID( "dhcpc" ); if ( dhcpid ) { result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "You have a dhcp client running.\n" "(PID = %1)\nThis can severly limit scanning!\nShould I kill it for you?" ).arg( dhcpid ), QMessageBox::Yes, QMessageBox::No ); if ( result == QMessageBox::Yes ) { if ( -1 == ::kill( dhcpid, SIGTERM ) ) - qWarning( "Wellenreiter: can't kill process #%d (%s)", result, strerror( errno ) ); + owarn << "Wellenreiter: can't kill process #" << result << " (" << strerror( errno ) << ")" << oendl; else killed = true; } } } a.exec(); diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index 7add6cd..a4b8839 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp @@ -16,16 +16,31 @@ #include "configwindow.h" #include "gps.h" #include "logwindow.h" #include "packetview.h" #include "mainwindow.h" #include "wellenreiter.h" #include "scanlist.h" +/* OPIE */ +#ifdef QWS +#include <qpe/resource.h> +#include <opie2/odebug.h> +#include <opie2/ofiledialog.h> +#else +#include "resource.h" +#include <qapplication.h> +#include <qfiledialog.h> +#endif +using namespace Opie::Core; +using namespace Opie::Net; +using namespace Opie::Ui; + +/* QT */ #include <qcombobox.h> #include <qdatastream.h> #include <qfile.h> #include <qfileinfo.h> #include <qlabel.h> #include <qlayout.h> #include <qlineedit.h> #include <qiconset.h> @@ -34,33 +49,19 @@ #include <qpopupmenu.h> #include <qpushbutton.h> #include <qstatusbar.h> #include <qspinbox.h> #include <qtextstream.h> #include <qtoolbutton.h> #include <qwhatsthis.h> -#ifdef QWS -#include <qpe/resource.h> -#include <opie2/ofiledialog.h> -using namespace Opie; -#else -#include "resource.h" -#include <qapplication.h> -#include <qfiledialog.h> -#endif - +/* STD */ #include <unistd.h> -using namespace Opie::Ui; -using namespace Opie::Net; -using namespace Opie::Ui; -using namespace Opie::Net; -using namespace Opie::Net; WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) :QMainWindow( parent, name, f ) { cw = new WellenreiterConfigWindow( this ); mw = new Wellenreiter( this ); mw->setConfigWindow( cw ); setCentralWidget( mw ); @@ -183,17 +184,17 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) ); connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) ); }; void WellenreiterMainWindow::showConfigure() { - qDebug( "show configure..." ); + odebug << "show configure..." << oendl; cw->setCaption( tr( "Configure" ) ); int result = QPEApplication::execDialog( cw ); if ( result ) updateToolButtonState(); } void WellenreiterMainWindow::updateToolButtonState() @@ -226,17 +227,17 @@ void WellenreiterMainWindow::changedSniffingState() menuBar()->setItemEnabled( uploadID, true ); uploadButton->setEnabled( true ); } } WellenreiterMainWindow::~WellenreiterMainWindow() { - qDebug( "Wellenreiter: bye." ); + odebug << "Wellenreiter: bye." << oendl; }; void WellenreiterMainWindow::demoAddStations() { //mw = 0; // test SIGSEGV handling mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80, GpsLocation( 39.8794, -94.0936) ); @@ -246,17 +247,17 @@ void WellenreiterMainWindow::demoAddStations() mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:05:8E:E7:56:E2"), false, 3, 20, GpsLocation( -10.0, -20.5 ) ); } void WellenreiterMainWindow::demoReadFromGps() { WellenreiterConfigWindow* configwindow = WellenreiterConfigWindow::instance(); GPS* gps = new GPS( this ); - qDebug( "Wellenreiter::demoReadFromGps(): url=gps://%s:%d/", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); + odebug << "Wellenreiter::demoReadFromGps(): url=gps://" << (const char*) configwindow->gpsdHost->currentText() << ":" << configwindow->gpsdPort->value() << "/" << oendl; gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); GpsLocation loc = gps->position(); QMessageBox::information( this, "Wellenreiter/Opie", tr( "GPS said:\n%1" ).arg( loc.dmsPosition() ) ); delete gps; } QString WellenreiterMainWindow::getFileName( bool save ) @@ -300,42 +301,42 @@ void WellenreiterMainWindow::fileSaveLog() if ( !fname.isEmpty() ) { QFile f( fname ); if ( f.open(IO_WriteOnly) ) { QTextStream t( &f ); t << mw->logWindow()->getLog(); f.close(); - qDebug( "Saved log to file '%s'", (const char*) fname ); + odebug << "Saved log to file '" << (const char*) fname << "'" << oendl; } else { - qDebug( "Problem saving log to file '%s'", (const char*) fname ); + odebug << "Problem saving log to file '" << (const char*) fname << "'" << oendl; } } } void WellenreiterMainWindow::fileSaveSession() { QString fname = getFileName( true ); if ( !fname.isEmpty() ) { QFile f( fname ); if ( f.open(IO_WriteOnly) ) { QDataStream t( &f ); t << *mw->netView(); f.close(); - qDebug( "Saved session to file '%s'", (const char*) fname ); + odebug << "Saved session to file '" << (const char*) fname << "'" << oendl; } else { - qDebug( "Problem saving session to file '%s'", (const char*) fname ); + odebug << "Problem saving session to file '" << (const char*) fname << "'" << oendl; } } } void WellenreiterMainWindow::fileSaveHex() { #warning DOES NOT WORK AT THE MOMENT /* @@ -343,42 +344,42 @@ void WellenreiterMainWindow::fileSaveHex() if ( !fname.isEmpty() ) { QFile f( fname ); if ( f.open(IO_WriteOnly) ) { QTextStream t( &f ); t << mw->hexWindow()->getLog(); f.close(); - qDebug( "Saved hex log to file '%s'", (const char*) fname ); + odebug << "Saved hex log to file '" << (const char*) fname << "'" << oendl; } else { - qDebug( "Problem saving hex log to file '%s'", (const char*) fname ); + odebug << "Problem saving hex log to file '" << (const char*) fname << "'" << oendl; } } */ } void WellenreiterMainWindow::fileLoadSession() { QString fname = getFileName( false ); if ( !fname.isEmpty() ) { QFile f( fname ); if ( f.open(IO_ReadOnly) ) { QDataStream t( &f ); t >> *mw->netView(); f.close(); - qDebug( "Loaded session from file '%s'", (const char*) fname ); + odebug << "Loaded session from file '" << (const char*) fname << "'" << oendl; } else { - qDebug( "Problem loading session from file '%s'", (const char*) fname ); + odebug << "Problem loading session from file '" << (const char*) fname << "'" << oendl; } } } void WellenreiterMainWindow::fileNew() { mw->netView()->clear(); @@ -433,21 +434,21 @@ void WellenreiterMainWindow::uploadSession() location->setText( "WL II Location" ); comments->setText( "No Comments." ); connect( accept, SIGNAL( clicked() ), d, SLOT( accept() ) ); connect( reject, SIGNAL( clicked() ), d, SLOT( reject() ) ); int result = d->exec(); if ( !result ) { - qDebug( "Session upload cancelled :(" ); + odebug << "Session upload cancelled :(" << oendl; return; } - qDebug( "Starting upload..." ); + odebug << "Starting upload..." << oendl; struct sockaddr_in raddr; struct hostent *rhost_info; int sock = -1; bool ok = false; rhost_info = (struct hostent *) ::gethostbyname( CAP_hostname ); if ( rhost_info ) diff --git a/noncore/net/wellenreiter/gui/packetview.cpp b/noncore/net/wellenreiter/gui/packetview.cpp index 3d3aa18..4df01da 100644 --- a/noncore/net/wellenreiter/gui/packetview.cpp +++ b/noncore/net/wellenreiter/gui/packetview.cpp @@ -79,17 +79,17 @@ void PacketView::showPacket( int number ) if ( p ) { _doSubPackets( const_cast<QObjectList*>( p->children() ), 0 ); _doHexPacket( p ); } else { - qDebug( "D'oh! No packet!" ); + odebug << "D'oh! No packet!" << oendl; } } void PacketView::_doSubPackets( QObjectList* l, int counter ) { if (!l) return; QObject* o = l->first(); while ( o ) diff --git a/noncore/net/wellenreiter/gui/resource.cpp b/noncore/net/wellenreiter/gui/resource.cpp index d98ef0b..cb17f51 100644 --- a/noncore/net/wellenreiter/gui/resource.cpp +++ b/noncore/net/wellenreiter/gui/resource.cpp @@ -24,26 +24,26 @@ namespace Resource QPixmap loadPixmap( const QString& pix ) { QString filename; filename.sprintf( "%s/%s.png", (const char*) PIXMAPPATH, (const char*) pix ); QPixmap pixmap( filename ); if ( pixmap.isNull() ) { - qDebug( "Wellenreiter::Resource: can't find pixmap " + filename ); + odebug << "Wellenreiter::Resource: can't find pixmap " + filename << oendl; } return pixmap; }; QIconSet loadIconSet( const QString& pix ) { QString filename; filename.sprintf( "%s/%s.png", (const char*) PIXMAPPATH, (const char*) pix ); QPixmap pixmap( filename ); if ( pixmap.isNull() ) { - qDebug( "Wellenreiter::Resource: can't find pixmap " + filename ); + 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 3b7120a..a2be782 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp @@ -12,51 +12,50 @@ ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** **********************************************************************/ #include "scanlist.h" #include "configwindow.h" #include "logwindow.h" -#include <assert.h> -#include <qcursor.h> -#include <qdatetime.h> -#include <qpopupmenu.h> -#include <qcheckbox.h> - +/* OPIE */ #ifdef QWS +#include <opie2/odebug.h> #include <qpe/qpeapplication.h> -#endif - -#ifdef QWS #include <qpe/resource.h> #else #include "resource.h" #endif +using namespace Opie::Core; +using namespace Opie::Ui; +using namespace Opie::Net; + +/* QT */ +#include <qcursor.h> +#include <qdatetime.h> +#include <qpopupmenu.h> +#include <qcheckbox.h> + +/* STD */ +#include <assert.h> const int col_type = 0; const int col_essid = 0; const int col_sig = 1; const int col_ap = 2; const int col_channel = 3; const int col_wep = 4; const int col_traffic = 5; const int col_ip = 6; const int col_manuf = 7; const int col_firstseen = 8; const int col_lastseen = 9; const int col_location = 10; -using namespace Opie::Net; -using namespace Opie::Ui; -using namespace Opie::Net; -using namespace Opie::Ui; -using namespace Opie::Ui; -using namespace Opie::Net; MScanListView::MScanListView( QWidget* parent, const char* name ) :OListView( parent, name ) { setFrameShape( QListView::StyledPanel ); setFrameShadow( QListView::Sunken ); addColumn( tr( "Net/Station" ) ); setColumnAlignment( col_essid, AlignLeft || AlignVCenter ); @@ -101,24 +100,24 @@ MScanListView::~MScanListView() OListViewItem* MScanListView::childFactory() { return new MScanListItem( this ); } void MScanListView::serializeTo( QDataStream& s) const { - qDebug( "serializing MScanListView" ); + odebug << "serializing MScanListView" << oendl; OListView::serializeTo( s ); } void MScanListView::serializeFrom( QDataStream& s) { - qDebug( "serializing MScanListView" ); + odebug << "serializing MScanListView" << oendl; OListView::serializeFrom( s ); } void MScanListView::addNewItem( const QString& type, const QString& essid, const OMacAddress& mac, bool wep, @@ -138,42 +137,42 @@ void MScanListView::addNewItem( const QString& type, QString s; MScanListItem* network; MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); while ( item && ( item->text( col_essid ) != essid ) ) { #ifdef DEBUG - qDebug( "itemtext: %s", (const char*) item->text( col_essid ) ); + odebug << "itemtext: " << (const char*) item->text( col_essid ) << "" << oendl; #endif item = static_cast<MScanListItem*> ( item->nextSibling() ); } if ( item ) { // we have already seen this net, check all childs if MAC exists network = item; item = static_cast<MScanListItem*> ( item->firstChild() ); assert( item ); // this shouldn't fail while ( item && ( item->text( col_ap ) != macaddr ) ) { #ifdef DEBUG - qDebug( "subitemtext: %s", (const char*) item->text( col_ap ) ); + odebug << "subitemtext: " << (const char*) item->text( col_ap ) << "" << oendl; #endif item = static_cast<MScanListItem*> ( item->nextSibling() ); } if ( item ) { // we have already seen this item, it's a dupe #ifdef DEBUG - qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); + odebug << "" << (const char*) macaddr << " is a dupe - ignoring..." << oendl; #endif item->receivedBeacon(); return; } } else { s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid ); @@ -181,17 +180,17 @@ void MScanListView::addNewItem( const QString& type, network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0, probe ); } // insert new station as child from network // no essid to reduce clutter, maybe later we have a nick or stationname to display!? #ifdef DEBUG - qDebug( "inserting new station %s", (const char*) macaddr ); + odebug << "inserting new station " << (const char*) macaddr << "" << oendl; #endif MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); station->setManufacturer( mac.manufacturer() ); station->setLocation( loc.dmsPosition() ); if ( type == "managed" ) { @@ -207,26 +206,26 @@ void MScanListView::addNewItem( const QString& type, void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type ) { MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) ) { #ifdef DEBUG - qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); + odebug << "subitemtext: " << (const char*) subitem->text( col_ap ) << "" << oendl; #endif subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); } if ( subitem ) { // we have already seen this item, it's a dupe #ifdef DEBUG - qDebug( "%s is a dupe - ignoring...", (const char*) addr.toString(true) ); + odebug << "" << (const char*) addr.toString(true) << " is a dupe - ignoring..." << oendl; #endif subitem->receivedBeacon(); //FIXME: sent data bit return; } // Hey, it seems to be a new item :-D MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr.toString(true), false, -1, -1 ); station->setManufacturer( addr.manufacturer() ); @@ -241,17 +240,17 @@ void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& s.sprintf( "(i) New Wireless Station in '%s' [xx]", (const char*) network->text( col_essid ) ); } MLogWindow::logwindow()->log( s ); } void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo ) { - qDebug( "WDSTraffic: %s and %s seem to form a WDS", (const char*) viaFrom.toString(), (const char*) viaTo.toString() ); + odebug << "WDSTraffic: " << (const char*) viaFrom.toString() << " and " << (const char*) viaTo.toString() << " seem to form a WDS" << oendl; QString s; MScanListItem* network; QListViewItemIterator it( this ); while ( it.current() && it.current()->text( col_ap ) != viaFrom.toString(true) && it.current()->text( col_ap ) != viaTo.toString(true) ) ++it; @@ -259,17 +258,17 @@ void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations { addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from ); addIfNotExisting( static_cast<MScanListItem*>(item->parent()), to ); } else { - qDebug( "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" ); + odebug << "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" << oendl; MLogWindow::logwindow()->log( "WARNING: Unhandled WSD traffic!" ); } } void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) { QString s; @@ -281,17 +280,17 @@ void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& to, MScanListItem* item = static_cast<MScanListItem*>( it.current() ); if ( item ) // AP has shown up yet, so just add our new "from" - station { addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "adhoc" ); } else { - qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); + odebug << "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" << oendl; MLogWindow::logwindow()->log( "WARNING: Unhandled toDS traffic!" ); } } void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) { @@ -304,91 +303,91 @@ void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& t MScanListItem* item = static_cast<MScanListItem*>( it.current() ); if ( item ) // AP has shown up yet, so just add our new "from" - station { addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "station" ); } else { - qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); + odebug << "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" << oendl; MLogWindow::logwindow()->log( "WARNING: Unhandled fromDS traffic!" ); } } void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) { - qWarning( "D'oh! Not yet implemented..." ); + owarn << "D'oh! Not yet implemented..." << oendl; MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" ); } void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) { - qDebug( "identify %s = %s", (const char*) macaddr.toString(), (const char*) ip ); + odebug << "identify " << (const char*) macaddr.toString() << " = " << (const char*) ip << "" << oendl; QListViewItemIterator it( this ); for ( ; it.current(); ++it ) { if ( it.current()->text( col_ap ) == macaddr.toString(true) ) { it.current()->setText( col_ip, ip ); return; } } - qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); + 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 ) ); } void MScanListView::addService( const QString& name, const OMacAddress& macaddr, const QString& ip ) { - qDebug( "addService '%s', Server = %s = %s", (const char*) name, (const char*) macaddr.toString(), (const char*) ip ); + odebug << "addService '" << (const char*) name << "', Server = " << (const char*) macaddr.toString() << " = " << (const char*) ip << "" << oendl; //TODO: Refactor that out, we need it all over the place. // Best to do it in a more comfortable abstraction in OListView // (Hmm, didn't I already start something in this direction?) QListViewItemIterator it( this ); for ( ; it.current(); ++it ) { if ( it.current()->text( col_ap ) == macaddr.toString(true) ) { MScanListItem* subitem = static_cast<MScanListItem*>( it.current()->firstChild() ); while ( subitem && ( subitem->text( col_essid ) != name ) ) { #ifdef DEBUG - qDebug( "subitemtext: %s", (const char*) subitem->text( col_essid ) ); + odebug << "subitemtext: " << (const char*) subitem->text( col_essid ) << "" << oendl; #endif subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); } if ( subitem ) { // we have already seen this item, it's a dupe #ifdef DEBUG - qDebug( "%s is a dupe - ignoring...", (const char*) name ); + odebug << "" << (const char*) name << " is a dupe - ignoring..." << oendl; #endif subitem->receivedBeacon(); //FIXME: sent data bit return; } // never seen that - add new item MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 ); item->setText( col_essid, name ); return; } } - qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); + 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 ) ); } void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) { if ( !item ) return; @@ -416,31 +415,31 @@ void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, in MScanListItem::MScanListItem( QListView* parent, const QString& type, const QString& essid, const QString& macaddr, bool wep, int channel, int signal, bool probed ) :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), _channel( channel ), _signal( signal ), _beacons( 1 ) { #ifdef DEBUG - qDebug( "creating scanlist item" ); + odebug << "creating scanlist item" << oendl; #endif if ( WellenreiterConfigWindow::instance() ) WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here decorateItem( type, essid, macaddr, wep, channel, signal, probed ); } MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const QString& essid, const QString& macaddr, bool wep, int channel, int signal ) :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) { #ifdef DEBUG - qDebug( "creating scanlist item" ); + odebug << "creating scanlist item" << oendl; #endif if ( WellenreiterConfigWindow::instance() ) WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here decorateItem( type, essid, macaddr, wep, channel, signal, false ); } const QString& MScanListItem::essid() const @@ -454,28 +453,28 @@ const QString& MScanListItem::essid() const OListViewItem* MScanListItem::childFactory() { return new MScanListItem( this ); } void MScanListItem::serializeTo( QDataStream& s ) const { #ifdef DEBUG - qDebug( "serializing MScanListItem" ); + odebug << "serializing MScanListItem" << oendl; #endif OListViewItem::serializeTo( s ); s << _type; s << (Q_UINT8) ( _wep ? 'y' : 'n' ); } void MScanListItem::serializeFrom( QDataStream& s ) { #ifdef DEBUG - qDebug( "serializing MScanListItem" ); + odebug << "serializing MScanListItem" << oendl; #endif OListViewItem::serializeFrom( s ); char wep; s >> _type; s >> (Q_UINT8) wep; _wep = (wep == 'y'); @@ -551,17 +550,17 @@ void MScanListItem::setLocation( const QString& location ) setText( col_location, location ); } void MScanListItem::receivedBeacon() { _beacons++; #ifdef DEBUG - qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); + odebug << "MScanListItem " << (const char*) _macaddr << ": received beacon #" << _beacons << "" << oendl; #endif setText( col_sig, QString::number( _beacons ) ); setText( col_lastseen, QTime::currentTime().toString() ); MScanListItem* p = (MScanListItem*) parent(); if ( p ) p->receivedBeacon(); } diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index fff7c35..fad6efd 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -6,72 +6,64 @@ ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ***********************************************************************/ -// Local - #include "gps.h" #include "wellenreiter.h" #include "scanlist.h" #include "logwindow.h" #include "packetview.h" #include "configwindow.h" #include "statwindow.h" #include "graphwindow.h" #include "protolistview.h" -// Opie - +/* OPIE */ #ifdef QWS #include <opie2/oapplication.h> +#include <opie2/odebug.h> #include <opie2/odevice.h> #else #include <qapplication.h> #endif #include <opie2/omanufacturerdb.h> #include <opie2/onetwork.h> #include <opie2/opcap.h> #include <qpe/qcopenvelope_qws.h> -using namespace Opie; - -// Qt +using namespace Opie::Core; +using namespace Opie::Net; +using namespace Opie::Ui; +/* QT */ #include <qcheckbox.h> #include <qcombobox.h> #include <qdatetime.h> #include <qpushbutton.h> #include <qlineedit.h> #include <qmessagebox.h> #include <qobjectlist.h> #include <qregexp.h> #include <qspinbox.h> #include <qtimer.h> #include <qtoolbutton.h> #include <qmainwindow.h> -// Standard - +/* STD */ #include <assert.h> #include <errno.h> #include <unistd.h> #include <string.h> #include <sys/types.h> #include <stdlib.h> -using namespace Opie::Core; -using namespace Opie::Net; -using namespace Opie::Net; -using namespace Opie::Core; -using namespace Opie::Net; -using namespace Opie::Core; Wellenreiter::Wellenreiter( QWidget* parent ) : WellenreiterBase( parent, 0, 0 ), sniffing( false ), iface( 0 ), configwindow( 0 ) { logwindow->log( "(i) Wellenreiter has been started." ); // @@ -101,17 +93,17 @@ Wellenreiter::Wellenreiter( QWidget* parent ) Wellenreiter::~Wellenreiter() { delete pcap; } void Wellenreiter::initialTimer() { - qDebug( "Wellenreiter::preloading manufacturer database..." ); + odebug << "Wellenreiter::preloading manufacturer database..." << oendl; OManufacturerDB::instance(); } void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) { configwindow = cw; } @@ -144,57 +136,57 @@ void Wellenreiter::handleNotification( OPacket* p ) QObject* o; while ( (o = it.current()) != 0 ) { QString name = it.current()->name(); if ( configwindow->parsePackets->isProtocolChecked( name ) ) { QString action = configwindow->parsePackets->protocolAction( name ); - qDebug( "parsePacket-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); + odebug << "parsePacket-action for '" << (const char*) name << "' seems to be '" << (const char*) action << "'" << oendl; doAction( action, name, p ); } else { - qDebug( "protocol '%s' not checked in parsePackets.", (const char*) name ); + odebug << "protocol '" << (const char*) name << "' not checked in parsePackets." << oendl; } ++it; } } void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage ) { if ( manage->managementType() == "Beacon" ) handleManagementFrameBeacon( p, manage ); else if ( manage->managementType() == "ProbeRequest" ) handleManagementFrameProbeRequest( p, manage ); else if ( manage->managementType() == "ProbeResponse" ) handleManagementFrameProbeResponse( p, manage ); - else qWarning( "Wellenreiter::handleManagementFrame(): '%s' - please handle me!", (const char*) manage->managementType() ); + else owarn << "Wellenreiter::handleManagementFrame(): '" << (const char*) manage->managementType() << "' - please handle me!" << oendl; } void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* request ) { OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); int channel = ds ? ds->channel() : -1; OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); GpsLocation loc( -111, -111 ); if ( configwindow->enableGPS->isChecked() ) { // TODO: add check if GPS is working!? - qDebug( "Wellenreiter::gathering GPS data..." ); + odebug << "Wellenreiter::gathering GPS data..." << oendl; loc = gps->position(); - qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); + odebug << "Wellenreiter::GPS data received is ( " << loc.latitude() << " , " << loc.longitude() << " ) - dms string = '" << loc.dmsPosition().latin1() << "'" << oendl; } if ( essid.length() ) netView()->addNewItem( "adhoc", essid, header->macAddress2(), false /* should check FrameControl field */, -1, 0, loc, true /* only probed */ ); - qDebug( "Wellenreiter::invalid frame [possibly noise] detected!" ); + odebug << "Wellenreiter::invalid frame [possibly noise] detected!" << oendl; } void Wellenreiter::handleManagementFrameProbeResponse( OPacket* p, OWaveLanManagementPacket* response ) { } @@ -206,34 +198,34 @@ void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPa type = "adhoc"; } else if ( beacon->canESS() ) { type = "managed"; } else { - qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); + owarn << "Wellenreiter::invalid frame [possibly noise] detected!" << oendl; return; } OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); int channel = ds ? ds->channel() : -1; OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); GpsLocation loc( -111, -111 ); if ( configwindow->enableGPS->isChecked() ) { // TODO: add check if GPS is working!? - qDebug( "Wellenreiter::gathering GPS data..." ); + odebug << "Wellenreiter::gathering GPS data..." << oendl; loc = gps->position(); - qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); + odebug << "Wellenreiter::GPS data received is ( " << loc.latitude() << " , " << loc.longitude() << " ) - dms string = '" << loc.dmsPosition().latin1() << "'" << oendl; } netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc ); // update graph window if ( ds ) { OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); @@ -250,17 +242,17 @@ void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* contro OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); if ( control->controlType() == "Acknowledge" ) { netView()->addNewItem( "adhoc", "<unknown>", header->macAddress1(), false, -1, 0, GpsLocation( -111, -111 ) ); } else { - qDebug( "Wellenreiter::handleControlFrame - please handle %s in a future version! :D", (const char*) control->controlType() ); + odebug << "Wellenreiter::handleControlFrame - please handle " << (const char*) control->controlType() << " in a future version! :D" << oendl; } } void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ) { OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); if ( wlan->fromDS() && !wlan->toDS() ) @@ -299,17 +291,17 @@ void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAd } void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest ) { OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); if ( arp ) { - qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() ); + odebug << "Received ARP traffic (type '" << (const char*) arp->type() << "'): " << oendl; if ( arp->type() == "REQUEST" ) { netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); } else if ( arp->type() == "REPLY" ) { netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() ); @@ -320,26 +312,26 @@ void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, OMacAddress& dest ) { //TODO: Implement more IP based protocols ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" ); if ( dhcp ) { - qDebug( "Received DHCP '%s' packet", (const char*) dhcp->type() ); + odebug << "Received DHCP '" << (const char*) dhcp->type() << "' packet" << oendl; if ( dhcp->type() == "OFFER" ) { - qDebug( "DHCP: '%s' ('%s') seems to be a DHCP server.", (const char*) source.toString(), (const char*) dhcp->serverAddress().toString() ); + odebug << "DHCP: '" << (const char*) source.toString() << "' ('" << (const char*) 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" ) { - qDebug( "DHCP: '%s' ('%s') accepted the offered DHCP address.", (const char*) dhcp->clientMacAddress().toString(), (const char*) dhcp->yourAddress().toString() ); + odebug << "DHCP: '" << (const char*) dhcp->clientMacAddress().toString() << "' ('" << (const char*) dhcp->yourAddress().toString() << "') accepted the offered DHCP address." << oendl; netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() ); } } } QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol ) { @@ -363,26 +355,26 @@ bool Wellenreiter::checkDumpPacket( OPacket* p ) QObject* o; while ( (o = it.current()) != 0 ) { QString name = it.current()->name(); if ( configwindow->capturePackets->isProtocolChecked( name ) ) { QString action = configwindow->capturePackets->protocolAction( name ); - qDebug( "capturePackets-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); + odebug << "capturePackets-action for '" << (const char*) name << "' seems to be '" << (const char*) action << "'" << oendl; if ( action == "Discard" ) { logwindow->log( QString().sprintf( "(i) dump-discarding of '%s' packet requested.", (const char*) name ) ); return false; } } else { - qDebug( "protocol '%s' not checked in capturePackets.", (const char*) name ); + odebug << "protocol '" << (const char*) name << "' not checked in capturePackets." << oendl; } ++it; } return true; } void Wellenreiter::receivePacket( OPacket* p ) @@ -546,17 +538,17 @@ void Wellenreiter::startClicked() switch ( cardtype ) { case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; - case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; + case DEVTYPE_FILE: odebug << "Wellenreiter: Capturing from file '" << (const char*) interface << "'" << oendl; break; default: assert( 0 ); // shouldn't reach this } // switch device into monitor mode if ( cardtype < DEVTYPE_FILE ) { if ( cardtype != DEVTYPE_MANUAL ) iface->setMode( "monitor" ); @@ -567,17 +559,17 @@ void Wellenreiter::startClicked() tr( "\nContinue with limited functionality?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) return; } } // open GPS device if ( configwindow->enableGPS->isChecked() ) { - qDebug( "Wellenreiter:GPS enabled @ %s:%d", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); + odebug << "Wellenreiter:GPS enabled @ " << (const char*) configwindow->gpsdHost->currentText() << ":" << configwindow->gpsdPort->value() << "" << oendl; gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); } // open pcap and start sniffing if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file? { dumpname = configwindow->captureFileName->text(); @@ -591,17 +583,17 @@ void Wellenreiter::startClicked() dumpname = "/var/log/dump.wellenreiter"; } if ( cardtype != DEVTYPE_FILE ) pcap->open( interface ); else pcap->open( QFile( interface ) ); - qDebug( "Wellenreiter:: dumping to %s", (const char*) dumpname ); + odebug << "Wellenreiter:: dumping to " << (const char*) dumpname << "" << oendl; pcap->openDumpFile( dumpname ); if ( !pcap->isOpen() ) { QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg( cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) )); return; } @@ -647,17 +639,17 @@ void Wellenreiter::startClicked() assert( parent() ); ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); } } void Wellenreiter::timerEvent( QTimerEvent* ) { - qDebug( "Wellenreiter::timerEvent()" ); + odebug << "Wellenreiter::timerEvent()" << oendl; OPacket* p = pcap->next(); if ( !p ) // no more packets available { stopClicked(); } else { receivePacket( p ); @@ -710,24 +702,24 @@ void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int ch (const char*) iface->name(), (const char*) type, (const char*) essid, channel, (const char*) macaddr ); QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); int count = 3; - qDebug("sending %d messages",count); + odebug << "sending " << count << " messages" << oendl; msg << QString("count") << QString::number(count); - qDebug("msg >%s< Mode >%s<", iface->name(),type.latin1() ); + odebug << "msg >" << iface->name() << "< Mode >" << type.latin1() << "<" << oendl; msg << QString(iface->name()) << QString("Mode") << type; - qDebug("msg >%s< essid >%s<", iface->name(),essid.latin1()); + odebug << "msg >" << iface->name() << "< essid >" << essid.latin1() << "<" << oendl; msg << QString(iface->name()) << QString("ESSID") << essid; - qDebug("msg >%s< channel >%d<", iface->name(),channel); + odebug << "msg >" << iface->name() << "< channel >" << channel << "<" << oendl; msg << QString(iface->name()) << QString("Channel") << channel; -// qDebug("msg >%s< mac >%s<", iface->name(),macaddr); +// odebug << "msg >" << iface->name() << "< mac >" << macaddr << "<" << oendl; // msg << QString(iface->name()) << QString("MacAddr") << macaddr; #else QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) ); #endif } |