summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index df8e9c3..9fe463a 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -478,193 +478,193 @@ void Wellenreiter::receivePacket( OPacket* p )
478} 478}
479 479
480 480
481void Wellenreiter::stopClicked() 481void Wellenreiter::stopClicked()
482{ 482{
483 if ( iface ) 483 if ( iface )
484 { 484 {
485 disconnect( SIGNAL( receivedPacket(Opie::Net::OPacket*) ), this, SLOT( receivePacket(Opie::Net::OPacket*) ) ); 485 disconnect( SIGNAL( receivedPacket(Opie::Net::OPacket*) ), this, SLOT( receivePacket(Opie::Net::OPacket*) ) );
486 disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); 486 disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) );
487 iface->setChannelHopping(); // stop hopping channels 487 iface->setChannelHopping(); // stop hopping channels
488 } 488 }
489 else 489 else
490 killTimers(); 490 killTimers();
491 491
492 pcap->close(); 492 pcap->close();
493 sniffing = false; 493 sniffing = false;
494 494
495 if ( iface ) 495 if ( iface )
496 { 496 {
497 // switch off monitor mode 497 // switch off monitor mode
498 iface->setMode( "managed" ); 498 iface->setMode( "managed" );
499 // switch off promisc flag 499 // switch off promisc flag
500 iface->setPromiscuousMode( false ); 500 iface->setPromiscuousMode( false );
501 501
502 system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess 502 system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess
503 } 503 }
504 504
505 logwindow->log( "(i) Stopped Scanning." ); 505 logwindow->log( "(i) Stopped Scanning." );
506 assert( parent() ); 506 assert( parent() );
507 ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); 507 ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" );
508 508
509 // message the user 509 // message the user
510 QMessageBox::information( this, "Wellenreiter II", 510 QMessageBox::information( this, "Wellenreiter II",
511 tr( "Your wireless card\nshould now be usable again." ) ); 511 tr( "Your wireless card\nshould now be usable again." ) );
512 512
513 sniffing = false; 513 sniffing = false;
514 emit( stoppedSniffing() ); 514 emit( stoppedSniffing() );
515 515
516 #ifdef QWS 516 #ifdef QWS
517 if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() ) 517 if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() )
518 { 518 {
519 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 519 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
520 } 520 }
521 #else 521 #else
522 #warning FIXME: setScreenSaverMode is not operational on the X11 build 522 #warning FIXME: setScreenSaverMode is not operational on the X11 build
523 #endif 523 #endif
524 524
525 updateStatistics(); 525 updateStatistics();
526} 526}
527 527
528 528
529void Wellenreiter::startClicked() 529void Wellenreiter::startClicked()
530{ 530{
531 // get configuration from config window 531 // get configuration from config window
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 {
539 QMessageBox::information( this, "Wellenreiter II", 539 QMessageBox::information( this, "Wellenreiter II",
540 tr( "No device configured.\nPlease reconfigure!" ) ); 540 tr( "No device configured.\nPlease reconfigure!" ) );
541 return; 541 return;
542 } 542 }
543 543
544 // configure device 544 // configure device
545 ONetwork* net = ONetwork::instance(); 545 ONetwork* net = ONetwork::instance();
546 546
547 // TODO: check if interface is wireless and support sniffing for non-wireless interfaces 547 // TODO: check if interface is wireless and support sniffing for non-wireless interfaces
548 548
549 if ( cardtype != DEVTYPE_FILE ) 549 if ( cardtype != DEVTYPE_FILE )
550 { 550 {
551 551
552 if ( !net->isPresent( interface ) ) 552 if ( !net->isPresent( interface ) )
553 { 553 {
554 QMessageBox::information( this, "Wellenreiter II", 554 QMessageBox::information( this, "Wellenreiter II",
555 tr( "The configured device (%1)\nis not available on this system\n. Please reconfigure!" ).arg( interface ) ); 555 tr( "The configured device (%1)\nis not available on this system\n. Please reconfigure!" ).arg( interface ) );
556 return; 556 return;
557 } 557 }
558 558
559 iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); // fails if network is not wireless! 559 iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); // fails if network is not wireless!
560 assert( iface ); 560 assert( iface );
561 561
562 // bring device UP 562 // bring device UP
563 iface->setUp( true ); 563 iface->setUp( true );
564 if ( !iface->isUp() ) 564 if ( !iface->isUp() )
565 { 565 {
566 QMessageBox::warning( this, "Wellenreiter II", 566 QMessageBox::warning( this, "Wellenreiter II",
567 tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) ); 567 tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) );
568 return; 568 return;
569 } 569 }
570 570
571 // check if wireless extension version matches 571 // check if wireless extension version matches
572 if ( ONetwork::wirelessExtensionCompileVersion() != iface->wirelessExtensionDriverVersion() ) 572 if ( ONetwork::wirelessExtensionCompileVersion() != iface->wirelessExtensionDriverVersion() )
573 { 573 {
574 QMessageBox::critical( this, "Wellenreiter II", tr( "<p>The Wireless Extension Versions<br>are not matching!<p>" 574 QMessageBox::critical( this, "Wellenreiter II", tr( "<p>The Wireless Extension Versions<br>do not match!<p>"
575 " Wellenreiter II : WE V%1<br>Interface driver: WE V%2" ) 575 " Wellenreiter II : WE V%1<br>Interface driver: WE V%2" )
576 .arg( QString::number( ONetwork::wirelessExtensionCompileVersion() ) ) 576 .arg( QString::number( ONetwork::wirelessExtensionCompileVersion() ) )
577 .arg( QString::number( iface->wirelessExtensionDriverVersion() ) ) ); 577 .arg( QString::number( iface->wirelessExtensionDriverVersion() ) ) );
578 return; 578 return;
579 } 579 }
580 } 580 }
581 // set monitor mode 581 // set monitor mode
582 bool usePrism = configwindow->usePrismHeader(); 582 bool usePrism = configwindow->usePrismHeader();
583 583
584 switch ( cardtype ) 584 switch ( cardtype )
585 { 585 {
586 case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; 586 case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break;
587 case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; 587 case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break;
588 case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; 588 case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break;
589 case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; 589 case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break;
590 case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; 590 case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break;
591 case DEVTYPE_FILE: odebug << "Wellenreiter: Capturing from file '" << interface << "'" << oendl; break; 591 case DEVTYPE_FILE: odebug << "Wellenreiter: Capturing from file '" << interface << "'" << oendl; break;
592 default: assert( 0 ); // shouldn't reach this 592 default: assert( 0 ); // shouldn't reach this
593 } 593 }
594 594
595 // switch device into monitor mode 595 // switch device into monitor mode
596 if ( cardtype < DEVTYPE_FILE ) 596 if ( cardtype < DEVTYPE_FILE )
597 { 597 {
598 if ( cardtype != DEVTYPE_MANUAL ) 598 if ( cardtype != DEVTYPE_MANUAL )
599 iface->setMode( "monitor" ); 599 iface->setMode( "monitor" );
600 if ( iface->mode() != "monitor" ) 600 if ( iface->mode() != "monitor" )
601 { 601 {
602 if ( QMessageBox::warning( this, "Wellenreiter II", 602 if ( QMessageBox::warning( this, "Wellenreiter II",
603 tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) + 603 tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) +
604 tr( "\nContinue with limited functionality?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) 604 tr( "\nContinue with limited functionality?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No )
605 return; 605 return;
606 } 606 }
607 } 607 }
608 608
609 // open GPS device 609 // open GPS device
610 if ( configwindow->enableGPS->isChecked() ) 610 if ( configwindow->enableGPS->isChecked() )
611 { 611 {
612 odebug << "Wellenreiter:GPS enabled @ " << configwindow->gpsdHost->currentText() << ":" << configwindow->gpsdPort->value() << "" << oendl; 612 odebug << "Wellenreiter:GPS enabled @ " << configwindow->gpsdHost->currentText() << ":" << configwindow->gpsdPort->value() << "" << oendl;
613 gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); 613 gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() );
614 } 614 }
615 615
616 // open pcap and start sniffing 616 // open pcap and start sniffing
617 617
618 if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file? 618 if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file?
619 { 619 {
620 dumpname = configwindow->captureFileName->text(); 620 dumpname = configwindow->captureFileName->text();
621 if ( dumpname.isEmpty() ) dumpname = "captureFile"; 621 if ( dumpname.isEmpty() ) dumpname = "captureFile";
622 dumpname.append( '-' ); 622 dumpname.append( '-' );
623 dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); 623 dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) );
624 dumpname.append( ".wellenreiter" ); 624 dumpname.append( ".wellenreiter" );
625 } 625 }
626 626
627 if ( cardtype != DEVTYPE_FILE ) 627 if ( cardtype != DEVTYPE_FILE )
628 pcap->open( interface ); 628 pcap->open( interface );
629 else 629 else
630 pcap->openCaptureFile( interface ); 630 pcap->openCaptureFile( interface );
631 631
632 if ( configwindow->writeCaptureFile->isChecked() ) 632 if ( configwindow->writeCaptureFile->isChecked() )
633 { 633 {
634 odebug << "Wellenreiter:: dumping to " << dumpname << oendl; 634 odebug << "Wellenreiter:: dumping to " << dumpname << oendl;
635 pcap->openDumpFile( dumpname ); 635 pcap->openDumpFile( dumpname );
636 } 636 }
637 637
638 if ( !pcap->isOpen() ) 638 if ( !pcap->isOpen() )
639 { 639 {
640 QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg( 640 QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg(
641 cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) )); 641 cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) ));
642 return; 642 return;
643 } 643 }
644 644
645 // set capturer to non-blocking mode 645 // set capturer to non-blocking mode
646 pcap->setBlocking( false ); 646 pcap->setBlocking( false );
647 647
648 // start channel hopper 648 // start channel hopper
649 if ( cardtype != DEVTYPE_FILE ) 649 if ( cardtype != DEVTYPE_FILE )
650 { 650 {
651 logwindow->log( QString().sprintf( "(i) Starting channel hopper (d=%d ms)", configwindow->hopInterval->value() ) ); 651 logwindow->log( QString().sprintf( "(i) Starting channel hopper (d=%d ms)", configwindow->hopInterval->value() ) );
652 iface->setChannelHopping( configwindow->hopInterval->value() ); //use interval from config window 652 iface->setChannelHopping( configwindow->hopInterval->value() ); //use interval from config window
653 } 653 }
654 654
655 if ( cardtype != DEVTYPE_FILE ) 655 if ( cardtype != DEVTYPE_FILE )
656 { 656 {
657 // connect socket notifier and start channel hopper 657 // connect socket notifier and start channel hopper
658 connect( pcap, SIGNAL( receivedPacket(Opie::Net::OPacket*) ), this, SLOT( receivePacket(Opie::Net::OPacket*) ) ); 658 connect( pcap, SIGNAL( receivedPacket(Opie::Net::OPacket*) ), this, SLOT( receivePacket(Opie::Net::OPacket*) ) );
659 connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); 659 connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) );
660 } 660 }
661 else 661 else
662 { 662 {
663 // start timer for reading packets 663 // start timer for reading packets
664 startTimer( 100 ); 664 startTimer( 100 );
665 } 665 }
666 666
667 logwindow->log( "(i) Started Scanning." ); 667 logwindow->log( "(i) Started Scanning." );
668 sniffing = true; 668 sniffing = true;
669 669
670 #ifdef QWS 670 #ifdef QWS