-rw-r--r-- | libopie2/opienet/onetwork.cpp | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index 918ba07..a85a510 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp | |||
@@ -36,2 +36,3 @@ | |||
36 | #include <opie2/onetwork.h> | 36 | #include <opie2/onetwork.h> |
37 | #include <opie2/ostation.h> | ||
37 | 38 | ||
@@ -883,3 +884,44 @@ int OWirelessNetworkInterface::scanNetwork() | |||
883 | { | 884 | { |
885 | qDebug( " - result length = %d", _iwr.u.data.length ); | ||
886 | if ( !_iwr.u.data.length ) | ||
887 | { | ||
888 | qDebug( " - no results (empty neighbourhood)" ); | ||
889 | return 0; | ||
890 | } | ||
891 | |||
884 | qDebug( " - results are in!" ); | 892 | qDebug( " - results are in!" ); |
893 | dumpBytes( (const unsigned char*) &buffer[0], _iwr.u.data.length ); | ||
894 | |||
895 | int stations = 0; | ||
896 | |||
897 | // parse results | ||
898 | |||
899 | int offset = 0; | ||
900 | struct iw_event* we = (struct iw_event*) &buffer[0]; | ||
901 | |||
902 | while ( offset < _iwr.u.data.length ) | ||
903 | { | ||
904 | //const char* cmd = *(*_ioctlmap)[we->cmd]; | ||
905 | //if ( !cmd ) cmd = "<unknown>"; | ||
906 | qDebug( "reading next event... cmd=%d, len=%d", we->cmd, we->len ); | ||
907 | switch (we->cmd) | ||
908 | { | ||
909 | case SIOCGIWAP: qDebug( "SIOCGIWAP" ); stations++; break; | ||
910 | case SIOCGIWMODE: qDebug( "SIOCGIWMODE" ); break; | ||
911 | case SIOCGIWFREQ: qDebug( "SIOCGIWFREQ" ); break; | ||
912 | case SIOCGIWESSID: qDebug( "SIOCGIWESSID" ); break; | ||
913 | case SIOCGIWSENS: qDebug( "SIOCGIWSENS" ); break; | ||
914 | case SIOCGIWENCODE: qDebug( "SIOCGIWENCODE" ); break; | ||
915 | case IWEVTXDROP: qDebug( "IWEVTXDROP" ); break; /* Packet dropped to excessive retry */ | ||
916 | case IWEVQUAL: qDebug( "IWEVQUAL" ); break; /* Quality part of statistics (scan) */ | ||
917 | case IWEVCUSTOM: qDebug( "IWEVCUSTOM" ); break; /* Driver specific ascii string */ | ||
918 | case IWEVREGISTERED: qDebug( "IWEVREGISTERED" ); break; /* Discovered a new node (AP mode) */ | ||
919 | case IWEVEXPIRED: qDebug( "IWEVEXPIRED" ); break; /* Expired a node (AP mode) */ | ||
920 | default: qDebug( "unhandled event" ); | ||
921 | } | ||
922 | |||
923 | offset += we->len; | ||
924 | we = (struct iw_event*) &buffer[offset]; | ||
925 | } | ||
926 | |||
885 | } | 927 | } |
@@ -887,3 +929,4 @@ int OWirelessNetworkInterface::scanNetwork() | |||
887 | { | 929 | { |
888 | qDebug( " - no results :(" ); | 930 | qDebug( " - no results (timeout) :(" ); |
931 | return 0; | ||
889 | } | 932 | } |