author | ar <ar> | 2004-05-15 22:36:18 (UTC) |
---|---|---|
committer | ar <ar> | 2004-05-15 22:36:18 (UTC) |
commit | 736a153edfac343d0794ecafc5dc2f2c405260a7 (patch) (unidiff) | |
tree | ebb41331403fa78769df2a344bfe12bbd1df6c46 /noncore/settings/networksettings/wlan/wlanimp2.cpp | |
parent | d4a82558ff3ae6ed7bbc5dbc9857461057eb3da3 (diff) | |
download | opie-736a153edfac343d0794ecafc5dc2f2c405260a7.zip opie-736a153edfac343d0794ecafc5dc2f2c405260a7.tar.gz opie-736a153edfac343d0794ecafc5dc2f2c405260a7.tar.bz2 |
- convert qDebug to odebug
Diffstat (limited to 'noncore/settings/networksettings/wlan/wlanimp2.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanimp2.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/noncore/settings/networksettings/wlan/wlanimp2.cpp b/noncore/settings/networksettings/wlan/wlanimp2.cpp index 4294b12..d36a702 100644 --- a/noncore/settings/networksettings/wlan/wlanimp2.cpp +++ b/noncore/settings/networksettings/wlan/wlanimp2.cpp | |||
@@ -51,13 +51,13 @@ WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, W | |||
51 | interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, interfaces); | 51 | interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, interfaces); |
52 | tabWidget->insertTab(interfaceSetup, "TCP/IP"); | 52 | tabWidget->insertTab(interfaceSetup, "TCP/IP"); |
53 | 53 | ||
54 | // Check sanity - the existance of the wireless-tools if-pre-up script | 54 | // Check sanity - the existance of the wireless-tools if-pre-up script |
55 | QFile file(QString(PREUP)); | 55 | QFile file(QString(PREUP)); |
56 | if (file.exists()) { | 56 | if (file.exists()) { |
57 | owarn << QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools") << oendl; | 57 | owarn << QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools") << oendl; |
58 | } | 58 | } |
59 | 59 | ||
60 | connect( rescanButton, SIGNAL( clicked() ), this, SLOT( rescanNeighbourhood() ) ); | 60 | connect( rescanButton, SIGNAL( clicked() ), this, SLOT( rescanNeighbourhood() ) ); |
61 | connect( netView, SIGNAL( clicked(QListViewItem*) ), this, SLOT( selectNetwork(QListViewItem*) ) ); | 61 | connect( netView, SIGNAL( clicked(QListViewItem*) ), this, SLOT( selectNetwork(QListViewItem*) ) ); |
62 | netView->setColumnAlignment( col_chn, AlignCenter ); | 62 | netView->setColumnAlignment( col_chn, AlignCenter ); |
63 | netView->setItemMargin( 3 ); | 63 | netView->setItemMargin( 3 ); |
@@ -232,13 +232,13 @@ void WLANImp::writeOpts() { | |||
232 | if(!interfaces->isInterfaceSet()){ | 232 | if(!interfaces->isInterfaceSet()){ |
233 | QMessageBox::warning(0,"Inface not set","should not happen!!!"); | 233 | QMessageBox::warning(0,"Inface not set","should not happen!!!"); |
234 | return; | 234 | return; |
235 | } | 235 | } |
236 | bool error = false; | 236 | bool error = false; |
237 | 237 | ||
238 | odebug << "setting wlan interface " << interfaces->getInterfaceName( error ).latin1() << "" << oendl; | 238 | odebug << "setting wlan interface " << interfaces->getInterfaceName( error ).latin1() << "" << oendl; |
239 | 239 | ||
240 | if (error) QMessageBox::warning(0,"Inface not set","should not happen!!!"); | 240 | if (error) QMessageBox::warning(0,"Inface not set","should not happen!!!"); |
241 | 241 | ||
242 | interfaces->setInterfaceOption(QString("wireless_mode"), mode->currentText()); | 242 | interfaces->setInterfaceOption(QString("wireless_mode"), mode->currentText()); |
243 | interfaces->setInterfaceOption(QString("wireless_essid"), essid->currentText()); | 243 | interfaces->setInterfaceOption(QString("wireless_essid"), essid->currentText()); |
244 | 244 | ||
@@ -306,13 +306,13 @@ void WLANImp::writeOpts() { | |||
306 | * ... powered by Wellenreiter II technology (C) Michael 'Mickey' Lauer <mickeyl@handhelds.org> | 306 | * ... powered by Wellenreiter II technology (C) Michael 'Mickey' Lauer <mickeyl@handhelds.org> |
307 | */ | 307 | */ |
308 | 308 | ||
309 | void WLANImp::rescanNeighbourhood() | 309 | void WLANImp::rescanNeighbourhood() |
310 | { | 310 | { |
311 | QString name = interface->getInterfaceName(); | 311 | QString name = interface->getInterfaceName(); |
312 | odebug << "rescanNeighbourhood via '" << name << "'" << oendl; | 312 | odebug << "rescanNeighbourhood via '" << name << "'" << oendl; |
313 | 313 | ||
314 | OWirelessNetworkInterface* wiface = static_cast<OWirelessNetworkInterface*>( ONetwork::instance()->interface( name ) ); | 314 | OWirelessNetworkInterface* wiface = static_cast<OWirelessNetworkInterface*>( ONetwork::instance()->interface( name ) ); |
315 | assert( wiface ); | 315 | assert( wiface ); |
316 | 316 | ||
317 | // try to guess device type | 317 | // try to guess device type |
318 | QString devicetype; | 318 | QString devicetype; |
@@ -329,18 +329,18 @@ void WLANImp::rescanNeighbourhood() | |||
329 | else if ( line.contains( "prism" ) ) devicetype = "wlan-ng"; /* puke */ | 329 | else if ( line.contains( "prism" ) ) devicetype = "wlan-ng"; /* puke */ |
330 | else if ( line.contains( "orinoco" ) ) devicetype = "orinoco"; | 330 | else if ( line.contains( "orinoco" ) ) devicetype = "orinoco"; |
331 | } | 331 | } |
332 | } | 332 | } |
333 | if ( devicetype.isEmpty() ) | 333 | if ( devicetype.isEmpty() ) |
334 | { | 334 | { |
335 | owarn << "rescanNeighbourhood(): couldn't guess device type :(" << oendl; | 335 | owarn << "rescanNeighbourhood(): couldn't guess device type :(" << oendl; |
336 | return; | 336 | return; |
337 | } | 337 | } |
338 | else | 338 | else |
339 | { | 339 | { |
340 | odebug << "rescanNeighbourhood(): device type seems to be '" << devicetype << "'" << oendl; | 340 | odebug << "rescanNeighbourhood(): device type seems to be '" << devicetype << "'" << oendl; |
341 | } | 341 | } |
342 | 342 | ||
343 | // configure interface to receive 802.11 management frames | 343 | // configure interface to receive 802.11 management frames |
344 | 344 | ||
345 | wiface->setUp( true ); | 345 | wiface->setUp( true ); |
346 | wiface->setPromiscuousMode( true ); | 346 | wiface->setPromiscuousMode( true ); |
@@ -348,29 +348,29 @@ void WLANImp::rescanNeighbourhood() | |||
348 | if ( devicetype == "cisco" ) wiface->setMonitoring( new OCiscoMonitoringInterface( wiface, false ) ); | 348 | if ( devicetype == "cisco" ) wiface->setMonitoring( new OCiscoMonitoringInterface( wiface, false ) ); |
349 | else if ( devicetype == "hostap" ) wiface->setMonitoring( new OHostAPMonitoringInterface( wiface, false ) ); | 349 | else if ( devicetype == "hostap" ) wiface->setMonitoring( new OHostAPMonitoringInterface( wiface, false ) ); |
350 | else if ( devicetype == "wlan-ng" ) wiface->setMonitoring( new OWlanNGMonitoringInterface( wiface, false ) ); | 350 | else if ( devicetype == "wlan-ng" ) wiface->setMonitoring( new OWlanNGMonitoringInterface( wiface, false ) ); |
351 | else if ( devicetype == "orinoco" ) wiface->setMonitoring( new OOrinocoMonitoringInterface( wiface, false ) ); | 351 | else if ( devicetype == "orinoco" ) wiface->setMonitoring( new OOrinocoMonitoringInterface( wiface, false ) ); |
352 | else | 352 | else |
353 | { | 353 | { |
354 | odebug << "rescanNeighbourhood(): unsupported device type for monitoring :(" << oendl; | 354 | odebug << "rescanNeighbourhood(): unsupported device type for monitoring :(" << oendl; |
355 | return; | 355 | return; |
356 | } | 356 | } |
357 | 357 | ||
358 | wiface->setMode( "monitor" ); | 358 | wiface->setMode( "monitor" ); |
359 | if ( wiface->mode() != "monitor" ) | 359 | if ( wiface->mode() != "monitor" ) |
360 | { | 360 | { |
361 | owarn << "rescanNeighbourhood(): Unable to bring device into monitor mode (" << strerror( errno ) << ")." << oendl; | 361 | owarn << "rescanNeighbourhood(): Unable to bring device into monitor mode (" << strerror( errno ) << ")." << oendl; |
362 | return; | 362 | return; |
363 | } | 363 | } |
364 | 364 | ||
365 | // open a packet capturer | 365 | // open a packet capturer |
366 | OPacketCapturer* cap = new OPacketCapturer(); | 366 | OPacketCapturer* cap = new OPacketCapturer(); |
367 | cap->open( name ); | 367 | cap->open( name ); |
368 | if ( !cap->isOpen() ) | 368 | if ( !cap->isOpen() ) |
369 | { | 369 | { |
370 | owarn << "rescanNeighbourhood(): Unable to open libpcap (" << strerror( errno ) << ")." << oendl; | 370 | owarn << "rescanNeighbourhood(): Unable to open libpcap (" << strerror( errno ) << ")." << oendl; |
371 | return; | 371 | return; |
372 | } | 372 | } |
373 | 373 | ||
374 | // display splash screen | 374 | // display splash screen |
375 | QFrame* splash = new QFrame( this, "splash", false, WStyle_StaysOnTop | WStyle_DialogBorder | WStyle_Customize ); | 375 | QFrame* splash = new QFrame( this, "splash", false, WStyle_StaysOnTop | WStyle_DialogBorder | WStyle_Customize ); |
376 | splash->setLineWidth( 2 ); | 376 | splash->setLineWidth( 2 ); |
@@ -397,21 +397,21 @@ void WLANImp::rescanNeighbourhood() | |||
397 | 397 | ||
398 | for ( int i = 1; i <= wiface->channels(); ++i ) | 398 | for ( int i = 1; i <= wiface->channels(); ++i ) |
399 | { | 399 | { |
400 | wiface->setChannel( i ); | 400 | wiface->setChannel( i ); |
401 | pb->setProgress( i ); | 401 | pb->setProgress( i ); |
402 | qApp->processEvents(); | 402 | qApp->processEvents(); |
403 | odebug << "rescanNeighbourhood(): listening on channel " << i << "..." << oendl; | 403 | odebug << "rescanNeighbourhood(): listening on channel " << i << "..." << oendl; |
404 | OPacket* p = cap->next( 1000 ); | 404 | OPacket* p = cap->next( 1000 ); |
405 | if ( !p ) | 405 | if ( !p ) |
406 | { | 406 | { |
407 | odebug << "rescanNeighbourhood(): nothing received on channel " << i << "" << oendl; | 407 | odebug << "rescanNeighbourhood(): nothing received on channel " << i << "" << oendl; |
408 | } | 408 | } |
409 | else | 409 | else |
410 | { | 410 | { |
411 | odebug << "rescanNeighbourhood(): TADAA - something came in on channel " << i << "" << oendl; | 411 | odebug << "rescanNeighbourhood(): TADAA - something came in on channel " << i << "" << oendl; |
412 | handlePacket( p ); | 412 | handlePacket( p ); |
413 | } | 413 | } |
414 | } | 414 | } |
415 | 415 | ||
416 | cap->close(); | 416 | cap->close(); |
417 | wiface->setMode( "managed" ); // TODO: use previous mode | 417 | wiface->setMode( "managed" ); // TODO: use previous mode |
@@ -438,13 +438,13 @@ void WLANImp::handlePacket( OPacket* p ) | |||
438 | else if ( beacon->canESS() ) | 438 | else if ( beacon->canESS() ) |
439 | { | 439 | { |
440 | type = "managed"; | 440 | type = "managed"; |
441 | } | 441 | } |
442 | else | 442 | else |
443 | { | 443 | { |
444 | owarn << "handlePacket(): invalid frame [possibly noise] detected!" << oendl; | 444 | owarn << "handlePacket(): invalid frame [possibly noise] detected!" << oendl; |
445 | return; | 445 | return; |
446 | } | 446 | } |
447 | 447 | ||
448 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); | 448 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); |
449 | QString essid = ssid ? ssid->ID() : QString("<unknown>"); | 449 | QString essid = ssid ? ssid->ID() : QString("<unknown>"); |
450 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); | 450 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); |
@@ -455,15 +455,14 @@ void WLANImp::handlePacket( OPacket* p ) | |||
455 | } | 455 | } |
456 | 456 | ||
457 | 457 | ||
458 | void WLANImp::displayFoundNetwork( const QString& mode, int channel, const QString& ssid, const OMacAddress& mac ) | 458 | void WLANImp::displayFoundNetwork( const QString& mode, int channel, const QString& ssid, const OMacAddress& mac ) |
459 | { | 459 | { |
460 | 460 | ||
461 | qDebug( "found network: <%s>, chn %d, ssid '%s', mac '%s'", (const char*) mode, channel, | 461 | odebug << "found network: <" << (const char*) mode << ">, chn " << channel |
462 | (const char*) ssid, | 462 | << ", ssid '" << (const char*) ssid << "', mac '" << (const char*) mac.toString() << "'" << oendl; |
463 | (const char*) mac.toString() ); | ||
464 | 463 | ||
465 | QListViewItemIterator it( netView ); | 464 | QListViewItemIterator it( netView ); |
466 | while ( it.current() && it.current()->text( col_ssid ) != ssid ) ++it; | 465 | while ( it.current() && it.current()->text( col_ssid ) != ssid ) ++it; |
467 | if ( !it.current() ) // ssid didn't show up yet | 466 | if ( !it.current() ) // ssid didn't show up yet |
468 | { | 467 | { |
469 | QListViewItem* item = new QListViewItem( netView, mode.left( 1 ).upper(), ssid, QString::number( channel ), mac.toString() ); | 468 | QListViewItem* item = new QListViewItem( netView, mode.left( 1 ).upper(), ssid, QString::number( channel ), mac.toString() ); |