Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index db68e5b..67e3940 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -483,65 +483,73 @@ void Wellenreiter::stopClicked() | |||
483 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | 483 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; |
484 | } | 484 | } |
485 | #else | 485 | #else |
486 | #warning FIXME: setScreenSaverMode is not operational on the X11 build | 486 | #warning FIXME: setScreenSaverMode is not operational on the X11 build |
487 | #endif | 487 | #endif |
488 | 488 | ||
489 | // print out statistics | 489 | // print out statistics |
490 | for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) | 490 | for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) |
491 | statwindow->updateCounter( it.key(), it.data() ); | 491 | statwindow->updateCounter( it.key(), it.data() ); |
492 | } | 492 | } |
493 | 493 | ||
494 | 494 | ||
495 | void Wellenreiter::startClicked() | 495 | void Wellenreiter::startClicked() |
496 | { | 496 | { |
497 | // get configuration from config window | 497 | // get configuration from config window |
498 | 498 | ||
499 | const QString& interface = configwindow->interfaceName->currentText(); | 499 | const QString& interface = configwindow->interfaceName->currentText(); |
500 | const int cardtype = configwindow->driverType(); | 500 | const int cardtype = configwindow->driverType(); |
501 | const int interval = configwindow->hoppingInterval(); | 501 | const int interval = configwindow->hoppingInterval(); |
502 | 502 | ||
503 | if ( ( interface == "" ) || ( cardtype == 0 ) ) | 503 | if ( ( interface == "" ) || ( cardtype == 0 ) ) |
504 | { | 504 | { |
505 | QMessageBox::information( this, "Wellenreiter II", | 505 | QMessageBox::information( this, "Wellenreiter II", |
506 | tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); | 506 | tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); |
507 | return; | 507 | return; |
508 | } | 508 | } |
509 | 509 | ||
510 | // configure device | 510 | // configure device |
511 | ONetwork* net = ONetwork::instance(); | 511 | ONetwork* net = ONetwork::instance(); |
512 | 512 | ||
513 | // TODO: check if interface is wireless and support sniffing for non-wireless interfaces | 513 | // TODO: check if interface is wireless and support sniffing for non-wireless interfaces |
514 | 514 | ||
515 | if ( !net->isPresent( interface ) ) | ||
516 | { | ||
517 | QMessageBox::information( this, "Wellenreiter II", | ||
518 | tr( "The configured device (%1)\nis not available on this system\n. Please reconfigure!" ).arg( interface ) ); | ||
519 | return; | ||
520 | } | ||
521 | |||
515 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); // fails if network is not wireless! | 522 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); // fails if network is not wireless! |
523 | assert( iface ); | ||
516 | 524 | ||
517 | // bring device UP | 525 | // bring device UP |
518 | if ( cardtype != DEVTYPE_FILE ) | 526 | if ( cardtype != DEVTYPE_FILE ) |
519 | { | 527 | { |
520 | iface->setUp( true ); | 528 | iface->setUp( true ); |
521 | if ( !iface->isUp() ) | 529 | if ( !iface->isUp() ) |
522 | { | 530 | { |
523 | QMessageBox::warning( this, "Wellenreiter II", | 531 | QMessageBox::warning( this, "Wellenreiter II", |
524 | tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) ); | 532 | tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) ); |
525 | return; | 533 | return; |
526 | } | 534 | } |
527 | } | 535 | } |
528 | // set monitor mode | 536 | // set monitor mode |
529 | bool usePrism = configwindow->usePrismHeader(); | 537 | bool usePrism = configwindow->usePrismHeader(); |
530 | 538 | ||
531 | switch ( cardtype ) | 539 | switch ( cardtype ) |
532 | { | 540 | { |
533 | case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; | 541 | case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; |
534 | case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; | 542 | case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; |
535 | case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; | 543 | case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; |
536 | case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; | 544 | case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; |
537 | case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; | 545 | case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; |
538 | case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; | 546 | case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; |
539 | default: assert( 0 ); // shouldn't reach this | 547 | default: assert( 0 ); // shouldn't reach this |
540 | } | 548 | } |
541 | 549 | ||
542 | // switch device into monitor mode | 550 | // switch device into monitor mode |
543 | if ( cardtype < DEVTYPE_FILE ) | 551 | if ( cardtype < DEVTYPE_FILE ) |
544 | { | 552 | { |
545 | if ( cardtype != DEVTYPE_MANUAL ) | 553 | if ( cardtype != DEVTYPE_MANUAL ) |
546 | iface->setMode( "monitor" ); | 554 | iface->setMode( "monitor" ); |
547 | if ( iface->mode() != "monitor" ) | 555 | if ( iface->mode() != "monitor" ) |