author | mickeyl <mickeyl> | 2003-10-28 16:39:26 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-10-28 16:39:26 (UTC) |
commit | 5acd7ce51829c317f6218ff059d0d2f63cdb0871 (patch) (unidiff) | |
tree | 8db30d3910ebd8c6936ea4aaa35b03da1faa2f1e | |
parent | 877bc5c756d94db71a745596dd7e48104a2ec9a1 (diff) | |
download | opie-5acd7ce51829c317f6218ff059d0d2f63cdb0871.zip opie-5acd7ce51829c317f6218ff059d0d2f63cdb0871.tar.gz opie-5acd7ce51829c317f6218ff059d0d2f63cdb0871.tar.bz2 |
catch up with API changes in libopienet
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 60bf231..365efb0 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -331,214 +331,214 @@ void Wellenreiter::receivePacket( OPacket* p ) | |||
331 | // check if we received a beacon frame | 331 | // check if we received a beacon frame |
332 | OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( childIfToParse( p, "802.11 Management" ) ); | 332 | OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( childIfToParse( p, "802.11 Management" ) ); |
333 | if ( beacon && beacon->managementType() == "Beacon" ) | 333 | if ( beacon && beacon->managementType() == "Beacon" ) |
334 | { | 334 | { |
335 | handleBeacon( p, beacon ); | 335 | handleBeacon( p, beacon ); |
336 | return; | 336 | return; |
337 | } | 337 | } |
338 | 338 | ||
339 | OMacAddress source; | 339 | OMacAddress source; |
340 | OMacAddress dest; | 340 | OMacAddress dest; |
341 | 341 | ||
342 | //TODO: WEP check here | 342 | //TODO: WEP check here |
343 | 343 | ||
344 | // check for a wireless data frame | 344 | // check for a wireless data frame |
345 | OWaveLanDataPacket* wlan = static_cast<OWaveLanDataPacket*>( childIfToParse( p, "802.11 Data" ) ); | 345 | OWaveLanDataPacket* wlan = static_cast<OWaveLanDataPacket*>( childIfToParse( p, "802.11 Data" ) ); |
346 | if ( wlan ) | 346 | if ( wlan ) |
347 | { | 347 | { |
348 | handleWlanData( p, wlan, source, dest ); | 348 | handleWlanData( p, wlan, source, dest ); |
349 | } | 349 | } |
350 | 350 | ||
351 | // check for a wired data frame | 351 | // check for a wired data frame |
352 | OEthernetPacket* eth = static_cast<OEthernetPacket*>( childIfToParse( p, "Ethernet" ) ); | 352 | OEthernetPacket* eth = static_cast<OEthernetPacket*>( childIfToParse( p, "Ethernet" ) ); |
353 | if ( eth ) | 353 | if ( eth ) |
354 | { | 354 | { |
355 | handleEthernetData( p, eth, source, dest ); | 355 | handleEthernetData( p, eth, source, dest ); |
356 | } | 356 | } |
357 | 357 | ||
358 | // check for an arp frame since arp frames come in two flavours: | 358 | // check for an arp frame since arp frames come in two flavours: |
359 | // 802.11 encapsulates ARP data within IP packets while wired ethernet doesn't. | 359 | // 802.11 encapsulates ARP data within IP packets while wired ethernet doesn't. |
360 | OARPPacket* arp = static_cast<OARPPacket*>( childIfToParse( p, "ARP" ) ); | 360 | OARPPacket* arp = static_cast<OARPPacket*>( childIfToParse( p, "ARP" ) ); |
361 | if ( arp ) | 361 | if ( arp ) |
362 | { | 362 | { |
363 | handleARPData( p, arp, source, dest ); | 363 | handleARPData( p, arp, source, dest ); |
364 | } | 364 | } |
365 | 365 | ||
366 | // check for a ip frame | 366 | // check for a ip frame |
367 | OIPPacket* ip = static_cast<OIPPacket*>( childIfToParse( p, "IP" ) ); | 367 | OIPPacket* ip = static_cast<OIPPacket*>( childIfToParse( p, "IP" ) ); |
368 | if ( ip ) | 368 | if ( ip ) |
369 | { | 369 | { |
370 | handleIPData( p, ip, source, dest ); | 370 | handleIPData( p, ip, source, dest ); |
371 | } | 371 | } |
372 | 372 | ||
373 | //handleNotification( p ); | 373 | //handleNotification( p ); |
374 | 374 | ||
375 | } | 375 | } |
376 | 376 | ||
377 | 377 | ||
378 | void Wellenreiter::stopClicked() | 378 | void Wellenreiter::stopClicked() |
379 | { | 379 | { |
380 | if ( iface ) | 380 | if ( iface ) |
381 | { | 381 | { |
382 | disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); | 382 | disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); |
383 | disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | 383 | disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); |
384 | iface->setChannelHopping(); // stop hopping channels | 384 | iface->setChannelHopping(); // stop hopping channels |
385 | } | 385 | } |
386 | else | 386 | else |
387 | killTimers(); | 387 | killTimers(); |
388 | 388 | ||
389 | pcap->close(); | 389 | pcap->close(); |
390 | sniffing = false; | 390 | sniffing = false; |
391 | 391 | ||
392 | if ( iface ) | 392 | if ( iface ) |
393 | { | 393 | { |
394 | // switch off monitor mode | 394 | // switch off monitor mode |
395 | iface->setMonitorMode( false ); | 395 | iface->setMode( "managed" ); |
396 | // switch off promisc flag | 396 | // switch off promisc flag |
397 | iface->setPromiscuousMode( false ); | 397 | iface->setPromiscuousMode( false ); |
398 | 398 | ||
399 | system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess | 399 | system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess |
400 | } | 400 | } |
401 | 401 | ||
402 | logwindow->log( "(i) Stopped Scanning." ); | 402 | logwindow->log( "(i) Stopped Scanning." ); |
403 | assert( parent() ); | 403 | assert( parent() ); |
404 | ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); | 404 | ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); |
405 | 405 | ||
406 | // message the user | 406 | // message the user |
407 | QMessageBox::information( this, "Wellenreiter II", | 407 | QMessageBox::information( this, "Wellenreiter II", |
408 | tr( "Your wireless card\nshould now be usable again." ) ); | 408 | tr( "Your wireless card\nshould now be usable again." ) ); |
409 | 409 | ||
410 | sniffing = false; | 410 | sniffing = false; |
411 | emit( stoppedSniffing() ); | 411 | emit( stoppedSniffing() ); |
412 | 412 | ||
413 | #ifdef QWS | 413 | #ifdef QWS |
414 | if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() ) | 414 | if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() ) |
415 | { | 415 | { |
416 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | 416 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; |
417 | } | 417 | } |
418 | #else | 418 | #else |
419 | #warning FIXME: setScreenSaverMode is not operational on the X11 build | 419 | #warning FIXME: setScreenSaverMode is not operational on the X11 build |
420 | #endif | 420 | #endif |
421 | 421 | ||
422 | // print out statistics | 422 | // print out statistics |
423 | for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) | 423 | for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) |
424 | statwindow->updateCounter( it.key(), it.data() ); | 424 | statwindow->updateCounter( it.key(), it.data() ); |
425 | } | 425 | } |
426 | 426 | ||
427 | 427 | ||
428 | void Wellenreiter::startClicked() | 428 | void Wellenreiter::startClicked() |
429 | { | 429 | { |
430 | // get configuration from config window | 430 | // get configuration from config window |
431 | 431 | ||
432 | const QString& interface = configwindow->interfaceName->currentText(); | 432 | const QString& interface = configwindow->interfaceName->currentText(); |
433 | const int cardtype = configwindow->driverType(); | 433 | const int cardtype = configwindow->driverType(); |
434 | const int interval = configwindow->hoppingInterval(); | 434 | const int interval = configwindow->hoppingInterval(); |
435 | 435 | ||
436 | if ( ( interface == "" ) || ( cardtype == 0 ) ) | 436 | if ( ( interface == "" ) || ( cardtype == 0 ) ) |
437 | { | 437 | { |
438 | QMessageBox::information( this, "Wellenreiter II", | 438 | QMessageBox::information( this, "Wellenreiter II", |
439 | tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); | 439 | tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); |
440 | return; | 440 | return; |
441 | } | 441 | } |
442 | 442 | ||
443 | // configure device | 443 | // configure device |
444 | ONetwork* net = ONetwork::instance(); | 444 | ONetwork* net = ONetwork::instance(); |
445 | 445 | ||
446 | // TODO: check if interface is wireless and support sniffing for non-wireless interfaces | 446 | // TODO: check if interface is wireless and support sniffing for non-wireless interfaces |
447 | 447 | ||
448 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); // fails if network is not wireless! | 448 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); // fails if network is not wireless! |
449 | 449 | ||
450 | // bring device UP | 450 | // bring device UP |
451 | if ( cardtype != DEVTYPE_FILE ) | 451 | if ( cardtype != DEVTYPE_FILE ) |
452 | { | 452 | { |
453 | iface->setUp( true ); | 453 | iface->setUp( true ); |
454 | if ( !iface->isUp() ) | 454 | if ( !iface->isUp() ) |
455 | { | 455 | { |
456 | QMessageBox::warning( this, "Wellenreiter II", | 456 | QMessageBox::warning( this, "Wellenreiter II", |
457 | tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) ); | 457 | tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) ); |
458 | return; | 458 | return; |
459 | } | 459 | } |
460 | } | 460 | } |
461 | // set monitor mode | 461 | // set monitor mode |
462 | bool usePrism = configwindow->usePrismHeader(); | 462 | bool usePrism = configwindow->usePrismHeader(); |
463 | 463 | ||
464 | switch ( cardtype ) | 464 | switch ( cardtype ) |
465 | { | 465 | { |
466 | case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; | 466 | case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; |
467 | case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; | 467 | case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; |
468 | case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; | 468 | case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; |
469 | case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; | 469 | case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; |
470 | case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; | 470 | case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; |
471 | case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; | 471 | case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; |
472 | default: assert( 0 ); // shouldn't reach this | 472 | default: assert( 0 ); // shouldn't reach this |
473 | } | 473 | } |
474 | 474 | ||
475 | // switch device into monitor mode | 475 | // switch device into monitor mode |
476 | if ( cardtype < DEVTYPE_FILE ) | 476 | if ( cardtype < DEVTYPE_FILE ) |
477 | { | 477 | { |
478 | if ( cardtype != DEVTYPE_MANUAL ) | 478 | if ( cardtype != DEVTYPE_MANUAL ) |
479 | iface->setMonitorMode( true ); | 479 | iface->setMode( "monitor" ); |
480 | if ( !iface->monitorMode() ) | 480 | if ( iface->mode() != "monitor" ) |
481 | { | 481 | { |
482 | if ( QMessageBox::warning( this, "Wellenreiter II", | 482 | if ( QMessageBox::warning( this, "Wellenreiter II", |
483 | tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) + | 483 | tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) + |
484 | tr( "\nContinue with limited functionality?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) | 484 | tr( "\nContinue with limited functionality?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) |
485 | return; | 485 | return; |
486 | } | 486 | } |
487 | } | 487 | } |
488 | 488 | ||
489 | // open GPS device | 489 | // open GPS device |
490 | if ( configwindow->enableGPS->isChecked() ) | 490 | if ( configwindow->enableGPS->isChecked() ) |
491 | { | 491 | { |
492 | qDebug( "Wellenreiter:GPS enabled @ %s:%d", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); | 492 | qDebug( "Wellenreiter:GPS enabled @ %s:%d", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); |
493 | gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); | 493 | gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); |
494 | } | 494 | } |
495 | 495 | ||
496 | // open pcap and start sniffing | 496 | // open pcap and start sniffing |
497 | if ( cardtype != DEVTYPE_FILE ) | 497 | if ( cardtype != DEVTYPE_FILE ) |
498 | { | 498 | { |
499 | pcap->open( interface ); | 499 | pcap->open( interface ); |
500 | 500 | ||
501 | if ( configwindow->writeCaptureFile->isChecked() ) | 501 | if ( configwindow->writeCaptureFile->isChecked() ) |
502 | { | 502 | { |
503 | QString dumpname( configwindow->captureFileName->text() ); | 503 | QString dumpname( configwindow->captureFileName->text() ); |
504 | if ( dumpname.isEmpty() ) dumpname = "captureFile"; | 504 | if ( dumpname.isEmpty() ) dumpname = "captureFile"; |
505 | dumpname.append( '-' ); | 505 | dumpname.append( '-' ); |
506 | dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); | 506 | dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); |
507 | dumpname.append( ".wellenreiter" ); | 507 | dumpname.append( ".wellenreiter" ); |
508 | pcap->openDumpFile( dumpname ); | 508 | pcap->openDumpFile( dumpname ); |
509 | } | 509 | } |
510 | else | 510 | else |
511 | { | 511 | { |
512 | pcap->open( interface ); | 512 | pcap->open( interface ); |
513 | } | 513 | } |
514 | } | 514 | } |
515 | else | 515 | else |
516 | { | 516 | { |
517 | pcap->open( QFile( interface ) ); | 517 | pcap->open( QFile( interface ) ); |
518 | } | 518 | } |
519 | 519 | ||
520 | if ( !pcap->isOpen() ) | 520 | if ( !pcap->isOpen() ) |
521 | { | 521 | { |
522 | QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg( | 522 | QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg( |
523 | cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) )); | 523 | cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) )); |
524 | return; | 524 | return; |
525 | } | 525 | } |
526 | 526 | ||
527 | // set capturer to non-blocking mode | 527 | // set capturer to non-blocking mode |
528 | pcap->setBlocking( false ); | 528 | pcap->setBlocking( false ); |
529 | 529 | ||
530 | // start channel hopper | 530 | // start channel hopper |
531 | if ( cardtype != DEVTYPE_FILE ) | 531 | if ( cardtype != DEVTYPE_FILE ) |
532 | { | 532 | { |
533 | logwindow->log( QString().sprintf( "(i) Starting channel hopper (d=%d ms)", configwindow->hopInterval->value() ) ); | 533 | logwindow->log( QString().sprintf( "(i) Starting channel hopper (d=%d ms)", configwindow->hopInterval->value() ) ); |
534 | iface->setChannelHopping( configwindow->hopInterval->value() ); //use interval from config window | 534 | iface->setChannelHopping( configwindow->hopInterval->value() ); //use interval from config window |
535 | } | 535 | } |
536 | 536 | ||
537 | if ( cardtype != DEVTYPE_FILE ) | 537 | if ( cardtype != DEVTYPE_FILE ) |
538 | { | 538 | { |
539 | // connect socket notifier and start channel hopper | 539 | // connect socket notifier and start channel hopper |
540 | connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); | 540 | connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); |
541 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | 541 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); |
542 | } | 542 | } |
543 | else | 543 | else |
544 | { | 544 | { |