summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/resource.cpp2
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp6
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiterbase.cpp8
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh21
4 files changed, 24 insertions, 13 deletions
diff --git a/noncore/net/wellenreiter/gui/resource.cpp b/noncore/net/wellenreiter/gui/resource.cpp
index 58c6bed..fb0966a 100644
--- a/noncore/net/wellenreiter/gui/resource.cpp
+++ b/noncore/net/wellenreiter/gui/resource.cpp
@@ -1,35 +1,35 @@
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 "resource.h" 16#include "resource.h"
17 17
18#define PIXMAPPATH "/home/mickey/work/opie/pics" 18#define PIXMAPPATH "/usr/share/wellenreiter/pics/"
19 19
20namespace Resource 20namespace Resource
21{ 21{
22 22
23QPixmap loadPixmap( const QString& pix ) 23QPixmap loadPixmap( const QString& pix )
24{ 24{
25 QString filename; 25 QString filename;
26 filename.sprintf( "%s/%s.png", (const char*) PIXMAPPATH, (const char*) pix ); 26 filename.sprintf( "%s/%s.png", (const char*) PIXMAPPATH, (const char*) pix );
27 QPixmap pixmap( filename ); 27 QPixmap pixmap( filename );
28 if ( pixmap.isNull() ) 28 if ( pixmap.isNull() )
29 { 29 {
30 qDebug( "Wellenreiter::Resource: can't find pixmap " + filename ); 30 qDebug( "Wellenreiter::Resource: can't find pixmap " + filename );
31 } 31 }
32 return pixmap; 32 return pixmap;
33}; 33};
34 34
35}; 35};
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index c1aae86..4c53028 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -40,244 +40,244 @@ using namespace Opie;
40#include <assert.h> 40#include <assert.h>
41#include <errno.h> 41#include <errno.h>
42#include <unistd.h> 42#include <unistd.h>
43#include <string.h> 43#include <string.h>
44#include <sys/types.h> 44#include <sys/types.h>
45#include <sys/socket.h> 45#include <sys/socket.h>
46#include <stdlib.h> 46#include <stdlib.h>
47#include <fcntl.h> 47#include <fcntl.h>
48 48
49// Local 49// Local
50 50
51#include "wellenreiter.h" 51#include "wellenreiter.h"
52#include "scanlist.h" 52#include "scanlist.h"
53#include "logwindow.h" 53#include "logwindow.h"
54#include "hexwindow.h" 54#include "hexwindow.h"
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
64Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) 64Wellenreiter::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
123Wellenreiter::~Wellenreiter() 123Wellenreiter::~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
130void Wellenreiter::handleMessage() 130void Wellenreiter::handleMessage()
131{ 131{
132 // FIXME: receive message and handle it 132 // FIXME: receive message and handle it
133 133
134 qDebug( "received message from daemon." ); 134 qDebug( "received message from daemon." );
135 135
136 /*char buffer[10000]; 136 /*char buffer[10000];
137 memset( &buffer, 0, sizeof( buffer ) );*/ 137 memset( &buffer, 0, sizeof( buffer ) );*/
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/*
164typedef struct { 164typedef 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 */
179 { 179 {
180 qDebug( "Sniffer said: new network found." ); 180 qDebug( "Sniffer said: new network found." );
181 wl_network_t n; 181 wl_network_t n;
182 get_network_found( &n, (char*) &buffer ); 182 get_network_found( &n, (char*) &buffer );
183 183
184 qDebug( "Sniffer said: net_type is %d.", n.net_type ); 184 qDebug( "Sniffer said: net_type is %d.", n.net_type );
185 qDebug( "Sniffer said: MAC is %s", (const char*) &n.mac ); 185 qDebug( "Sniffer said: MAC is %s", (const char*) &n.mac );
186 186
187 //n.bssid[n.ssid_len] = "\0"; 187 //n.bssid[n.ssid_len] = "\0";
188 188
189 QString type; 189 QString type;
190 190
191 if ( n.net_type == 1 ) 191 if ( n.net_type == 1 )
192 type = "managed"; 192 type = "managed";
193 else 193 else
194 type = "adhoc"; 194 type = "adhoc";
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
208void Wellenreiter::dataReceived() 208void 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
214void Wellenreiter::buttonClicked() 214void 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( tr( "Start Scanning" ) ); 231 button->setText( tr( "Start Scanning" ) );
232 setCaption( tr( "Scanning in progress..." ) ); 232 setCaption( tr( "Wellenreiter/Opie" ) );
233 233
234 // Stop daemon - ugly for now... later better 234 // Stop daemon - ugly for now... later better
235 235
236 system( "killall wellenreiterd" ); 236 system( "killall wellenreiterd" );
237 237
238 // get configuration from config window 238 // get configuration from config window
239 239
240 const QString& interface = configwindow->interfaceName->currentText(); 240 const QString& interface = configwindow->interfaceName->currentText();
241 241
242 // reset the interface trying to get it into a usable state again 242 // reset the interface trying to get it into a usable state again
243 243
244 QString cmdline; 244 QString cmdline;
245 cmdline.sprintf( "ifdown %s; ifup %s", (const char*) interface, (const char*) interface ); 245 cmdline.sprintf( "iwpriv %s monitor 0; ifdown %s; ifup %s", (const char*) interface, (const char*) interface, (const char*) interface );
246 system( cmdline ); 246 system( cmdline );
247 247
248 // message the user 248 // message the user
249 249
250 QMessageBox::information( this, "Wellenreiter/Opie", "Your wireless card\nshould now be usable again." ); 250 QMessageBox::information( this, "Wellenreiter/Opie", "Your wireless card\nshould now be usable again." );
251 } 251 }
252 252
253 else 253 else
254 { 254 {
255 255
256 // get configuration from config window 256 // get configuration from config window
257 257
258 const QString& interface = configwindow->interfaceName->currentText(); 258 const QString& interface = configwindow->interfaceName->currentText();
259 const int cardtype = configwindow->daemonDeviceType(); 259 const int cardtype = configwindow->daemonDeviceType();
260 const int interval = configwindow->daemonHopInterval(); 260 const int interval = configwindow->daemonHopInterval();
261 261
262 if ( ( interface == "<select>" ) || ( cardtype == 0 ) ) 262 if ( ( interface == "<select>" ) || ( cardtype == 0 ) )
263 { 263 {
264 QMessageBox::information( this, "Wellenreiter/Opie", "You must configure your\ndevice before scanning." ); 264 QMessageBox::information( this, "Wellenreiter/Opie", "You must configure your\ndevice before scanning." );
265 return; 265 return;
266 } 266 }
267 267
268 // start wellenreiterd 268 // start wellenreiterd
269 269
270 QString cmdline; 270 QString cmdline;
271 cmdline.sprintf( "wellenreiterd %s %d &", (const char*) interface, cardtype ); 271 cmdline.sprintf( "wellenreiterd %s %d &", (const char*) interface, cardtype );
272 272
273 qDebug( "about to execute '%s' ...", (const char*) cmdline ); 273 qDebug( "about to execute '%s' ...", (const char*) cmdline );
274 system( cmdline ); 274 system( cmdline );
275 qDebug( "done!" ); 275 qDebug( "done!" );
276 276
277 logwindow->log( "(i) Daemon has been started." ); 277 logwindow->log( "(i) Daemon has been started." );
278 daemonRunning = true; 278 daemonRunning = true;
279 button->setText( tr( "Stop Scanning" ) ); 279 button->setText( tr( "Stop Scanning" ) );
280 setCaption( tr( "Wellenreiter/Opie" ) ); 280 setCaption( tr( "Scanning ..." ) );
281 281
282 } 282 }
283} 283}
diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
index a93c684..da12f2b 100644
--- a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
@@ -1,181 +1,181 @@
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 "wellenreiterbase.h" 16#include "wellenreiterbase.h"
17 17
18#include <qheader.h> 18#include <qheader.h>
19#include <qlabel.h> 19#include <qlabel.h>
20#include <qlistview.h> 20#include <qlistview.h>
21#include <qmultilineedit.h> 21#include <qmultilineedit.h>
22#include <qpushbutton.h> 22#include <qpushbutton.h>
23#include <qlayout.h> 23#include <qlayout.h>
24#include <qvariant.h> 24#include <qvariant.h>
25#include <qtooltip.h> 25#include <qtooltip.h>
26#include <qwhatsthis.h> 26#include <qwhatsthis.h>
27#include <qimage.h> 27#include <qimage.h>
28#include <qpixmap.h> 28#include <qpixmap.h>
29 29
30#include "logwindow.h" 30#include "logwindow.h"
31#include "hexwindow.h" 31#include "hexwindow.h"
32#include "configwindow.h" 32#include "configwindow.h"
33#include "scanlist.h" 33#include "scanlist.h"
34 34
35#ifdef QWS 35#ifdef QWS
36#include <qpe/resource.h> 36#include <qpe/resource.h>
37#include <opie/otabwidget.h> 37#include <opie/otabwidget.h>
38#else 38#else
39#include "resource.h" 39#include "resource.h"
40#include <qtabwidget.h> 40#include <qtabwidget.h>
41#endif 41#endif
42 42
43 43
44/* 44/*
45 * Constructs a WellenreiterBase which is a child of 'parent', with the 45 * Constructs a WellenreiterBase which is a child of 'parent', with the
46 * name 'name' and widget flags set to 'f' 46 * name 'name' and widget flags set to 'f'
47 */ 47 */
48WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags fl ) 48WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags fl )
49 : QWidget( parent, name, fl ) 49 : QWidget( parent, name, fl )
50{ 50{
51 ani1 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot0" ) ); 51 //ani1 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot0" ) );
52 ani2 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot90" ) ); 52 //ani2 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot90" ) );
53 ani3 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot180" ) ); 53 //ani3 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot180" ) );
54 ani4 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot270" ) ); 54 //ani4 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot270" ) );
55 55
56 if ( !name ) 56 if ( !name )
57 setName( "WellenreiterBase" ); 57 setName( "WellenreiterBase" );
58 resize( 191, 294 ); 58 resize( 191, 294 );
59 setCaption( tr( "Wellenreiter" ) ); 59 setCaption( tr( "Wellenreiter" ) );
60 WellenreiterBaseLayout = new QVBoxLayout( this ); 60 WellenreiterBaseLayout = new QVBoxLayout( this );
61 WellenreiterBaseLayout->setSpacing( 2 ); 61 WellenreiterBaseLayout->setSpacing( 2 );
62 WellenreiterBaseLayout->setMargin( 0 ); 62 WellenreiterBaseLayout->setMargin( 0 );
63#ifdef QWS 63#ifdef QWS
64 TabWidget = new OTabWidget( this, "TabWidget", OTabWidget::Global ); 64 TabWidget = new OTabWidget( this, "TabWidget", OTabWidget::Global );
65#else 65#else
66 TabWidget = new QTabWidget( this, "TabWidget" ); 66 TabWidget = new QTabWidget( this, "TabWidget" );
67#endif 67#endif
68 ap = new QWidget( TabWidget, "ap" ); 68 ap = new QWidget( TabWidget, "ap" );
69 apLayout = new QVBoxLayout( ap ); 69 apLayout = new QVBoxLayout( ap );
70 apLayout->setSpacing( 2 ); 70 apLayout->setSpacing( 2 );
71 apLayout->setMargin( 2 ); 71 apLayout->setMargin( 2 );
72 72
73 //--------- NETVIEW TAB -------------- 73 //--------- NETVIEW TAB --------------
74 74
75 netview = new MScanListView( ap ); 75 netview = new MScanListView( ap );
76 apLayout->addWidget( netview ); 76 apLayout->addWidget( netview );
77 77
78 78
79 //--------- LOG TAB -------------- 79 //--------- LOG TAB --------------
80 80
81 logwindow = new MLogWindow( TabWidget, "Log" ); 81 logwindow = new MLogWindow( TabWidget, "Log" );
82 82
83 83
84 //--------- HEX TAB -------------- 84 //--------- HEX TAB --------------
85 85
86 hexwindow = new MHexWindow( TabWidget, "Hex" ); 86 hexwindow = new MHexWindow( TabWidget, "Hex" );
87 87
88 //--------- CONFIG TAB -------------- 88 //--------- CONFIG TAB --------------
89 89
90 configwindow = new WellenreiterConfigWindow( TabWidget, "Config" ); 90 configwindow = new WellenreiterConfigWindow( TabWidget, "Config" );
91 91
92 //--------- ABOUT TAB -------------- 92 //--------- ABOUT TAB --------------
93 93
94 about = new QWidget( TabWidget, "about" ); 94 about = new QWidget( TabWidget, "about" );
95 aboutLayout = new QGridLayout( about ); 95 aboutLayout = new QGridLayout( about );
96 aboutLayout->setSpacing( 6 ); 96 aboutLayout->setSpacing( 6 );
97 aboutLayout->setMargin( 11 ); 97 aboutLayout->setMargin( 11 );
98 98
99 PixmapLabel1_3_2 = new QLabel( about, "PixmapLabel1_3_2" ); 99 PixmapLabel1_3_2 = new QLabel( about, "PixmapLabel1_3_2" );
100 PixmapLabel1_3_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, PixmapLabel1_3_2->sizePolicy().hasHeightForWidth() ) ); 100 PixmapLabel1_3_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, PixmapLabel1_3_2->sizePolicy().hasHeightForWidth() ) );
101 PixmapLabel1_3_2->setFrameShape( QLabel::Panel ); 101 PixmapLabel1_3_2->setFrameShape( QLabel::Panel );
102 PixmapLabel1_3_2->setFrameShadow( QLabel::Sunken ); 102 PixmapLabel1_3_2->setFrameShadow( QLabel::Sunken );
103 PixmapLabel1_3_2->setLineWidth( 2 ); 103 PixmapLabel1_3_2->setLineWidth( 2 );
104 PixmapLabel1_3_2->setMargin( 0 ); 104 PixmapLabel1_3_2->setMargin( 0 );
105 PixmapLabel1_3_2->setMidLineWidth( 0 ); 105 PixmapLabel1_3_2->setMidLineWidth( 0 );
106 PixmapLabel1_3_2->setPixmap( Resource::loadPixmap( "wellenreiter/logo" ) ); 106 PixmapLabel1_3_2->setPixmap( Resource::loadPixmap( "wellenreiter/logo" ) );
107 PixmapLabel1_3_2->setScaledContents( TRUE ); 107 PixmapLabel1_3_2->setScaledContents( TRUE );
108 PixmapLabel1_3_2->setAlignment( int( QLabel::AlignCenter ) ); 108 PixmapLabel1_3_2->setAlignment( int( QLabel::AlignCenter ) );
109 109
110 aboutLayout->addWidget( PixmapLabel1_3_2, 0, 0 ); 110 aboutLayout->addWidget( PixmapLabel1_3_2, 0, 0 );
111 111
112 TextLabel1_4_2 = new QLabel( about, "TextLabel1_4_2" ); 112 TextLabel1_4_2 = new QLabel( about, "TextLabel1_4_2" );
113 QFont TextLabel1_4_2_font( TextLabel1_4_2->font() ); 113 QFont TextLabel1_4_2_font( TextLabel1_4_2->font() );
114 TextLabel1_4_2_font.setFamily( "adobe-helvetica" ); 114 TextLabel1_4_2_font.setFamily( "adobe-helvetica" );
115 TextLabel1_4_2_font.setPointSize( 10 ); 115 TextLabel1_4_2_font.setPointSize( 10 );
116 TextLabel1_4_2->setFont( TextLabel1_4_2_font ); 116 TextLabel1_4_2->setFont( TextLabel1_4_2_font );
117 TextLabel1_4_2->setText( tr( "<p align=center>\n" 117 TextLabel1_4_2->setText( tr( "<p align=center>\n"
118"<hr>\n" 118"<hr>\n"
119"Max Moser<br>\n" 119"Max Moser<br>\n"
120"Martin J. Muench<br>\n" 120"Martin J. Muench<br>\n"
121"Michael Lauer<br><hr>\n" 121"Michael Lauer<br><hr>\n"
122"<b>www.remote-exploit.org</b>\n" 122"<b>www.remote-exploit.org</b>\n"
123"</p>" ) ); 123"</p>" ) );
124 TextLabel1_4_2->setAlignment( int( QLabel::AlignCenter ) ); 124 TextLabel1_4_2->setAlignment( int( QLabel::AlignCenter ) );
125 125
126 aboutLayout->addWidget( TextLabel1_4_2, 1, 0 ); 126 aboutLayout->addWidget( TextLabel1_4_2, 1, 0 );
127 127
128 button = new QPushButton( this, "button" ); 128 button = new QPushButton( this, "button" );
129 button->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, button->sizePolicy().hasHeightForWidth() ) ); 129 button->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, button->sizePolicy().hasHeightForWidth() ) );
130 button->setText( tr( "Start Scanning" ) ); 130 button->setText( tr( "Start Scanning" ) );
131 131
132#ifdef QWS 132#ifdef QWS
133 TabWidget->addTab( ap, "wellenreiter/networks", tr( "Networks" ) ); 133 TabWidget->addTab( ap, "wellenreiter/networks", tr( "Networks" ) );
134 TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) ); 134 TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) );
135 TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) ); 135 TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) );
136 TabWidget->addTab( configwindow, "wellenreiter/config", tr( "Config" ) ); 136 TabWidget->addTab( configwindow, "wellenreiter/config", tr( "Config" ) );
137 TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) ); 137 TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) );
138#else 138#else
139 TabWidget->addTab( ap, /* "wellenreiter/networks", */ tr( "Networks" ) ); 139 TabWidget->addTab( ap, /* "wellenreiter/networks", */ tr( "Networks" ) );
140 TabWidget->addTab( logwindow, /* "wellenreiter/log", */ tr( "Log" ) ); 140 TabWidget->addTab( logwindow, /* "wellenreiter/log", */ tr( "Log" ) );
141 TabWidget->addTab( hexwindow, /* "wellenreiter/hex", */ tr( "Hex" ) ); 141 TabWidget->addTab( hexwindow, /* "wellenreiter/hex", */ tr( "Hex" ) );
142 TabWidget->addTab( configwindow, /* "wellenreiter/config", */ tr( "Config" ) ); 142 TabWidget->addTab( configwindow, /* "wellenreiter/config", */ tr( "Config" ) );
143 TabWidget->addTab( about, /* "wellenreiter/about", */ tr( "About" ) ); 143 TabWidget->addTab( about, /* "wellenreiter/about", */ tr( "About" ) );
144#endif 144#endif
145 WellenreiterBaseLayout->addWidget( TabWidget ); 145 WellenreiterBaseLayout->addWidget( TabWidget );
146 WellenreiterBaseLayout->addWidget( button ); 146 WellenreiterBaseLayout->addWidget( button );
147 147
148#ifdef QWS 148#ifdef QWS
149 TabWidget->setCurrentTab( tr( "Networks" ) ); 149 TabWidget->setCurrentTab( tr( "Networks" ) );
150#endif 150#endif
151 151
152} 152}
153 153
154/* 154/*
155 * Destroys the object and frees any allocated resources 155 * Destroys the object and frees any allocated resources
156 */ 156 */
157WellenreiterBase::~WellenreiterBase() 157WellenreiterBase::~WellenreiterBase()
158{ 158{
159 // no need to delete child widgets, Qt does it all for us 159 // no need to delete child widgets, Qt does it all for us
160} 160}
161 161
162/* 162/*
163 * Main event handler. Reimplemented to handle application 163 * Main event handler. Reimplemented to handle application
164 * font changes 164 * font changes
165 */ 165 */
166bool WellenreiterBase::event( QEvent* ev ) 166bool WellenreiterBase::event( QEvent* ev )
167{ 167{
168 bool ret = QWidget::event( ev ); 168 bool ret = QWidget::event( ev );
169 if ( ev->type() == QEvent::ApplicationFontChange ) { 169 if ( ev->type() == QEvent::ApplicationFontChange ) {
170 //QFont Log_2_font( Log_2->font() ); 170 //QFont Log_2_font( Log_2->font() );
171 //Log_2_font.setFamily( "adobe-courier" ); 171 //Log_2_font.setFamily( "adobe-courier" );
172 //Log_2_font.setPointSize( 8 ); 172 //Log_2_font.setPointSize( 8 );
173 //Log_2->setFont( Log_2_font ); 173 //Log_2->setFont( Log_2_font );
174 QFont TextLabel1_4_2_font( TextLabel1_4_2->font() ); 174 QFont TextLabel1_4_2_font( TextLabel1_4_2->font() );
175 TextLabel1_4_2_font.setFamily( "adobe-helvetica" ); 175 TextLabel1_4_2_font.setFamily( "adobe-helvetica" );
176 TextLabel1_4_2_font.setPointSize( 10 ); 176 TextLabel1_4_2_font.setPointSize( 10 );
177 TextLabel1_4_2->setFont( TextLabel1_4_2_font ); 177 TextLabel1_4_2->setFont( TextLabel1_4_2_font );
178 } 178 }
179 return ret; 179 return ret;
180} 180}
181 181
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh
index 652b3ed..58e99ac 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh
+++ b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh
@@ -1,94 +1,105 @@
1/* $Id$ */ 1/* $Id$ */
2 2
3#ifndef CARDMODE_HH 3#ifndef CARDMODE_HH
4#define CARDMODE_HH 4#define CARDMODE_HH
5 5
6#include <string.h> 6#include <string.h>
7#include <stdlib.h> 7#include <stdlib.h>
8#include <errno.h> 8#include <errno.h>
9#include <sys/types.h> 9#include <sys/types.h>
10#include <sys/time.h> 10#include <sys/time.h>
11#include <sys/socket.h> 11#include <sys/socket.h>
12#include <netinet/in.h> 12#include <netinet/in.h>
13#include <arpa/inet.h> 13#include <arpa/inet.h>
14#include <sys/ioctl.h> 14#include <sys/ioctl.h>
15#include <unistd.h> 15#include <unistd.h>
16#include <linux/if.h> 16#include <linux/if.h>
17
18/* Following typedefs are needed here, because linux/wireless.h
19 includes linux/ethertool.h which is using them */
20typedef signed char s8;
21typedef unsigned char u8;
22typedef signed short s16;
23typedef unsigned short u16;
24typedef signed int s32;
25typedef unsigned int u32;
26typedef signed long long s64;
27typedef unsigned long long u64;
28
17#include <linux/wireless.h> 29#include <linux/wireless.h>
18 30
19#ifndef SIOCIWFIRSTPRIV 31#ifndef SIOCIWFIRSTPRIV
20#define SIOCIWFIRSTPRIV SIOCDEVPRIVATE 32#define SIOCIWFIRSTPRIV SIOCDEVPRIVATE
21#endif 33#endif
22 34
23
24extern "C" 35extern "C"
25{ 36{
26#include <net/bpf.h> 37#include <net/bpf.h>
27#include <pcap.h> 38#include <pcap.h>
28} 39}
29 40
30/* Defines, used for the card setup */ 41/* Defines, used for the card setup */
31#define DEFAULT_PATH "/proc/driver/aironet/%s/Config" 42#define DEFAULT_PATH "/proc/driver/aironet/%s/Config"
32#define CISCO_STATUS "/proc/driver/aironet/%s/Status" 43#define CISCO_STATUS "/proc/driver/aironet/%s/Status"
33 #define CARD_TYPE_CISCO 1 44#define CARD_TYPE_CISCO 1
34 #define CARD_TYPE_NG 2 45#define CARD_TYPE_NG 2
35 #define CARD_TYPE_HOSTAP3 46#define CARD_TYPE_HOSTAP 3
36#define CARD_TYPE_ORINOCCO 4 47#define CARD_TYPE_ORINOCCO 4
37 48
38/* Some usefull constants for frequencies */ 49/* Some usefull constants for frequencies */
39#define KILO 1e3 50#define KILO 1e3
40#define MEGA 1e6 51#define MEGA 1e6
41#define GIGA 1e9 52#define GIGA 1e9
42 53
43 54
44/* only for now, until we have the daemon running */ 55/* only for now, until we have the daemon running */
45/*the config file should provide these information */ 56/*the config file should provide these information */
46#define CARD_TYPE CARD_TYPE_HOSTAP 57#define CARD_TYPE CARD_TYPE_HOSTAP
47 58
48/* Prototypes */ 59/* Prototypes */
49int card_check_rfmon_datalink (const char *device); 60int card_check_rfmon_datalink (const char *device);
50int card_into_monitormode (pcap_t **, const char *, int); 61int card_into_monitormode (pcap_t **, const char *, int);
51int card_set_promisc_up (const char *device); 62int card_set_promisc_up (const char *device);
52int card_remove_promisc (const char *device); 63int card_remove_promisc (const char *device);
53int card_set_channel (const char *device, int channel,int cardtype); 64int card_set_channel (const char *device, int channel,int cardtype);
54int iw_get_range_info(int skfd, const char * ifname, struct iw_range * range); 65int iw_get_range_info(int skfd, const char * ifname, struct iw_range * range);
55double iw_freq2float(iw_freq * in); 66double iw_freq2float(iw_freq * in);
56 void iw_float2freq(double in, iw_freq *out); 67 void iw_float2freq(double in, iw_freq *out);
57int card_detect_channels (char * device); 68int card_detect_channels (char * device);
58 69
59 70
60/*------------------------------------------------------------------*/ 71/*------------------------------------------------------------------*/
61/* 72/*
62 * Wrapper to push some Wireless Parameter in the driver 73 * Wrapper to push some Wireless Parameter in the driver
63 */ 74 */
64static inline int 75static inline int
65 iw_set_ext(int skfd, /* Socket to the kernel */ 76 iw_set_ext(int skfd, /* Socket to the kernel */
66 char * ifname, /* Device name */ 77 char * ifname, /* Device name */
67 int request,/* WE ID */ 78 int request,/* WE ID */
68 struct iwreq * pwrq) /* Fixed part of the request */ 79 struct iwreq * pwrq) /* Fixed part of the request */
69{ 80{
70 /* Set device name */ 81 /* Set device name */
71 strncpy(pwrq->ifr_name, ifname, IFNAMSIZ); 82 strncpy(pwrq->ifr_name, ifname, IFNAMSIZ);
72 /* Do the request */ 83 /* Do the request */
73 return(ioctl(skfd, request, pwrq)); 84 return(ioctl(skfd, request, pwrq));
74} 85}
75 86
76/*------------------------------------------------------------------*/ 87/*------------------------------------------------------------------*/
77/* 88/*
78 * Wrapper to extract some Wireless Parameter out of the driver 89 * Wrapper to extract some Wireless Parameter out of the driver
79 */ 90 */
80static inline int 91static inline int
81 iw_get_ext(int skfd, /* Socket to the kernel */ 92 iw_get_ext(int skfd, /* Socket to the kernel */
82 char * ifname, /* Device name */ 93 char * ifname, /* Device name */
83 int request,/* WE ID */ 94 int request,/* WE ID */
84 struct iwreq * pwrq) /* Fixed part of the request */ 95 struct iwreq * pwrq) /* Fixed part of the request */
85{ 96{
86 /* Set device name */ 97 /* Set device name */
87 strncpy(pwrq->ifr_name, ifname, IFNAMSIZ); 98 strncpy(pwrq->ifr_name, ifname, IFNAMSIZ);
88 /* Do the request */ 99 /* Do the request */
89 return(ioctl(skfd, request, pwrq)); 100 return(ioctl(skfd, request, pwrq));
90} 101}
91 102
92 103
93 104
94#endif /* CARDMODE_HH */ 105#endif /* CARDMODE_HH */