-rw-r--r-- | libopie2/opienet/onetwork.h | 58 |
1 files changed, 37 insertions, 21 deletions
diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h index f052317..a29b29d 100644 --- a/libopie2/opienet/onetwork.h +++ b/libopie2/opienet/onetwork.h | |||
@@ -31,24 +31,24 @@ | |||
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 */ | ||
38 | |||
39 | #include <opie2/onetutils.h> | ||
40 | |||
37 | /* QT */ | 41 | /* QT */ |
38 | 42 | ||
39 | #include <qvaluelist.h> | 43 | #include <qvaluelist.h> |
40 | #include <qdict.h> | 44 | #include <qdict.h> |
41 | #include <qmap.h> | 45 | #include <qmap.h> |
42 | #include <qobject.h> | 46 | #include <qobject.h> |
43 | #include <qhostaddress.h> | 47 | #include <qhostaddress.h> |
44 | 48 | ||
45 | /* OPIE */ | ||
46 | |||
47 | #include <opie2/onetutils.h> | ||
48 | |||
49 | #ifndef IFNAMSIZ | 49 | #ifndef IFNAMSIZ |
50 | #define IFNAMSIZ 16 | 50 | #define IFNAMSIZ 16 |
51 | #endif | 51 | #endif |
52 | #ifndef IW_MAX_PRIV_DEF | 52 | #ifndef IW_MAX_PRIV_DEF |
53 | #define IW_MAX_PRIV_DEF 128 | 53 | #define IW_MAX_PRIV_DEF 128 |
54 | #endif | 54 | #endif |
@@ -97,18 +97,18 @@ class ONetwork : public QObject | |||
97 | static ONetwork* instance(); | 97 | static ONetwork* instance(); |
98 | /** | 98 | /** |
99 | * @returns an iterator usable for iterating through all network interfaces. | 99 | * @returns an iterator usable for iterating through all network interfaces. |
100 | */ | 100 | */ |
101 | InterfaceIterator iterator() const; | 101 | InterfaceIterator iterator() const; |
102 | /** | 102 | /** |
103 | * @returns true, if the @p interface supports the wireless extension protocol. | 103 | * @returns true, if the @a interface supports the wireless extension protocol. |
104 | */ | 104 | */ |
105 | // FIXME QString? -zecke | 105 | // FIXME QString? -zecke |
106 | bool isWirelessInterface( const char* interface ) const; | 106 | bool isWirelessInterface( const char* interface ) const; |
107 | /** | 107 | /** |
108 | * @returns a pointer to the @ref ONetworkInterface object for the specified @p interface or 0, if not found | 108 | * @returns a pointer to the @ref ONetworkInterface object for the specified @a interface or 0, if not found |
109 | * @see ONetworkInterface | 109 | * @see ONetworkInterface |
110 | */ | 110 | */ |
111 | // FIXME: const QString& is prefered over QString!!! -zecke | 111 | // FIXME: const QString& is prefered over QString!!! -zecke |
112 | ONetworkInterface* interface( const QString& interface ) const; | 112 | ONetworkInterface* interface( const QString& interface ) const; |
113 | /** | 113 | /** |
114 | * @internal Rebuild the internal interface database | 114 | * @internal Rebuild the internal interface database |
@@ -195,13 +195,13 @@ class ONetworkInterface : public QObject | |||
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; | 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 | * @warning This is not supported by all drivers. | 205 | * @warning This is not supported by all drivers. |
206 | */ | 206 | */ |
207 | void setMacAddress( const OMacAddress& addr ); | 207 | void setMacAddress( const OMacAddress& addr ); |
@@ -213,13 +213,13 @@ class ONetworkInterface : public QObject | |||
213 | * Associate the IPv4 @a netmask with the interface. | 213 | * Associate the IPv4 @a netmask with the interface. |
214 | */ | 214 | */ |
215 | void setIPV4Netmask( const QHostAddress& netmask ); | 215 | void setIPV4Netmask( const QHostAddress& netmask ); |
216 | /** | 216 | /** |
217 | * @returns the IPv4 netmask associated with the interface. | 217 | * @returns the IPv4 netmask associated with the interface. |
218 | */ | 218 | */ |
219 | QString ipV4Netmask() const; | 219 | QString ipV4Netmask() const; //TODO: make this return an OHostAddress |
220 | /** | 220 | /** |
221 | * @returns the data link type currently associated with the interface. | 221 | * @returns the data link type currently associated with the interface. |
222 | * @see #include <net/if_arp.h> for possible values. | 222 | * @see #include <net/if_arp.h> for possible values. |
223 | */ | 223 | */ |
224 | int dataLinkType() const; | 224 | int dataLinkType() const; |
225 | 225 | ||
@@ -314,14 +314,12 @@ class OWirelessNetworkInterface : public ONetworkInterface | |||
314 | friend class OHostAPMonitoringInterface; | 314 | friend class OHostAPMonitoringInterface; |
315 | friend class OOrinocoMonitoringInterface; | 315 | friend class OOrinocoMonitoringInterface; |
316 | 316 | ||
317 | friend class OPrivateIOCTL; | 317 | friend class OPrivateIOCTL; |
318 | 318 | ||
319 | public: | 319 | public: |
320 | enum Mode { AdHoc, Managed, Monitor }; | ||
321 | |||
322 | /** | 320 | /** |
323 | * Constructor. | 321 | * Constructor. |
324 | */ | 322 | */ |
325 | OWirelessNetworkInterface( QObject* parent, const char* name ); | 323 | OWirelessNetworkInterface( QObject* parent, const char* name ); |
326 | /** | 324 | /** |
327 | * Destructor. | 325 | * Destructor. |
@@ -343,33 +341,40 @@ class OWirelessNetworkInterface : public ONetworkInterface | |||
343 | /** | 341 | /** |
344 | * @returns the number of radio frequency channels for the | 342 | * @returns the number of radio frequency channels for the |
345 | * corresponding wireless network device. | 343 | * corresponding wireless network device. |
346 | * @note European devices usually have 14 channels, while American typically feature 11 channels. | 344 | * @note European devices usually have 14 channels, while American typically feature 11 channels. |
347 | */ | 345 | */ |
348 | virtual int channels() const; | 346 | virtual int channels() const; |
349 | //virtual double frequency(int) const; | 347 | /** |
350 | 348 | * Set the IEEE 802.11 operation @a mode. | |
351 | virtual void setMode( Mode ) {}; //FIXME: Implement and document this | 349 | * Valid values are <ul><li>adhoc<li>managed<li>monitor<li>master |
352 | virtual bool mode() const {}; //FIXME: Implement and document this | 350 | * @warning Not all drivers support the all modes. |
353 | 351 | * @note You might have to change the SSID to get the operation mode change into effect. | |
352 | */ | ||
353 | virtual void setMode( const QString& mode ); | ||
354 | /** | ||
355 | * @returns the current IEEE 802.11 operation mode. | ||
356 | * Possible values are <ul><li>adhoc<li>managed<li>monitor<li>master or <li>unknown | ||
357 | */ | ||
358 | virtual QString mode() const; | ||
354 | /** | 359 | /** |
355 | * Setting the monitor mode on a wireless network interface enables | 360 | * Setting the monitor mode on a wireless network interface enables |
356 | * listening to IEEE 802.11 data and management frames which normally | 361 | * listening to IEEE 802.11 data and management frames which normally |
357 | * are handled by the device firmware. This can be used to detect | 362 | * are handled by the device firmware. This can be used to detect |
358 | * other wireless network devices, e.g. Access Points or Ad-hoc stations. | 363 | * other wireless network devices, e.g. Access Points or Ad-hoc stations. |
359 | * @warning Standard wireless network drives don't support the monitor mode. | 364 | * @warning Standard wireless network drives don't support the monitor mode. |
360 | * @warning You need a patched driver for this to work. | 365 | * @warning You need a patched driver for this to work. |
361 | * @note Enabling the monitor mode is highly driver dependent and requires | 366 | * @note Enabling the monitor mode is highly driver dependent and requires |
362 | * the proper @ref OMonitoringInterface to be associated with the interface. | 367 | * the proper @ref OMonitoringInterface to be associated with the interface. |
363 | * @see OMonitoringInterface | 368 | * @see OMonitoringInterface |
364 | */ | 369 | */ |
365 | virtual void setMonitorMode( bool ); | 370 | virtual void setMonitorMode( bool ); //FIXME: ==> setMode( "monitor" ); |
366 | /** | 371 | /** |
367 | * @returns true if the device is listening in IEEE 802.11 monitor mode | 372 | * @returns true if the device is listening in IEEE 802.11 monitor mode |
368 | */ | 373 | */ |
369 | virtual bool monitorMode() const; | 374 | virtual bool monitorMode() const; //FIXME: ==> mode() |
370 | /** | 375 | /** |
371 | * Set the channel hopping @a interval. An @a interval of 0 disables channel hopping. | 376 | * Set the channel hopping @a interval. An @a interval of 0 disables channel hopping. |
372 | * @see OChannelHopper | 377 | * @see OChannelHopper |
373 | */ | 378 | */ |
374 | virtual void setChannelHopping( int interval = 0 ); | 379 | virtual void setChannelHopping( int interval = 0 ); |
375 | /** | 380 | /** |
@@ -380,13 +385,13 @@ class OWirelessNetworkInterface : public ONetworkInterface | |||
380 | * @returns the @ref OChannelHopper of this interface or 0, if channel hopping has not been activated before | 385 | * @returns the @ref OChannelHopper of this interface or 0, if channel hopping has not been activated before |
381 | */ | 386 | */ |
382 | virtual OChannelHopper* channelHopper() const; | 387 | virtual OChannelHopper* channelHopper() const; |
383 | /** | 388 | /** |
384 | * Set the station @a nickname. | 389 | * Set the station @a nickname. |
385 | */ | 390 | */ |
386 | virtual void setNickName( const QString& nickname ) {}; //FIXME: Implement this | 391 | virtual void setNickName( const QString& nickname ); |
387 | /** | 392 | /** |
388 | * @returns the current station nickname. | 393 | * @returns the current station nickname. |
389 | */ | 394 | */ |
390 | virtual QString nickName() const; | 395 | virtual QString nickName() const; |
391 | /** | 396 | /** |
392 | * Invoke the private IOCTL @a command with a @number of parameters on the network interface. | 397 | * Invoke the private IOCTL @a command with a @number of parameters on the network interface. |
@@ -397,15 +402,26 @@ class OWirelessNetworkInterface : public ONetworkInterface | |||
397 | * @returns true if the interface is featuring the private IOCTL @command. | 402 | * @returns true if the interface is featuring the private IOCTL @command. |
398 | */ | 403 | */ |
399 | virtual bool hasPrivate( const QString& command ); | 404 | virtual bool hasPrivate( const QString& command ); |
400 | virtual void getPrivate( const QString& command ); //FIXME: Implement and document this | 405 | virtual void getPrivate( const QString& command ); //FIXME: Implement and document this |
401 | 406 | ||
402 | virtual bool isAssociated() const {}; //FIXME: Implement and document this | 407 | virtual bool isAssociated() const {}; //FIXME: Implement and document this |
403 | virtual QString associatedAP() const; //FIXME: Implement and document this | 408 | /** |
404 | 409 | * @returns the MAC address of the Access Point if the | |
405 | virtual void setSSID( const QString& ); | 410 | * device is in infrastructure mode. @returns a (more or less random) CELL |
411 | * address if the device is in adhoc mode. | ||
412 | */ | ||
413 | virtual QString associatedAP() const; | ||
414 | /** | ||
415 | * Set the @a ssid (Service Set ID) string. This is used to decide | ||
416 | * which network to associate with (use "any" to let the driver decide). | ||
417 | */ | ||
418 | virtual void setSSID( const QString& ssid ); | ||
419 | /** | ||
420 | * @returns the current SSID (Service Set ID). | ||
421 | */ | ||
406 | virtual QString SSID() const; | 422 | virtual QString SSID() const; |
407 | 423 | ||
408 | protected: | 424 | protected: |
409 | void buildChannelList(); | 425 | void buildChannelList(); |
410 | void buildPrivateList(); | 426 | void buildPrivateList(); |
411 | virtual void init(); | 427 | virtual void init(); |