summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-03-09 17:59:55 (UTC)
committer mickeyl <mickeyl>2004-03-09 17:59:55 (UTC)
commitdd34b866c0f3e5041696dd97cf356d86a8d6d212 (patch) (unidiff)
treefb4c6e414b851a3000d91d34d38a666da1fbf95a
parent25434cbbcd2d2473c9cd3d486cec7a96a6a6323e (diff)
downloadopie-dd34b866c0f3e5041696dd97cf356d86a8d6d212.zip
opie-dd34b866c0f3e5041696dd97cf356d86a8d6d212.tar.gz
opie-dd34b866c0f3e5041696dd97cf356d86a8d6d212.tar.bz2
on the way to a new hex window
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,573 +1,576 @@
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() ) );
116 fileSave->insertItem( tr( "&Hex Log..." ), this, SLOT( fileSaveHex() ) ); 116 fileSave->insertItem( tr( "&Hex Log..." ), this, SLOT( fileSaveHex() ) );
117 117
118 QPopupMenu* fileLoad = new QPopupMenu( mb ); 118 QPopupMenu* fileLoad = new QPopupMenu( mb );
119 fileLoad->insertItem( tr( "&Session..." ), this, SLOT( fileLoadSession() ) ); 119 fileLoad->insertItem( tr( "&Session..." ), this, SLOT( fileLoadSession() ) );
120 //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); 120 //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) );
121 121
122 QPopupMenu* file = new QPopupMenu( mb ); 122 QPopupMenu* file = new QPopupMenu( mb );
123 file->insertItem( tr( "&New" ), this, SLOT( fileNew() ) ); 123 file->insertItem( tr( "&New" ), this, SLOT( fileNew() ) );
124 id = file->insertItem( tr( "&Load" ), fileLoad ); 124 id = file->insertItem( tr( "&Load" ), fileLoad );
125 file->insertItem( tr( "&Save" ), fileSave ); 125 file->insertItem( tr( "&Save" ), fileSave );
126 file->insertSeparator(); 126 file->insertSeparator();
127 uploadID = file->insertItem( tr( "&Upload Session" ), this, SLOT( uploadSession() ) ); 127 uploadID = file->insertItem( tr( "&Upload Session" ), this, SLOT( uploadSession() ) );
128 file->insertSeparator(); 128 file->insertSeparator();
129 file->insertItem( tr( "&Exit" ), qApp, SLOT( quit() ) ); 129 file->insertItem( tr( "&Exit" ), qApp, SLOT( quit() ) );
130 130
131 QPopupMenu* sniffer = new QPopupMenu( mb ); 131 QPopupMenu* sniffer = new QPopupMenu( mb );
132 sniffer->insertItem( tr( "&Configure..." ), this, SLOT( showConfigure() ) ); 132 sniffer->insertItem( tr( "&Configure..." ), this, SLOT( showConfigure() ) );
133 sniffer->insertSeparator(); 133 sniffer->insertSeparator();
134 startID = sniffer->insertItem( tr( "&Start" ), mw, SLOT( startClicked() ) ); 134 startID = sniffer->insertItem( tr( "&Start" ), mw, SLOT( startClicked() ) );
135 sniffer->setItemEnabled( startID, false ); 135 sniffer->setItemEnabled( startID, false );
136 stopID = sniffer->insertItem( tr( "Sto&p" ), mw, SLOT( stopClicked() ) ); 136 stopID = sniffer->insertItem( tr( "Sto&p" ), mw, SLOT( stopClicked() ) );
137 sniffer->setItemEnabled( stopID, false ); 137 sniffer->setItemEnabled( stopID, false );
138 138
139 QPopupMenu* view = new QPopupMenu( mb ); 139 QPopupMenu* view = new QPopupMenu( mb );
140 view->insertItem( tr( "&Expand All" ), this, SLOT( viewExpandAll() ) ); 140 view->insertItem( tr( "&Expand All" ), this, SLOT( viewExpandAll() ) );
141 view->insertItem( tr( "&Collapse All" ), this, SLOT( viewCollapseAll() ) ); 141 view->insertItem( tr( "&Collapse All" ), this, SLOT( viewCollapseAll() ) );
142 142
143 QPopupMenu* demo = new QPopupMenu( mb ); 143 QPopupMenu* demo = new QPopupMenu( mb );
144 demo->insertItem( tr( "&Add something" ), this, SLOT( demoAddStations() ) ); 144 demo->insertItem( tr( "&Add something" ), this, SLOT( demoAddStations() ) );
145 //demo->insertItem( tr( "&Read from GPSd" ), this, SLOT( demoReadFromGps() ) ); 145 //demo->insertItem( tr( "&Read from GPSd" ), this, SLOT( demoReadFromGps() ) );
146 146
147 id = mb->insertItem( tr( "&File" ), file ); 147 id = mb->insertItem( tr( "&File" ), file );
148 148
149 id = mb->insertItem( tr( "&View" ), view ); 149 id = mb->insertItem( tr( "&View" ), view );
150 //mb->setItemEnabled( id, false ); 150 //mb->setItemEnabled( id, false );
151 151
152 id = mb->insertItem( tr( "&Sniffer" ), sniffer ); 152 id = mb->insertItem( tr( "&Sniffer" ), sniffer );
153 153
154 id = mb->insertItem( tr( "&Demo" ), demo ); 154 id = mb->insertItem( tr( "&Demo" ), demo );
155 mb->setItemEnabled( id, true ); 155 mb->setItemEnabled( id, true );
156 mb->setItemEnabled( uploadID, false ); 156 mb->setItemEnabled( uploadID, false );
157 157
158 #ifdef QWS 158 #ifdef QWS
159 mb->insertItem( startButton ); 159 mb->insertItem( startButton );
160 mb->insertItem( stopButton ); 160 mb->insertItem( stopButton );
161 mb->insertItem( uploadButton ); 161 mb->insertItem( uploadButton );
162 mb->insertItem( d ); 162 mb->insertItem( d );
163 #else // Qt3 changed the insertion order. It's now totally random :( 163 #else // Qt3 changed the insertion order. It's now totally random :(
164 mb->insertItem( d ); 164 mb->insertItem( d );
165 mb->insertItem( uploadButton ); 165 mb->insertItem( uploadButton );
166 mb->insertItem( stopButton ); 166 mb->insertItem( stopButton );
167 mb->insertItem( startButton ); 167 mb->insertItem( startButton );
168 #endif 168 #endif
169 169
170 updateToolButtonState(); 170 updateToolButtonState();
171 171
172 // setup status bar (for now only on X11) 172 // setup status bar (for now only on X11)
173 173
174 #ifndef QWS 174 #ifndef QWS
175 statusBar()->message( tr( "Ready." ) ); 175 statusBar()->message( tr( "Ready." ) );
176 #endif 176 #endif
177 177
178 connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) ); 178 connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) );
179 connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) ); 179 connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) );
180}; 180};
181 181
182 182
183 183
184void WellenreiterMainWindow::showConfigure() 184void WellenreiterMainWindow::showConfigure()
185{ 185{
186 qDebug( "show configure..." ); 186 qDebug( "show configure..." );
187 cw->setCaption( tr( "Configure" ) ); 187 cw->setCaption( tr( "Configure" ) );
188 int result = QPEApplication::execDialog( cw ); 188 int result = QPEApplication::execDialog( cw );
189 189
190 if ( result ) updateToolButtonState(); 190 if ( result ) updateToolButtonState();
191} 191}
192 192
193 193
194void WellenreiterMainWindow::updateToolButtonState() 194void WellenreiterMainWindow::updateToolButtonState()
195{ 195{
196 const QString& interface = cw->interfaceName->currentText(); 196 const QString& interface = cw->interfaceName->currentText();
197 const int cardtype = cw->driverType(); 197 const int cardtype = cw->driverType();
198 198
199 if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) 199 if ( ( interface != "<select>" ) && ( cardtype != 0 ) )
200 { 200 {
201 startButton->setEnabled( true ); 201 startButton->setEnabled( true );
202 menuBar()->setItemEnabled( startID, true ); 202 menuBar()->setItemEnabled( startID, true );
203 } 203 }
204 else 204 else
205 { 205 {
206 startButton->setEnabled( false ); 206 startButton->setEnabled( false );
207 menuBar()->setItemEnabled( startID, false ); 207 menuBar()->setItemEnabled( startID, false );
208 } 208 }
209} 209}
210 210
211 211
212void WellenreiterMainWindow::changedSniffingState() 212void WellenreiterMainWindow::changedSniffingState()
213{ 213{
214 startButton->setEnabled( !mw->sniffing ); 214 startButton->setEnabled( !mw->sniffing );
215 menuBar()->setItemEnabled( startID, !mw->sniffing ); 215 menuBar()->setItemEnabled( startID, !mw->sniffing );
216 stopButton->setEnabled( mw->sniffing ); 216 stopButton->setEnabled( mw->sniffing );
217 menuBar()->setItemEnabled( stopID, mw->sniffing ); 217 menuBar()->setItemEnabled( stopID, mw->sniffing );
218 218
219 if ( !mw->sniffing ) 219 if ( !mw->sniffing )
220 { 220 {
221 menuBar()->setItemEnabled( uploadID, true ); 221 menuBar()->setItemEnabled( uploadID, true );
222 uploadButton->setEnabled( true ); 222 uploadButton->setEnabled( true );
223 } 223 }
224} 224}
225 225
226 226
227WellenreiterMainWindow::~WellenreiterMainWindow() 227WellenreiterMainWindow::~WellenreiterMainWindow()
228{ 228{
229 qDebug( "Wellenreiter: bye." ); 229 qDebug( "Wellenreiter: bye." );
230}; 230};
231 231
232 232
233void WellenreiterMainWindow::demoAddStations() 233void WellenreiterMainWindow::demoAddStations()
234{ 234{
235 //mw = 0; // test SIGSEGV handling 235 //mw = 0; // test SIGSEGV handling
236 236
237 mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80, GpsLocation( 39.8794, -94.0936) ); 237 mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80, GpsLocation( 39.8794, -94.0936) );
238 mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10, GpsLocation( 0.0, 0.0 ) ); 238 mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10, GpsLocation( 0.0, 0.0 ) );
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 {
447 450
448 451
449 if ( !QFile::exists( mw->captureFileName() ) ) 452 if ( !QFile::exists( mw->captureFileName() ) )
450 { 453 {
451 QMessageBox::warning( 0, tr( "Error" ), tr( "<p>Logfile '%1' doesn't exist</p>").arg( mw->captureFileName() ) ); 454 QMessageBox::warning( 0, tr( "Error" ), tr( "<p>Logfile '%1' doesn't exist</p>").arg( mw->captureFileName() ) );
452 return; 455 return;
453 } 456 }
454 457
455 QFile f( mw->captureFileName() ); 458 QFile f( mw->captureFileName() );
456 if ( !f.open( IO_ReadOnly ) ) 459 if ( !f.open( IO_ReadOnly ) )
457 { 460 {
458 QMessageBox::warning( 0, tr( "Error" ), tr( "<p>Can't open Logfile '%1'</p>").arg( mw->captureFileName() ) ); 461 QMessageBox::warning( 0, tr( "Error" ), tr( "<p>Can't open Logfile '%1'</p>").arg( mw->captureFileName() ) );
459 return; 462 return;
460 } 463 }
461 464
462 int content_length = f.size(); 465 int content_length = f.size();
463 466
464 ::memset( &raddr, 0, sizeof (struct sockaddr_in) ); 467 ::memset( &raddr, 0, sizeof (struct sockaddr_in) );
465 ::memcpy( &raddr. sin_addr, rhost_info-> h_addr, rhost_info-> h_length ); 468 ::memcpy( &raddr. sin_addr, rhost_info-> h_addr, rhost_info-> h_length );
466 raddr.sin_family = rhost_info-> h_addrtype; 469 raddr.sin_family = rhost_info-> h_addrtype;
467 raddr.sin_port = htons ( 80 ); 470 raddr.sin_port = htons ( 80 );
468 471
469 sock = ::socket( AF_INET, SOCK_STREAM, 0 ); 472 sock = ::socket( AF_INET, SOCK_STREAM, 0 );
470 473
471 if ( sock >= 0 ) 474 if ( sock >= 0 )
472 { 475 {
473 if ( ::connect ( sock, (struct sockaddr *) & raddr, sizeof (struct sockaddr)) >= 0 ) 476 if ( ::connect ( sock, (struct sockaddr *) & raddr, sizeof (struct sockaddr)) >= 0 )
474 { 477 {
475 QString header; 478 QString header;
476 QString content; 479 QString content;
477 QString preambel; 480 QString preambel;
478 481
479 header = "" 482 header = ""
480 "POST /projects/capturedump.spy HTTP/1.1\r\n" 483 "POST /projects/capturedump.spy HTTP/1.1\r\n"
481 "Host: www.vanille.de\r\n" 484 "Host: www.vanille.de\r\n"
482 "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031010 Galeon/1.3.10\r\n" 485 "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031010 Galeon/1.3.10\r\n"
483 "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1\r\n" 486 "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1\r\n"
484 "Accept-Language: en\r\n" 487 "Accept-Language: en\r\n"
485 "Accept-Encoding: gzip, deflate, compress;q=0.9\r\n" 488 "Accept-Encoding: gzip, deflate, compress;q=0.9\r\n"
486 "Accept-Charset: us-ascii,utf-8;q=0.7,*;q=0.7\r\n" 489 "Accept-Charset: us-ascii,utf-8;q=0.7,*;q=0.7\r\n"
487 "Keep-Alive: 300\r\n" 490 "Keep-Alive: 300\r\n"
488 "Connection: keep-alive\r\n" 491 "Connection: keep-alive\r\n"
489 "Referer: http://www.vanille.de/projects/capturedump.spy\r\n" 492 "Referer: http://www.vanille.de/projects/capturedump.spy\r\n"
490 "Content-Type: multipart/form-data; boundary=---------------------------97267758015830030481215568065\r\n" 493 "Content-Type: multipart/form-data; boundary=---------------------------97267758015830030481215568065\r\n"
491 "Content-Length: %1\r\n" 494 "Content-Length: %1\r\n"
492 "\r\n"; 495 "\r\n";
493 496
494 content = "" 497 content = ""
495 "-----------------------------97267758015830030481215568065\r\n" 498 "-----------------------------97267758015830030481215568065\r\n"
496 "Content-Disposition: form-data; name=\"Name\"\r\n" 499 "Content-Disposition: form-data; name=\"Name\"\r\n"
497 "\r\n" 500 "\r\n"
498 "%1\r\n" 501 "%1\r\n"
499 "-----------------------------97267758015830030481215568065\r\n" 502 "-----------------------------97267758015830030481215568065\r\n"
500 "Content-Disposition: form-data; name=\"Location\"\r\n" 503 "Content-Disposition: form-data; name=\"Location\"\r\n"
501 "\r\n" 504 "\r\n"
502 "%2\r\n" 505 "%2\r\n"
503 "-----------------------------97267758015830030481215568065\r\n" 506 "-----------------------------97267758015830030481215568065\r\n"
504 "Content-Disposition: form-data; name=\"Comments\"\r\n" 507 "Content-Disposition: form-data; name=\"Comments\"\r\n"
505 "\r\n" 508 "\r\n"
506 "%3\r\n" 509 "%3\r\n"
507 "-----------------------------97267758015830030481215568065\r\n" 510 "-----------------------------97267758015830030481215568065\r\n"
508 "Content-Disposition: form-data; name=\"upfile\"; filename=\"%4\"\r\n" 511 "Content-Disposition: form-data; name=\"upfile\"; filename=\"%4\"\r\n"
509 "Content-Type: application/octet-stream\r\n" 512 "Content-Type: application/octet-stream\r\n"
510 "\r\n"; 513 "\r\n";
511 514
512 preambel = "" 515 preambel = ""
513 "\r\n-----------------------------97267758015830030481215568065--\r\n"; 516 "\r\n-----------------------------97267758015830030481215568065--\r\n";
514 517
515 content = content.arg( from->text().isEmpty() ? QString( "Anonymous Wellenreiter II User" ) : from->text() ); 518 content = content.arg( from->text().isEmpty() ? QString( "Anonymous Wellenreiter II User" ) : from->text() );
516 content = content.arg( location->text().isEmpty() ? QString( "Anonymous Wellenreiter II Location" ) : location->text() ); 519 content = content.arg( location->text().isEmpty() ? QString( "Anonymous Wellenreiter II Location" ) : location->text() );
517 content = content.arg( comments->text().isEmpty() ? QString( "Anonymous Wellenreiter II Comments" ) : comments->text() ); 520 content = content.arg( comments->text().isEmpty() ? QString( "Anonymous Wellenreiter II Comments" ) : comments->text() );
518 content = content.arg( mw->captureFileName() ); 521 content = content.arg( mw->captureFileName() );
519 522
520 header = header.arg( QString::number( content.length() + f.size() + preambel.length() ) ); 523 header = header.arg( QString::number( content.length() + f.size() + preambel.length() ) );
521 524
522 // write header 525 // write header
523 526
524 const char* ascii = header.latin1(); 527 const char* ascii = header.latin1();
525 uint ascii_len = ::strlen( ascii ); 528 uint ascii_len = ::strlen( ascii );
526 ::write ( sock, ascii, ascii_len ); 529 ::write ( sock, ascii, ascii_len );
527 530
528 // write fixed content 531 // write fixed content
529 532
530 ascii = content.latin1(); 533 ascii = content.latin1();
531 ascii_len = ::strlen( ascii ); 534 ascii_len = ::strlen( ascii );
532 ::write ( sock, ascii, ascii_len ); 535 ::write ( sock, ascii, ascii_len );
533 536
534 // write variable content 537 // write variable content
535 538
536 char ch; 539 char ch;
537 while ( !f.atEnd() ) 540 while ( !f.atEnd() )
538 { 541 {
539 f.readBlock( &ch, 1 ); 542 f.readBlock( &ch, 1 );
540 ::write ( sock, &ch, 1 ); 543 ::write ( sock, &ch, 1 );
541 } 544 }
542 545
543 // write preambel 546 // write preambel
544 547
545 ascii = preambel.latin1(); 548 ascii = preambel.latin1();
546 ascii_len = ::strlen( ascii ); 549 ascii_len = ::strlen( ascii );
547 ::write ( sock, ascii, ascii_len ); 550 ::write ( sock, ascii, ascii_len );
548 551
549 // done! 552 // done!
550 553
551 ok = true; 554 ok = true;
552 } 555 }
553 } 556 }
554 ::close ( sock ); 557 ::close ( sock );
555 } 558 }
556 if ( ok ) 559 if ( ok )
557 QMessageBox::information( 0, tr( "Success" ), 560 QMessageBox::information( 0, tr( "Success" ),
558 QString ( "<p>%1</p>" ).arg( tr( "Capture Dump was uploaded to %1" ) ).arg( CAP_hostname ) ); 561 QString ( "<p>%1</p>" ).arg( tr( "Capture Dump was uploaded to %1" ) ).arg( CAP_hostname ) );
559 else 562 else
560 QMessageBox::warning( 0, tr( "Error" ), 563 QMessageBox::warning( 0, tr( "Error" ),
561 QString ( "<p>%1</p>" ).arg ( tr( "Connection to %1 failed" ) ).arg( CAP_hostname ) ); 564 QString ( "<p>%1</p>" ).arg ( tr( "Connection to %1 failed" ) ).arg( CAP_hostname ) );
562} 565}
563 566
564 567
565void WellenreiterMainWindow::viewExpandAll() 568void WellenreiterMainWindow::viewExpandAll()
566{ 569{
567 mw->netView()->expand(); 570 mw->netView()->expand();
568} 571}
569 572
570void WellenreiterMainWindow::viewCollapseAll() 573void WellenreiterMainWindow::viewCollapseAll()
571{ 574{
572 mw->netView()->collapse(); 575 mw->netView()->collapse();
573} 576}
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,639 +1,639 @@
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;
117 if ( c > 1 ) left.fill( '.', c-1 ); 117 if ( c > 1 ) left.fill( '.', c-1 );
118 title.append( left ); 118 title.append( left );
119 title.append( '|' ); 119 title.append( '|' );
120 if ( c < iface->channels() ) 120 if ( c < iface->channels() )
121 { 121 {
122 QString right; 122 QString right;
123 right.fill( '.', iface->channels()-c ); 123 right.fill( '.', iface->channels()-c );
124 title.append( right ); 124 title.append( right );
125 } 125 }
126 title.append( "]" ); 126 title.append( "]" );
127 //title.append( QString().sprintf( " %02d", c ) ); 127 //title.append( QString().sprintf( " %02d", c ) );
128 assert( parent() ); 128 assert( parent() );
129 ( (QMainWindow*) parent() )->setCaption( title ); 129 ( (QMainWindow*) parent() )->setCaption( title );
130} 130}
131 131
132 132
133void Wellenreiter::handleNotification( OPacket* p ) 133void Wellenreiter::handleNotification( OPacket* p )
134{ 134{
135 QObjectList* l = p->queryList(); 135 QObjectList* l = p->queryList();
136 QObjectListIt it( *l ); 136 QObjectListIt it( *l );
137 QObject* o; 137 QObject* o;
138 138
139 while ( (o = it.current()) != 0 ) 139 while ( (o = it.current()) != 0 )
140 { 140 {
141 QString name = it.current()->name(); 141 QString name = it.current()->name();
142 if ( configwindow->parsePackets->isProtocolChecked( name ) ) 142 if ( configwindow->parsePackets->isProtocolChecked( name ) )
143 { 143 {
144 QString action = configwindow->parsePackets->protocolAction( name ); 144 QString action = configwindow->parsePackets->protocolAction( name );
145 qDebug( "parsePacket-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); 145 qDebug( "parsePacket-action for '%s' seems to be '%s'", (const char*) name, (const char*) action );
146 doAction( action, name, p ); 146 doAction( action, name, p );
147 } 147 }
148 else 148 else
149 { 149 {
150 qDebug( "protocol '%s' not checked in parsePackets.", (const char*) name ); 150 qDebug( "protocol '%s' not checked in parsePackets.", (const char*) name );
151 } 151 }
152 ++it; 152 ++it;
153 } 153 }
154} 154}
155 155
156 156
157void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage ) 157void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage )
158{ 158{
159 if ( manage->managementType() == "Beacon" ) handleManagementFrameBeacon( p, manage ); 159 if ( manage->managementType() == "Beacon" ) handleManagementFrameBeacon( p, manage );
160 else if ( manage->managementType() == "ProbeRequest" ) handleManagementFrameProbeRequest( p, manage ); 160 else if ( manage->managementType() == "ProbeRequest" ) handleManagementFrameProbeRequest( p, manage );
161 else if ( manage->managementType() == "ProbeResponse" ) handleManagementFrameProbeResponse( p, manage ); 161 else if ( manage->managementType() == "ProbeResponse" ) handleManagementFrameProbeResponse( p, manage );
162 else qWarning( "Wellenreiter::handleManagementFrame(): '%s' - please handle me!", (const char*) manage->managementType() ); 162 else qWarning( "Wellenreiter::handleManagementFrame(): '%s' - please handle me!", (const char*) manage->managementType() );
163} 163}
164 164
165 165
166void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* request ) 166void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* request )
167{ 167{
168 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); 168 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) );
169 QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); 169 QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>");
170 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); 170 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) );
171 int channel = ds ? ds->channel() : -1; 171 int channel = ds ? ds->channel() : -1;
172 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); 172 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
173 173
174 GpsLocation loc( -111, -111 ); 174 GpsLocation loc( -111, -111 );
175 if ( configwindow->enableGPS->isChecked() ) 175 if ( configwindow->enableGPS->isChecked() )
176 { 176 {
177 // TODO: add check if GPS is working!? 177 // TODO: add check if GPS is working!?
178 qDebug( "Wellenreiter::gathering GPS data..." ); 178 qDebug( "Wellenreiter::gathering GPS data..." );
179 loc = gps->position(); 179 loc = gps->position();
180 qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); 180 qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() );
181 } 181 }
182 182
183 if ( essid.length() ) 183 if ( essid.length() )
184 netView()->addNewItem( "adhoc", essid, header->macAddress2(), false /* should check FrameControl field */, -1, 0, loc, true /* only probed */ ); 184 netView()->addNewItem( "adhoc", essid, header->macAddress2(), false /* should check FrameControl field */, -1, 0, loc, true /* only probed */ );
185 qDebug( "Wellenreiter::invalid frame [possibly noise] detected!" ); 185 qDebug( "Wellenreiter::invalid frame [possibly noise] detected!" );
186} 186}
187 187
188 188
189void Wellenreiter::handleManagementFrameProbeResponse( OPacket* p, OWaveLanManagementPacket* response ) 189void Wellenreiter::handleManagementFrameProbeResponse( OPacket* p, OWaveLanManagementPacket* response )
190{ 190{
191} 191}
192 192
193 193
194void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) 194void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPacket* beacon )
195{ 195{
196 QString type; 196 QString type;
197 if ( beacon->canIBSS() ) 197 if ( beacon->canIBSS() )
198 { 198 {
199 type = "adhoc"; 199 type = "adhoc";
200 } 200 }
201 else if ( beacon->canESS() ) 201 else if ( beacon->canESS() )
202 { 202 {
203 type = "managed"; 203 type = "managed";
204 } 204 }
205 else 205 else
206 { 206 {
207 qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); 207 qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" );
208 return; 208 return;
209 } 209 }
210 210
211 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); 211 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) );
212 QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); 212 QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>");
213 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); 213 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) );
214 int channel = ds ? ds->channel() : -1; 214 int channel = ds ? ds->channel() : -1;
215 215
216 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); 216 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
217 217
218 GpsLocation loc( -111, -111 ); 218 GpsLocation loc( -111, -111 );
219 if ( configwindow->enableGPS->isChecked() ) 219 if ( configwindow->enableGPS->isChecked() )
220 { 220 {
221 // TODO: add check if GPS is working!? 221 // TODO: add check if GPS is working!?
222 qDebug( "Wellenreiter::gathering GPS data..." ); 222 qDebug( "Wellenreiter::gathering GPS data..." );
223 loc = gps->position(); 223 loc = gps->position();
224 qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); 224 qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() );
225 } 225 }
226 226
227 netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc ); 227 netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc );
228 228
229 // update graph window 229 // update graph window
230 if ( ds ) 230 if ( ds )
231 { 231 {
232 OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); 232 OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) );
233 if ( prism ) 233 if ( prism )
234 graphwindow->traffic( ds->channel(), prism->signalStrength() ); 234 graphwindow->traffic( ds->channel(), prism->signalStrength() );
235 else 235 else
236 graphwindow->traffic( ds->channel(), 95 ); 236 graphwindow->traffic( ds->channel(), 95 );
237 } 237 }
238} 238}
239 239
240 240
241void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* control ) 241void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* control )
242{ 242{
243 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); 243 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
244 244
245 if ( control->controlType() == "Acknowledge" ) 245 if ( control->controlType() == "Acknowledge" )
246 { 246 {
247 netView()->addNewItem( "adhoc", "<unknown>", header->macAddress1(), false, -1, 0, GpsLocation( -111, -111 ) ); 247 netView()->addNewItem( "adhoc", "<unknown>", header->macAddress1(), false, -1, 0, GpsLocation( -111, -111 ) );
248 } 248 }
249 else 249 else
250 { 250 {
251 qDebug( "Wellenreiter::handleControlFrame - please handle %s in a future version! :D", (const char*) control->controlType() ); 251 qDebug( "Wellenreiter::handleControlFrame - please handle %s in a future version! :D", (const char*) control->controlType() );
252 } 252 }
253} 253}
254 254
255 255
256void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ) 256void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to )
257{ 257{
258 OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); 258 OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" );
259 if ( wlan->fromDS() && !wlan->toDS() ) 259 if ( wlan->fromDS() && !wlan->toDS() )
260 { 260 {
261 netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); 261 netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() );
262 from = wlan->macAddress3(); 262 from = wlan->macAddress3();
263 to = wlan->macAddress2(); 263 to = wlan->macAddress2();
264 } 264 }
265 else if ( !wlan->fromDS() && wlan->toDS() ) 265 else if ( !wlan->fromDS() && wlan->toDS() )
266 { 266 {
267 netView()->toDStraffic( wlan->macAddress2(), wlan->macAddress3(), wlan->macAddress1() ); 267 netView()->toDStraffic( wlan->macAddress2(), wlan->macAddress3(), wlan->macAddress1() );
268 from = wlan->macAddress2(); 268 from = wlan->macAddress2();
269 to = wlan->macAddress3(); 269 to = wlan->macAddress3();
270 } 270 }
271 else if ( wlan->fromDS() && wlan->toDS() ) 271 else if ( wlan->fromDS() && wlan->toDS() )
272 { 272 {
273 netView()->WDStraffic( wlan->macAddress4(), wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); 273 netView()->WDStraffic( wlan->macAddress4(), wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() );
274 from = wlan->macAddress4(); 274 from = wlan->macAddress4();
275 to = wlan->macAddress3(); 275 to = wlan->macAddress3();
276 } 276 }
277 else 277 else
278 { 278 {
279 netView()->IBSStraffic( wlan->macAddress2(), wlan->macAddress1(), wlan->macAddress3() ); 279 netView()->IBSStraffic( wlan->macAddress2(), wlan->macAddress1(), wlan->macAddress3() );
280 from = wlan->macAddress2(); 280 from = wlan->macAddress2();
281 to = wlan->macAddress1(); 281 to = wlan->macAddress1();
282 } 282 }
283} 283}
284 284
285 285
286void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ) 286void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to )
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
480 #ifdef QWS 480 #ifdef QWS
481 if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() ) 481 if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() )
482 { 482 {
483 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 483 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
484 } 484 }
485 #else 485 #else
486 #warning FIXME: setScreenSaverMode is not operational on the X11 build 486 #warning FIXME: setScreenSaverMode is not operational on the X11 build
487 #endif 487 #endif
488 488
489 // print out statistics 489 // print out statistics
490 for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) 490 for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it )
491 statwindow->updateCounter( it.key(), it.data() ); 491 statwindow->updateCounter( it.key(), it.data() );
492} 492}
493 493
494 494
495void Wellenreiter::startClicked() 495void Wellenreiter::startClicked()
496{ 496{
497 // get configuration from config window 497 // get configuration from config window
498 498
499 const QString& interface = configwindow->interfaceName->currentText(); 499 const QString& interface = configwindow->interfaceName->currentText();
500 const int cardtype = configwindow->driverType(); 500 const int cardtype = configwindow->driverType();
501 const int interval = configwindow->hoppingInterval(); 501 const int interval = configwindow->hoppingInterval();
502 502
503 if ( ( interface == "" ) || ( cardtype == 0 ) ) 503 if ( ( interface == "" ) || ( cardtype == 0 ) )
504 { 504 {
505 QMessageBox::information( this, "Wellenreiter II", 505 QMessageBox::information( this, "Wellenreiter II",
506 tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); 506 tr( "Your device is not\nproperly configured. Please reconfigure!" ) );
507 return; 507 return;
508 } 508 }
509 509
510 // configure device 510 // configure device
511 ONetwork* net = ONetwork::instance(); 511 ONetwork* net = ONetwork::instance();
512 512
513 // TODO: check if interface is wireless and support sniffing for non-wireless interfaces 513 // TODO: check if interface is wireless and support sniffing for non-wireless interfaces
514 514
515 if ( !net->isPresent( interface ) ) 515 if ( !net->isPresent( interface ) )
516 { 516 {
517 QMessageBox::information( this, "Wellenreiter II", 517 QMessageBox::information( this, "Wellenreiter II",
518 tr( "The configured device (%1)\nis not available on this system\n. Please reconfigure!" ).arg( interface ) ); 518 tr( "The configured device (%1)\nis not available on this system\n. Please reconfigure!" ).arg( interface ) );
519 return; 519 return;
520 } 520 }
521 521
522 iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); // fails if network is not wireless! 522 iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); // fails if network is not wireless!
523 assert( iface ); 523 assert( iface );
524 524
525 // bring device UP 525 // bring device UP
526 if ( cardtype != DEVTYPE_FILE ) 526 if ( cardtype != DEVTYPE_FILE )
527 { 527 {
528 iface->setUp( true ); 528 iface->setUp( true );
529 if ( !iface->isUp() ) 529 if ( !iface->isUp() )
530 { 530 {
531 QMessageBox::warning( this, "Wellenreiter II", 531 QMessageBox::warning( this, "Wellenreiter II",
532 tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) ); 532 tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) );
533 return; 533 return;
534 } 534 }
535 } 535 }
536 // set monitor mode 536 // set monitor mode
537 bool usePrism = configwindow->usePrismHeader(); 537 bool usePrism = configwindow->usePrismHeader();
538 538
539 switch ( cardtype ) 539 switch ( cardtype )
540 { 540 {
541 case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; 541 case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break;
542 case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; 542 case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break;
543 case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; 543 case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break;
544 case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; 544 case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break;
545 case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; 545 case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break;
546 case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; 546 case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break;
547 default: assert( 0 ); // shouldn't reach this 547 default: assert( 0 ); // shouldn't reach this
548 } 548 }
549 549
550 // switch device into monitor mode 550 // switch device into monitor mode
551 if ( cardtype < DEVTYPE_FILE ) 551 if ( cardtype < DEVTYPE_FILE )
552 { 552 {
553 if ( cardtype != DEVTYPE_MANUAL ) 553 if ( cardtype != DEVTYPE_MANUAL )
554 iface->setMode( "monitor" ); 554 iface->setMode( "monitor" );
555 if ( iface->mode() != "monitor" ) 555 if ( iface->mode() != "monitor" )
556 { 556 {
557 if ( QMessageBox::warning( this, "Wellenreiter II", 557 if ( QMessageBox::warning( this, "Wellenreiter II",
558 tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) + 558 tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) +
559 tr( "\nContinue with limited functionality?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) 559 tr( "\nContinue with limited functionality?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No )
560 return; 560 return;
561 } 561 }
562 } 562 }
563 563
564 // open GPS device 564 // open GPS device
565 if ( configwindow->enableGPS->isChecked() ) 565 if ( configwindow->enableGPS->isChecked() )
566 { 566 {
567 qDebug( "Wellenreiter:GPS enabled @ %s:%d", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); 567 qDebug( "Wellenreiter:GPS enabled @ %s:%d", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() );
568 gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); 568 gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() );
569 } 569 }
570 570
571 // open pcap and start sniffing 571 // open pcap and start sniffing
572 572
573 if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file? 573 if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file?
574 { 574 {
575 dumpname = configwindow->captureFileName->text(); 575 dumpname = configwindow->captureFileName->text();
576 if ( dumpname.isEmpty() ) dumpname = "captureFile"; 576 if ( dumpname.isEmpty() ) dumpname = "captureFile";
577 dumpname.append( '-' ); 577 dumpname.append( '-' );
578 dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); 578 dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) );
579 dumpname.append( ".wellenreiter" ); 579 dumpname.append( ".wellenreiter" );
580 } 580 }
581 else // write it anyway ;) 581 else // write it anyway ;)
582 { 582 {
583 dumpname = "/var/log/dump.wellenreiter"; 583 dumpname = "/var/log/dump.wellenreiter";
584 } 584 }
585 585
586 if ( cardtype != DEVTYPE_FILE ) 586 if ( cardtype != DEVTYPE_FILE )
587 pcap->open( interface ); 587 pcap->open( interface );
588 else 588 else
589 pcap->open( QFile( interface ) ); 589 pcap->open( QFile( interface ) );
590 590
591 qDebug( "Wellenreiter:: dumping to %s", (const char*) dumpname ); 591 qDebug( "Wellenreiter:: dumping to %s", (const char*) dumpname );
592 pcap->openDumpFile( dumpname ); 592 pcap->openDumpFile( dumpname );
593 593
594 if ( !pcap->isOpen() ) 594 if ( !pcap->isOpen() )
595 { 595 {
596 QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg( 596 QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg(
597 cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) )); 597 cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) ));
598 return; 598 return;
599 } 599 }
600 600
601 // set capturer to non-blocking mode 601 // set capturer to non-blocking mode
602 pcap->setBlocking( false ); 602 pcap->setBlocking( false );
603 603
604 // start channel hopper 604 // start channel hopper
605 if ( cardtype != DEVTYPE_FILE ) 605 if ( cardtype != DEVTYPE_FILE )
606 { 606 {
607 logwindow->log( QString().sprintf( "(i) Starting channel hopper (d=%d ms)", configwindow->hopInterval->value() ) ); 607 logwindow->log( QString().sprintf( "(i) Starting channel hopper (d=%d ms)", configwindow->hopInterval->value() ) );
608 iface->setChannelHopping( configwindow->hopInterval->value() ); //use interval from config window 608 iface->setChannelHopping( configwindow->hopInterval->value() ); //use interval from config window
609 } 609 }
610 610
611 if ( cardtype != DEVTYPE_FILE ) 611 if ( cardtype != DEVTYPE_FILE )
612 { 612 {
613 // connect socket notifier and start channel hopper 613 // connect socket notifier and start channel hopper
614 connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); 614 connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
615 connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); 615 connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) );
616 } 616 }
617 else 617 else
618 { 618 {
619 // start timer for reading packets 619 // start timer for reading packets
620 startTimer( 100 ); 620 startTimer( 100 );
621 } 621 }
622 622
623 logwindow->log( "(i) Started Scanning." ); 623 logwindow->log( "(i) Started Scanning." );
624 sniffing = true; 624 sniffing = true;
625 625
626 #ifdef QWS 626 #ifdef QWS
627 if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() ) 627 if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() )
628 { 628 {
629 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable; 629 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable;
630 } 630 }
631 #else 631 #else
632 #warning FIXME: setScreenSaverMode is not operational on the X11 build 632 #warning FIXME: setScreenSaverMode is not operational on the X11 build
633 #endif 633 #endif
634 634
635 emit( startedSniffing() ); 635 emit( startedSniffing() );
636 if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title 636 if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title
637 else 637 else
638 { 638 {
639 assert( parent() ); 639 assert( parent() );
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