-rw-r--r-- | noncore/net/wellenreiter/gui/protolistview.cpp | 12 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/protolistview.h | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 75 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.h | 3 |
4 files changed, 77 insertions, 15 deletions
diff --git a/noncore/net/wellenreiter/gui/protolistview.cpp b/noncore/net/wellenreiter/gui/protolistview.cpp index 05ff5e7..d4b0dfe 100644 --- a/noncore/net/wellenreiter/gui/protolistview.cpp +++ b/noncore/net/wellenreiter/gui/protolistview.cpp | |||
@@ -1,111 +1,117 @@ | |||
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 | #include "protolistview.h" | 17 | #include "protolistview.h" |
18 | 18 | ||
19 | #include <qcheckbox.h> | 19 | #include <qcheckbox.h> |
20 | #include <qcombobox.h> | 20 | #include <qcombobox.h> |
21 | #include <qhbox.h> | 21 | #include <qhbox.h> |
22 | #include <qvbox.h> | 22 | #include <qvbox.h> |
23 | #include <qpalette.h> | 23 | #include <qpalette.h> |
24 | #include <qcolor.h> | 24 | #include <qcolor.h> |
25 | #include <qlabel.h> | 25 | #include <qlabel.h> |
26 | #include <qframe.h> | 26 | #include <qframe.h> |
27 | 27 | ||
28 | ProtocolListView::ProtocolListView( QWidget* parent, const char* name, WFlags f ) | 28 | ProtocolListView::ProtocolListView( QWidget* parent, const char* name, WFlags f ) |
29 | :QScrollView( parent, name, f ) | 29 | :QScrollView( parent, name, f ) |
30 | { | 30 | { |
31 | actions = ( QString( "parsePackets" ) == QString( name ) ); | 31 | actions = ( QString( "parsePackets" ) == QString( name ) ); |
32 | 32 | ||
33 | setMargins( 3, 3, 0, 0 ); | 33 | setMargins( 3, 3, 0, 0 ); |
34 | viewport()->setBackgroundColor( QCheckBox(0).palette().color( QPalette::Active, QColorGroup::Background ) ); | 34 | viewport()->setBackgroundColor( QCheckBox(0).palette().color( QPalette::Active, QColorGroup::Background ) ); |
35 | 35 | ||
36 | vbox = new QVBox( viewport() ); | 36 | vbox = new QVBox( viewport() ); |
37 | vbox->setSpacing( 1 ); | 37 | vbox->setSpacing( 1 ); |
38 | addChild( vbox ); | 38 | addChild( vbox ); |
39 | 39 | ||
40 | QHBox* hbox = new QHBox( vbox ); | 40 | QHBox* hbox = new QHBox( vbox ); |
41 | hbox->setSpacing( 40 ); | 41 | hbox->setSpacing( 40 ); |
42 | new QLabel( tr( "Protocol Family" ), hbox ); | 42 | new QLabel( tr( "Protocol Family" ), hbox ); |
43 | if ( actions ) new QLabel( tr( "Perform Action" ), hbox ); | 43 | if ( actions ) new QLabel( tr( "Perform Action" ), hbox ); |
44 | QFrame* frame = new QFrame( vbox ); | 44 | QFrame* frame = new QFrame( vbox ); |
45 | frame->setFrameStyle( QFrame::HLine + QFrame::Sunken ); | 45 | frame->setFrameStyle( QFrame::HLine + QFrame::Sunken ); |
46 | 46 | ||
47 | //TODO: hardcoded for now...a protocol database would be nice!? | 47 | //TODO: hardcoded for now...a protocol database would be nice!? |
48 | 48 | ||
49 | //addProtocol( "Ethernet" ); | 49 | //addProtocol( "Ethernet" ); |
50 | addProtocol( "Prism" ); | 50 | addProtocol( "Prism" ); |
51 | //addProtocol( "802.11" ); | 51 | //addProtocol( "802.11" ); |
52 | addProtocol( "802.11 Management" ); | 52 | addProtocol( "802.11 Management" ); |
53 | addProtocol( "802.11 SSID" ); | 53 | addProtocol( "802.11 SSID" ); |
54 | addProtocol( "802.11 Rates" ); | 54 | addProtocol( "802.11 Rates" ); |
55 | addProtocol( "802.11 CF" ); | 55 | addProtocol( "802.11 CF" ); |
56 | addProtocol( "802.11 FH" ); | 56 | addProtocol( "802.11 FH" ); |
57 | addProtocol( "802.11 DS" ); | 57 | addProtocol( "802.11 DS" ); |
58 | addProtocol( "802.11 Tim" ); | 58 | addProtocol( "802.11 Tim" ); |
59 | addProtocol( "802.11 IBSS" ); | 59 | addProtocol( "802.11 IBSS" ); |
60 | addProtocol( "802.11 Challenge" ); | 60 | addProtocol( "802.11 Challenge" ); |
61 | addProtocol( "802.11 Data" ); | 61 | addProtocol( "802.11 Data" ); |
62 | addProtocol( "802.11 LLC" ); | 62 | addProtocol( "802.11 LLC" ); |
63 | addProtocol( "802.11 Data" ); | 63 | addProtocol( "802.11 Data" ); |
64 | addProtocol( "IP" ); | 64 | addProtocol( "IP" ); |
65 | addProtocol( "ARP" ); | 65 | addProtocol( "ARP" ); |
66 | addProtocol( "UDP" ); | 66 | addProtocol( "UDP" ); |
67 | addProtocol( "TCP" ); | 67 | addProtocol( "TCP" ); |
68 | } | 68 | } |
69 | 69 | ||
70 | 70 | ||
71 | ProtocolListView::~ProtocolListView() | 71 | ProtocolListView::~ProtocolListView() |
72 | { | 72 | { |
73 | } | 73 | } |
74 | 74 | ||
75 | 75 | ||
76 | void ProtocolListView::addProtocol( const QString& name ) | 76 | void ProtocolListView::addProtocol( const QString& name ) |
77 | { | 77 | { |
78 | QHBox* hbox = new QHBox( vbox ); | 78 | QHBox* hbox = new QHBox( vbox ); |
79 | new QCheckBox( name, hbox, (const char*) name ); | 79 | new QCheckBox( name, hbox, (const char*) name ); |
80 | 80 | ||
81 | if ( actions ) | 81 | if ( actions ) |
82 | { | 82 | { |
83 | QComboBox* combo = new QComboBox( hbox, (const char*) name ); | 83 | QComboBox* combo = new QComboBox( hbox, (const char*) name ); |
84 | #ifdef QWS | 84 | #ifdef QWS |
85 | combo->setFixedWidth( 75 ); | 85 | combo->setFixedWidth( 75 ); |
86 | #endif | 86 | #endif |
87 | combo->insertItem( "Ignore" ); | 87 | combo->insertItem( "Ignore" ); |
88 | combo->insertItem( "TouchSound" ); | 88 | combo->insertItem( "TouchSound" ); |
89 | combo->insertItem( "AlarmSound" ); | 89 | combo->insertItem( "AlarmSound" ); |
90 | combo->insertItem( "KeySound" ); | 90 | combo->insertItem( "KeySound" ); |
91 | combo->insertItem( "LedOn" ); | 91 | combo->insertItem( "LedOn" ); |
92 | combo->insertItem( "LedOff" ); | 92 | combo->insertItem( "LedOff" ); |
93 | combo->insertItem( "LogMessage" ); | 93 | combo->insertItem( "LogMessage" ); |
94 | combo->insertItem( "MessageBox" ); | 94 | combo->insertItem( "MessageBox" ); |
95 | } | 95 | } |
96 | } | 96 | } |
97 | 97 | ||
98 | 98 | ||
99 | bool ProtocolListView::isProtocolChecked( const QString& name ) | 99 | bool ProtocolListView::isProtocolChecked( const QString& name ) |
100 | { | 100 | { |
101 | QCheckBox* box = (QCheckBox*) child( (const char*) name ); | 101 | QCheckBox* box = (QCheckBox*) child( (const char*) name ); |
102 | return ( box && box->isOn() ); | 102 | return ( box && box->isOn() ); |
103 | } | 103 | } |
104 | 104 | ||
105 | 105 | ||
106 | QString ProtocolListView::protocolAction( const QString& name ) const | 106 | QString ProtocolListView::protocolAction( const QString& name ) |
107 | { | 107 | { |
108 | //FIXME | 108 | //QObject * child ( const char * objName, const char * inheritsClass = 0, |
109 | // bool recursiveSearch = TRUE ) | ||
110 | |||
111 | QComboBox* combo = (QComboBox*) child( (const char*) name, "QComboBox" ); | ||
112 | if ( combo ) | ||
113 | return combo->currentText(); | ||
114 | else | ||
115 | return "<unknown>"; | ||
109 | } | 116 | } |
110 | 117 | ||
111 | |||
diff --git a/noncore/net/wellenreiter/gui/protolistview.h b/noncore/net/wellenreiter/gui/protolistview.h index 723e8cd..166b648 100644 --- a/noncore/net/wellenreiter/gui/protolistview.h +++ b/noncore/net/wellenreiter/gui/protolistview.h | |||
@@ -1,47 +1,47 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #ifndef PROTOLISTVIEW_H | 16 | #ifndef PROTOLISTVIEW_H |
17 | #define PROTOLISTVIEW_H | 17 | #define PROTOLISTVIEW_H |
18 | 18 | ||
19 | #include <qscrollview.h> | 19 | #include <qscrollview.h> |
20 | #include <qdict.h> | 20 | #include <qdict.h> |
21 | //#include <qcheckbox.h> | 21 | //#include <qcheckbox.h> |
22 | //#include <qcombobox.h> | 22 | //#include <qcombobox.h> |
23 | class QCheckBox; | 23 | class QCheckBox; |
24 | class QComboBox; | 24 | class QComboBox; |
25 | 25 | ||
26 | class QVBox; | 26 | class QVBox; |
27 | 27 | ||
28 | class ProtocolListView : public QScrollView | 28 | class ProtocolListView : public QScrollView |
29 | { | 29 | { |
30 | public: | 30 | public: |
31 | ProtocolListView( QWidget* parent = 0, const char* name = 0, WFlags f = 0 ); | 31 | ProtocolListView( QWidget* parent = 0, const char* name = 0, WFlags f = 0 ); |
32 | virtual ~ProtocolListView(); | 32 | virtual ~ProtocolListView(); |
33 | 33 | ||
34 | bool isProtocolChecked( const QString& name ); | 34 | bool isProtocolChecked( const QString& name ); |
35 | QString protocolAction( const QString& name ) const; | 35 | QString protocolAction( const QString& name ); |
36 | 36 | ||
37 | protected: | 37 | protected: |
38 | virtual void addProtocol( const QString& name ); | 38 | virtual void addProtocol( const QString& name ); |
39 | 39 | ||
40 | private: | 40 | private: |
41 | QVBox* vbox; | 41 | QVBox* vbox; |
42 | bool actions; | 42 | bool actions; |
43 | }; | 43 | }; |
44 | 44 | ||
45 | 45 | ||
46 | 46 | ||
47 | #endif // PROTOLISTVIEW_H | 47 | #endif // PROTOLISTVIEW_H |
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 2f3d093..edf7dcf 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -1,433 +1,486 @@ | |||
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 | ||
17 | |||
18 | #include "wellenreiter.h" | ||
19 | #include "scanlist.h" | ||
20 | #include "logwindow.h" | ||
21 | #include "hexwindow.h" | ||
22 | #include "configwindow.h" | ||
23 | #include "statwindow.h" | ||
24 | #include "graphwindow.h" | ||
25 | #include "manufacturers.h" | ||
26 | #include "protolistview.h" | ||
27 | |||
16 | // Opie | 28 | // Opie |
17 | 29 | ||
18 | #ifdef QWS | 30 | #ifdef QWS |
19 | #include <opie/odevice.h> | 31 | #include <opie/odevice.h> |
20 | using namespace Opie; | 32 | using namespace Opie; |
21 | #endif | 33 | #endif |
22 | 34 | ||
23 | #ifdef QWS | 35 | #ifdef QWS |
24 | #include <opie2/oapplication.h> | 36 | #include <opie2/oapplication.h> |
25 | #else | 37 | #else |
26 | #include <qapplication.h> | 38 | #include <qapplication.h> |
27 | #endif | 39 | #endif |
28 | #include <opie2/onetwork.h> | 40 | #include <opie2/onetwork.h> |
29 | #include <opie2/opcap.h> | 41 | #include <opie2/opcap.h> |
30 | 42 | ||
31 | // Qt | 43 | // Qt |
32 | 44 | ||
33 | #include <qcheckbox.h> | 45 | #include <qcheckbox.h> |
34 | #include <qcombobox.h> | 46 | #include <qcombobox.h> |
35 | #include <qdatetime.h> | 47 | #include <qdatetime.h> |
36 | #include <qpushbutton.h> | 48 | #include <qpushbutton.h> |
37 | #include <qlineedit.h> | 49 | #include <qlineedit.h> |
38 | #include <qmessagebox.h> | 50 | #include <qmessagebox.h> |
51 | #include <qobjectlist.h> | ||
39 | #include <qregexp.h> | 52 | #include <qregexp.h> |
40 | #include <qspinbox.h> | 53 | #include <qspinbox.h> |
41 | #include <qtoolbutton.h> | 54 | #include <qtoolbutton.h> |
42 | #include <qmainwindow.h> | 55 | #include <qmainwindow.h> |
43 | 56 | ||
44 | // Standard | 57 | // Standard |
45 | 58 | ||
46 | #include <assert.h> | 59 | #include <assert.h> |
47 | #include <errno.h> | 60 | #include <errno.h> |
48 | #include <unistd.h> | 61 | #include <unistd.h> |
49 | #include <string.h> | 62 | #include <string.h> |
50 | #include <sys/types.h> | 63 | #include <sys/types.h> |
51 | #include <stdlib.h> | 64 | #include <stdlib.h> |
52 | 65 | ||
53 | // Local | ||
54 | |||
55 | #include "wellenreiter.h" | ||
56 | #include "scanlist.h" | ||
57 | #include "logwindow.h" | ||
58 | #include "hexwindow.h" | ||
59 | #include "configwindow.h" | ||
60 | #include "statwindow.h" | ||
61 | #include "graphwindow.h" | ||
62 | #include "manufacturers.h" | ||
63 | |||
64 | Wellenreiter::Wellenreiter( QWidget* parent ) | 66 | Wellenreiter::Wellenreiter( QWidget* parent ) |
65 | : WellenreiterBase( parent, 0, 0 ), | 67 | : WellenreiterBase( parent, 0, 0 ), |
66 | sniffing( false ), iface( 0 ), manufacturerdb( 0 ), configwindow( 0 ) | 68 | sniffing( false ), iface( 0 ), manufacturerdb( 0 ), configwindow( 0 ) |
67 | { | 69 | { |
68 | 70 | ||
69 | // | 71 | // |
70 | // construct manufacturer database | 72 | // construct manufacturer database |
71 | // | 73 | // |
72 | 74 | ||
73 | QString manufile; | 75 | QString manufile; |
74 | #ifdef QWS | 76 | #ifdef QWS |
75 | manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) QPEApplication::qpeDir() ); | 77 | manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) QPEApplication::qpeDir() ); |
76 | #else | 78 | #else |
77 | manufile.sprintf( "/usr/local/share/wellenreiter/manufacturers.dat" ); | 79 | manufile.sprintf( "/usr/local/share/wellenreiter/manufacturers.dat" ); |
78 | #endif | 80 | #endif |
79 | manufacturerdb = new ManufacturerDB( manufile ); | 81 | manufacturerdb = new ManufacturerDB( manufile ); |
80 | 82 | ||
81 | logwindow->log( "(i) Wellenreiter has been started." ); | 83 | logwindow->log( "(i) Wellenreiter has been started." ); |
82 | 84 | ||
83 | // | 85 | // |
84 | // detect operating system | 86 | // detect operating system |
85 | // | 87 | // |
86 | 88 | ||
87 | #ifdef QWS | 89 | #ifdef QWS |
88 | QString sys; | 90 | QString sys; |
89 | sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); | 91 | sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); |
90 | _system = ODevice::inst()->system(); | 92 | _system = ODevice::inst()->system(); |
91 | logwindow->log( sys ); | 93 | logwindow->log( sys ); |
92 | #endif | 94 | #endif |
93 | 95 | ||
94 | // setup GUI | 96 | // setup GUI |
95 | netview->setColumnWidthMode( 1, QListView::Manual ); | 97 | netview->setColumnWidthMode( 1, QListView::Manual ); |
96 | 98 | ||
97 | if ( manufacturerdb ) | 99 | if ( manufacturerdb ) |
98 | netview->setManufacturerDB( manufacturerdb ); | 100 | netview->setManufacturerDB( manufacturerdb ); |
99 | 101 | ||
100 | pcap = new OPacketCapturer(); | 102 | pcap = new OPacketCapturer(); |
101 | 103 | ||
102 | } | 104 | } |
103 | 105 | ||
104 | 106 | ||
105 | Wellenreiter::~Wellenreiter() | 107 | Wellenreiter::~Wellenreiter() |
106 | { | 108 | { |
107 | // no need to delete child widgets, Qt does it all for us | 109 | // no need to delete child widgets, Qt does it all for us |
108 | 110 | ||
109 | delete manufacturerdb; | 111 | delete manufacturerdb; |
110 | delete pcap; | 112 | delete pcap; |
111 | } | 113 | } |
112 | 114 | ||
113 | 115 | ||
114 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) | 116 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) |
115 | { | 117 | { |
116 | configwindow = cw; | 118 | configwindow = cw; |
117 | } | 119 | } |
118 | 120 | ||
119 | 121 | ||
120 | void Wellenreiter::channelHopped(int c) | 122 | void Wellenreiter::channelHopped(int c) |
121 | { | 123 | { |
122 | QString title = "Wellenreiter II -scan- ["; | 124 | QString title = "Wellenreiter II -scan- ["; |
123 | QString left; | 125 | QString left; |
124 | if ( c > 1 ) left.fill( '.', c-1 ); | 126 | if ( c > 1 ) left.fill( '.', c-1 ); |
125 | title.append( left ); | 127 | title.append( left ); |
126 | title.append( '|' ); | 128 | title.append( '|' ); |
127 | if ( c < iface->channels() ) | 129 | if ( c < iface->channels() ) |
128 | { | 130 | { |
129 | QString right; | 131 | QString right; |
130 | right.fill( '.', iface->channels()-c ); | 132 | right.fill( '.', iface->channels()-c ); |
131 | title.append( right ); | 133 | title.append( right ); |
132 | } | 134 | } |
133 | title.append( "]" ); | 135 | title.append( "]" ); |
134 | //title.append( QString().sprintf( " %02d", c ) ); | 136 | //title.append( QString().sprintf( " %02d", c ) ); |
135 | assert( parent() ); | 137 | assert( parent() ); |
136 | ( (QMainWindow*) parent() )->setCaption( title ); | 138 | ( (QMainWindow*) parent() )->setCaption( title ); |
137 | } | 139 | } |
138 | 140 | ||
139 | 141 | ||
142 | void Wellenreiter::handleNotification( OPacket* p ) | ||
143 | { | ||
144 | QObjectList* l = p->queryList(); | ||
145 | QObjectListIt it( *l ); | ||
146 | QObject* o; | ||
147 | |||
148 | while ( (o = it.current()) != 0 ) | ||
149 | { | ||
150 | QString name = it.current()->name(); | ||
151 | if ( configwindow->parsePackets->isProtocolChecked( name ) ) | ||
152 | { | ||
153 | QString action = configwindow->parsePackets->protocolAction( name ); | ||
154 | qDebug( "action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); | ||
155 | doAction( action, name, p ); | ||
156 | } | ||
157 | else | ||
158 | { | ||
159 | qDebug( "protocol '%s' not checked.", (const char*) name ); | ||
160 | } | ||
161 | ++it; | ||
162 | } | ||
163 | } | ||
164 | |||
165 | |||
140 | void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) | 166 | void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) |
141 | { | 167 | { |
142 | QString type; | 168 | QString type; |
143 | if ( beacon->canIBSS() ) | 169 | if ( beacon->canIBSS() ) |
144 | { | 170 | { |
145 | type = "adhoc"; | 171 | type = "adhoc"; |
146 | } | 172 | } |
147 | else if ( beacon->canESS() ) | 173 | else if ( beacon->canESS() ) |
148 | { | 174 | { |
149 | type = "managed"; | 175 | type = "managed"; |
150 | } | 176 | } |
151 | else | 177 | else |
152 | { | 178 | { |
153 | qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); | 179 | qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); |
154 | return; | 180 | return; |
155 | } | 181 | } |
156 | 182 | ||
157 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); | 183 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); |
158 | QString essid = ssid ? ssid->ID() : QString("<unknown>"); | 184 | QString essid = ssid ? ssid->ID() : QString("<unknown>"); |
159 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); | 185 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); |
160 | int channel = ds ? ds->channel() : -1; | 186 | int channel = ds ? ds->channel() : -1; |
161 | 187 | ||
162 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 188 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
163 | netView()->addNewItem( type, essid, header->macAddress2().toString(), beacon->canPrivacy(), channel, 0 ); | 189 | netView()->addNewItem( type, essid, header->macAddress2().toString(), beacon->canPrivacy(), channel, 0 ); |
164 | 190 | ||
165 | // update graph window | 191 | // update graph window |
166 | if ( ds ) | 192 | if ( ds ) |
167 | { | 193 | { |
168 | OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); | 194 | OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); |
169 | if ( prism ) | 195 | if ( prism ) |
170 | graphwindow->traffic( ds->channel(), prism->signalStrength() ); | 196 | graphwindow->traffic( ds->channel(), prism->signalStrength() ); |
171 | else | 197 | else |
172 | graphwindow->traffic( ds->channel(), 95 ); | 198 | graphwindow->traffic( ds->channel(), 95 ); |
173 | } | 199 | } |
174 | } | 200 | } |
175 | 201 | ||
176 | 202 | ||
177 | void Wellenreiter::handleData( OPacket* p, OWaveLanDataPacket* data ) | 203 | void Wellenreiter::handleData( OPacket* p, OWaveLanDataPacket* data ) |
178 | { | 204 | { |
179 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); | 205 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); |
180 | if ( wlan->fromDS() && !wlan->toDS() ) | 206 | if ( wlan->fromDS() && !wlan->toDS() ) |
181 | { | 207 | { |
182 | qDebug( "FromDS traffic: '%s' -> '%s' via '%s'", | 208 | qDebug( "FromDS traffic: '%s' -> '%s' via '%s'", |
183 | (const char*) wlan->macAddress3().toString(true), | 209 | (const char*) wlan->macAddress3().toString(true), |
184 | (const char*) wlan->macAddress1().toString(true), | 210 | (const char*) wlan->macAddress1().toString(true), |
185 | (const char*) wlan->macAddress2().toString(true) ); | 211 | (const char*) wlan->macAddress2().toString(true) ); |
186 | netView()->fromDStraffic( wlan->macAddress3().toString(), | 212 | netView()->fromDStraffic( wlan->macAddress3().toString(), |
187 | wlan->macAddress1().toString(), | 213 | wlan->macAddress1().toString(), |
188 | wlan->macAddress2().toString() ); | 214 | wlan->macAddress2().toString() ); |
189 | } | 215 | } |
190 | else | 216 | else |
191 | if ( !wlan->fromDS() && wlan->toDS() ) | 217 | if ( !wlan->fromDS() && wlan->toDS() ) |
192 | { | 218 | { |
193 | qDebug( "ToDS traffic: '%s' -> '%s' via '%s'", | 219 | qDebug( "ToDS traffic: '%s' -> '%s' via '%s'", |
194 | (const char*) wlan->macAddress2().toString(true), | 220 | (const char*) wlan->macAddress2().toString(true), |
195 | (const char*) wlan->macAddress3().toString(true), | 221 | (const char*) wlan->macAddress3().toString(true), |
196 | (const char*) wlan->macAddress1().toString(true) ); | 222 | (const char*) wlan->macAddress1().toString(true) ); |
197 | netView()->toDStraffic( wlan->macAddress2().toString(), | 223 | netView()->toDStraffic( wlan->macAddress2().toString(), |
198 | wlan->macAddress3().toString(), | 224 | wlan->macAddress3().toString(), |
199 | wlan->macAddress1().toString() ); | 225 | wlan->macAddress1().toString() ); |
200 | } | 226 | } |
201 | else | 227 | else |
202 | if ( wlan->fromDS() && wlan->toDS() ) | 228 | if ( wlan->fromDS() && wlan->toDS() ) |
203 | { | 229 | { |
204 | qDebug( "WDS(bridge) traffic: '%s' -> '%s' via '%s' and '%s'", | 230 | qDebug( "WDS(bridge) traffic: '%s' -> '%s' via '%s' and '%s'", |
205 | (const char*) wlan->macAddress4().toString(true), | 231 | (const char*) wlan->macAddress4().toString(true), |
206 | (const char*) wlan->macAddress3().toString(true), | 232 | (const char*) wlan->macAddress3().toString(true), |
207 | (const char*) wlan->macAddress1().toString(true), | 233 | (const char*) wlan->macAddress1().toString(true), |
208 | (const char*) wlan->macAddress2().toString(true) ); | 234 | (const char*) wlan->macAddress2().toString(true) ); |
209 | netView()->WDStraffic( wlan->macAddress4().toString(), | 235 | netView()->WDStraffic( wlan->macAddress4().toString(), |
210 | wlan->macAddress3().toString(), | 236 | wlan->macAddress3().toString(), |
211 | wlan->macAddress1().toString(), | 237 | wlan->macAddress1().toString(), |
212 | wlan->macAddress2().toString() ); | 238 | wlan->macAddress2().toString() ); |
213 | } | 239 | } |
214 | else | 240 | else |
215 | { | 241 | { |
216 | qDebug( "IBSS(AdHoc) traffic: '%s' -> '%s' (Cell: '%s')'", | 242 | qDebug( "IBSS(AdHoc) traffic: '%s' -> '%s' (Cell: '%s')'", |
217 | (const char*) wlan->macAddress2().toString(true), | 243 | (const char*) wlan->macAddress2().toString(true), |
218 | (const char*) wlan->macAddress1().toString(true), | 244 | (const char*) wlan->macAddress1().toString(true), |
219 | (const char*) wlan->macAddress3().toString(true) ); | 245 | (const char*) wlan->macAddress3().toString(true) ); |
220 | netView()->IBSStraffic( wlan->macAddress2().toString(), | 246 | netView()->IBSStraffic( wlan->macAddress2().toString(), |
221 | wlan->macAddress1().toString(), | 247 | wlan->macAddress1().toString(), |
222 | wlan->macAddress3().toString() ); | 248 | wlan->macAddress3().toString() ); |
223 | } | 249 | } |
224 | 250 | ||
225 | OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); | 251 | OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); |
226 | if ( arp ) | 252 | if ( arp ) |
227 | { | 253 | { |
228 | qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() ); | 254 | qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() ); |
229 | if ( arp->type() == "REQUEST" ) | 255 | if ( arp->type() == "REQUEST" ) |
230 | { | 256 | { |
231 | netView()->identify( arp->senderMacAddress().toString(), arp->senderIPV4Address().toString() ); | 257 | netView()->identify( arp->senderMacAddress().toString(), arp->senderIPV4Address().toString() ); |
232 | } | 258 | } |
233 | else if ( arp->type() == "REPLY" ) | 259 | else if ( arp->type() == "REPLY" ) |
234 | { | 260 | { |
235 | netView()->identify( arp->senderMacAddress().toString(), arp->senderIPV4Address().toString() ); | 261 | netView()->identify( arp->senderMacAddress().toString(), arp->senderIPV4Address().toString() ); |
236 | netView()->identify( arp->targetMacAddress().toString(), arp->targetIPV4Address().toString() ); | 262 | netView()->identify( arp->targetMacAddress().toString(), arp->targetIPV4Address().toString() ); |
237 | } | 263 | } |
238 | } | 264 | } |
239 | 265 | ||
240 | OIPPacket* ip = (OIPPacket*) p->child( "IP" ); | 266 | OIPPacket* ip = (OIPPacket*) p->child( "IP" ); |
241 | if ( ip ) | 267 | if ( ip ) |
242 | { | 268 | { |
243 | qDebug( "Received IP packet." ); | 269 | qDebug( "Received IP packet." ); |
244 | } | 270 | } |
245 | } | 271 | } |
246 | 272 | ||
247 | 273 | ||
274 | QObject* childIfToParse( OPacket* p, const QString& protocol ) | ||
275 | { | ||
276 | //FIXME: Implement | ||
277 | } | ||
278 | |||
279 | |||
248 | void Wellenreiter::receivePacket( OPacket* p ) | 280 | void Wellenreiter::receivePacket( OPacket* p ) |
249 | { | 281 | { |
250 | hexWindow()->log( p->dump( 8 ) ); | 282 | hexWindow()->log( p->dump( 8 ) ); |
251 | 283 | ||
284 | handleNotification( p ); | ||
285 | |||
252 | // check if we received a beacon frame | 286 | // check if we received a beacon frame |
253 | OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); | 287 | OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); |
254 | if ( beacon && beacon->managementType() == "Beacon" ) | 288 | if ( beacon && beacon->managementType() == "Beacon" ) |
255 | { | 289 | { |
256 | handleBeacon( p, beacon ); | 290 | handleBeacon( p, beacon ); |
257 | return; | 291 | return; |
258 | } | 292 | } |
259 | 293 | ||
260 | //TODO: WEP check here | 294 | //TODO: WEP check here |
261 | 295 | ||
262 | // check for a data frame | 296 | // check for a data frame |
263 | OWaveLanDataPacket* data = static_cast<OWaveLanDataPacket*>( p->child( "802.11 Data" ) ); | 297 | OWaveLanDataPacket* data = static_cast<OWaveLanDataPacket*>( p->child( "802.11 Data" ) ); |
264 | if ( data ) | 298 | if ( data ) |
265 | { | 299 | { |
266 | handleData( p, data ); | 300 | handleData( p, data ); |
267 | } | 301 | } |
268 | } | 302 | } |
269 | 303 | ||
270 | 304 | ||
271 | void Wellenreiter::stopClicked() | 305 | void Wellenreiter::stopClicked() |
272 | { | 306 | { |
273 | if ( iface ) | 307 | if ( iface ) |
274 | { | 308 | { |
275 | disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); | 309 | disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); |
276 | disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | 310 | disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); |
277 | iface->setChannelHopping(); // stop hopping channels | 311 | iface->setChannelHopping(); // stop hopping channels |
278 | } | 312 | } |
279 | else | 313 | else |
280 | killTimers(); | 314 | killTimers(); |
281 | 315 | ||
282 | pcap->close(); | 316 | pcap->close(); |
283 | sniffing = false; | 317 | sniffing = false; |
284 | 318 | ||
285 | if ( iface ) | 319 | if ( iface ) |
286 | { | 320 | { |
287 | // switch off monitor mode | 321 | // switch off monitor mode |
288 | iface->setMonitorMode( false ); | 322 | iface->setMonitorMode( false ); |
289 | // switch off promisc flag | 323 | // switch off promisc flag |
290 | iface->setPromiscuousMode( false ); | 324 | iface->setPromiscuousMode( false ); |
291 | 325 | ||
292 | system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess | 326 | system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess |
293 | } | 327 | } |
294 | 328 | ||
295 | logwindow->log( "(i) Stopped Scanning." ); | 329 | logwindow->log( "(i) Stopped Scanning." ); |
296 | assert( parent() ); | 330 | assert( parent() ); |
297 | ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); | 331 | ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); |
298 | 332 | ||
299 | // message the user | 333 | // message the user |
300 | QMessageBox::information( this, "Wellenreiter II", | 334 | QMessageBox::information( this, "Wellenreiter II", |
301 | tr( "Your wireless card\nshould now be usable again." ) ); | 335 | tr( "Your wireless card\nshould now be usable again." ) ); |
302 | 336 | ||
303 | sniffing = false; | 337 | sniffing = false; |
304 | emit( stoppedSniffing() ); | 338 | emit( stoppedSniffing() ); |
305 | 339 | ||
306 | // print out statistics | 340 | // print out statistics |
307 | for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) | 341 | for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) |
308 | statwindow->updateCounter( it.key(), it.data() ); | 342 | statwindow->updateCounter( it.key(), it.data() ); |
309 | } | 343 | } |
310 | 344 | ||
311 | 345 | ||
312 | void Wellenreiter::startClicked() | 346 | void Wellenreiter::startClicked() |
313 | { | 347 | { |
314 | // get configuration from config window | 348 | // get configuration from config window |
315 | 349 | ||
316 | const QString& interface = configwindow->interfaceName->currentText(); | 350 | const QString& interface = configwindow->interfaceName->currentText(); |
317 | const int cardtype = configwindow->driverType(); | 351 | const int cardtype = configwindow->driverType(); |
318 | const int interval = configwindow->hoppingInterval(); | 352 | const int interval = configwindow->hoppingInterval(); |
319 | 353 | ||
320 | if ( ( interface == "" ) || ( cardtype == 0 ) ) | 354 | if ( ( interface == "" ) || ( cardtype == 0 ) ) |
321 | { | 355 | { |
322 | QMessageBox::information( this, "Wellenreiter II", | 356 | QMessageBox::information( this, "Wellenreiter II", |
323 | tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); | 357 | tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); |
324 | return; | 358 | return; |
325 | } | 359 | } |
326 | 360 | ||
327 | // configure device | 361 | // configure device |
328 | 362 | ||
329 | ONetwork* net = ONetwork::instance(); | 363 | ONetwork* net = ONetwork::instance(); |
330 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); | 364 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); |
331 | 365 | ||
332 | // set monitor mode | 366 | // set monitor mode |
333 | 367 | ||
334 | bool usePrism = configwindow->usePrismHeader(); | 368 | bool usePrism = configwindow->usePrismHeader(); |
335 | 369 | ||
336 | switch ( cardtype ) | 370 | switch ( cardtype ) |
337 | { | 371 | { |
338 | case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; | 372 | case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; |
339 | case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; | 373 | case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; |
340 | case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; | 374 | case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; |
341 | case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; | 375 | case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; |
342 | case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; | 376 | case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; |
343 | case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; | 377 | case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; |
344 | default: assert( 0 ); // shouldn't reach this | 378 | default: assert( 0 ); // shouldn't reach this |
345 | } | 379 | } |
346 | 380 | ||
347 | // switch device into monitor mode | 381 | // switch device into monitor mode |
348 | if ( cardtype < DEVTYPE_FILE ) | 382 | if ( cardtype < DEVTYPE_FILE ) |
349 | { | 383 | { |
350 | if ( cardtype != DEVTYPE_MANUAL ) | 384 | if ( cardtype != DEVTYPE_MANUAL ) |
351 | iface->setMonitorMode( true ); | 385 | iface->setMonitorMode( true ); |
352 | if ( !iface->monitorMode() ) | 386 | if ( !iface->monitorMode() ) |
353 | { | 387 | { |
354 | QMessageBox::warning( this, "Wellenreiter II", | 388 | QMessageBox::warning( this, "Wellenreiter II", |
355 | tr( "Can't set device into monitor mode." ) ); | 389 | tr( "Can't set device into monitor mode." ) ); |
356 | return; | 390 | return; |
357 | } | 391 | } |
358 | } | 392 | } |
359 | 393 | ||
360 | // open pcap and start sniffing | 394 | // open pcap and start sniffing |
361 | if ( cardtype != DEVTYPE_FILE ) | 395 | if ( cardtype != DEVTYPE_FILE ) |
362 | { | 396 | { |
363 | if ( configwindow->writeCaptureFile->isEnabled() ) //FIXME: bug!? | 397 | if ( configwindow->writeCaptureFile->isEnabled() ) //FIXME: bug!? |
364 | { | 398 | { |
365 | QString dumpname( configwindow->captureFileName->text() ); | 399 | QString dumpname( configwindow->captureFileName->text() ); |
366 | dumpname.append( '-' ); | 400 | dumpname.append( '-' ); |
367 | dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); | 401 | dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); |
368 | dumpname.append( ".wellenreiter" ); | 402 | dumpname.append( ".wellenreiter" ); |
369 | pcap->open( interface, dumpname ); | 403 | pcap->open( interface, dumpname ); |
370 | } | 404 | } |
371 | else | 405 | else |
372 | { | 406 | { |
373 | pcap->open( interface ); | 407 | pcap->open( interface ); |
374 | } | 408 | } |
375 | } | 409 | } |
376 | else | 410 | else |
377 | { | 411 | { |
378 | pcap->open( QFile( interface ) ); | 412 | pcap->open( QFile( interface ) ); |
379 | } | 413 | } |
380 | 414 | ||
381 | if ( !pcap->isOpen() ) | 415 | if ( !pcap->isOpen() ) |
382 | { | 416 | { |
383 | QMessageBox::warning( this, "Wellenreiter II", | 417 | QMessageBox::warning( this, "Wellenreiter II", |
384 | tr( "Can't open packet capturer:\n" ) + QString(strerror( errno ) )); | 418 | tr( "Can't open packet capturer:\n" ) + QString(strerror( errno ) )); |
385 | return; | 419 | return; |
386 | } | 420 | } |
387 | 421 | ||
388 | // set capturer to non-blocking mode | 422 | // set capturer to non-blocking mode |
389 | pcap->setBlocking( false ); | 423 | pcap->setBlocking( false ); |
390 | 424 | ||
391 | // start channel hopper | 425 | // start channel hopper |
392 | if ( cardtype != DEVTYPE_FILE ) | 426 | if ( cardtype != DEVTYPE_FILE ) |
393 | iface->setChannelHopping( 1000 ); //use interval from config window | 427 | iface->setChannelHopping( 1000 ); //use interval from config window |
394 | 428 | ||
395 | if ( cardtype != DEVTYPE_FILE ) | 429 | if ( cardtype != DEVTYPE_FILE ) |
396 | { | 430 | { |
397 | // connect socket notifier and start channel hopper | 431 | // connect socket notifier and start channel hopper |
398 | connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); | 432 | connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); |
399 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | 433 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); |
400 | } | 434 | } |
401 | else | 435 | else |
402 | { | 436 | { |
403 | // start timer for reading packets | 437 | // start timer for reading packets |
404 | startTimer( 100 ); | 438 | startTimer( 100 ); |
405 | } | 439 | } |
406 | 440 | ||
407 | logwindow->log( "(i) Started Scanning." ); | 441 | logwindow->log( "(i) Started Scanning." ); |
408 | sniffing = true; | 442 | sniffing = true; |
409 | emit( startedSniffing() ); | 443 | emit( startedSniffing() ); |
410 | if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title | 444 | if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title |
411 | else | 445 | else |
412 | { | 446 | { |
413 | assert( parent() ); | 447 | assert( parent() ); |
414 | ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); | 448 | ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); |
415 | } | 449 | } |
416 | } | 450 | } |
417 | 451 | ||
418 | 452 | ||
419 | void Wellenreiter::timerEvent( QTimerEvent* ) | 453 | void Wellenreiter::timerEvent( QTimerEvent* ) |
420 | { | 454 | { |
421 | qDebug( "Wellenreiter::timerEvent()" ); | 455 | qDebug( "Wellenreiter::timerEvent()" ); |
422 | OPacket* p = pcap->next(); | 456 | OPacket* p = pcap->next(); |
423 | if ( !p ) // no more packets available | 457 | if ( !p ) // no more packets available |
424 | { | 458 | { |
425 | stopClicked(); | 459 | stopClicked(); |
426 | } | 460 | } |
427 | else | 461 | else |
428 | { | 462 | { |
429 | receivePacket( p ); | 463 | receivePacket( p ); |
430 | delete p; | 464 | delete p; |
431 | } | 465 | } |
432 | } | 466 | } |
433 | 467 | ||
468 | |||
469 | void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* p ) | ||
470 | { | ||
471 | if ( action == "TouchSound" ) | ||
472 | ODevice::inst()->touchSound(); | ||
473 | else if ( action == "AlarmSound" ) | ||
474 | ODevice::inst()->alarmSound(); | ||
475 | else if ( action == "KeySound" ) | ||
476 | ODevice::inst()->keySound(); | ||
477 | else if ( action == "LedOn" ) | ||
478 | ODevice::inst()->setLedState( Led_Mail, Led_On ); | ||
479 | else if ( action == "LedOff" ) | ||
480 | ODevice::inst()->setLedState( Led_Mail, Led_Off ); | ||
481 | else if ( action == "LogMessage" ) | ||
482 | logwindow->log( QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); | ||
483 | else if ( action == "MessageBox" ) | ||
484 | QMessageBox::information ( this, "Notification!", | ||
485 | QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); | ||
486 | } | ||
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h index ea8a692..e227a24 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.h +++ b/noncore/net/wellenreiter/gui/wellenreiter.h | |||
@@ -1,86 +1,89 @@ | |||
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> |
23 | using namespace Opie; | 23 | using namespace Opie; |
24 | #endif | 24 | #endif |
25 | 25 | ||
26 | class QTimerEvent; | 26 | class QTimerEvent; |
27 | class QPixmap; | 27 | class QPixmap; |
28 | class OPacket; | 28 | class OPacket; |
29 | class OWaveLanManagementPacket; | 29 | class OWaveLanManagementPacket; |
30 | class OWaveLanDataPacket; | 30 | class OWaveLanDataPacket; |
31 | class OPacketCapturer; | 31 | class OPacketCapturer; |
32 | class OWirelessNetworkInterface; | 32 | class OWirelessNetworkInterface; |
33 | class ManufacturerDB; | 33 | class ManufacturerDB; |
34 | class WellenreiterConfigWindow; | 34 | class WellenreiterConfigWindow; |
35 | class MLogWindow; | 35 | class MLogWindow; |
36 | class MHexWindow; | 36 | class MHexWindow; |
37 | 37 | ||
38 | class Wellenreiter : public WellenreiterBase { | 38 | class Wellenreiter : public WellenreiterBase { |
39 | Q_OBJECT | 39 | Q_OBJECT |
40 | 40 | ||
41 | public: | 41 | public: |
42 | Wellenreiter( QWidget* parent = 0 ); | 42 | Wellenreiter( QWidget* parent = 0 ); |
43 | ~Wellenreiter(); | 43 | ~Wellenreiter(); |
44 | 44 | ||
45 | void setConfigWindow( WellenreiterConfigWindow* cw ); | 45 | void setConfigWindow( WellenreiterConfigWindow* cw ); |
46 | MScanListView* netView() const { return netview; }; | 46 | MScanListView* netView() const { return netview; }; |
47 | MLogWindow* logWindow() const { return logwindow; }; | 47 | MLogWindow* logWindow() const { return logwindow; }; |
48 | MHexWindow* hexWindow() const { return hexwindow; }; | 48 | MHexWindow* hexWindow() const { return hexwindow; }; |
49 | bool isDaemonRunning() const { return sniffing; }; | 49 | bool isDaemonRunning() const { return sniffing; }; |
50 | 50 | ||
51 | bool sniffing; | 51 | bool sniffing; |
52 | 52 | ||
53 | protected: | 53 | protected: |
54 | virtual void timerEvent( QTimerEvent* ); | 54 | virtual void timerEvent( QTimerEvent* ); |
55 | 55 | ||
56 | public slots: | 56 | public slots: |
57 | void channelHopped(int); | 57 | void channelHopped(int); |
58 | void receivePacket(OPacket*); | 58 | void receivePacket(OPacket*); |
59 | void startClicked(); | 59 | void startClicked(); |
60 | void stopClicked(); | 60 | void stopClicked(); |
61 | 61 | ||
62 | signals: | 62 | signals: |
63 | void startedSniffing(); | 63 | void startedSniffing(); |
64 | void stoppedSniffing(); | 64 | void stoppedSniffing(); |
65 | 65 | ||
66 | private: | 66 | private: |
67 | void handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ); | 67 | void handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ); |
68 | void handleData( OPacket* p, OWaveLanDataPacket* data ); | 68 | void handleData( OPacket* p, OWaveLanDataPacket* data ); |
69 | void handleNotification( OPacket* p ); | ||
70 | void doAction( const QString& action, const QString& protocol, OPacket* p ); | ||
71 | QObject* childIfToParse( OPacket* p, const QString& protocol ); | ||
69 | 72 | ||
70 | private: | 73 | private: |
71 | #ifdef QWS | 74 | #ifdef QWS |
72 | OSystem _system; // Opie Operating System identifier | 75 | OSystem _system; // Opie Operating System identifier |
73 | #endif | 76 | #endif |
74 | 77 | ||
75 | OWirelessNetworkInterface* iface; | 78 | OWirelessNetworkInterface* iface; |
76 | OPacketCapturer* pcap; | 79 | OPacketCapturer* pcap; |
77 | ManufacturerDB* manufacturerdb; | 80 | ManufacturerDB* manufacturerdb; |
78 | WellenreiterConfigWindow* configwindow; | 81 | WellenreiterConfigWindow* configwindow; |
79 | 82 | ||
80 | //void readConfig(); | 83 | //void readConfig(); |
81 | //void writeConfig(); | 84 | //void writeConfig(); |
82 | }; | 85 | }; |
83 | 86 | ||
84 | 87 | ||
85 | 88 | ||
86 | #endif | 89 | #endif |