-rw-r--r-- | libopie2/opienet/onetwork.cpp | 128 |
1 files changed, 68 insertions, 60 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index 6a9280f..d918193 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp @@ -23,24 +23,25 @@ -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* OPIE */ #include <opie2/onetwork.h> #include <opie2/ostation.h> +#include <opie2/odebug.h>
/* QT */ #include <qfile.h> #include <qtextstream.h> /* UNIX */ #include <assert.h> #include <arpa/inet.h> #include <errno.h> #include <string.h> @@ -58,58 +59,58 @@ #include <opie2/odebugmapper.h> DebugMapper* debugmapper = new DebugMapper(); #endif /*====================================================================================== * ONetwork *======================================================================================*/ ONetwork* ONetwork::_instance = 0; ONetwork::ONetwork() { - qDebug( "ONetwork::ONetwork()" ); - qDebug( "ONetwork: This code has been compiled against Wireless Extensions V%d", WIRELESS_EXT ); + odebug << "ONetwork::ONetwork()" << oendl;
+ odebug << "ONetwork: This code has been compiled against Wireless Extensions V" << WIRELESS_EXT << oendl;
synchronize(); } void ONetwork::synchronize() { // gather available interfaces by inspecting /proc/net/dev //FIXME: we could use SIOCGIFCONF here, but we aren't interested in virtual (e.g. eth0:0) devices //FIXME: Use SIOCGIFCONF anway, because we can disable listing of aliased devices //FIXME: Best is use SIOCGIFCONF and if this doesn't work (result=-1), then fallback to parsing /proc/net/dev _interfaces.clear(); QString str; QFile f( "/proc/net/dev" ); bool hasFile = f.open( IO_ReadOnly ); if ( !hasFile ) { - qDebug( "ONetwork: /proc/net/dev not existing. No network devices available" ); + odebug << "ONetwork: /proc/net/dev not existing. No network devices available" << oendl;
return; } QTextStream s( &f ); s.readLine(); s.readLine(); while ( !s.atEnd() ) { s >> str; str.truncate( str.find( ':' ) ); - qDebug( "ONetwork: found interface '%s'", (const char*) str ); + odebug << "ONetwork: found interface '" << str << "'" << oendl;
ONetworkInterface* iface; if ( isWirelessInterface( str ) ) { iface = new OWirelessNetworkInterface( this, (const char*) str ); - qDebug( "ONetwork: interface '%s' has Wireless Extensions", (const char*) str ); + odebug << "ONetwork: interface '" << str << "' has Wireless Extensions" << oendl;
} else { iface = new ONetworkInterface( this, (const char*) str ); } _interfaces.insert( str, iface ); s.readLine(); } } short ONetwork::wirelessExtensionVersion() @@ -152,57 +153,59 @@ bool ONetwork::isWirelessInterface( const char* name ) const int result = ::ioctl( sfd, SIOCGIWNAME, &iwr ); return result != -1; } /*====================================================================================== * ONetworkInterface *======================================================================================*/ ONetworkInterface::ONetworkInterface( QObject* parent, const char* name ) :QObject( parent, name ), _sfd( socket( AF_INET, SOCK_DGRAM, 0 ) ), _mon( 0 ) { - qDebug( "ONetworkInterface::ONetworkInterface()" ); + odebug << "ONetworkInterface::ONetworkInterface()" << oendl;
init(); } struct ifreq& ONetworkInterface::ifr() const { return _ifr; } void ONetworkInterface::init() { - qDebug( "ONetworkInterface::init()" ); + odebug << "ONetworkInterface::init()" << oendl;
memset( &_ifr, 0, sizeof( struct ifreq ) ); if ( _sfd == -1 ) { - qDebug( "ONetworkInterface::init(): Warning - can't get socket for device '%s'", name() ); + odebug << "ONetworkInterface::init(): Warning - can't get socket for device '" << name() << "'" << oendl;
return; } } bool ONetworkInterface::ioctl( int call, struct ifreq& ifreq ) const { #ifndef NODEBUG int result = ::ioctl( _sfd, call, &ifreq ); if ( result == -1 ) - qDebug( "ONetworkInterface::ioctl (%s) call %s (0x%04X) - Status: Failed: %d (%s)", name(), (const char*) debugmapper->map( call ), call, result, strerror( errno ) ); + odebug << "ONetworkInterface::ioctl (" << name() << ") call '" << debugmapper->map( call )
+ << "' FAILED! " << result << " (" << strerror( errno ) << ")" << oendl;
else - qDebug( "ONetworkInterface::ioctl (%s) call %s (0x%04X) - Status: Ok.", name(), (const char*) debugmapper->map( call ), call ); + odebug << "ONetworkInterface::ioctl (" << name() << ") call '" << debugmapper->map( call )
+ << "' - Status: Ok." << oendl;
return ( result != -1 ); #else return ::ioctl( _sfd, call, &ifreq ) != -1; #endif } bool ONetworkInterface::ioctl( int call ) const { strcpy( _ifr.ifr_name, name() ); return ioctl( call, _ifr ); } @@ -306,37 +309,37 @@ int ONetworkInterface::dataLinkType() const return _ifr.ifr_hwaddr.sa_family; } else { return -1; } } void ONetworkInterface::setMonitoring( OMonitoringInterface* m ) { _mon = m; - qDebug( "ONetwork::setMonitoring(): Installed monitoring driver '%s' on interface '%s'", (const char*) m->name(), name() ); + odebug << "ONetwork::setMonitoring(): Installed monitoring driver '" << m->name() << "' on interface '" << name() << "'" << oendl;
} OMonitoringInterface* ONetworkInterface::monitoring() const { return _mon; } ONetworkInterface::~ONetworkInterface() { - qDebug( "ONetworkInterface::~ONetworkInterface()" ); + odebug << "ONetworkInterface::~ONetworkInterface()" << oendl;
if ( _sfd != -1 ) ::close( _sfd ); } bool ONetworkInterface::setPromiscuousMode( bool b ) { ioctl( SIOCGIFFLAGS ); if ( b ) _ifr.ifr_flags |= IFF_PROMISC; else _ifr.ifr_flags &= (~IFF_PROMISC); return ioctl( SIOCSIFFLAGS ); } @@ -395,26 +398,25 @@ bool OChannelHopper::isActive() const int OChannelHopper::channel() const { return *_channel; } void OChannelHopper::timerEvent( QTimerEvent* ) { _iface->setChannel( *_channel ); emit( hopped( *_channel ) ); - qDebug( "OChannelHopper::timerEvent(): set channel %d on interface '%s'", - *_channel, (const char*) _iface->name() ); + odebug << "OChannelHopper::timerEvent(): set channel " << *_channel << " on interface '" << _iface->name() << "'" << oendl;
if ( ++_channel == _channels.end() ) _channel = _channels.begin(); } void OChannelHopper::setInterval( int interval ) { if ( interval == _interval ) return; if ( _interval ) killTimer( _tid ); @@ -432,43 +434,43 @@ int OChannelHopper::interval() const { return _interval; } /*====================================================================================== * OWirelessNetworkInterface *======================================================================================*/ OWirelessNetworkInterface::OWirelessNetworkInterface( QObject* parent, const char* name ) :ONetworkInterface( parent, name ), _hopper( 0 ) { - qDebug( "OWirelessNetworkInterface::OWirelessNetworkInterface()" ); + odebug << "OWirelessNetworkInterface::OWirelessNetworkInterface()" << oendl;
init(); } OWirelessNetworkInterface::~OWirelessNetworkInterface() { } struct iwreq& OWirelessNetworkInterface::iwr() const { return _iwr; } void OWirelessNetworkInterface::init() { - qDebug( "OWirelessNetworkInterface::init()" ); + odebug << "OWirelessNetworkInterface::init()" << oendl;
memset( &_iwr, 0, sizeof( struct iwreq ) ); buildInformation(); buildPrivateList(); dumpInformation(); } bool OWirelessNetworkInterface::isAssociated() const { //FIXME: handle different modes return !(associatedAP() == OMacAddress::unknown); } @@ -497,102 +499,102 @@ void OWirelessNetworkInterface::buildInformation() struct iwreq wrq; int len = sizeof( struct iw_range )*2; char *buffer = (char*) malloc( len ); //FIXME: Validate if we actually got the memory block memset( buffer, 0, len ); memcpy( wrq.ifr_name, name(), IFNAMSIZ); wrq.u.data.pointer = (caddr_t) buffer; wrq.u.data.length = sizeof( struct iw_range ); wrq.u.data.flags = 0; if ( ::ioctl( _sfd, SIOCGIWRANGE, &wrq ) == -1 ) { - qDebug( "OWirelessNetworkInterface::buildInformation(): SIOCGIWRANGE failed (%s) - using default values.", strerror( errno ) ); + owarn << "OWirelessNetworkInterface::buildInformation(): Can't get channel information - using default values." << oendl;
_channels.insert( 2412, 1 ); // 2.412 GHz _channels.insert( 2417, 2 ); // 2.417 GHz _channels.insert( 2422, 3 ); // 2.422 GHz _channels.insert( 2427, 4 ); // 2.427 GHz _channels.insert( 2432, 5 ); // 2.432 GHz _channels.insert( 2437, 6 ); // 2.437 GHz _channels.insert( 2442, 7 ); // 2.442 GHz _channels.insert( 2447, 8 ); // 2.447 GHz _channels.insert( 2452, 9 ); // 2.452 GHz _channels.insert( 2457, 10 ); // 2.457 GHz _channels.insert( 2462, 11 ); // 2.462 GHz memset( &_range, 0, sizeof( struct iw_range ) ); } else { // <check if the driver overwrites stuff> int max = 0; for ( int r = sizeof( struct iw_range ); r < len; r++ ) if (buffer[r] != 0) max = r; if (max > 0) { - qWarning( "OWirelessNetworkInterface::buildInformation(): Driver for wireless interface '%s' sucks!\n" - "It overwrote the buffer end with at least %i bytes!\n", name(), max - sizeof( struct iw_range ) ); + owarn << "OWirelessNetworkInterface::buildInformation(): Driver for wireless interface '" << name()
+ << "' sucks! It overwrote the buffer end with at least " << max - sizeof( struct iw_range ) << " bytes!" << oendl;
} // </check if the driver overwrites stuff> struct iw_range range; memcpy( &range, buffer, sizeof range ); - qDebug( "OWirelessNetworkInterface::buildInformation(): Interface %s reported to have %d channels.", name(), range.num_frequency ); + odebug << "OWirelessNetworkInterface::buildInformation(): Interface reported to have " << (int) range.num_frequency << " channels." << oendl;
for ( int i = 0; i < range.num_frequency; ++i ) { int freq = (int) ( double( range.freq[i].m ) * pow( 10.0, range.freq[i].e ) / 1000000.0 ); _channels.insert( freq, i+1 ); } } memcpy( &_range, buffer, sizeof( struct iw_range ) ); - qDebug( "OWirelessNetworkInterface::buildInformation(): Information block constructed." ); + odebug << "OWirelessNetworkInterface::buildInformation(): Information block constructed." << oendl;
free(buffer); } void OWirelessNetworkInterface::buildPrivateList() { - qDebug( "OWirelessNetworkInterface::buildPrivateList()" ); + odebug << "OWirelessNetworkInterface::buildPrivateList()" << oendl;
struct iw_priv_args priv[IW_MAX_PRIV_DEF]; _iwr.u.data.pointer = (char*) &priv; _iwr.u.data.length = IW_MAX_PRIV_DEF; // length in terms of number of (sizeof iw_priv_args), not (sizeof iw_priv_args) itself _iwr.u.data.flags = 0; if ( !wioctl( SIOCGIWPRIV ) ) { - qDebug( "OWirelessNetworkInterface::buildPrivateList(): SIOCGIWPRIV failed (%s) - can't get private ioctl information.", strerror( errno ) ); + owarn << "OWirelessNetworkInterface::buildPrivateList(): Can't get private ioctl information." << oendl;
return; } for ( int i = 0; i < _iwr.u.data.length; ++i ) { new OPrivateIOCTL( this, priv[i].name, priv[i].cmd, priv[i].get_args, priv[i].set_args ); } - qDebug( "OWirelessNetworkInterface::buildPrivateList(): Private IOCTL list constructed." ); + odebug << "OWirelessNetworkInterface::buildPrivateList(): Private ioctl list constructed." << oendl;
} void OWirelessNetworkInterface::dumpInformation() const { - qDebug( "OWirelessNetworkInterface::() -------------- dumping information block ----------------" ); + odebug << "OWirelessNetworkInterface::() -------------- dumping information block ----------------" << oendl;
qDebug( " - driver's idea of maximum throughput is %d bps = %d byte/s = %d Kb/s = %f.2 Mb/s", _range.throughput, _range.throughput / 8, _range.throughput / 8 / 1024, float( _range.throughput ) / 8.0 / 1024.0 / 1024.0 ); qDebug( " - driver for '%s' has been compiled against WE V%d (source=V%d)", name(), _range.we_version_compiled, _range.we_version_source ); - qDebug( "OWirelessNetworkInterface::() ---------------------------------------------------------" ); + odebug << "OWirelessNetworkInterface::() ---------------------------------------------------------" << oendl;
} int OWirelessNetworkInterface::channel() const { //FIXME: When monitoring enabled, then use it //FIXME: to gather the current RF channel //FIXME: Until then, get active channel from hopper. if ( _hopper && _hopper->isActive() ) return _hopper->channel(); if ( !wioctl( SIOCGIWFREQ ) ) @@ -601,25 +603,25 @@ int OWirelessNetworkInterface::channel() const } else { return _channels[ static_cast<int>(double( _iwr.u.freq.m ) * pow( 10.0, _iwr.u.freq.e ) / 1000000) ]; } } void OWirelessNetworkInterface::setChannel( int c ) const { if ( !c ) { - qWarning( "OWirelessNetworkInterface::setChannel( 0 ) called - fix your application!" ); + oerr << "OWirelessNetworkInterface::setChannel( 0 ) called - fix your application!" << oendl;
return; } if ( !_mon ) { memset( &_iwr, 0, sizeof( struct iwreq ) ); _iwr.u.freq.m = c; _iwr.u.freq.e = 0; wioctl( SIOCSIWFREQ ); } else { @@ -672,75 +674,75 @@ void OWirelessNetworkInterface::commit() const { wioctl( SIOCSIWCOMMIT ); } void OWirelessNetworkInterface::setMode( const QString& newMode ) { #ifdef FINALIZE QString currentMode = mode(); if ( currentMode == newMode ) return; #endif - qDebug( "OWirelessNetworkInterface::setMode(): trying to set mode '%s' (%d)", (const char*) newMode, stringToMode( newMode ) ); + odebug << "OWirelessNetworkInterface::setMode(): trying to set mode " << newMode << oendl;
_iwr.u.mode = stringToMode( newMode ); if ( _iwr.u.mode != IW_MODE_MONITOR ) { // IWR.U.MODE WIRD DURCH ABFRAGE DES MODE HIER PLATTGEMACHT!!!!!!!!!!!!!!!!!!!!! DEPP! _iwr.u.mode = stringToMode( newMode ); wioctl( SIOCSIWMODE ); // special iwpriv fallback for monitor mode (check if we're really out of monitor mode now) if ( mode() == "monitor" ) { - qDebug( "OWirelessNetworkInterface::setMode(): SIOCSIWMODE not sufficient - trying fallback to iwpriv..." ); + odebug << "OWirelessNetworkInterface::setMode(): SIOCSIWMODE not sufficient - trying fallback to iwpriv..." << oendl;
if ( _mon ) _mon->setEnabled( false ); else - qDebug( "ONetwork(): can't switch monitor mode without installed monitoring interface" ); + odebug << "ONetwork(): can't switch monitor mode without installed monitoring interface" << oendl;
} } else // special iwpriv fallback for monitor mode { if ( wioctl( SIOCSIWMODE ) ) { - qDebug( "OWirelessNetworkInterface::setMode(): IW_MODE_MONITOR ok" ); + odebug << "OWirelessNetworkInterface::setMode(): IW_MODE_MONITOR ok" << oendl;
} else { - qDebug( "OWirelessNetworkInterface::setMode(): SIOCSIWMODE not working - trying fallback to iwpriv..." ); + odebug << "OWirelessNetworkInterface::setMode(): SIOCSIWMODE not working - trying fallback to iwpriv..." << oendl;
if ( _mon ) _mon->setEnabled( true ); else - qDebug( "ONetwork(): can't switch monitor mode without installed monitoring interface" ); + odebug << "ONetwork(): can't switch monitor mode without installed monitoring interface" << oendl;
} } } QString OWirelessNetworkInterface::mode() const { memset( &_iwr, 0, sizeof( struct iwreq ) ); if ( !wioctl( SIOCGIWMODE ) ) { return "<unknown>"; } - qDebug( "DEBUG: WE's idea of current mode seems to be '%s'", (const char*) modeToString( _iwr.u.mode ) ); + odebug << "OWirelessNetworkInterface::setMode(): WE's idea of current mode seems to be " << modeToString( _iwr.u.mode ) << oendl;
// legacy compatible monitor mode check if ( dataLinkType() == ARPHRD_IEEE80211 || dataLinkType() == 802 ) { return "monitor"; } else { return modeToString( _iwr.u.mode ); } } @@ -766,49 +768,51 @@ QString OWirelessNetworkInterface::nickName() const { str[_iwr.u.data.length] = 0x0; // some drivers (e.g. wlan-ng) don't zero-terminate the string return str; } } void OWirelessNetworkInterface::setPrivate( const QString& call, int numargs, ... ) { OPrivateIOCTL* priv = static_cast<OPrivateIOCTL*>( child( (const char*) call ) ); if ( !priv ) { - qDebug( "OWirelessNetworkInterface::setPrivate(): interface '%s' does not support private ioctl '%s'", name(), (const char*) call ); + owarn << "OWirelessNetworkInterface::setPrivate(): interface '" << name()
+ << "' does not support private ioctl '" << call << "'" << oendl;
return; } if ( priv->numberSetArgs() != numargs ) { - qDebug( "OWirelessNetworkInterface::setPrivate(): parameter count not matching. '%s' expects %d arguments, but got %d", (const char*) call, priv->numberSetArgs(), numargs ); + owarn << "OWirelessNetworkInterface::setPrivate(): parameter count not matching. '"
+ << call << "' expects " << priv->numberSetArgs() << ", but got " << numargs << oendl;
return; } - qDebug( "OWirelessNetworkInterface::setPrivate(): about to call '%s' on interface '%s'", (const char*) call, name() ); + odebug << "OWirelessNetworkInterface::setPrivate(): about to call '" << call << "' on interface '" << name() << "'" << oendl;
memset( &_iwr, 0, sizeof _iwr ); va_list argp; va_start( argp, numargs ); for ( int i = 0; i < numargs; ++i ) { priv->setParameter( i, va_arg( argp, int ) ); } va_end( argp ); priv->invoke(); } void OWirelessNetworkInterface::getPrivate( const QString& call ) { - qWarning( "OWirelessNetworkInterface::getPrivate() is not implemented yet." ); + oerr << "OWirelessNetworkInterface::getPrivate() is not implemented yet." << oendl;
} bool OWirelessNetworkInterface::hasPrivate( const QString& call ) { return child( (const char*) call ); } QString OWirelessNetworkInterface::SSID() const { char str[IW_ESSID_MAX_SIZE]; @@ -837,146 +841,150 @@ OStationList* OWirelessNetworkInterface::scanNetwork() { _iwr.u.param.flags = IW_SCAN_DEFAULT; _iwr.u.param.value = 0; if ( !wioctl( SIOCSIWSCAN ) ) { return 0; } OStationList* stations = new OStationList(); int timeout = 1000000; - qDebug( "ONetworkInterface::scanNetwork() - scan started." ); + odebug << "ONetworkInterface::scanNetwork() - scan started." << oendl;
bool results = false; struct timeval tv; tv.tv_sec = 0; tv.tv_usec = 250000; // initial timeout ~ 250ms char buffer[IW_SCAN_MAX_DATA]; while ( !results && timeout > 0 ) { timeout -= tv.tv_usec; select( 0, 0, 0, 0, &tv ); _iwr.u.data.pointer = &buffer[0]; _iwr.u.data.flags = 0; _iwr.u.data.length = sizeof buffer; if ( wioctl( SIOCGIWSCAN ) ) { results = true; continue; } else if ( errno == EAGAIN) { - qDebug( "ONetworkInterface::scanNetwork() - scan in progress..." ); + odebug << "ONetworkInterface::scanNetwork() - scan in progress..." << oendl;
#if 0 if ( qApp ) { qApp->processEvents( 100 ); continue; } #endif tv.tv_sec = 0; tv.tv_usec = 100000; continue; } } - qDebug( "ONetworkInterface::scanNetwork() - scan finished." ); + odebug << "ONetworkInterface::scanNetwork() - scan finished." << oendl;
if ( results ) { - qDebug( " - result length = %d", _iwr.u.data.length ); + odebug << " - result length = " << _iwr.u.data.length << oendl;
if ( !_iwr.u.data.length ) { - qDebug( " - no results (empty neighbourhood)" ); + odebug << " - no results (empty neighbourhood)" << oendl;
return stations; } - qDebug( " - results are in!" ); + odebug << " - results are in!" << oendl;
dumpBytes( (const unsigned char*) &buffer[0], _iwr.u.data.length ); // parse results int offset = 0; struct iw_event* we = (struct iw_event*) &buffer[0]; while ( offset < _iwr.u.data.length ) { //const char* cmd = *(*_ioctlmap)[we->cmd]; //if ( !cmd ) cmd = "<unknown>"; - qDebug( "reading next event... cmd=%d, len=%d", we->cmd, we->len ); + odebug << " - reading next event... cmd=" << we->cmd << ", len=" << we->len << oendl;
switch (we->cmd) { case SIOCGIWAP: { - qDebug( "SIOCGIWAP" ); + odebug << "SIOCGIWAP" << oendl;
stations->append( new OStation() ); stations->last()->macAddress = (const unsigned char*) &we->u.ap_addr.sa_data[0]; break; } case SIOCGIWMODE: { - qDebug( "SIOCGIWMODE" ); + odebug << "SIOCGIWMODE" << oendl;
stations->last()->type = modeToString( we->u.mode ); break; } case SIOCGIWFREQ: { - qDebug( "SIOCGIWFREQ" ); + odebug << "SIOCGIWFREQ" << oendl;
stations->last()->channel = _channels[ static_cast<int>(double( we->u.freq.m ) * pow( 10.0, we->u.freq.e ) / 1000000) ]; break; } case SIOCGIWESSID: { - qDebug( "SIOCGIWESSID" ); + odebug << "SIOCGIWESSID" << oendl;
stations->last()->ssid = we->u.essid.pointer; break; } - case SIOCGIWSENS: qDebug( "SIOCGIWSENS" ); break; - case SIOCGIWENCODE: qDebug( "SIOCGIWENCODE" ); break; - case IWEVTXDROP: qDebug( "IWEVTXDROP" ); break; /* Packet dropped to excessive retry */ - case IWEVQUAL: qDebug( "IWEVQUAL" ); break; /* Quality part of statistics (scan) */ - case IWEVCUSTOM: qDebug( "IWEVCUSTOM" ); break; /* Driver specific ascii string */ - case IWEVREGISTERED: qDebug( "IWEVREGISTERED" ); break; /* Discovered a new node (AP mode) */ - case IWEVEXPIRED: qDebug( "IWEVEXPIRED" ); break; /* Expired a node (AP mode) */ - default: qDebug( "unhandled event" ); + case SIOCGIWSENS: odebug << "SIOCGIWSENS" << oendl; break;
+ case SIOCGIWENCODE: odebug << "SIOCGIWENCODE" << oendl; break;
+ case IWEVTXDROP: odebug << "IWEVTXDROP" << oendl; break; /* Packet dropped to excessive retry */
+ case IWEVQUAL: odebug << "IWEVQUAL" << oendl; break; /* Quality part of statistics (scan) */
+ case IWEVCUSTOM: odebug << "IWEVCUSTOM" << oendl; break; /* Driver specific ascii string */
+ case IWEVREGISTERED: odebug << "IWEVREGISTERED" << oendl; break; /* Discovered a new node (AP mode) */
+ case IWEVEXPIRED: odebug << "IWEVEXPIRED" << oendl; break; /* Expired a node (AP mode) */
+ default: odebug << "unhandled event" << oendl;
} offset += we->len; we = (struct iw_event*) &buffer[offset]; } return stations; return stations; } else { - qDebug( " - no results (timeout) :(" ); + odebug << " - no results (timeout) :(" << oendl;
return stations; } } bool OWirelessNetworkInterface::wioctl( int call, struct iwreq& iwreq ) const { #ifndef NODEBUG int result = ::ioctl( _sfd, call, &iwreq ); +
if ( result == -1 ) - qDebug( "ONetworkInterface::wioctl (%s) call %s (0x%04X) - Status: Failed: %d (%s)", name(), (const char*) debugmapper->map( call ), call, result, strerror( errno ) ); + odebug << "ONetworkInterface::wioctl (" << name() << ") call '"
+ << debugmapper->map( call ) << "' FAILED! " << result << " (" << strerror( errno ) << ")" << oendl;
else - qDebug( "ONetworkInterface::wioctl (%s) call %s (0x%04X) - Status: Ok.", name(), (const char*) debugmapper->map( call ), call ); + odebug << "ONetworkInterface::wioctl (" << name() << ") call '"
+ << debugmapper->map( call ) << "' - Status: Ok." << oendl;
+
return ( result != -1 ); #else return ::ioctl( _sfd, call, &iwreq ) != -1; #endif } bool OWirelessNetworkInterface::wioctl( int call ) const { strcpy( _iwr.ifr_name, name() ); return wioctl( call, _iwr ); } |