-rw-r--r-- | libopie2/opienet/onetwork.h | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h index b57ac3f..acf2f69 100644 --- a/libopie2/opienet/onetwork.h +++ b/libopie2/opienet/onetwork.h | |||
@@ -46,12 +46,15 @@ | |||
46 | 46 | ||
47 | #include <opie2/onetutils.h> | 47 | #include <opie2/onetutils.h> |
48 | 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 | ||
53 | #define IW_MAX_PRIV_DEF 128 | ||
54 | #endif | ||
52 | 55 | ||
53 | // 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 |
54 | // 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> |
55 | // ML: which conflicts with the user header <net/if.h> | 58 | // ML: which conflicts with the user header <net/if.h> |
56 | // ML: We really a user header for the Wireless Extensions, something like <net/wireless.h> | 59 | // ML: We really a user header for the Wireless Extensions, something like <net/wireless.h> |
57 | // ML: I will drop Jean an mail on that subject | 60 | // ML: I will drop Jean an mail on that subject |
@@ -105,38 +108,36 @@ class ONetwork : public QObject | |||
105 | 108 | ||
106 | 109 | ||
107 | /*====================================================================================== | 110 | /*====================================================================================== |
108 | * ONetworkInterface | 111 | * ONetworkInterface |
109 | *======================================================================================*/ | 112 | *======================================================================================*/ |
110 | 113 | ||
111 | class ONetworkInterface | 114 | class ONetworkInterface : public QObject |
112 | { | 115 | { |
113 | friend class OMonitoringInterface; | 116 | friend class OMonitoringInterface; |
114 | friend class OCiscoMonitoringInterface; | 117 | friend class OCiscoMonitoringInterface; |
115 | friend class OWlanNGMonitoringInterface; | 118 | friend class OWlanNGMonitoringInterface; |
116 | friend class OHostAPMonitoringInterface; | 119 | friend class OHostAPMonitoringInterface; |
117 | friend class OOrinocoMonitoringInterface; | 120 | friend class OOrinocoMonitoringInterface; |
118 | 121 | ||
119 | public: | 122 | public: |
120 | ONetworkInterface( const QString& name ); | 123 | ONetworkInterface( QObject* parent, const char* name ); |
121 | virtual ~ONetworkInterface(); | 124 | virtual ~ONetworkInterface(); |
122 | 125 | ||
123 | const QString& name() const; | ||
124 | void setMonitoring( OMonitoringInterface* ); | 126 | void setMonitoring( OMonitoringInterface* ); |
125 | OMonitoringInterface* monitoring() const; | 127 | OMonitoringInterface* monitoring() const; |
126 | bool setPromiscuousMode( bool ); | 128 | bool setPromiscuousMode( bool ); |
127 | bool promiscuousMode() const; | 129 | bool promiscuousMode() const; |
128 | bool setUp( bool ); | 130 | bool setUp( bool ); |
129 | bool isUp() const; | 131 | bool isUp() const; |
130 | bool isLoopback() const; | 132 | bool isLoopback() const; |
131 | bool isWireless() const; | 133 | bool isWireless() const; |
132 | QString ipV4Address() const; | 134 | QString ipV4Address() const; |
133 | OMacAddress macAddress() const; | 135 | OMacAddress macAddress() const; |
134 | 136 | ||
135 | protected: | 137 | protected: |
136 | const QString _name; | ||
137 | const int _sfd; | 138 | const int _sfd; |
138 | mutable ifreqstruct _ifr; | 139 | mutable ifreqstruct _ifr; |
139 | OMonitoringInterface* _mon; | 140 | OMonitoringInterface* _mon; |
140 | 141 | ||
141 | protected: | 142 | protected: |
142 | ifreqstruct& ifr() const; | 143 | ifreqstruct& ifr() const; |
@@ -182,13 +183,13 @@ class OWirelessNetworkInterface : public ONetworkInterface | |||
182 | friend class OHostAPMonitoringInterface; | 183 | friend class OHostAPMonitoringInterface; |
183 | friend class OOrinocoMonitoringInterface; | 184 | friend class OOrinocoMonitoringInterface; |
184 | 185 | ||
185 | public: | 186 | public: |
186 | enum Mode { AdHoc, Managed, Monitor }; | 187 | enum Mode { AdHoc, Managed, Monitor }; |
187 | 188 | ||
188 | OWirelessNetworkInterface( const QString& name ); | 189 | OWirelessNetworkInterface( QObject* parent, const char* name ); |
189 | virtual ~OWirelessNetworkInterface(); | 190 | virtual ~OWirelessNetworkInterface(); |
190 | 191 | ||
191 | virtual void setChannel( int ) const; | 192 | virtual void setChannel( int ) const; |
192 | virtual int channel() const; | 193 | virtual int channel() const; |
193 | virtual double frequency() const; | 194 | virtual double frequency() const; |
194 | virtual int channels() const; | 195 | virtual int channels() const; |
@@ -210,21 +211,23 @@ class OWirelessNetworkInterface : public ONetworkInterface | |||
210 | virtual QString associatedAP() const; | 211 | virtual QString associatedAP() const; |
211 | 212 | ||
212 | virtual void setSSID( const QString& ); | 213 | virtual void setSSID( const QString& ); |
213 | virtual QString SSID() const; | 214 | virtual QString SSID() const; |
214 | 215 | ||
215 | protected: | 216 | protected: |
216 | mutable iwreqstruct _iwr; | 217 | void buildChannelList(); |
217 | QMap<int,int> _channels; | 218 | void buildPrivateList(); |
218 | |||
219 | protected: | ||
220 | virtual void init(); | 219 | virtual void init(); |
221 | iwreqstruct& iwr() const; | 220 | iwreqstruct& iwr() const; |
222 | bool wioctl( int call ) const; | 221 | bool wioctl( int call ) const; |
223 | bool wioctl( int call, iwreqstruct& ) const; | 222 | bool wioctl( int call, iwreqstruct& ) const; |
224 | 223 | ||
224 | protected: | ||
225 | mutable iwreqstruct _iwr; | ||
226 | QMap<int,int> _channels; | ||
227 | |||
225 | private: | 228 | private: |
226 | OChannelHopper* _hopper; | 229 | OChannelHopper* _hopper; |
227 | }; | 230 | }; |
228 | 231 | ||
229 | 232 | ||
230 | /*====================================================================================== | 233 | /*====================================================================================== |