summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/TODO7
-rw-r--r--noncore/net/wellenreiter/gui/main.cpp1
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.cpp5
-rw-r--r--noncore/net/wellenreiter/gui/packetview.cpp48
-rw-r--r--noncore/net/wellenreiter/gui/packetview.h19
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp4
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.h4
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiterbase.cpp14
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiterbase.h4
9 files changed, 75 insertions, 31 deletions
diff --git a/noncore/net/wellenreiter/TODO b/noncore/net/wellenreiter/TODO
index f3fd205..5f37ddf 100644
--- a/noncore/net/wellenreiter/TODO
+++ b/noncore/net/wellenreiter/TODO
@@ -1,60 +1,67 @@
1/************************************************************************ 1/************************************************************************
2/* W e l l e n r e i t e r I I 2/* W e l l e n r e i t e r I I
3/* =============================== 3/* ===============================
4/* 4/*
5/* Version: 1.0.2 5/* Version: 1.0.2
6/************************************************************************ 6/************************************************************************
7 7
8---------------------------------------------------- 8----------------------------------------------------
9 Ideas as of Wellenreiter II / December 2003 9 Ideas as of Wellenreiter II / December 2003
10---------------------------------------------------- 10----------------------------------------------------
11 11
12-------- 12--------
13ENGINE 13ENGINE
14-------- 14--------
15 15
16- enable multiple packet sources 16- enable multiple packet sources
17 - infrared 17 - infrared
18 - bluetooth 18 - bluetooth
19 - usb? 19 - usb?
20 20
21- define packet structure in a metalanguage and generate 21- define packet structure in a metalanguage and generate
22 the actual parsing code (hmmm) 22 the actual parsing code (hmmm)
23 23
24- pester the ethereal folks to settle for an application independant 24- pester the ethereal folks to settle for an application independant
25 packet dissection framework... (unlikely) 25 packet dissection framework... (unlikely)
26 26
27- adaptive hopping scheme ! 27- adaptive hopping scheme !
28 28
29- gather interface capabilities 29- gather interface capabilities
30 30
31- enable sniffing in wired networks 31- enable sniffing in wired networks
32 32
33- fix autodetection (interface name) 33- fix autodetection (interface name)
34 34
35--------- 35---------
36 UI 36 UI
37--------- 37---------
38 38
39- display interface capabilities (or rewrite networksettings?) 39- display interface capabilities (or rewrite networksettings?)
40 40
41- distinguish wireless bridges (WDS traffic) 41- distinguish wireless bridges (WDS traffic)
42 42
43- add configuration for scrollback buffer in hex window and log window 43- add configuration for scrollback buffer in hex window and log window
44 44
45- revamp hex window, make it more sophisticated than just a QMultiLineEdit 45- revamp hex window, make it more sophisticated than just a QMultiLineEdit
46 - tree view 46 - tree view
47 47
48- beep over headphone / customizable 48- beep over headphone / customizable
49 49
50- count/display number of wireless networks / APs since last start/stop 50- count/display number of wireless networks / APs since last start/stop
51 51
52--------- 52---------
53 FILES 53 FILES
54--------- 54---------
55 55
56- write kismet-like .network format and format to be importable into AutoRoute 56- write kismet-like .network format and format to be importable into AutoRoute
57 57
58- implement beacon stripping (the first beacon is enough to detect a 58- implement beacon stripping (the first beacon is enough to detect a
59 new network - further beacons just blow up the capture file) 59 new network - further beacons just blow up the capture file)
60 60
61- write wi-scan format like that:
62 # $Creator: Wellenreiter II Version 1.0.2
63 # $Format: wi-scan
64 # Latitude Longitude ( SSID ) Type ( BSSID ) Time (GMT) [ SNR Sig Noise ]
65 # $DateGMT: 2004-02-07
66 N 41.1008009 W 8.3893034 ( Porceven ) BBS ( 00:a0:f8:41:91:63 ) 22:32:39 (GMT) [ 21 177 156 ]
67
diff --git a/noncore/net/wellenreiter/gui/main.cpp b/noncore/net/wellenreiter/gui/main.cpp
index be7a528..7dcc583 100644
--- a/noncore/net/wellenreiter/gui/main.cpp
+++ b/noncore/net/wellenreiter/gui/main.cpp
@@ -1,109 +1,110 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Wellenreiter II. 4** This file is part of Wellenreiter II.
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 "mainwindow.h" 16#include "mainwindow.h"
17#ifdef QWS 17#ifdef QWS
18#include <opie2/oapplication.h> 18#include <opie2/oapplication.h>
19#include <opie2/oprocess.h> 19#include <opie2/oprocess.h>
20#else 20#else
21#include <qapplication.h> 21#include <qapplication.h>
22#endif 22#endif
23 23
24#include <qmessagebox.h> 24#include <qmessagebox.h>
25#include <qstringlist.h> 25#include <qstringlist.h>
26 26
27#include <errno.h> 27#include <errno.h>
28#include <signal.h> 28#include <signal.h>
29#include <string.h> 29#include <string.h>
30#include <unistd.h> 30#include <unistd.h>
31 31
32int main( int argc, char **argv ) 32int main( int argc, char **argv )
33{ 33{
34 #ifdef QWS 34 #ifdef QWS
35 OApplication a( argc, argv, "Wellenreiter II" ); 35 OApplication a( argc, argv, "Wellenreiter II" );
36 #else 36 #else
37 QApplication a( argc, argv ); 37 QApplication a( argc, argv );
38 #endif 38 #endif
39 WellenreiterMainWindow* w = new WellenreiterMainWindow(); 39 WellenreiterMainWindow* w = new WellenreiterMainWindow();
40 #ifdef QWS 40 #ifdef QWS
41 a.showMainWidget( w ); 41 a.showMainWidget( w );
42 #else 42 #else
43 a.setMainWidget( w ); 43 a.setMainWidget( w );
44 w->setCaption( "Wellenreiter II" ); 44 w->setCaption( "Wellenreiter II" );
45 w->show(); 45 w->show();
46 #endif 46 #endif
47 47
48 a.processEvents(); // show the window before doing the safety checks 48 a.processEvents(); // show the window before doing the safety checks
49 int result = -1; 49 int result = -1;
50 static int killed = false; 50 static int killed = false;
51 51
52 bool check = true; 52 bool check = true;
53 for ( int i = 1; i < argc; ++i ) 53 for ( int i = 1; i < argc; ++i )
54 { 54 {
55 qDebug( "Wellenreiter::main() parsing argument %d = '%s'", i, argv[i] );
55 if ( !strcmp( "-nocheck", argv[i] ) ) 56 if ( !strcmp( "-nocheck", argv[i] ) )
56 { 57 {
57 qDebug( "-nocheck found" ); 58 qDebug( "-nocheck found" );
58 check = false; 59 check = false;
59 break; 60 break;
60 } 61 }
61 } 62 }
62 63
63 if ( check ) 64 if ( check )
64 { 65 {
65 // root check 66 // root check
66 if ( getuid() ) 67 if ( getuid() )
67 { 68 {
68 qWarning( QObject::tr( "Wellenreiter: trying to run as non-root!" ) ); 69 qWarning( QObject::tr( "Wellenreiter: trying to run as non-root!" ) );
69 result = QMessageBox::warning( w, " - Wellenreiter II - (non-root)", QObject::tr( "You have started Wellenreiter II\n" 70 result = QMessageBox::warning( w, " - Wellenreiter II - (non-root)", QObject::tr( "You have started Wellenreiter II\n"
70 "as non-root. You will have\nonly limited functionality.\nProceed anyway?" ), 71 "as non-root. You will have\nonly limited functionality.\nProceed anyway?" ),
71 QMessageBox::Yes, QMessageBox::No ); 72 QMessageBox::Yes, QMessageBox::No );
72 if ( result == QMessageBox::No ) return -1; 73 if ( result == QMessageBox::No ) return -1;
73 } 74 }
74 75
75 int dhcpid = OProcess::processPID( "dhcpc" ); 76 int dhcpid = OProcess::processPID( "dhcpc" );
76 77
77 if ( dhcpid ) 78 if ( dhcpid )
78 { 79 {
79 result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "You have a dhcp client running.\n" 80 result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "You have a dhcp client running.\n"
80 "(PID = %1)\nThis can severly limit scanning!\nShould I kill it for you?" ).arg( dhcpid ), 81 "(PID = %1)\nThis can severly limit scanning!\nShould I kill it for you?" ).arg( dhcpid ),
81 QMessageBox::Yes, QMessageBox::No ); 82 QMessageBox::Yes, QMessageBox::No );
82 if ( result == QMessageBox::Yes ) 83 if ( result == QMessageBox::Yes )
83 { 84 {
84 if ( -1 == ::kill( dhcpid, SIGTERM ) ) 85 if ( -1 == ::kill( dhcpid, SIGTERM ) )
85 qWarning( "Wellenreiter: can't kill process #%d (%s)", result, strerror( errno ) ); 86 qWarning( "Wellenreiter: can't kill process #%d (%s)", result, strerror( errno ) );
86 else 87 else
87 killed = true; 88 killed = true;
88 } 89 }
89 } 90 }
90 } 91 }
91 92
92 a.exec(); 93 a.exec();
93 94
94 if ( check ) 95 if ( check )
95 { 96 {
96 97
97 if ( killed ) 98 if ( killed )
98 { 99 {
99 result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "Restart your dhcp client?" ), QMessageBox::Yes, QMessageBox::No ); 100 result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "Restart your dhcp client?" ), QMessageBox::Yes, QMessageBox::No );
100 if ( result == QMessageBox::Yes ) 101 if ( result == QMessageBox::Yes )
101 { 102 {
102 ::system( QString().sprintf( "dhclient &; udhcpcd &; dhcpcd &" ) ); 103 ::system( QString().sprintf( "dhclient &; udhcpcd &; dhcpcd &" ) );
103 } 104 }
104 } 105 }
105 106
106 delete w; 107 delete w;
107 } 108 }
108 return 0; 109 return 0;
109} 110}
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp
index 6f57a7f..5cc0daf 100644
--- a/noncore/net/wellenreiter/gui/mainwindow.cpp
+++ b/noncore/net/wellenreiter/gui/mainwindow.cpp
@@ -1,115 +1,115 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Wellenreiter II. 4** This file is part of Wellenreiter II.
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 "gps.h" 17#include "gps.h"
18#include "logwindow.h" 18#include "logwindow.h"
19#include "hexwindow.h" 19#include "packetview.h"
20#include "mainwindow.h" 20#include "mainwindow.h"
21#include "wellenreiter.h" 21#include "wellenreiter.h"
22#include "scanlist.h" 22#include "scanlist.h"
23 23
24#include <qcombobox.h> 24#include <qcombobox.h>
25#include <qdatastream.h> 25#include <qdatastream.h>
26#include <qfile.h> 26#include <qfile.h>
27#include <qfileinfo.h> 27#include <qfileinfo.h>
28#include <qlabel.h> 28#include <qlabel.h>
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qlineedit.h> 30#include <qlineedit.h>
31#include <qiconset.h> 31#include <qiconset.h>
32#include <qmenubar.h> 32#include <qmenubar.h>
33#include <qmessagebox.h> 33#include <qmessagebox.h>
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35#include <qpushbutton.h> 35#include <qpushbutton.h>
36#include <qstatusbar.h> 36#include <qstatusbar.h>
37#include <qspinbox.h> 37#include <qspinbox.h>
38#include <qtextstream.h> 38#include <qtextstream.h>
39#include <qtoolbutton.h> 39#include <qtoolbutton.h>
40#include <qwhatsthis.h> 40#include <qwhatsthis.h>
41 41
42#ifdef QWS 42#ifdef QWS
43#include <qpe/resource.h> 43#include <qpe/resource.h>
44#include <opie2/ofiledialog.h> 44#include <opie2/ofiledialog.h>
45using namespace Opie; 45using namespace Opie;
46#else 46#else
47#include "resource.h" 47#include "resource.h"
48#include <qapplication.h> 48#include <qapplication.h>
49#include <qfiledialog.h> 49#include <qfiledialog.h>
50#endif 50#endif
51 51
52#include <unistd.h> 52#include <unistd.h>
53 53
54WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) 54WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f )
55 :QMainWindow( parent, name, f ) 55 :QMainWindow( parent, name, f )
56{ 56{
57 cw = new WellenreiterConfigWindow( this ); 57 cw = new WellenreiterConfigWindow( this );
58 mw = new Wellenreiter( this ); 58 mw = new Wellenreiter( this );
59 mw->setConfigWindow( cw ); 59 mw->setConfigWindow( cw );
60 setCentralWidget( mw ); 60 setCentralWidget( mw );
61 61
62 // setup application icon 62 // setup application icon
63 63
64 setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); 64 setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) );
65 #ifndef QWS 65 #ifndef QWS
66 setIconText( "Wellenreiter/X11" ); 66 setIconText( "Wellenreiter/X11" );
67 #endif 67 #endif
68 68
69 // setup tool buttons 69 // setup tool buttons
70 70
71 startButton = new QToolButton( 0 ); 71 startButton = new QToolButton( 0 );
72 QWhatsThis::add( startButton, tr( "Click here to start scanning." ) ); 72 QWhatsThis::add( startButton, tr( "Click here to start scanning." ) );
73 #ifdef QWS 73 #ifdef QWS
74 startButton->setAutoRaise( true ); 74 startButton->setAutoRaise( true );
75 #endif 75 #endif
76 startButton->setIconSet( Resource::loadIconSet( "wellenreiter/SearchIcon" ) ); 76 startButton->setIconSet( Resource::loadIconSet( "wellenreiter/SearchIcon" ) );
77 startButton->setEnabled( false ); 77 startButton->setEnabled( false );
78 connect( startButton, SIGNAL( clicked() ), mw, SLOT( startClicked() ) ); 78 connect( startButton, SIGNAL( clicked() ), mw, SLOT( startClicked() ) );
79 79
80 stopButton = new QToolButton( 0 ); 80 stopButton = new QToolButton( 0 );
81 QWhatsThis::add( stopButton, tr( "Click here to stop scanning." ) ); 81 QWhatsThis::add( stopButton, tr( "Click here to stop scanning." ) );
82 #ifdef QWS 82 #ifdef QWS
83 stopButton->setAutoRaise( true ); 83 stopButton->setAutoRaise( true );
84 #endif 84 #endif
85 stopButton->setIconSet( Resource::loadIconSet( "wellenreiter/CancelIcon" ) ); 85 stopButton->setIconSet( Resource::loadIconSet( "wellenreiter/CancelIcon" ) );
86 stopButton->setEnabled( false ); 86 stopButton->setEnabled( false );
87 connect( stopButton, SIGNAL( clicked() ), mw, SLOT( stopClicked() ) ); 87 connect( stopButton, SIGNAL( clicked() ), mw, SLOT( stopClicked() ) );
88 88
89 QToolButton* d = new QToolButton( 0 ); 89 QToolButton* d = new QToolButton( 0 );
90 QWhatsThis::add( d, tr( "Click here to open the configure dialog." ) ), 90 QWhatsThis::add( d, tr( "Click here to open the configure dialog." ) ),
91 #ifdef QWS 91 #ifdef QWS
92 d->setAutoRaise( true ); 92 d->setAutoRaise( true );
93 #endif 93 #endif
94 d->setIconSet( Resource::loadIconSet( "wellenreiter/SettingsIcon" ) ); 94 d->setIconSet( Resource::loadIconSet( "wellenreiter/SettingsIcon" ) );
95 connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); 95 connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) );
96 96
97 uploadButton = new QToolButton( 0 ); 97 uploadButton = new QToolButton( 0 );
98 QWhatsThis::add( uploadButton, tr( "Click here to upload a capture session." ) ); 98 QWhatsThis::add( uploadButton, tr( "Click here to upload a capture session." ) );
99 #ifdef QWS 99 #ifdef QWS
100 uploadButton->setAutoRaise( true ); 100 uploadButton->setAutoRaise( true );
101 #endif 101 #endif
102 uploadButton->setIconSet( Resource::loadIconSet( "up" ) ); 102 uploadButton->setIconSet( Resource::loadIconSet( "up" ) );
103 uploadButton->setEnabled( false ); 103 uploadButton->setEnabled( false );
104 //uploadButton->setEnabled( true ); // DEBUGGING 104 //uploadButton->setEnabled( true ); // DEBUGGING
105 connect( uploadButton, SIGNAL( clicked() ), this, SLOT( uploadSession() ) ); 105 connect( uploadButton, SIGNAL( clicked() ), this, SLOT( uploadSession() ) );
106 106
107 // setup menu bar 107 // setup menu bar
108 108
109 int id; 109 int id;
110 110
111 QMenuBar* mb = menuBar(); 111 QMenuBar* mb = menuBar();
112 112
113 QPopupMenu* fileSave = new QPopupMenu( mb ); 113 QPopupMenu* fileSave = new QPopupMenu( mb );
114 fileSave->insertItem( tr( "&Session..." ), this, SLOT( fileSaveSession() ) ); 114 fileSave->insertItem( tr( "&Session..." ), this, SLOT( fileSaveSession() ) );
115 fileSave->insertItem( tr( "&Text Log..." ), this, SLOT( fileSaveLog() ) ); 115 fileSave->insertItem( tr( "&Text Log..." ), this, SLOT( fileSaveLog() ) );
@@ -239,208 +239,211 @@ void WellenreiterMainWindow::demoAddStations()
239 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:03:F8:E7:16:22"), false, 3, 10, GpsLocation( 5.5, 2.3 ) ); 239 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:03:F8:E7:16:22"), false, 3, 10, GpsLocation( 5.5, 2.3 ) );
240 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:04:01:E7:56:62"), false, 3, 15, GpsLocation( 2.3, 5.5 ) ); 240 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:04:01:E7:56:62"), false, 3, 15, GpsLocation( 2.3, 5.5 ) );
241 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:05:8E:E7:56:E2"), false, 3, 20, GpsLocation( -10.0, -20.5 ) ); 241 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:05:8E:E7:56:E2"), false, 3, 20, GpsLocation( -10.0, -20.5 ) );
242} 242}
243 243
244 244
245void WellenreiterMainWindow::demoReadFromGps() 245void WellenreiterMainWindow::demoReadFromGps()
246{ 246{
247 WellenreiterConfigWindow* configwindow = WellenreiterConfigWindow::instance(); 247 WellenreiterConfigWindow* configwindow = WellenreiterConfigWindow::instance();
248 GPS* gps = new GPS( this ); 248 GPS* gps = new GPS( this );
249 qDebug( "Wellenreiter::demoReadFromGps(): url=gps://%s:%d/", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); 249 qDebug( "Wellenreiter::demoReadFromGps(): url=gps://%s:%d/", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() );
250 gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); 250 gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() );
251 GpsLocation loc = gps->position(); 251 GpsLocation loc = gps->position();
252 QMessageBox::information( this, "Wellenreiter/Opie", tr( "GPS said:\n%1" ).arg( loc.dmsPosition() ) ); 252 QMessageBox::information( this, "Wellenreiter/Opie", tr( "GPS said:\n%1" ).arg( loc.dmsPosition() ) );
253 delete gps; 253 delete gps;
254} 254}
255 255
256 256
257QString WellenreiterMainWindow::getFileName( bool save ) 257QString WellenreiterMainWindow::getFileName( bool save )
258{ 258{
259 QMap<QString, QStringList> map; 259 QMap<QString, QStringList> map;
260 map.insert( tr("All"), QStringList() ); 260 map.insert( tr("All"), QStringList() );
261 QStringList text; 261 QStringList text;
262 text << "text/*"; 262 text << "text/*";
263 map.insert( tr("Text"), text ); 263 map.insert( tr("Text"), text );
264 text << "*"; 264 text << "*";
265 map.insert( tr("All"), text ); 265 map.insert( tr("All"), text );
266 266
267 QString str; 267 QString str;
268 if ( save ) 268 if ( save )
269 { 269 {
270 #ifdef QWS 270 #ifdef QWS
271 str = OFileDialog::getSaveFileName( 2, "/", QString::null, map ); 271 str = OFileDialog::getSaveFileName( 2, "/", QString::null, map );
272 #else 272 #else
273 str = QFileDialog::getSaveFileName(); 273 str = QFileDialog::getSaveFileName();
274 #endif 274 #endif
275 if ( str.isEmpty() /*|| QFileInfo(str).isDir()*/ ) 275 if ( str.isEmpty() /*|| QFileInfo(str).isDir()*/ )
276 return ""; 276 return "";
277 } 277 }
278 else 278 else
279 { 279 {
280 #ifdef QWS 280 #ifdef QWS
281 str = OFileDialog::getOpenFileName( 2, "/", QString::null, map ); 281 str = OFileDialog::getOpenFileName( 2, "/", QString::null, map );
282 #else 282 #else
283 str = QFileDialog::getOpenFileName(); 283 str = QFileDialog::getOpenFileName();
284 #endif 284 #endif
285 if ( str.isEmpty() || !QFile(str).exists() || QFileInfo(str).isDir() ) 285 if ( str.isEmpty() || !QFile(str).exists() || QFileInfo(str).isDir() )
286 return ""; 286 return "";
287 } 287 }
288 return str; 288 return str;
289} 289}
290 290
291 291
292void WellenreiterMainWindow::fileSaveLog() 292void WellenreiterMainWindow::fileSaveLog()
293{ 293{
294 QString fname = getFileName( true ); 294 QString fname = getFileName( true );
295 if ( !fname.isEmpty() ) 295 if ( !fname.isEmpty() )
296 { 296 {
297 QFile f( fname ); 297 QFile f( fname );
298 if ( f.open(IO_WriteOnly) ) 298 if ( f.open(IO_WriteOnly) )
299 { 299 {
300 QTextStream t( &f ); 300 QTextStream t( &f );
301 t << mw->logWindow()->getLog(); 301 t << mw->logWindow()->getLog();
302 f.close(); 302 f.close();
303 qDebug( "Saved log to file '%s'", (const char*) fname ); 303 qDebug( "Saved log to file '%s'", (const char*) fname );
304 } 304 }
305 else 305 else
306 { 306 {
307 qDebug( "Problem saving log to file '%s'", (const char*) fname ); 307 qDebug( "Problem saving log to file '%s'", (const char*) fname );
308 } 308 }
309 } 309 }
310} 310}
311 311
312void WellenreiterMainWindow::fileSaveSession() 312void WellenreiterMainWindow::fileSaveSession()
313{ 313{
314 QString fname = getFileName( true ); 314 QString fname = getFileName( true );
315 if ( !fname.isEmpty() ) 315 if ( !fname.isEmpty() )
316 { 316 {
317 317
318 QFile f( fname ); 318 QFile f( fname );
319 if ( f.open(IO_WriteOnly) ) 319 if ( f.open(IO_WriteOnly) )
320 { 320 {
321 QDataStream t( &f ); 321 QDataStream t( &f );
322 t << *mw->netView(); 322 t << *mw->netView();
323 f.close(); 323 f.close();
324 qDebug( "Saved session to file '%s'", (const char*) fname ); 324 qDebug( "Saved session to file '%s'", (const char*) fname );
325 } 325 }
326 else 326 else
327 { 327 {
328 qDebug( "Problem saving session to file '%s'", (const char*) fname ); 328 qDebug( "Problem saving session to file '%s'", (const char*) fname );
329 } 329 }
330 } 330 }
331} 331}
332 332
333void WellenreiterMainWindow::fileSaveHex() 333void WellenreiterMainWindow::fileSaveHex()
334{ 334{
335 #warning DOES NOT WORK AT THE MOMENT
336 /*
335 QString fname = getFileName( true ); 337 QString fname = getFileName( true );
336 if ( !fname.isEmpty() ) 338 if ( !fname.isEmpty() )
337 { 339 {
338 QFile f( fname ); 340 QFile f( fname );
339 if ( f.open(IO_WriteOnly) ) 341 if ( f.open(IO_WriteOnly) )
340 { 342 {
341 QTextStream t( &f ); 343 QTextStream t( &f );
342 t << mw->hexWindow()->getLog(); 344 t << mw->hexWindow()->getLog();
343 f.close(); 345 f.close();
344 qDebug( "Saved hex log to file '%s'", (const char*) fname ); 346 qDebug( "Saved hex log to file '%s'", (const char*) fname );
345 } 347 }
346 else 348 else
347 { 349 {
348 qDebug( "Problem saving hex log to file '%s'", (const char*) fname ); 350 qDebug( "Problem saving hex log to file '%s'", (const char*) fname );
349 } 351 }
350 } 352 }
353 */
351} 354}
352 355
353void WellenreiterMainWindow::fileLoadSession() 356void WellenreiterMainWindow::fileLoadSession()
354{ 357{
355 QString fname = getFileName( false ); 358 QString fname = getFileName( false );
356 if ( !fname.isEmpty() ) 359 if ( !fname.isEmpty() )
357 { 360 {
358 QFile f( fname ); 361 QFile f( fname );
359 if ( f.open(IO_ReadOnly) ) 362 if ( f.open(IO_ReadOnly) )
360 { 363 {
361 QDataStream t( &f ); 364 QDataStream t( &f );
362 t >> *mw->netView(); 365 t >> *mw->netView();
363 f.close(); 366 f.close();
364 qDebug( "Loaded session from file '%s'", (const char*) fname ); 367 qDebug( "Loaded session from file '%s'", (const char*) fname );
365 } 368 }
366 else 369 else
367 { 370 {
368 qDebug( "Problem loading session from file '%s'", (const char*) fname ); 371 qDebug( "Problem loading session from file '%s'", (const char*) fname );
369 } 372 }
370 } 373 }
371} 374}
372 375
373 376
374void WellenreiterMainWindow::fileNew() 377void WellenreiterMainWindow::fileNew()
375{ 378{
376 mw->netView()->clear(); 379 mw->netView()->clear();
377 mw->logWindow()->clear(); 380 mw->logWindow()->clear();
378 mw->hexWindow()->clear(); 381 mw->hexWindow()->clear();
379} 382}
380 383
381 384
382void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) 385void WellenreiterMainWindow::closeEvent( QCloseEvent* e )
383{ 386{
384 if ( mw->isDaemonRunning() ) 387 if ( mw->isDaemonRunning() )
385 { 388 {
386 QMessageBox::warning( this, "Wellenreiter/Opie", 389 QMessageBox::warning( this, "Wellenreiter/Opie",
387 tr( "Sniffing in progress!\nPlease stop sniffing before closing." ) ); 390 tr( "Sniffing in progress!\nPlease stop sniffing before closing." ) );
388 e->ignore(); 391 e->ignore();
389 } 392 }
390 else 393 else
391 { 394 {
392 QMainWindow::closeEvent( e ); 395 QMainWindow::closeEvent( e );
393 } 396 }
394} 397}
395 398
396static const char* CAP_hostname = "www.vanille.de"; 399static const char* CAP_hostname = "www.vanille.de";
397 400
398#include <netdb.h> 401#include <netdb.h>
399#include <unistd.h> 402#include <unistd.h>
400#include <sys/types.h> 403#include <sys/types.h>
401#include <sys/socket.h> 404#include <sys/socket.h>
402 405
403void WellenreiterMainWindow::uploadSession() 406void WellenreiterMainWindow::uploadSession()
404{ 407{
405 QLineEdit* from; 408 QLineEdit* from;
406 QLineEdit* location; 409 QLineEdit* location;
407 QLineEdit* comments; 410 QLineEdit* comments;
408 QPushButton* accept; 411 QPushButton* accept;
409 QPushButton* reject; 412 QPushButton* reject;
410 413
411 QDialog* d = new QDialog( 0, "session upload", true ); 414 QDialog* d = new QDialog( 0, "session upload", true );
412 d->setCaption( tr( "Upload Session" ) ); 415 d->setCaption( tr( "Upload Session" ) );
413 QGridLayout* g = new QGridLayout( d, 4, 2, 3 ); 416 QGridLayout* g = new QGridLayout( d, 4, 2, 3 );
414 g->addWidget( new QLabel( tr( "From: " ), d ), 0, 0 ); 417 g->addWidget( new QLabel( tr( "From: " ), d ), 0, 0 );
415 g->addWidget( from = new QLineEdit( d ), 0, 1 ); 418 g->addWidget( from = new QLineEdit( d ), 0, 1 );
416 g->addWidget( new QLabel( tr( "Location: " ), d ), 1, 0 ); 419 g->addWidget( new QLabel( tr( "Location: " ), d ), 1, 0 );
417 g->addWidget( location = new QLineEdit( d ), 1, 1 ); 420 g->addWidget( location = new QLineEdit( d ), 1, 1 );
418 g->addWidget( new QLabel( tr( "Comments: " ), d ), 2, 0 ); 421 g->addWidget( new QLabel( tr( "Comments: " ), d ), 2, 0 );
419 g->addWidget( comments = new QLineEdit( d ), 2, 1 ); 422 g->addWidget( comments = new QLineEdit( d ), 2, 1 );
420 g->addWidget( accept = new QPushButton( tr( "&Ok" ), d ), 3, 0 ); 423 g->addWidget( accept = new QPushButton( tr( "&Ok" ), d ), 3, 0 );
421 g->addWidget( reject = new QPushButton( tr( "&Cancel" ), d ), 3, 1 ); 424 g->addWidget( reject = new QPushButton( tr( "&Cancel" ), d ), 3, 1 );
422 accept->setDefault( true ); 425 accept->setDefault( true );
423 accept->setAutoDefault( true ); 426 accept->setAutoDefault( true );
424 from->setText( "WL II User" ); 427 from->setText( "WL II User" );
425 location->setText( "WL II Location" ); 428 location->setText( "WL II Location" );
426 comments->setText( "No Comments." ); 429 comments->setText( "No Comments." );
427 connect( accept, SIGNAL( clicked() ), d, SLOT( accept() ) ); 430 connect( accept, SIGNAL( clicked() ), d, SLOT( accept() ) );
428 connect( reject, SIGNAL( clicked() ), d, SLOT( reject() ) ); 431 connect( reject, SIGNAL( clicked() ), d, SLOT( reject() ) );
429 int result = d->exec(); 432 int result = d->exec();
430 433
431 if ( !result ) 434 if ( !result )
432 { 435 {
433 qDebug( "Session upload cancelled :(" ); 436 qDebug( "Session upload cancelled :(" );
434 return; 437 return;
435 } 438 }
436 439
437 qDebug( "Starting upload..." ); 440 qDebug( "Starting upload..." );
438 441
439 struct sockaddr_in raddr; 442 struct sockaddr_in raddr;
440 struct hostent *rhost_info; 443 struct hostent *rhost_info;
441 int sock = -1; 444 int sock = -1;
442 bool ok = false; 445 bool ok = false;
443 446
444 rhost_info = (struct hostent *) ::gethostbyname( CAP_hostname ); 447 rhost_info = (struct hostent *) ::gethostbyname( CAP_hostname );
445 if ( rhost_info ) 448 if ( rhost_info )
446 { 449 {
diff --git a/noncore/net/wellenreiter/gui/packetview.cpp b/noncore/net/wellenreiter/gui/packetview.cpp
index e986b49..ef5d020 100644
--- a/noncore/net/wellenreiter/gui/packetview.cpp
+++ b/noncore/net/wellenreiter/gui/packetview.cpp
@@ -1,44 +1,68 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Wellenreiter II. 4** This file is part of Wellenreiter II.
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 "packetview.h" 16#include "packetview.h"
17#include <qmultilineedit.h> 17
18/* OPIE */
19#include <opie2/opcap.h>
20
21/* QT */
22#include <qtextview.h>
23#include <qspinbox.h>
24#include <qlabel.h>
25#include <qlayout.h>
26#include <qlist.h>
18 27
19PacketView::PacketView( QWidget * parent, const char * name, WFlags f ) 28PacketView::PacketView( QWidget * parent, const char * name, WFlags f )
20 :QVBox( parent, name, f ) 29 :QFrame( parent, name, f )
21{ 30{
22 ledit = new QMultiLineEdit( this ); 31 _number = new QSpinBox( this );
23 ledit->setFont( QFont( "fixed", 10 ) ); 32 _number->setPrefix( "Packet # " );
24 ledit->setReadOnly( true ); 33 _label = new QLabel( this );
34 _label->setText( "eth0 2004/03/08 - 00:00:21" );
35 _list = new QLabel( this );
36 _hex = new QTextView( this );
37
38 QVBoxLayout* vb = new QVBoxLayout( this, 2, 2 );
39 QHBoxLayout* hb = new QHBoxLayout( vb, 2 );
40 hb->addWidget( _label );
41 hb->addWidget( _number );
42 vb->addWidget( _list );
43 vb->addWidget( _hex );
44
45 _packets.setAutoDelete( true );
46
47 _list->setText( "<b>[ 802.11 [ LLC [ IP [ UDP [ DHCP ] ] ] ] ]</b>" );
25}; 48};
26 49
27void PacketView::log( const QString& text ) 50void PacketView::add( OPacket* p )
28{ 51{
29 int col; 52 _packets.append( p );
30 int row;
31 ledit->getCursorPosition( &col, &row );
32 ledit->insertAt( text, col, row );
33}; 53};
34 54
35const QString PacketView::getLog() const 55const QString PacketView::getLog() const
36{ 56{
37 return ledit->text();
38} 57}
39 58
40void PacketView::clear() 59void PacketView::clear()
41{ 60{
42 ledit->clear(); 61 _packets.clear();
62 _number->setMinValue( 0 );
63 _number->setMaxValue( 0 );
64 _label->setText( "---" );
65 _list->setText( " <b>-- no Packet available --</b> " );
66 _hex->setText( " <i>-- no Packet available --</i> " );
43} 67}
44 68
diff --git a/noncore/net/wellenreiter/gui/packetview.h b/noncore/net/wellenreiter/gui/packetview.h
index ee3cf3a..b5f2b26 100644
--- a/noncore/net/wellenreiter/gui/packetview.h
+++ b/noncore/net/wellenreiter/gui/packetview.h
@@ -1,40 +1,49 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Wellenreiter II. 4** This file is part of Wellenreiter II.
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 PACKETVIEW_H 16#ifndef PACKETVIEW_H
17#define PACKETVIEW_H 17#define PACKETVIEW_H
18 18
19#include <qvbox.h> 19#include <qlist.h>
20#include <qframe.h>
20 21
21class QString; 22class QString;
22class QMultiLineEdit; 23class QSpinBox;
24class QLabel;
25class QTextView;
26class OPacket;
23 27
24class PacketView: public QVBox 28class PacketView: public QFrame
25{ 29{
26 30
27 public: 31 public:
28 PacketView( QWidget * parent = 0, const char * name = "PacketView", WFlags f = 0 ); 32 PacketView( QWidget * parent = 0, const char * name = "PacketView", WFlags f = 0 );
29 33
30 void log( const QString& text ); 34 void add( OPacket* p );
31 const QString getLog() const; 35 const QString getLog() const;
32 void clear(); 36 void clear();
33 37
34 protected: 38 protected:
35 QMultiLineEdit* ledit; 39
40 QSpinBox* _number;
41 QLabel* _label;
42 QLabel* _list;
43 QTextView* _hex;
44 QList<OPacket> _packets;
36 45
37}; 46};
38 47
39#endif 48#endif
40 49
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 67e3940..ce416e5 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -1,116 +1,116 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file may be distributed and/or modified under the terms of the 4** This file may be distributed and/or modified under the terms of the
5** GNU General Public License version 2 as published by the Free Software 5** GNU General Public License version 2 as published by the Free Software
6** Foundation and appearing in the file LICENSE.GPL included in the 6** Foundation and appearing in the file LICENSE.GPL included in the
7** packaging of this file. 7** packaging of this file.
8** 8**
9** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 9** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 10** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11** 11**
12***********************************************************************/ 12***********************************************************************/
13 13
14// Local 14// Local
15 15
16#include "gps.h" 16#include "gps.h"
17#include "wellenreiter.h" 17#include "wellenreiter.h"
18#include "scanlist.h" 18#include "scanlist.h"
19#include "logwindow.h" 19#include "logwindow.h"
20#include "hexwindow.h" 20#include "packetview.h"
21#include "configwindow.h" 21#include "configwindow.h"
22#include "statwindow.h" 22#include "statwindow.h"
23#include "graphwindow.h" 23#include "graphwindow.h"
24#include "protolistview.h" 24#include "protolistview.h"
25 25
26// Opie 26// Opie
27 27
28#ifdef QWS 28#ifdef QWS
29#include <opie2/oapplication.h> 29#include <opie2/oapplication.h>
30#include <opie2/odevice.h> 30#include <opie2/odevice.h>
31#else 31#else
32#include <qapplication.h> 32#include <qapplication.h>
33#endif 33#endif
34#include <opie2/omanufacturerdb.h> 34#include <opie2/omanufacturerdb.h>
35#include <opie2/onetwork.h> 35#include <opie2/onetwork.h>
36#include <opie2/opcap.h> 36#include <opie2/opcap.h>
37#include <qpe/qcopenvelope_qws.h> 37#include <qpe/qcopenvelope_qws.h>
38using namespace Opie; 38using namespace Opie;
39 39
40// Qt 40// Qt
41 41
42#include <qcheckbox.h> 42#include <qcheckbox.h>
43#include <qcombobox.h> 43#include <qcombobox.h>
44#include <qdatetime.h> 44#include <qdatetime.h>
45#include <qpushbutton.h> 45#include <qpushbutton.h>
46#include <qlineedit.h> 46#include <qlineedit.h>
47#include <qmessagebox.h> 47#include <qmessagebox.h>
48#include <qobjectlist.h> 48#include <qobjectlist.h>
49#include <qregexp.h> 49#include <qregexp.h>
50#include <qspinbox.h> 50#include <qspinbox.h>
51#include <qtimer.h> 51#include <qtimer.h>
52#include <qtoolbutton.h> 52#include <qtoolbutton.h>
53#include <qmainwindow.h> 53#include <qmainwindow.h>
54 54
55// Standard 55// Standard
56 56
57#include <assert.h> 57#include <assert.h>
58#include <errno.h> 58#include <errno.h>
59#include <unistd.h> 59#include <unistd.h>
60#include <string.h> 60#include <string.h>
61#include <sys/types.h> 61#include <sys/types.h>
62#include <stdlib.h> 62#include <stdlib.h>
63 63
64Wellenreiter::Wellenreiter( QWidget* parent ) 64Wellenreiter::Wellenreiter( QWidget* parent )
65 : WellenreiterBase( parent, 0, 0 ), 65 : WellenreiterBase( parent, 0, 0 ),
66 sniffing( false ), iface( 0 ), configwindow( 0 ) 66 sniffing( false ), iface( 0 ), configwindow( 0 )
67{ 67{
68 68
69 logwindow->log( "(i) Wellenreiter has been started." ); 69 logwindow->log( "(i) Wellenreiter has been started." );
70 70
71 // 71 //
72 // detect operating system 72 // detect operating system
73 // 73 //
74 74
75 #ifdef QWS 75 #ifdef QWS
76 QString sys; 76 QString sys;
77 sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); 77 sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() );
78 _system = ODevice::inst()->system(); 78 _system = ODevice::inst()->system();
79 logwindow->log( sys ); 79 logwindow->log( sys );
80 #endif 80 #endif
81 81
82 netview->setColumnWidthMode( 1, QListView::Manual ); 82 netview->setColumnWidthMode( 1, QListView::Manual );
83 connect( netview, SIGNAL( joinNetwork(const QString&,const QString&,int,const QString&) ), 83 connect( netview, SIGNAL( joinNetwork(const QString&,const QString&,int,const QString&) ),
84 this, SLOT( joinNetwork(const QString&,const QString&,int,const QString&) ) ); 84 this, SLOT( joinNetwork(const QString&,const QString&,int,const QString&) ) );
85 pcap = new OPacketCapturer(); 85 pcap = new OPacketCapturer();
86 86
87 gps = new GPS( this ); 87 gps = new GPS( this );
88 88
89 QTimer::singleShot( 1000, this, SLOT( initialTimer() ) ); 89 QTimer::singleShot( 1000, this, SLOT( initialTimer() ) );
90 90
91} 91}
92 92
93 93
94Wellenreiter::~Wellenreiter() 94Wellenreiter::~Wellenreiter()
95{ 95{
96 delete pcap; 96 delete pcap;
97} 97}
98 98
99 99
100void Wellenreiter::initialTimer() 100void Wellenreiter::initialTimer()
101{ 101{
102 qDebug( "Wellenreiter::preloading manufacturer database..." ); 102 qDebug( "Wellenreiter::preloading manufacturer database..." );
103 OManufacturerDB::instance(); 103 OManufacturerDB::instance();
104} 104}
105 105
106 106
107void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) 107void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw )
108{ 108{
109 configwindow = cw; 109 configwindow = cw;
110} 110}
111 111
112 112
113void Wellenreiter::channelHopped(int c) 113void Wellenreiter::channelHopped(int c)
114{ 114{
115 QString title = "Wellenreiter II -scan- ["; 115 QString title = "Wellenreiter II -scan- [";
116 QString left; 116 QString left;
@@ -287,193 +287,193 @@ void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAd
287{ 287{
288 from = data->sourceAddress(); 288 from = data->sourceAddress();
289 to = data->destinationAddress(); 289 to = data->destinationAddress();
290 290
291 netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( -111, -111 ) ); 291 netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( -111, -111 ) );
292} 292}
293 293
294 294
295void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest ) 295void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest )
296{ 296{
297 OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); 297 OARPPacket* arp = (OARPPacket*) p->child( "ARP" );
298 if ( arp ) 298 if ( arp )
299 { 299 {
300 qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() ); 300 qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() );
301 if ( arp->type() == "REQUEST" ) 301 if ( arp->type() == "REQUEST" )
302 { 302 {
303 netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); 303 netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() );
304 } 304 }
305 else if ( arp->type() == "REPLY" ) 305 else if ( arp->type() == "REPLY" )
306 { 306 {
307 netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); 307 netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() );
308 netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() ); 308 netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() );
309 } 309 }
310 } 310 }
311} 311}
312 312
313 313
314void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, OMacAddress& dest ) 314void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, OMacAddress& dest )
315{ 315{
316 //TODO: Implement more IP based protocols 316 //TODO: Implement more IP based protocols
317 317
318 ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" ); 318 ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" );
319 if ( dhcp ) 319 if ( dhcp )
320 { 320 {
321 qDebug( "Received DHCP '%s' packet", (const char*) dhcp->type() ); 321 qDebug( "Received DHCP '%s' packet", (const char*) dhcp->type() );
322 if ( dhcp->type() == "OFFER" ) 322 if ( dhcp->type() == "OFFER" )
323 { 323 {
324 qDebug( "DHCP: '%s' ('%s') seems to be a DHCP server.", (const char*) source.toString(), (const char*) dhcp->serverAddress().toString() ); 324 qDebug( "DHCP: '%s' ('%s') seems to be a DHCP server.", (const char*) source.toString(), (const char*) dhcp->serverAddress().toString() );
325 netView()->identify( source, dhcp->serverAddress().toString() ); 325 netView()->identify( source, dhcp->serverAddress().toString() );
326 netView()->addService( "DHCP", source, dhcp->serverAddress().toString() ); 326 netView()->addService( "DHCP", source, dhcp->serverAddress().toString() );
327 } 327 }
328 else if ( dhcp->type() == "ACK" ) 328 else if ( dhcp->type() == "ACK" )
329 { 329 {
330 qDebug( "DHCP: '%s' ('%s') accepted the offered DHCP address.", (const char*) dhcp->clientMacAddress().toString(), (const char*) dhcp->yourAddress().toString() ); 330 qDebug( "DHCP: '%s' ('%s') accepted the offered DHCP address.", (const char*) dhcp->clientMacAddress().toString(), (const char*) dhcp->yourAddress().toString() );
331 netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() ); 331 netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() );
332 } 332 }
333 } 333 }
334} 334}
335 335
336 336
337QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol ) 337QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol )
338{ 338{
339 if ( configwindow->parsePackets->isProtocolChecked( protocol ) ) 339 if ( configwindow->parsePackets->isProtocolChecked( protocol ) )
340 if ( configwindow->parsePackets->protocolAction( protocol ) == "Discard!" ) 340 if ( configwindow->parsePackets->protocolAction( protocol ) == "Discard!" )
341 return 0; 341 return 0;
342 342
343 return p->child( protocol ); 343 return p->child( protocol );
344} 344}
345 345
346 346
347bool Wellenreiter::checkDumpPacket( OPacket* p ) 347bool Wellenreiter::checkDumpPacket( OPacket* p )
348{ 348{
349 // go through all child packets and see if one is inside the child hierarchy for p 349 // go through all child packets and see if one is inside the child hierarchy for p
350 // if so, do what the user requested (protocolAction), e.g. pass or discard 350 // if so, do what the user requested (protocolAction), e.g. pass or discard
351 if ( !configwindow->writeCaptureFile->isChecked() ) 351 if ( !configwindow->writeCaptureFile->isChecked() )
352 return true; // semantic change - we're logging anyway now to /tmp/wellenreiter 352 return true; // semantic change - we're logging anyway now to /tmp/wellenreiter
353 353
354 QObjectList* l = p->queryList(); 354 QObjectList* l = p->queryList();
355 QObjectListIt it( *l ); 355 QObjectListIt it( *l );
356 QObject* o; 356 QObject* o;
357 357
358 while ( (o = it.current()) != 0 ) 358 while ( (o = it.current()) != 0 )
359 { 359 {
360 QString name = it.current()->name(); 360 QString name = it.current()->name();
361 if ( configwindow->capturePackets->isProtocolChecked( name ) ) 361 if ( configwindow->capturePackets->isProtocolChecked( name ) )
362 { 362 {
363 QString action = configwindow->capturePackets->protocolAction( name ); 363 QString action = configwindow->capturePackets->protocolAction( name );
364 qDebug( "capturePackets-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); 364 qDebug( "capturePackets-action for '%s' seems to be '%s'", (const char*) name, (const char*) action );
365 if ( action == "Discard" ) 365 if ( action == "Discard" )
366 { 366 {
367 logwindow->log( QString().sprintf( "(i) dump-discarding of '%s' packet requested.", (const char*) name ) ); 367 logwindow->log( QString().sprintf( "(i) dump-discarding of '%s' packet requested.", (const char*) name ) );
368 return false; 368 return false;
369 } 369 }
370 } 370 }
371 else 371 else
372 { 372 {
373 qDebug( "protocol '%s' not checked in capturePackets.", (const char*) name ); 373 qDebug( "protocol '%s' not checked in capturePackets.", (const char*) name );
374 } 374 }
375 ++it; 375 ++it;
376 } 376 }
377 return true; 377 return true;
378} 378}
379 379
380 380
381void Wellenreiter::receivePacket( OPacket* p ) 381void Wellenreiter::receivePacket( OPacket* p )
382{ 382{
383 hexWindow()->log( p->dump( 8 ) ); 383 hexWindow()->add( p );
384 384
385 if ( checkDumpPacket( p ) ) 385 if ( checkDumpPacket( p ) )
386 { 386 {
387 pcap->dump( p ); 387 pcap->dump( p );
388 } 388 }
389 389
390 // check for a management frame 390 // check for a management frame
391 OWaveLanManagementPacket* manage = static_cast<OWaveLanManagementPacket*>( childIfToParse( p, "802.11 Management" ) ); 391 OWaveLanManagementPacket* manage = static_cast<OWaveLanManagementPacket*>( childIfToParse( p, "802.11 Management" ) );
392 if ( manage ) 392 if ( manage )
393 { 393 {
394 handleManagementFrame( p, manage ); 394 handleManagementFrame( p, manage );
395 return; 395 return;
396 } 396 }
397 397
398 // check for a control frame 398 // check for a control frame
399 OWaveLanControlPacket* control = static_cast<OWaveLanControlPacket*>( childIfToParse( p, "802.11 Control" ) ); 399 OWaveLanControlPacket* control = static_cast<OWaveLanControlPacket*>( childIfToParse( p, "802.11 Control" ) );
400 if ( control ) 400 if ( control )
401 { 401 {
402 handleControlFrame( p, control ); 402 handleControlFrame( p, control );
403 return; 403 return;
404 } 404 }
405 405
406 OMacAddress source; 406 OMacAddress source;
407 OMacAddress dest; 407 OMacAddress dest;
408 408
409 //TODO: WEP check here 409 //TODO: WEP check here
410 410
411 // check for a wireless data frame 411 // check for a wireless data frame
412 OWaveLanDataPacket* wlan = static_cast<OWaveLanDataPacket*>( childIfToParse( p, "802.11 Data" ) ); 412 OWaveLanDataPacket* wlan = static_cast<OWaveLanDataPacket*>( childIfToParse( p, "802.11 Data" ) );
413 if ( wlan ) 413 if ( wlan )
414 { 414 {
415 handleWlanData( p, wlan, source, dest ); 415 handleWlanData( p, wlan, source, dest );
416 } 416 }
417 417
418 // check for a wired data frame 418 // check for a wired data frame
419 OEthernetPacket* eth = static_cast<OEthernetPacket*>( childIfToParse( p, "Ethernet" ) ); 419 OEthernetPacket* eth = static_cast<OEthernetPacket*>( childIfToParse( p, "Ethernet" ) );
420 if ( eth ) 420 if ( eth )
421 { 421 {
422 handleEthernetData( p, eth, source, dest ); 422 handleEthernetData( p, eth, source, dest );
423 } 423 }
424 424
425 // check for an arp frame since arp frames come in two flavours: 425 // check for an arp frame since arp frames come in two flavours:
426 // 802.11 encapsulates ARP data within IP packets while wired ethernet doesn't. 426 // 802.11 encapsulates ARP data within IP packets while wired ethernet doesn't.
427 OARPPacket* arp = static_cast<OARPPacket*>( childIfToParse( p, "ARP" ) ); 427 OARPPacket* arp = static_cast<OARPPacket*>( childIfToParse( p, "ARP" ) );
428 if ( arp ) 428 if ( arp )
429 { 429 {
430 handleARPData( p, arp, source, dest ); 430 handleARPData( p, arp, source, dest );
431 } 431 }
432 432
433 // check for a ip frame 433 // check for a ip frame
434 OIPPacket* ip = static_cast<OIPPacket*>( childIfToParse( p, "IP" ) ); 434 OIPPacket* ip = static_cast<OIPPacket*>( childIfToParse( p, "IP" ) );
435 if ( ip ) 435 if ( ip )
436 { 436 {
437 handleIPData( p, ip, source, dest ); 437 handleIPData( p, ip, source, dest );
438 } 438 }
439 439
440 //handleNotification( p ); 440 //handleNotification( p );
441 441
442} 442}
443 443
444 444
445void Wellenreiter::stopClicked() 445void Wellenreiter::stopClicked()
446{ 446{
447 if ( iface ) 447 if ( iface )
448 { 448 {
449 disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); 449 disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
450 disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); 450 disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) );
451 iface->setChannelHopping(); // stop hopping channels 451 iface->setChannelHopping(); // stop hopping channels
452 } 452 }
453 else 453 else
454 killTimers(); 454 killTimers();
455 455
456 pcap->close(); 456 pcap->close();
457 sniffing = false; 457 sniffing = false;
458 458
459 if ( iface ) 459 if ( iface )
460 { 460 {
461 // switch off monitor mode 461 // switch off monitor mode
462 iface->setMode( "managed" ); 462 iface->setMode( "managed" );
463 // switch off promisc flag 463 // switch off promisc flag
464 iface->setPromiscuousMode( false ); 464 iface->setPromiscuousMode( false );
465 465
466 system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess 466 system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess
467 } 467 }
468 468
469 logwindow->log( "(i) Stopped Scanning." ); 469 logwindow->log( "(i) Stopped Scanning." );
470 assert( parent() ); 470 assert( parent() );
471 ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); 471 ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" );
472 472
473 // message the user 473 // message the user
474 QMessageBox::information( this, "Wellenreiter II", 474 QMessageBox::information( this, "Wellenreiter II",
475 tr( "Your wireless card\nshould now be usable again." ) ); 475 tr( "Your wireless card\nshould now be usable again." ) );
476 476
477 sniffing = false; 477 sniffing = false;
478 emit( stoppedSniffing() ); 478 emit( stoppedSniffing() );
479 479
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h
index 745486f..d02813b 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.h
+++ b/noncore/net/wellenreiter/gui/wellenreiter.h
@@ -1,107 +1,107 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file may be distributed and/or modified under the terms of the 4** This file may be distributed and/or modified under the terms of the
5** GNU General Public License version 2 as published by the Free Software 5** GNU General Public License version 2 as published by the Free Software
6** Foundation and appearing in the file LICENSE.GPL included in the 6** Foundation and appearing in the file LICENSE.GPL included in the
7** packaging of this file. 7** packaging of this file.
8** 8**
9** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 9** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 10** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11** 11**
12**********************************************************************/ 12**********************************************************************/
13 13
14#ifndef WELLENREITER_H 14#ifndef WELLENREITER_H
15#define WELLENREITER_H 15#define WELLENREITER_H
16 16
17#include "wellenreiterbase.h" 17#include "wellenreiterbase.h"
18 18
19#ifdef QWS 19#ifdef QWS
20#include <opie2/odevice.h> 20#include <opie2/odevice.h>
21using namespace Opie; 21using namespace Opie;
22#endif 22#endif
23 23
24class QTimerEvent; 24class QTimerEvent;
25class QPixmap; 25class QPixmap;
26class OPacket; 26class OPacket;
27class OWaveLanManagementPacket; 27class OWaveLanManagementPacket;
28class OWaveLanControlPacket; 28class OWaveLanControlPacket;
29class OWaveLanDataPacket; 29class OWaveLanDataPacket;
30class OEthernetPacket; 30class OEthernetPacket;
31class OARPPacket; 31class OARPPacket;
32class OMacAddress; 32class OMacAddress;
33class OIPPacket; 33class OIPPacket;
34class OPacketCapturer; 34class OPacketCapturer;
35class OWirelessNetworkInterface; 35class OWirelessNetworkInterface;
36class PacketView;
36class WellenreiterConfigWindow; 37class WellenreiterConfigWindow;
37class MLogWindow; 38class MLogWindow;
38class MHexWindow;
39class GPS; 39class GPS;
40 40
41class Wellenreiter : public WellenreiterBase { 41class Wellenreiter : public WellenreiterBase {
42 Q_OBJECT 42 Q_OBJECT
43 43
44 public: 44 public:
45 Wellenreiter( QWidget* parent = 0 ); 45 Wellenreiter( QWidget* parent = 0 );
46 ~Wellenreiter(); 46 ~Wellenreiter();
47 47
48 void setConfigWindow( WellenreiterConfigWindow* cw ); 48 void setConfigWindow( WellenreiterConfigWindow* cw );
49 MScanListView* netView() const { return netview; }; 49 MScanListView* netView() const { return netview; };
50 MLogWindow* logWindow() const { return logwindow; }; 50 MLogWindow* logWindow() const { return logwindow; };
51 MHexWindow* hexWindow() const { return hexwindow; }; 51 PacketView* hexWindow() const { return hexwindow; };
52 bool isDaemonRunning() const { return sniffing; }; 52 bool isDaemonRunning() const { return sniffing; };
53 QString captureFileName() const { return dumpname; }; 53 QString captureFileName() const { return dumpname; };
54 54
55 public: 55 public:
56 bool sniffing; 56 bool sniffing;
57 57
58 protected: 58 protected:
59 virtual void timerEvent( QTimerEvent* ); 59 virtual void timerEvent( QTimerEvent* );
60 60
61 public slots: 61 public slots:
62 void initialTimer(); 62 void initialTimer();
63 63
64 void channelHopped(int); 64 void channelHopped(int);
65 void receivePacket(OPacket*); 65 void receivePacket(OPacket*);
66 void startClicked(); 66 void startClicked();
67 void stopClicked(); 67 void stopClicked();
68 68
69 void joinNetwork(const QString&,const QString&,int,const QString&); 69 void joinNetwork(const QString&,const QString&,int,const QString&);
70 70
71 signals: 71 signals:
72 void startedSniffing(); 72 void startedSniffing();
73 void stoppedSniffing(); 73 void stoppedSniffing();
74 74
75 private: 75 private:
76 void handleManagementFrame( OPacket* p, OWaveLanManagementPacket* ); 76 void handleManagementFrame( OPacket* p, OWaveLanManagementPacket* );
77 void handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPacket* ); 77 void handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPacket* );
78 void handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* ); 78 void handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* );
79 void handleManagementFrameProbeResponse( OPacket* p, OWaveLanManagementPacket* ); 79 void handleManagementFrameProbeResponse( OPacket* p, OWaveLanManagementPacket* );
80 void handleControlFrame( OPacket* p, OWaveLanControlPacket* control ); 80 void handleControlFrame( OPacket* p, OWaveLanControlPacket* control );
81 void handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ); 81 void handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to );
82 void handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ); 82 void handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to );
83 void handleARPData( OPacket* p, OARPPacket* arp, OMacAddress& from, OMacAddress& to ); 83 void handleARPData( OPacket* p, OARPPacket* arp, OMacAddress& from, OMacAddress& to );
84 void handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& from, OMacAddress& to ); 84 void handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& from, OMacAddress& to );
85 void handleNotification( OPacket* p ); 85 void handleNotification( OPacket* p );
86 void doAction( const QString& action, const QString& protocol, OPacket* p ); 86 void doAction( const QString& action, const QString& protocol, OPacket* p );
87 QObject* childIfToParse( OPacket* p, const QString& protocol ); 87 QObject* childIfToParse( OPacket* p, const QString& protocol );
88 bool checkDumpPacket( OPacket* p ); 88 bool checkDumpPacket( OPacket* p );
89 89
90 private: 90 private:
91 #ifdef QWS 91 #ifdef QWS
92 OSystem _system; // Opie Operating System identifier 92 OSystem _system; // Opie Operating System identifier
93 #endif 93 #endif
94 94
95 QString dumpname; 95 QString dumpname;
96 OWirelessNetworkInterface* iface; 96 OWirelessNetworkInterface* iface;
97 OPacketCapturer* pcap; 97 OPacketCapturer* pcap;
98 WellenreiterConfigWindow* configwindow; 98 WellenreiterConfigWindow* configwindow;
99 GPS* gps; 99 GPS* gps;
100 100
101 //void readConfig(); 101 //void readConfig();
102 //void writeConfig(); 102 //void writeConfig();
103}; 103};
104 104
105 105
106 106
107#endif 107#endif
diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
index f57dba2..3d0595d 100644
--- a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
@@ -1,177 +1,177 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Wellenreiter II. 4** This file is part of Wellenreiter II.
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 <qlabel.h> 18#include <qlabel.h>
19#include <qlayout.h> 19#include <qlayout.h>
20 20
21#include "logwindow.h" 21#include "logwindow.h"
22#include "hexwindow.h" 22#include "packetview.h"
23#include "scanlist.h" 23#include "scanlist.h"
24#include "statwindow.h" 24#include "statwindow.h"
25#include "graphwindow.h" 25#include "graphwindow.h"
26 26
27#ifdef QWS 27#ifdef QWS
28#include <qpe/resource.h> 28#include <qpe/resource.h>
29#include <opie2/otabwidget.h> 29#include <opie2/otabwidget.h>
30using namespace Opie; 30using namespace Opie;
31#else 31#else
32#include "resource.h" 32#include "resource.h"
33#include <qtabwidget.h> 33#include <qtabwidget.h>
34#endif 34#endif
35 35
36 36
37/* 37/*
38 * Constructs a WellenreiterBase which is a child of 'parent', with the 38 * Constructs a WellenreiterBase which is a child of 'parent', with the
39 * name 'name' and widget flags set to 'f' 39 * name 'name' and widget flags set to 'f'
40 */ 40 */
41WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags fl ) 41WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags fl )
42 : QWidget( parent, name, fl ) 42 : QWidget( parent, name, fl )
43{ 43{
44 //ani1 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot0" ) ); 44 //ani1 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot0" ) );
45 //ani2 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot90" ) ); 45 //ani2 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot90" ) );
46 //ani3 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot180" ) ); 46 //ani3 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot180" ) );
47 //ani4 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot270" ) ); 47 //ani4 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot270" ) );
48 48
49 if ( !name ) 49 if ( !name )
50 setName( "WellenreiterBase" ); 50 setName( "WellenreiterBase" );
51 resize( 191, 294 ); 51 resize( 191, 294 );
52#ifdef QWS 52#ifdef QWS
53 setCaption( tr( "Wellenreiter/Opie" ) ); 53 setCaption( tr( "Wellenreiter/Opie" ) );
54#else 54#else
55 setCaption( tr( "Wellenreiter/X11" ) ); 55 setCaption( tr( "Wellenreiter/X11" ) );
56#endif 56#endif
57 WellenreiterBaseLayout = new QVBoxLayout( this ); 57 WellenreiterBaseLayout = new QVBoxLayout( this );
58 WellenreiterBaseLayout->setSpacing( 2 ); 58 WellenreiterBaseLayout->setSpacing( 2 );
59 WellenreiterBaseLayout->setMargin( 0 ); 59 WellenreiterBaseLayout->setMargin( 0 );
60#ifdef QWS 60#ifdef QWS
61 TabWidget = new OTabWidget( this, "TabWidget", OTabWidget::Global ); 61 TabWidget = new OTabWidget( this, "TabWidget", OTabWidget::Global );
62#else 62#else
63 TabWidget = new QTabWidget( this, "TabWidget" ); 63 TabWidget = new QTabWidget( this, "TabWidget" );
64#endif 64#endif
65 ap = new QWidget( TabWidget, "ap" ); 65 ap = new QWidget( TabWidget, "ap" );
66 apLayout = new QVBoxLayout( ap ); 66 apLayout = new QVBoxLayout( ap );
67 apLayout->setSpacing( 2 ); 67 apLayout->setSpacing( 2 );
68 apLayout->setMargin( 2 ); 68 apLayout->setMargin( 2 );
69 69
70 //--------- NETVIEW TAB -------------- 70 //--------- NETVIEW TAB --------------
71 71
72 netview = new MScanListView( ap ); 72 netview = new MScanListView( ap );
73 apLayout->addWidget( netview ); 73 apLayout->addWidget( netview );
74 74
75 //--------- GRAPH TAB -------------- 75 //--------- GRAPH TAB --------------
76 76
77 graphwindow = new MGraphWindow( TabWidget, "Graph" ); 77 graphwindow = new MGraphWindow( TabWidget, "Graph" );
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 //--------- HEX TAB -------------- 83 //--------- HEX TAB --------------
84 84
85 hexwindow = new MHexWindow( TabWidget, "Hex" ); 85 hexwindow = new PacketView( TabWidget, "Hex" );
86 86
87 //--------- STAT TAB -------------- 87 //--------- STAT TAB --------------
88 88
89 statwindow = new MStatWindow( TabWidget, "Stat" ); 89 statwindow = new MStatWindow( TabWidget, "Stat" );
90 90
91 //--------- ABOUT TAB -------------- 91 //--------- ABOUT TAB --------------
92 92
93 about = new QWidget( TabWidget, "about" ); 93 about = new QWidget( TabWidget, "about" );
94 aboutLayout = new QGridLayout( about ); 94 aboutLayout = new QGridLayout( about );
95 aboutLayout->setSpacing( 6 ); 95 aboutLayout->setSpacing( 6 );
96 aboutLayout->setMargin( 11 ); 96 aboutLayout->setMargin( 11 );
97 97
98 PixmapLabel1_3_2 = new QLabel( about, "PixmapLabel1_3_2" ); 98 PixmapLabel1_3_2 = new QLabel( about, "PixmapLabel1_3_2" );
99 PixmapLabel1_3_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, PixmapLabel1_3_2->sizePolicy().hasHeightForWidth() ) ); 99 PixmapLabel1_3_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, PixmapLabel1_3_2->sizePolicy().hasHeightForWidth() ) );
100 PixmapLabel1_3_2->setFrameShape( QLabel::Panel ); 100 PixmapLabel1_3_2->setFrameShape( QLabel::Panel );
101 PixmapLabel1_3_2->setFrameShadow( QLabel::Sunken ); 101 PixmapLabel1_3_2->setFrameShadow( QLabel::Sunken );
102 PixmapLabel1_3_2->setLineWidth( 2 ); 102 PixmapLabel1_3_2->setLineWidth( 2 );
103 PixmapLabel1_3_2->setMargin( 0 ); 103 PixmapLabel1_3_2->setMargin( 0 );
104 PixmapLabel1_3_2->setMidLineWidth( 0 ); 104 PixmapLabel1_3_2->setMidLineWidth( 0 );
105 PixmapLabel1_3_2->setPixmap( Resource::loadPixmap( "wellenreiter/logo" ) ); 105 PixmapLabel1_3_2->setPixmap( Resource::loadPixmap( "wellenreiter/logo" ) );
106 PixmapLabel1_3_2->setScaledContents( TRUE ); 106 PixmapLabel1_3_2->setScaledContents( TRUE );
107 PixmapLabel1_3_2->setAlignment( int( QLabel::AlignCenter ) ); 107 PixmapLabel1_3_2->setAlignment( int( QLabel::AlignCenter ) );
108 108
109 aboutLayout->addWidget( PixmapLabel1_3_2, 0, 0 ); 109 aboutLayout->addWidget( PixmapLabel1_3_2, 0, 0 );
110 110
111 TextLabel1_4_2 = new QLabel( about, "TextLabel1_4_2" ); 111 TextLabel1_4_2 = new QLabel( about, "TextLabel1_4_2" );
112 QFont TextLabel1_4_2_font( TextLabel1_4_2->font() ); 112 QFont TextLabel1_4_2_font( TextLabel1_4_2->font() );
113 TextLabel1_4_2_font.setFamily( "adobe-helvetica" ); 113 TextLabel1_4_2_font.setFamily( "adobe-helvetica" );
114 TextLabel1_4_2_font.setPointSize( 10 ); 114 TextLabel1_4_2_font.setPointSize( 10 );
115 TextLabel1_4_2->setFont( TextLabel1_4_2_font ); 115 TextLabel1_4_2->setFont( TextLabel1_4_2_font );
116 TextLabel1_4_2->setText( tr( "<p align=center>\n" 116 TextLabel1_4_2->setText( tr( "<p align=center>\n"
117"<hr>\n" 117"<hr>\n"
118"Michael 'Mickey' Lauer<br><hr>\n" 118"Michael 'Mickey' Lauer<br><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"<b>www.wellenreiter.net</b>\n" 121"<b>www.wellenreiter.net</b>\n"
122"</p>" ) ); 122"</p>" ) );
123 TextLabel1_4_2->setAlignment( int( QLabel::AlignCenter ) ); 123 TextLabel1_4_2->setAlignment( int( QLabel::AlignCenter ) );
124 124
125 aboutLayout->addWidget( TextLabel1_4_2, 1, 0 ); 125 aboutLayout->addWidget( TextLabel1_4_2, 1, 0 );
126 126
127#ifdef QWS 127#ifdef QWS
128 TabWidget->addTab( ap, "wellenreiter/networks", tr( "Nets" ) ); 128 TabWidget->addTab( ap, "wellenreiter/networks", tr( "Nets" ) );
129 TabWidget->addTab( graphwindow, "wellenreiter/graph", tr( "Graph" ) ); 129 TabWidget->addTab( graphwindow, "wellenreiter/graph", tr( "Graph" ) );
130 TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) ); 130 TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) );
131 TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) ); 131 TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) );
132 TabWidget->addTab( statwindow, "wellenreiter/stat", tr( "Stat" ) ); 132 TabWidget->addTab( statwindow, "wellenreiter/stat", tr( "Stat" ) );
133 TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) ); 133 TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) );
134#else 134#else
135 TabWidget->addTab( ap, /* "wellenreiter/networks", */ tr( "Networks" ) ); 135 TabWidget->addTab( ap, /* "wellenreiter/networks", */ tr( "Networks" ) );
136 TabWidget->addTab( graphwindow, /* "wellenreiter/graph", */ tr( "Graph" ) ); 136 TabWidget->addTab( graphwindow, /* "wellenreiter/graph", */ tr( "Graph" ) );
137 TabWidget->addTab( logwindow, /* "wellenreiter/log", */ tr( "Log" ) ); 137 TabWidget->addTab( logwindow, /* "wellenreiter/log", */ tr( "Log" ) );
138 TabWidget->addTab( hexwindow, /* "wellenreiter/hex", */ tr( "Hex" ) ); 138 TabWidget->addTab( hexwindow, /* "wellenreiter/hex", */ tr( "Hex" ) );
139 TabWidget->addTab( statwindow, /* "wellenreiter/hex", */ tr( "Stat" ) ); 139 TabWidget->addTab( statwindow, /* "wellenreiter/hex", */ tr( "Stat" ) );
140 TabWidget->addTab( about, /* "wellenreiter/about", */ tr( "About" ) ); 140 TabWidget->addTab( about, /* "wellenreiter/about", */ tr( "About" ) );
141#endif 141#endif
142 WellenreiterBaseLayout->addWidget( TabWidget ); 142 WellenreiterBaseLayout->addWidget( TabWidget );
143 143
144#ifdef QWS 144#ifdef QWS
145 TabWidget->setCurrentTab( tr( "Nets" ) ); 145 TabWidget->setCurrentTab( tr( "Nets" ) );
146#endif 146#endif
147 147
148} 148}
149 149
150/* 150/*
151 * Destroys the object and frees any allocated resources 151 * Destroys the object and frees any allocated resources
152 */ 152 */
153WellenreiterBase::~WellenreiterBase() 153WellenreiterBase::~WellenreiterBase()
154{ 154{
155 // no need to delete child widgets, Qt does it all for us 155 // no need to delete child widgets, Qt does it all for us
156} 156}
157 157
158/* 158/*
159 * Main event handler. Reimplemented to handle application 159 * Main event handler. Reimplemented to handle application
160 * font changes 160 * font changes
161 */ 161 */
162bool WellenreiterBase::event( QEvent* ev ) 162bool WellenreiterBase::event( QEvent* ev )
163{ 163{
164 bool ret = QWidget::event( ev ); 164 bool ret = QWidget::event( ev );
165 if ( ev->type() == QEvent::ApplicationFontChange ) { 165 if ( ev->type() == QEvent::ApplicationFontChange ) {
166 //QFont Log_2_font( Log_2->font() ); 166 //QFont Log_2_font( Log_2->font() );
167 //Log_2_font.setFamily( "adobe-courier" ); 167 //Log_2_font.setFamily( "adobe-courier" );
168 //Log_2_font.setPointSize( 8 ); 168 //Log_2_font.setPointSize( 8 );
169 //Log_2->setFont( Log_2_font ); 169 //Log_2->setFont( Log_2_font );
170 QFont TextLabel1_4_2_font( TextLabel1_4_2->font() ); 170 QFont TextLabel1_4_2_font( TextLabel1_4_2->font() );
171 TextLabel1_4_2_font.setFamily( "adobe-helvetica" ); 171 TextLabel1_4_2_font.setFamily( "adobe-helvetica" );
172 TextLabel1_4_2_font.setPointSize( 10 ); 172 TextLabel1_4_2_font.setPointSize( 10 );
173 TextLabel1_4_2->setFont( TextLabel1_4_2_font ); 173 TextLabel1_4_2->setFont( TextLabel1_4_2_font );
174 } 174 }
175 return ret; 175 return ret;
176} 176}
177 177
diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.h b/noncore/net/wellenreiter/gui/wellenreiterbase.h
index 5e00ddc..126aad2 100644
--- a/noncore/net/wellenreiter/gui/wellenreiterbase.h
+++ b/noncore/net/wellenreiter/gui/wellenreiterbase.h
@@ -1,77 +1,77 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Wellenreiter II. 4** This file is part of Wellenreiter II.
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 WELLENREITERBASE_H 16#ifndef WELLENREITERBASE_H
17#define WELLENREITERBASE_H 17#define WELLENREITERBASE_H
18 18
19#include <qvariant.h> 19#include <qvariant.h>
20#include <qwidget.h> 20#include <qwidget.h>
21class QVBoxLayout; 21class QVBoxLayout;
22class QHBoxLayout; 22class QHBoxLayout;
23class QGridLayout; 23class QGridLayout;
24class QLabel; 24class QLabel;
25class MScanListView; 25class MScanListView;
26class MScanListItem; 26class MScanListItem;
27class QPushButton; 27class QPushButton;
28class MLogWindow; 28class MLogWindow;
29class MHexWindow;
30class MStatWindow; 29class MStatWindow;
31class MGraphWindow; 30class MGraphWindow;
31class PacketView;
32 32
33#ifdef QWS 33#ifdef QWS
34#include <opie2/otabwidget.h> 34#include <opie2/otabwidget.h>
35using namespace Opie; 35using namespace Opie;
36#else 36#else
37class QTabWidget; 37class QTabWidget;
38#endif 38#endif
39 39
40class WellenreiterBase : public QWidget 40class WellenreiterBase : public QWidget
41{ 41{
42 Q_OBJECT 42 Q_OBJECT
43 43
44public: 44public:
45 WellenreiterBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 45 WellenreiterBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
46 ~WellenreiterBase(); 46 ~WellenreiterBase();
47 47
48#ifdef QWS 48#ifdef QWS
49 OTabWidget* TabWidget; 49 OTabWidget* TabWidget;
50#else 50#else
51 QTabWidget* TabWidget; 51 QTabWidget* TabWidget;
52#endif 52#endif
53 QWidget* ap; 53 QWidget* ap;
54 MScanListView* netview; 54 MScanListView* netview;
55 MLogWindow* logwindow; 55 MLogWindow* logwindow;
56 MHexWindow* hexwindow; 56 PacketView* hexwindow;
57 MStatWindow* statwindow; 57 MStatWindow* statwindow;
58 MGraphWindow* graphwindow; 58 MGraphWindow* graphwindow;
59 QWidget* about; 59 QWidget* about;
60 QLabel* PixmapLabel1_3_2; 60 QLabel* PixmapLabel1_3_2;
61 QLabel* TextLabel1_4_2; 61 QLabel* TextLabel1_4_2;
62 62
63protected: 63protected:
64 QVBoxLayout* WellenreiterBaseLayout; 64 QVBoxLayout* WellenreiterBaseLayout;
65 QVBoxLayout* apLayout; 65 QVBoxLayout* apLayout;
66 QGridLayout* aboutLayout; 66 QGridLayout* aboutLayout;
67 bool event( QEvent* ); 67 bool event( QEvent* );
68 68
69 QPixmap* ani1; 69 QPixmap* ani1;
70 QPixmap* ani2; 70 QPixmap* ani2;
71 QPixmap* ani3; 71 QPixmap* ani3;
72 QPixmap* ani4; 72 QPixmap* ani4;
73 73
74 74
75}; 75};
76 76
77#endif // WELLENREITERBASE_H 77#endif // WELLENREITERBASE_H