-rw-r--r-- | libopie2/opienet/onetwork.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h index 93b129f..a953296 100644 --- a/libopie2/opienet/onetwork.h +++ b/libopie2/opienet/onetwork.h | |||
@@ -47,24 +47,27 @@ | |||
47 | 47 | ||
48 | #include <opie2/onetutils.h> | 48 | #include <opie2/onetutils.h> |
49 | #include <opie2/ostation.h> | 49 | #include <opie2/ostation.h> |
50 | 50 | ||
51 | /* QT */ | 51 | /* QT */ |
52 | 52 | ||
53 | #include <qvaluelist.h> | 53 | #include <qvaluelist.h> |
54 | #include <qdict.h> | 54 | #include <qdict.h> |
55 | #include <qmap.h> | 55 | #include <qmap.h> |
56 | #include <qobject.h> | 56 | #include <qobject.h> |
57 | #include <qhostaddress.h> | 57 | #include <qhostaddress.h> |
58 | 58 | ||
59 | namespace Opie { | ||
60 | namespace Net { | ||
61 | |||
59 | class ONetworkInterface; | 62 | class ONetworkInterface; |
60 | class OWirelessNetworkInterface; | 63 | class OWirelessNetworkInterface; |
61 | class OChannelHopper; | 64 | class OChannelHopper; |
62 | class OMonitoringInterface; | 65 | class OMonitoringInterface; |
63 | 66 | ||
64 | /*====================================================================================== | 67 | /*====================================================================================== |
65 | * ONetwork | 68 | * ONetwork |
66 | *======================================================================================*/ | 69 | *======================================================================================*/ |
67 | 70 | ||
68 | /** | 71 | /** |
69 | * @brief A container class for all network interfaces | 72 | * @brief A container class for all network interfaces |
70 | * | 73 | * |
@@ -114,24 +117,26 @@ class ONetwork : public QObject | |||
114 | void synchronize(); | 117 | void synchronize(); |
115 | /** | 118 | /** |
116 | * @returns the wireless extension version used at compile time. | 119 | * @returns the wireless extension version used at compile time. |
117 | **/ | 120 | **/ |
118 | static short wirelessExtensionVersion(); | 121 | static short wirelessExtensionVersion(); |
119 | 122 | ||
120 | protected: | 123 | protected: |
121 | ONetwork(); | 124 | ONetwork(); |
122 | 125 | ||
123 | private: | 126 | private: |
124 | static ONetwork* _instance; | 127 | static ONetwork* _instance; |
125 | InterfaceMap _interfaces; | 128 | InterfaceMap _interfaces; |
129 | class Private; | ||
130 | Private *d; | ||
126 | }; | 131 | }; |
127 | 132 | ||
128 | 133 | ||
129 | /*====================================================================================== | 134 | /*====================================================================================== |
130 | * ONetworkInterface | 135 | * ONetworkInterface |
131 | *======================================================================================*/ | 136 | *======================================================================================*/ |
132 | 137 | ||
133 | /** | 138 | /** |
134 | * @brief A network interface wrapper. | 139 | * @brief A network interface wrapper. |
135 | * | 140 | * |
136 | * This class provides a wrapper for a network interface. All the cumbersume details of | 141 | * 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. | 142 | * Linux ioctls are hidden under a convenient high-level interface. |
@@ -225,24 +230,27 @@ class ONetworkInterface : public QObject | |||
225 | int dataLinkType() const; | 230 | int dataLinkType() const; |
226 | 231 | ||
227 | protected: | 232 | protected: |
228 | const int _sfd; | 233 | const int _sfd; |
229 | mutable ifreq _ifr; | 234 | mutable ifreq _ifr; |
230 | OMonitoringInterface* _mon; | 235 | OMonitoringInterface* _mon; |
231 | 236 | ||
232 | protected: | 237 | protected: |
233 | struct ifreq& ifr() const; | 238 | struct ifreq& ifr() const; |
234 | virtual void init(); | 239 | virtual void init(); |
235 | bool ioctl( int call ) const; | 240 | bool ioctl( int call ) const; |
236 | bool ioctl( int call, struct ifreq& ) const; | 241 | bool ioctl( int call, struct ifreq& ) const; |
242 | private: | ||
243 | class Private; | ||
244 | Private *d; | ||
237 | }; | 245 | }; |
238 | 246 | ||
239 | /*====================================================================================== | 247 | /*====================================================================================== |
240 | * OChannelHopper | 248 | * OChannelHopper |
241 | *======================================================================================*/ | 249 | *======================================================================================*/ |
242 | 250 | ||
243 | /** | 251 | /** |
244 | * @brief A radio frequency channel hopper. | 252 | * @brief A radio frequency channel hopper. |
245 | * | 253 | * |
246 | * This class provides a channel hopper for radio frequencies. A channel hopper frequently | 254 | * This class provides a channel hopper for radio frequencies. A channel hopper frequently |
247 | * changes the radio frequency channel of its associated @ref OWirelessNetworkInterface. | 255 | * changes the radio frequency channel of its associated @ref OWirelessNetworkInterface. |
248 | * This is necessary when in monitoring mode and scanning for other devices, because | 256 | * This is necessary when in monitoring mode and scanning for other devices, because |
@@ -287,24 +295,26 @@ class OChannelHopper : public QObject | |||
287 | */ | 295 | */ |
288 | void hopped( int ); | 296 | void hopped( int ); |
289 | 297 | ||
290 | protected: | 298 | protected: |
291 | virtual void timerEvent( QTimerEvent* ); | 299 | virtual void timerEvent( QTimerEvent* ); |
292 | 300 | ||
293 | private: | 301 | private: |
294 | OWirelessNetworkInterface* _iface; | 302 | OWirelessNetworkInterface* _iface; |
295 | int _interval; | 303 | int _interval; |
296 | int _tid; | 304 | int _tid; |
297 | QValueList<int> _channels; | 305 | QValueList<int> _channels; |
298 | QValueList<int>::Iterator _channel; | 306 | QValueList<int>::Iterator _channel; |
307 | class Private; | ||
308 | Private *d; | ||
299 | }; | 309 | }; |
300 | 310 | ||
301 | 311 | ||
302 | /*====================================================================================== | 312 | /*====================================================================================== |
303 | * OWirelessNetworkInterface | 313 | * OWirelessNetworkInterface |
304 | *======================================================================================*/ | 314 | *======================================================================================*/ |
305 | 315 | ||
306 | /** | 316 | /** |
307 | * @brief A network interface wrapper for interfaces supporting the wireless extensions protocol. | 317 | * @brief A network interface wrapper for interfaces supporting the wireless extensions protocol. |
308 | * | 318 | * |
309 | * This class provides a high-level encapsulation of the Linux wireless extension API. | 319 | * This class provides a high-level encapsulation of the Linux wireless extension API. |
310 | * | 320 | * |
@@ -446,114 +456,135 @@ class OWirelessNetworkInterface : public ONetworkInterface | |||
446 | virtual void init(); | 456 | virtual void init(); |
447 | struct iwreq& iwr() const; | 457 | struct iwreq& iwr() const; |
448 | bool wioctl( int call ) const; | 458 | bool wioctl( int call ) const; |
449 | bool wioctl( int call, struct iwreq& ) const; | 459 | bool wioctl( int call, struct iwreq& ) const; |
450 | 460 | ||
451 | protected: | 461 | protected: |
452 | mutable struct iwreq _iwr; | 462 | mutable struct iwreq _iwr; |
453 | QMap<int,int> _channels; | 463 | QMap<int,int> _channels; |
454 | struct iw_range _range; | 464 | struct iw_range _range; |
455 | 465 | ||
456 | private: | 466 | private: |
457 | OChannelHopper* _hopper; | 467 | OChannelHopper* _hopper; |
468 | class Private; | ||
469 | Private *d; | ||
458 | }; | 470 | }; |
459 | 471 | ||
460 | 472 | ||
461 | /*====================================================================================== | 473 | /*====================================================================================== |
462 | * OMonitoringInterface | 474 | * OMonitoringInterface |
463 | *======================================================================================*/ | 475 | *======================================================================================*/ |
464 | 476 | ||
465 | 477 | ||
466 | class OMonitoringInterface | 478 | class OMonitoringInterface |
467 | { | 479 | { |
468 | public: | 480 | public: |
469 | OMonitoringInterface(); | 481 | OMonitoringInterface(); |
470 | OMonitoringInterface( ONetworkInterface*, bool _prismHeader ); | 482 | OMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
471 | virtual ~OMonitoringInterface(); | 483 | virtual ~OMonitoringInterface(); |
472 | 484 | ||
473 | public: | 485 | public: |
474 | virtual void setEnabled( bool ); | 486 | virtual void setEnabled( bool ); |
475 | virtual void setChannel( int ); | 487 | virtual void setChannel( int ); |
476 | 488 | ||
477 | virtual QString name() const = 0; | 489 | virtual QString name() const = 0; |
478 | 490 | ||
479 | protected: | 491 | protected: |
480 | OWirelessNetworkInterface* _if; | 492 | OWirelessNetworkInterface* _if; |
481 | bool _prismHeader; | 493 | bool _prismHeader; |
494 | private: | ||
495 | class Private; | ||
496 | Private *d; | ||
482 | 497 | ||
483 | }; | 498 | }; |
484 | 499 | ||
485 | 500 | ||
486 | /*====================================================================================== | 501 | /*====================================================================================== |
487 | * OCiscoMonitoring | 502 | * OCiscoMonitoring |
488 | *======================================================================================*/ | 503 | *======================================================================================*/ |
489 | 504 | ||
490 | 505 | ||
491 | class OCiscoMonitoringInterface : public OMonitoringInterface | 506 | class OCiscoMonitoringInterface : public OMonitoringInterface |
492 | { | 507 | { |
493 | public: | 508 | public: |
494 | OCiscoMonitoringInterface( ONetworkInterface*, bool _prismHeader ); | 509 | OCiscoMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
495 | virtual ~OCiscoMonitoringInterface(); | 510 | virtual ~OCiscoMonitoringInterface(); |
496 | 511 | ||
497 | virtual void setEnabled( bool ); | 512 | virtual void setEnabled( bool ); |
498 | virtual QString name() const; | 513 | virtual QString name() const; |
499 | virtual void setChannel( int ); | 514 | virtual void setChannel( int ); |
515 | private: | ||
516 | class Private; | ||
517 | Private *d; | ||
500 | 518 | ||
501 | }; | 519 | }; |
502 | 520 | ||
503 | 521 | ||
504 | /*====================================================================================== | 522 | /*====================================================================================== |
505 | * OWlanNGMonitoringInterface | 523 | * OWlanNGMonitoringInterface |
506 | *======================================================================================*/ | 524 | *======================================================================================*/ |
507 | 525 | ||
508 | 526 | ||
509 | class OWlanNGMonitoringInterface : public OMonitoringInterface | 527 | class OWlanNGMonitoringInterface : public OMonitoringInterface |
510 | { | 528 | { |
511 | public: | 529 | public: |
512 | OWlanNGMonitoringInterface( ONetworkInterface*, bool _prismHeader ); | 530 | OWlanNGMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
513 | virtual ~OWlanNGMonitoringInterface(); | 531 | virtual ~OWlanNGMonitoringInterface(); |
514 | 532 | ||
515 | public: | 533 | public: |
516 | virtual void setEnabled( bool ); | 534 | virtual void setEnabled( bool ); |
517 | virtual QString name() const; | 535 | virtual QString name() const; |
518 | virtual void setChannel( int ); | 536 | virtual void setChannel( int ); |
537 | private: | ||
538 | class Private; | ||
539 | Private *d; | ||
519 | 540 | ||
520 | }; | 541 | }; |
521 | 542 | ||
522 | 543 | ||
523 | /*====================================================================================== | 544 | /*====================================================================================== |
524 | * OHostAPMonitoringInterface | 545 | * OHostAPMonitoringInterface |
525 | *======================================================================================*/ | 546 | *======================================================================================*/ |
526 | 547 | ||
527 | 548 | ||
528 | class OHostAPMonitoringInterface : public OMonitoringInterface | 549 | class OHostAPMonitoringInterface : public OMonitoringInterface |
529 | { | 550 | { |
530 | public: | 551 | public: |
531 | OHostAPMonitoringInterface( ONetworkInterface*, bool _prismHeader ); | 552 | OHostAPMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
532 | virtual ~OHostAPMonitoringInterface(); | 553 | virtual ~OHostAPMonitoringInterface(); |
533 | 554 | ||
534 | public: | 555 | public: |
535 | virtual void setEnabled( bool ); | 556 | virtual void setEnabled( bool ); |
536 | virtual QString name() const; | 557 | virtual QString name() const; |
558 | |||
559 | private: | ||
560 | class Private; | ||
561 | Private *d; | ||
537 | }; | 562 | }; |
538 | 563 | ||
539 | 564 | ||
540 | /*====================================================================================== | 565 | /*====================================================================================== |
541 | * OOrinocoMonitoringInterface | 566 | * OOrinocoMonitoringInterface |
542 | *======================================================================================*/ | 567 | *======================================================================================*/ |
543 | 568 | ||
544 | 569 | ||
545 | class OOrinocoMonitoringInterface : public OMonitoringInterface | 570 | class OOrinocoMonitoringInterface : public OMonitoringInterface |
546 | { | 571 | { |
547 | public: | 572 | public: |
548 | OOrinocoMonitoringInterface( ONetworkInterface*, bool _prismHeader ); | 573 | OOrinocoMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
549 | virtual ~OOrinocoMonitoringInterface(); | 574 | virtual ~OOrinocoMonitoringInterface(); |
550 | 575 | ||
551 | public: | 576 | public: |
552 | virtual void setChannel( int ); | 577 | virtual void setChannel( int ); |
553 | virtual void setEnabled( bool ); | 578 | virtual void setEnabled( bool ); |
554 | virtual QString name() const; | 579 | virtual QString name() const; |
555 | 580 | ||
581 | private: | ||
582 | class Private; | ||
583 | Private *d; | ||
556 | }; | 584 | }; |
557 | 585 | ||
586 | } | ||
587 | } | ||
588 | |||
558 | #endif // ONETWORK_H | 589 | #endif // ONETWORK_H |
559 | 590 | ||