-rw-r--r-- | noncore/net/wellenreiter/gui/configbase.ui | 30 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.cpp | 26 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.h | 9 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/manufacturers.h | 3 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 97 |
5 files changed, 95 insertions, 70 deletions
diff --git a/noncore/net/wellenreiter/gui/configbase.ui b/noncore/net/wellenreiter/gui/configbase.ui index 8dcf513..7992e6b 100644 --- a/noncore/net/wellenreiter/gui/configbase.ui +++ b/noncore/net/wellenreiter/gui/configbase.ui | |||
@@ -1,30 +1,30 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>WellenreiterConfigBase</class> | 2 | <class>WellenreiterConfigBase</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>WellenreiterConfigBase</cstring> | 7 | <cstring>WellenreiterConfigBase</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>228</width> | 14 | <width>224</width> |
15 | <height>267</height> | 15 | <height>267</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Form1</string> | 20 | <string>Form1</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <vbox> | 28 | <vbox> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
@@ -140,82 +140,102 @@ | |||
140 | </property> | 140 | </property> |
141 | </item> | 141 | </item> |
142 | <item> | 142 | <item> |
143 | <property> | 143 | <property> |
144 | <name>text</name> | 144 | <name>text</name> |
145 | <string>wifi1</string> | 145 | <string>wifi1</string> |
146 | </property> | 146 | </property> |
147 | </item> | 147 | </item> |
148 | <property stdset="1"> | 148 | <property stdset="1"> |
149 | <name>name</name> | 149 | <name>name</name> |
150 | <cstring>interfaceName</cstring> | 150 | <cstring>interfaceName</cstring> |
151 | </property> | 151 | </property> |
152 | <property stdset="1"> | 152 | <property stdset="1"> |
153 | <name>enabled</name> | 153 | <name>enabled</name> |
154 | <bool>true</bool> | 154 | <bool>true</bool> |
155 | </property> | 155 | </property> |
156 | <property> | ||
157 | <name>whatsThis</name> | ||
158 | <string>Choose the interface used for sniffing.</string> | ||
159 | </property> | ||
156 | </widget> | 160 | </widget> |
157 | <widget row="4" column="0" rowspan="1" colspan="2" > | 161 | <widget row="4" column="0" rowspan="1" colspan="2" > |
158 | <class>QCheckBox</class> | 162 | <class>QCheckBox</class> |
159 | <property stdset="1"> | 163 | <property stdset="1"> |
160 | <name>name</name> | 164 | <name>name</name> |
161 | <cstring>activeScanning</cstring> | 165 | <cstring>activeScanning</cstring> |
162 | </property> | 166 | </property> |
163 | <property stdset="1"> | 167 | <property stdset="1"> |
164 | <name>enabled</name> | 168 | <name>enabled</name> |
165 | <bool>false</bool> | 169 | <bool>false</bool> |
166 | </property> | 170 | </property> |
167 | <property stdset="1"> | 171 | <property stdset="1"> |
168 | <name>text</name> | 172 | <name>text</name> |
169 | <string>Active Scanning (caution!)</string> | 173 | <string>Active Scanning (caution!)</string> |
170 | </property> | 174 | </property> |
171 | </widget> | 175 | </widget> |
172 | <widget row="1" column="0" > | 176 | <widget row="1" column="0" > |
173 | <class>QComboBox</class> | 177 | <class>QComboBox</class> |
174 | <item> | 178 | <item> |
175 | <property> | 179 | <property> |
176 | <name>text</name> | 180 | <name>text</name> |
177 | <string><select></string> | 181 | <string><select></string> |
178 | </property> | 182 | </property> |
179 | </item> | 183 | </item> |
180 | <item> | 184 | <item> |
181 | <property> | 185 | <property> |
182 | <name>text</name> | 186 | <name>text</name> |
183 | <string>orinoco</string> | 187 | <string>cisco</string> |
188 | </property> | ||
189 | </item> | ||
190 | <item> | ||
191 | <property> | ||
192 | <name>text</name> | ||
193 | <string>wlan-ng</string> | ||
184 | </property> | 194 | </property> |
185 | </item> | 195 | </item> |
186 | <item> | 196 | <item> |
187 | <property> | 197 | <property> |
188 | <name>text</name> | 198 | <name>text</name> |
189 | <string>prism</string> | 199 | <string>hostap</string> |
200 | </property> | ||
201 | </item> | ||
202 | <item> | ||
203 | <property> | ||
204 | <name>text</name> | ||
205 | <string>orinoco</string> | ||
190 | </property> | 206 | </property> |
191 | </item> | 207 | </item> |
192 | <item> | 208 | <item> |
193 | <property> | 209 | <property> |
194 | <name>text</name> | 210 | <name>text</name> |
195 | <string><manual></string> | 211 | <string><manual></string> |
196 | </property> | 212 | </property> |
197 | </item> | 213 | </item> |
198 | <property stdset="1"> | 214 | <property stdset="1"> |
199 | <name>name</name> | 215 | <name>name</name> |
200 | <cstring>deviceType</cstring> | 216 | <cstring>deviceType</cstring> |
201 | </property> | 217 | </property> |
202 | <property stdset="1"> | 218 | <property stdset="1"> |
203 | <name>enabled</name> | 219 | <name>enabled</name> |
204 | <bool>true</bool> | 220 | <bool>true</bool> |
205 | </property> | 221 | </property> |
222 | <property> | ||
223 | <name>whatsThis</name> | ||
224 | <string>Choose the type of driver used for sniffing.</string> | ||
225 | </property> | ||
206 | </widget> | 226 | </widget> |
207 | <widget row="3" column="0" rowspan="1" colspan="2" > | 227 | <widget row="3" column="0" rowspan="1" colspan="2" > |
208 | <class>QCheckBox</class> | 228 | <class>QCheckBox</class> |
209 | <property stdset="1"> | 229 | <property stdset="1"> |
210 | <name>name</name> | 230 | <name>name</name> |
211 | <cstring>additionalInfo</cstring> | 231 | <cstring>additionalInfo</cstring> |
212 | </property> | 232 | </property> |
213 | <property stdset="1"> | 233 | <property stdset="1"> |
214 | <name>enabled</name> | 234 | <name>enabled</name> |
215 | <bool>false</bool> | 235 | <bool>false</bool> |
216 | </property> | 236 | </property> |
217 | <property stdset="1"> | 237 | <property stdset="1"> |
218 | <name>text</name> | 238 | <name>text</name> |
219 | <string>Gather Additional Info</string> | 239 | <string>Gather Additional Info</string> |
220 | </property> | 240 | </property> |
221 | </widget> | 241 | </widget> |
@@ -232,32 +252,36 @@ | |||
232 | <property stdset="1"> | 252 | <property stdset="1"> |
233 | <name>suffix</name> | 253 | <name>suffix</name> |
234 | <string> ms</string> | 254 | <string> ms</string> |
235 | </property> | 255 | </property> |
236 | <property stdset="1"> | 256 | <property stdset="1"> |
237 | <name>maxValue</name> | 257 | <name>maxValue</name> |
238 | <number>2000</number> | 258 | <number>2000</number> |
239 | </property> | 259 | </property> |
240 | <property stdset="1"> | 260 | <property stdset="1"> |
241 | <name>minValue</name> | 261 | <name>minValue</name> |
242 | <number>100</number> | 262 | <number>100</number> |
243 | </property> | 263 | </property> |
244 | <property stdset="1"> | 264 | <property stdset="1"> |
245 | <name>lineStep</name> | 265 | <name>lineStep</name> |
246 | <number>100</number> | 266 | <number>100</number> |
247 | </property> | 267 | </property> |
268 | <property> | ||
269 | <name>whatsThis</name> | ||
270 | <string>Choose the channel hop interval.</string> | ||
271 | </property> | ||
248 | </widget> | 272 | </widget> |
249 | <widget row="2" column="1" > | 273 | <widget row="2" column="1" > |
250 | <class>QLabel</class> | 274 | <class>QLabel</class> |
251 | <property stdset="1"> | 275 | <property stdset="1"> |
252 | <name>name</name> | 276 | <name>name</name> |
253 | <cstring>TextLabel3_3</cstring> | 277 | <cstring>TextLabel3_3</cstring> |
254 | </property> | 278 | </property> |
255 | <property stdset="1"> | 279 | <property stdset="1"> |
256 | <name>enabled</name> | 280 | <name>enabled</name> |
257 | <bool>true</bool> | 281 | <bool>true</bool> |
258 | </property> | 282 | </property> |
259 | <property stdset="1"> | 283 | <property stdset="1"> |
260 | <name>text</name> | 284 | <name>text</name> |
261 | <string>Hop Interval</string> | 285 | <string>Hop Interval</string> |
262 | </property> | 286 | </property> |
263 | </widget> | 287 | </widget> |
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp index 04e3457..515d9b2 100644 --- a/noncore/net/wellenreiter/gui/configwindow.cpp +++ b/noncore/net/wellenreiter/gui/configwindow.cpp | |||
@@ -1,23 +1,47 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "configwindow.h" | 16 | #include "configwindow.h" |
17 | #include <qmap.h> | ||
18 | #include <qcombobox.h> | ||
19 | #include <qspinbox.h> | ||
17 | 20 | ||
18 | WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) | 21 | WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) |
19 | :WellenreiterConfigBase( parent, name, f ) | 22 | :WellenreiterConfigBase( parent, name, f ) |
20 | { | 23 | { |
21 | 24 | _devicetype[ "cisco" ] = 1; | |
25 | _devicetype[ "wlan-ng" ] = 2; | ||
26 | _devicetype[ "hostap" ] = 3; | ||
27 | _devicetype[ "orinoco" ] = 4; | ||
28 | _devicetype[ "<manual>" ] = 5; | ||
22 | }; | 29 | }; |
23 | 30 | ||
31 | int WellenreiterConfigWindow::daemonDeviceType() | ||
32 | { | ||
33 | QString name = deviceType->currentText(); | ||
34 | if ( _devicetype.contains( name ) ) | ||
35 | { | ||
36 | return _devicetype[name]; | ||
37 | } | ||
38 | else | ||
39 | { | ||
40 | return 0; | ||
41 | } | ||
42 | }; | ||
43 | |||
44 | int WellenreiterConfigWindow::daemonHopInterval() | ||
45 | { | ||
46 | return hopInterval->cleanText().toInt(); | ||
47 | } | ||
diff --git a/noncore/net/wellenreiter/gui/configwindow.h b/noncore/net/wellenreiter/gui/configwindow.h index c2db283..c627901 100644 --- a/noncore/net/wellenreiter/gui/configwindow.h +++ b/noncore/net/wellenreiter/gui/configwindow.h | |||
@@ -4,28 +4,33 @@ | |||
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #ifndef WELLENREITERCONFIGWINDOW_H | 16 | #ifndef WELLENREITERCONFIGWINDOW_H |
17 | #define WELLENREITERCONFIGWINDOW_H | 17 | #define WELLENREITERCONFIGWINDOW_H |
18 | 18 | ||
19 | #include "configbase.h" | 19 | #include "configbase.h" |
20 | #include <qmap.h> | ||
20 | 21 | ||
21 | class WellenreiterConfigWindow : public WellenreiterConfigBase | 22 | class WellenreiterConfigWindow : public WellenreiterConfigBase |
22 | { | 23 | { |
23 | 24 | ||
24 | public: | 25 | public: |
25 | WellenreiterConfigWindow( QWidget * parent = 0, const char * name = "WellenreiterConfigWindow", WFlags f = 0 ); | 26 | WellenreiterConfigWindow( QWidget * parent = 0, const char * name = "WellenreiterConfigWindow", WFlags f = 0 ); |
26 | 27 | int daemonDeviceType(); | |
27 | 28 | int daemonHopInterval(); | |
29 | |||
30 | protected: | ||
31 | QMap<QString, int> _devicetype; | ||
32 | |||
28 | }; | 33 | }; |
29 | 34 | ||
30 | #endif | 35 | #endif |
31 | 36 | ||
diff --git a/noncore/net/wellenreiter/gui/manufacturers.h b/noncore/net/wellenreiter/gui/manufacturers.h index 67afe21..75728b1 100644 --- a/noncore/net/wellenreiter/gui/manufacturers.h +++ b/noncore/net/wellenreiter/gui/manufacturers.h | |||
@@ -4,34 +4,33 @@ | |||
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #ifndef MANUFACTURERS_H | 16 | #ifndef MANUFACTURERS_H |
17 | #define MANUFACTURERS_H | 17 | #define MANUFACTURERS_H |
18 | 18 | ||
19 | #include <qmap.h> | 19 | #include <qmap.h> |
20 | #include <string.h> | ||
21 | 20 | ||
22 | class ManufacturerDB | 21 | class ManufacturerDB |
23 | { | 22 | { |
24 | public: | 23 | public: |
25 | 24 | ||
26 | ManufacturerDB( const QString& filename ); | 25 | ManufacturerDB( const QString& filename ); |
27 | virtual ~ManufacturerDB(); | 26 | virtual ~ManufacturerDB(); |
28 | const QString& lookup( const QString& macaddr ) const; | 27 | const QString& lookup( const QString& macaddr ) const; |
29 | 28 | ||
30 | private: | 29 | private: |
31 | 30 | ||
32 | QMap<QString, QString> manufacturers; | 31 | QMap<QString, QString> manufacturers; |
33 | 32 | ||
34 | }; | 33 | }; |
35 | 34 | ||
36 | #endif | 35 | #endif |
37 | 36 | ||
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 4ee9a35..4c1c972 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -55,79 +55,79 @@ using namespace Opie; | |||
55 | #include "configwindow.h" | 55 | #include "configwindow.h" |
56 | 56 | ||
57 | #include "manufacturers.h" | 57 | #include "manufacturers.h" |
58 | 58 | ||
59 | #include <daemon/source/config.hh> | 59 | #include <daemon/source/config.hh> |
60 | #include <libwellenreiter/source/wl_types.hh> | 60 | #include <libwellenreiter/source/wl_types.hh> |
61 | #include <libwellenreiter/source/wl_sock.hh> | 61 | #include <libwellenreiter/source/wl_sock.hh> |
62 | #include <libwellenreiter/source/wl_proto.hh> | 62 | #include <libwellenreiter/source/wl_proto.hh> |
63 | 63 | ||
64 | Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) | 64 | Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) |
65 | : WellenreiterBase( parent, name, fl ), daemonRunning( false ), manufacturerdb( 0 ) | 65 | : WellenreiterBase( parent, name, fl ), daemonRunning( false ), manufacturerdb( 0 ) |
66 | { | 66 | { |
67 | 67 | ||
68 | // | 68 | // |
69 | // construct manufacturer database | 69 | // construct manufacturer database |
70 | // | 70 | // |
71 | 71 | ||
72 | QString manufile; | 72 | QString manufile; |
73 | #ifdef QWS | 73 | #ifdef QWS |
74 | manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) QPEApplication::qpeDir() ); | 74 | manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) QPEApplication::qpeDir() ); |
75 | #else | 75 | #else |
76 | manufile.sprintf( "/home/mickey/work/opie/share/wellenreiter/manufacturers.dat" ); | 76 | manufile.sprintf( "/home/mickey/work/opie/share/wellenreiter/manufacturers.dat" ); |
77 | #endif | 77 | #endif |
78 | manufacturerdb = new ManufacturerDB( manufile ); | 78 | manufacturerdb = new ManufacturerDB( manufile ); |
79 | 79 | ||
80 | logwindow->log( "(i) Wellenreiter has been started." ); | 80 | logwindow->log( "(i) Wellenreiter has been started." ); |
81 | 81 | ||
82 | // | 82 | // |
83 | // detect operating system | 83 | // detect operating system |
84 | // | 84 | // |
85 | 85 | ||
86 | #ifdef QWS | 86 | #ifdef QWS |
87 | QString sys; | 87 | QString sys; |
88 | sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); | 88 | sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); |
89 | _system = ODevice::inst()->system(); | 89 | _system = ODevice::inst()->system(); |
90 | logwindow->log( sys ); | 90 | logwindow->log( sys ); |
91 | #endif | 91 | #endif |
92 | 92 | ||
93 | // | 93 | // |
94 | // setup socket for daemon communication, register socket notifier | 94 | // setup socket for daemon communication, register socket notifier |
95 | // | 95 | // |
96 | 96 | ||
97 | // struct sockaddr_in sockaddr; | 97 | // struct sockaddr_in sockaddr; |
98 | daemon_fd = wl_setupsock( GUIADDR, GUIPORT, sockaddr ); | 98 | daemon_fd = wl_setupsock( GUIADDR, GUIPORT, sockaddr ); |
99 | if ( daemon_fd == -1 ) | 99 | if ( daemon_fd == -1 ) |
100 | { | 100 | { |
101 | logwindow->log( "(E) Couldn't get file descriptor for commsocket." ); | 101 | logwindow->log( "(E) Couldn't get file descriptor for commsocket." ); |
102 | } | 102 | } |
103 | else | 103 | else |
104 | { | 104 | { |
105 | int flags; | 105 | int flags; |
106 | flags = fcntl( daemon_fd, F_GETFL, 0 ); | 106 | flags = fcntl( daemon_fd, F_GETFL, 0 ); |
107 | fcntl( daemon_fd, F_SETFL, flags | O_NONBLOCK ); | 107 | fcntl( daemon_fd, F_SETFL, flags | O_NONBLOCK ); |
108 | QSocketNotifier *sn = new QSocketNotifier( daemon_fd, QSocketNotifier::Read, parent ); | 108 | QSocketNotifier *sn = new QSocketNotifier( daemon_fd, QSocketNotifier::Read, parent ); |
109 | connect( sn, SIGNAL( activated( int ) ), this, SLOT( dataReceived() ) ); | 109 | connect( sn, SIGNAL( activated( int ) ), this, SLOT( dataReceived() ) ); |
110 | } | 110 | } |
111 | 111 | ||
112 | // setup GUI | 112 | // setup GUI |
113 | 113 | ||
114 | connect( button, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) ); | 114 | connect( button, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) ); |
115 | // button->setEnabled( false ); | 115 | // button->setEnabled( false ); |
116 | netview->setColumnWidthMode( 1, QListView::Manual ); | 116 | netview->setColumnWidthMode( 1, QListView::Manual ); |
117 | 117 | ||
118 | if ( manufacturerdb ) | 118 | if ( manufacturerdb ) |
119 | netview->setManufacturerDB( manufacturerdb ); | 119 | netview->setManufacturerDB( manufacturerdb ); |
120 | 120 | ||
121 | } | 121 | } |
122 | 122 | ||
123 | Wellenreiter::~Wellenreiter() | 123 | Wellenreiter::~Wellenreiter() |
124 | { | 124 | { |
125 | // no need to delete child widgets, Qt does it all for us | 125 | // no need to delete child widgets, Qt does it all for us |
126 | 126 | ||
127 | delete manufacturerdb; | 127 | delete manufacturerdb; |
128 | } | 128 | } |
129 | 129 | ||
130 | void Wellenreiter::handleMessage() | 130 | void Wellenreiter::handleMessage() |
131 | { | 131 | { |
132 | // FIXME: receive message and handle it | 132 | // FIXME: receive message and handle it |
133 | 133 | ||
@@ -138,41 +138,41 @@ void Wellenreiter::handleMessage() | |||
138 | 138 | ||
139 | char buffer[WL_SOCKBUF]; | 139 | char buffer[WL_SOCKBUF]; |
140 | 140 | ||
141 | // int result = #wl_recv( &daemon_fd, (char*) &buffer, sizeof(buffer) ); | 141 | // int result = #wl_recv( &daemon_fd, (char*) &buffer, sizeof(buffer) ); |
142 | 142 | ||
143 | /* | 143 | /* |
144 | 144 | ||
145 | struct sockaddr from; | 145 | struct sockaddr from; |
146 | socklen_t len; | 146 | socklen_t len; |
147 | 147 | ||
148 | int result = recvfrom( daemon_fd, &buffer, 8192, MSG_WAITALL, &from, &len ); | 148 | int result = recvfrom( daemon_fd, &buffer, 8192, MSG_WAITALL, &from, &len ); |
149 | qDebug( "received %d from recv [%d bytes]", result, len ); | 149 | qDebug( "received %d from recv [%d bytes]", result, len ); |
150 | 150 | ||
151 | */ | 151 | */ |
152 | 152 | ||
153 | int result = wl_recv( &daemon_fd, sockaddr, (char*) &buffer, WL_SOCKBUF ); | 153 | int result = wl_recv( &daemon_fd, sockaddr, (char*) &buffer, WL_SOCKBUF ); |
154 | 154 | ||
155 | if ( result == -1 ) | 155 | if ( result == -1 ) |
156 | { | 156 | { |
157 | qDebug( "Warning: %s", strerror( errno ) ); | 157 | qDebug( "Warning: %s", strerror( errno ) ); |
158 | return; | 158 | return; |
159 | } | 159 | } |
160 | 160 | ||
161 | int command = buffer[1] - 48; | 161 | int command = buffer[1] - 48; |
162 | 162 | ||
163 | /* | 163 | /* |
164 | typedef struct { | 164 | typedef struct { |
165 | int net_type; 1 = Accesspoint ; 2 = Ad-Hoc | 165 | int net_type; 1 = Accesspoint ; 2 = Ad-Hoc |
166 | int ssid_len; Length of SSID | 166 | int ssid_len; Length of SSID |
167 | int channel; Channel | 167 | int channel; Channel |
168 | int wep; 1 = WEP enabled ; 0 = disabled | 168 | int wep; 1 = WEP enabled ; 0 = disabled |
169 | char mac[64]; MAC address of Accesspoint | 169 | char mac[64]; MAC address of Accesspoint |
170 | char bssid[128]; BSSID of Accesspoint | 170 | char bssid[128]; BSSID of Accesspoint |
171 | } wl_network_t; | 171 | } wl_network_t; |
172 | */ | 172 | */ |
173 | 173 | ||
174 | qDebug( "Recv result: %d", ( result ) ); | 174 | qDebug( "Recv result: %d", ( result ) ); |
175 | qDebug( "Sniffer sent: '%s'", (const char*) buffer ); | 175 | qDebug( "Sniffer sent: '%s'", (const char*) buffer ); |
176 | hexwindow->log( (const char*) &buffer ); | 176 | hexwindow->log( (const char*) &buffer ); |
177 | 177 | ||
178 | if ( command == NETFOUND ) /* new network found */ | 178 | if ( command == NETFOUND ) /* new network found */ |
@@ -195,119 +195,92 @@ typedef struct { | |||
195 | 195 | ||
196 | netview->addNewItem( type, n.bssid, QString( (const char*) &n.mac ), n.wep, n.channel, 0 ); | 196 | netview->addNewItem( type, n.bssid, QString( (const char*) &n.mac ), n.wep, n.channel, 0 ); |
197 | 197 | ||
198 | } | 198 | } |
199 | 199 | ||
200 | else | 200 | else |
201 | 201 | ||
202 | { | 202 | { |
203 | qDebug( "unknown sniffer command." ); | 203 | qDebug( "unknown sniffer command." ); |
204 | } | 204 | } |
205 | 205 | ||
206 | } | 206 | } |
207 | 207 | ||
208 | void Wellenreiter::dataReceived() | 208 | void Wellenreiter::dataReceived() |
209 | { | 209 | { |
210 | logwindow->log( "(d) Received data from daemon" ); | 210 | logwindow->log( "(d) Received data from daemon" ); |
211 | handleMessage(); | 211 | handleMessage(); |
212 | } | 212 | } |
213 | 213 | ||
214 | void Wellenreiter::buttonClicked() | 214 | void Wellenreiter::buttonClicked() |
215 | { | 215 | { |
216 | /* | 216 | /* |
217 | // add some test stations, so that we can see if the GUI part works | 217 | // add some test stations, so that we can see if the GUI part works |
218 | addNewItem( "managed", "Vanille", "04:00:20:EF:A6:43", true, 6, 80 ); | 218 | addNewItem( "managed", "Vanille", "04:00:20:EF:A6:43", true, 6, 80 ); |
219 | addNewItem( "managed", "Vanille", "04:00:20:EF:A6:23", true, 11, 10 ); | 219 | addNewItem( "managed", "Vanille", "04:00:20:EF:A6:23", true, 11, 10 ); |
220 | addNewItem( "adhoc", "ELAN", "40:03:43:E7:16:22", false, 3, 10 ); | 220 | addNewItem( "adhoc", "ELAN", "40:03:43:E7:16:22", false, 3, 10 ); |
221 | addNewItem( "adhoc", "ELAN", "40:03:53:E7:56:62", false, 3, 15 ); | 221 | addNewItem( "adhoc", "ELAN", "40:03:53:E7:56:62", false, 3, 15 ); |
222 | addNewItem( "adhoc", "ELAN", "40:03:63:E7:56:E2", false, 3, 20 ); | 222 | addNewItem( "adhoc", "ELAN", "40:03:63:E7:56:E2", false, 3, 20 ); |
223 | */ | 223 | */ |
224 | 224 | ||
225 | 225 | ||
226 | if ( daemonRunning ) | 226 | if ( daemonRunning ) |
227 | { | 227 | { |
228 | daemonRunning = false; | 228 | daemonRunning = false; |
229 | 229 | ||
230 | logwindow->log( "(i) Daemon has been stopped." ); | 230 | logwindow->log( "(i) Daemon has been stopped." ); |
231 | button->setText( "Start Scanning" ); | 231 | button->setText( "Start Scanning" ); |
232 | 232 | ||
233 | // Stop daemon - ugly for now... later better | 233 | // Stop daemon - ugly for now... later better |
234 | 234 | ||
235 | system( "killall orinoco_hopper" ); | ||
236 | system( "killall wellenreiterd" ); | 235 | system( "killall wellenreiterd" ); |
237 | 236 | ||
238 | // get configuration from config window | 237 | // get configuration from config window |
239 | 238 | ||
240 | const QString& interface = configwindow->interfaceName->currentText(); | 239 | const QString& interface = configwindow->interfaceName->currentText(); |
241 | const QString& cardtype = configwindow->deviceType->currentText(); | 240 | const QString& cardtype = configwindow->deviceType->currentText(); |
242 | const QString& interval = configwindow->hopInterval->cleanText(); | 241 | //const QString& interval = configwindow->hopInterval->cleanText(); |
243 | 242 | ||
244 | // reset the card trying to get into a usable state again | 243 | // reset the card trying to get into a usable state again |
245 | 244 | ||
246 | QString cmdline; | 245 | QString cmdline; |
247 | cmdline.sprintf( "iwpriv %s monitor 1", (const char*) interface ); | 246 | cmdline.sprintf( "cardctl eject; cardctl insert" ); |
248 | system( cmdline ); | ||
249 | cmdline.sprintf( "iwpriv %s monitor 1 6", (const char*) interface ); | ||
250 | system( cmdline ); | ||
251 | cmdline.sprintf( "ifconfig %s -promisc", (const char*) interface ); | ||
252 | system( cmdline ); | 247 | system( cmdline ); |
253 | cmdline.sprintf( "killall -14 dhcpcd" ); | 248 | cmdline.sprintf( "killall -14 dhcpcd" ); |
254 | system( cmdline ); | 249 | system( cmdline ); |
255 | cmdline.sprintf( "killall -10 udhcpc" ); | 250 | cmdline.sprintf( "killall -10 udhcpc" ); |
256 | 251 | ||
257 | // message the user | 252 | // message the user |
258 | 253 | ||
259 | QMessageBox::information( this, "Wellenreiter/Opie", "Your wireless card\nshould now be usable again." ); | 254 | QMessageBox::information( this, "Wellenreiter/Opie", "Your wireless card\nshould now be usable again." ); |
260 | } | 255 | } |
261 | 256 | ||
262 | else | 257 | else |
263 | { | 258 | { |
264 | 259 | ||
265 | logwindow->log( "(i) Daemon has been started." ); | ||
266 | daemonRunning = true; | ||
267 | button->setText( "Stop Scanning" ); | ||
268 | |||
269 | // get configuration from config window | 260 | // get configuration from config window |
270 | 261 | ||
271 | const QString& interface = configwindow->interfaceName->currentText(); | 262 | const QString& interface = configwindow->interfaceName->currentText(); |
272 | const QString& cardtype = configwindow->deviceType->currentText(); | 263 | const int cardtype = configwindow->daemonDeviceType(); |
273 | const QString& interval = configwindow->hopInterval->cleanText(); | 264 | const int interval = configwindow->daemonHopInterval(); |
274 | 265 | ||
275 | if ( ( interface == "<select>" ) || ( cardtype == "<select>" ) ) | 266 | if ( ( interface == "<select>" ) || ( cardtype == 0 ) ) |
276 | { | 267 | { |
277 | QMessageBox::information( this, "Wellenreiter/Opie", "You must configure your\ndevice before scanning." ); | 268 | QMessageBox::information( this, "Wellenreiter/Opie", "You must configure your\ndevice before scanning." ); |
278 | return; | 269 | return; |
279 | } | 270 | } |
280 | 271 | ||
281 | // set interface into monitor mode | 272 | // start wellenreiterd |
282 | /* Global::Execute definitely does not work very well with non-gui stuff! :( */ | 273 | |
283 | |||
284 | QString cmdline; | 274 | QString cmdline; |
285 | cmdline.sprintf( "iwpriv %s monitor 2", (const char*) interface ); | 275 | cmdline.sprintf( "wellenreiterd %s %d &", (const char*) interface, cardtype ); |
286 | system( cmdline ); | ||
287 | cmdline.sprintf( "iwpriv %s monitor 2 1", (const char*) interface ); | ||
288 | system( cmdline ); | ||
289 | |||
290 | // start channel hopper | ||
291 | |||
292 | cmdline = "orinoco_hopper "; | ||
293 | cmdline += interface; | ||
294 | cmdline += " -i "; | ||
295 | cmdline += interval; | ||
296 | cmdline += " &"; | ||
297 | qDebug( "execute: %s", (const char*) cmdline ); | ||
298 | system( cmdline ); | ||
299 | qDebug( "done" ); | ||
300 | |||
301 | // start daemon | ||
302 | |||
303 | cmdline = "wellenreiterd "; | ||
304 | cmdline += interface; | ||
305 | cmdline += " 3"; | ||
306 | cmdline += " &"; | ||
307 | 276 | ||
308 | qDebug( "execute: %s", (const char*) cmdline ); | 277 | qDebug( "about to execute '%s' ...", (const char*) cmdline ); |
309 | system( cmdline ); | 278 | system( cmdline ); |
310 | qDebug( "done" ); | 279 | qDebug( "done!" ); |
280 | |||
281 | logwindow->log( "(i) Daemon has been started." ); | ||
282 | daemonRunning = true; | ||
283 | button->setText( "Stop Scanning" ); | ||
311 | 284 | ||
312 | } | 285 | } |
313 | } | 286 | } |