author | schurig <schurig> | 2003-06-04 11:53:19 (UTC) |
---|---|---|
committer | schurig <schurig> | 2003-06-04 11:53:19 (UTC) |
commit | e23848abe917d689ee9d8f7b78ff5e5047a3ed43 (patch) (unidiff) | |
tree | c23bf1cbb116ad2f8e523746867cf0494aa4af89 | |
parent | df76591a8ee920c6549bc55b026ab66926917667 (diff) | |
download | opie-e23848abe917d689ee9d8f7b78ff5e5047a3ed43.zip opie-e23848abe917d689ee9d8f7b78ff5e5047a3ed43.tar.gz opie-e23848abe917d689ee9d8f7b78ff5e5047a3ed43.tar.bz2 |
enable compilation
-rw-r--r-- | libopie2/opienet/onetwork.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h index eb9d506..cfb999d 100644 --- a/libopie2/opienet/onetwork.h +++ b/libopie2/opienet/onetwork.h | |||
@@ -1,539 +1,540 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) 2003 by the Wellenreiter team: | 3 | Copyright (C) 2003 by the Wellenreiter team: |
4 | Martin J. Muench <mjm@remote-exploit.org> | 4 | Martin J. Muench <mjm@remote-exploit.org> |
5 | Max Moser <mmo@remote-exploit.org | 5 | Max Moser <mmo@remote-exploit.org |
6 | Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 6 | Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = Library General Public License along with | 26 | -_. . . )=. = Library General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #ifndef ONETWORK_H | 34 | #ifndef ONETWORK_H |
35 | #define ONETWORK_H | 35 | #define ONETWORK_H |
36 | 36 | ||
37 | /* OPIE */ | 37 | /* OPIE */ |
38 | 38 | ||
39 | #include <opie2/onetutils.h> | 39 | #include <opie2/onetutils.h> |
40 | 40 | ||
41 | /* QT */ | 41 | /* QT */ |
42 | 42 | ||
43 | #include <qvaluelist.h> | 43 | #include <qvaluelist.h> |
44 | #include <qdict.h> | 44 | #include <qdict.h> |
45 | #include <qmap.h> | 45 | #include <qmap.h> |
46 | #include <qobject.h> | 46 | #include <qobject.h> |
47 | #include <qhostaddress.h> | 47 | #include <qhostaddress.h> |
48 | 48 | ||
49 | #ifndef IFNAMSIZ | ||
50 | #define IFNAMSIZ 16 | ||
51 | #endif | ||
52 | #ifndef IW_MAX_PRIV_DEF | ||
53 | #define IW_MAX_PRIV_DEF 128 | ||
54 | #endif | ||
55 | |||
56 | // ML: Yeah, I hate to include kernel headers, but it's necessary here | 49 | // ML: Yeah, I hate to include kernel headers, but it's necessary here |
57 | // ML: Here comes an ugly hack to prevent <linux/wireless.h> including <linux/if.h> | 50 | // ML: Here comes an ugly hack to prevent <linux/wireless.h> including <linux/if.h> |
58 | // ML: which conflicts with the user header <net/if.h> | 51 | // ML: which conflicts with the user header <net/if.h> |
59 | // ML: We really need a user header for the Wireless Extensions, something like <net/wireless.h> | 52 | // ML: We really need a user header for the Wireless Extensions, something like <net/wireless.h> |
60 | // ML: I will drop Jean a mail on that subject | 53 | // ML: I will drop Jean a mail on that subject |
61 | 54 | ||
62 | #include <net/if.h> | 55 | #include <net/if.h> |
56 | |||
57 | #ifndef IFNAMSIZ | ||
58 | #define IFNAMSIZ 16 | ||
59 | #endif | ||
60 | #ifndef IW_MAX_PRIV_DEF | ||
61 | #define IW_MAX_PRIV_DEF 128 | ||
62 | #endif | ||
63 | |||
63 | #define _LINUX_IF_H | 64 | #define _LINUX_IF_H |
64 | #include <linux/wireless.h> | 65 | #include <linux/wireless.h> |
65 | 66 | ||
66 | class ONetworkInterface; | 67 | class ONetworkInterface; |
67 | class OWirelessNetworkInterface; | 68 | class OWirelessNetworkInterface; |
68 | class OChannelHopper; | 69 | class OChannelHopper; |
69 | class OMonitoringInterface; | 70 | class OMonitoringInterface; |
70 | 71 | ||
71 | /*====================================================================================== | 72 | /*====================================================================================== |
72 | * ONetwork | 73 | * ONetwork |
73 | *======================================================================================*/ | 74 | *======================================================================================*/ |
74 | 75 | ||
75 | /** | 76 | /** |
76 | * @brief A container class for all network interfaces | 77 | * @brief A container class for all network interfaces |
77 | * | 78 | * |
78 | * This class provides access to all available network interfaces of your computer. | 79 | * This class provides access to all available network interfaces of your computer. |
79 | * | 80 | * |
80 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 81 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
81 | */ | 82 | */ |
82 | class ONetwork : public QObject | 83 | class ONetwork : public QObject |
83 | { | 84 | { |
84 | Q_OBJECT | 85 | Q_OBJECT |
85 | 86 | ||
86 | public: | 87 | public: |
87 | typedef QDict<ONetworkInterface> InterfaceMap; | 88 | typedef QDict<ONetworkInterface> InterfaceMap; |
88 | typedef QDictIterator<ONetworkInterface> InterfaceIterator; | 89 | typedef QDictIterator<ONetworkInterface> InterfaceIterator; |
89 | 90 | ||
90 | public: | 91 | public: |
91 | /** | 92 | /** |
92 | * @returns the number of available interfaces | 93 | * @returns the number of available interfaces |
93 | */ | 94 | */ |
94 | int count() const; | 95 | int count() const; |
95 | /** | 96 | /** |
96 | * @returns a pointer to the (one and only) @ref ONetwork instance. | 97 | * @returns a pointer to the (one and only) @ref ONetwork instance. |
97 | */ | 98 | */ |
98 | static ONetwork* instance(); | 99 | static ONetwork* instance(); |
99 | /** | 100 | /** |
100 | * @returns an iterator usable for iterating through all network interfaces. | 101 | * @returns an iterator usable for iterating through all network interfaces. |
101 | */ | 102 | */ |
102 | InterfaceIterator iterator() const; | 103 | InterfaceIterator iterator() const; |
103 | /** | 104 | /** |
104 | * @returns true, if the @a interface supports the wireless extension protocol. | 105 | * @returns true, if the @a interface supports the wireless extension protocol. |
105 | */ | 106 | */ |
106 | // FIXME QString? -zecke | 107 | // FIXME QString? -zecke |
107 | bool isWirelessInterface( const char* interface ) const; | 108 | bool isWirelessInterface( const char* interface ) const; |
108 | /** | 109 | /** |
109 | * @returns a pointer to the @ref ONetworkInterface object for the specified @a interface or 0, if not found | 110 | * @returns a pointer to the @ref ONetworkInterface object for the specified @a interface or 0, if not found |
110 | * @see ONetworkInterface | 111 | * @see ONetworkInterface |
111 | */ | 112 | */ |
112 | // FIXME: const QString& is prefered over QString!!! -zecke | 113 | // FIXME: const QString& is prefered over QString!!! -zecke |
113 | ONetworkInterface* interface( const QString& interface ) const; | 114 | ONetworkInterface* interface( const QString& interface ) const; |
114 | /** | 115 | /** |
115 | * @internal Rebuild the internal interface database | 116 | * @internal Rebuild the internal interface database |
116 | * @note Sometimes it might be useful to call this from client code, | 117 | * @note Sometimes it might be useful to call this from client code, |
117 | * e.g. after issuing a cardctl insert | 118 | * e.g. after issuing a cardctl insert |
118 | */ | 119 | */ |
119 | void synchronize(); | 120 | void synchronize(); |
120 | 121 | ||
121 | protected: | 122 | protected: |
122 | ONetwork(); | 123 | ONetwork(); |
123 | 124 | ||
124 | private: | 125 | private: |
125 | static ONetwork* _instance; | 126 | static ONetwork* _instance; |
126 | InterfaceMap _interfaces; | 127 | InterfaceMap _interfaces; |
127 | }; | 128 | }; |
128 | 129 | ||
129 | 130 | ||
130 | /*====================================================================================== | 131 | /*====================================================================================== |
131 | * ONetworkInterface | 132 | * ONetworkInterface |
132 | *======================================================================================*/ | 133 | *======================================================================================*/ |
133 | 134 | ||
134 | /** | 135 | /** |
135 | * @brief A network interface wrapper. | 136 | * @brief A network interface wrapper. |
136 | * | 137 | * |
137 | * This class provides a wrapper for a network interface. All the cumbersume details of | 138 | * This class provides a wrapper for a network interface. All the cumbersume details of |
138 | * Linux ioctls are hidden under a convenient high-level interface. | 139 | * Linux ioctls are hidden under a convenient high-level interface. |
139 | * @warning Most of the setting methods contained in this class require the appropriate | 140 | * @warning Most of the setting methods contained in this class require the appropriate |
140 | * process permissions to work. | 141 | * process permissions to work. |
141 | * | 142 | * |
142 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 143 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
143 | */ | 144 | */ |
144 | class ONetworkInterface : public QObject | 145 | class ONetworkInterface : public QObject |
145 | { | 146 | { |
146 | friend class OMonitoringInterface; | 147 | friend class OMonitoringInterface; |
147 | friend class OCiscoMonitoringInterface; | 148 | friend class OCiscoMonitoringInterface; |
148 | friend class OWlanNGMonitoringInterface; | 149 | friend class OWlanNGMonitoringInterface; |
149 | friend class OHostAPMonitoringInterface; | 150 | friend class OHostAPMonitoringInterface; |
150 | friend class OOrinocoMonitoringInterface; | 151 | friend class OOrinocoMonitoringInterface; |
151 | 152 | ||
152 | public: | 153 | public: |
153 | /** | 154 | /** |
154 | * Constructor. Normally you don't create @ref ONetworkInterface objects yourself, | 155 | * Constructor. Normally you don't create @ref ONetworkInterface objects yourself, |
155 | * but access them via @ref ONetwork::interface(). | 156 | * but access them via @ref ONetwork::interface(). |
156 | */ | 157 | */ |
157 | ONetworkInterface( QObject* parent, const char* name ); | 158 | ONetworkInterface( QObject* parent, const char* name ); |
158 | /** | 159 | /** |
159 | * Destructor. | 160 | * Destructor. |
160 | */ | 161 | */ |
161 | virtual ~ONetworkInterface(); | 162 | virtual ~ONetworkInterface(); |
162 | /** | 163 | /** |
163 | * Associates a @a monitoring interface with this network interface. | 164 | * Associates a @a monitoring interface with this network interface. |
164 | * @note This is currently only useful with @ref OWirelessNetworkInterface objects. | 165 | * @note This is currently only useful with @ref OWirelessNetworkInterface objects. |
165 | */ | 166 | */ |
166 | void setMonitoring( OMonitoringInterface* monitoring ); | 167 | void setMonitoring( OMonitoringInterface* monitoring ); |
167 | /** | 168 | /** |
168 | * @returns the currently associated monitoring interface or 0, if no monitoring is associated. | 169 | * @returns the currently associated monitoring interface or 0, if no monitoring is associated. |
169 | */ | 170 | */ |
170 | OMonitoringInterface* monitoring() const; | 171 | OMonitoringInterface* monitoring() const; |
171 | /** | 172 | /** |
172 | * Setting an interface to promiscuous mode enables the device to receive | 173 | * Setting an interface to promiscuous mode enables the device to receive |
173 | * all packets on the shared medium - as opposed to packets which are addressed to this interface. | 174 | * all packets on the shared medium - as opposed to packets which are addressed to this interface. |
174 | */ | 175 | */ |
175 | bool setPromiscuousMode( bool ); | 176 | bool setPromiscuousMode( bool ); |
176 | /** | 177 | /** |
177 | * @returns true if the interface is set to promiscuous mode. | 178 | * @returns true if the interface is set to promiscuous mode. |
178 | */ | 179 | */ |
179 | bool promiscuousMode() const; | 180 | bool promiscuousMode() const; |
180 | /** | 181 | /** |
181 | * Setting an interface to up enables it to receive packets. | 182 | * Setting an interface to up enables it to receive packets. |
182 | */ | 183 | */ |
183 | bool setUp( bool ); | 184 | bool setUp( bool ); |
184 | /** | 185 | /** |
185 | * @returns true if the interface is up. | 186 | * @returns true if the interface is up. |
186 | */ | 187 | */ |
187 | bool isUp() const; | 188 | bool isUp() const; |
188 | /** | 189 | /** |
189 | * @returns true if the interface is a loopback interface. | 190 | * @returns true if the interface is a loopback interface. |
190 | */ | 191 | */ |
191 | bool isLoopback() const; | 192 | bool isLoopback() const; |
192 | /** | 193 | /** |
193 | * @returns true if the interface is featuring supports the wireless extension protocol. | 194 | * @returns true if the interface is featuring supports the wireless extension protocol. |
194 | */ | 195 | */ |
195 | bool isWireless() const; | 196 | bool isWireless() const; |
196 | /** | 197 | /** |
197 | * Associate the IP address @ addr with the interface. | 198 | * Associate the IP address @ addr with the interface. |
198 | */ | 199 | */ |
199 | void setIPV4Address( const QHostAddress& addr ); | 200 | void setIPV4Address( const QHostAddress& addr ); |
200 | /** | 201 | /** |
201 | * @returns the IPv4 address associated with the interface. | 202 | * @returns the IPv4 address associated with the interface. |
202 | */ | 203 | */ |
203 | QString ipV4Address() const; //TODO: make this return an OHostAddress | 204 | QString ipV4Address() const; //TODO: make this return an OHostAddress |
204 | /** | 205 | /** |
205 | * Associate the MAC address @a addr with the interface. | 206 | * Associate the MAC address @a addr with the interface. |
206 | * @note It can be necessary to shut down the interface prior to calling this method. | 207 | * @note It can be necessary to shut down the interface prior to calling this method. |
207 | * @warning This is not supported by all drivers. | 208 | * @warning This is not supported by all drivers. |
208 | */ | 209 | */ |
209 | void setMacAddress( const OMacAddress& addr ); | 210 | void setMacAddress( const OMacAddress& addr ); |
210 | /** | 211 | /** |
211 | * @returns the MAC address associated with the interface. | 212 | * @returns the MAC address associated with the interface. |
212 | */ | 213 | */ |
213 | OMacAddress macAddress() const; | 214 | OMacAddress macAddress() const; |
214 | /** | 215 | /** |
215 | * Associate the IPv4 @a netmask with the interface. | 216 | * Associate the IPv4 @a netmask with the interface. |
216 | */ | 217 | */ |
217 | void setIPV4Netmask( const QHostAddress& netmask ); | 218 | void setIPV4Netmask( const QHostAddress& netmask ); |
218 | /** | 219 | /** |
219 | * @returns the IPv4 netmask associated with the interface. | 220 | * @returns the IPv4 netmask associated with the interface. |
220 | */ | 221 | */ |
221 | QString ipV4Netmask() const; //TODO: make this return an OHostAddress | 222 | QString ipV4Netmask() const; //TODO: make this return an OHostAddress |
222 | /** | 223 | /** |
223 | * @returns the data link type currently associated with the interface. | 224 | * @returns the data link type currently associated with the interface. |
224 | * @see #include <net/if_arp.h> for possible values. | 225 | * @see #include <net/if_arp.h> for possible values. |
225 | */ | 226 | */ |
226 | int dataLinkType() const; | 227 | int dataLinkType() const; |
227 | 228 | ||
228 | protected: | 229 | protected: |
229 | const int _sfd; | 230 | const int _sfd; |
230 | mutable ifreq _ifr; | 231 | mutable ifreq _ifr; |
231 | OMonitoringInterface* _mon; | 232 | OMonitoringInterface* _mon; |
232 | 233 | ||
233 | protected: | 234 | protected: |
234 | struct ifreq& ifr() const; | 235 | struct ifreq& ifr() const; |
235 | virtual void init(); | 236 | virtual void init(); |
236 | bool ioctl( int call ) const; | 237 | bool ioctl( int call ) const; |
237 | bool ioctl( int call, struct ifreq& ) const; | 238 | bool ioctl( int call, struct ifreq& ) const; |
238 | }; | 239 | }; |
239 | 240 | ||
240 | /*====================================================================================== | 241 | /*====================================================================================== |
241 | * OChannelHopper | 242 | * OChannelHopper |
242 | *======================================================================================*/ | 243 | *======================================================================================*/ |
243 | 244 | ||
244 | /** | 245 | /** |
245 | * @brief A radio frequency channel hopper. | 246 | * @brief A radio frequency channel hopper. |
246 | * | 247 | * |
247 | * This class provides a channel hopper for radio frequencies. A channel hopper frequently | 248 | * This class provides a channel hopper for radio frequencies. A channel hopper frequently |
248 | * changes the radio frequency channel of its associated @ref OWirelessNetworkInterface. | 249 | * changes the radio frequency channel of its associated @ref OWirelessNetworkInterface. |
249 | * This is necessary when in monitoring mode and scanning for other devices, because | 250 | * This is necessary when in monitoring mode and scanning for other devices, because |
250 | * the radio frequency hardware can only detect packets sent on the same frequency. | 251 | * the radio frequency hardware can only detect packets sent on the same frequency. |
251 | * | 252 | * |
252 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 253 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
253 | */ | 254 | */ |
254 | class OChannelHopper : public QObject | 255 | class OChannelHopper : public QObject |
255 | { | 256 | { |
256 | Q_OBJECT | 257 | Q_OBJECT |
257 | 258 | ||
258 | public: | 259 | public: |
259 | /** | 260 | /** |
260 | * Constructor. | 261 | * Constructor. |
261 | */ | 262 | */ |
262 | OChannelHopper( OWirelessNetworkInterface* ); | 263 | OChannelHopper( OWirelessNetworkInterface* ); |
263 | /** | 264 | /** |
264 | * Destructor. | 265 | * Destructor. |
265 | */ | 266 | */ |
266 | virtual ~OChannelHopper(); | 267 | virtual ~OChannelHopper(); |
267 | /** | 268 | /** |
268 | * @returns true, if the channel hopper is hopping channels | 269 | * @returns true, if the channel hopper is hopping channels |
269 | */ | 270 | */ |
270 | bool isActive() const; | 271 | bool isActive() const; |
271 | /** | 272 | /** |
272 | * @returns the last hopped channel | 273 | * @returns the last hopped channel |
273 | */ | 274 | */ |
274 | int channel() const; | 275 | int channel() const; |
275 | /** | 276 | /** |
276 | * Set the channel hopping @a interval. | 277 | * Set the channel hopping @a interval. |
277 | * An interval of 0 deactivates the channel hopper. | 278 | * An interval of 0 deactivates the channel hopper. |
278 | */ | 279 | */ |
279 | void setInterval( int interval ); | 280 | void setInterval( int interval ); |
280 | /** | 281 | /** |
281 | * @returns the channel hopping interval | 282 | * @returns the channel hopping interval |
282 | */ | 283 | */ |
283 | int interval() const; | 284 | int interval() const; |
284 | 285 | ||
285 | signals: | 286 | signals: |
286 | /** | 287 | /** |
287 | * This signal is emitted right after the channel hopper performed a hop | 288 | * This signal is emitted right after the channel hopper performed a hop |
288 | */ | 289 | */ |
289 | void hopped( int ); | 290 | void hopped( int ); |
290 | 291 | ||
291 | protected: | 292 | protected: |
292 | virtual void timerEvent( QTimerEvent* ); | 293 | virtual void timerEvent( QTimerEvent* ); |
293 | 294 | ||
294 | private: | 295 | private: |
295 | OWirelessNetworkInterface* _iface; | 296 | OWirelessNetworkInterface* _iface; |
296 | int _interval; | 297 | int _interval; |
297 | int _tid; | 298 | int _tid; |
298 | QValueList<int> _channels; | 299 | QValueList<int> _channels; |
299 | QValueList<int>::Iterator _channel; | 300 | QValueList<int>::Iterator _channel; |
300 | }; | 301 | }; |
301 | 302 | ||
302 | 303 | ||
303 | /*====================================================================================== | 304 | /*====================================================================================== |
304 | * OWirelessNetworkInterface | 305 | * OWirelessNetworkInterface |
305 | *======================================================================================*/ | 306 | *======================================================================================*/ |
306 | 307 | ||
307 | /** | 308 | /** |
308 | * @brief A network interface wrapper for interfaces supporting the wireless extensions protocol. | 309 | * @brief A network interface wrapper for interfaces supporting the wireless extensions protocol. |
309 | * | 310 | * |
310 | * This class provides a high-level encapsulation of the Linux wireless extension API. | 311 | * This class provides a high-level encapsulation of the Linux wireless extension API. |
311 | * | 312 | * |
312 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 313 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
313 | */ | 314 | */ |
314 | class OWirelessNetworkInterface : public ONetworkInterface | 315 | class OWirelessNetworkInterface : public ONetworkInterface |
315 | { | 316 | { |
316 | friend class OMonitoringInterface; | 317 | friend class OMonitoringInterface; |
317 | friend class OCiscoMonitoringInterface; | 318 | friend class OCiscoMonitoringInterface; |
318 | friend class OWlanNGMonitoringInterface; | 319 | friend class OWlanNGMonitoringInterface; |
319 | friend class OHostAPMonitoringInterface; | 320 | friend class OHostAPMonitoringInterface; |
320 | friend class OOrinocoMonitoringInterface; | 321 | friend class OOrinocoMonitoringInterface; |
321 | 322 | ||
322 | friend class OPrivateIOCTL; | 323 | friend class OPrivateIOCTL; |
323 | 324 | ||
324 | public: | 325 | public: |
325 | /** | 326 | /** |
326 | * Constructor. | 327 | * Constructor. |
327 | */ | 328 | */ |
328 | OWirelessNetworkInterface( QObject* parent, const char* name ); | 329 | OWirelessNetworkInterface( QObject* parent, const char* name ); |
329 | /** | 330 | /** |
330 | * Destructor. | 331 | * Destructor. |
331 | */ | 332 | */ |
332 | virtual ~OWirelessNetworkInterface(); | 333 | virtual ~OWirelessNetworkInterface(); |
333 | /** | 334 | /** |
334 | * Setting the @a channel of the interface changes the radio frequency (RF) | 335 | * Setting the @a channel of the interface changes the radio frequency (RF) |
335 | * of the corresponding wireless network device. | 336 | * of the corresponding wireless network device. |
336 | */ | 337 | */ |
337 | virtual void setChannel( int channel ) const; | 338 | virtual void setChannel( int channel ) const; |
338 | /** | 339 | /** |
339 | * @returns the channel index of the current radio frequency. | 340 | * @returns the channel index of the current radio frequency. |
340 | */ | 341 | */ |
341 | virtual int channel() const; | 342 | virtual int channel() const; |
342 | /** | 343 | /** |
343 | * @returns the current radio frequency (in MHz). | 344 | * @returns the current radio frequency (in MHz). |
344 | */ | 345 | */ |
345 | virtual double frequency() const; | 346 | virtual double frequency() const; |
346 | /** | 347 | /** |
347 | * @returns the number of radio frequency channels for the | 348 | * @returns the number of radio frequency channels for the |
348 | * corresponding wireless network device. | 349 | * corresponding wireless network device. |
349 | * @note European devices usually have 14 channels, while American typically feature 11 channels. | 350 | * @note European devices usually have 14 channels, while American typically feature 11 channels. |
350 | */ | 351 | */ |
351 | virtual int channels() const; | 352 | virtual int channels() const; |
352 | /** | 353 | /** |
353 | * Set the IEEE 802.11 operation @a mode. | 354 | * Set the IEEE 802.11 operation @a mode. |
354 | * Valid values are <ul><li>adhoc<li>managed<li>monitor<li>master | 355 | * Valid values are <ul><li>adhoc<li>managed<li>monitor<li>master |
355 | * @warning Not all drivers support the all modes. | 356 | * @warning Not all drivers support the all modes. |
356 | * @note You might have to change the SSID to get the operation mode change into effect. | 357 | * @note You might have to change the SSID to get the operation mode change into effect. |
357 | */ | 358 | */ |
358 | virtual void setMode( const QString& mode ); | 359 | virtual void setMode( const QString& mode ); |
359 | /** | 360 | /** |
360 | * @returns the current IEEE 802.11 operation mode. | 361 | * @returns the current IEEE 802.11 operation mode. |
361 | * Possible values are <ul><li>adhoc<li>managed<li>monitor<li>master or <li>unknown | 362 | * Possible values are <ul><li>adhoc<li>managed<li>monitor<li>master or <li>unknown |
362 | */ | 363 | */ |
363 | virtual QString mode() const; | 364 | virtual QString mode() const; |
364 | /** | 365 | /** |
365 | * Setting the monitor mode on a wireless network interface enables | 366 | * Setting the monitor mode on a wireless network interface enables |
366 | * listening to IEEE 802.11 data and management frames which normally | 367 | * listening to IEEE 802.11 data and management frames which normally |
367 | * are handled by the device firmware. This can be used to detect | 368 | * are handled by the device firmware. This can be used to detect |
368 | * other wireless network devices, e.g. Access Points or Ad-hoc stations. | 369 | * other wireless network devices, e.g. Access Points or Ad-hoc stations. |
369 | * @warning Standard wireless network drives don't support the monitor mode. | 370 | * @warning Standard wireless network drives don't support the monitor mode. |
370 | * @warning You need a patched driver for this to work. | 371 | * @warning You need a patched driver for this to work. |
371 | * @note Enabling the monitor mode is highly driver dependent and requires | 372 | * @note Enabling the monitor mode is highly driver dependent and requires |
372 | * the proper @ref OMonitoringInterface to be associated with the interface. | 373 | * the proper @ref OMonitoringInterface to be associated with the interface. |
373 | * @see OMonitoringInterface | 374 | * @see OMonitoringInterface |
374 | */ | 375 | */ |
375 | virtual void setMonitorMode( bool ); //FIXME: ==> setMode( "monitor" ); | 376 | virtual void setMonitorMode( bool ); //FIXME: ==> setMode( "monitor" ); |
376 | /** | 377 | /** |
377 | * @returns true if the device is listening in IEEE 802.11 monitor mode | 378 | * @returns true if the device is listening in IEEE 802.11 monitor mode |
378 | */ | 379 | */ |
379 | virtual bool monitorMode() const; //FIXME: ==> mode() | 380 | virtual bool monitorMode() const; //FIXME: ==> mode() |
380 | /** | 381 | /** |
381 | * Set the channel hopping @a interval. An @a interval of 0 disables channel hopping. | 382 | * Set the channel hopping @a interval. An @a interval of 0 disables channel hopping. |
382 | * @see OChannelHopper | 383 | * @see OChannelHopper |
383 | */ | 384 | */ |
384 | virtual void setChannelHopping( int interval = 0 ); | 385 | virtual void setChannelHopping( int interval = 0 ); |
385 | /** | 386 | /** |
386 | * @returns the channel hopping interval or 0, if channel hopping is disabled. | 387 | * @returns the channel hopping interval or 0, if channel hopping is disabled. |
387 | */ | 388 | */ |
388 | virtual int channelHopping() const; | 389 | virtual int channelHopping() const; |
389 | /** | 390 | /** |
390 | * @returns the @ref OChannelHopper of this interface or 0, if channel hopping has not been activated before | 391 | * @returns the @ref OChannelHopper of this interface or 0, if channel hopping has not been activated before |
391 | */ | 392 | */ |
392 | virtual OChannelHopper* channelHopper() const; | 393 | virtual OChannelHopper* channelHopper() const; |
393 | /** | 394 | /** |
394 | * Set the station @a nickname. | 395 | * Set the station @a nickname. |
395 | */ | 396 | */ |
396 | virtual void setNickName( const QString& nickname ); | 397 | virtual void setNickName( const QString& nickname ); |
397 | /** | 398 | /** |
398 | * @returns the current station nickname. | 399 | * @returns the current station nickname. |
399 | */ | 400 | */ |
400 | virtual QString nickName() const; | 401 | virtual QString nickName() const; |
401 | /** | 402 | /** |
402 | * Invoke the private IOCTL @a command with a @number of parameters on the network interface. | 403 | * Invoke the private IOCTL @a command with a @number of parameters on the network interface. |
403 | * @see OPrivateIOCTL | 404 | * @see OPrivateIOCTL |
404 | */ | 405 | */ |
405 | virtual void setPrivate( const QString& command, int number, ... ); | 406 | virtual void setPrivate( const QString& command, int number, ... ); |
406 | /** | 407 | /** |
407 | * @returns true if the interface is featuring the private IOCTL @command. | 408 | * @returns true if the interface is featuring the private IOCTL @command. |
408 | */ | 409 | */ |
409 | virtual bool hasPrivate( const QString& command ); | 410 | virtual bool hasPrivate( const QString& command ); |
410 | virtual void getPrivate( const QString& command ); //FIXME: Implement and document this | 411 | virtual void getPrivate( const QString& command ); //FIXME: Implement and document this |
411 | 412 | ||
412 | virtual bool isAssociated() const {}; //FIXME: Implement and document this | 413 | virtual bool isAssociated() const {}; //FIXME: Implement and document this |
413 | /** | 414 | /** |
414 | * @returns the MAC address of the Access Point if the | 415 | * @returns the MAC address of the Access Point if the |
415 | * device is in infrastructure mode. @returns a (more or less random) CELL | 416 | * device is in infrastructure mode. @returns a (more or less random) CELL |
416 | * address if the device is in adhoc mode. | 417 | * address if the device is in adhoc mode. |
417 | */ | 418 | */ |
418 | virtual QString associatedAP() const; | 419 | virtual QString associatedAP() const; |
419 | /** | 420 | /** |
420 | * Set the @a ssid (Service Set ID) string. This is used to decide | 421 | * Set the @a ssid (Service Set ID) string. This is used to decide |
421 | * which network to associate with (use "any" to let the driver decide). | 422 | * which network to associate with (use "any" to let the driver decide). |
422 | */ | 423 | */ |
423 | virtual void setSSID( const QString& ssid ); | 424 | virtual void setSSID( const QString& ssid ); |
424 | /** | 425 | /** |
425 | * @returns the current SSID (Service Set ID). | 426 | * @returns the current SSID (Service Set ID). |
426 | */ | 427 | */ |
427 | virtual QString SSID() const; | 428 | virtual QString SSID() const; |
428 | 429 | ||
429 | protected: | 430 | protected: |
430 | void buildChannelList(); | 431 | void buildChannelList(); |
431 | void buildPrivateList(); | 432 | void buildPrivateList(); |
432 | virtual void init(); | 433 | virtual void init(); |
433 | struct iwreq& iwr() const; | 434 | struct iwreq& iwr() const; |
434 | bool wioctl( int call ) const; | 435 | bool wioctl( int call ) const; |
435 | bool wioctl( int call, struct iwreq& ) const; | 436 | bool wioctl( int call, struct iwreq& ) const; |
436 | 437 | ||
437 | protected: | 438 | protected: |
438 | mutable struct iwreq _iwr; | 439 | mutable struct iwreq _iwr; |
439 | QMap<int,int> _channels; | 440 | QMap<int,int> _channels; |
440 | 441 | ||
441 | private: | 442 | private: |
442 | OChannelHopper* _hopper; | 443 | OChannelHopper* _hopper; |
443 | }; | 444 | }; |
444 | 445 | ||
445 | 446 | ||
446 | /*====================================================================================== | 447 | /*====================================================================================== |
447 | * OMonitoringInterface | 448 | * OMonitoringInterface |
448 | *======================================================================================*/ | 449 | *======================================================================================*/ |
449 | 450 | ||
450 | 451 | ||
451 | class OMonitoringInterface | 452 | class OMonitoringInterface |
452 | { | 453 | { |
453 | public: | 454 | public: |
454 | OMonitoringInterface(); | 455 | OMonitoringInterface(); |
455 | OMonitoringInterface( ONetworkInterface*, bool _prismHeader ); | 456 | OMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
456 | virtual ~OMonitoringInterface(); | 457 | virtual ~OMonitoringInterface(); |
457 | 458 | ||
458 | public: | 459 | public: |
459 | virtual void setEnabled( bool ); | 460 | virtual void setEnabled( bool ); |
460 | virtual bool enabled() const; | 461 | virtual bool enabled() const; |
461 | virtual void setChannel( int ); | 462 | virtual void setChannel( int ); |
462 | 463 | ||
463 | virtual QString name() const = 0; | 464 | virtual QString name() const = 0; |
464 | 465 | ||
465 | protected: | 466 | protected: |
466 | OWirelessNetworkInterface* _if; | 467 | OWirelessNetworkInterface* _if; |
467 | bool _prismHeader; | 468 | bool _prismHeader; |
468 | 469 | ||
469 | }; | 470 | }; |
470 | 471 | ||
471 | 472 | ||
472 | /*====================================================================================== | 473 | /*====================================================================================== |
473 | * OCiscoMonitoring | 474 | * OCiscoMonitoring |
474 | *======================================================================================*/ | 475 | *======================================================================================*/ |
475 | 476 | ||
476 | 477 | ||
477 | class OCiscoMonitoringInterface : public OMonitoringInterface | 478 | class OCiscoMonitoringInterface : public OMonitoringInterface |
478 | { | 479 | { |
479 | public: | 480 | public: |
480 | OCiscoMonitoringInterface( ONetworkInterface*, bool _prismHeader ); | 481 | OCiscoMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
481 | virtual ~OCiscoMonitoringInterface(); | 482 | virtual ~OCiscoMonitoringInterface(); |
482 | 483 | ||
483 | virtual void setEnabled( bool ); | 484 | virtual void setEnabled( bool ); |
484 | virtual QString name() const; | 485 | virtual QString name() const; |
485 | virtual void setChannel( int ); | 486 | virtual void setChannel( int ); |
486 | 487 | ||
487 | }; | 488 | }; |
488 | 489 | ||
489 | /*====================================================================================== | 490 | /*====================================================================================== |
490 | * OWlanNGMonitoringInterface | 491 | * OWlanNGMonitoringInterface |
491 | *======================================================================================*/ | 492 | *======================================================================================*/ |
492 | 493 | ||
493 | class OWlanNGMonitoringInterface : public OMonitoringInterface | 494 | class OWlanNGMonitoringInterface : public OMonitoringInterface |
494 | { | 495 | { |
495 | public: | 496 | public: |
496 | OWlanNGMonitoringInterface( ONetworkInterface*, bool _prismHeader ); | 497 | OWlanNGMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
497 | virtual ~OWlanNGMonitoringInterface(); | 498 | virtual ~OWlanNGMonitoringInterface(); |
498 | 499 | ||
499 | public: | 500 | public: |
500 | virtual void setEnabled( bool ); | 501 | virtual void setEnabled( bool ); |
501 | virtual QString name() const; | 502 | virtual QString name() const; |
502 | virtual void setChannel( int ); | 503 | virtual void setChannel( int ); |
503 | 504 | ||
504 | }; | 505 | }; |
505 | 506 | ||
506 | /*====================================================================================== | 507 | /*====================================================================================== |
507 | * OHostAPMonitoringInterface | 508 | * OHostAPMonitoringInterface |
508 | *======================================================================================*/ | 509 | *======================================================================================*/ |
509 | 510 | ||
510 | class OHostAPMonitoringInterface : public OMonitoringInterface | 511 | class OHostAPMonitoringInterface : public OMonitoringInterface |
511 | { | 512 | { |
512 | public: | 513 | public: |
513 | OHostAPMonitoringInterface( ONetworkInterface*, bool _prismHeader ); | 514 | OHostAPMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
514 | virtual ~OHostAPMonitoringInterface(); | 515 | virtual ~OHostAPMonitoringInterface(); |
515 | 516 | ||
516 | public: | 517 | public: |
517 | virtual void setEnabled( bool ); | 518 | virtual void setEnabled( bool ); |
518 | virtual QString name() const; | 519 | virtual QString name() const; |
519 | }; | 520 | }; |
520 | 521 | ||
521 | /*====================================================================================== | 522 | /*====================================================================================== |
522 | * OOrinocoMonitoringInterface | 523 | * OOrinocoMonitoringInterface |
523 | *======================================================================================*/ | 524 | *======================================================================================*/ |
524 | 525 | ||
525 | class OOrinocoMonitoringInterface : public OMonitoringInterface | 526 | class OOrinocoMonitoringInterface : public OMonitoringInterface |
526 | { | 527 | { |
527 | public: | 528 | public: |
528 | OOrinocoMonitoringInterface( ONetworkInterface*, bool _prismHeader ); | 529 | OOrinocoMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
529 | virtual ~OOrinocoMonitoringInterface(); | 530 | virtual ~OOrinocoMonitoringInterface(); |
530 | 531 | ||
531 | public: | 532 | public: |
532 | virtual void setChannel( int ); | 533 | virtual void setChannel( int ); |
533 | virtual void setEnabled( bool ); | 534 | virtual void setEnabled( bool ); |
534 | virtual QString name() const; | 535 | virtual QString name() const; |
535 | 536 | ||
536 | }; | 537 | }; |
537 | 538 | ||
538 | #endif // ONETWORK_H | 539 | #endif // ONETWORK_H |
539 | 540 | ||