summaryrefslogtreecommitdiff
path: root/libopie2/opienet/onetwork.cpp
authormickeyl <mickeyl>2003-10-21 13:23:37 (UTC)
committer mickeyl <mickeyl>2003-10-21 13:23:37 (UTC)
commit76ca3158518a851085b5a5ebe3724d0c0c3be857 (patch) (side-by-side diff)
treec1e3cd417968e08a4f01497a431720f3088f0fa6 /libopie2/opienet/onetwork.cpp
parentfccc5d110dea3bc32176694c8e5fc7f014706be6 (diff)
downloadopie-76ca3158518a851085b5a5ebe3724d0c0c3be857.zip
opie-76ca3158518a851085b5a5ebe3724d0c0c3be857.tar.gz
opie-76ca3158518a851085b5a5ebe3724d0c0c3be857.tar.bz2
add clear text debug output for ioctls
Diffstat (limited to 'libopie2/opienet/onetwork.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opienet/onetwork.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp
index be45924..918ba07 100644
--- a/libopie2/opienet/onetwork.cpp
+++ b/libopie2/opienet/onetwork.cpp
@@ -58,6 +58,11 @@
using namespace std;
+#ifndef NODEBUG
+#include <opie2/oioctlmap.h>
+IntStringMap* _ioctlmap = constructIoctlMap();
+#endif
+
/*======================================================================================
* ONetwork
*======================================================================================*/
@@ -187,12 +192,16 @@ void ONetworkInterface::init()
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 %d (0x%04X) - Status: Failed: %d (%s)", name(), call, call, result, strerror( errno ) );
+ qDebug( "ONetworkInterface::ioctl (%s) call %s (0x%04X) - Status: Failed: %d (%s)", name(), (const char*) *(*_ioctlmap)[call], call, result, strerror( errno ) );
else
- qDebug( "ONetworkInterface::ioctl (%s) call %d (0x%04X) - Status: Ok.", name(), call, call );
+ qDebug( "ONetworkInterface::ioctl (%s) call %s (0x%04X) - Status: Ok.", name(), (const char*) *(*_ioctlmap)[call], call );
return ( result != -1 );
+ #else
+ return ::ioctl( _sfd, call, &ifreq ) != -1;
+ #endif
}
@@ -883,12 +892,16 @@ int OWirelessNetworkInterface::scanNetwork()
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 %d (0x%04X) - Status: Failed: %d (%s)", name(), call, call, result, strerror( errno ) );
+ qDebug( "ONetworkInterface::wioctl (%s) call %s (0x%04X) - Status: Failed: %d (%s)", name(), (const char*) *(*_ioctlmap)[call], call, result, strerror( errno ) );
else
- qDebug( "ONetworkInterface::wioctl (%s) call %d (0x%04X) - Status: Ok.", name(), call, call );
+ qDebug( "ONetworkInterface::wioctl (%s) call %s (0x%04X) - Status: Ok.", name(), (const char*) *(*_ioctlmap)[call], call );
return ( result != -1 );
+ #else
+ return ::ioctl( _sfd, call, &iwreq ) != -1;
+ #endif
}