summaryrefslogtreecommitdiff
path: root/libopie2/opienet/onetwork.cpp
Side-by-side diff
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
@@ -55,12 +55,17 @@
#include <linux/sockios.h>
#include <net/if_arp.h>
#include <stdarg.h>
using namespace std;
+#ifndef NODEBUG
+#include <opie2/oioctlmap.h>
+IntStringMap* _ioctlmap = constructIoctlMap();
+#endif
+
/*======================================================================================
* ONetwork
*======================================================================================*/
ONetwork* ONetwork::_instance = 0;
@@ -184,18 +189,22 @@ 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
}
bool ONetworkInterface::ioctl( int call ) const
{
strcpy( _ifr.ifr_name, name() );
@@ -880,18 +889,22 @@ 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
}
bool OWirelessNetworkInterface::wioctl( int call ) const
{
strcpy( _iwr.ifr_name, name() );