Diffstat (limited to 'libopie2/opienet/onetwork.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
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 | |||
@@ -40,33 +40,31 @@ | |||
40 | 40 | ||
41 | #include <qfile.h> | 41 | #include <qfile.h> |
42 | #include <qtextstream.h> | 42 | #include <qtextstream.h> |
43 | 43 | ||
44 | /* UNIX */ | 44 | /* UNIX */ |
45 | 45 | ||
46 | #include <assert.h> | 46 | #include <assert.h> |
47 | #include <arpa/inet.h> | 47 | #include <arpa/inet.h> |
48 | #include <cerrno> | 48 | #include <errno.h> |
49 | #include <cstring> | 49 | #include <string.h> |
50 | #include <cstdlib> | 50 | #include <stdlib.h> |
51 | #include <math.h> | 51 | #include <math.h> |
52 | #include <sys/ioctl.h> | 52 | #include <sys/ioctl.h> |
53 | #include <sys/socket.h> | 53 | #include <sys/socket.h> |
54 | #include <sys/types.h> | 54 | #include <sys/types.h> |
55 | #include <unistd.h> | 55 | #include <unistd.h> |
56 | #include <linux/sockios.h> | 56 | #include <linux/sockios.h> |
57 | #include <net/if_arp.h> | 57 | #include <net/if_arp.h> |
58 | #include <stdarg.h> | 58 | #include <stdarg.h> |
59 | 59 | ||
60 | using namespace std; | ||
61 | |||
62 | #ifndef NODEBUG | 60 | #ifndef NODEBUG |
63 | #include <opie2/oioctlmap.h> | 61 | #include <opie2/odebugmapper.h> |
64 | IntStringMap* _ioctlmap = constructIoctlMap(); | 62 | DebugMapper* debugmapper = new DebugMapper(); |
65 | #endif | 63 | #endif |
66 | 64 | ||
67 | /*====================================================================================== | 65 | /*====================================================================================== |
68 | * ONetwork | 66 | * ONetwork |
69 | *======================================================================================*/ | 67 | *======================================================================================*/ |
70 | 68 | ||
71 | ONetwork* ONetwork::_instance = 0; | 69 | ONetwork* ONetwork::_instance = 0; |
72 | 70 | ||
@@ -191,19 +189,19 @@ void ONetworkInterface::init() | |||
191 | } | 189 | } |
192 | 190 | ||
193 | 191 | ||
194 | bool ONetworkInterface::ioctl( int call, struct ifreq& ifreq ) const | 192 | bool ONetworkInterface::ioctl( int call, struct ifreq& ifreq ) const |
195 | { | 193 | { |
196 | #ifndef NODEBUG | 194 | #ifndef NODEBUG |
197 | int result = ::ioctl( _sfd, call, &ifreq ); | 195 | int result = ::ioctl( _sfd, call, &ifreq ); |
198 | if ( result == -1 ) | 196 | if ( result == -1 ) |
199 | qDebug( "ONetworkInterface::ioctl (%s) call %s (0x%04X) - Status: Failed: %d (%s)", name(), (const char*) *(*_ioctlmap)[call], call, result, strerror( errno ) ); | 197 | qDebug( "ONetworkInterface::ioctl (%s) call %s (0x%04X) - Status: Failed: %d (%s)", name(), (const char*) debugmapper->map( call ), call, result, strerror( errno ) ); |
200 | else | 198 | else |
201 | qDebug( "ONetworkInterface::ioctl (%s) call %s (0x%04X) - Status: Ok.", name(), (const char*) *(*_ioctlmap)[call], call ); | 199 | qDebug( "ONetworkInterface::ioctl (%s) call %s (0x%04X) - Status: Ok.", name(), (const char*) debugmapper->map( call ), call ); |
202 | return ( result != -1 ); | 200 | return ( result != -1 ); |
203 | #else | 201 | #else |
204 | return ::ioctl( _sfd, call, &ifreq ) != -1; | 202 | return ::ioctl( _sfd, call, &ifreq ) != -1; |
205 | #endif | 203 | #endif |
206 | } | 204 | } |
207 | 205 | ||
208 | 206 | ||
209 | bool ONetworkInterface::ioctl( int call ) const | 207 | bool ONetworkInterface::ioctl( int call ) const |
@@ -964,19 +962,19 @@ OStationList* OWirelessNetworkInterface::scanNetwork() | |||
964 | } | 962 | } |
965 | 963 | ||
966 | 964 | ||
967 | bool OWirelessNetworkInterface::wioctl( int call, struct iwreq& iwreq ) const | 965 | bool OWirelessNetworkInterface::wioctl( int call, struct iwreq& iwreq ) const |
968 | { | 966 | { |
969 | #ifndef NODEBUG | 967 | #ifndef NODEBUG |
970 | int result = ::ioctl( _sfd, call, &iwreq ); | 968 | int result = ::ioctl( _sfd, call, &iwreq ); |
971 | if ( result == -1 ) | 969 | if ( result == -1 ) |
972 | qDebug( "ONetworkInterface::wioctl (%s) call %s (0x%04X) - Status: Failed: %d (%s)", name(), (const char*) *(*_ioctlmap)[call], call, result, strerror( errno ) ); | 970 | qDebug( "ONetworkInterface::wioctl (%s) call %s (0x%04X) - Status: Failed: %d (%s)", name(), (const char*) debugmapper->map( call ), call, result, strerror( errno ) ); |
973 | else | 971 | else |
974 | qDebug( "ONetworkInterface::wioctl (%s) call %s (0x%04X) - Status: Ok.", name(), (const char*) *(*_ioctlmap)[call], call ); | 972 | qDebug( "ONetworkInterface::wioctl (%s) call %s (0x%04X) - Status: Ok.", name(), (const char*) debugmapper->map( call ), call ); |
975 | return ( result != -1 ); | 973 | return ( result != -1 ); |
976 | #else | 974 | #else |
977 | return ::ioctl( _sfd, call, &iwreq ) != -1; | 975 | return ::ioctl( _sfd, call, &iwreq ) != -1; |
978 | #endif | 976 | #endif |
979 | } | 977 | } |
980 | 978 | ||
981 | 979 | ||
982 | bool OWirelessNetworkInterface::wioctl( int call ) const | 980 | bool OWirelessNetworkInterface::wioctl( int call ) const |