From eb26b0413c269b898a24deb30d5602ac0c142a56 Mon Sep 17 00:00:00 2001 From: mickeyl Date: Sat, 08 Nov 2003 20:39:38 +0000 Subject: refactor the debug mapper and make it more secure --- (limited to 'libopie2/opienet/onetwork.cpp') diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index c329e9a..95c813f 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp @@ -45,9 +45,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include #include @@ -57,11 +57,9 @@ #include #include -using namespace std; - #ifndef NODEBUG -#include -IntStringMap* _ioctlmap = constructIoctlMap(); +#include +DebugMapper* debugmapper = new DebugMapper(); #endif /*====================================================================================== @@ -196,9 +194,9 @@ 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*) *(*_ioctlmap)[call], call, result, strerror( errno ) ); + qDebug( "ONetworkInterface::ioctl (%s) call %s (0x%04X) - Status: Failed: %d (%s)", name(), (const char*) debugmapper->map( call ), call, result, strerror( errno ) ); else - qDebug( "ONetworkInterface::ioctl (%s) call %s (0x%04X) - Status: Ok.", name(), (const char*) *(*_ioctlmap)[call], call ); + qDebug( "ONetworkInterface::ioctl (%s) call %s (0x%04X) - Status: Ok.", name(), (const char*) debugmapper->map( call ), call ); return ( result != -1 ); #else return ::ioctl( _sfd, call, &ifreq ) != -1; @@ -969,9 +967,9 @@ 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*) *(*_ioctlmap)[call], call, result, strerror( errno ) ); + qDebug( "ONetworkInterface::wioctl (%s) call %s (0x%04X) - Status: Failed: %d (%s)", name(), (const char*) debugmapper->map( call ), call, result, strerror( errno ) ); else - qDebug( "ONetworkInterface::wioctl (%s) call %s (0x%04X) - Status: Ok.", name(), (const char*) *(*_ioctlmap)[call], call ); + qDebug( "ONetworkInterface::wioctl (%s) call %s (0x%04X) - Status: Ok.", name(), (const char*) debugmapper->map( call ), call ); return ( result != -1 ); #else return ::ioctl( _sfd, call, &iwreq ) != -1; -- cgit v0.9.0.2