-rw-r--r-- | libopie2/opienet/onetwork.cpp | 7 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.h | 9 |
2 files changed, 16 insertions, 0 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index e916c44..73b543b 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp | |||
@@ -304,96 +304,97 @@ bool ONetworkInterface::isWireless() const | |||
304 | * OChannelHopper | 304 | * OChannelHopper |
305 | *======================================================================================*/ | 305 | *======================================================================================*/ |
306 | 306 | ||
307 | OChannelHopper::OChannelHopper( OWirelessNetworkInterface* iface ) | 307 | OChannelHopper::OChannelHopper( OWirelessNetworkInterface* iface ) |
308 | :QObject( 0, "Mickey's funky hopper" ), | 308 | :QObject( 0, "Mickey's funky hopper" ), |
309 | _iface( iface ), _interval( 0 ), _tid( 0 ) | 309 | _iface( iface ), _interval( 0 ), _tid( 0 ) |
310 | { | 310 | { |
311 | int _maxChannel = iface->channels()+1; | 311 | int _maxChannel = iface->channels()+1; |
312 | // generate fancy hopping sequence honoring the device capabilities | 312 | // generate fancy hopping sequence honoring the device capabilities |
313 | if ( _maxChannel >= 1 ) _channels.append( 1 ); | 313 | if ( _maxChannel >= 1 ) _channels.append( 1 ); |
314 | if ( _maxChannel >= 7 ) _channels.append( 7 ); | 314 | if ( _maxChannel >= 7 ) _channels.append( 7 ); |
315 | if ( _maxChannel >= 13 ) _channels.append( 13 ); | 315 | if ( _maxChannel >= 13 ) _channels.append( 13 ); |
316 | if ( _maxChannel >= 2 ) _channels.append( 2 ); | 316 | if ( _maxChannel >= 2 ) _channels.append( 2 ); |
317 | if ( _maxChannel >= 8 ) _channels.append( 8 ); | 317 | if ( _maxChannel >= 8 ) _channels.append( 8 ); |
318 | if ( _maxChannel >= 3 ) _channels.append( 3 ); | 318 | if ( _maxChannel >= 3 ) _channels.append( 3 ); |
319 | if ( _maxChannel >= 14 ) _channels.append( 14 ); | 319 | if ( _maxChannel >= 14 ) _channels.append( 14 ); |
320 | if ( _maxChannel >= 9 ) _channels.append( 9 ); | 320 | if ( _maxChannel >= 9 ) _channels.append( 9 ); |
321 | if ( _maxChannel >= 4 ) _channels.append( 4 ); | 321 | if ( _maxChannel >= 4 ) _channels.append( 4 ); |
322 | if ( _maxChannel >= 10 ) _channels.append( 10 ); | 322 | if ( _maxChannel >= 10 ) _channels.append( 10 ); |
323 | if ( _maxChannel >= 5 ) _channels.append( 5 ); | 323 | if ( _maxChannel >= 5 ) _channels.append( 5 ); |
324 | if ( _maxChannel >= 11 ) _channels.append( 11 ); | 324 | if ( _maxChannel >= 11 ) _channels.append( 11 ); |
325 | if ( _maxChannel >= 6 ) _channels.append( 6 ); | 325 | if ( _maxChannel >= 6 ) _channels.append( 6 ); |
326 | if ( _maxChannel >= 12 ) _channels.append( 12 ); | 326 | if ( _maxChannel >= 12 ) _channels.append( 12 ); |
327 | _channel = _channels.begin(); | 327 | _channel = _channels.begin(); |
328 | 328 | ||
329 | } | 329 | } |
330 | 330 | ||
331 | 331 | ||
332 | OChannelHopper::~OChannelHopper() | 332 | OChannelHopper::~OChannelHopper() |
333 | { | 333 | { |
334 | } | 334 | } |
335 | 335 | ||
336 | 336 | ||
337 | bool OChannelHopper::isActive() const | 337 | bool OChannelHopper::isActive() const |
338 | { | 338 | { |
339 | return _tid; | 339 | return _tid; |
340 | } | 340 | } |
341 | 341 | ||
342 | 342 | ||
343 | int OChannelHopper::channel() const | 343 | int OChannelHopper::channel() const |
344 | { | 344 | { |
345 | return *_channel; | 345 | return *_channel; |
346 | } | 346 | } |
347 | 347 | ||
348 | 348 | ||
349 | void OChannelHopper::timerEvent( QTimerEvent* ) | 349 | void OChannelHopper::timerEvent( QTimerEvent* ) |
350 | { | 350 | { |
351 | _iface->setChannel( *_channel ); | 351 | _iface->setChannel( *_channel ); |
352 | emit( hopped( *_channel ) ); | ||
352 | qDebug( "OChannelHopper::timerEvent(): set channel %d on interface '%s'", | 353 | qDebug( "OChannelHopper::timerEvent(): set channel %d on interface '%s'", |
353 | *_channel, (const char*) _iface->name() ); | 354 | *_channel, (const char*) _iface->name() ); |
354 | if ( ++_channel == _channels.end() ) _channel = _channels.begin(); | 355 | if ( ++_channel == _channels.end() ) _channel = _channels.begin(); |
355 | } | 356 | } |
356 | 357 | ||
357 | 358 | ||
358 | void OChannelHopper::setInterval( int interval ) | 359 | void OChannelHopper::setInterval( int interval ) |
359 | { | 360 | { |
360 | if ( interval == _interval ) | 361 | if ( interval == _interval ) |
361 | return; | 362 | return; |
362 | 363 | ||
363 | if ( _interval ) | 364 | if ( _interval ) |
364 | killTimer( _tid ); | 365 | killTimer( _tid ); |
365 | 366 | ||
366 | _tid = 0; | 367 | _tid = 0; |
367 | _interval = interval; | 368 | _interval = interval; |
368 | 369 | ||
369 | if ( _interval ) | 370 | if ( _interval ) |
370 | { | 371 | { |
371 | _tid = startTimer( interval ); | 372 | _tid = startTimer( interval ); |
372 | } | 373 | } |
373 | } | 374 | } |
374 | 375 | ||
375 | 376 | ||
376 | int OChannelHopper::interval() const | 377 | int OChannelHopper::interval() const |
377 | { | 378 | { |
378 | return _interval; | 379 | return _interval; |
379 | } | 380 | } |
380 | 381 | ||
381 | 382 | ||
382 | /*====================================================================================== | 383 | /*====================================================================================== |
383 | * OWirelessNetworkInterface | 384 | * OWirelessNetworkInterface |
384 | *======================================================================================*/ | 385 | *======================================================================================*/ |
385 | 386 | ||
386 | OWirelessNetworkInterface::OWirelessNetworkInterface( QObject* parent, const char* name ) | 387 | OWirelessNetworkInterface::OWirelessNetworkInterface( QObject* parent, const char* name ) |
387 | :ONetworkInterface( parent, name ), _hopper( 0 ) | 388 | :ONetworkInterface( parent, name ), _hopper( 0 ) |
388 | { | 389 | { |
389 | qDebug( "OWirelessNetworkInterface::OWirelessNetworkInterface()" ); | 390 | qDebug( "OWirelessNetworkInterface::OWirelessNetworkInterface()" ); |
390 | init(); | 391 | init(); |
391 | } | 392 | } |
392 | 393 | ||
393 | 394 | ||
394 | OWirelessNetworkInterface::~OWirelessNetworkInterface() | 395 | OWirelessNetworkInterface::~OWirelessNetworkInterface() |
395 | { | 396 | { |
396 | } | 397 | } |
397 | 398 | ||
398 | 399 | ||
399 | struct iwreq& OWirelessNetworkInterface::iwr() const | 400 | struct iwreq& OWirelessNetworkInterface::iwr() const |
@@ -548,96 +549,102 @@ void OWirelessNetworkInterface::setChannel( int c ) const | |||
548 | if ( !_mon ) | 549 | if ( !_mon ) |
549 | { | 550 | { |
550 | memset( &_iwr, 0, sizeof( struct iwreq ) ); | 551 | memset( &_iwr, 0, sizeof( struct iwreq ) ); |
551 | _iwr.u.freq.m = c; | 552 | _iwr.u.freq.m = c; |
552 | _iwr.u.freq.e = 0; | 553 | _iwr.u.freq.e = 0; |
553 | wioctl( SIOCSIWFREQ ); | 554 | wioctl( SIOCSIWFREQ ); |
554 | } | 555 | } |
555 | else | 556 | else |
556 | { | 557 | { |
557 | _mon->setChannel( c ); | 558 | _mon->setChannel( c ); |
558 | } | 559 | } |
559 | } | 560 | } |
560 | 561 | ||
561 | 562 | ||
562 | double OWirelessNetworkInterface::frequency() const | 563 | double OWirelessNetworkInterface::frequency() const |
563 | { | 564 | { |
564 | if ( !wioctl( SIOCGIWFREQ ) ) | 565 | if ( !wioctl( SIOCGIWFREQ ) ) |
565 | { | 566 | { |
566 | return -1.0; | 567 | return -1.0; |
567 | } | 568 | } |
568 | else | 569 | else |
569 | { | 570 | { |
570 | return double( _iwr.u.freq.m ) * pow( 10.0, _iwr.u.freq.e ) / 1000000000.0; | 571 | return double( _iwr.u.freq.m ) * pow( 10.0, _iwr.u.freq.e ) / 1000000000.0; |
571 | } | 572 | } |
572 | } | 573 | } |
573 | 574 | ||
574 | 575 | ||
575 | int OWirelessNetworkInterface::channels() const | 576 | int OWirelessNetworkInterface::channels() const |
576 | { | 577 | { |
577 | return _channels.count(); | 578 | return _channels.count(); |
578 | } | 579 | } |
579 | 580 | ||
580 | 581 | ||
581 | void OWirelessNetworkInterface::setChannelHopping( int interval ) | 582 | void OWirelessNetworkInterface::setChannelHopping( int interval ) |
582 | { | 583 | { |
583 | if ( !_hopper ) _hopper = new OChannelHopper( this ); | 584 | if ( !_hopper ) _hopper = new OChannelHopper( this ); |
584 | _hopper->setInterval( interval ); | 585 | _hopper->setInterval( interval ); |
585 | //FIXME: When and by whom will the channel hopper be deleted? | 586 | //FIXME: When and by whom will the channel hopper be deleted? |
586 | //TODO: rely on QObject hierarchy | 587 | //TODO: rely on QObject hierarchy |
587 | } | 588 | } |
588 | 589 | ||
589 | 590 | ||
590 | int OWirelessNetworkInterface::channelHopping() const | 591 | int OWirelessNetworkInterface::channelHopping() const |
591 | { | 592 | { |
592 | return _hopper->interval(); | 593 | return _hopper->interval(); |
593 | } | 594 | } |
594 | 595 | ||
595 | 596 | ||
597 | OChannelHopper* OWirelessNetworkInterface::channelHopper() const | ||
598 | { | ||
599 | return _hopper; | ||
600 | } | ||
601 | |||
602 | |||
596 | void OWirelessNetworkInterface::setMonitorMode( bool b ) | 603 | void OWirelessNetworkInterface::setMonitorMode( bool b ) |
597 | { | 604 | { |
598 | if ( _mon ) | 605 | if ( _mon ) |
599 | _mon->setEnabled( b ); | 606 | _mon->setEnabled( b ); |
600 | else | 607 | else |
601 | qDebug( "ONetwork(): can't switch monitor mode without installed monitoring interface" ); | 608 | qDebug( "ONetwork(): can't switch monitor mode without installed monitoring interface" ); |
602 | } | 609 | } |
603 | 610 | ||
604 | 611 | ||
605 | bool OWirelessNetworkInterface::monitorMode() const | 612 | bool OWirelessNetworkInterface::monitorMode() const |
606 | { | 613 | { |
607 | qDebug( "dataLinkType = %d", dataLinkType() ); | 614 | qDebug( "dataLinkType = %d", dataLinkType() ); |
608 | return dataLinkType() == ARPHRD_IEEE80211; | 615 | return dataLinkType() == ARPHRD_IEEE80211; |
609 | } | 616 | } |
610 | 617 | ||
611 | 618 | ||
612 | QString OWirelessNetworkInterface::nickName() const | 619 | QString OWirelessNetworkInterface::nickName() const |
613 | { | 620 | { |
614 | char str[IW_ESSID_MAX_SIZE]; | 621 | char str[IW_ESSID_MAX_SIZE]; |
615 | _iwr.u.data.pointer = &str[0]; | 622 | _iwr.u.data.pointer = &str[0]; |
616 | _iwr.u.data.length = IW_ESSID_MAX_SIZE; | 623 | _iwr.u.data.length = IW_ESSID_MAX_SIZE; |
617 | if ( !wioctl( SIOCGIWNICKN ) ) | 624 | if ( !wioctl( SIOCGIWNICKN ) ) |
618 | { | 625 | { |
619 | return "<unknown>"; | 626 | return "<unknown>"; |
620 | } | 627 | } |
621 | else | 628 | else |
622 | { | 629 | { |
623 | str[_iwr.u.data.length] = 0x0; // some drivers (e.g. wlan-ng) don't zero-terminate the string | 630 | str[_iwr.u.data.length] = 0x0; // some drivers (e.g. wlan-ng) don't zero-terminate the string |
624 | return str; | 631 | return str; |
625 | } | 632 | } |
626 | } | 633 | } |
627 | 634 | ||
628 | 635 | ||
629 | void OWirelessNetworkInterface::setPrivate( const QString& call, int numargs, ... ) | 636 | void OWirelessNetworkInterface::setPrivate( const QString& call, int numargs, ... ) |
630 | { | 637 | { |
631 | OPrivateIOCTL* priv = static_cast<OPrivateIOCTL*>( child( (const char*) call ) ); | 638 | OPrivateIOCTL* priv = static_cast<OPrivateIOCTL*>( child( (const char*) call ) ); |
632 | if ( !priv ) | 639 | if ( !priv ) |
633 | { | 640 | { |
634 | qDebug( "OWirelessNetworkInterface::setPrivate(): interface '%s' does not support private ioctl '%s'", name(), (const char*) call ); | 641 | qDebug( "OWirelessNetworkInterface::setPrivate(): interface '%s' does not support private ioctl '%s'", name(), (const char*) call ); |
635 | return; | 642 | return; |
636 | } | 643 | } |
637 | if ( priv->numberSetArgs() != numargs ) | 644 | if ( priv->numberSetArgs() != numargs ) |
638 | { | 645 | { |
639 | qDebug( "OWirelessNetworkInterface::setPrivate(): parameter count not matching. '%s' expects %d arguments, but got %d", (const char*) call, priv->numberSetArgs(), numargs ); | 646 | qDebug( "OWirelessNetworkInterface::setPrivate(): parameter count not matching. '%s' expects %d arguments, but got %d", (const char*) call, priv->numberSetArgs(), numargs ); |
640 | return; | 647 | return; |
641 | } | 648 | } |
642 | 649 | ||
643 | qDebug( "OWirelessNetworkInterface::setPrivate(): about to call '%s' on interface '%s'", (const char*) call, name() ); | 650 | qDebug( "OWirelessNetworkInterface::setPrivate(): about to call '%s' on interface '%s'", (const char*) call, name() ); |
diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h index 10f52b8..d2cc25d 100644 --- a/libopie2/opienet/onetwork.h +++ b/libopie2/opienet/onetwork.h | |||
@@ -182,194 +182,203 @@ class ONetworkInterface : public QObject | |||
182 | bool isWireless() const; | 182 | bool isWireless() const; |
183 | /* | 183 | /* |
184 | * @returns the IPv4 address associated with this interface. | 184 | * @returns the IPv4 address associated with this interface. |
185 | */ | 185 | */ |
186 | QString ipV4Address() const; | 186 | QString ipV4Address() const; |
187 | /* | 187 | /* |
188 | * Associate the MAC address @a addr with the interface. | 188 | * Associate the MAC address @a addr with the interface. |
189 | * @note It can be necessary to shut down the interface prior to calling this method. | 189 | * @note It can be necessary to shut down the interface prior to calling this method. |
190 | * @warning This is not supported by all drivers. | 190 | * @warning This is not supported by all drivers. |
191 | */ | 191 | */ |
192 | void setMacAddress( const OMacAddress& addr ); | 192 | void setMacAddress( const OMacAddress& addr ); |
193 | /* | 193 | /* |
194 | * @returns the MAC address associated with this interface. | 194 | * @returns the MAC address associated with this interface. |
195 | */ | 195 | */ |
196 | OMacAddress macAddress() const; | 196 | OMacAddress macAddress() const; |
197 | /* | 197 | /* |
198 | * @returns the data link type currently associated with this interface. | 198 | * @returns the data link type currently associated with this interface. |
199 | * @see #include <net/if_arp.h> for possible values. | 199 | * @see #include <net/if_arp.h> for possible values. |
200 | */ | 200 | */ |
201 | int dataLinkType() const; | 201 | int dataLinkType() const; |
202 | 202 | ||
203 | protected: | 203 | protected: |
204 | const int _sfd; | 204 | const int _sfd; |
205 | mutable ifreq _ifr; | 205 | mutable ifreq _ifr; |
206 | OMonitoringInterface* _mon; | 206 | OMonitoringInterface* _mon; |
207 | 207 | ||
208 | protected: | 208 | protected: |
209 | struct ifreq& ifr() const; | 209 | struct ifreq& ifr() const; |
210 | virtual void init(); | 210 | virtual void init(); |
211 | bool ioctl( int call ) const; | 211 | bool ioctl( int call ) const; |
212 | bool ioctl( int call, struct ifreq& ) const; | 212 | bool ioctl( int call, struct ifreq& ) const; |
213 | }; | 213 | }; |
214 | 214 | ||
215 | /*====================================================================================== | 215 | /*====================================================================================== |
216 | * OChannelHopper | 216 | * OChannelHopper |
217 | *======================================================================================*/ | 217 | *======================================================================================*/ |
218 | 218 | ||
219 | /** | 219 | /** |
220 | * @brief A radio frequency channel hopper. | 220 | * @brief A radio frequency channel hopper. |
221 | * | 221 | * |
222 | * This class provides a channel hopper for radio frequencies. A channel hopper frequently | 222 | * This class provides a channel hopper for radio frequencies. A channel hopper frequently |
223 | * changes the radio frequency channel of its associated @ref OWirelessNetworkInterface. | 223 | * changes the radio frequency channel of its associated @ref OWirelessNetworkInterface. |
224 | * This is necessary when in monitoring mode and scanning for other devices, because | 224 | * This is necessary when in monitoring mode and scanning for other devices, because |
225 | * the radio frequency hardware can only detect packets sent on the same frequency. | 225 | * the radio frequency hardware can only detect packets sent on the same frequency. |
226 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 226 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
227 | */ | 227 | */ |
228 | class OChannelHopper : public QObject | 228 | class OChannelHopper : public QObject |
229 | { | 229 | { |
230 | Q_OBJECT | ||
231 | |||
230 | public: | 232 | public: |
231 | OChannelHopper( OWirelessNetworkInterface* ); | 233 | OChannelHopper( OWirelessNetworkInterface* ); |
232 | virtual ~OChannelHopper(); | 234 | virtual ~OChannelHopper(); |
233 | bool isActive() const; | 235 | bool isActive() const; |
234 | int channel() const; | 236 | int channel() const; |
235 | virtual void timerEvent( QTimerEvent* ); | 237 | virtual void timerEvent( QTimerEvent* ); |
236 | void setInterval( int ); | 238 | void setInterval( int ); |
237 | int interval() const; | 239 | int interval() const; |
238 | 240 | ||
241 | signals: | ||
242 | void hopped( int ); | ||
243 | |||
239 | private: | 244 | private: |
240 | OWirelessNetworkInterface* _iface; | 245 | OWirelessNetworkInterface* _iface; |
241 | int _interval; | 246 | int _interval; |
242 | int _tid; | 247 | int _tid; |
243 | QValueList<int> _channels; | 248 | QValueList<int> _channels; |
244 | QValueList<int>::Iterator _channel; | 249 | QValueList<int>::Iterator _channel; |
245 | }; | 250 | }; |
246 | 251 | ||
247 | 252 | ||
248 | /*====================================================================================== | 253 | /*====================================================================================== |
249 | * OWirelessNetworkInterface | 254 | * OWirelessNetworkInterface |
250 | *======================================================================================*/ | 255 | *======================================================================================*/ |
251 | 256 | ||
252 | /** | 257 | /** |
253 | * @brief A network interface wrapper for interfaces supporting the wireless extensions protocol. | 258 | * @brief A network interface wrapper for interfaces supporting the wireless extensions protocol. |
254 | * | 259 | * |
255 | * This class provides a high-level encapsulation of the Linux wireless extension API. | 260 | * This class provides a high-level encapsulation of the Linux wireless extension API. |
256 | */ | 261 | */ |
257 | class OWirelessNetworkInterface : public ONetworkInterface | 262 | class OWirelessNetworkInterface : public ONetworkInterface |
258 | { | 263 | { |
259 | friend class OMonitoringInterface; | 264 | friend class OMonitoringInterface; |
260 | friend class OCiscoMonitoringInterface; | 265 | friend class OCiscoMonitoringInterface; |
261 | friend class OWlanNGMonitoringInterface; | 266 | friend class OWlanNGMonitoringInterface; |
262 | friend class OHostAPMonitoringInterface; | 267 | friend class OHostAPMonitoringInterface; |
263 | friend class OOrinocoMonitoringInterface; | 268 | friend class OOrinocoMonitoringInterface; |
264 | 269 | ||
265 | friend class OPrivateIOCTL; | 270 | friend class OPrivateIOCTL; |
266 | 271 | ||
267 | public: | 272 | public: |
268 | enum Mode { AdHoc, Managed, Monitor }; | 273 | enum Mode { AdHoc, Managed, Monitor }; |
269 | 274 | ||
270 | /** | 275 | /** |
271 | * Constructor. | 276 | * Constructor. |
272 | */ | 277 | */ |
273 | OWirelessNetworkInterface( QObject* parent, const char* name ); | 278 | OWirelessNetworkInterface( QObject* parent, const char* name ); |
274 | /** | 279 | /** |
275 | * Destructor. | 280 | * Destructor. |
276 | */ | 281 | */ |
277 | virtual ~OWirelessNetworkInterface(); | 282 | virtual ~OWirelessNetworkInterface(); |
278 | /** | 283 | /** |
279 | * Setting the @a channel of the interface changes the radio frequency (RF) | 284 | * Setting the @a channel of the interface changes the radio frequency (RF) |
280 | * of the corresponding wireless network device. | 285 | * of the corresponding wireless network device. |
281 | */ | 286 | */ |
282 | virtual void setChannel( int channel ) const; | 287 | virtual void setChannel( int channel ) const; |
283 | /** | 288 | /** |
284 | * @returns the channel index of the current radio frequency. | 289 | * @returns the channel index of the current radio frequency. |
285 | */ | 290 | */ |
286 | virtual int channel() const; | 291 | virtual int channel() const; |
287 | /** | 292 | /** |
288 | * @returns the current radio frequency (in MHz). | 293 | * @returns the current radio frequency (in MHz). |
289 | */ | 294 | */ |
290 | virtual double frequency() const; | 295 | virtual double frequency() const; |
291 | /** | 296 | /** |
292 | * @returns the number of radio frequency channels for the | 297 | * @returns the number of radio frequency channels for the |
293 | * corresponding wireless network device. | 298 | * corresponding wireless network device. |
294 | * @note European devices usually have 14 channels, while American typically feature 11 channels. | 299 | * @note European devices usually have 14 channels, while American typically feature 11 channels. |
295 | */ | 300 | */ |
296 | virtual int channels() const; | 301 | virtual int channels() const; |
297 | //virtual double frequency(int) const; | 302 | //virtual double frequency(int) const; |
298 | 303 | ||
299 | virtual void setMode( Mode ) {}; //FIXME: Implement and document this | 304 | virtual void setMode( Mode ) {}; //FIXME: Implement and document this |
300 | virtual bool mode() const {}; //FIXME: Implement and document this | 305 | virtual bool mode() const {}; //FIXME: Implement and document this |
301 | 306 | ||
302 | /** | 307 | /** |
303 | * Setting the monitor mode on a wireless network interface enables | 308 | * Setting the monitor mode on a wireless network interface enables |
304 | * listening to IEEE 802.11 data and management frames which normally | 309 | * listening to IEEE 802.11 data and management frames which normally |
305 | * are handled by the device firmware. This can be used to detect | 310 | * are handled by the device firmware. This can be used to detect |
306 | * other wireless network devices, e.g. Access Points or Ad-hoc stations. | 311 | * other wireless network devices, e.g. Access Points or Ad-hoc stations. |
307 | * @warning Standard wireless network drives don't support the monitor mode. | 312 | * @warning Standard wireless network drives don't support the monitor mode. |
308 | * @warning You need a patched driver for this to work. | 313 | * @warning You need a patched driver for this to work. |
309 | * @note Enabling the monitor mode is highly driver dependent and requires | 314 | * @note Enabling the monitor mode is highly driver dependent and requires |
310 | * the proper @ref OMonitoringInterface to be associated with the interface. | 315 | * the proper @ref OMonitoringInterface to be associated with the interface. |
311 | * @see OMonitoringInterface | 316 | * @see OMonitoringInterface |
312 | */ | 317 | */ |
313 | virtual void setMonitorMode( bool ); | 318 | virtual void setMonitorMode( bool ); |
314 | /** | 319 | /** |
315 | * @returns true if the device is listening in IEEE 802.11 monitor mode | 320 | * @returns true if the device is listening in IEEE 802.11 monitor mode |
316 | */ | 321 | */ |
317 | virtual bool monitorMode() const; | 322 | virtual bool monitorMode() const; |
318 | /** | 323 | /** |
319 | * Set the channel hopping @a interval. An @a interval of 0 disables channel hopping. | 324 | * Set the channel hopping @a interval. An @a interval of 0 disables channel hopping. |
320 | * @see OChannelHopper | 325 | * @see OChannelHopper |
321 | */ | 326 | */ |
322 | virtual void setChannelHopping( int interval = 0 ); | 327 | virtual void setChannelHopping( int interval = 0 ); |
323 | /** | 328 | /** |
324 | * @returns the channel hopping interval or 0, if channel hopping is disabled. | 329 | * @returns the channel hopping interval or 0, if channel hopping is disabled. |
325 | */ | 330 | */ |
326 | virtual int channelHopping() const; | 331 | virtual int channelHopping() const; |
327 | /** | 332 | /** |
333 | * @returns the @ref OChannelHopper of this interface or 0, if channel hopping has not been activated before | ||
334 | */ | ||
335 | virtual OChannelHopper* channelHopper() const; | ||
336 | /** | ||
328 | * Set the station @a nickname. | 337 | * Set the station @a nickname. |
329 | */ | 338 | */ |
330 | virtual void setNickName( const QString& nickname ) {}; //FIXME: Implement this | 339 | virtual void setNickName( const QString& nickname ) {}; //FIXME: Implement this |
331 | /** | 340 | /** |
332 | * @returns the current station nickname. | 341 | * @returns the current station nickname. |
333 | */ | 342 | */ |
334 | virtual QString nickName() const; | 343 | virtual QString nickName() const; |
335 | /** | 344 | /** |
336 | * Invoke the private IOCTL @a command with a @number of parameters on the network interface. | 345 | * Invoke the private IOCTL @a command with a @number of parameters on the network interface. |
337 | * @see OPrivateIOCTL | 346 | * @see OPrivateIOCTL |
338 | */ | 347 | */ |
339 | virtual void setPrivate( const QString& command, int number, ... ); | 348 | virtual void setPrivate( const QString& command, int number, ... ); |
340 | /** | 349 | /** |
341 | * @returns true if the interface is featuring the private IOCTL @command. | 350 | * @returns true if the interface is featuring the private IOCTL @command. |
342 | */ | 351 | */ |
343 | virtual bool hasPrivate( const QString& command ); | 352 | virtual bool hasPrivate( const QString& command ); |
344 | virtual void getPrivate( const QString& command ); //FIXME: Implement and document this | 353 | virtual void getPrivate( const QString& command ); //FIXME: Implement and document this |
345 | 354 | ||
346 | virtual bool isAssociated() const {}; //FIXME: Implement and document this | 355 | virtual bool isAssociated() const {}; //FIXME: Implement and document this |
347 | virtual QString associatedAP() const; //FIXME: Implement and document this | 356 | virtual QString associatedAP() const; //FIXME: Implement and document this |
348 | 357 | ||
349 | virtual void setSSID( const QString& ); | 358 | virtual void setSSID( const QString& ); |
350 | virtual QString SSID() const; | 359 | virtual QString SSID() const; |
351 | 360 | ||
352 | protected: | 361 | protected: |
353 | void buildChannelList(); | 362 | void buildChannelList(); |
354 | void buildPrivateList(); | 363 | void buildPrivateList(); |
355 | virtual void init(); | 364 | virtual void init(); |
356 | struct iwreq& iwr() const; | 365 | struct iwreq& iwr() const; |
357 | bool wioctl( int call ) const; | 366 | bool wioctl( int call ) const; |
358 | bool wioctl( int call, struct iwreq& ) const; | 367 | bool wioctl( int call, struct iwreq& ) const; |
359 | 368 | ||
360 | protected: | 369 | protected: |
361 | mutable struct iwreq _iwr; | 370 | mutable struct iwreq _iwr; |
362 | QMap<int,int> _channels; | 371 | QMap<int,int> _channels; |
363 | 372 | ||
364 | private: | 373 | private: |
365 | OChannelHopper* _hopper; | 374 | OChannelHopper* _hopper; |
366 | }; | 375 | }; |
367 | 376 | ||
368 | 377 | ||
369 | /*====================================================================================== | 378 | /*====================================================================================== |
370 | * OMonitoringInterface | 379 | * OMonitoringInterface |
371 | *======================================================================================*/ | 380 | *======================================================================================*/ |
372 | 381 | ||
373 | 382 | ||
374 | class OMonitoringInterface | 383 | class OMonitoringInterface |
375 | { | 384 | { |