author | mickeyl <mickeyl> | 2003-10-23 17:51:00 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-10-23 17:51:00 (UTC) |
commit | a9eddd4cd428dd844d8693e98e4df8e365e75da8 (patch) (side-by-side diff) | |
tree | 21b5957143ad30b0efb505694505985ca65d3850 /libopie2/opienet | |
parent | a61c014e1fb43e36aa7454ce4b3cb9a7a706c6fa (diff) | |
download | opie-a9eddd4cd428dd844d8693e98e4df8e365e75da8.zip opie-a9eddd4cd428dd844d8693e98e4df8e365e75da8.tar.gz opie-a9eddd4cd428dd844d8693e98e4df8e365e75da8.tar.bz2 |
misc changes
-rw-r--r-- | libopie2/opienet/onetutils.cpp | 30 | ||||
-rw-r--r-- | libopie2/opienet/onetutils.h | 7 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 91 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.h | 5 | ||||
-rw-r--r-- | libopie2/opienet/ostation.cpp | 15 | ||||
-rw-r--r-- | libopie2/opienet/ostation.h | 17 |
6 files changed, 103 insertions, 62 deletions
diff --git a/libopie2/opienet/onetutils.cpp b/libopie2/opienet/onetutils.cpp index ad0e89d..ce147c5 100644 --- a/libopie2/opienet/onetutils.cpp +++ b/libopie2/opienet/onetutils.cpp @@ -13,49 +13,49 @@ ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <opie2/onetutils.h> #include <opie2/onetwork.h> #include <opie2/omanufacturerdb.h> #include <net/if.h> - +#include <cassert> #include <cstdio> using namespace std; #define IW_PRIV_TYPE_MASK 0x7000 #define IW_PRIV_TYPE_NONE 0x0000 #define IW_PRIV_TYPE_BYTE 0x1000 #define IW_PRIV_TYPE_CHAR 0x2000 #define IW_PRIV_TYPE_INT 0x4000 #define IW_PRIV_TYPE_FLOAT 0x5000 #define IW_PRIV_TYPE_ADDR 0x6000 #define IW_PRIV_SIZE_FIXED 0x0800 #define IW_PRIV_SIZE_MASK 0x07FF /*====================================================================================== * OMacAddress *======================================================================================*/ // static initializer for broadcast and unknown MAC Adresses const unsigned char __broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; const OMacAddress& OMacAddress::broadcast = OMacAddress( __broadcast ); const unsigned char __unknown[6] = { 0x44, 0x44, 0x44, 0x44, 0x44, 0x44 }; const OMacAddress& OMacAddress::unknown = OMacAddress( __unknown ); //TODO: Incorporate Ethernet Manufacturer database here! (inline or so) @@ -192,24 +192,52 @@ void OPrivateIOCTL::invoke() const void OPrivateIOCTL::setParameter( int num, u_int32_t value ) { u_int32_t* arglist = (u_int32_t*) &( (OWirelessNetworkInterface*) parent() )->_iwr.u.name; arglist[num] = value; } /*====================================================================================== * assorted functions *======================================================================================*/ void dumpBytes( const unsigned char* data, int num ) { printf( "Dumping %d bytes @ %0x", num, data ); printf( "-------------------------------------------\n" ); for ( int i = 0; i < num; ++i ) { printf( "%02x ", data[i] ); if ( !((i+1) % 32) ) printf( "\n" ); } printf( "\n\n" ); } + +int stringToMode( const QString& mode ) +{ + if ( mode == "auto" ) return IW_MODE_AUTO; + else if ( mode == "adhoc" ) return IW_MODE_ADHOC; + else if ( mode == "managed" ) return IW_MODE_INFRA; + else if ( mode == "master" ) return IW_MODE_MASTER; + else if ( mode == "repeater" ) return IW_MODE_REPEAT; + else if ( mode == "secondary" ) return IW_MODE_SECOND; + else if ( mode == "monitor" ) return IW_MODE_MONITOR; + else assert( 0 ); +} + + +QString modeToString( int mode ) +{ + switch ( 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 "second"; + case IW_MODE_MONITOR: return "monitor"; + default: assert( 0 ); + } +} diff --git a/libopie2/opienet/onetutils.h b/libopie2/opienet/onetutils.h index 18731ba..541c5ab 100644 --- a/libopie2/opienet/onetutils.h +++ b/libopie2/opienet/onetutils.h @@ -63,87 +63,88 @@ class OMacAddress // no c'tor but this one why not make it a c'tor. it could also replace the others or is this the problem? static OMacAddress fromString( const QString& ); public: static const OMacAddress& broadcast; // ff:ff:ff:ff:ff:ff static const OMacAddress& unknown; // 44:44:44:44:44:44 private: unsigned char _bytes[6]; friend bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); }; bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); /*====================================================================================== * OHostAddress *======================================================================================*/ class OHostAddress : public QHostAddress { - public: + /*public: OHostAddress(); ~OHostAddress(); + */ }; /*====================================================================================== * OPrivateIOCTL *======================================================================================*/ class OPrivateIOCTL : public QObject { public: OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ); ~OPrivateIOCTL(); int numberGetArgs() const; int typeGetArgs() const; int numberSetArgs() const; int typeSetArgs() const; // FIXME return int? as ::ioctl does? -zecke void invoke() const; void setParameter( int, u_int32_t ); private: u_int32_t _ioctl; u_int16_t _getargs; u_int16_t _setargs; }; /*====================================================================================== * Miscellaneous *======================================================================================*/ -/* dump bytes */ - void dumpBytes( const unsigned char* data, int num ); +QString modeToString( int ); +int stringToMode( const QString& ); /* Network to host order macros */ #ifdef LBL_ALIGN #define EXTRACT_16BITS(p) \ ((u_int16_t)((u_int16_t)*((const u_int8_t *)(p) + 0) << 8 | \ (u_int16_t)*((const u_int8_t *)(p) + 1))) #define EXTRACT_32BITS(p) \ ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 0) << 24 | \ (u_int32_t)*((const u_int8_t *)(p) + 1) << 16 | \ (u_int32_t)*((const u_int8_t *)(p) + 2) << 8 | \ (u_int32_t)*((const u_int8_t *)(p) + 3))) #else #define EXTRACT_16BITS(p) \ ((u_int16_t)ntohs(*(const u_int16_t *)(p))) #define EXTRACT_32BITS(p) \ ((u_int32_t)ntohl(*(const u_int32_t *)(p))) #endif #define EXTRACT_24BITS(p) \ ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 0) << 16 | \ (u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \ (u_int32_t)*((const u_int8_t *)(p) + 2))) diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index a85a510..50c6679 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp @@ -235,48 +235,49 @@ bool ONetworkInterface::isUp() const return _ifr.ifr_flags & IFF_UP; } void ONetworkInterface::setIPV4Address( const QHostAddress& addr ) { struct sockaddr_in *sa = (struct sockaddr_in *) &_ifr.ifr_addr; sa->sin_family = AF_INET; sa->sin_port = 0; sa->sin_addr.s_addr = htonl( addr.ip4Addr() ); ioctl( SIOCSIFADDR ); } QString ONetworkInterface::ipV4Address() const { if ( ioctl( SIOCGIFADDR ) ) { struct sockaddr_in* sa = (struct sockaddr_in *) &_ifr.ifr_addr; //FIXME: Use QHostAddress here return QString( inet_ntoa( sa->sin_addr ) ); } else return "<unknown>"; + } void ONetworkInterface::setMacAddress( const OMacAddress& addr ) { _ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER; memcpy( &_ifr.ifr_hwaddr.sa_data, addr.native(), 6 ); ioctl( SIOCSIFHWADDR ); } OMacAddress ONetworkInterface::macAddress() const { if ( ioctl( SIOCGIFHWADDR ) ) { return OMacAddress( _ifr ); } else { return OMacAddress::unknown; } } @@ -453,72 +454,58 @@ OWirelessNetworkInterface::OWirelessNetworkInterface( QObject* parent, const cha OWirelessNetworkInterface::~OWirelessNetworkInterface() { } struct iwreq& OWirelessNetworkInterface::iwr() const { return _iwr; } void OWirelessNetworkInterface::init() { qDebug( "OWirelessNetworkInterface::init()" ); memset( &_iwr, 0, sizeof( struct iwreq ) ); buildInformation(); buildPrivateList(); dumpInformation(); } bool OWirelessNetworkInterface::isAssociated() const { //FIXME: handle different modes - return associatedAP() != "44:44:44:44:44:44"; + return !(associatedAP() == OMacAddress::unknown); } -QString OWirelessNetworkInterface::associatedAP() const +OMacAddress OWirelessNetworkInterface::associatedAP() const { - //FIXME: use OMacAddress - QString mac; - if ( ioctl( SIOCGIWAP ) ) - { - mac.sprintf( "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X", - _ifr.ifr_hwaddr.sa_data[0]&0xff, - _ifr.ifr_hwaddr.sa_data[1]&0xff, - _ifr.ifr_hwaddr.sa_data[2]&0xff, - _ifr.ifr_hwaddr.sa_data[3]&0xff, - _ifr.ifr_hwaddr.sa_data[4]&0xff, - _ifr.ifr_hwaddr.sa_data[5]&0xff ); - } + return (const unsigned char*) &_ifr.ifr_hwaddr.sa_data[0]; else - { - mac = "<Unknown>"; - } - return mac; + return OMacAddress::unknown; } void OWirelessNetworkInterface::buildInformation() { //ML: If you listen carefully enough, you can hear lots of WLAN drivers suck //ML: The HostAP drivers need more than sizeof struct_iw range to complete //ML: SIOCGIWRANGE otherwise they fail with "Invalid Argument Length". //ML: The Wlan-NG drivers on the otherside fail (segfault!) if you allocate //ML: _too much_ space. This is damn shitty crap *sigh* //ML: We allocate a large memory region in RAM and check whether the //ML: driver pollutes this extra space. The complaint will be made on stdout, //ML: so please forward this... struct iwreq wrq; int len = sizeof( struct iw_range )*2; char *buffer = (char*) malloc( len ); //FIXME: Validate if we actually got the memory block memset( buffer, 0, len ); memcpy( wrq.ifr_name, name(), IFNAMSIZ); wrq.u.data.pointer = (caddr_t) buffer; wrq.u.data.length = sizeof( struct iw_range ); wrq.u.data.flags = 0; @@ -667,81 +654,60 @@ int OWirelessNetworkInterface::channels() const void OWirelessNetworkInterface::setChannelHopping( int interval ) { if ( !_hopper ) _hopper = new OChannelHopper( this ); _hopper->setInterval( interval ); //FIXME: When and by whom will the channel hopper be deleted? //TODO: rely on QObject hierarchy } int OWirelessNetworkInterface::channelHopping() const { return _hopper->interval(); } OChannelHopper* OWirelessNetworkInterface::channelHopper() const { return _hopper; } 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; - else if ( mode == "monitor" ) _iwr.u.mode = IW_MODE_MONITOR; - else - { - qDebug( "ONetwork: Warning! Invalid IEEE 802.11 mode '%s' specified.", (const char*) mode ); - return; - } + _iwr.u.mode = stringToMode( mode ); 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"; - case IW_MODE_MONITOR: return "monitor"; - default: assert( 0 ); // shouldn't happen - } + return modeToString( _iwr.u.mode ); } void OWirelessNetworkInterface::setMonitorMode( bool b ) { if ( _mon ) _mon->setEnabled( b ); else qDebug( "ONetwork(): can't switch monitor mode without installed monitoring interface" ); } bool OWirelessNetworkInterface::monitorMode() const { qDebug( "dataLinkType = %d", dataLinkType() ); return ( dataLinkType() == ARPHRD_IEEE80211 || dataLinkType() == 802 ); //FIXME: 802 is the header type for PRISM - Linux support for this is pending... //FIXME: What is 119, by the way? } void OWirelessNetworkInterface::setNickName( const QString& nickname ) { _iwr.u.essid.pointer = const_cast<char*>( (const char*) nickname ); @@ -809,147 +775,170 @@ bool OWirelessNetworkInterface::hasPrivate( const QString& call ) QString OWirelessNetworkInterface::SSID() const { char str[IW_ESSID_MAX_SIZE]; _iwr.u.essid.pointer = &str[0]; _iwr.u.essid.length = IW_ESSID_MAX_SIZE; if ( !wioctl( SIOCGIWESSID ) ) { return "<unknown>"; } else { return str; } } void OWirelessNetworkInterface::setSSID( const QString& ssid ) { _iwr.u.essid.pointer = const_cast<char*>( (const char*) ssid ); _iwr.u.essid.length = ssid.length(); wioctl( SIOCSIWESSID ); } -int OWirelessNetworkInterface::scanNetwork() +OStationList* OWirelessNetworkInterface::scanNetwork() { _iwr.u.param.flags = IW_SCAN_DEFAULT; _iwr.u.param.value = 0; if ( !wioctl( SIOCSIWSCAN ) ) { - return -1; + return 0; } + OStationList* stations = new OStationList(); + int timeout = 1000000; qDebug( "ONetworkInterface::scanNetwork() - scan started." ); bool results = false; struct timeval tv; tv.tv_sec = 0; tv.tv_usec = 250000; // initial timeout ~ 250ms char buffer[IW_SCAN_MAX_DATA]; while ( !results && timeout > 0 ) { timeout -= tv.tv_usec; select( 0, 0, 0, 0, &tv ); _iwr.u.data.pointer = &buffer[0]; _iwr.u.data.flags = 0; _iwr.u.data.length = sizeof buffer; if ( wioctl( SIOCGIWSCAN ) ) { results = true; continue; } else if ( errno == EAGAIN) { qDebug( "ONetworkInterface::scanNetwork() - scan in progress..." ); #if 0 if ( qApp ) { qApp->processEvents( 100 ); continue; } #endif tv.tv_sec = 0; tv.tv_usec = 100000; continue; } } qDebug( "ONetworkInterface::scanNetwork() - scan finished." ); if ( results ) { qDebug( " - result length = %d", _iwr.u.data.length ); if ( !_iwr.u.data.length ) { qDebug( " - no results (empty neighbourhood)" ); - return 0; + return stations; } qDebug( " - results are in!" ); dumpBytes( (const unsigned char*) &buffer[0], _iwr.u.data.length ); - int stations = 0; - // parse results int offset = 0; struct iw_event* we = (struct iw_event*) &buffer[0]; while ( offset < _iwr.u.data.length ) { //const char* cmd = *(*_ioctlmap)[we->cmd]; //if ( !cmd ) cmd = "<unknown>"; qDebug( "reading next event... cmd=%d, len=%d", we->cmd, we->len ); switch (we->cmd) { - case SIOCGIWAP: qDebug( "SIOCGIWAP" ); stations++; break; - case SIOCGIWMODE: qDebug( "SIOCGIWMODE" ); break; - case SIOCGIWFREQ: qDebug( "SIOCGIWFREQ" ); break; - case SIOCGIWESSID: qDebug( "SIOCGIWESSID" ); break; + case SIOCGIWAP: + { + qDebug( "SIOCGIWAP" ); + stations->append( new OStation() ); + stations->last()->macAddress = (const unsigned char*) &we->u.ap_addr.sa_data[0]; + break; + } + case SIOCGIWMODE: + { + qDebug( "SIOCGIWMODE" ); + stations->last()->type = modeToString( we->u.mode ); + break; + } + case SIOCGIWFREQ: + { + qDebug( "SIOCGIWFREQ" ); + stations->last()->channel = _channels[ static_cast<int>(double( we->u.freq.m ) * pow( 10.0, we->u.freq.e ) / 1000000) ]; + break; + } + case SIOCGIWESSID: + { + qDebug( "SIOCGIWESSID" ); + stations->last()->ssid = we->u.essid.pointer; + break; + } case SIOCGIWSENS: qDebug( "SIOCGIWSENS" ); break; case SIOCGIWENCODE: qDebug( "SIOCGIWENCODE" ); break; case IWEVTXDROP: qDebug( "IWEVTXDROP" ); break; /* Packet dropped to excessive retry */ case IWEVQUAL: qDebug( "IWEVQUAL" ); break; /* Quality part of statistics (scan) */ case IWEVCUSTOM: qDebug( "IWEVCUSTOM" ); break; /* Driver specific ascii string */ case IWEVREGISTERED: qDebug( "IWEVREGISTERED" ); break; /* Discovered a new node (AP mode) */ case IWEVEXPIRED: qDebug( "IWEVEXPIRED" ); break; /* Expired a node (AP mode) */ default: qDebug( "unhandled event" ); } offset += we->len; we = (struct iw_event*) &buffer[offset]; } + return stations; + } else { qDebug( " - no results (timeout) :(" ); - return 0; + return stations; } } 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 ) ); else qDebug( "ONetworkInterface::wioctl (%s) call %s (0x%04X) - Status: Ok.", name(), (const char*) *(*_ioctlmap)[call], call ); return ( result != -1 ); #else return ::ioctl( _sfd, call, &iwreq ) != -1; #endif } bool OWirelessNetworkInterface::wioctl( int call ) const { strcpy( _iwr.ifr_name, name() ); return wioctl( call, _iwr ); } diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h index e1545dd..0eb4542 100644 --- a/libopie2/opienet/onetwork.h +++ b/libopie2/opienet/onetwork.h @@ -18,48 +18,49 @@ + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef ONETWORK_H #define ONETWORK_H #include "wireless.h" /* OPIE */ #include <opie2/onetutils.h> +#include <opie2/ostation.h> /* QT */ #include <qvaluelist.h> #include <qdict.h> #include <qmap.h> #include <qobject.h> #include <qhostaddress.h> class ONetworkInterface; class OWirelessNetworkInterface; class OChannelHopper; class OMonitoringInterface; /*====================================================================================== * ONetwork *======================================================================================*/ /** * @brief A container class for all network interfaces * * This class provides access to all available network interfaces of your computer. * * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> @@ -385,63 +386,63 @@ class OWirelessNetworkInterface : public ONetworkInterface virtual void setNickName( const QString& nickname ); /** * @returns the current station nickname. */ virtual QString nickName() const; /** * Invoke the private IOCTL @a command with a @number of parameters on the network interface. * @see OPrivateIOCTL */ virtual void setPrivate( const QString& command, int number, ... ); /** * @returns true if the interface is featuring the private IOCTL @command. */ virtual bool hasPrivate( const QString& command ); virtual void getPrivate( const QString& command ); //FIXME: Implement and document this /** * @returns true if the interface is associated to an access point * @note: This information is only valid if the interface is in managed mode. */ virtual bool isAssociated() const; /** * @returns the MAC address of the Access Point if the device is in infrastructure mode. * @returns a (more or less random) cell ID address if the device is in adhoc mode. */ - virtual QString associatedAP() const; + virtual OMacAddress associatedAP() const; /** * Set the @a ssid (Service Set ID) string. This is used to decide * which network to associate with (use "any" to let the driver decide). */ virtual void setSSID( const QString& ssid ); /** * @returns the current SSID (Service Set ID). */ virtual QString SSID() const; /** * Perform scanning the wireless network neighbourhood. * @note: UNSTABLE API - UNDER CONSTRUCTION - DON'T USE! */ - virtual int scanNetwork(); + virtual OStationList* scanNetwork(); protected: void buildInformation(); void buildPrivateList(); void dumpInformation() const; virtual void init(); struct iwreq& iwr() const; bool wioctl( int call ) const; bool wioctl( int call, struct iwreq& ) const; protected: mutable struct iwreq _iwr; QMap<int,int> _channels; struct iw_range _range; private: OChannelHopper* _hopper; }; /*====================================================================================== * OMonitoringInterface *======================================================================================*/ diff --git a/libopie2/opienet/ostation.cpp b/libopie2/opienet/ostation.cpp index 3817b31..ba1e4f6 100644 --- a/libopie2/opienet/ostation.cpp +++ b/libopie2/opienet/ostation.cpp @@ -17,33 +17,48 @@ : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <opie2/ostation.h> /*====================================================================================== * OStation *======================================================================================*/ OStation::OStation() { qDebug( "OStation::OStation()" ); + + type = "<unknown>"; + macAddress = OMacAddress::unknown; + ssid = "<unknown>"; + channel = 0; + apAddress = OMacAddress::unknown; + } OStation::~OStation() { qDebug( "OStation::~OStation()" ); } +void OStation::dump() +{ + qDebug( "------- OStation::dump() ------------" ); + qDebug( "type: %s", (const char*) type ); + qDebug( "mac: %s", (const char*) macAddress.toString() ); + qDebug( "ap: %s", (const char*) apAddress.toString() ); + qDebug( "ip: %s", (const char*) ipAddress.toString() ); +} diff --git a/libopie2/opienet/ostation.h b/libopie2/opienet/ostation.h index f61570b..a6956c9 100644 --- a/libopie2/opienet/ostation.h +++ b/libopie2/opienet/ostation.h @@ -13,55 +13,62 @@ ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef OSTATION_H #define OSTATION_H #include <opie2/onetutils.h> -#include <qdict.h> -#include <qmap.h> +#include <qlist.h> #include <qstring.h> #include <qhostaddress.h> #include <qobject.h> #include <sys/types.h> class OStation; -typedef QDict<OStation> OStationDict; +typedef QList<OStation> OStationList; /*====================================================================================== * OStation *======================================================================================*/ class OStation { public: OStation(); ~OStation(); - private: + void dump(); + + /* Ethernet */ + QString type; OMacAddress macAddress; QHostAddress ipAddress; + + /* WaveLan */ QString ssid; - QString type; + OMacAddress apAddress; + int channel; + bool encrypted; }; + #endif // OSTATION_H |