Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 68 |
1 files changed, 40 insertions, 28 deletions
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 @@ | |||
33 | #include <opie2/onetwork.h> | 33 | #include <opie2/onetwork.h> |
34 | #include <opie2/opcap.h> | 34 | #include <opie2/opcap.h> |
35 | #include <qpe/qcopenvelope_qws.h> | 35 | #include <qpe/qcopenvelope_qws.h> |
36 | using namespace Opie::Core; | ||
37 | using namespace Opie::Net; | ||
38 | using namespace Opie::Ui; | ||
39 | 36 | ||
40 | /* QT */ | 37 | /* QT */ |
41 | #include <qcheckbox.h> | 38 | #include <qcheckbox.h> |
@@ -60,6 +57,11 @@ using namespace Opie::Ui; | |||
60 | #include <stdlib.h> | 57 | #include <stdlib.h> |
61 | #include <signal.h> | 58 | #include <signal.h> |
62 | 59 | ||
60 | |||
61 | using namespace Opie::Core; | ||
62 | using namespace Opie::Net; | ||
63 | using namespace Opie::Ui; | ||
64 | |||
63 | Wellenreiter* Wellenreiter::instance = 0; | 65 | Wellenreiter* Wellenreiter::instance = 0; |
64 | 66 | ||
65 | Wellenreiter::Wellenreiter( QWidget* parent ) | 67 | Wellenreiter::Wellenreiter( QWidget* parent ) |
@@ -74,8 +76,7 @@ Wellenreiter::Wellenreiter( QWidget* parent ) | |||
74 | // | 76 | // |
75 | 77 | ||
76 | #ifdef QWS | 78 | #ifdef QWS |
77 | QString sys; | 79 | QString sys = QString( "(i) Running on '%1'.").arg( ODevice::inst()->systemString() ); |
78 | sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); | ||
79 | _system = ODevice::inst()->system(); | 80 | _system = ODevice::inst()->system(); |
80 | logwindow->log( sys ); | 81 | logwindow->log( sys ); |
81 | #endif | 82 | #endif |
@@ -110,6 +111,7 @@ void Wellenreiter::initialTimer() | |||
110 | 111 | ||
111 | void Wellenreiter::signalHandler( int sig ) | 112 | void Wellenreiter::signalHandler( int sig ) |
112 | { | 113 | { |
114 | Q_UNUSED( sig ) | ||
113 | oerr << "Aye! Received SIGSEGV or SIGBUS! Trying to exit gracefully..." << oendl; | 115 | oerr << "Aye! Received SIGSEGV or SIGBUS! Trying to exit gracefully..." << oendl; |
114 | if ( Wellenreiter::instance->sniffing ) | 116 | if ( Wellenreiter::instance->sniffing ) |
115 | { | 117 | { |
@@ -176,7 +178,7 @@ void Wellenreiter::handleNotification( OPacket* p ) | |||
176 | if ( configwindow->parsePackets->isProtocolChecked( name ) ) | 178 | if ( configwindow->parsePackets->isProtocolChecked( name ) ) |
177 | { | 179 | { |
178 | QString action = configwindow->parsePackets->protocolAction( name ); | 180 | QString action = configwindow->parsePackets->protocolAction( name ); |
179 | odebug << "parsePacket-action for '" << (const char*) name << "' seems to be '" << action << "'" << oendl; | 181 | odebug << "parsePacket-action for '" << name << "' seems to be '" << action << "'" << oendl; |
180 | doAction( action, name, p ); | 182 | doAction( action, name, p ); |
181 | } | 183 | } |
182 | else | 184 | else |
@@ -197,12 +199,12 @@ void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* | |||
197 | } | 199 | } |
198 | 200 | ||
199 | 201 | ||
200 | void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* request ) | 202 | void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* /* request */ ) |
201 | { | 203 | { |
202 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); | 204 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); |
203 | QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); | 205 | QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); |
204 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); | 206 | // OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); |
205 | int channel = ds ? ds->channel() : -1; | 207 | // int channel = ds ? ds->channel() : -1; |
206 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 208 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
207 | 209 | ||
208 | GpsLocation loc( -111, -111 ); | 210 | GpsLocation loc( -111, -111 ); |
@@ -220,7 +222,7 @@ void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManage | |||
220 | } | 222 | } |
221 | 223 | ||
222 | 224 | ||
223 | void Wellenreiter::handleManagementFrameProbeResponse( OPacket* p, OWaveLanManagementPacket* response ) | 225 | void Wellenreiter::handleManagementFrameProbeResponse( OPacket* /* p */, OWaveLanManagementPacket* /* response */ ) |
224 | { | 226 | { |
225 | } | 227 | } |
226 | 228 | ||
@@ -287,7 +289,7 @@ void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* contro | |||
287 | } | 289 | } |
288 | 290 | ||
289 | 291 | ||
290 | void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ) | 292 | void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* /* data */ , OMacAddress& from, OMacAddress& to ) |
291 | { | 293 | { |
292 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); | 294 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); |
293 | if ( wlan->fromDS() && !wlan->toDS() ) | 295 | if ( wlan->fromDS() && !wlan->toDS() ) |
@@ -317,7 +319,7 @@ void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAdd | |||
317 | } | 319 | } |
318 | 320 | ||
319 | 321 | ||
320 | void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ) | 322 | void Wellenreiter::handleEthernetData( OPacket* /* p */, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ) |
321 | { | 323 | { |
322 | from = data->sourceAddress(); | 324 | from = data->sourceAddress(); |
323 | to = data->destinationAddress(); | 325 | to = data->destinationAddress(); |
@@ -326,7 +328,7 @@ void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAd | |||
326 | } | 328 | } |
327 | 329 | ||
328 | 330 | ||
329 | void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest ) | 331 | void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& /* source */, OMacAddress& /* dest */ ) |
330 | { | 332 | { |
331 | OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); | 333 | OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); |
332 | if ( arp ) | 334 | if ( arp ) |
@@ -345,7 +347,7 @@ void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, | |||
345 | } | 347 | } |
346 | 348 | ||
347 | 349 | ||
348 | void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, OMacAddress& dest ) | 350 | void Wellenreiter::handleIPData( OPacket* p, OIPPacket* /* ip */, OMacAddress& source, OMacAddress& /* dest */ ) |
349 | { | 351 | { |
350 | //TODO: Implement more IP based protocols | 352 | //TODO: Implement more IP based protocols |
351 | 353 | ||
@@ -355,13 +357,13 @@ void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, | |||
355 | odebug << "Received DHCP '" << dhcp->type() << "' packet" << oendl; | 357 | odebug << "Received DHCP '" << dhcp->type() << "' packet" << oendl; |
356 | if ( dhcp->type() == "OFFER" ) | 358 | if ( dhcp->type() == "OFFER" ) |
357 | { | 359 | { |
358 | odebug << "DHCP: '" << (const char*) source.toString() << "' ('" << dhcp->serverAddress().toString() << "') seems to be a DHCP server." << oendl; | 360 | odebug << "DHCP: '" << source.toString() << "' ('" << dhcp->serverAddress().toString() << "') seems to be a DHCP server." << oendl; |
359 | netView()->identify( source, dhcp->serverAddress().toString() ); | 361 | netView()->identify( source, dhcp->serverAddress().toString() ); |
360 | netView()->addService( "DHCP", source, dhcp->serverAddress().toString() ); | 362 | netView()->addService( "DHCP", source, dhcp->serverAddress().toString() ); |
361 | } | 363 | } |
362 | else if ( dhcp->type() == "ACK" ) | 364 | else if ( dhcp->type() == "ACK" ) |
363 | { | 365 | { |
364 | odebug << "DHCP: '" << (const char*) dhcp->clientMacAddress().toString() << "' ('" << dhcp->yourAddress().toString() << "') accepted the offered DHCP address." << oendl; | 366 | odebug << "DHCP: '" << dhcp->clientMacAddress().toString() << "' ('" << dhcp->yourAddress().toString() << "') accepted the offered DHCP address." << oendl; |
365 | netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() ); | 367 | netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() ); |
366 | } | 368 | } |
367 | } | 369 | } |
@@ -395,10 +397,10 @@ bool Wellenreiter::checkDumpPacket( OPacket* p ) | |||
395 | if ( configwindow->capturePackets->isProtocolChecked( name ) ) | 397 | if ( configwindow->capturePackets->isProtocolChecked( name ) ) |
396 | { | 398 | { |
397 | QString action = configwindow->capturePackets->protocolAction( name ); | 399 | QString action = configwindow->capturePackets->protocolAction( name ); |
398 | odebug << "capturePackets-action for '" << (const char*) name << "' seems to be '" << action << "'" << oendl; | 400 | odebug << "capturePackets-action for '" << name << "' seems to be '" << action << "'" << oendl; |
399 | if ( action == "Discard" ) | 401 | if ( action == "Discard" ) |
400 | { | 402 | { |
401 | logwindow->log( QString().sprintf( "(i) dump-discarding of '%s' packet requested.", (const char*) name ) ); | 403 | logwindow->log( QString("(i) dump-discarding of '%1' packet requested." ).arg( name ) ); |
402 | return false; | 404 | return false; |
403 | } | 405 | } |
404 | } | 406 | } |
@@ -520,9 +522,7 @@ void Wellenreiter::stopClicked() | |||
520 | #warning FIXME: setScreenSaverMode is not operational on the X11 build | 522 | #warning FIXME: setScreenSaverMode is not operational on the X11 build |
521 | #endif | 523 | #endif |
522 | 524 | ||
523 | // print out statistics | 525 | updateStatistics(); |
524 | for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) | ||
525 | statwindow->updateCounter( it.key(), it.data() ); | ||
526 | } | 526 | } |
527 | 527 | ||
528 | 528 | ||
@@ -532,7 +532,7 @@ void Wellenreiter::startClicked() | |||
532 | 532 | ||
533 | const QString& interface = configwindow->interfaceName->currentText(); | 533 | const QString& interface = configwindow->interfaceName->currentText(); |
534 | const int cardtype = configwindow->driverType(); | 534 | const int cardtype = configwindow->driverType(); |
535 | const int interval = configwindow->hoppingInterval(); | 535 | // const int interval = configwindow->hoppingInterval(); |
536 | 536 | ||
537 | if ( ( interface == "" ) || ( cardtype == 0 ) ) | 537 | if ( ( interface == "" ) || ( cardtype == 0 ) ) |
538 | { | 538 | { |
@@ -704,7 +704,7 @@ void Wellenreiter::timerEvent( QTimerEvent* ) | |||
704 | } | 704 | } |
705 | 705 | ||
706 | 706 | ||
707 | void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* p ) | 707 | void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* /* p */ ) |
708 | { | 708 | { |
709 | #ifdef QWS | 709 | #ifdef QWS |
710 | if ( action == "TouchSound" ) | 710 | if ( action == "TouchSound" ) |
@@ -718,10 +718,10 @@ void Wellenreiter::doAction( const QString& action, const QString& protocol, OPa | |||
718 | else if ( action == "LedOff" ) | 718 | else if ( action == "LedOff" ) |
719 | ODevice::inst()->setLedState( Led_Mail, Led_Off ); | 719 | ODevice::inst()->setLedState( Led_Mail, Led_Off ); |
720 | else if ( action == "LogMessage" ) | 720 | else if ( action == "LogMessage" ) |
721 | logwindow->log( QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); | 721 | logwindow->log( QString(tr("Got packet with protocol '%1'","Protocol Name" ) ).arg( protocol ) ); |
722 | else if ( action == "MessageBox" ) | 722 | else if ( action == "MessageBox" ) |
723 | QMessageBox::information( this, "Notification!", | 723 | QMessageBox::information( this, "Notification!", |
724 | QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); | 724 | QString(tr( "Got packet with protocol '%1'", "Protocol Name" ) ).arg( protocol ) ); |
725 | #else | 725 | #else |
726 | #warning Actions do not work with Qt/X11 yet | 726 | #warning Actions do not work with Qt/X11 yet |
727 | #endif | 727 | #endif |
@@ -742,9 +742,9 @@ void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int ch | |||
742 | return; | 742 | return; |
743 | } | 743 | } |
744 | 744 | ||
745 | odebug << "joinNetwork() with Interface " << (const char*) iface->name() | 745 | odebug << "joinNetwork() with Interface " << iface->name() |
746 | << ": " << (const char*) type << ", " << (const char*) essid | 746 | << ": " << type << ", " << essid |
747 | << ", " << channel << ", " << (const char*) macaddr << oendl; | 747 | << ", " << channel << ", " << macaddr << oendl; |
748 | 748 | ||
749 | QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); | 749 | QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); |
750 | int count = 3; | 750 | int count = 3; |
@@ -764,3 +764,15 @@ void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int ch | |||
764 | 764 | ||
765 | } | 765 | } |
766 | 766 | ||
767 | void Wellenreiter::updateStatistics() | ||
768 | { | ||
769 | // print out statistics | ||
770 | for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) | ||
771 | statwindow->updateCounter( it.key(), it.data() ); | ||
772 | } | ||
773 | |||
774 | void Wellenreiter::slotTabChanged( QWidget* wid ) | ||
775 | { | ||
776 | if ( wid == statwindow ) | ||
777 | updateStatistics(); | ||
778 | } | ||