summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp12
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.h2
2 files changed, 14 insertions, 0 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 365efb0..1d4a98b 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -1,163 +1,175 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14***********************************************************************/ 14***********************************************************************/
15 15
16// Local 16// Local
17 17
18#include "gps.h" 18#include "gps.h"
19#include "wellenreiter.h" 19#include "wellenreiter.h"
20#include "scanlist.h" 20#include "scanlist.h"
21#include "logwindow.h" 21#include "logwindow.h"
22#include "hexwindow.h" 22#include "hexwindow.h"
23#include "configwindow.h" 23#include "configwindow.h"
24#include "statwindow.h" 24#include "statwindow.h"
25#include "graphwindow.h" 25#include "graphwindow.h"
26#include "protolistview.h" 26#include "protolistview.h"
27 27
28// Opie 28// Opie
29 29
30#ifdef QWS 30#ifdef QWS
31#include <opie/odevice.h> 31#include <opie/odevice.h>
32#include <qpe/qcopenvelope_qws.h> 32#include <qpe/qcopenvelope_qws.h>
33using namespace Opie; 33using namespace Opie;
34#endif 34#endif
35 35
36#ifdef QWS 36#ifdef QWS
37#include <opie2/oapplication.h> 37#include <opie2/oapplication.h>
38#else 38#else
39#include <qapplication.h> 39#include <qapplication.h>
40#endif 40#endif
41#include <opie2/omanufacturerdb.h>
41#include <opie2/onetwork.h> 42#include <opie2/onetwork.h>
42#include <opie2/opcap.h> 43#include <opie2/opcap.h>
43 44
44// Qt 45// Qt
45 46
46#include <qcheckbox.h> 47#include <qcheckbox.h>
47#include <qcombobox.h> 48#include <qcombobox.h>
48#include <qdatetime.h> 49#include <qdatetime.h>
49#include <qpushbutton.h> 50#include <qpushbutton.h>
50#include <qlineedit.h> 51#include <qlineedit.h>
51#include <qmessagebox.h> 52#include <qmessagebox.h>
52#include <qobjectlist.h> 53#include <qobjectlist.h>
53#include <qregexp.h> 54#include <qregexp.h>
54#include <qspinbox.h> 55#include <qspinbox.h>
56#include <qtimer.h>
55#include <qtoolbutton.h> 57#include <qtoolbutton.h>
56#include <qmainwindow.h> 58#include <qmainwindow.h>
57 59
58// Standard 60// Standard
59 61
60#include <assert.h> 62#include <assert.h>
61#include <errno.h> 63#include <errno.h>
62#include <unistd.h> 64#include <unistd.h>
63#include <string.h> 65#include <string.h>
64#include <sys/types.h> 66#include <sys/types.h>
65#include <stdlib.h> 67#include <stdlib.h>
66 68
67Wellenreiter::Wellenreiter( QWidget* parent ) 69Wellenreiter::Wellenreiter( QWidget* parent )
68 : WellenreiterBase( parent, 0, 0 ), 70 : WellenreiterBase( parent, 0, 0 ),
69 sniffing( false ), iface( 0 ), configwindow( 0 ) 71 sniffing( false ), iface( 0 ), configwindow( 0 )
70{ 72{
71 73
72 logwindow->log( "(i) Wellenreiter has been started." ); 74 logwindow->log( "(i) Wellenreiter has been started." );
73 75
74 // 76 //
75 // detect operating system 77 // detect operating system
76 // 78 //
77 79
78 #ifdef QWS 80 #ifdef QWS
79 QString sys; 81 QString sys;
80 sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); 82 sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() );
81 _system = ODevice::inst()->system(); 83 _system = ODevice::inst()->system();
82 logwindow->log( sys ); 84 logwindow->log( sys );
83 #endif 85 #endif
84 86
85 netview->setColumnWidthMode( 1, QListView::Manual ); 87 netview->setColumnWidthMode( 1, QListView::Manual );
86 connect( netview, SIGNAL( joinNetwork(const QString&,const QString&,int,const QString&) ), 88 connect( netview, SIGNAL( joinNetwork(const QString&,const QString&,int,const QString&) ),
87 this, SLOT( joinNetwork(const QString&,const QString&,int,const QString&) ) ); 89 this, SLOT( joinNetwork(const QString&,const QString&,int,const QString&) ) );
88 pcap = new OPacketCapturer(); 90 pcap = new OPacketCapturer();
89 91
90 gps = new GPS( this ); 92 gps = new GPS( this );
93
94 QTimer::singleShot( 1000, this, SLOT( initialTimer() ) );
95
91} 96}
92 97
93 98
94Wellenreiter::~Wellenreiter() 99Wellenreiter::~Wellenreiter()
95{ 100{
96 delete pcap; 101 delete pcap;
97} 102}
98 103
99 104
105void Wellenreiter::initialTimer()
106{
107 qDebug( "Wellenreiter::preloading manufacturer database..." );
108 OManufacturerDB::instance();
109}
110
111
100void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) 112void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw )
101{ 113{
102 configwindow = cw; 114 configwindow = cw;
103} 115}
104 116
105 117
106void Wellenreiter::channelHopped(int c) 118void Wellenreiter::channelHopped(int c)
107{ 119{
108 QString title = "Wellenreiter II -scan- ["; 120 QString title = "Wellenreiter II -scan- [";
109 QString left; 121 QString left;
110 if ( c > 1 ) left.fill( '.', c-1 ); 122 if ( c > 1 ) left.fill( '.', c-1 );
111 title.append( left ); 123 title.append( left );
112 title.append( '|' ); 124 title.append( '|' );
113 if ( c < iface->channels() ) 125 if ( c < iface->channels() )
114 { 126 {
115 QString right; 127 QString right;
116 right.fill( '.', iface->channels()-c ); 128 right.fill( '.', iface->channels()-c );
117 title.append( right ); 129 title.append( right );
118 } 130 }
119 title.append( "]" ); 131 title.append( "]" );
120 //title.append( QString().sprintf( " %02d", c ) ); 132 //title.append( QString().sprintf( " %02d", c ) );
121 assert( parent() ); 133 assert( parent() );
122 ( (QMainWindow*) parent() )->setCaption( title ); 134 ( (QMainWindow*) parent() )->setCaption( title );
123} 135}
124 136
125 137
126void Wellenreiter::handleNotification( OPacket* p ) 138void Wellenreiter::handleNotification( OPacket* p )
127{ 139{
128 QObjectList* l = p->queryList(); 140 QObjectList* l = p->queryList();
129 QObjectListIt it( *l ); 141 QObjectListIt it( *l );
130 QObject* o; 142 QObject* o;
131 143
132 while ( (o = it.current()) != 0 ) 144 while ( (o = it.current()) != 0 )
133 { 145 {
134 QString name = it.current()->name(); 146 QString name = it.current()->name();
135 if ( configwindow->parsePackets->isProtocolChecked( name ) ) 147 if ( configwindow->parsePackets->isProtocolChecked( name ) )
136 { 148 {
137 QString action = configwindow->parsePackets->protocolAction( name ); 149 QString action = configwindow->parsePackets->protocolAction( name );
138 qDebug( "parsePacket-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); 150 qDebug( "parsePacket-action for '%s' seems to be '%s'", (const char*) name, (const char*) action );
139 doAction( action, name, p ); 151 doAction( action, name, p );
140 } 152 }
141 else 153 else
142 { 154 {
143 qDebug( "protocol '%s' not checked in parsePackets.", (const char*) name ); 155 qDebug( "protocol '%s' not checked in parsePackets.", (const char*) name );
144 } 156 }
145 ++it; 157 ++it;
146 } 158 }
147} 159}
148 160
149 161
150void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) 162void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon )
151{ 163{
152 QString type; 164 QString type;
153 if ( beacon->canIBSS() ) 165 if ( beacon->canIBSS() )
154 { 166 {
155 type = "adhoc"; 167 type = "adhoc";
156 } 168 }
157 else if ( beacon->canESS() ) 169 else if ( beacon->canESS() )
158 { 170 {
159 type = "managed"; 171 type = "managed";
160 } 172 }
161 else 173 else
162 { 174 {
163 qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); 175 qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" );
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h
index 25a5e8d..d882500 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.h
+++ b/noncore/net/wellenreiter/gui/wellenreiter.h
@@ -1,100 +1,102 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#ifndef WELLENREITER_H 16#ifndef WELLENREITER_H
17#define WELLENREITER_H 17#define WELLENREITER_H
18 18
19#include "wellenreiterbase.h" 19#include "wellenreiterbase.h"
20 20
21#ifdef QWS 21#ifdef QWS
22#include <opie/odevice.h> 22#include <opie/odevice.h>
23using namespace Opie; 23using namespace Opie;
24#endif 24#endif
25 25
26class QTimerEvent; 26class QTimerEvent;
27class QPixmap; 27class QPixmap;
28class OPacket; 28class OPacket;
29class OWaveLanManagementPacket; 29class OWaveLanManagementPacket;
30class OWaveLanDataPacket; 30class OWaveLanDataPacket;
31class OEthernetPacket; 31class OEthernetPacket;
32class OARPPacket; 32class OARPPacket;
33class OMacAddress; 33class OMacAddress;
34class OIPPacket; 34class OIPPacket;
35class OPacketCapturer; 35class OPacketCapturer;
36class OWirelessNetworkInterface; 36class OWirelessNetworkInterface;
37class WellenreiterConfigWindow; 37class WellenreiterConfigWindow;
38class MLogWindow; 38class MLogWindow;
39class MHexWindow; 39class MHexWindow;
40class GPS; 40class GPS;
41 41
42class Wellenreiter : public WellenreiterBase { 42class Wellenreiter : public WellenreiterBase {
43 Q_OBJECT 43 Q_OBJECT
44 44
45 public: 45 public:
46 Wellenreiter( QWidget* parent = 0 ); 46 Wellenreiter( QWidget* parent = 0 );
47 ~Wellenreiter(); 47 ~Wellenreiter();
48 48
49 void setConfigWindow( WellenreiterConfigWindow* cw ); 49 void setConfigWindow( WellenreiterConfigWindow* cw );
50 MScanListView* netView() const { return netview; }; 50 MScanListView* netView() const { return netview; };
51 MLogWindow* logWindow() const { return logwindow; }; 51 MLogWindow* logWindow() const { return logwindow; };
52 MHexWindow* hexWindow() const { return hexwindow; }; 52 MHexWindow* hexWindow() const { return hexwindow; };
53 bool isDaemonRunning() const { return sniffing; }; 53 bool isDaemonRunning() const { return sniffing; };
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();
63
62 void channelHopped(int); 64 void channelHopped(int);
63 void receivePacket(OPacket*); 65 void receivePacket(OPacket*);
64 void startClicked(); 66 void startClicked();
65 void stopClicked(); 67 void stopClicked();
66 68
67 void joinNetwork(const QString&,const QString&,int,const QString&); 69 void joinNetwork(const QString&,const QString&,int,const QString&);
68 70
69 signals: 71 signals:
70 void startedSniffing(); 72 void startedSniffing();
71 void stoppedSniffing(); 73 void stoppedSniffing();
72 74
73 private: 75 private:
74 void handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ); 76 void handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon );
75 void handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ); 77 void handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to );
76 void handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ); 78 void handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to );
77 void handleARPData( OPacket* p, OARPPacket* arp, OMacAddress& from, OMacAddress& to ); 79 void handleARPData( OPacket* p, OARPPacket* arp, OMacAddress& from, OMacAddress& to );
78 void handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& from, OMacAddress& to ); 80 void handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& from, OMacAddress& to );
79 void handleNotification( OPacket* p ); 81 void handleNotification( OPacket* p );
80 void doAction( const QString& action, const QString& protocol, OPacket* p ); 82 void doAction( const QString& action, const QString& protocol, OPacket* p );
81 QObject* childIfToParse( OPacket* p, const QString& protocol ); 83 QObject* childIfToParse( OPacket* p, const QString& protocol );
82 bool checkDumpPacket( OPacket* p ); 84 bool checkDumpPacket( OPacket* p );
83 85
84 private: 86 private:
85 #ifdef QWS 87 #ifdef QWS
86 OSystem _system; // Opie Operating System identifier 88 OSystem _system; // Opie Operating System identifier
87 #endif 89 #endif
88 90
89 OWirelessNetworkInterface* iface; 91 OWirelessNetworkInterface* iface;
90 OPacketCapturer* pcap; 92 OPacketCapturer* pcap;
91 WellenreiterConfigWindow* configwindow; 93 WellenreiterConfigWindow* configwindow;
92 GPS* gps; 94 GPS* gps;
93 95
94 //void readConfig(); 96 //void readConfig();
95 //void writeConfig(); 97 //void writeConfig();
96}; 98};
97 99
98 100
99 101
100#endif 102#endif