-rw-r--r-- | libopie2/opienet/onetutils.cpp | 33 | ||||
-rw-r--r-- | libopie2/opienet/onetutils.h | 4 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 33 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.h | 5 |
4 files changed, 71 insertions, 4 deletions
diff --git a/libopie2/opienet/onetutils.cpp b/libopie2/opienet/onetutils.cpp index 3e11b53..fd8f9e9 100644 --- a/libopie2/opienet/onetutils.cpp +++ b/libopie2/opienet/onetutils.cpp | |||
@@ -9,48 +9,49 @@ | |||
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include <opie2/onetutils.h> | 32 | #include <opie2/onetutils.h> |
33 | #include <opie2/onetwork.h> | ||
33 | 34 | ||
34 | #include <net/if.h> | 35 | #include <net/if.h> |
35 | 36 | ||
36 | #include <cstdio> | 37 | #include <cstdio> |
37 | using namespace std; | 38 | using namespace std; |
38 | 39 | ||
39 | #define IW_PRIV_TYPE_MASK 0x7000 | 40 | #define IW_PRIV_TYPE_MASK 0x7000 |
40 | #define IW_PRIV_TYPE_NONE 0x0000 | 41 | #define IW_PRIV_TYPE_NONE 0x0000 |
41 | #define IW_PRIV_TYPE_BYTE 0x1000 | 42 | #define IW_PRIV_TYPE_BYTE 0x1000 |
42 | #define IW_PRIV_TYPE_CHAR 0x2000 | 43 | #define IW_PRIV_TYPE_CHAR 0x2000 |
43 | #define IW_PRIV_TYPE_INT 0x4000 | 44 | #define IW_PRIV_TYPE_INT 0x4000 |
44 | #define IW_PRIV_TYPE_FLOAT 0x5000 | 45 | #define IW_PRIV_TYPE_FLOAT 0x5000 |
45 | #define IW_PRIV_TYPE_ADDR 0x6000 | 46 | #define IW_PRIV_TYPE_ADDR 0x6000 |
46 | #define IW_PRIV_SIZE_FIXED 0x0800 | 47 | #define IW_PRIV_SIZE_FIXED 0x0800 |
47 | #define IW_PRIV_SIZE_MASK 0x07FF | 48 | #define IW_PRIV_SIZE_MASK 0x07FF |
48 | 49 | ||
49 | /*====================================================================================== | 50 | /*====================================================================================== |
50 | * OMacAddress | 51 | * OMacAddress |
51 | *======================================================================================*/ | 52 | *======================================================================================*/ |
52 | 53 | ||
53 | // static initializer for broadcast and unknown MAC Adresses | 54 | // static initializer for broadcast and unknown MAC Adresses |
54 | const unsigned char __broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; | 55 | const unsigned char __broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
55 | const OMacAddress& OMacAddress::broadcast = OMacAddress( __broadcast ); | 56 | const OMacAddress& OMacAddress::broadcast = OMacAddress( __broadcast ); |
56 | const unsigned char __unknown[6] = { 0x44, 0x44, 0x44, 0x44, 0x44, 0x44 }; | 57 | const unsigned char __unknown[6] = { 0x44, 0x44, 0x44, 0x44, 0x44, 0x44 }; |
@@ -97,64 +98,88 @@ bool operator==( const OMacAddress &m1, const OMacAddress &m2 ) | |||
97 | return memcmp( &m1._bytes, &m2._bytes, 6 ) == 0; | 98 | return memcmp( &m1._bytes, &m2._bytes, 6 ) == 0; |
98 | } | 99 | } |
99 | 100 | ||
100 | 101 | ||
101 | /*====================================================================================== | 102 | /*====================================================================================== |
102 | * OHostAddress | 103 | * OHostAddress |
103 | *======================================================================================*/ | 104 | *======================================================================================*/ |
104 | 105 | ||
105 | 106 | ||
106 | /*====================================================================================== | 107 | /*====================================================================================== |
107 | * OPrivateIOCTL | 108 | * OPrivateIOCTL |
108 | *======================================================================================*/ | 109 | *======================================================================================*/ |
109 | 110 | ||
110 | OPrivateIOCTL::OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ) | 111 | OPrivateIOCTL::OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ) |
111 | :QObject( parent, name ), _ioctl( cmd ), _getargs( getargs ), _setargs( setargs ) | 112 | :QObject( parent, name ), _ioctl( cmd ), _getargs( getargs ), _setargs( setargs ) |
112 | { | 113 | { |
113 | } | 114 | } |
114 | 115 | ||
115 | 116 | ||
116 | OPrivateIOCTL::~OPrivateIOCTL() | 117 | OPrivateIOCTL::~OPrivateIOCTL() |
117 | { | 118 | { |
118 | } | 119 | } |
119 | 120 | ||
120 | 121 | ||
121 | inline int OPrivateIOCTL::numberGetArgs() const | 122 | #ifdef QT_NO_DEBUG |
123 | inline | ||
124 | #endif | ||
125 | int OPrivateIOCTL::numberGetArgs() const | ||
122 | { | 126 | { |
123 | return _getargs & IW_PRIV_SIZE_MASK; | 127 | return _getargs & IW_PRIV_SIZE_MASK; |
124 | } | 128 | } |
125 | 129 | ||
126 | 130 | ||
127 | inline int OPrivateIOCTL::typeGetArgs() const | 131 | #ifdef QT_NO_DEBUG |
132 | inline | ||
133 | #endif | ||
134 | int OPrivateIOCTL::typeGetArgs() const | ||
128 | { | 135 | { |
129 | return _getargs & IW_PRIV_TYPE_MASK >> 12; | 136 | return _getargs & IW_PRIV_TYPE_MASK >> 12; |
130 | } | 137 | } |
131 | 138 | ||
132 | 139 | ||
133 | inline int OPrivateIOCTL::numberSetArgs() const | 140 | #ifdef QT_NO_DEBUG |
141 | inline | ||
142 | #endif | ||
143 | int OPrivateIOCTL::numberSetArgs() const | ||
134 | { | 144 | { |
135 | return _setargs & IW_PRIV_SIZE_MASK; | 145 | return _setargs & IW_PRIV_SIZE_MASK; |
136 | } | 146 | } |
137 | 147 | ||
138 | 148 | ||
139 | inline int OPrivateIOCTL::typeSetArgs() const | 149 | #ifdef QT_NO_DEBUG |
150 | inline | ||
151 | #endif | ||
152 | int OPrivateIOCTL::typeSetArgs() const | ||
140 | { | 153 | { |
141 | return _setargs & IW_PRIV_TYPE_MASK >> 12; | 154 | return _setargs & IW_PRIV_TYPE_MASK >> 12; |
142 | } | 155 | } |
143 | 156 | ||
144 | 157 | ||
158 | void OPrivateIOCTL::invoke() const | ||
159 | { | ||
160 | ( (OWirelessNetworkInterface*) parent() )->wioctl( _ioctl ); | ||
161 | } | ||
162 | |||
163 | |||
164 | void OPrivateIOCTL::setParameter( int num, u_int32_t value ) | ||
165 | { | ||
166 | u_int32_t* arglist = (u_int32_t*) &( (OWirelessNetworkInterface*) parent() )->_iwr.u.name; | ||
167 | arglist[num] = value; | ||
168 | } | ||
169 | |||
145 | /*====================================================================================== | 170 | /*====================================================================================== |
146 | * assorted functions | 171 | * assorted functions |
147 | *======================================================================================*/ | 172 | *======================================================================================*/ |
148 | 173 | ||
149 | void dumpBytes( const unsigned char* data, int num ) | 174 | void dumpBytes( const unsigned char* data, int num ) |
150 | { | 175 | { |
151 | printf( "Dumping %d bytes @ %0x", num, data ); | 176 | printf( "Dumping %d bytes @ %0x", num, data ); |
152 | printf( "-------------------------------------------\n" ); | 177 | printf( "-------------------------------------------\n" ); |
153 | 178 | ||
154 | for ( int i = 0; i < num; ++i ) | 179 | for ( int i = 0; i < num; ++i ) |
155 | { | 180 | { |
156 | printf( "%02x ", data[i] ); | 181 | printf( "%02x ", data[i] ); |
157 | if ( !((i+1) % 32) ) printf( "\n" ); | 182 | if ( !((i+1) % 32) ) printf( "\n" ); |
158 | } | 183 | } |
159 | printf( "\n\n" ); | 184 | printf( "\n\n" ); |
160 | } | 185 | } |
diff --git a/libopie2/opienet/onetutils.h b/libopie2/opienet/onetutils.h index 6640515..8be042b 100644 --- a/libopie2/opienet/onetutils.h +++ b/libopie2/opienet/onetutils.h | |||
@@ -77,52 +77,56 @@ bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); | |||
77 | 77 | ||
78 | class OHostAddress : public QHostAddress | 78 | class OHostAddress : public QHostAddress |
79 | { | 79 | { |
80 | public: | 80 | public: |
81 | OHostAddress(); | 81 | OHostAddress(); |
82 | ~OHostAddress(); | 82 | ~OHostAddress(); |
83 | }; | 83 | }; |
84 | 84 | ||
85 | 85 | ||
86 | /*====================================================================================== | 86 | /*====================================================================================== |
87 | * OPrivateIOCTL | 87 | * OPrivateIOCTL |
88 | *======================================================================================*/ | 88 | *======================================================================================*/ |
89 | 89 | ||
90 | class OPrivateIOCTL : public QObject | 90 | class OPrivateIOCTL : public QObject |
91 | { | 91 | { |
92 | public: | 92 | public: |
93 | OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ); | 93 | OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ); |
94 | ~OPrivateIOCTL(); | 94 | ~OPrivateIOCTL(); |
95 | 95 | ||
96 | int numberGetArgs() const; | 96 | int numberGetArgs() const; |
97 | int typeGetArgs() const; | 97 | int typeGetArgs() const; |
98 | int numberSetArgs() const; | 98 | int numberSetArgs() const; |
99 | int typeSetArgs() const; | 99 | int typeSetArgs() const; |
100 | 100 | ||
101 | void invoke() const; | ||
102 | void setParameter( int, u_int32_t ); | ||
103 | |||
101 | private: | 104 | private: |
102 | u_int32_t _ioctl; | 105 | u_int32_t _ioctl; |
103 | u_int16_t _getargs; | 106 | u_int16_t _getargs; |
104 | u_int16_t _setargs; | 107 | u_int16_t _setargs; |
108 | |||
105 | }; | 109 | }; |
106 | 110 | ||
107 | /*====================================================================================== | 111 | /*====================================================================================== |
108 | * Miscellaneous | 112 | * Miscellaneous |
109 | *======================================================================================*/ | 113 | *======================================================================================*/ |
110 | 114 | ||
111 | /* dump bytes */ | 115 | /* dump bytes */ |
112 | 116 | ||
113 | void dumpBytes( const unsigned char* data, int num ); | 117 | void dumpBytes( const unsigned char* data, int num ); |
114 | 118 | ||
115 | /* Network to host order macros */ | 119 | /* Network to host order macros */ |
116 | 120 | ||
117 | #ifdef LBL_ALIGN | 121 | #ifdef LBL_ALIGN |
118 | #define EXTRACT_16BITS(p) \ | 122 | #define EXTRACT_16BITS(p) \ |
119 | ((u_int16_t)((u_int16_t)*((const u_int8_t *)(p) + 0) << 8 | \ | 123 | ((u_int16_t)((u_int16_t)*((const u_int8_t *)(p) + 0) << 8 | \ |
120 | (u_int16_t)*((const u_int8_t *)(p) + 1))) | 124 | (u_int16_t)*((const u_int8_t *)(p) + 1))) |
121 | #define EXTRACT_32BITS(p) \ | 125 | #define EXTRACT_32BITS(p) \ |
122 | ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 0) << 24 | \ | 126 | ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 0) << 24 | \ |
123 | (u_int32_t)*((const u_int8_t *)(p) + 1) << 16 | \ | 127 | (u_int32_t)*((const u_int8_t *)(p) + 1) << 16 | \ |
124 | (u_int32_t)*((const u_int8_t *)(p) + 2) << 8 | \ | 128 | (u_int32_t)*((const u_int8_t *)(p) + 2) << 8 | \ |
125 | (u_int32_t)*((const u_int8_t *)(p) + 3))) | 129 | (u_int32_t)*((const u_int8_t *)(p) + 3))) |
126 | #else | 130 | #else |
127 | #define EXTRACT_16BITS(p) \ | 131 | #define EXTRACT_16BITS(p) \ |
128 | ((u_int16_t)ntohs(*(const u_int16_t *)(p))) | 132 | ((u_int16_t)ntohs(*(const u_int16_t *)(p))) |
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index 2548a04..66fa215 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp | |||
@@ -31,48 +31,49 @@ | |||
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | /* OPIE */ | 34 | /* OPIE */ |
35 | 35 | ||
36 | #include <opie2/onetwork.h> | 36 | #include <opie2/onetwork.h> |
37 | 37 | ||
38 | /* QT */ | 38 | /* QT */ |
39 | 39 | ||
40 | #include <qfile.h> | 40 | #include <qfile.h> |
41 | #include <qtextstream.h> | 41 | #include <qtextstream.h> |
42 | 42 | ||
43 | /* UNIX */ | 43 | /* UNIX */ |
44 | 44 | ||
45 | #include <arpa/inet.h> | 45 | #include <arpa/inet.h> |
46 | #include <cerrno> | 46 | #include <cerrno> |
47 | #include <cstring> | 47 | #include <cstring> |
48 | #include <cstdlib> | 48 | #include <cstdlib> |
49 | #include <math.h> | 49 | #include <math.h> |
50 | #include <sys/ioctl.h> | 50 | #include <sys/ioctl.h> |
51 | #include <sys/socket.h> | 51 | #include <sys/socket.h> |
52 | #include <sys/types.h> | 52 | #include <sys/types.h> |
53 | #include <unistd.h> | 53 | #include <unistd.h> |
54 | #include <linux/sockios.h> | 54 | #include <linux/sockios.h> |
55 | #include <stdarg.h> | ||
55 | 56 | ||
56 | using namespace std; | 57 | using namespace std; |
57 | 58 | ||
58 | /*====================================================================================== | 59 | /*====================================================================================== |
59 | * ONetwork | 60 | * ONetwork |
60 | *======================================================================================*/ | 61 | *======================================================================================*/ |
61 | 62 | ||
62 | ONetwork* ONetwork::_instance = 0; | 63 | ONetwork* ONetwork::_instance = 0; |
63 | 64 | ||
64 | ONetwork::ONetwork() | 65 | ONetwork::ONetwork() |
65 | { | 66 | { |
66 | qDebug( "ONetwork::ONetwork()" ); | 67 | qDebug( "ONetwork::ONetwork()" ); |
67 | synchronize(); | 68 | synchronize(); |
68 | } | 69 | } |
69 | 70 | ||
70 | void ONetwork::synchronize() | 71 | void ONetwork::synchronize() |
71 | { | 72 | { |
72 | // gather available interfaces by inspecting /proc/net/dev | 73 | // gather available interfaces by inspecting /proc/net/dev |
73 | // we could use SIOCGIFCONF here, but we aren't interested in virtual (e.g. eth0:0) devices | 74 | // we could use SIOCGIFCONF here, but we aren't interested in virtual (e.g. eth0:0) devices |
74 | 75 | ||
75 | _interfaces.clear(); | 76 | _interfaces.clear(); |
76 | QString str; | 77 | QString str; |
77 | QFile f( "/proc/net/dev" ); | 78 | QFile f( "/proc/net/dev" ); |
78 | bool hasFile = f.open( IO_ReadOnly ); | 79 | bool hasFile = f.open( IO_ReadOnly ); |
@@ -561,48 +562,80 @@ void OWirelessNetworkInterface::setMonitorMode( bool b ) | |||
561 | 562 | ||
562 | bool OWirelessNetworkInterface::monitorMode() const | 563 | bool OWirelessNetworkInterface::monitorMode() const |
563 | { | 564 | { |
564 | return _mon ? _mon->enabled() : false; | 565 | return _mon ? _mon->enabled() : false; |
565 | } | 566 | } |
566 | 567 | ||
567 | 568 | ||
568 | QString OWirelessNetworkInterface::nickName() const | 569 | QString OWirelessNetworkInterface::nickName() const |
569 | { | 570 | { |
570 | char str[IW_ESSID_MAX_SIZE]; | 571 | char str[IW_ESSID_MAX_SIZE]; |
571 | _iwr.u.data.pointer = &str[0]; | 572 | _iwr.u.data.pointer = &str[0]; |
572 | _iwr.u.data.length = IW_ESSID_MAX_SIZE; | 573 | _iwr.u.data.length = IW_ESSID_MAX_SIZE; |
573 | if ( !wioctl( SIOCGIWNICKN ) ) | 574 | if ( !wioctl( SIOCGIWNICKN ) ) |
574 | { | 575 | { |
575 | return "<unknown>"; | 576 | return "<unknown>"; |
576 | } | 577 | } |
577 | else | 578 | else |
578 | { | 579 | { |
579 | str[_iwr.u.data.length] = 0x0; // some drivers (e.g. wlan-ng) don't zero-terminate the string | 580 | str[_iwr.u.data.length] = 0x0; // some drivers (e.g. wlan-ng) don't zero-terminate the string |
580 | return str; | 581 | return str; |
581 | } | 582 | } |
582 | } | 583 | } |
583 | 584 | ||
584 | 585 | ||
586 | void OWirelessNetworkInterface::setPrivate( const QString& call, int numargs, ... ) | ||
587 | { | ||
588 | OPrivateIOCTL* priv = static_cast<OPrivateIOCTL*>( child( (const char*) call ) ); | ||
589 | if ( !priv ) | ||
590 | { | ||
591 | qDebug( "OWirelessNetworkInterface::setPrivate(): interface '%s' does not support private ioctl '%s'", name(), (const char*) call ); | ||
592 | return; | ||
593 | } | ||
594 | if ( priv->numberSetArgs() != numargs ) | ||
595 | { | ||
596 | qDebug( "OWirelessNetworkInterface::setPrivate(): parameter count not matching. '%s' expects %d arguments, but got %d", (const char*) call, priv->numberSetArgs(), numargs ); | ||
597 | return; | ||
598 | } | ||
599 | |||
600 | qDebug( "OWirelessNetworkInterface::setPrivate(): about to call '%s' on interface '%s'", (const char*) call, name() ); | ||
601 | memset( &_iwr, 0, sizeof _iwr ); | ||
602 | va_list argp; | ||
603 | va_start( argp, numargs ); | ||
604 | for ( int i = 0; i < numargs; ++i ) | ||
605 | { | ||
606 | priv->setParameter( i, va_arg( argp, int ) ); | ||
607 | } | ||
608 | va_end( argp ); | ||
609 | priv->invoke(); | ||
610 | } | ||
611 | |||
612 | |||
613 | void OWirelessNetworkInterface::getPrivate( const QString& call ) | ||
614 | { | ||
615 | } | ||
616 | |||
617 | |||
585 | QString OWirelessNetworkInterface::SSID() const | 618 | QString OWirelessNetworkInterface::SSID() const |
586 | { | 619 | { |
587 | char str[IW_ESSID_MAX_SIZE]; | 620 | char str[IW_ESSID_MAX_SIZE]; |
588 | _iwr.u.essid.pointer = &str[0]; | 621 | _iwr.u.essid.pointer = &str[0]; |
589 | _iwr.u.essid.length = IW_ESSID_MAX_SIZE; | 622 | _iwr.u.essid.length = IW_ESSID_MAX_SIZE; |
590 | if ( !wioctl( SIOCGIWESSID ) ) | 623 | if ( !wioctl( SIOCGIWESSID ) ) |
591 | { | 624 | { |
592 | return "<unknown>"; | 625 | return "<unknown>"; |
593 | } | 626 | } |
594 | else | 627 | else |
595 | { | 628 | { |
596 | return str; | 629 | return str; |
597 | } | 630 | } |
598 | } | 631 | } |
599 | 632 | ||
600 | 633 | ||
601 | void OWirelessNetworkInterface::setSSID( const QString& ssid ) | 634 | void OWirelessNetworkInterface::setSSID( const QString& ssid ) |
602 | { | 635 | { |
603 | _iwr.u.essid.pointer = const_cast<char*>( (const char*) ssid ); | 636 | _iwr.u.essid.pointer = const_cast<char*>( (const char*) ssid ); |
604 | _iwr.u.essid.length = ssid.length(); | 637 | _iwr.u.essid.length = ssid.length(); |
605 | wioctl( SIOCSIWESSID ); | 638 | wioctl( SIOCSIWESSID ); |
606 | } | 639 | } |
607 | 640 | ||
608 | 641 | ||
diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h index acf2f69..7c70873 100644 --- a/libopie2/opienet/onetwork.h +++ b/libopie2/opienet/onetwork.h | |||
@@ -162,72 +162,77 @@ class OChannelHopper : public QObject | |||
162 | int interval() const; | 162 | int interval() const; |
163 | 163 | ||
164 | private: | 164 | private: |
165 | OWirelessNetworkInterface* _iface; | 165 | OWirelessNetworkInterface* _iface; |
166 | int _interval; | 166 | int _interval; |
167 | int _tid; | 167 | int _tid; |
168 | QValueList<int> _channels; | 168 | QValueList<int> _channels; |
169 | QValueList<int>::Iterator _channel; | 169 | QValueList<int>::Iterator _channel; |
170 | 170 | ||
171 | }; | 171 | }; |
172 | 172 | ||
173 | 173 | ||
174 | /*====================================================================================== | 174 | /*====================================================================================== |
175 | * OWirelessNetworkInterface | 175 | * OWirelessNetworkInterface |
176 | *======================================================================================*/ | 176 | *======================================================================================*/ |
177 | 177 | ||
178 | class OWirelessNetworkInterface : public ONetworkInterface | 178 | class OWirelessNetworkInterface : public ONetworkInterface |
179 | { | 179 | { |
180 | friend class OMonitoringInterface; | 180 | friend class OMonitoringInterface; |
181 | friend class OCiscoMonitoringInterface; | 181 | friend class OCiscoMonitoringInterface; |
182 | friend class OWlanNGMonitoringInterface; | 182 | friend class OWlanNGMonitoringInterface; |
183 | friend class OHostAPMonitoringInterface; | 183 | friend class OHostAPMonitoringInterface; |
184 | friend class OOrinocoMonitoringInterface; | 184 | friend class OOrinocoMonitoringInterface; |
185 | 185 | ||
186 | friend class OPrivateIOCTL; | ||
187 | |||
186 | public: | 188 | public: |
187 | enum Mode { AdHoc, Managed, Monitor }; | 189 | enum Mode { AdHoc, Managed, Monitor }; |
188 | 190 | ||
189 | OWirelessNetworkInterface( QObject* parent, const char* name ); | 191 | OWirelessNetworkInterface( QObject* parent, const char* name ); |
190 | virtual ~OWirelessNetworkInterface(); | 192 | virtual ~OWirelessNetworkInterface(); |
191 | 193 | ||
192 | virtual void setChannel( int ) const; | 194 | virtual void setChannel( int ) const; |
193 | virtual int channel() const; | 195 | virtual int channel() const; |
194 | virtual double frequency() const; | 196 | virtual double frequency() const; |
195 | virtual int channels() const; | 197 | virtual int channels() const; |
196 | //virtual double frequency(int) const; | 198 | //virtual double frequency(int) const; |
197 | 199 | ||
198 | virtual void setMode( Mode ) {}; | 200 | virtual void setMode( Mode ) {}; |
199 | virtual bool mode() const {}; | 201 | virtual bool mode() const {}; |
200 | 202 | ||
201 | virtual void setMonitorMode( bool ); | 203 | virtual void setMonitorMode( bool ); |
202 | virtual bool monitorMode() const; | 204 | virtual bool monitorMode() const; |
203 | 205 | ||
204 | virtual void setChannelHopping( int interval = 0 ); | 206 | virtual void setChannelHopping( int interval = 0 ); |
205 | virtual int channelHopping() const; | 207 | virtual int channelHopping() const; |
206 | 208 | ||
207 | virtual void setNickName( const QString& ) {}; | 209 | virtual void setNickName( const QString& ) {}; |
208 | virtual QString nickName() const; | 210 | virtual QString nickName() const; |
209 | 211 | ||
212 | virtual void setPrivate( const QString&, int, ... ); | ||
213 | virtual void getPrivate( const QString& ); | ||
214 | |||
210 | virtual bool isAssociated() const {}; | 215 | virtual bool isAssociated() const {}; |
211 | virtual QString associatedAP() const; | 216 | virtual QString associatedAP() const; |
212 | 217 | ||
213 | virtual void setSSID( const QString& ); | 218 | virtual void setSSID( const QString& ); |
214 | virtual QString SSID() const; | 219 | virtual QString SSID() const; |
215 | 220 | ||
216 | protected: | 221 | protected: |
217 | void buildChannelList(); | 222 | void buildChannelList(); |
218 | void buildPrivateList(); | 223 | void buildPrivateList(); |
219 | virtual void init(); | 224 | virtual void init(); |
220 | iwreqstruct& iwr() const; | 225 | iwreqstruct& iwr() const; |
221 | bool wioctl( int call ) const; | 226 | bool wioctl( int call ) const; |
222 | bool wioctl( int call, iwreqstruct& ) const; | 227 | bool wioctl( int call, iwreqstruct& ) const; |
223 | 228 | ||
224 | protected: | 229 | protected: |
225 | mutable iwreqstruct _iwr; | 230 | mutable iwreqstruct _iwr; |
226 | QMap<int,int> _channels; | 231 | QMap<int,int> _channels; |
227 | 232 | ||
228 | private: | 233 | private: |
229 | OChannelHopper* _hopper; | 234 | OChannelHopper* _hopper; |
230 | }; | 235 | }; |
231 | 236 | ||
232 | 237 | ||
233 | /*====================================================================================== | 238 | /*====================================================================================== |