author | mickeyl <mickeyl> | 2004-03-28 13:39:39 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-03-28 13:39:39 (UTC) |
commit | ca32f9c2a799aec751efd82e73c3154de1afe957 (patch) (unidiff) | |
tree | 4577ffe310acac81451235a4b11f0bf2ec86c3bc | |
parent | 0821e9018b0a3b1ea11ff5a4454db2e047d94d88 (diff) | |
download | opie-ca32f9c2a799aec751efd82e73c3154de1afe957.zip opie-ca32f9c2a799aec751efd82e73c3154de1afe957.tar.gz opie-ca32f9c2a799aec751efd82e73c3154de1afe957.tar.bz2 |
fix stupid bug that broke replaying capture files
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index e8d9de7..c8d77a7 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -489,77 +489,78 @@ void Wellenreiter::stopClicked() | |||
489 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | 489 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; |
490 | } | 490 | } |
491 | #else | 491 | #else |
492 | #warning FIXME: setScreenSaverMode is not operational on the X11 build | 492 | #warning FIXME: setScreenSaverMode is not operational on the X11 build |
493 | #endif | 493 | #endif |
494 | 494 | ||
495 | // print out statistics | 495 | // print out statistics |
496 | for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) | 496 | for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) |
497 | statwindow->updateCounter( it.key(), it.data() ); | 497 | statwindow->updateCounter( it.key(), it.data() ); |
498 | } | 498 | } |
499 | 499 | ||
500 | 500 | ||
501 | void Wellenreiter::startClicked() | 501 | void Wellenreiter::startClicked() |
502 | { | 502 | { |
503 | // get configuration from config window | 503 | // get configuration from config window |
504 | 504 | ||
505 | const QString& interface = configwindow->interfaceName->currentText(); | 505 | const QString& interface = configwindow->interfaceName->currentText(); |
506 | const int cardtype = configwindow->driverType(); | 506 | const int cardtype = configwindow->driverType(); |
507 | const int interval = configwindow->hoppingInterval(); | 507 | const int interval = configwindow->hoppingInterval(); |
508 | 508 | ||
509 | if ( ( interface == "" ) || ( cardtype == 0 ) ) | 509 | if ( ( interface == "" ) || ( cardtype == 0 ) ) |
510 | { | 510 | { |
511 | QMessageBox::information( this, "Wellenreiter II", | 511 | QMessageBox::information( this, "Wellenreiter II", |
512 | tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); | 512 | tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); |
513 | return; | 513 | return; |
514 | } | 514 | } |
515 | 515 | ||
516 | // configure device | 516 | // configure device |
517 | ONetwork* net = ONetwork::instance(); | 517 | ONetwork* net = ONetwork::instance(); |
518 | 518 | ||
519 | // TODO: check if interface is wireless and support sniffing for non-wireless interfaces | 519 | // TODO: check if interface is wireless and support sniffing for non-wireless interfaces |
520 | 520 | ||
521 | if ( !net->isPresent( interface ) ) | ||
522 | { | ||
523 | QMessageBox::information( this, "Wellenreiter II", | ||
524 | tr( "The configured device (%1)\nis not available on this system\n. Please reconfigure!" ).arg( interface ) ); | ||
525 | return; | ||
526 | } | ||
527 | |||
528 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); // fails if network is not wireless! | ||
529 | assert( iface ); | ||
530 | |||
531 | // bring device UP | ||
532 | if ( cardtype != DEVTYPE_FILE ) | 521 | if ( cardtype != DEVTYPE_FILE ) |
533 | { | 522 | { |
523 | |||
524 | if ( !net->isPresent( interface ) ) | ||
525 | { | ||
526 | QMessageBox::information( this, "Wellenreiter II", | ||
527 | tr( "The configured device (%1)\nis not available on this system\n. Please reconfigure!" ).arg( interface ) ); | ||
528 | return; | ||
529 | } | ||
530 | |||
531 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); // fails if network is not wireless! | ||
532 | assert( iface ); | ||
533 | |||
534 | // bring device UP | ||
534 | iface->setUp( true ); | 535 | iface->setUp( true ); |
535 | if ( !iface->isUp() ) | 536 | if ( !iface->isUp() ) |
536 | { | 537 | { |
537 | QMessageBox::warning( this, "Wellenreiter II", | 538 | QMessageBox::warning( this, "Wellenreiter II", |
538 | tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) ); | 539 | tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) ); |
539 | return; | 540 | return; |
540 | } | 541 | } |
541 | } | 542 | } |
542 | // set monitor mode | 543 | // set monitor mode |
543 | bool usePrism = configwindow->usePrismHeader(); | 544 | bool usePrism = configwindow->usePrismHeader(); |
544 | 545 | ||
545 | switch ( cardtype ) | 546 | switch ( cardtype ) |
546 | { | 547 | { |
547 | case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; | 548 | case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; |
548 | case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; | 549 | case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; |
549 | case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; | 550 | case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; |
550 | case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; | 551 | case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; |
551 | case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; | 552 | case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; |
552 | case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; | 553 | case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; |
553 | default: assert( 0 ); // shouldn't reach this | 554 | default: assert( 0 ); // shouldn't reach this |
554 | } | 555 | } |
555 | 556 | ||
556 | // switch device into monitor mode | 557 | // switch device into monitor mode |
557 | if ( cardtype < DEVTYPE_FILE ) | 558 | if ( cardtype < DEVTYPE_FILE ) |
558 | { | 559 | { |
559 | if ( cardtype != DEVTYPE_MANUAL ) | 560 | if ( cardtype != DEVTYPE_MANUAL ) |
560 | iface->setMode( "monitor" ); | 561 | iface->setMode( "monitor" ); |
561 | if ( iface->mode() != "monitor" ) | 562 | if ( iface->mode() != "monitor" ) |
562 | { | 563 | { |
563 | if ( QMessageBox::warning( this, "Wellenreiter II", | 564 | if ( QMessageBox::warning( this, "Wellenreiter II", |
564 | tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) + | 565 | tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) + |
565 | tr( "\nContinue with limited functionality?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) | 566 | tr( "\nContinue with limited functionality?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) |
@@ -615,65 +616,65 @@ void Wellenreiter::startClicked() | |||
615 | } | 616 | } |
616 | 617 | ||
617 | if ( cardtype != DEVTYPE_FILE ) | 618 | if ( cardtype != DEVTYPE_FILE ) |
618 | { | 619 | { |
619 | // connect socket notifier and start channel hopper | 620 | // connect socket notifier and start channel hopper |
620 | connect( pcap, SIGNAL( receivedPacket(Opie::Net::OPacket*) ), this, SLOT( receivePacket(Opie::Net::OPacket*) ) ); | 621 | connect( pcap, SIGNAL( receivedPacket(Opie::Net::OPacket*) ), this, SLOT( receivePacket(Opie::Net::OPacket*) ) ); |
621 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | 622 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); |
622 | } | 623 | } |
623 | else | 624 | else |
624 | { | 625 | { |
625 | // start timer for reading packets | 626 | // start timer for reading packets |
626 | startTimer( 100 ); | 627 | startTimer( 100 ); |
627 | } | 628 | } |
628 | 629 | ||
629 | logwindow->log( "(i) Started Scanning." ); | 630 | logwindow->log( "(i) Started Scanning." ); |
630 | sniffing = true; | 631 | sniffing = true; |
631 | 632 | ||
632 | #ifdef QWS | 633 | #ifdef QWS |
633 | if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() ) | 634 | if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() ) |
634 | { | 635 | { |
635 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable; | 636 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable; |
636 | } | 637 | } |
637 | #else | 638 | #else |
638 | #warning FIXME: setScreenSaverMode is not operational on the X11 build | 639 | #warning FIXME: setScreenSaverMode is not operational on the X11 build |
639 | #endif | 640 | #endif |
640 | 641 | ||
641 | emit( startedSniffing() ); | 642 | emit( startedSniffing() ); |
642 | if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title | 643 | if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title |
643 | else | 644 | else |
644 | { | 645 | { |
645 | assert( parent() ); | 646 | assert( parent() ); |
646 | ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); | 647 | ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); |
647 | } | 648 | } |
648 | } | 649 | } |
649 | 650 | ||
650 | 651 | ||
651 | void Wellenreiter::timerEvent( QTimerEvent* ) | 652 | void Wellenreiter::timerEvent( QTimerEvent* ) |
652 | { | 653 | { |
653 | qDebug( "Wellenreiter::timerEvent()" ); | 654 | qDebug( "Wellenreiter::timerEvent()" ); |
654 | OPacket* p = pcap->next(); | 655 | OPacket* p = pcap->next(); |
655 | if ( !p ) // no more packets available | 656 | if ( !p ) // no more packets available |
656 | { | 657 | { |
657 | stopClicked(); | 658 | stopClicked(); |
658 | } | 659 | } |
659 | else | 660 | else |
660 | { | 661 | { |
661 | receivePacket( p ); | 662 | receivePacket( p ); |
662 | delete p; | 663 | delete p; |
663 | } | 664 | } |
664 | } | 665 | } |
665 | 666 | ||
666 | 667 | ||
667 | void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* p ) | 668 | void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* p ) |
668 | { | 669 | { |
669 | #ifdef QWS | 670 | #ifdef QWS |
670 | if ( action == "TouchSound" ) | 671 | if ( action == "TouchSound" ) |
671 | ODevice::inst()->playTouchSound(); | 672 | ODevice::inst()->playTouchSound(); |
672 | else if ( action == "AlarmSound" ) | 673 | else if ( action == "AlarmSound" ) |
673 | ODevice::inst()->playAlarmSound(); | 674 | ODevice::inst()->playAlarmSound(); |
674 | else if ( action == "KeySound" ) | 675 | else if ( action == "KeySound" ) |
675 | ODevice::inst()->playKeySound(); | 676 | ODevice::inst()->playKeySound(); |
676 | else if ( action == "LedOn" ) | 677 | else if ( action == "LedOn" ) |
677 | ODevice::inst()->setLedState( Led_Mail, Led_On ); | 678 | ODevice::inst()->setLedState( Led_Mail, Led_On ); |
678 | else if ( action == "LedOff" ) | 679 | else if ( action == "LedOff" ) |
679 | ODevice::inst()->setLedState( Led_Mail, Led_Off ); | 680 | ODevice::inst()->setLedState( Led_Mail, Led_Off ); |