author | mickeyl <mickeyl> | 2003-05-01 23:06:29 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-05-01 23:06:29 (UTC) |
commit | 49dfb55bd22f5027fcbcbc55648efd4bce6c8fd6 (patch) (unidiff) | |
tree | 503a7fe9fba8e297b15c07398fbf2ee215294f1c /libopie2/opienet | |
parent | 8266da96576ad43a768da37000cef4e8eba000ac (diff) | |
download | opie-49dfb55bd22f5027fcbcbc55648efd4bce6c8fd6.zip opie-49dfb55bd22f5027fcbcbc55648efd4bce6c8fd6.tar.gz opie-49dfb55bd22f5027fcbcbc55648efd4bce6c8fd6.tar.bz2 |
more work on a higher level listview interface
-rw-r--r-- | libopie2/opienet/onetwork.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h index a29b29d..1b38d02 100644 --- a/libopie2/opienet/onetwork.h +++ b/libopie2/opienet/onetwork.h | |||
@@ -55,48 +55,49 @@ | |||
55 | 55 | ||
56 | // ML: Yeah, I hate to include kernel headers, but it's necessary here | 56 | // 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> | 57 | // 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> | 58 | // 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> | 59 | // 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 | 60 | // ML: I will drop Jean a mail on that subject |
61 | 61 | ||
62 | #include <net/if.h> | 62 | #include <net/if.h> |
63 | #define _LINUX_IF_H | 63 | #define _LINUX_IF_H |
64 | #include <linux/wireless.h> | 64 | #include <linux/wireless.h> |
65 | 65 | ||
66 | class ONetworkInterface; | 66 | class ONetworkInterface; |
67 | class OWirelessNetworkInterface; | 67 | class OWirelessNetworkInterface; |
68 | class OChannelHopper; | 68 | class OChannelHopper; |
69 | class OMonitoringInterface; | 69 | class OMonitoringInterface; |
70 | 70 | ||
71 | /*====================================================================================== | 71 | /*====================================================================================== |
72 | * ONetwork | 72 | * ONetwork |
73 | *======================================================================================*/ | 73 | *======================================================================================*/ |
74 | 74 | ||
75 | /** | 75 | /** |
76 | * @brief A container class for all network interfaces | 76 | * @brief A container class for all network interfaces |
77 | * | 77 | * |
78 | * This class provides access to all available network interfaces of your computer. | 78 | * This class provides access to all available network interfaces of your computer. |
79 | * | ||
79 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 80 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
80 | */ | 81 | */ |
81 | class ONetwork : public QObject | 82 | class ONetwork : public QObject |
82 | { | 83 | { |
83 | Q_OBJECT | 84 | Q_OBJECT |
84 | 85 | ||
85 | public: | 86 | public: |
86 | typedef QDict<ONetworkInterface> InterfaceMap; | 87 | typedef QDict<ONetworkInterface> InterfaceMap; |
87 | typedef QDictIterator<ONetworkInterface> InterfaceIterator; | 88 | typedef QDictIterator<ONetworkInterface> InterfaceIterator; |
88 | 89 | ||
89 | public: | 90 | public: |
90 | /** | 91 | /** |
91 | * @returns the number of available interfaces | 92 | * @returns the number of available interfaces |
92 | */ | 93 | */ |
93 | int count() const; | 94 | int count() const; |
94 | /** | 95 | /** |
95 | * @returns a pointer to the (one and only) @ref ONetwork instance. | 96 | * @returns a pointer to the (one and only) @ref ONetwork instance. |
96 | */ | 97 | */ |
97 | static ONetwork* instance(); | 98 | static ONetwork* instance(); |
98 | /** | 99 | /** |
99 | * @returns an iterator usable for iterating through all network interfaces. | 100 | * @returns an iterator usable for iterating through all network interfaces. |
100 | */ | 101 | */ |
101 | InterfaceIterator iterator() const; | 102 | InterfaceIterator iterator() const; |
102 | /** | 103 | /** |
@@ -116,48 +117,49 @@ class ONetwork : public QObject | |||
116 | * e.g. after issuing a cardctl insert | 117 | * e.g. after issuing a cardctl insert |
117 | */ | 118 | */ |
118 | void synchronize(); | 119 | void synchronize(); |
119 | 120 | ||
120 | protected: | 121 | protected: |
121 | ONetwork(); | 122 | ONetwork(); |
122 | 123 | ||
123 | private: | 124 | private: |
124 | static ONetwork* _instance; | 125 | static ONetwork* _instance; |
125 | InterfaceMap _interfaces; | 126 | InterfaceMap _interfaces; |
126 | }; | 127 | }; |
127 | 128 | ||
128 | 129 | ||
129 | /*====================================================================================== | 130 | /*====================================================================================== |
130 | * ONetworkInterface | 131 | * ONetworkInterface |
131 | *======================================================================================*/ | 132 | *======================================================================================*/ |
132 | 133 | ||
133 | /** | 134 | /** |
134 | * @brief A network interface wrapper. | 135 | * @brief A network interface wrapper. |
135 | * | 136 | * |
136 | * This class provides a wrapper for a network interface. All the cumbersume details of | 137 | * This class provides a wrapper for a network interface. All the cumbersume details of |
137 | * Linux ioctls are hidden under a convenient high-level interface. | 138 | * Linux ioctls are hidden under a convenient high-level interface. |
138 | * @warning Most of the setting methods contained in this class require the appropriate | 139 | * @warning Most of the setting methods contained in this class require the appropriate |
139 | * process permissions to work. | 140 | * process permissions to work. |
141 | * | ||
140 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 142 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
141 | */ | 143 | */ |
142 | class ONetworkInterface : public QObject | 144 | class ONetworkInterface : public QObject |
143 | { | 145 | { |
144 | friend class OMonitoringInterface; | 146 | friend class OMonitoringInterface; |
145 | friend class OCiscoMonitoringInterface; | 147 | friend class OCiscoMonitoringInterface; |
146 | friend class OWlanNGMonitoringInterface; | 148 | friend class OWlanNGMonitoringInterface; |
147 | friend class OHostAPMonitoringInterface; | 149 | friend class OHostAPMonitoringInterface; |
148 | friend class OOrinocoMonitoringInterface; | 150 | friend class OOrinocoMonitoringInterface; |
149 | 151 | ||
150 | public: | 152 | public: |
151 | /** | 153 | /** |
152 | * Constructor. Normally you don't create @ref ONetworkInterface objects yourself, | 154 | * Constructor. Normally you don't create @ref ONetworkInterface objects yourself, |
153 | * but access them via @ref ONetwork::interface(). | 155 | * but access them via @ref ONetwork::interface(). |
154 | */ | 156 | */ |
155 | ONetworkInterface( QObject* parent, const char* name ); | 157 | ONetworkInterface( QObject* parent, const char* name ); |
156 | /** | 158 | /** |
157 | * Destructor. | 159 | * Destructor. |
158 | */ | 160 | */ |
159 | virtual ~ONetworkInterface(); | 161 | virtual ~ONetworkInterface(); |
160 | /** | 162 | /** |
161 | * Associates a @a monitoring interface with this network interface. | 163 | * Associates a @a monitoring interface with this network interface. |
162 | * @note This is currently only useful with @ref OWirelessNetworkInterface objects. | 164 | * @note This is currently only useful with @ref OWirelessNetworkInterface objects. |
163 | */ | 165 | */ |
@@ -225,48 +227,49 @@ class ONetworkInterface : public QObject | |||
225 | 227 | ||
226 | protected: | 228 | protected: |
227 | const int _sfd; | 229 | const int _sfd; |
228 | mutable ifreq _ifr; | 230 | mutable ifreq _ifr; |
229 | OMonitoringInterface* _mon; | 231 | OMonitoringInterface* _mon; |
230 | 232 | ||
231 | protected: | 233 | protected: |
232 | struct ifreq& ifr() const; | 234 | struct ifreq& ifr() const; |
233 | virtual void init(); | 235 | virtual void init(); |
234 | bool ioctl( int call ) const; | 236 | bool ioctl( int call ) const; |
235 | bool ioctl( int call, struct ifreq& ) const; | 237 | bool ioctl( int call, struct ifreq& ) const; |
236 | }; | 238 | }; |
237 | 239 | ||
238 | /*====================================================================================== | 240 | /*====================================================================================== |
239 | * OChannelHopper | 241 | * OChannelHopper |
240 | *======================================================================================*/ | 242 | *======================================================================================*/ |
241 | 243 | ||
242 | /** | 244 | /** |
243 | * @brief A radio frequency channel hopper. | 245 | * @brief A radio frequency channel hopper. |
244 | * | 246 | * |
245 | * This class provides a channel hopper for radio frequencies. A channel hopper frequently | 247 | * This class provides a channel hopper for radio frequencies. A channel hopper frequently |
246 | * changes the radio frequency channel of its associated @ref OWirelessNetworkInterface. | 248 | * changes the radio frequency channel of its associated @ref OWirelessNetworkInterface. |
247 | * This is necessary when in monitoring mode and scanning for other devices, because | 249 | * This is necessary when in monitoring mode and scanning for other devices, because |
248 | * the radio frequency hardware can only detect packets sent on the same frequency. | 250 | * the radio frequency hardware can only detect packets sent on the same frequency. |
251 | * | ||
249 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 252 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
250 | */ | 253 | */ |
251 | class OChannelHopper : public QObject | 254 | class OChannelHopper : public QObject |
252 | { | 255 | { |
253 | Q_OBJECT | 256 | Q_OBJECT |
254 | 257 | ||
255 | public: | 258 | public: |
256 | /** | 259 | /** |
257 | * Constructor. | 260 | * Constructor. |
258 | */ | 261 | */ |
259 | OChannelHopper( OWirelessNetworkInterface* ); | 262 | OChannelHopper( OWirelessNetworkInterface* ); |
260 | /** | 263 | /** |
261 | * Destructor. | 264 | * Destructor. |
262 | */ | 265 | */ |
263 | virtual ~OChannelHopper(); | 266 | virtual ~OChannelHopper(); |
264 | /** | 267 | /** |
265 | * @returns true, if the channel hopper is hopping channels | 268 | * @returns true, if the channel hopper is hopping channels |
266 | */ | 269 | */ |
267 | bool isActive() const; | 270 | bool isActive() const; |
268 | /** | 271 | /** |
269 | * @returns the last hopped channel | 272 | * @returns the last hopped channel |
270 | */ | 273 | */ |
271 | int channel() const; | 274 | int channel() const; |
272 | /** | 275 | /** |
@@ -284,48 +287,50 @@ class OChannelHopper : public QObject | |||
284 | * This signal is emitted right after the channel hopper performed a hop | 287 | * This signal is emitted right after the channel hopper performed a hop |
285 | */ | 288 | */ |
286 | void hopped( int ); | 289 | void hopped( int ); |
287 | 290 | ||
288 | protected: | 291 | protected: |
289 | virtual void timerEvent( QTimerEvent* ); | 292 | virtual void timerEvent( QTimerEvent* ); |
290 | 293 | ||
291 | private: | 294 | private: |
292 | OWirelessNetworkInterface* _iface; | 295 | OWirelessNetworkInterface* _iface; |
293 | int _interval; | 296 | int _interval; |
294 | int _tid; | 297 | int _tid; |
295 | QValueList<int> _channels; | 298 | QValueList<int> _channels; |
296 | QValueList<int>::Iterator _channel; | 299 | QValueList<int>::Iterator _channel; |
297 | }; | 300 | }; |
298 | 301 | ||
299 | 302 | ||
300 | /*====================================================================================== | 303 | /*====================================================================================== |
301 | * OWirelessNetworkInterface | 304 | * OWirelessNetworkInterface |
302 | *======================================================================================*/ | 305 | *======================================================================================*/ |
303 | 306 | ||
304 | /** | 307 | /** |
305 | * @brief A network interface wrapper for interfaces supporting the wireless extensions protocol. | 308 | * @brief A network interface wrapper for interfaces supporting the wireless extensions protocol. |
306 | * | 309 | * |
307 | * This class provides a high-level encapsulation of the Linux wireless extension API. | 310 | * This class provides a high-level encapsulation of the Linux wireless extension API. |
311 | * | ||
312 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | ||
308 | */ | 313 | */ |
309 | class OWirelessNetworkInterface : public ONetworkInterface | 314 | class OWirelessNetworkInterface : public ONetworkInterface |
310 | { | 315 | { |
311 | friend class OMonitoringInterface; | 316 | friend class OMonitoringInterface; |
312 | friend class OCiscoMonitoringInterface; | 317 | friend class OCiscoMonitoringInterface; |
313 | friend class OWlanNGMonitoringInterface; | 318 | friend class OWlanNGMonitoringInterface; |
314 | friend class OHostAPMonitoringInterface; | 319 | friend class OHostAPMonitoringInterface; |
315 | friend class OOrinocoMonitoringInterface; | 320 | friend class OOrinocoMonitoringInterface; |
316 | 321 | ||
317 | friend class OPrivateIOCTL; | 322 | friend class OPrivateIOCTL; |
318 | 323 | ||
319 | public: | 324 | public: |
320 | /** | 325 | /** |
321 | * Constructor. | 326 | * Constructor. |
322 | */ | 327 | */ |
323 | OWirelessNetworkInterface( QObject* parent, const char* name ); | 328 | OWirelessNetworkInterface( QObject* parent, const char* name ); |
324 | /** | 329 | /** |
325 | * Destructor. | 330 | * Destructor. |
326 | */ | 331 | */ |
327 | virtual ~OWirelessNetworkInterface(); | 332 | virtual ~OWirelessNetworkInterface(); |
328 | /** | 333 | /** |
329 | * Setting the @a channel of the interface changes the radio frequency (RF) | 334 | * Setting the @a channel of the interface changes the radio frequency (RF) |
330 | * of the corresponding wireless network device. | 335 | * of the corresponding wireless network device. |
331 | */ | 336 | */ |