Diffstat (limited to 'libopie2/opienet/onetwork.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index 171a2bc..591681c 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp | |||
@@ -813,57 +813,57 @@ void OWirelessNetworkInterface::setPrivate( const QString& call, int numargs, .. | |||
813 | owarn << "OWirelessNetworkInterface::setPrivate(): interface '" << name() | 813 | owarn << "OWirelessNetworkInterface::setPrivate(): interface '" << name() |
814 | << "' does not support private ioctl '" << call << "'" << oendl; | 814 | << "' does not support private ioctl '" << call << "'" << oendl; |
815 | return; | 815 | return; |
816 | } | 816 | } |
817 | if ( priv->numberSetArgs() != numargs ) | 817 | if ( priv->numberSetArgs() != numargs ) |
818 | { | 818 | { |
819 | owarn << "OWirelessNetworkInterface::setPrivate(): parameter count not matching. '" | 819 | owarn << "OWirelessNetworkInterface::setPrivate(): parameter count not matching. '" |
820 | << call << "' expects " << priv->numberSetArgs() << ", but got " << numargs << oendl; | 820 | << call << "' expects " << priv->numberSetArgs() << ", but got " << numargs << oendl; |
821 | return; | 821 | return; |
822 | } | 822 | } |
823 | 823 | ||
824 | odebug << "OWirelessNetworkInterface::setPrivate(): about to call '" << call << "' on interface '" << name() << "'" << oendl; | 824 | odebug << "OWirelessNetworkInterface::setPrivate(): about to call '" << call << "' on interface '" << name() << "'" << oendl; |
825 | memset( &_iwr, 0, sizeof _iwr ); | 825 | memset( &_iwr, 0, sizeof _iwr ); |
826 | va_list argp; | 826 | va_list argp; |
827 | va_start( argp, numargs ); | 827 | va_start( argp, numargs ); |
828 | for ( int i = 0; i < numargs; ++i ) | 828 | for ( int i = 0; i < numargs; ++i ) |
829 | { | 829 | { |
830 | priv->setParameter( i, va_arg( argp, int ) ); | 830 | priv->setParameter( i, va_arg( argp, int ) ); |
831 | } | 831 | } |
832 | va_end( argp ); | 832 | va_end( argp ); |
833 | priv->invoke(); | 833 | priv->invoke(); |
834 | } | 834 | } |
835 | 835 | ||
836 | 836 | ||
837 | void OWirelessNetworkInterface::getPrivate( const QString& call ) | 837 | void OWirelessNetworkInterface::getPrivate( const QString& ) |
838 | { | 838 | { |
839 | oerr << "OWirelessNetworkInterface::getPrivate() is not implemented yet." << oendl; | 839 | oerr << "OWirelessNetworkInterface::getPrivate() is not implemented yet." << oendl; |
840 | } | 840 | } |
841 | 841 | ||
842 | 842 | ||
843 | bool OWirelessNetworkInterface::hasPrivate( const QString& call ) | 843 | bool OWirelessNetworkInterface::hasPrivate( const QString& call ) |
844 | { | 844 | { |
845 | return child( (const char*) call ); | 845 | return child( call.local8Bit() ); |
846 | } | 846 | } |
847 | 847 | ||
848 | 848 | ||
849 | QString OWirelessNetworkInterface::SSID() const | 849 | QString OWirelessNetworkInterface::SSID() const |
850 | { | 850 | { |
851 | char str[IW_ESSID_MAX_SIZE]; | 851 | char str[IW_ESSID_MAX_SIZE]; |
852 | _iwr.u.essid.pointer = &str[0]; | 852 | _iwr.u.essid.pointer = &str[0]; |
853 | _iwr.u.essid.length = IW_ESSID_MAX_SIZE; | 853 | _iwr.u.essid.length = IW_ESSID_MAX_SIZE; |
854 | if ( !wioctl( SIOCGIWESSID ) ) | 854 | if ( !wioctl( SIOCGIWESSID ) ) |
855 | { | 855 | { |
856 | return "<unknown>"; | 856 | return "<unknown>"; |
857 | } | 857 | } |
858 | else | 858 | else |
859 | { | 859 | { |
860 | return str; | 860 | return str; |
861 | } | 861 | } |
862 | } | 862 | } |
863 | 863 | ||
864 | 864 | ||
865 | void OWirelessNetworkInterface::setSSID( const QString& ssid ) | 865 | void OWirelessNetworkInterface::setSSID( const QString& ssid ) |
866 | { | 866 | { |
867 | _iwr.u.essid.pointer = const_cast<char*>( (const char*) ssid ); | 867 | _iwr.u.essid.pointer = const_cast<char*>( (const char*) ssid ); |
868 | _iwr.u.essid.length = ssid.length(); | 868 | _iwr.u.essid.length = ssid.length(); |
869 | wioctl( SIOCSIWESSID ); | 869 | wioctl( SIOCSIWESSID ); |
@@ -991,50 +991,50 @@ OStationList* OWirelessNetworkInterface::scanNetwork() | |||
991 | } | 991 | } |
992 | else | 992 | else |
993 | { | 993 | { |
994 | odebug << " - no results (timeout) :(" << oendl; | 994 | odebug << " - no results (timeout) :(" << oendl; |
995 | return stations; | 995 | return stations; |
996 | } | 996 | } |
997 | } | 997 | } |
998 | 998 | ||
999 | 999 | ||
1000 | int OWirelessNetworkInterface::signalStrength() const | 1000 | int OWirelessNetworkInterface::signalStrength() const |
1001 | { | 1001 | { |
1002 | iw_statistics stat; | 1002 | iw_statistics stat; |
1003 | ::memset( &stat, 0, sizeof stat ); | 1003 | ::memset( &stat, 0, sizeof stat ); |
1004 | _iwr.u.data.pointer = (char*) &stat; | 1004 | _iwr.u.data.pointer = (char*) &stat; |
1005 | _iwr.u.data.flags = 0; | 1005 | _iwr.u.data.flags = 0; |
1006 | _iwr.u.data.length = sizeof stat; | 1006 | _iwr.u.data.length = sizeof stat; |
1007 | 1007 | ||
1008 | if ( !wioctl( SIOCGIWSTATS ) ) | 1008 | if ( !wioctl( SIOCGIWSTATS ) ) |
1009 | { | 1009 | { |
1010 | return -1; | 1010 | return -1; |
1011 | } | 1011 | } |
1012 | 1012 | ||
1013 | int max = _range.max_qual.qual; | 1013 | int max = _range.max_qual.qual; |
1014 | int cur = stat.qual.qual; | 1014 | int cur = stat.qual.qual; |
1015 | int lev = stat.qual.level; //FIXME: Do something with them? | 1015 | // int lev = stat.qual.level; //FIXME: Do something with them? |
1016 | int noi = stat.qual.noise; //FIXME: Do something with them? | 1016 | // int noi = stat.qual.noise; //FIXME: Do something with them? |
1017 | 1017 | ||
1018 | 1018 | ||
1019 | return max != 0 ? cur*100/max: -1; | 1019 | return max != 0 ? cur*100/max: -1; |
1020 | } | 1020 | } |
1021 | 1021 | ||
1022 | 1022 | ||
1023 | bool OWirelessNetworkInterface::wioctl( int call, struct iwreq& iwreq ) const | 1023 | bool OWirelessNetworkInterface::wioctl( int call, struct iwreq& iwreq ) const |
1024 | { | 1024 | { |
1025 | #ifndef NODEBUG | 1025 | #ifndef NODEBUG |
1026 | int result = ::ioctl( _sfd, call, &iwreq ); | 1026 | int result = ::ioctl( _sfd, call, &iwreq ); |
1027 | 1027 | ||
1028 | if ( result == -1 ) | 1028 | if ( result == -1 ) |
1029 | odebug << "ONetworkInterface::wioctl (" << name() << ") call '" | 1029 | odebug << "ONetworkInterface::wioctl (" << name() << ") call '" |
1030 | << debugmapper->map( call ) << "' FAILED! " << result << " (" << strerror( errno ) << ")" << oendl; | 1030 | << debugmapper->map( call ) << "' FAILED! " << result << " (" << strerror( errno ) << ")" << oendl; |
1031 | else | 1031 | else |
1032 | odebug << "ONetworkInterface::wioctl (" << name() << ") call '" | 1032 | odebug << "ONetworkInterface::wioctl (" << name() << ") call '" |
1033 | << debugmapper->map( call ) << "' - Status: Ok." << oendl; | 1033 | << debugmapper->map( call ) << "' - Status: Ok." << oendl; |
1034 | 1034 | ||
1035 | return ( result != -1 ); | 1035 | return ( result != -1 ); |
1036 | #else | 1036 | #else |
1037 | return ::ioctl( _sfd, call, &iwreq ) != -1; | 1037 | return ::ioctl( _sfd, call, &iwreq ) != -1; |
1038 | #endif | 1038 | #endif |
1039 | } | 1039 | } |
1040 | 1040 | ||
@@ -1050,70 +1050,70 @@ bool OWirelessNetworkInterface::wioctl( int call ) const | |||
1050 | * OMonitoringInterface | 1050 | * OMonitoringInterface |
1051 | *======================================================================================*/ | 1051 | *======================================================================================*/ |
1052 | 1052 | ||
1053 | OMonitoringInterface::OMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) | 1053 | OMonitoringInterface::OMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) |
1054 | :_if( static_cast<OWirelessNetworkInterface*>( iface ) ), _prismHeader( prismHeader ) | 1054 | :_if( static_cast<OWirelessNetworkInterface*>( iface ) ), _prismHeader( prismHeader ) |
1055 | { | 1055 | { |
1056 | } | 1056 | } |
1057 | 1057 | ||
1058 | 1058 | ||
1059 | OMonitoringInterface::~OMonitoringInterface() | 1059 | OMonitoringInterface::~OMonitoringInterface() |
1060 | { | 1060 | { |
1061 | } | 1061 | } |
1062 | 1062 | ||
1063 | 1063 | ||
1064 | void OMonitoringInterface::setChannel( int c ) | 1064 | void OMonitoringInterface::setChannel( int c ) |
1065 | { | 1065 | { |
1066 | // use standard WE channel switching protocol | 1066 | // use standard WE channel switching protocol |
1067 | memset( &_if->_iwr, 0, sizeof( struct iwreq ) ); | 1067 | memset( &_if->_iwr, 0, sizeof( struct iwreq ) ); |
1068 | _if->_iwr.u.freq.m = c; | 1068 | _if->_iwr.u.freq.m = c; |
1069 | _if->_iwr.u.freq.e = 0; | 1069 | _if->_iwr.u.freq.e = 0; |
1070 | _if->wioctl( SIOCSIWFREQ ); | 1070 | _if->wioctl( SIOCSIWFREQ ); |
1071 | } | 1071 | } |
1072 | 1072 | ||
1073 | 1073 | ||
1074 | void OMonitoringInterface::setEnabled( bool b ) | 1074 | void OMonitoringInterface::setEnabled( bool ) |
1075 | { | 1075 | { |
1076 | } | 1076 | } |
1077 | 1077 | ||
1078 | 1078 | ||
1079 | /*====================================================================================== | 1079 | /*====================================================================================== |
1080 | * OCiscoMonitoringInterface | 1080 | * OCiscoMonitoringInterface |
1081 | *======================================================================================*/ | 1081 | *======================================================================================*/ |
1082 | 1082 | ||
1083 | OCiscoMonitoringInterface::OCiscoMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) | 1083 | OCiscoMonitoringInterface::OCiscoMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) |
1084 | :OMonitoringInterface( iface, prismHeader ) | 1084 | :OMonitoringInterface( iface, prismHeader ) |
1085 | { | 1085 | { |
1086 | iface->setMonitoring( this ); | 1086 | iface->setMonitoring( this ); |
1087 | } | 1087 | } |
1088 | 1088 | ||
1089 | 1089 | ||
1090 | OCiscoMonitoringInterface::~OCiscoMonitoringInterface() | 1090 | OCiscoMonitoringInterface::~OCiscoMonitoringInterface() |
1091 | { | 1091 | { |
1092 | } | 1092 | } |
1093 | 1093 | ||
1094 | 1094 | ||
1095 | void OCiscoMonitoringInterface::setEnabled( bool b ) | 1095 | void OCiscoMonitoringInterface::setEnabled( bool /*b*/ ) |
1096 | { | 1096 | { |
1097 | QString fname; | 1097 | QString fname; |
1098 | fname.sprintf( "/proc/driver/aironet/%s", (const char*) _if->name() ); | 1098 | fname.sprintf( "/proc/driver/aironet/%s", (const char*) _if->name() ); |
1099 | QFile f( fname ); | 1099 | QFile f( fname ); |
1100 | if ( !f.exists() ) return; | 1100 | if ( !f.exists() ) return; |
1101 | 1101 | ||
1102 | if ( f.open( IO_WriteOnly ) ) | 1102 | if ( f.open( IO_WriteOnly ) ) |
1103 | { | 1103 | { |
1104 | QTextStream s( &f ); | 1104 | QTextStream s( &f ); |
1105 | s << "Mode: r"; | 1105 | s << "Mode: r"; |
1106 | s << "Mode: y"; | 1106 | s << "Mode: y"; |
1107 | s << "XmitPower: 1"; | 1107 | s << "XmitPower: 1"; |
1108 | } | 1108 | } |
1109 | 1109 | ||
1110 | // flushing and closing will be done automatically when f goes out of scope | 1110 | // flushing and closing will be done automatically when f goes out of scope |
1111 | } | 1111 | } |
1112 | 1112 | ||
1113 | 1113 | ||
1114 | QString OCiscoMonitoringInterface::name() const | 1114 | QString OCiscoMonitoringInterface::name() const |
1115 | { | 1115 | { |
1116 | return "cisco"; | 1116 | return "cisco"; |
1117 | } | 1117 | } |
1118 | 1118 | ||
1119 | 1119 | ||