-rw-r--r-- | libopie2/opienet/onetwork.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h index f5fbe1d..a49c8fb 100644 --- a/libopie2/opienet/onetwork.h +++ b/libopie2/opienet/onetwork.h | |||
@@ -80,97 +80,97 @@ class OMonitoringInterface; | |||
80 | * | 80 | * |
81 | * This class provides access to all available network interfaces of your computer. | 81 | * This class provides access to all available network interfaces of your computer. |
82 | * | 82 | * |
83 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> | 83 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> |
84 | */ | 84 | */ |
85 | class ONetwork : public QObject | 85 | class ONetwork : public QObject |
86 | { | 86 | { |
87 | Q_OBJECT | 87 | Q_OBJECT |
88 | 88 | ||
89 | public: | 89 | public: |
90 | typedef QDict<ONetworkInterface> InterfaceMap; | 90 | typedef QDict<ONetworkInterface> InterfaceMap; |
91 | typedef QDictIterator<ONetworkInterface> InterfaceIterator; | 91 | typedef QDictIterator<ONetworkInterface> InterfaceIterator; |
92 | 92 | ||
93 | public: | 93 | public: |
94 | /** | 94 | /** |
95 | * @returns the number of available interfaces | 95 | * @returns the number of available interfaces |
96 | */ | 96 | */ |
97 | int count() const; | 97 | int count() const; |
98 | /** | 98 | /** |
99 | * @returns a pointer to the (one and only) @ref ONetwork instance. | 99 | * @returns a pointer to the (one and only) @ref ONetwork instance. |
100 | */ | 100 | */ |
101 | static ONetwork* instance(); | 101 | static ONetwork* instance(); |
102 | /** | 102 | /** |
103 | * @returns an iterator usable for iterating through all network interfaces. | 103 | * @returns an iterator usable for iterating through all network interfaces. |
104 | */ | 104 | */ |
105 | InterfaceIterator iterator() const; | 105 | InterfaceIterator iterator() const; |
106 | /** | 106 | /** |
107 | * @returns true, if the @a interface is present. | 107 | * @returns true, if the @a interface is present. |
108 | */ | 108 | */ |
109 | bool isPresent( const char* interface ) const; | 109 | bool isPresent( const char* interface ) const; |
110 | /** | 110 | /** |
111 | * @returns true, if the @a interface supports the wireless extension protocol. | 111 | * @returns true, if the @a interface supports the wireless extension protocol. |
112 | */ | 112 | */ |
113 | bool isWirelessInterface( const char* interface ) const; | 113 | bool isWirelessInterface( const char* interface ) const; |
114 | /** | 114 | /** |
115 | * @returns a pointer to the @ref ONetworkInterface object for the specified @a interface or 0, if not found. | 115 | * @returns a pointer to the @ref ONetworkInterface object for the specified @a interface or 0, if not found. |
116 | * @see ONetworkInterface | 116 | * @see ONetworkInterface |
117 | */ | 117 | */ |
118 | ONetworkInterface* interface( const QString& interface ) const; | 118 | ONetworkInterface* interface( const QString& interface ) const; |
119 | /** | 119 | /** |
120 | * @internal Rebuild the internal interface database | 120 | * @internal Rebuild the internal interface database |
121 | * @note Sometimes it might be useful to call this from client code, | 121 | * @note Sometimes it might be useful to call this from client code, |
122 | * e.g. after issuing a cardctl insert | 122 | * e.g. after issuing a cardctl insert |
123 | */ | 123 | */ |
124 | void synchronize(); | 124 | void synchronize(); |
125 | /** | 125 | /** |
126 | * @returns the wireless extension version used at compile time. | 126 | * @returns the wireless extension version used at compile time. |
127 | **/ | 127 | **/ |
128 | static short wirelessExtensionVersion(); | 128 | static short wirelessExtensionCompileVersion(); |
129 | 129 | ||
130 | protected: | 130 | protected: |
131 | ONetwork(); | 131 | ONetwork(); |
132 | 132 | ||
133 | private: | 133 | private: |
134 | static ONetwork* _instance; | 134 | static ONetwork* _instance; |
135 | InterfaceMap _interfaces; | 135 | InterfaceMap _interfaces; |
136 | class Private; | 136 | class Private; |
137 | Private *d; | 137 | Private *d; |
138 | }; | 138 | }; |
139 | 139 | ||
140 | 140 | ||
141 | /*====================================================================================== | 141 | /*====================================================================================== |
142 | * ONetworkInterface | 142 | * ONetworkInterface |
143 | *======================================================================================*/ | 143 | *======================================================================================*/ |
144 | 144 | ||
145 | /** | 145 | /** |
146 | * @brief A network interface wrapper. | 146 | * @brief A network interface wrapper. |
147 | * | 147 | * |
148 | * This class provides a wrapper for a network interface. All the cumbersume details of | 148 | * This class provides a wrapper for a network interface. All the cumbersume details of |
149 | * Linux ioctls are hidden under a convenient high-level interface. | 149 | * Linux ioctls are hidden under a convenient high-level interface. |
150 | * @warning Most of the setting methods contained in this class require the appropriate | 150 | * @warning Most of the setting methods contained in this class require the appropriate |
151 | * process permissions to work. | 151 | * process permissions to work. |
152 | * | 152 | * |
153 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> | 153 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> |
154 | */ | 154 | */ |
155 | class ONetworkInterface : public QObject | 155 | class ONetworkInterface : public QObject |
156 | { | 156 | { |
157 | friend class OMonitoringInterface; | 157 | friend class OMonitoringInterface; |
158 | friend class OCiscoMonitoringInterface; | 158 | friend class OCiscoMonitoringInterface; |
159 | friend class OWlanNGMonitoringInterface; | 159 | friend class OWlanNGMonitoringInterface; |
160 | friend class OHostAPMonitoringInterface; | 160 | friend class OHostAPMonitoringInterface; |
161 | friend class OOrinocoMonitoringInterface; | 161 | friend class OOrinocoMonitoringInterface; |
162 | 162 | ||
163 | public: | 163 | public: |
164 | /** | 164 | /** |
165 | * Constructor. Normally you don't create @ref ONetworkInterface objects yourself, | 165 | * Constructor. Normally you don't create @ref ONetworkInterface objects yourself, |
166 | * but access them via @ref ONetwork::interface(). | 166 | * but access them via @ref ONetwork::interface(). |
167 | */ | 167 | */ |
168 | ONetworkInterface( QObject* parent, const char* name ); | 168 | ONetworkInterface( QObject* parent, const char* name ); |
169 | /** | 169 | /** |
170 | * Destructor. | 170 | * Destructor. |
171 | */ | 171 | */ |
172 | virtual ~ONetworkInterface(); | 172 | virtual ~ONetworkInterface(); |
173 | /** | 173 | /** |
174 | * Associates a @a monitoring interface with this network interface. | 174 | * Associates a @a monitoring interface with this network interface. |
175 | * @note This is currently only useful with @ref OWirelessNetworkInterface objects. | 175 | * @note This is currently only useful with @ref OWirelessNetworkInterface objects. |
176 | */ | 176 | */ |
@@ -406,98 +406,102 @@ class OWirelessNetworkInterface : public ONetworkInterface | |||
406 | /** | 406 | /** |
407 | * Set the station @a nickname. | 407 | * Set the station @a nickname. |
408 | */ | 408 | */ |
409 | virtual void setNickName( const QString& nickname ); | 409 | virtual void setNickName( const QString& nickname ); |
410 | /** | 410 | /** |
411 | * @returns the current station nickname. | 411 | * @returns the current station nickname. |
412 | */ | 412 | */ |
413 | virtual QString nickName() const; | 413 | virtual QString nickName() const; |
414 | /** | 414 | /** |
415 | * Invoke the private IOCTL @a command with a @number of parameters on the network interface. | 415 | * Invoke the private IOCTL @a command with a @number of parameters on the network interface. |
416 | * @see OPrivateIOCTL | 416 | * @see OPrivateIOCTL |
417 | */ | 417 | */ |
418 | virtual void setPrivate( const QString& command, int number, ... ); | 418 | virtual void setPrivate( const QString& command, int number, ... ); |
419 | /** | 419 | /** |
420 | * @returns true if the interface is featuring the private IOCTL @command. | 420 | * @returns true if the interface is featuring the private IOCTL @command. |
421 | */ | 421 | */ |
422 | virtual bool hasPrivate( const QString& command ); | 422 | virtual bool hasPrivate( const QString& command ); |
423 | virtual void getPrivate( const QString& command ); //FIXME: Implement and document this | 423 | virtual void getPrivate( const QString& command ); //FIXME: Implement and document this |
424 | /** | 424 | /** |
425 | * @returns true if the interface is associated to an access point | 425 | * @returns true if the interface is associated to an access point |
426 | * @note: This information is only valid if the interface is in managed mode. | 426 | * @note: This information is only valid if the interface is in managed mode. |
427 | */ | 427 | */ |
428 | virtual bool isAssociated() const; | 428 | virtual bool isAssociated() const; |
429 | /** | 429 | /** |
430 | * @returns the MAC address of the Access Point if the device is in infrastructure mode. | 430 | * @returns the MAC address of the Access Point if the device is in infrastructure mode. |
431 | * @returns a (more or less random) cell ID address if the device is in adhoc mode. | 431 | * @returns a (more or less random) cell ID address if the device is in adhoc mode. |
432 | */ | 432 | */ |
433 | virtual OMacAddress associatedAP() const; | 433 | virtual OMacAddress associatedAP() const; |
434 | /** | 434 | /** |
435 | * Set the @a ssid (Service Set ID) string. This is used to decide | 435 | * Set the @a ssid (Service Set ID) string. This is used to decide |
436 | * which network to associate with (use "any" to let the driver decide). | 436 | * which network to associate with (use "any" to let the driver decide). |
437 | */ | 437 | */ |
438 | virtual void setSSID( const QString& ssid ); | 438 | virtual void setSSID( const QString& ssid ); |
439 | /** | 439 | /** |
440 | * @returns the current SSID (Service Set ID). | 440 | * @returns the current SSID (Service Set ID). |
441 | */ | 441 | */ |
442 | virtual QString SSID() const; | 442 | virtual QString SSID() const; |
443 | /** | 443 | /** |
444 | * Perform scanning the wireless network neighbourhood. | 444 | * Perform scanning the wireless network neighbourhood. |
445 | * @note: UNSTABLE API - UNDER CONSTRUCTION - DON'T USE! | 445 | * @note: UNSTABLE API - UNDER CONSTRUCTION - DON'T USE! |
446 | */ | 446 | */ |
447 | virtual OStationList* scanNetwork(); | 447 | virtual OStationList* scanNetwork(); |
448 | /** | 448 | /** |
449 | * @return signal strength to associated neighbour (in percent). | 449 | * @return signal strength to associated neighbour (in percent). |
450 | * In infrastructure mode, this is the signal strength of the Access Point. | 450 | * In infrastructure mode, this is the signal strength of the Access Point. |
451 | * In other modes the result is driver dependent. | 451 | * In other modes the result is driver dependent. |
452 | */ | 452 | */ |
453 | virtual int signalStrength() const; | 453 | virtual int signalStrength() const; |
454 | /** @internal commit pending changes to the driver | 454 | /** |
455 | * | 455 | * @returns the wireless extension version used by the interface driver. |
456 | **/ | ||
457 | short wirelessExtensionDriverVersion() const; | ||
458 | /** | ||
459 | * @internal commit pending changes to the driver | ||
456 | */ | 460 | */ |
457 | void commit() const; | 461 | void commit() const; |
458 | 462 | ||
459 | protected: | 463 | protected: |
460 | void buildInformation(); | 464 | void buildInformation(); |
461 | void buildPrivateList(); | 465 | void buildPrivateList(); |
462 | void dumpInformation() const; | 466 | void dumpInformation() const; |
463 | virtual void init(); | 467 | virtual void init(); |
464 | struct iwreq& iwr() const; | 468 | struct iwreq& iwr() const; |
465 | bool wioctl( int call ) const; | 469 | bool wioctl( int call ) const; |
466 | bool wioctl( int call, struct iwreq& ) const; | 470 | bool wioctl( int call, struct iwreq& ) const; |
467 | 471 | ||
468 | protected: | 472 | protected: |
469 | mutable struct iwreq _iwr; | 473 | mutable struct iwreq _iwr; |
470 | QMap<int,int> _channels; | 474 | QMap<int,int> _channels; |
471 | struct iw_range _range; | 475 | struct iw_range _range; |
472 | 476 | ||
473 | private: | 477 | private: |
474 | OChannelHopper* _hopper; | 478 | OChannelHopper* _hopper; |
475 | class Private; | 479 | class Private; |
476 | Private *d; | 480 | Private *d; |
477 | }; | 481 | }; |
478 | 482 | ||
479 | 483 | ||
480 | /*====================================================================================== | 484 | /*====================================================================================== |
481 | * OMonitoringInterface | 485 | * OMonitoringInterface |
482 | *======================================================================================*/ | 486 | *======================================================================================*/ |
483 | 487 | ||
484 | 488 | ||
485 | class OMonitoringInterface | 489 | class OMonitoringInterface |
486 | { | 490 | { |
487 | public: | 491 | public: |
488 | OMonitoringInterface(); | 492 | OMonitoringInterface(); |
489 | OMonitoringInterface( ONetworkInterface*, bool _prismHeader ); | 493 | OMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
490 | virtual ~OMonitoringInterface(); | 494 | virtual ~OMonitoringInterface(); |
491 | 495 | ||
492 | public: | 496 | public: |
493 | virtual void setEnabled( bool ); | 497 | virtual void setEnabled( bool ); |
494 | virtual void setChannel( int ); | 498 | virtual void setChannel( int ); |
495 | 499 | ||
496 | virtual QString name() const = 0; | 500 | virtual QString name() const = 0; |
497 | 501 | ||
498 | protected: | 502 | protected: |
499 | OWirelessNetworkInterface* _if; | 503 | OWirelessNetworkInterface* _if; |
500 | bool _prismHeader; | 504 | bool _prismHeader; |
501 | private: | 505 | private: |
502 | class Private; | 506 | class Private; |
503 | Private *d; | 507 | Private *d; |