author | mickeyl <mickeyl> | 2003-05-01 00:59:20 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-05-01 00:59:20 (UTC) |
commit | 1d721ddb247e9000e29fba3150e0cce5f59f543e (patch) (side-by-side diff) | |
tree | 70b659b209395c8aff25442afaa4fc57c29679e6 /libopie2/opienet/onetwork.cpp | |
parent | 30c685f9da06d19c993e9bdb74f349dabbde063e (diff) | |
download | opie-1d721ddb247e9000e29fba3150e0cce5f59f543e.zip opie-1d721ddb247e9000e29fba3150e0cce5f59f543e.tar.gz opie-1d721ddb247e9000e29fba3150e0cce5f59f543e.tar.bz2 |
implement and document a bunch of missing methods
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index 95e7043..2dfff1d 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp @@ -43,4 +43,5 @@ /* UNIX */ +#include <assert.h> #include <arpa/inet.h> #include <cerrno> @@ -640,4 +641,46 @@ OChannelHopper* OWirelessNetworkInterface::channelHopper() const +void OWirelessNetworkInterface::setMode( const QString& mode ) +{ + if ( mode == "auto" ) _iwr.u.mode = IW_MODE_AUTO; + else if ( mode == "adhoc" ) _iwr.u.mode = IW_MODE_ADHOC; + else if ( mode == "managed" ) _iwr.u.mode = IW_MODE_INFRA; + else if ( mode == "master" ) _iwr.u.mode = IW_MODE_MASTER; + else if ( mode == "repeater" ) _iwr.u.mode = IW_MODE_REPEAT; + else if ( mode == "secondary" ) _iwr.u.mode = IW_MODE_SECOND; + #if WIRELESS_EXT > 14 + else if ( mode == "monitor" ) _iwr.u.mode = IW_MODE_MONITOR; + #endif + else + { + qDebug( "ONetwork: Warning! Invalid IEEE 802.11 mode '%s' specified.", (const char*) mode ); + return; + } + wioctl( SIOCSIWMODE ); +} + + +QString OWirelessNetworkInterface::mode() const +{ + if ( !wioctl( SIOCGIWMODE ) ) + { + return "<unknown>"; + } + switch ( _iwr.u.mode ) + { + case IW_MODE_AUTO: return "auto"; + case IW_MODE_ADHOC: return "adhoc"; + case IW_MODE_INFRA: return "managed"; + case IW_MODE_MASTER: return "master"; + case IW_MODE_REPEAT: return "repeater"; + case IW_MODE_SECOND: return "secondary"; + #if WIRELESS_EXT > 14 + case IW_MODE_MONITOR: return "monitor"; + #endif + default: assert( 0 ); // shouldn't happen + } +} + + void OWirelessNetworkInterface::setMonitorMode( bool b ) { @@ -657,4 +700,12 @@ bool OWirelessNetworkInterface::monitorMode() const +void OWirelessNetworkInterface::setNickName( const QString& nickname ) +{ + _iwr.u.essid.pointer = const_cast<char*>( (const char*) nickname ); + _iwr.u.essid.length = nickname.length(); + wioctl( SIOCSIWNICKN ); +} + + QString OWirelessNetworkInterface::nickName() const { |