summaryrefslogtreecommitdiff
path: root/libopie2
authormickeyl <mickeyl>2005-05-16 17:48:03 (UTC)
committer mickeyl <mickeyl>2005-05-16 17:48:03 (UTC)
commitd2426de3452342ab4af8e95214b9ff408f30744e (patch) (unidiff)
tree41eb23ab226a83778112aaf6d14ab3e8fc5dc896 /libopie2
parenta0276f0957bd503491e8d435b7ad1a6479ce24eb (diff)
downloadopie-d2426de3452342ab4af8e95214b9ff408f30744e.zip
opie-d2426de3452342ab4af8e95214b9ff408f30744e.tar.gz
opie-d2426de3452342ab4af8e95214b9ff408f30744e.tar.bz2
- add ONetworkInterfaceDriverInfo block extracting info using ethtool ioctls
- adjust example
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opienet/onetutils.h26
-rw-r--r--libopie2/opienet/onetwork.cpp31
-rw-r--r--libopie2/opienet/onetwork.h7
-rw-r--r--libopie2/opienet/opienet.pro2
4 files changed, 55 insertions, 11 deletions
diff --git a/libopie2/opienet/onetutils.h b/libopie2/opienet/onetutils.h
index 32f5355..25c9238 100644
--- a/libopie2/opienet/onetutils.h
+++ b/libopie2/opienet/onetutils.h
@@ -7,192 +7,218 @@
7 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; version 2 of the License. 11 - .   .-<_>     .<> Foundation; version 2 of the License.
12     ._= =}       : 12     ._= =}       :
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28 28
29*/ 29*/
30 30
31#ifndef ONETUTILS_H 31#ifndef ONETUTILS_H
32#define ONETUTILS_H 32#define ONETUTILS_H
33 33
34#include <qdict.h> 34#include <qdict.h>
35#include <qmap.h> 35#include <qmap.h>
36#include <qstring.h> 36#include <qstring.h>
37#include <qhostaddress.h> 37#include <qhostaddress.h>
38#include <qobject.h> 38#include <qobject.h>
39 39
40#include <sys/types.h> 40#include <sys/types.h>
41 41
42struct ifreq; 42struct ifreq;
43 43
44namespace Opie { 44namespace Opie {
45namespace Net { 45namespace Net {
46 46
47class OWirelessNetworkInterface; 47class OWirelessNetworkInterface;
48 48
49/*====================================================================================== 49/*======================================================================================
50 * OMacAddress 50 * OMacAddress
51 *======================================================================================*/ 51 *======================================================================================*/
52 52
53class OMacAddress 53class OMacAddress
54{ 54{
55 public: 55 public:
56 // QString c'tor? -zecke 56 // QString c'tor? -zecke
57 OMacAddress(); 57 OMacAddress();
58 OMacAddress( unsigned char* ); 58 OMacAddress( unsigned char* );
59 OMacAddress( const unsigned char* ); 59 OMacAddress( const unsigned char* );
60 OMacAddress( struct ifreq& ); 60 OMacAddress( struct ifreq& );
61 ~OMacAddress(); 61 ~OMacAddress();
62 62
63 QString manufacturer() const; 63 QString manufacturer() const;
64 QString toString( bool substitute = false ) const; 64 QString toString( bool substitute = false ) const;
65 const unsigned char* native() const; 65 const unsigned char* native() const;
66 66
67 // no c'tor but this one why not make it a c'tor. it could also replace the others or is this the problem? 67 // no c'tor but this one why not make it a c'tor. it could also replace the others or is this the problem?
68 static OMacAddress fromString( const QString& ); 68 static OMacAddress fromString( const QString& );
69 69
70 public: 70 public:
71 static const OMacAddress& broadcast; // ff:ff:ff:ff:ff:ff 71 static const OMacAddress& broadcast; // ff:ff:ff:ff:ff:ff
72 static const OMacAddress& unknown; // 44:44:44:44:44:44 72 static const OMacAddress& unknown; // 44:44:44:44:44:44
73 73
74 private: 74 private:
75 unsigned char _bytes[6]; 75 unsigned char _bytes[6];
76 76
77 friend bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); 77 friend bool operator==( const OMacAddress &m1, const OMacAddress &m2 );
78 class Private; 78 class Private;
79 Private *d; 79 Private *d;
80 80
81}; 81};
82 82
83bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); 83bool operator==( const OMacAddress &m1, const OMacAddress &m2 );
84 84
85 85
86/*====================================================================================== 86/*======================================================================================
87 * OHostAddress 87 * OHostAddress
88 *======================================================================================*/ 88 *======================================================================================*/
89 89
90class OHostAddress : public QHostAddress 90class OHostAddress : public QHostAddress
91{ 91{
92 /*public: 92 /*public:
93 OHostAddress(); 93 OHostAddress();
94 ~OHostAddress(); 94 ~OHostAddress();
95 */ 95 */
96 private: 96 private:
97 class Private; 97 class Private;
98 Private *d; 98 Private *d;
99}; 99};
100 100
101 101
102/*====================================================================================== 102/*======================================================================================
103 * ONetworkInterfaceDriverInfo
104 *======================================================================================*/
105
106class ONetworkInterfaceDriverInfo
107{
108 public:
109 ONetworkInterfaceDriverInfo( const QString& name = "<unknown>",
110 const QString& version = "<unknown>",
111 const QString& firmware = "<unknown>",
112 const QString& bus = "<unknown>" ) :
113 _name( name ), _version( version ), _firmware( firmware ), _bus( bus ) { };
114 ~ONetworkInterfaceDriverInfo() { };
115
116 QString name() const { return _name; };
117 QString version() const { return _version; };
118 QString firmware() const { return _firmware; };
119 QString bus() const { return _bus; };
120
121 private:
122 const QString _name;
123 const QString _version;
124 const QString _firmware;
125 const QString _bus;
126};
127
128/*======================================================================================
103 * OPrivateIOCTL 129 * OPrivateIOCTL
104 *======================================================================================*/ 130 *======================================================================================*/
105 131
106class OPrivateIOCTL : public QObject 132class OPrivateIOCTL : public QObject
107{ 133{
108 public: 134 public:
109 OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ); 135 OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs );
110 ~OPrivateIOCTL(); 136 ~OPrivateIOCTL();
111 137
112 int numberGetArgs() const; 138 int numberGetArgs() const;
113 int typeGetArgs() const; 139 int typeGetArgs() const;
114 int numberSetArgs() const; 140 int numberSetArgs() const;
115 int typeSetArgs() const; 141 int typeSetArgs() const;
116 142
117 // FIXME return int? as ::ioctl does? -zecke 143 // FIXME return int? as ::ioctl does? -zecke
118 void invoke() const; 144 void invoke() const;
119 void setParameter( int, u_int32_t ); 145 void setParameter( int, u_int32_t );
120 146
121 private: 147 private:
122 u_int32_t _ioctl; 148 u_int32_t _ioctl;
123 u_int16_t _getargs; 149 u_int16_t _getargs;
124 u_int16_t _setargs; 150 u_int16_t _setargs;
125 151
126 class Private; 152 class Private;
127 Private *d; 153 Private *d;
128}; 154};
129 155
130 /*====================================================================================== 156 /*======================================================================================
131 * Miscellaneous 157 * Miscellaneous
132 *======================================================================================*/ 158 *======================================================================================*/
133 159
134namespace Internal { 160namespace Internal {
135void dumpBytes( const unsigned char* data, int num ); 161void dumpBytes( const unsigned char* data, int num );
136QString modeToString( int ); 162QString modeToString( int );
137int stringToMode( const QString& ); 163int stringToMode( const QString& );
138} 164}
139} 165}
140} 166}
141 167
142#define IW_PRIV_TYPE_MASK 0x7000 168#define IW_PRIV_TYPE_MASK 0x7000
143#define IW_PRIV_TYPE_NONE 0x0000 169#define IW_PRIV_TYPE_NONE 0x0000
144#define IW_PRIV_TYPE_BYTE 0x1000 170#define IW_PRIV_TYPE_BYTE 0x1000
145#define IW_PRIV_TYPE_CHAR 0x2000 171#define IW_PRIV_TYPE_CHAR 0x2000
146#define IW_PRIV_TYPE_INT 0x4000 172#define IW_PRIV_TYPE_INT 0x4000
147#define IW_PRIV_TYPE_FLOAT 0x5000 173#define IW_PRIV_TYPE_FLOAT 0x5000
148#define IW_PRIV_TYPE_ADDR 0x6000 174#define IW_PRIV_TYPE_ADDR 0x6000
149#define IW_PRIV_SIZE_FIXED 0x0800 175#define IW_PRIV_SIZE_FIXED 0x0800
150#define IW_PRIV_SIZE_MASK 0x07FF 176#define IW_PRIV_SIZE_MASK 0x07FF
151 177
152#define IW_HEADER_TYPE_NULL 0 /* Not available */ 178#define IW_HEADER_TYPE_NULL 0 /* Not available */
153#define IW_HEADER_TYPE_CHAR 2 /* char [IFNAMSIZ] */ 179#define IW_HEADER_TYPE_CHAR 2 /* char [IFNAMSIZ] */
154#define IW_HEADER_TYPE_UINT 4 /* __u32 */ 180#define IW_HEADER_TYPE_UINT 4 /* __u32 */
155#define IW_HEADER_TYPE_FREQ 5 /* struct iw_freq */ 181#define IW_HEADER_TYPE_FREQ 5 /* struct iw_freq */
156#define IW_HEADER_TYPE_ADDR 6 /* struct sockaddr */ 182#define IW_HEADER_TYPE_ADDR 6 /* struct sockaddr */
157#define IW_HEADER_TYPE_POINT 8 /* struct iw_point */ 183#define IW_HEADER_TYPE_POINT 8 /* struct iw_point */
158#define IW_HEADER_TYPE_PARAM 9 /* struct iw_param */ 184#define IW_HEADER_TYPE_PARAM 9 /* struct iw_param */
159#define IW_HEADER_TYPE_QUAL 10 /* struct iw_quality */ 185#define IW_HEADER_TYPE_QUAL 10 /* struct iw_quality */
160 186
161#define IW_EV_POINT_OFF (((char *) &(((struct iw_point *) NULL)->length)) - \ 187#define IW_EV_POINT_OFF (((char *) &(((struct iw_point *) NULL)->length)) - \
162 (char *) NULL) 188 (char *) NULL)
163 189
164#ifndef ARPHRD_IEEE80211 190#ifndef ARPHRD_IEEE80211
165#define ARPHRD_IEEE80211 801 191#define ARPHRD_IEEE80211 801
166#endif 192#endif
167#ifndef ARPHRD_IEEE80211_PRISM 193#ifndef ARPHRD_IEEE80211_PRISM
168#define ARPHRD_IEEE80211_PRISM 802 194#define ARPHRD_IEEE80211_PRISM 802
169#endif 195#endif
170 196
171/* Wireless Extension Scanning Stuff */ 197/* Wireless Extension Scanning Stuff */
172struct iw_stream_descr 198struct iw_stream_descr
173{ 199{
174 char * end; /* End of the stream */ 200 char * end; /* End of the stream */
175 char * current; /* Current event in stream of events */ 201 char * current; /* Current event in stream of events */
176 char * value; /* Current value in event */ 202 char * value; /* Current value in event */
177}; 203};
178 204
179 205
180/* Network to host order macros */ 206/* Network to host order macros */
181 207
182#ifdef LBL_ALIGN 208#ifdef LBL_ALIGN
183#define EXTRACT_16BITS(p) \ 209#define EXTRACT_16BITS(p) \
184 ((u_int16_t)((u_int16_t)*((const u_int8_t *)(p) + 0) << 8 | \ 210 ((u_int16_t)((u_int16_t)*((const u_int8_t *)(p) + 0) << 8 | \
185 (u_int16_t)*((const u_int8_t *)(p) + 1))) 211 (u_int16_t)*((const u_int8_t *)(p) + 1)))
186#define EXTRACT_32BITS(p) \ 212#define EXTRACT_32BITS(p) \
187 ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 0) << 24 | \ 213 ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 0) << 24 | \
188 (u_int32_t)*((const u_int8_t *)(p) + 1) << 16 | \ 214 (u_int32_t)*((const u_int8_t *)(p) + 1) << 16 | \
189 (u_int32_t)*((const u_int8_t *)(p) + 2) << 8 | \ 215 (u_int32_t)*((const u_int8_t *)(p) + 2) << 8 | \
190 (u_int32_t)*((const u_int8_t *)(p) + 3))) 216 (u_int32_t)*((const u_int8_t *)(p) + 3)))
191#else 217#else
192#define EXTRACT_16BITS(p) \ 218#define EXTRACT_16BITS(p) \
193 ((u_int16_t)ntohs(*(const u_int16_t *)(p))) 219 ((u_int16_t)ntohs(*(const u_int16_t *)(p)))
194#define EXTRACT_32BITS(p) \ 220#define EXTRACT_32BITS(p) \
195 ((u_int32_t)ntohl(*(const u_int32_t *)(p))) 221 ((u_int32_t)ntohl(*(const u_int32_t *)(p)))
196#endif 222#endif
197 223
198#define EXTRACT_24BITS(p) \ 224#define EXTRACT_24BITS(p) \
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp
index 05513f8..1deb051 100644
--- a/libopie2/opienet/onetwork.cpp
+++ b/libopie2/opienet/onetwork.cpp
@@ -1,159 +1,161 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) 2003-2005 by Michael 'Mickey' Lauer <mickey@Vanille.de> 3              Copyright (C) 2003-2005 by Michael 'Mickey' Lauer <mickey@Vanille.de>
4 =. 4 =.
5 .=l. 5 .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; version 2 of the License. 11 - .   .-<_>     .<> Foundation; version 2 of the License.
12     ._= =}       : 12     ._= =}       :
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28 28
29*/ 29*/
30 30
31/* OPIE */ 31/* OPIE */
32
33#include <opie2/onetwork.h> 32#include <opie2/onetwork.h>
34#include <opie2/ostation.h> 33#include <opie2/ostation.h>
35#include <opie2/odebug.h> 34#include <opie2/odebug.h>
35using namespace Opie::Core;
36 36
37/* QT */ 37/* QT */
38
39#include <qfile.h> 38#include <qfile.h>
40#include <qtextstream.h> 39#include <qtextstream.h>
41#include <qapplication.h> 40#include <qapplication.h>
42 41
43/* UNIX */ 42/* STD */
44
45#include <assert.h> 43#include <assert.h>
46#include <arpa/inet.h> 44#include <arpa/inet.h>
47#include <errno.h> 45#include <errno.h>
46#include <stdarg.h>
48#include <string.h> 47#include <string.h>
49#include <stdlib.h> 48#include <stdlib.h>
50#include <math.h> 49#include <math.h>
50#include <unistd.h>
51#include <net/if_arp.h>
52#include <net/ethernet.h>
51#include <sys/ioctl.h> 53#include <sys/ioctl.h>
52#include <sys/socket.h> 54#include <sys/socket.h>
53#include <sys/types.h> 55#include <sys/types.h>
54#include <unistd.h> 56#include <linux/types.h>
55#include <linux/sockios.h> 57#include <linux/sockios.h>
56#include <net/if_arp.h> 58#define u64 __u64
57#include <net/ethernet.h> 59#define u32 __u32
58#include <stdarg.h> 60#define u16 __u16
61#define u8 __u8
62#include <linux/ethtool.h>
59 63
60#ifndef NODEBUG 64#ifndef NODEBUG
61#include <opie2/odebugmapper.h> 65#include <opie2/odebugmapper.h>
62
63using namespace Opie::Core;
64using namespace Opie::Net::Internal; 66using namespace Opie::Net::Internal;
65DebugMapper* debugmapper = new DebugMapper(); 67DebugMapper* debugmapper = new DebugMapper();
66#endif 68#endif
67 69
68/*====================================================================================== 70/*======================================================================================
69 * ONetwork 71 * ONetwork
70 *======================================================================================*/ 72 *======================================================================================*/
71 73
72namespace Opie { 74namespace Opie {
73namespace Net { 75namespace Net {
74ONetwork* ONetwork::_instance = 0; 76ONetwork* ONetwork::_instance = 0;
75 77
76ONetwork::ONetwork() 78ONetwork::ONetwork()
77{ 79{
78 odebug << "ONetwork::ONetwork()" << oendl; 80 odebug << "ONetwork::ONetwork()" << oendl;
79 odebug << "ONetwork: This code has been compiled against Wireless Extensions V" << WIRELESS_EXT << oendl; 81 odebug << "ONetwork: This code has been compiled against Wireless Extensions V" << WIRELESS_EXT << oendl;
80 synchronize(); 82 synchronize();
81} 83}
82 84
83void ONetwork::synchronize() 85void ONetwork::synchronize()
84{ 86{
85 // gather available interfaces by inspecting /proc/net/dev 87 // gather available interfaces by inspecting /proc/net/dev
86 //FIXME: we could use SIOCGIFCONF here, but we aren't interested in virtual (e.g. eth0:0) devices 88 //FIXME: we could use SIOCGIFCONF here, but we aren't interested in virtual (e.g. eth0:0) devices
87 //FIXME: Use SIOCGIFCONF anway, because we can disable listing of aliased devices 89 //FIXME: Use SIOCGIFCONF anway, because we can disable listing of aliased devices
88 //FIXME: Best is use SIOCGIFCONF and if this doesn't work (result=-1), then fallback to parsing /proc/net/dev 90 //FIXME: Best is use SIOCGIFCONF and if this doesn't work (result=-1), then fallback to parsing /proc/net/dev
89 91
90 _interfaces.clear(); 92 _interfaces.clear();
91 QString str; 93 QString str;
92 QFile f( "/proc/net/dev" ); 94 QFile f( "/proc/net/dev" );
93 bool hasFile = f.open( IO_ReadOnly ); 95 bool hasFile = f.open( IO_ReadOnly );
94 if ( !hasFile ) 96 if ( !hasFile )
95 { 97 {
96 odebug << "ONetwork: /proc/net/dev not existing. No network devices available" << oendl; 98 odebug << "ONetwork: /proc/net/dev not existing. No network devices available" << oendl;
97 return; 99 return;
98 } 100 }
99 QTextStream s( &f ); 101 QTextStream s( &f );
100 s.readLine(); 102 s.readLine();
101 s.readLine(); 103 s.readLine();
102 while ( !s.atEnd() ) 104 while ( !s.atEnd() )
103 { 105 {
104 s >> str; 106 s >> str;
105 str.truncate( str.find( ':' ) ); 107 str.truncate( str.find( ':' ) );
106 odebug << "ONetwork: found interface '" << str << "'" << oendl; 108 odebug << "ONetwork: found interface '" << str << "'" << oendl;
107 if ( str.startsWith( "wifi" ) ) 109 if ( str.startsWith( "wifi" ) )
108 { 110 {
109 odebug << "ONetwork: ignoring hostap control interface" << oendl; 111 odebug << "ONetwork: ignoring hostap control interface" << oendl;
110 s.readLine(); 112 s.readLine();
111 continue; 113 continue;
112 } 114 }
113 ONetworkInterface* iface = 0; 115 ONetworkInterface* iface = 0;
114 if ( isWirelessInterface( str ) ) 116 if ( isWirelessInterface( str ) )
115 { 117 {
116 iface = new OWirelessNetworkInterface( this, (const char*) str ); 118 iface = new OWirelessNetworkInterface( this, (const char*) str );
117 odebug << "ONetwork: interface '" << str << "' has Wireless Extensions" << oendl; 119 odebug << "ONetwork: interface '" << str << "' has Wireless Extensions" << oendl;
118 } 120 }
119 else 121 else
120 { 122 {
121 iface = new ONetworkInterface( this, (const char*) str ); 123 iface = new ONetworkInterface( this, (const char*) str );
122 } 124 }
123 _interfaces.insert( str, iface ); 125 _interfaces.insert( str, iface );
124 s.readLine(); 126 s.readLine();
125 } 127 }
126} 128}
127 129
128 130
129short ONetwork::wirelessExtensionCompileVersion() 131short ONetwork::wirelessExtensionCompileVersion()
130{ 132{
131 return WIRELESS_EXT; 133 return WIRELESS_EXT;
132} 134}
133 135
134 136
135int ONetwork::count() const 137int ONetwork::count() const
136{ 138{
137 return _interfaces.count(); 139 return _interfaces.count();
138} 140}
139 141
140 142
141ONetworkInterface* ONetwork::interface( const QString& iface ) const 143ONetworkInterface* ONetwork::interface( const QString& iface ) const
142{ 144{
143 return _interfaces[iface]; 145 return _interfaces[iface];
144} 146}
145 147
146 148
147ONetwork* ONetwork::instance() 149ONetwork* ONetwork::instance()
148{ 150{
149 if ( !_instance ) _instance = new ONetwork(); 151 if ( !_instance ) _instance = new ONetwork();
150 return _instance; 152 return _instance;
151} 153}
152 154
153 155
154ONetwork::InterfaceIterator ONetwork::iterator() const 156ONetwork::InterfaceIterator ONetwork::iterator() const
155{ 157{
156 return ONetwork::InterfaceIterator( _interfaces ); 158 return ONetwork::InterfaceIterator( _interfaces );
157} 159}
158 160
159 161
@@ -288,216 +290,225 @@ void ONetworkInterface::setMacAddress( const OMacAddress& addr )
288 memcpy( &_ifr.ifr_hwaddr.sa_data, addr.native(), 6 ); 290 memcpy( &_ifr.ifr_hwaddr.sa_data, addr.native(), 6 );
289 ioctl( SIOCSIFHWADDR ); 291 ioctl( SIOCSIFHWADDR );
290} 292}
291 293
292 294
293OMacAddress ONetworkInterface::macAddress() const 295OMacAddress ONetworkInterface::macAddress() const
294{ 296{
295 if ( ioctl( SIOCGIFHWADDR ) ) 297 if ( ioctl( SIOCGIFHWADDR ) )
296 { 298 {
297 return OMacAddress( _ifr ); 299 return OMacAddress( _ifr );
298 } 300 }
299 else 301 else
300 { 302 {
301 return OMacAddress::unknown; 303 return OMacAddress::unknown;
302 } 304 }
303} 305}
304 306
305 307
306void ONetworkInterface::setIPV4Netmask( const QHostAddress& addr ) 308void ONetworkInterface::setIPV4Netmask( const QHostAddress& addr )
307{ 309{
308 struct sockaddr_in *sa = (struct sockaddr_in *) &_ifr.ifr_addr; 310 struct sockaddr_in *sa = (struct sockaddr_in *) &_ifr.ifr_addr;
309 sa->sin_family = AF_INET; 311 sa->sin_family = AF_INET;
310 sa->sin_port = 0; 312 sa->sin_port = 0;
311 sa->sin_addr.s_addr = htonl( addr.ip4Addr() ); 313 sa->sin_addr.s_addr = htonl( addr.ip4Addr() );
312 ioctl( SIOCSIFNETMASK ); 314 ioctl( SIOCSIFNETMASK );
313} 315}
314 316
315 317
316QString ONetworkInterface::ipV4Netmask() const 318QString ONetworkInterface::ipV4Netmask() const
317{ 319{
318 if ( ioctl( SIOCGIFNETMASK ) ) 320 if ( ioctl( SIOCGIFNETMASK ) )
319 { 321 {
320 struct sockaddr_in* sa = (struct sockaddr_in *) &_ifr.ifr_addr; 322 struct sockaddr_in* sa = (struct sockaddr_in *) &_ifr.ifr_addr;
321 //FIXME: Use QHostAddress here 323 //FIXME: Use QHostAddress here
322 return QString( inet_ntoa( sa->sin_addr ) ); 324 return QString( inet_ntoa( sa->sin_addr ) );
323 } 325 }
324 else 326 else
325 return "<unknown>"; 327 return "<unknown>";
326} 328}
327 329
328 330
329int ONetworkInterface::dataLinkType() const 331int ONetworkInterface::dataLinkType() const
330{ 332{
331 if ( ioctl( SIOCGIFHWADDR ) ) 333 if ( ioctl( SIOCGIFHWADDR ) )
332 { 334 {
333 return _ifr.ifr_hwaddr.sa_family; 335 return _ifr.ifr_hwaddr.sa_family;
334 } 336 }
335 else 337 else
336 { 338 {
337 return -1; 339 return -1;
338 } 340 }
339} 341}
340 342
341 343
342void ONetworkInterface::setMonitoring( OMonitoringInterface* m ) 344void ONetworkInterface::setMonitoring( OMonitoringInterface* m )
343{ 345{
344 _mon = m; 346 _mon = m;
345 odebug << "ONetwork::setMonitoring(): Installed monitoring driver '" << m->name() << "' on interface '" << name() << "'" << oendl; 347 odebug << "ONetwork::setMonitoring(): Installed monitoring driver '" << m->name() << "' on interface '" << name() << "'" << oendl;
346} 348}
347 349
348 350
349OMonitoringInterface* ONetworkInterface::monitoring() const 351OMonitoringInterface* ONetworkInterface::monitoring() const
350{ 352{
351 return _mon; 353 return _mon;
352} 354}
353 355
354 356
355ONetworkInterface::~ONetworkInterface() 357ONetworkInterface::~ONetworkInterface()
356{ 358{
357 odebug << "ONetworkInterface::~ONetworkInterface()" << oendl; 359 odebug << "ONetworkInterface::~ONetworkInterface()" << oendl;
358 if ( _sfd != -1 ) ::close( _sfd ); 360 if ( _sfd != -1 ) ::close( _sfd );
359} 361}
360 362
361 363
362bool ONetworkInterface::setPromiscuousMode( bool b ) 364bool ONetworkInterface::setPromiscuousMode( bool b )
363{ 365{
364 ioctl( SIOCGIFFLAGS ); 366 ioctl( SIOCGIFFLAGS );
365 if ( b ) _ifr.ifr_flags |= IFF_PROMISC; 367 if ( b ) _ifr.ifr_flags |= IFF_PROMISC;
366 else _ifr.ifr_flags &= (~IFF_PROMISC); 368 else _ifr.ifr_flags &= (~IFF_PROMISC);
367 return ioctl( SIOCSIFFLAGS ); 369 return ioctl( SIOCSIFFLAGS );
368} 370}
369 371
370 372
371bool ONetworkInterface::promiscuousMode() const 373bool ONetworkInterface::promiscuousMode() const
372{ 374{
373 ioctl( SIOCGIFFLAGS ); 375 ioctl( SIOCGIFFLAGS );
374 return _ifr.ifr_flags & IFF_PROMISC; 376 return _ifr.ifr_flags & IFF_PROMISC;
375} 377}
376 378
377 379
378bool ONetworkInterface::isWireless() const 380bool ONetworkInterface::isWireless() const
379{ 381{
380 return ioctl( SIOCGIWNAME ); 382 return ioctl( SIOCGIWNAME );
381} 383}
382 384
383 385
386ONetworkInterfaceDriverInfo ONetworkInterface::driverInfo() const
387{
388 struct ethtool_drvinfo info;
389 info.cmd = ETHTOOL_GDRVINFO;
390 _ifr.ifr_data = (caddr_t) &info;
391 return ioctl( SIOCETHTOOL ) ? ONetworkInterfaceDriverInfo( info.driver, info.version, info.fw_version, info.bus_info) : ONetworkInterfaceDriverInfo();
392}
393
384/*====================================================================================== 394/*======================================================================================
385 * OChannelHopper 395 * OChannelHopper
386 *======================================================================================*/ 396 *======================================================================================*/
387 397
388OChannelHopper::OChannelHopper( OWirelessNetworkInterface* iface ) 398OChannelHopper::OChannelHopper( OWirelessNetworkInterface* iface )
389 :QObject( 0, "Mickey's funky hopper" ), 399 :QObject( 0, "Mickey's funky hopper" ),
390 _iface( iface ), _interval( 0 ), _tid( 0 ) 400 _iface( iface ), _interval( 0 ), _tid( 0 )
391{ 401{
392 int _maxChannel = iface->channels(); 402 int _maxChannel = iface->channels();
393 // generate fancy hopping sequence honoring the device capabilities 403 // generate fancy hopping sequence honoring the device capabilities
394 if ( _maxChannel >= 1 ) _channels.append( 1 ); 404 if ( _maxChannel >= 1 ) _channels.append( 1 );
395 if ( _maxChannel >= 7 ) _channels.append( 7 ); 405 if ( _maxChannel >= 7 ) _channels.append( 7 );
396 if ( _maxChannel >= 13 ) _channels.append( 13 ); 406 if ( _maxChannel >= 13 ) _channels.append( 13 );
397 if ( _maxChannel >= 2 ) _channels.append( 2 ); 407 if ( _maxChannel >= 2 ) _channels.append( 2 );
398 if ( _maxChannel >= 8 ) _channels.append( 8 ); 408 if ( _maxChannel >= 8 ) _channels.append( 8 );
399 if ( _maxChannel >= 3 ) _channels.append( 3 ); 409 if ( _maxChannel >= 3 ) _channels.append( 3 );
400 if ( _maxChannel >= 14 ) _channels.append( 14 ); 410 if ( _maxChannel >= 14 ) _channels.append( 14 );
401 if ( _maxChannel >= 9 ) _channels.append( 9 ); 411 if ( _maxChannel >= 9 ) _channels.append( 9 );
402 if ( _maxChannel >= 4 ) _channels.append( 4 ); 412 if ( _maxChannel >= 4 ) _channels.append( 4 );
403 if ( _maxChannel >= 10 ) _channels.append( 10 ); 413 if ( _maxChannel >= 10 ) _channels.append( 10 );
404 if ( _maxChannel >= 5 ) _channels.append( 5 ); 414 if ( _maxChannel >= 5 ) _channels.append( 5 );
405 if ( _maxChannel >= 11 ) _channels.append( 11 ); 415 if ( _maxChannel >= 11 ) _channels.append( 11 );
406 if ( _maxChannel >= 6 ) _channels.append( 6 ); 416 if ( _maxChannel >= 6 ) _channels.append( 6 );
407 if ( _maxChannel >= 12 ) _channels.append( 12 ); 417 if ( _maxChannel >= 12 ) _channels.append( 12 );
418 //FIXME: Add 802.11a/g channels
408 _channel = _channels.begin(); 419 _channel = _channels.begin();
409} 420}
410 421
411 422
412OChannelHopper::~OChannelHopper() 423OChannelHopper::~OChannelHopper()
413{ 424{
414} 425}
415 426
416 427
417bool OChannelHopper::isActive() const 428bool OChannelHopper::isActive() const
418{ 429{
419 return _tid; 430 return _tid;
420} 431}
421 432
422 433
423int OChannelHopper::channel() const 434int OChannelHopper::channel() const
424{ 435{
425 return *_channel; 436 return *_channel;
426} 437}
427 438
428 439
429void OChannelHopper::timerEvent( QTimerEvent* ) 440void OChannelHopper::timerEvent( QTimerEvent* )
430{ 441{
431 _iface->setChannel( *_channel ); 442 _iface->setChannel( *_channel );
432 emit( hopped( *_channel ) ); 443 emit( hopped( *_channel ) );
433 odebug << "OChannelHopper::timerEvent(): set channel " << *_channel << " on interface '" << _iface->name() << "'" << oendl; 444 odebug << "OChannelHopper::timerEvent(): set channel " << *_channel << " on interface '" << _iface->name() << "'" << oendl;
434 if ( ++_channel == _channels.end() ) _channel = _channels.begin(); 445 if ( ++_channel == _channels.end() ) _channel = _channels.begin();
435} 446}
436 447
437 448
438void OChannelHopper::setInterval( int interval ) 449void OChannelHopper::setInterval( int interval )
439{ 450{
440 if ( interval == _interval ) 451 if ( interval == _interval )
441 return; 452 return;
442 453
443 if ( _interval ) 454 if ( _interval )
444 killTimer( _tid ); 455 killTimer( _tid );
445 456
446 _tid = 0; 457 _tid = 0;
447 _interval = interval; 458 _interval = interval;
448 459
449 if ( _interval ) 460 if ( _interval )
450 { 461 {
451 _tid = startTimer( interval ); 462 _tid = startTimer( interval );
452 } 463 }
453} 464}
454 465
455 466
456int OChannelHopper::interval() const 467int OChannelHopper::interval() const
457{ 468{
458 return _interval; 469 return _interval;
459} 470}
460 471
461 472
462/*====================================================================================== 473/*======================================================================================
463 * OWirelessNetworkInterface 474 * OWirelessNetworkInterface
464 *======================================================================================*/ 475 *======================================================================================*/
465 476
466OWirelessNetworkInterface::OWirelessNetworkInterface( QObject* parent, const char* name ) 477OWirelessNetworkInterface::OWirelessNetworkInterface( QObject* parent, const char* name )
467 :ONetworkInterface( parent, name ), _hopper( 0 ) 478 :ONetworkInterface( parent, name ), _hopper( 0 )
468{ 479{
469 odebug << "OWirelessNetworkInterface::OWirelessNetworkInterface()" << oendl; 480 odebug << "OWirelessNetworkInterface::OWirelessNetworkInterface()" << oendl;
470 init(); 481 init();
471} 482}
472 483
473 484
474OWirelessNetworkInterface::~OWirelessNetworkInterface() 485OWirelessNetworkInterface::~OWirelessNetworkInterface()
475{ 486{
476} 487}
477 488
478 489
479struct iwreq& OWirelessNetworkInterface::iwr() const 490struct iwreq& OWirelessNetworkInterface::iwr() const
480{ 491{
481 return _iwr; 492 return _iwr;
482} 493}
483 494
484 495
485void OWirelessNetworkInterface::init() 496void OWirelessNetworkInterface::init()
486{ 497{
487 odebug << "OWirelessNetworkInterface::init()" << oendl; 498 odebug << "OWirelessNetworkInterface::init()" << oendl;
488 memset( &_iwr, 0, sizeof( struct iwreq ) ); 499 memset( &_iwr, 0, sizeof( struct iwreq ) );
489 buildInformation(); 500 buildInformation();
490 buildPrivateList(); 501 buildPrivateList();
491 dumpInformation(); 502 dumpInformation();
492} 503}
493 504
494 505
495bool OWirelessNetworkInterface::isAssociated() const 506bool OWirelessNetworkInterface::isAssociated() const
496{ 507{
497 //FIXME: handle different modes 508 //FIXME: handle different modes
498 return !(associatedAP() == OMacAddress::unknown); 509 return !(associatedAP() == OMacAddress::unknown);
499} 510}
500 511
501 512
502void OWirelessNetworkInterface::setAssociatedAP( const OMacAddress& mac ) const 513void OWirelessNetworkInterface::setAssociatedAP( const OMacAddress& mac ) const
503{ 514{
diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h
index fa9f39f..f0c4450 100644
--- a/libopie2/opienet/onetwork.h
+++ b/libopie2/opienet/onetwork.h
@@ -109,212 +109,219 @@ class ONetwork : public QObject
109 * e.g. after issuing a cardctl insert 109 * e.g. after issuing a cardctl insert
110 */ 110 */
111 void synchronize(); 111 void synchronize();
112 /** 112 /**
113 * @returns the wireless extension version used at compile time. 113 * @returns the wireless extension version used at compile time.
114 **/ 114 **/
115 static short wirelessExtensionCompileVersion(); 115 static short wirelessExtensionCompileVersion();
116 116
117 protected: 117 protected:
118 ONetwork(); 118 ONetwork();
119 119
120 private: 120 private:
121 static ONetwork* _instance; 121 static ONetwork* _instance;
122 InterfaceMap _interfaces; 122 InterfaceMap _interfaces;
123 class Private; 123 class Private;
124 Private *d; 124 Private *d;
125}; 125};
126 126
127 127
128/*====================================================================================== 128/*======================================================================================
129 * ONetworkInterface 129 * ONetworkInterface
130 *======================================================================================*/ 130 *======================================================================================*/
131 131
132/** 132/**
133 * @brief A network interface wrapper. 133 * @brief A network interface wrapper.
134 * 134 *
135 * This class provides a wrapper for a network interface. All the cumbersume details of 135 * This class provides a wrapper for a network interface. All the cumbersume details of
136 * Linux ioctls are hidden under a convenient high-level interface. 136 * Linux ioctls are hidden under a convenient high-level interface.
137 * @warning Most of the setting methods contained in this class require the appropriate 137 * @warning Most of the setting methods contained in this class require the appropriate
138 * process permissions to work. 138 * process permissions to work.
139 * 139 *
140 * @author Michael 'Mickey' Lauer <mickey@vanille.de> 140 * @author Michael 'Mickey' Lauer <mickey@vanille.de>
141 */ 141 */
142class ONetworkInterface : public QObject 142class ONetworkInterface : public QObject
143{ 143{
144 friend class OMonitoringInterface; 144 friend class OMonitoringInterface;
145 friend class OCiscoMonitoringInterface; 145 friend class OCiscoMonitoringInterface;
146 friend class OWlanNGMonitoringInterface; 146 friend class OWlanNGMonitoringInterface;
147 friend class OHostAPMonitoringInterface; 147 friend class OHostAPMonitoringInterface;
148 friend class OOrinocoMonitoringInterface; 148 friend class OOrinocoMonitoringInterface;
149 149
150 public: 150 public:
151 /** 151 /**
152 * Constructor. Normally you don't create @ref ONetworkInterface objects yourself, 152 * Constructor. Normally you don't create @ref ONetworkInterface objects yourself,
153 * but access them via @ref ONetwork::interface(). 153 * but access them via @ref ONetwork::interface().
154 */ 154 */
155 ONetworkInterface( QObject* parent, const char* name ); 155 ONetworkInterface( QObject* parent, const char* name );
156 /** 156 /**
157 * Destructor. 157 * Destructor.
158 */ 158 */
159 virtual ~ONetworkInterface(); 159 virtual ~ONetworkInterface();
160 /** 160 /**
161 * Associates a @a monitoring interface with this network interface. 161 * Associates a @a monitoring interface with this network interface.
162 * @note This is currently only useful with @ref OWirelessNetworkInterface objects. 162 * @note This is currently only useful with @ref OWirelessNetworkInterface objects.
163 */ 163 */
164 void setMonitoring( OMonitoringInterface* monitoring ); 164 void setMonitoring( OMonitoringInterface* monitoring );
165 /** 165 /**
166 * @returns the currently associated monitoring interface or 0, if no monitoring is associated. 166 * @returns the currently associated monitoring interface or 0, if no monitoring is associated.
167 */ 167 */
168 OMonitoringInterface* monitoring() const; 168 OMonitoringInterface* monitoring() const;
169 /** 169 /**
170 * Setting an interface to promiscuous mode enables the device to receive 170 * Setting an interface to promiscuous mode enables the device to receive
171 * all packets on the shared medium - as opposed to packets which are addressed to this interface. 171 * all packets on the shared medium - as opposed to packets which are addressed to this interface.
172 */ 172 */
173 bool setPromiscuousMode( bool ); 173 bool setPromiscuousMode( bool );
174 /** 174 /**
175 * @returns true if the interface is set to promiscuous mode. 175 * @returns true if the interface is set to promiscuous mode.
176 */ 176 */
177 bool promiscuousMode() const; 177 bool promiscuousMode() const;
178 /** 178 /**
179 * Setting an interface to up enables it to receive packets. 179 * Setting an interface to up enables it to receive packets.
180 */ 180 */
181 bool setUp( bool ); 181 bool setUp( bool );
182 /** 182 /**
183 * @returns true if the interface is up. 183 * @returns true if the interface is up.
184 */ 184 */
185 bool isUp() const; 185 bool isUp() const;
186 /** 186 /**
187 * @returns true if the interface is a loopback interface. 187 * @returns true if the interface is a loopback interface.
188 */ 188 */
189 bool isLoopback() const; 189 bool isLoopback() const;
190 /** 190 /**
191 * @returns true if the interface is featuring supports the wireless extension protocol. 191 * @returns true if the interface is featuring supports the wireless extension protocol.
192 */ 192 */
193 bool isWireless() const; 193 bool isWireless() const;
194 /** 194 /**
195 * Associate the IP address @ addr with the interface. 195 * Associate the IP address @ addr with the interface.
196 */ 196 */
197 void setIPV4Address( const QHostAddress& addr ); 197 void setIPV4Address( const QHostAddress& addr );
198 /** 198 /**
199 * @returns the IPv4 address associated with the interface. 199 * @returns the IPv4 address associated with the interface.
200 */ 200 */
201 QString ipV4Address() const; //TODO: make this return an OHostAddress 201 QString ipV4Address() const; //TODO: make this return an OHostAddress
202 /** 202 /**
203 * Associate the MAC address @a addr with the interface. 203 * Associate the MAC address @a addr with the interface.
204 * @note It can be necessary to shut down the interface prior to calling this method. 204 * @note It can be necessary to shut down the interface prior to calling this method.
205 * @note This operation needs root privileges
205 * @warning This is not supported by all drivers. 206 * @warning This is not supported by all drivers.
206 */ 207 */
207 void setMacAddress( const OMacAddress& addr ); 208 void setMacAddress( const OMacAddress& addr );
208 /** 209 /**
209 * @returns the MAC address associated with the interface. 210 * @returns the MAC address associated with the interface.
210 */ 211 */
211 OMacAddress macAddress() const; 212 OMacAddress macAddress() const;
212 /** 213 /**
213 * Associate the IPv4 @a netmask with the interface. 214 * Associate the IPv4 @a netmask with the interface.
214 */ 215 */
215 void setIPV4Netmask( const QHostAddress& netmask ); 216 void setIPV4Netmask( const QHostAddress& netmask );
216 /** 217 /**
217 * @returns the IPv4 netmask associated with the interface. 218 * @returns the IPv4 netmask associated with the interface.
218 */ 219 */
219 QString ipV4Netmask() const; //TODO: make this return an OHostAddress 220 QString ipV4Netmask() const; //TODO: make this return an OHostAddress
220 /** 221 /**
221 * @returns the data link type currently associated with the interface. 222 * @returns the data link type currently associated with the interface.
222 * @see #include <net/if_arp.h> for possible values. 223 * @see #include <net/if_arp.h> for possible values.
223 */ 224 */
224 int dataLinkType() const; 225 int dataLinkType() const;
226 /**
227 * @returns a ONetworkInterfaceDriverInfo driver information block
228 * @note This operation needs root privileges
229 * @warning This is not supported by all drivers
230 */
231 ONetworkInterfaceDriverInfo driverInfo() const;
225 232
226 protected: 233 protected:
227 const int _sfd; 234 const int _sfd;
228 mutable ifreq _ifr; 235 mutable ifreq _ifr;
229 OMonitoringInterface* _mon; 236 OMonitoringInterface* _mon;
230 237
231 protected: 238 protected:
232 struct ifreq& ifr() const; 239 struct ifreq& ifr() const;
233 virtual void init(); 240 virtual void init();
234 bool ioctl( int call ) const; 241 bool ioctl( int call ) const;
235 bool ioctl( int call, struct ifreq& ) const; 242 bool ioctl( int call, struct ifreq& ) const;
236 private: 243 private:
237 class Private; 244 class Private;
238 Private *d; 245 Private *d;
239}; 246};
240 247
241/*====================================================================================== 248/*======================================================================================
242 * OChannelHopper 249 * OChannelHopper
243 *======================================================================================*/ 250 *======================================================================================*/
244 251
245/** 252/**
246 * @brief A radio frequency channel hopper. 253 * @brief A radio frequency channel hopper.
247 * 254 *
248 * This class provides a channel hopper for radio frequencies. A channel hopper frequently 255 * This class provides a channel hopper for radio frequencies. A channel hopper frequently
249 * changes the radio frequency channel of its associated @ref OWirelessNetworkInterface. 256 * changes the radio frequency channel of its associated @ref OWirelessNetworkInterface.
250 * This is necessary when in monitoring mode and scanning for other devices, because 257 * This is necessary when in monitoring mode and scanning for other devices, because
251 * the radio frequency hardware can only detect packets sent on the same frequency. 258 * the radio frequency hardware can only detect packets sent on the same frequency.
252 * 259 *
253 * @author Michael 'Mickey' Lauer <mickey@vanille.de> 260 * @author Michael 'Mickey' Lauer <mickey@vanille.de>
254 */ 261 */
255class OChannelHopper : public QObject 262class OChannelHopper : public QObject
256{ 263{
257 Q_OBJECT 264 Q_OBJECT
258 265
259 public: 266 public:
260 /** 267 /**
261 * Constructor. 268 * Constructor.
262 */ 269 */
263 OChannelHopper( OWirelessNetworkInterface* ); 270 OChannelHopper( OWirelessNetworkInterface* );
264 /** 271 /**
265 * Destructor. 272 * Destructor.
266 */ 273 */
267 virtual ~OChannelHopper(); 274 virtual ~OChannelHopper();
268 /** 275 /**
269 * @returns true, if the channel hopper is hopping channels 276 * @returns true, if the channel hopper is hopping channels
270 */ 277 */
271 bool isActive() const; 278 bool isActive() const;
272 /** 279 /**
273 * @returns the last hopped channel 280 * @returns the last hopped channel
274 */ 281 */
275 int channel() const; 282 int channel() const;
276 /** 283 /**
277 * Set the channel hopping @a interval. 284 * Set the channel hopping @a interval.
278 * An interval of 0 deactivates the channel hopper. 285 * An interval of 0 deactivates the channel hopper.
279 */ 286 */
280 void setInterval( int interval ); 287 void setInterval( int interval );
281 /** 288 /**
282 * @returns the channel hopping interval 289 * @returns the channel hopping interval
283 */ 290 */
284 int interval() const; 291 int interval() const;
285 292
286 signals: 293 signals:
287 /** 294 /**
288 * This signal is emitted right after the channel hopper performed a hop 295 * This signal is emitted right after the channel hopper performed a hop
289 */ 296 */
290 void hopped( int ); 297 void hopped( int );
291 298
292 protected: 299 protected:
293 virtual void timerEvent( QTimerEvent* ); 300 virtual void timerEvent( QTimerEvent* );
294 301
295 private: 302 private:
296 OWirelessNetworkInterface* _iface; 303 OWirelessNetworkInterface* _iface;
297 int _interval; 304 int _interval;
298 int _tid; 305 int _tid;
299 QValueList<int> _channels; 306 QValueList<int> _channels;
300 QValueList<int>::Iterator _channel; 307 QValueList<int>::Iterator _channel;
301 class Private; 308 class Private;
302 Private *d; 309 Private *d;
303}; 310};
304 311
305 312
306/*====================================================================================== 313/*======================================================================================
307 * OWirelessNetworkInterface 314 * OWirelessNetworkInterface
308 *======================================================================================*/ 315 *======================================================================================*/
309 316
310/** 317/**
311 * @brief A network interface wrapper for interfaces supporting the wireless extensions protocol. 318 * @brief A network interface wrapper for interfaces supporting the wireless extensions protocol.
312 * 319 *
313 * This class provides a high-level encapsulation of the Linux wireless extension API. 320 * This class provides a high-level encapsulation of the Linux wireless extension API.
314 * 321 *
315 * @author Michael 'Mickey' Lauer <mickey@vanille.de> 322 * @author Michael 'Mickey' Lauer <mickey@vanille.de>
316 */ 323 */
317class OWirelessNetworkInterface : public ONetworkInterface 324class OWirelessNetworkInterface : public ONetworkInterface
318{ 325{
319 friend class OMonitoringInterface; 326 friend class OMonitoringInterface;
320 friend class OCiscoMonitoringInterface; 327 friend class OCiscoMonitoringInterface;
diff --git a/libopie2/opienet/opienet.pro b/libopie2/opienet/opienet.pro
index 460de0a..854e5ff 100644
--- a/libopie2/opienet/opienet.pro
+++ b/libopie2/opienet/opienet.pro
@@ -1,40 +1,40 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on 2CONFIG += qt warn_on
3DESTDIR = $(OPIEDIR)/lib 3DESTDIR = $(OPIEDIR)/lib
4HEADERS = 802_11_user.h \ 4HEADERS = 802_11_user.h \
5 dhcp.h \ 5 dhcp.h \
6 udp_ports.h \ 6 udp_ports.h \
7 odebugmapper.h \ 7 odebugmapper.h \
8 omanufacturerdb.h \ 8 omanufacturerdb.h \
9 onetutils.h \ 9 onetutils.h \
10 onetwork.h \ 10 onetwork.h \
11 opcap.h \ 11 opcap.h \
12 ostation.h 12 ostation.h
13SOURCES = odebugmapper.cpp \ 13SOURCES = odebugmapper.cpp \
14 omanufacturerdb.cpp \ 14 omanufacturerdb.cpp \
15 onetutils.cpp \ 15 onetutils.cpp \
16 onetwork.cpp \ 16 onetwork.cpp \
17 opcap.cpp \ 17 opcap.cpp \
18 ostation.cpp 18 ostation.cpp
19INTERFACES = 19INTERFACES =
20TARGET = opienet2 20TARGET = opienet2
21VERSION = 1.8.6 21VERSION = 1.8.7
22INCLUDEPATH += $(OPIEDIR)/include 22INCLUDEPATH += $(OPIEDIR)/include
23DEPENDPATH += $(OPIEDIR)/include 23DEPENDPATH += $(OPIEDIR)/include
24LIBS += -lpcap 24LIBS += -lpcap
25 25
26 26
27!contains( platform, x11 ) { 27!contains( platform, x11 ) {
28 include( $(OPIEDIR)/include.pro ) 28 include( $(OPIEDIR)/include.pro )
29} 29}
30 30
31contains( platform, x11 ) { 31contains( platform, x11 ) {
32 LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib 32 LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib
33} 33}
34 34
35!isEmpty( LIBPCAP_INC_DIR ) { 35!isEmpty( LIBPCAP_INC_DIR ) {
36 INCLUDEPATH = $$LIBPCAP_INC_DIR $$INCLUDEPATH 36 INCLUDEPATH = $$LIBPCAP_INC_DIR $$INCLUDEPATH
37} 37}
38!isEmpty( LIBPCAP_LIB_DIR ) { 38!isEmpty( LIBPCAP_LIB_DIR ) {
39 LIBS = -L$$LIBPCAP_LIB_DIR $$LIBS 39 LIBS = -L$$LIBPCAP_LIB_DIR $$LIBS
40} 40}