author | mickeyl <mickeyl> | 2003-10-28 19:13:34 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-10-28 19:13:34 (UTC) |
commit | d5d9b307e950d9038215e4d63e64bc9cd5d85352 (patch) (unidiff) | |
tree | ccef170352625a48c9c7ff0e7ff119f8d23e2331 /noncore | |
parent | 5acd7ce51829c317f6218ff059d0d2f63cdb0871 (diff) | |
download | opie-d5d9b307e950d9038215e4d63e64bc9cd5d85352.zip opie-d5d9b307e950d9038215e4d63e64bc9cd5d85352.tar.gz opie-d5d9b307e950d9038215e4d63e64bc9cd5d85352.tar.bz2 |
catch up with API changes in libopienet
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanimp2.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/settings/networksettings/wlan/wlanimp2.cpp b/noncore/settings/networksettings/wlan/wlanimp2.cpp index 7ce096f..e7d6ff5 100644 --- a/noncore/settings/networksettings/wlan/wlanimp2.cpp +++ b/noncore/settings/networksettings/wlan/wlanimp2.cpp | |||
@@ -330,50 +330,50 @@ void WLANImp::rescanNeighbourhood() | |||
330 | { | 330 | { |
331 | qWarning( "rescanNeighbourhood(): couldn't guess device type :(" ); | 331 | qWarning( "rescanNeighbourhood(): couldn't guess device type :(" ); |
332 | return; | 332 | return; |
333 | } | 333 | } |
334 | else | 334 | else |
335 | { | 335 | { |
336 | qDebug( "rescanNeighbourhood(): device type seems to be '%s'", (const char*) devicetype ); | 336 | qDebug( "rescanNeighbourhood(): device type seems to be '%s'", (const char*) devicetype ); |
337 | } | 337 | } |
338 | 338 | ||
339 | // configure interface to receive 802.11 management frames | 339 | // configure interface to receive 802.11 management frames |
340 | 340 | ||
341 | wiface->setUp( true ); | 341 | wiface->setUp( true ); |
342 | wiface->setPromiscuousMode( true ); | 342 | wiface->setPromiscuousMode( true ); |
343 | 343 | ||
344 | if ( devicetype == "cisco" ) wiface->setMonitoring( new OCiscoMonitoringInterface( wiface, false ) ); | 344 | if ( devicetype == "cisco" ) wiface->setMonitoring( new OCiscoMonitoringInterface( wiface, false ) ); |
345 | else if ( devicetype == "hostap" ) wiface->setMonitoring( new OHostAPMonitoringInterface( wiface, false ) ); | 345 | else if ( devicetype == "hostap" ) wiface->setMonitoring( new OHostAPMonitoringInterface( wiface, false ) ); |
346 | else if ( devicetype == "wlan-ng" ) wiface->setMonitoring( new OWlanNGMonitoringInterface( wiface, false ) ); | 346 | else if ( devicetype == "wlan-ng" ) wiface->setMonitoring( new OWlanNGMonitoringInterface( wiface, false ) ); |
347 | else if ( devicetype == "orinoco" ) wiface->setMonitoring( new OOrinocoMonitoringInterface( wiface, false ) ); | 347 | else if ( devicetype == "orinoco" ) wiface->setMonitoring( new OOrinocoMonitoringInterface( wiface, false ) ); |
348 | else | 348 | else |
349 | { | 349 | { |
350 | qDebug( "rescanNeighbourhood(): unsupported device type for monitoring :(" ); | 350 | qDebug( "rescanNeighbourhood(): unsupported device type for monitoring :(" ); |
351 | return; | 351 | return; |
352 | } | 352 | } |
353 | 353 | ||
354 | wiface->setMonitorMode( true ); | 354 | wiface->setMode( "monitor" ); |
355 | if ( !wiface->monitorMode() ) | 355 | if ( wiface->mode() != "monitor" ) |
356 | { | 356 | { |
357 | qWarning( "rescanNeighbourhood(): Unable to bring device into monitor mode (%s).", strerror( errno ) ); | 357 | qWarning( "rescanNeighbourhood(): Unable to bring device into monitor mode (%s).", strerror( errno ) ); |
358 | return; | 358 | return; |
359 | } | 359 | } |
360 | 360 | ||
361 | // open a packet capturer | 361 | // open a packet capturer |
362 | OPacketCapturer* cap = new OPacketCapturer(); | 362 | OPacketCapturer* cap = new OPacketCapturer(); |
363 | cap->open( name ); | 363 | cap->open( name ); |
364 | if ( !cap->isOpen() ) | 364 | if ( !cap->isOpen() ) |
365 | { | 365 | { |
366 | qWarning( "rescanNeighbourhood(): Unable to open libpcap (%s).", strerror( errno ) ); | 366 | qWarning( "rescanNeighbourhood(): Unable to open libpcap (%s).", strerror( errno ) ); |
367 | return; | 367 | return; |
368 | } | 368 | } |
369 | 369 | ||
370 | // display splash screen | 370 | // display splash screen |
371 | QFrame* splash = new QFrame( this, "splash", false, WStyle_StaysOnTop | WStyle_DialogBorder | WStyle_Customize ); | 371 | QFrame* splash = new QFrame( this, "splash", false, WStyle_StaysOnTop | WStyle_DialogBorder | WStyle_Customize ); |
372 | splash->setLineWidth( 2 ); | 372 | splash->setLineWidth( 2 ); |
373 | splash->setFrameStyle( QFrame::Panel | QFrame::Raised ); | 373 | splash->setFrameStyle( QFrame::Panel | QFrame::Raised ); |
374 | QVBoxLayout* vbox = new QVBoxLayout( splash, 4, 4 ); | 374 | QVBoxLayout* vbox = new QVBoxLayout( splash, 4, 4 ); |
375 | QLabel* lab = new QLabel( "<center><b>Scanning...</b><br>Please Wait...</center>", splash ); | 375 | QLabel* lab = new QLabel( "<center><b>Scanning...</b><br>Please Wait...</center>", splash ); |
376 | QProgressBar* pb = new QProgressBar( wiface->channels(), splash ); | 376 | QProgressBar* pb = new QProgressBar( wiface->channels(), splash ); |
377 | vbox->addWidget( lab ); | 377 | vbox->addWidget( lab ); |
378 | vbox->addWidget( pb ); | 378 | vbox->addWidget( pb ); |
379 | pb->setCenterIndicator( true ); | 379 | pb->setCenterIndicator( true ); |
@@ -389,50 +389,50 @@ void WLANImp::rescanNeighbourhood() | |||
389 | qApp->processEvents(); | 389 | qApp->processEvents(); |
390 | 390 | ||
391 | // set capturer to non-blocking mode | 391 | // set capturer to non-blocking mode |
392 | cap->setBlocking( false ); | 392 | cap->setBlocking( false ); |
393 | 393 | ||
394 | for ( int i = 1; i <= wiface->channels(); ++i ) | 394 | for ( int i = 1; i <= wiface->channels(); ++i ) |
395 | { | 395 | { |
396 | wiface->setChannel( i ); | 396 | wiface->setChannel( i ); |
397 | pb->setProgress( i ); | 397 | pb->setProgress( i ); |
398 | qApp->processEvents(); | 398 | qApp->processEvents(); |
399 | qDebug( "rescanNeighbourhood(): listening on channel %d...", i ); | 399 | qDebug( "rescanNeighbourhood(): listening on channel %d...", i ); |
400 | OPacket* p = cap->next( 1000 ); | 400 | OPacket* p = cap->next( 1000 ); |
401 | if ( !p ) | 401 | if ( !p ) |
402 | { | 402 | { |
403 | qDebug( "rescanNeighbourhood(): nothing received on channel %d", i ); | 403 | qDebug( "rescanNeighbourhood(): nothing received on channel %d", i ); |
404 | } | 404 | } |
405 | else | 405 | else |
406 | { | 406 | { |
407 | qDebug( "rescanNeighbourhood(): TADAA - something came in on channel %d", i ); | 407 | qDebug( "rescanNeighbourhood(): TADAA - something came in on channel %d", i ); |
408 | handlePacket( p ); | 408 | handlePacket( p ); |
409 | } | 409 | } |
410 | } | 410 | } |
411 | 411 | ||
412 | cap->close(); | 412 | cap->close(); |
413 | wiface->setMonitorMode( false ); | 413 | wiface->setMode( "managed" ); // TODO: use previous mode |
414 | wiface->setPromiscuousMode( true ); | 414 | wiface->setPromiscuousMode( false ); |
415 | 415 | ||
416 | splash->hide(); | 416 | splash->hide(); |
417 | delete splash; | 417 | delete splash; |
418 | 418 | ||
419 | } | 419 | } |
420 | 420 | ||
421 | void WLANImp::handlePacket( OPacket* p ) | 421 | void WLANImp::handlePacket( OPacket* p ) |
422 | { | 422 | { |
423 | 423 | ||
424 | // check if we received a beacon frame | 424 | // check if we received a beacon frame |
425 | OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); | 425 | OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); |
426 | if ( beacon && beacon->managementType() == "Beacon" ) | 426 | if ( beacon && beacon->managementType() == "Beacon" ) |
427 | { | 427 | { |
428 | 428 | ||
429 | QString type; | 429 | QString type; |
430 | if ( beacon->canIBSS() ) | 430 | if ( beacon->canIBSS() ) |
431 | { | 431 | { |
432 | type = "adhoc"; | 432 | type = "adhoc"; |
433 | } | 433 | } |
434 | else if ( beacon->canESS() ) | 434 | else if ( beacon->canESS() ) |
435 | { | 435 | { |
436 | type = "managed"; | 436 | type = "managed"; |
437 | } | 437 | } |
438 | else | 438 | else |